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
Nested Classes Modifier and Type Class Description static classWListItemRenderer.ColumnComparator
-
Field Summary
Fields Modifier and Type Field Description protected ArrayList<TableValueChangeListener>m_listenersArray of listeners for changes in the table components.
-
Constructor Summary
Constructors Constructor Description WListItemRenderer()Default constructor.WListItemRenderer(List<? extends String> columnNames)Constructor specifying the column headers.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddColumn(String header)voidaddColumn(String header, String description)voidaddColumn(String header, String description, int AD_Reference_ID)Add Table Column.voidaddTableValueChangeListener(TableValueChangeListener listener)Add a listener for changes in the table's component values.voidclearColumns()Reset the renderer.voidclearSelection()Clear the renderer.protected org.zkoss.zul.ListcellgetCellComponent(WListbox table, Object field, int rowIndex, int columnIndex)Generate the cell for the givenfield.protected Comparator<Object>getColumnComparator(boolean ascending, int columnIndex)Obtain the comparator for a given column.protected intgetColumnPosition(org.zkoss.zk.ui.Component source)Get the column index of the givensourcecomponent.intgetControls()intgetNoColumns()Get the number of columns.protected intgetRowPosition(org.zkoss.zk.ui.Component source)Get the row index of the givensourcecomponent.List<WTableColumn>getTableColumns()org.zkoss.zul.ListcellnewListcell(org.zkoss.zul.Listitem item)org.zkoss.zul.ListitemnewListitem(org.zkoss.zul.Listbox listbox)voidonEvent(org.zkoss.zk.ui.event.Event event)voidremoveTableValueChangeListener(TableValueChangeListener listener)voidrender(org.zkoss.zul.Listitem item, Object data, int index)voidrenderListHead(ListHead head)Render the ListHead for the table with headers for the table columns.voidsetColumnClass(int index, Class<?> classType)voidsetColumnHeader(int index, String header)voidsetListHeader(int index, ListHeader header)set custom list headervoidsetRO(int colIndex, Boolean readOnly)Deprecated.voidupdateColumn(int index, String header)Update Table Column.
-
-
-
Field Detail
-
m_listeners
protected ArrayList<TableValueChangeListener> m_listeners
Array of listeners for changes in the table components.
-
-
Method Detail
-
getCellComponent
protected org.zkoss.zul.Listcell getCellComponent(WListbox table, Object field, int rowIndex, int columnIndex)
Generate the cell for the givenfield.- Parameters:
table- The table into which the cell will be placed.field- The data field 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
public void updateColumn(int index, String header)Update Table Column.- Parameters:
index- The index of the column to updateheader- The header text for the column
-
addColumn
public void addColumn(String header)
- Parameters:
header-
-
addColumn
public void addColumn(String header, String description, int AD_Reference_ID)
Add Table Column. after adding a column, you need to set the column classes again (DefaultTableModel fires TableStructureChanged, which calls JTable.tableChanged .. createDefaultColumnsFromModel- Parameters:
header- The header text for the columndescription-
-
getNoColumns
public int getNoColumns()
Get the number of columns.- Returns:
- the number of columns
-
setRO
public void setRO(int colIndex, Boolean readOnly)Deprecated.This is unused. The readonly proprty of a column should be set in the parent table.- Parameters:
colIndex-readOnly-
-
setListHeader
public void setListHeader(int index, ListHeader header)set custom list header- Parameters:
index-header-
-
getColumnComparator
protected Comparator<Object> getColumnComparator(boolean ascending, int columnIndex)
Obtain the comparator for a given column.- Parameters:
ascending- whether the comparator will sort ascendingcolumnIndex- the index of the column for which the comparator is required- Returns:
- comparator for the given column for the given direction
-
renderListHead
public void renderListHead(ListHead head)
Render the ListHead for the table with headers for the table columns.- Parameters:
head- The ListHead component to render.- See Also:
addColumn(String),WListItemRenderer(List)
-
onEvent
public void onEvent(org.zkoss.zk.ui.event.Event event) throws Exception- Specified by:
onEventin 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 givensourcecomponent.- Parameters:
source- The component for which the row index is to be found.- Returns:
- The row index of the given component.
-
getColumnPosition
protected int getColumnPosition(org.zkoss.zk.ui.Component source)
Get the column index of the givensourcecomponent.- 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 the renderer. This should be called if the table using this renderer is cleared.
-
addTableValueChangeListener
public void addTableValueChangeListener(TableValueChangeListener listener)
Add a listener for changes in the table's component values.- Parameters:
listener- The listener to add.
-
removeTableValueChangeListener
public void removeTableValueChangeListener(TableValueChangeListener listener)
-
getControls
public int getControls()
- Specified by:
getControlsin interfaceorg.zkoss.zul.ListitemRendererExt
-
newListcell
public org.zkoss.zul.Listcell newListcell(org.zkoss.zul.Listitem item)
- Specified by:
newListcellin interfaceorg.zkoss.zul.ListitemRendererExt
-
newListitem
public org.zkoss.zul.Listitem newListitem(org.zkoss.zul.Listbox listbox)
- Specified by:
newListitemin interfaceorg.zkoss.zul.ListitemRendererExt
-
setColumnHeader
public void setColumnHeader(int index, String header)- Parameters:
index-header-
-
setColumnClass
public void setColumnClass(int index, Class<?> classType)
-
getTableColumns
public List<WTableColumn> getTableColumns()
-
-