Package org.adempiere.webui.component
Class ListModelTable
- java.lang.Object
-
- org.zkoss.zul.AbstractListModel<E>
-
- org.zkoss.zul.ListModelList<Object>
-
- org.adempiere.webui.component.ListModelTable
-
- All Implemented Interfaces:
Serializable
,Iterable<Object>
,Collection<Object>
,List<Object>
,org.zkoss.zul.ext.Pageable
,org.zkoss.zul.ext.Selectable<Object>
,org.zkoss.zul.ext.Sortable<Object>
,org.zkoss.zul.ListModel<Object>
,org.zkoss.zul.PageableModel
public class ListModelTable extends org.zkoss.zul.ListModelList<Object> implements org.zkoss.zul.ext.Sortable<Object>
This is a ListModel- Author:
- Andrew Kimball
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.zkoss.zul.AbstractListModel
org.zkoss.zul.AbstractListModel.DefaultSelectionControl<E extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description protected ArrayList<WTableModelListener>
m_listeners
Array of listeners to changes in the table model.
-
Constructor Summary
Constructors Constructor Description ListModelTable()
Default constructor.ListModelTable(Collection<?> collection)
Construct the ListModel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColumn()
Add a column to the model.void
addTableModelListener(WTableModelListener listener)
Add a listener for events from the data model.Object
getDataAt(int rowIndex, int columnIndex)
Returns the cell value atrowIndex
andcolumnIndex
.int
getNoColumns()
Query thenumber of columns in the table.int
getNoRows()
Query the number of rows in the table.int
getRowCount()
alias for getSize, to ease porting of swing formObject
getValueAt(int rowIndex, int columnIndex)
alias for getDataAt, to ease porting of swing formvoid
removeTableModelListener(WTableModelListener listener)
void
setDataAt(Object aValue, int row, int col)
Set the cell value atrow
andcolumn
.void
setNoColumns(int columns)
Set the number of columns that the table is to contain.void
setNoRows(int rowCount)
Set the number of rows in the table and initialise new rows.void
setSorter(org.zkoss.zul.ext.Sortable<Object> lme)
void
setValueAt(Object value, int row, int col)
alias for setDataAt, to ease porting of swing formvoid
sort(Comparator<Object> cmpr, boolean ascending)
void
updateComponent(int row)
Request components that attached to this model to re-render a row.void
updateComponent(int fromRow, int toRow)
Request components that attached to this model to re-render a range of row.-
Methods inherited from class org.zkoss.zul.ListModelList
add, add, addAll, addAll, addSelection, clear, clone, contains, containsAll, equals, fireSelectionEvent, get, getElementAt, getInnerList, getSize, getSortDirection, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, notifyChange, remove, remove, removeAll, removeRange, removeSelection, retainAll, set, size, sort, subList, toArray, toArray, toString
-
Methods inherited from class org.zkoss.zul.AbstractListModel
addListDataListener, addPagingEventListener, addToSelection, clearSelection, fireEvent, getActivePage, getPageCount, getPageSize, getSelection, getSelectionControl, isMultiple, isSelected, isSelectionEmpty, newEmptySelection, readSelection, removeAllSelection, removeFromSelection, removeListDataListener, removePagingEventListener, retainAllSelection, setActivePage, setMultiple, setPageSize, setSelection, setSelectionControl, writeSelection
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
-
-
-
Field Detail
-
m_listeners
protected ArrayList<WTableModelListener> m_listeners
Array of listeners to changes in the table model.
-
-
Constructor Detail
-
ListModelTable
public ListModelTable()
Default constructor.
-
ListModelTable
public ListModelTable(Collection<?> collection)
Construct the ListModel- Parameters:
collection
- The collection of objects with which to initialise the list
-
-
Method Detail
-
getNoColumns
public int getNoColumns()
Query thenumber of columns in the table.- Returns:
- the number of columns in the table. 0 if uninitialised.
-
addColumn
public void addColumn()
Add a column to the model.
-
setNoColumns
public void setNoColumns(int columns)
Set the number of columns that the table is to contain.- Parameters:
columns
- The number of columns.
-
getNoRows
public int getNoRows()
Query the number of rows in the table.- Returns:
- the number of rows in the table
-
getDataAt
public Object getDataAt(int rowIndex, int columnIndex)
Returns the cell value atrowIndex
andcolumnIndex
.- Parameters:
rowIndex
- the index of the row whose value is to be queriedcolumnIndex
- the index of the column whose value is to be queried- Returns:
- The object stored at the specified position
-
setDataAt
public void setDataAt(Object aValue, int row, int col)
Set the cell value atrow
andcolumn
.- Parameters:
aValue
- The value to setrow
- the index of the row whose value is to be setcol
- the index of the column whose value is to be set
-
setNoRows
public void setNoRows(int rowCount)
Set the number of rows in the table and initialise new rows. For each new row, an empty collection of the size specified bysetNoColumns(int)
is created.- Parameters:
rowCount
- The number of rows to be contained in the table
-
addTableModelListener
public void addTableModelListener(WTableModelListener listener)
Add a listener for events from the data model. The listener will only be added if it doesn't already exist.- Parameters:
listener
- A listener for changes in the table mode
-
removeTableModelListener
public void removeTableModelListener(WTableModelListener listener)
-
sort
public void sort(Comparator<Object> cmpr, boolean ascending)
-
getValueAt
public Object getValueAt(int rowIndex, int columnIndex)
alias for getDataAt, to ease porting of swing form- Parameters:
rowIndex
-columnIndex
-- Returns:
- column value
-
setValueAt
public void setValueAt(Object value, int row, int col)
alias for setDataAt, to ease porting of swing form- Parameters:
value
-row
-col
-
-
getRowCount
public int getRowCount()
alias for getSize, to ease porting of swing form- Returns:
- size
-
updateComponent
public void updateComponent(int row)
Request components that attached to this model to re-render a row.- Parameters:
row
-
-
updateComponent
public void updateComponent(int fromRow, int toRow)
Request components that attached to this model to re-render a range of row.- Parameters:
fromRow
-toRow
-
-
setSorter
public void setSorter(org.zkoss.zul.ext.Sortable<Object> lme)
-
-