com.tonbeller.wcf.table
Class TableComponent

java.lang.Object
  extended bycom.tonbeller.wcf.component.ComponentSupport
      extended bycom.tonbeller.wcf.component.NestableComponentSupport
          extended bycom.tonbeller.wcf.table.TableComponent
All Implemented Interfaces:
Bookmarkable, Component, java.util.EventListener, Form, FormListener, javax.servlet.http.HttpSessionBindingListener, ITableComponent, LifeCycle, NestableComponent, Renderable, RequestListener, RoleExprHolder, Visible

public class TableComponent
extends NestableComponentSupport
implements ITableComponent

The main class for the table.


Field Summary
 
Fields inherited from interface com.tonbeller.wcf.bookmarks.Bookmarkable
EXTENSIONAL, INTENSIONAL
 
Constructor Summary
TableComponent(java.lang.String id, Component parent)
          creates a Table component that is initially hidden.
TableComponent(java.lang.String id, Component parent, TableModel model)
           
 
Method Summary
 java.lang.String getBorder()
          gets the border attribute of the generated table.
 int getCurrentPage()
           
 TableModel getModel()
          the underlying data model w/o sort/paging decorators
 int getPageCount()
           
 int getPageSize()
           
 java.lang.String getRenderId()
          gets the renderId attribute of the generated table.
 com.tonbeller.wcf.table.RowComparator getRowComparator()
           
 SelectionModel getSelectionModel()
          the current selection
 TableColumn getTableColumn(int columnIndex)
          column metadata
 TableColumn[] getTableColumns()
           
 java.lang.String getTd()
           
 java.lang.String getTh()
           
 java.lang.String getTr()
           
 void initialize(RequestContext context)
          initializes the component.
 boolean isClosable()
          shall this table have a close button?
 boolean isColHeaders()
           
 boolean isPageable()
          allows to enable/disable paging of rows
 boolean isReadOnly()
          user may view data but not change the selection
 boolean isSortable()
          allows to enable/disable sorting of columns
 org.w3c.dom.Element render(RequestContext context, org.w3c.dom.Document factory)
          returns an Element with ownerDocument == factory.
 void setBorder(java.lang.String border)
          sets the border attribute of the generated table.
 void setClosable(boolean b)
          shall this table have a close button?
 void setColHeaders(boolean title)
           
 void setCurrentPage(int newCurrentPage)
           
 void setError(java.lang.String message)
          sets the error message to display
 void setModel(TableModel newModel)
          set the data model and initializes everything
 void setPageable(boolean newPageable)
          allows to enable/disable paging of rows
 void setPageSize(int newPageSize)
           
 void setReadOnly(boolean readOnly)
          user may view data but not change the selection
 void setRenderId(java.lang.String renderId)
          sets the renderId attribute of the generated table.
 void setSelectionModel(SelectionModel selectionModel)
          the current selection
 void setSortable(boolean newSortable)
          allows to enable/disable sorting of columns
 void setSortColumnIndex(int index)
          set the current sort column
 void setTableColumn(int columnIndex, TableColumn tableColumn)
          column metadata
 void setTd(java.lang.String newTd)
           
 void setTh(java.lang.String newTh)
           
 void setTr(java.lang.String newTr)
           
 void setWidth(java.lang.String width)
          sets the width attribute of the generated table.
 
Methods inherited from class com.tonbeller.wcf.component.NestableComponentSupport
render
 
Methods inherited from class com.tonbeller.wcf.component.ComponentSupport
addFormListener, destroy, getBookmarkState, getDispatcher, getForm, getId, getLocale, getNextView, getParent, getRoleExpr, isAutoValidate, isListeningTo, isVisible, removeFormListener, request, revert, setAutoValidate, setBookmarkState, setId, setNextView, setParent, setRoleExpr, setVisible, validate, valueBound, valueUnbound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tonbeller.wcf.component.Component
getParent, isListeningTo, setNextView
 
Methods inherited from interface com.tonbeller.wcf.controller.RequestListener
request
 
Methods inherited from interface com.tonbeller.wcf.component.Renderable
render
 
Methods inherited from interface com.tonbeller.wcf.component.FormListener
revert, validate
 
Methods inherited from interface com.tonbeller.wcf.component.Visible
isVisible, setVisible
 
Methods inherited from interface com.tonbeller.wcf.component.LifeCycle
destroy
 

Constructor Detail

TableComponent

public TableComponent(java.lang.String id,
                      Component parent,
                      TableModel model)

TableComponent

public TableComponent(java.lang.String id,
                      Component parent)
creates a Table component that is initially hidden. It must be assigned a TableModel before it may set visible or used in another way

Parameters:
id - - id of session attribute
See Also:
setModel(com.tonbeller.wcf.table.TableModel)
Method Detail

initialize

public void initialize(RequestContext context)
                throws java.lang.Exception
Description copied from interface: LifeCycle
initializes the component. Called once after construction.

