org.apache.tapestry.contrib.table.components
Class TableView

java.lang.Object
  extended by org.apache.hivemind.impl.BaseLocatable
      extended by org.apache.tapestry.AbstractComponent
          extended by org.apache.tapestry.BaseComponent
              extended by org.apache.tapestry.contrib.table.components.TableView
All Implemented Interfaces:
EventListener, org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder, ITableModelSource, PageBeginRenderListener, PageDetachListener, IComponent, IDirectEvent, Component, IRender, ITemplateComponent

public abstract class TableView
extends BaseComponent
implements PageDetachListener, PageBeginRenderListener, ITableModelSource

A low level Table component that wraps all other low level Table components. This component carries the ITableModelthat is used by the other Table components. Please see the documentation of ITableModelif you need to know more about how a table is represented.

This component also handles the saving of the state of the model using an ITableSessionStateManagerto determine what part of the model is to be saved and an ITableSessionStoreManagerto determine how to save it.

Upon the beginning of a new request cycle when the table model is first needed, the model is obtained using the following process:

Just before the rendering phase the persistent state of the model is saved in the session. This process occurs in reverse:

Please see the Component Reference for details on how to use this component. [ Component Reference ]

Author:
mindbridge

Field Summary
 
Fields inherited from class org.apache.tapestry.AbstractComponent
_body, _bodyCount
 
Fields inherited from interface org.apache.tapestry.contrib.table.model.ITableModelSource
TABLE_MODEL_SOURCE_ATTRIBUTE
 
Constructor Summary
TableView()
          The component constructor.
 
Method Summary
 void executeTableActions()
          Executes the stored table actions.
 void fireObservedStateChange()
          Invoked when there is a modification of the table state and it needs to be saved.
protected  ITableColumnModel generateTableColumnModel(String strDesc)
          Generate a table column model out of the description string provided.
protected  ITableModel generateTableModel(SimpleTableState objState)
          Generate a table model using the 'source' and 'columns' parameters.
 ITableModel getCachedTableModelValue()
           
abstract  Serializable getClientAppState()
           
abstract  Serializable getClientState()
           
abstract  Object getColumns()
           
abstract  IComponent getColumnSettingsContainer()
           
abstract  IAdvancedTableColumnSource getColumnSource()
           
 ITableSessionStateManager getDefaultTableSessionStateManager()
          The default session state manager to be used in case no such manager is provided by the corresponding parameter.
abstract  int getInitialPage()
           
abstract  String getInitialSortColumn()
           
abstract  boolean getInitialSortOrder()
           
abstract  TableColumnModelSource getModelSource()
           
abstract  int getPageSize()
           
abstract  String getPersist()
           
abstract  Serializable getSessionState()
           
abstract  Object getSource()
           
abstract  List getTableActions()
           
protected  ITableColumnModel getTableColumnModel()
          Returns the table column model as specified by the 'columns' binding.
 ITableModel getTableModel()
          Returns the tableModel.
abstract  ITableModel getTableModelValue()
           
abstract  ITableSessionStateManager getTableSessionStateManager()
           
abstract  ITableSessionStoreManager getTableSessionStoreManager()
           
protected  Serializable loadSessionState()
          Loads the table state using the SessionStoreManager.
 void pageBeginRender(PageEvent event)
          Ensures that the table state is saved before the render phase begins in case there are modifications for which fireObservedStateChange()has not been invoked.
 void pageDetached(PageEvent objEvent)
          Invokes the component member initializations.
protected  void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
          Stores a pointer to this component in the Request Cycle while rendering so that wrapped components have access to it.
 void reset()
          Resets the table by removing any stored table state.
protected  void saveSessionState()
          Saves the table state using the SessionStateManager to determine what to save and the SessionStoreManager to determine where to save it.
abstract  void setClientAppState(Serializable sessionState)
           
abstract  void setClientState(Serializable sessionState)
           
abstract  void setSessionState(Serializable sessionState)
           
abstract  void setTableActions(List actions)
           
protected  void storeSessionState(Serializable objState)
          Stores the table state using the SessionStoreManager.
 void storeTableAction(ITableAction action)
          Stores the provided table action.
protected  void validateValues()
          Make sure that the values stored in the model are useable and correct.
 
Methods inherited from class org.apache.tapestry.BaseComponent
addOuter, finishLoad, getContainedRenderers, getInnerRenderers
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, checkActiveLock, cleanupAfterRender, enterActiveState, equals, finishLoad, generateClientId, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getBoundId, getClientId, getComponent, getComponents, getContainedComponent, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getListeners, getMessages, getNamespace, getPage, getRenderWorker, getSpecification, getSpecifiedId, getTemplateTagName, hasEvents, hashCode, isInActiveState, isParameterBound, isRendering, isStateful, pageEndRender, peekClientId, prepareForRender, render, renderBody, renderIdAttribute, renderInformalParameters, setBinding, setClientId, setContainedComponent, setContainer, setHasEvents, setId, setNamespace, setPage, setTemplateTagName, toString, triggerEvent
 
Methods inherited from class org.apache.hivemind.impl.BaseLocatable
getLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.IComponent
addAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getClientId, getComponent, getComponents, getContainedComponent, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getListeners, getMessages, getNamespace, getPage, getSpecification, getSpecifiedId, getTemplateTagName, isRendering, peekClientId, renderBody, setBinding, setClientId, setContainedComponent, setContainer, setId, setNamespace, setPage, setTemplateTagName
 
