to.etc.domui.component.tbl
Class AbstractRowRenderer<T>

java.lang.Object
  extended by to.etc.domui.component.tbl.AbstractRowRenderer<T>
Direct Known Subclasses:
BasicRowRenderer, SimpleRowRenderer

public class AbstractRowRenderer<T>
extends java.lang.Object


Field Summary
protected  java.util.List<SimpleColumnDef> m_columnList
           
 
Constructor Summary
AbstractRowRenderer(java.lang.Class<T> data)
           
AbstractRowRenderer(java.lang.Class<T> data, ClassMetaModel cmm)
           
 
Method Summary
 void beforeQuery(TableModelTableBase<T> tbl)
          This gets called by the data table component just before it starts to render a new page.
protected  void check()
          Throws an exception if this renderer has been completed and is unmutable.
protected  void complete(TableModelTableBase<T> tbl)
          Complete this object if it is not already complete (internal).
protected  java.lang.Class<?> getActualClass()
          Returns the record type being rendered.
 ICellClicked<?> getCellClicked(int col)
          Get the cell clicked handler for the specified column.
 SimpleColumnDef getColumn(int ix)
          Return the definition for the nth column.
 SimpleColumnDef getColumnByName(java.lang.String propertyName)
          Find a column by the property it is displaying.
 int getColumnCount()
          Return the #of columns in this renderer.
 INodeContentRenderer<?> getNodeRenderer(int index)
          Convenience method to get the column's cell renderer; replacement for getColumn(index).getRenderer().
 IRowButtonFactory<T> getRowButtonFactory()
           
 ICellClicked<?> getRowClicked()
          When set each row will be selectable (will react when the mouse hovers over it), and when clicked will call this handler.
protected  SimpleColumnDef getSortColumn()
           
 java.lang.String getUnknownColumnCaption()
           
protected  boolean isComplete()
          Check if this object is used (completed) and thereby unmodifyable (internal).
protected  ClassMetaModel model()
          Returns the metamodel used.
protected
<X> void
renderColumn(TableModelTableBase<T> tbl, ColumnContainer<T> cc, int index, T instance, SimpleColumnDef cd)
          Render a single column fully.
 void renderHeader(TableModelTableBase<T> tbl, HeaderContainer<T> cc)
          Render the header for a table, using the simple column metadata provided.
 void renderRow(TableModelTableBase<T> tbl, ColumnContainer<T> cc, int index, T instance)
           
 void setCellClicked(int col, ICellClicked<?> cellClicked)
          Set the cell clicked handler for the specified column.
 void setColumnWidth(int index, java.lang.String width)
          Convenience method to set the column width; replacement for getColumn(index).setWidth().
 void setColumnWidths(java.lang.String... widths)
          Quickly set the widths of all columns in the same order as defined.
 void setNodeRenderer(int index, INodeContentRenderer<?> renderer)
          Convenience method to set the column's cell renderer; replacement for getColumn(index).setRenderer().
 void setRowButtonFactory(IRowButtonFactory<T> rowButtonFactory)
           
 void setRowClicked(ICellClicked<?> rowClicked)
          When set each row will be selectable (will react when the mouse hovers over it), and when clicked will call this handler.
protected  void setSortColumn(SimpleColumnDef cd)
           
 void setUnknownColumnCaption(java.lang.String unknownColumnCaption)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_columnList

protected final java.util.List<SimpleColumnDef> m_columnList
Constructor Detail

AbstractRowRenderer

public AbstractRowRenderer(java.lang.Class<T> data)

AbstractRowRenderer

public AbstractRowRenderer(java.lang.Class<T> data,
                           ClassMetaModel cmm)
Method Detail

model

protected ClassMetaModel model()
Returns the metamodel used.

Returns:

getActualClass

protected java.lang.Class<?> getActualClass()
Returns the record type being rendered.

Returns:

check

protected void check()
Throws an exception if this renderer has been completed and is unmutable.


complete

protected void complete(TableModelTableBase<T> tbl)
Complete this object if it is not already complete (internal).


isComplete

protected boolean isComplete()
Check if this object is used (completed) and thereby unmodifyable (internal).

Returns:

setSortColumn

