Adempiere 3.5.2a

org.adempiere.webui.component
Class WListItemRenderer

java.lang.Object
  extended by org.adempiere.webui.component.WListItemRenderer
All Implemented Interfaces:
EventListener, ListitemRenderer, ListitemRendererExt

public class WListItemRenderer
extends Object
implements ListitemRenderer, EventListener, ListitemRendererExt

Renderer for org.adempiere.webui.component.ListItems for the Listbox.

Author:
Andrew Kimball

Field Summary
protected  ArrayList<TableValueChangeListener> m_listeners
          Array of listeners for changes in the table components.
 
Fields inherited from interface org.zkoss.zul.ListitemRendererExt
DETACH_ON_RENDER, DETACH_ON_UNLOAD, RETAIN_CELLS_ON_UNLOAD
 
Constructor Summary
WListItemRenderer()
          Default constructor.
WListItemRenderer(Vector<? extends String> columnNames)
          Constructor specifying the column headers.
 
Method Summary
 void addColumn(String header)
          Add Table Column.
 void addTableValueChangeListener(TableValueChangeListener listener)
          Add a listener for changes in the table's component values.
 void clearColumns()
          Reset the renderer.
 void clearSelection()
          Clear the renderer.
protected  Comparator getColumnComparator(boolean ascending, int columnIndex)
          Obtain the comparator for a given column.
protected  int getColumnPosition(Component source)
          Get the column index of the given source component.
 int getControls()
           
 int getNoColumns()
          Get the number of columns.
protected  int getRowPosition(Component source)
          Get the row index of the given source component.
 Listcell newListcell(Listitem item)
           
 Listitem newListitem(Listbox listbox)
           
 void onEvent(Event event)
           
 void render(Listitem item, Object data)
           
 void renderListHead(ListHead head)
          Render the ListHead for the table with headers for the table columns.
 void setRO(int colIndex, Boolean readOnly)
          Deprecated.  
 void updateColumn(int index, String header)
          Update Table Column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_listeners

protected ArrayList<TableValueChangeListener> m_listeners
Array of listeners for changes in the table components.

Constructor Detail

WListItemRenderer

public WListItemRenderer()
Default constructor.


WListItemRenderer

public WListItemRenderer(Vector<? extends String> columnNames)
Constructor specifying the column headers.

Parameters:
columnNames - vector of column titles.
Method Detail

render

public void render(Listitem item,
                   Object data)
            throws Exception
Specified by:
render in interface ListitemRenderer
Throws:
Exception

updateColumn

public void updateColumn(int index,
                         String header)
Update Table Column.

Parameters:
index - The index of the column to update
header - The header text for the column

addColumn

public void addColumn(String header)
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 column

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 -

getColumnComparator

protected Comparator getColumnComparator(boolean ascending,
                                         int columnIndex)
Obtain the comparator for a given column.

Parameters:
ascending - whether the comparator will sort ascending
columnIndex - 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(Vector)

onEvent

public void onEvent(Event event)
             throws Exception
Specified by:
onEvent in interface EventListener
Throws:
Exception

getRowPosition

protected int getRowPosition(Component source)
Get the row index of the given source component.

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(Component source)
Get the column index of the given source 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 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.

getControls

public int getControls()
Specified by:
getControls in interface ListitemRendererExt

newListcell

public Listcell newListcell(Listitem item)
Specified by:
newListcell in interface ListitemRendererExt

newListitem

public Listitem newListitem(Listbox listbox)
Specified by:
newListitem in interface ListitemRendererExt

Adempiere 3.5.2a

Adempiere® is a registered trademark of ADempiere Business Inc. ©2004-2008 HumanFlash.com All rights reserved.