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>
ListModel
- Author:
- Andrew Kimball
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zul.AbstractListModel
org.zkoss.zul.AbstractListModel.DefaultSelectionControl<E extends Object>
-
Field Summary
Modifier and TypeFieldDescriptionprotected ArrayList<WTableModelListener>
Array of listeners to changes in the table model.Fields inherited from class org.zkoss.zul.ListModelList
_list
Fields inherited from class org.zkoss.zul.AbstractListModel
_selection
Fields inherited from interface org.zkoss.zul.PageableModel
INTERNAL_EVENT
-
Constructor Summary
ConstructorDescriptionDefault constructor.ListModelTable
(Collection<?> collection) Construct the ListModel -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a column to the model.void
addTableModelListener
(WTableModelListener listener) Add a listener for events from the data model.getDataAt
(int rowIndex, int columnIndex) Returns the cell value atrowIndex
andcolumnIndex
.int
Get the number of columns in the table.int
Get the number of rows in the table.int
alias for getSize, to ease porting of swing formgetValueAt
(int rowIndex, int columnIndex) alias for getDataAt, to ease porting of swing formvoid
removeTableModelListener
(WTableModelListener listener) Remove WTableModelListener listenervoid
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 (if necessary).
For each new row, an empty collection of the size specified bysetNoColumns(int)
is created.void
Set custom sorter for modelvoid
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
Methods inherited from interface org.zkoss.zul.ext.Sortable
getSortDirection, sort
-
Field Details
-
m_listeners
Array of listeners to changes in the table model.
-
-
Constructor Details
-
ListModelTable
public ListModelTable()Default constructor. -
ListModelTable
Construct the ListModel- Parameters:
collection
- The collection of objects with which to initialise the list
-
-
Method Details
-
getNoColumns
public int getNoColumns()Get the number 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()Get the number of rows in the table.- Returns:
- the number of rows in the table
-
getDataAt
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
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 (if necessary).
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
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
Remove WTableModelListener listener- Parameters:
listener
-
-
sort
-
getValueAt
alias for getDataAt, to ease porting of swing form- Parameters:
rowIndex
-columnIndex
-- Returns:
- column value
-
setValueAt
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
Set custom sorter for model- Parameters:
lme
- Custom Sortable implementation
-