Methods inherited from interface org.apache.tapestry.IRender
render
 
Methods inherited from interface org.apache.hivemind.LocationHolder
setLocation
 
Methods inherited from interface org.apache.hivemind.Locatable
getLocation
 

Constructor Detail

TableView

public TableView()
The component constructor. Invokes the component member initializations.

Method Detail

getModelSource

public abstract TableColumnModelSource getModelSource()
Since:
4.0

getColumnSource

public abstract IAdvancedTableColumnSource getColumnSource()
Since:
4.0

getTableModelValue

public abstract ITableModel getTableModelValue()

getSource

public abstract Object getSource()

getColumns

public abstract Object getColumns()

getInitialPage

public abstract int getInitialPage()

getInitialSortColumn

public abstract String getInitialSortColumn()

getInitialSortOrder

public abstract boolean getInitialSortOrder()

getTableSessionStateManager

public abstract ITableSessionStateManager getTableSessionStateManager()

getTableSessionStoreManager

public abstract ITableSessionStoreManager getTableSessionStoreManager()

getColumnSettingsContainer

public abstract IComponent getColumnSettingsContainer()

getPageSize

public abstract int getPageSize()

getPersist

public abstract String getPersist()

getSessionState

public abstract Serializable getSessionState()

setSessionState

public abstract void setSessionState(Serializable sessionState)

getClientState

public abstract Serializable getClientState()

setClientState

public abstract void setClientState(Serializable sessionState)

getClientAppState

public abstract Serializable getClientAppState()

setClientAppState

public abstract void setClientAppState(Serializable sessionState)

getTableActions

public abstract List getTableActions()

setTableActions

public abstract void setTableActions(List actions)

pageDetached

public void pageDetached(PageEvent objEvent)
Invokes the component member initializations.

Specified by:
pageDetached in interface PageDetachListener
See Also:
PageDetachListener.pageDetached(PageEvent)

reset

public void reset()
Resets the table by removing any stored table state. This means that the current column to sort on and the current page will be forgotten and all data will be reloaded.


getCachedTableModelValue

public ITableModel getCachedTableModelValue()

getTableModel

public ITableModel getTableModel()
Returns the tableModel.

Specified by:
getTableModel in interface ITableModelSource
Returns:
ITableModel the table model used by the table components

generateTableModel

protected ITableModel generateTableModel(SimpleTableState objState)
Generate a table model using the 'source' and 'columns' parameters.

Returns:
the newly generated table model

getTableColumnModel

protected ITableColumnModel getTableColumnModel()
Returns the table column model as specified by the 'columns' binding. If the value of the 'columns' binding is of a type different than ITableColumnModel, this method makes the appropriate conversion.

Returns:
The table column model as specified by the 'columns' binding

generateTableColumnModel

protected ITableColumnModel generateTableColumnModel(String strDesc)
Generate a table column model out of the description string provided. Entries in the description string are separated by commas. Each column entry is of the format name, name:expression, or name:displayName:expression. An entry prefixed with ! represents a non-sortable column. If the whole description string is prefixed with *, it represents columns to be included in a Form.

Parameters:
strDesc - the description of the column model to be generated
Returns:
a table column model based on the provided description

getDefaultTableSessionStateManager

public ITableSessionStateManager getDefaultTableSessionStateManager()
The default session state manager to be used in case no such manager is provided by the corresponding parameter.

Returns:
the default session state manager

fireObservedStateChange

public void fireObservedStateChange()
Invoked when there is a modification of the table state and it needs to be saved.

Specified by:
fireObservedStateChange in interface ITableModelSource
See Also:
ITableModelSource.fireObservedStateChange()

pageBeginRender

public void pageBeginRender(PageEvent event)
Ensures that the table state is saved before the render phase begins in case there are modifications for which fireObservedStateChange()has not been invoked.

Specified by:
pageBeginRender in interface PageBeginRenderListener
See Also:
PageBeginRenderListener.pageBeginRender(org.apache.tapestry.event.PageEvent)

saveSessionState

protected void saveSessionState()
Saves the table state using the SessionStateManager to determine what to save and the SessionStoreManager to determine where to save it.


loadSessionState

protected Serializable loadSessionState()
Loads the table state using the SessionStoreManager.

Returns:
the stored table state

storeSessionState

protected void storeSessionState(Serializable objState)
Stores the table state using the SessionStoreManager.

Parameters:
objState - the table state to store

validateValues

protected void validateValues()
Make sure that the values stored in the model are useable and correct. The changes made here are not saved.


renderComponent

protected void renderComponent(IMarkupWriter writer,
                               IRequestCycle cycle)
Stores a pointer to this component in the Request Cycle while rendering so that wrapped components have access to it.

Overrides:
renderComponent in class BaseComponent
See Also:
BaseComponent.renderComponent(IMarkupWriter, IRequestCycle)

storeTableAction

public void storeTableAction(ITableAction action)
Stores the provided table action.

Specified by:
storeTableAction in interface ITableModelSource
Parameters:
action - The action to store.

executeTableActions

public void executeTableActions()
Executes the stored table actions.



Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.