Package org.adempiere.webui.component
Class WListItemRenderer
java.lang.Object
org.adempiere.webui.component.WListItemRenderer
- All Implemented Interfaces:
org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
,org.zkoss.zul.ListitemRenderer<Object>
,org.zkoss.zul.ListitemRendererExt
- Direct Known Subclasses:
WInfoWindowListItemRenderer
public class WListItemRenderer
extends Object
implements org.zkoss.zul.ListitemRenderer<Object>, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>, org.zkoss.zul.ListitemRendererExt
- Author:
- Andrew Kimball
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Column Comparator implementation -
Field Summary
Modifier and TypeFieldDescriptionstatic String
protected ArrayList<TableValueChangeListener>
Array of listeners for changes in the table components.Fields inherited from interface org.zkoss.zul.ListitemRendererExt
DETACH_ON_RENDER
-
Constructor Summary
ConstructorDescriptionDefault constructor.WListItemRenderer
(List<? extends String> columnNames) Constructor specifying the column headers. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add columnvoid
Add columnvoid
Add Table Column.void
Add a listener for changes in the table's component values.void
Reset the renderer.void
Clear selectionsprotected org.zkoss.zul.Listcell
getCellComponent
(WListbox table, Object value, int rowIndex, int columnIndex) Create cell for the givenvalue
.getColumn
(int columnIndex) Get column details of specifiedcolumn
.protected Comparator<Object>
getColumnComparator
(boolean ascending, int columnIndex) Create comparator for a given column.protected int
getColumnPosition
(org.zkoss.zk.ui.Component source) Get the column index of the givensource
component.int
getListHeader
(int index) get list headerint
Get the number of columns.protected int
getRowPosition
(org.zkoss.zk.ui.Component source) Get the row index of the givensource
component.org.zkoss.zul.Listcell
newListcell
(org.zkoss.zul.Listitem item) org.zkoss.zul.Listitem
newListitem
(org.zkoss.zul.Listbox listbox) void
onEvent
(org.zkoss.zk.ui.event.Event event) void
Remove listenervoid
void
renderListHead
(ListHead head) Render column headersvoid
setColumnClass
(int index, Class<?> classType) Set column typevoid
setColumnHeader
(int index, String header) Set column header textvoid
setListHeader
(int index, ListHeader header) set custom list headervoid
Deprecated, for removal: This API element is subject to removal in a future version.void
updateColumn
(int index, String header) Update header of a Column.
-
Field Details
-
m_listeners
Array of listeners for changes in the table components. -
iconPrefix
-
-
Constructor Details
-
WListItemRenderer
public WListItemRenderer()Default constructor. -
WListItemRenderer
Constructor specifying the column headers.- Parameters:
columnNames
- List of column headers.
-
-
Method Details
-
getColumn
Get column details of specifiedcolumn
.- Parameters:
columnIndex
- The index of the column for which details are to be retrieved.- Returns:
- The details of the column at the specified index.
-
render
-
getCellComponent
protected org.zkoss.zul.Listcell getCellComponent(WListbox table, Object value, int rowIndex, int columnIndex) Create cell for the givenvalue
.- Parameters:
table
- The table into which the cell will be placed.value
- Value for which the cell is to be created.rowIndex
- The row in which the cell is to be placed.columnIndex
- The column in which the cell is to be placed.- Returns:
- The list cell component.
-
updateColumn
Update header of a Column.- Parameters:
index
- The index of the column to updateheader
- The header text for the column
-
addColumn
Add column- Parameters:
header
-
-
addColumn
Add column- Parameters:
header
-description
-
-
addColumn
Add Table Column.- Parameters:
header
- The header text for the columndescription
-AD_Reference_ID
-
-
getNoColumns
public int getNoColumns()Get the number of columns.- Returns:
- the number of columns
-
setRO
Deprecated, for removal: This API element is subject to removal in a future version.This is unused. The readonly property of a column should be set in the parent table.- Parameters:
colIndex
-readOnly
-
-
setListHeader
set custom list header- Parameters:
index
- index of columnheader
- ListHeader
-
getListHeader
get list header- Parameters:
index
- index of column- Returns:
- ListHeader
-
getColumnComparator
Create comparator for a given column.- Parameters:
ascending
- whether the comparator will sort ascendingcolumnIndex
- the index of column- Returns:
- comparator for the given column for the given sort direction
-
renderListHead
Render column headers- Parameters:
head
- The ListHead component to render.- See Also:
-
onEvent
- Specified by:
onEvent
in interfaceorg.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
- Throws:
Exception
-
getRowPosition
protected int getRowPosition(org.zkoss.zk.ui.Component source) Get the row index of the givensource
component.- Parameters:
source
- The component for which the row index is to be found.- Returns:
- The row index of the given component or -1 if not found.
-
getColumnPosition
protected int getColumnPosition(org.zkoss.zk.ui.Component source) Get the column index of the givensource
component.- Parameters:
source
- The component for which the column index is to be found.- Returns:
- The column index of the given component.
-
clearColumns
public void clearColumns()Reset the renderer. This should be called if the table using this renderer is cleared. -
clearSelection
public void clearSelection()Clear selections -
addTableValueChangeListener
Add a listener for changes in the table's component values.- Parameters:
listener
- The listener to add.
-
removeTableValueChangeListener
Remove listener- Parameters:
listener
-
-
getControls
public int getControls()- Specified by:
getControls
in interfaceorg.zkoss.zul.ListitemRendererExt
-
newListcell
public org.zkoss.zul.Listcell newListcell(org.zkoss.zul.Listitem item) - Specified by:
newListcell
in interfaceorg.zkoss.zul.ListitemRendererExt
-
newListitem
public org.zkoss.zul.Listitem newListitem(org.zkoss.zul.Listbox listbox) - Specified by:
newListitem
in interfaceorg.zkoss.zul.ListitemRendererExt
-
setColumnHeader
Set column header text- Parameters:
index
-header
-
-
setColumnClass
Set column type- Parameters:
index
- index of columnclassType
- Class Type of column
-
getTableColumns
- Returns:
- Unmodifiable list of
WTableColumn
-