Specified by:
initialize in interface LifeCycle
Overrides:
initialize in class ComponentSupport
Throws:
java.lang.Exception
See Also:
ComponentSupport.destroy(javax.servlet.http.HttpSession), ComponentSupport.valueBound(javax.servlet.http.HttpSessionBindingEvent), ComponentTag.doEndTag()

getTableColumn

public TableColumn getTableColumn(int columnIndex)
column metadata


setTableColumn

public void setTableColumn(int columnIndex,
                           TableColumn tableColumn)
column metadata


setModel

public void setModel(TableModel newModel)
set the data model and initializes everything

Specified by:
setModel in interface ITableComponent

getModel

public TableModel getModel()
the underlying data model w/o sort/paging decorators

Specified by:
getModel in interface ITableComponent

setSelectionModel

public void setSelectionModel(SelectionModel selectionModel)
the current selection

Specified by:
setSelectionModel in interface ITableComponent

getSelectionModel

public SelectionModel getSelectionModel()
the current selection

Specified by:
getSelectionModel in interface ITableComponent

setSortable

public void setSortable(boolean newSortable)
allows to enable/disable sorting of columns

Specified by:
setSortable in interface ITableComponent

isSortable

public boolean isSortable()
allows to enable/disable sorting of columns

Specified by:
isSortable in interface ITableComponent

setPageable

public void setPageable(boolean newPageable)
allows to enable/disable paging of rows

Specified by:
setPageable in interface ITableComponent

isPageable

public boolean isPageable()
allows to enable/disable paging of rows

Specified by:
isPageable in interface ITableComponent

setSortColumnIndex

public void setSortColumnIndex(int index)
set the current sort column

Specified by:
setSortColumnIndex in interface ITableComponent

getRowComparator

public com.tonbeller.wcf.table.RowComparator getRowComparator()
Specified by:
getRowComparator in interface ITableComponent

getPageSize

public int getPageSize()
Specified by:
getPageSize in interface ITableComponent

setPageSize

public void setPageSize(int newPageSize)
Specified by:
setPageSize in interface ITableComponent

getCurrentPage

public int getCurrentPage()
Specified by:
getCurrentPage in interface ITableComponent

setCurrentPage

public void setCurrentPage(int newCurrentPage)
Specified by:
setCurrentPage in interface ITableComponent

getPageCount

public int getPageCount()
Specified by:
getPageCount in interface ITableComponent

render

public org.w3c.dom.Element render(RequestContext context,
                                  org.w3c.dom.Document factory)
                           throws java.lang.Exception
Description copied from interface: NestableComponent
returns an Element with ownerDocument == factory.

Specified by:
render in interface NestableComponent
Throws:
java.lang.Exception

isClosable

public boolean isClosable()
shall this table have a close button?

Specified by:
isClosable in interface ITableComponent

setClosable

public void setClosable(boolean b)
shall this table have a close button?

Specified by:
setClosable in interface ITableComponent

getBorder

public java.lang.String getBorder()
gets the border attribute of the generated table. Overrides the global stylesheet parameter "border".

Specified by:
getBorder in interface ITableComponent
Returns:
the border attribute or null

setBorder

public void setBorder(java.lang.String border)
sets the border attribute of the generated table. Overrides the global stylesheet parameter "border".

Specified by:
setBorder in interface ITableComponent
Parameters:
border - the border attribute or null to use the stylesheet parameter

setWidth

public void setWidth(java.lang.String width)
sets the width attribute of the generated table.


setRenderId

public void setRenderId(java.lang.String renderId)
sets the renderId attribute of the generated table. Overrides the global stylesheet parameter "renderId".

Specified by:
setRenderId in interface ITableComponent
Parameters:
renderId - the renderId attribute or null to use the stylesheet parameter

getRenderId

public java.lang.String getRenderId()
gets the renderId attribute of the generated table. Overrides the global stylesheet parameter "renderId".

Specified by:
getRenderId in interface ITableComponent
Returns:
the renderId attribute or null

setTr

public void setTr(java.lang.String newTr)

getTr

public java.lang.String getTr()

setTd

public void setTd(java.lang.String newTd)

getTd

public java.lang.String getTd()

setTh

public void setTh(java.lang.String newTh)

getTh

public java.lang.String getTh()

getTableColumns

public TableColumn[] getTableColumns()

setError

public void setError(java.lang.String message)
sets the error message to display

Specified by:
setError in interface ITableComponent
Parameters:
message - the message to display or null to remove a previous error message

isColHeaders

public boolean isColHeaders()

setColHeaders

public void setColHeaders(boolean title)

isReadOnly

public boolean isReadOnly()
Description copied from interface: ITableComponent
user may view data but not change the selection

Specified by:
isReadOnly in interface ITableComponent

setReadOnly

public void setReadOnly(boolean readOnly)
Description copied from interface: ITableComponent
user may view data but not change the selection

Specified by:
setReadOnly in interface ITableComponent