protected void setSortColumn(SimpleColumnDef cd)

getSortColumn

protected SimpleColumnDef getSortColumn()

getColumn

public SimpleColumnDef getColumn(int ix)
Return the definition for the nth column. You can change the column's definition there.

Parameters:
ix -
Returns:

getColumnCount

public int getColumnCount()
Return the #of columns in this renderer.

Returns:

getColumnByName

public SimpleColumnDef getColumnByName(java.lang.String propertyName)
Find a column by the property it is displaying. This only works for that kind of columns, and will not work for any joined columns defined from metadata. If no column exists for the specified property this will throw an exception.

Parameters:
propertyName -
Returns:

setColumnWidths

public void setColumnWidths(java.lang.String... widths)
Quickly set the widths of all columns in the same order as defined.

Parameters:
widths -

setColumnWidth

public void setColumnWidth(int index,
                           java.lang.String width)
Convenience method to set the column width; replacement for getColumn(index).setWidth().

Parameters:
index -
width -

setNodeRenderer

public void setNodeRenderer(int index,
                            INodeContentRenderer<?> renderer)
Convenience method to set the column's cell renderer; replacement for getColumn(index).setRenderer().

Parameters:
index -
renderer -

getNodeRenderer

public INodeContentRenderer<?> getNodeRenderer(int index)
Convenience method to get the column's cell renderer; replacement for getColumn(index).getRenderer().

Parameters:
index -
Returns:

getRowClicked

public ICellClicked<?> getRowClicked()
When set each row will be selectable (will react when the mouse hovers over it), and when clicked will call this handler.

Returns:

setRowClicked

public void setRowClicked(ICellClicked<?> rowClicked)
When set each row will be selectable (will react when the mouse hovers over it), and when clicked will call this handler.

Parameters:
rowClicked -

getCellClicked

public ICellClicked<?> getCellClicked(int col)
Get the cell clicked handler for the specified column. Convenience method for getColumn(col).getCellClicked().

Parameters:
col -
Returns:

setCellClicked

public void setCellClicked(int col,
                           ICellClicked<?> cellClicked)
Set the cell clicked handler for the specified column. Convenience method for getColumn(col).setCellClicked().

Parameters:
col -
cellClicked -

renderHeader

public void renderHeader(TableModelTableBase<T> tbl,
                         HeaderContainer<T> cc)
                  throws java.lang.Exception
Render the header for a table, using the simple column metadata provided. This renders a rich header, containing column labels, sort boxes and the like.

Throws:
java.lang.Exception
See Also:
to.etc.domui.component.tbl.IRowRenderer#renderHeader(to.etc.domui.component.tbl.HeaderContainer)

beforeQuery

public void beforeQuery(TableModelTableBase<T> tbl)
                 throws java.lang.Exception
This gets called by the data table component just before it starts to render a new page. When called the query has not yet been done and nothing is rendered for this object. This exposes the actual model that will be used during the rendering process and allows this component to define sorting, if needed.

Throws:
java.lang.Exception
See Also:
to.etc.domui.component.tbl.IRowRenderer#beforeQuery(to.etc.domui.component.tbl.DataTable)

renderRow

public void renderRow(TableModelTableBase<T> tbl,
                      ColumnContainer<T> cc,
                      int index,
                      T instance)
               throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
to.etc.domui.component.tbl.IRowRenderer#renderRow(to.etc.domui.component.tbl.ColumnContainer, int, java.lang.Object)

renderColumn

protected <X> void renderColumn(TableModelTableBase<T> tbl,
                                ColumnContainer<T> cc,
                                int index,
                                T instance,
                                SimpleColumnDef cd)
                     throws java.lang.Exception
Render a single column fully.

Parameters:
tbl -
cc -
index -
instance -
cd -
Throws:
java.lang.Exception

getRowButtonFactory

public IRowButtonFactory<T> getRowButtonFactory()

setRowButtonFactory

public void setRowButtonFactory(IRowButtonFactory<T> rowButtonFactory)

setUnknownColumnCaption

public void setUnknownColumnCaption(java.lang.String unknownColumnCaption)

getUnknownColumnCaption

public java.lang.String getUnknownColumnCaption()