You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/03/19 06:11:41 UTC
svn commit: r386927 [2/4] - in /jakarta/tapestry/trunk:
contrib/src/java/org/apache/tapestry/contrib/ajax/
contrib/src/java/org/apache/tapestry/contrib/ejb/
contrib/src/java/org/apache/tapestry/contrib/form/
contrib/src/java/org/apache/tapestry/contrib...
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/TableView.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/TableView.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/TableView.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/TableView.java Sat Mar 18 21:11:35 2006
@@ -46,64 +46,66 @@
import org.apache.tapestry.event.PageEvent;
/**
- * A low level Table component that wraps all other low level Table components. This component
- * carries the {@link org.apache.tapestry.contrib.table.model.ITableModel}that is used by the other
- * Table components. Please see the documentation of
- * {@link org.apache.tapestry.contrib.table.model.ITableModel}if you need to know more about how a
- * table is represented.
+ * A low level Table component that wraps all other low level Table components.
+ * This component carries the
+ * {@link org.apache.tapestry.contrib.table.model.ITableModel}that is used by
+ * the other Table components. Please see the documentation of
+ * {@link org.apache.tapestry.contrib.table.model.ITableModel}if you need to
+ * know more about how a table is represented.
* <p>
* This component also handles the saving of the state of the model using an
- * {@link org.apache.tapestry.contrib.table.model.ITableSessionStateManager}to determine what part
- * of the model is to be saved and an
- * {@link org.apache.tapestry.contrib.table.model.ITableSessionStoreManager}to determine how to
- * save it.
+ * {@link org.apache.tapestry.contrib.table.model.ITableSessionStateManager}to
+ * determine what part of the model is to be saved and an
+ * {@link org.apache.tapestry.contrib.table.model.ITableSessionStoreManager}to
+ * determine how to save it.
* <p>
- * Upon the beginning of a new request cycle when the table model is first needed, the model is
- * obtained using the following process:
+ * Upon the beginning of a new request cycle when the table model is first
+ * needed, the model is obtained using the following process:
* <ul>
- * <li>The persistent state of the table is loaded. If the tableSessionStoreManager binding has not
- * been bound, the state is loaded from a persistent property within the component (it is null at
- * the beginning). Otherwise the supplied
- * {@link org.apache.tapestry.contrib.table.model.ITableSessionStoreManager}is used to load the
- * persistent state.
+ * <li>The persistent state of the table is loaded. If the
+ * tableSessionStoreManager binding has not been bound, the state is loaded from
+ * a persistent property within the component (it is null at the beginning).
+ * Otherwise the supplied
+ * {@link org.apache.tapestry.contrib.table.model.ITableSessionStoreManager}is
+ * used to load the persistent state.
* <li>The table model is recreated using the
- * {@link org.apache.tapestry.contrib.table.model.ITableSessionStateManager}that could be supplied
- * using the tableSessionStateManager binding (but has a default value and is therefore not
- * required).
- * <li>If the {@link org.apache.tapestry.contrib.table.model.ITableSessionStateManager}returns
+ * {@link org.apache.tapestry.contrib.table.model.ITableSessionStateManager}that
+ * could be supplied using the tableSessionStateManager binding (but has a
+ * default value and is therefore not required).
+ * <li>If the
+ * {@link org.apache.tapestry.contrib.table.model.ITableSessionStateManager}returns
* null, then a table model is taken from the tableModel binding. Thus, if the
- * {@link org.apache.tapestry.contrib.table.model.common.NullTableSessionStateManager}is used, the
- * table model would be taken from the tableModel binding every time.
+ * {@link org.apache.tapestry.contrib.table.model.common.NullTableSessionStateManager}is
+ * used, the table model would be taken from the tableModel binding every time.
* </ul>
- * Just before the rendering phase the persistent state of the model is saved in the session. This
- * process occurs in reverse:
+ * Just before the rendering phase the persistent state of the model is saved in
+ * the session. This process occurs in reverse:
* <ul>
* <li>The persistent state of the model is taken via the
* {@link org.apache.tapestry.contrib.table.model.ITableSessionStateManager}.
- * <li>If the tableSessionStoreManager binding has not been bound, the persistent state is saved as
- * a persistent page property. Otherwise the supplied
- * {@link org.apache.tapestry.contrib.table.model.ITableSessionStoreManager}is used to save the
- * persistent state. Use of the
- * {@link org.apache.tapestry.contrib.table.model.ITableSessionStoreManager}is usually necessary
- * when tables with the same model have to be used across multiple pages, and hence the state has to
- * be saved in the Visit, rather than in a persistent component property.
+ * <li>If the tableSessionStoreManager binding has not been bound, the
+ * persistent state is saved as a persistent page property. Otherwise the
+ * supplied
+ * {@link org.apache.tapestry.contrib.table.model.ITableSessionStoreManager}is
+ * used to save the persistent state. Use of the
+ * {@link org.apache.tapestry.contrib.table.model.ITableSessionStoreManager}is
+ * usually necessary when tables with the same model have to be used across
+ * multiple pages, and hence the state has to be saved in the Visit, rather than
+ * in a persistent component property.
* </ul>
* <p>
* <p>
- * Please see the Component Reference for details on how to use this component. [ <a
- * href="../../../../../../../ComponentReference/contrib.TableView.html">Component Reference </a>]
+ * Please see the Component Reference for details on how to use this component. [
+ * <a
+ * href="../../../../../../../ComponentReference/contrib.TableView.html">Component
+ * Reference </a>]
*
* @author mindbridge
*/
-public abstract class TableView extends BaseComponent implements PageDetachListener,
- PageBeginRenderListener, ITableModelSource
+public abstract class TableView extends BaseComponent implements
+ PageDetachListener, PageBeginRenderListener, ITableModelSource
{
- /** @since 4.0 */
- public abstract TableColumnModelSource getModelSource();
- /** @since 4.0 */
- public abstract IAdvancedTableColumnSource getColumnSource();
-
// Component properties
private ITableSessionStateManager m_objDefaultSessionStateManager = null;
@@ -114,6 +116,20 @@
private ITableModel m_objCachedTableModelValue;
+ /**
+ * The component constructor. Invokes the component member initializations.
+ */
+ public TableView()
+ {
+ initialize();
+ }
+
+ /** @since 4.0 */
+ public abstract TableColumnModelSource getModelSource();
+
+ /** @since 4.0 */
+ public abstract IAdvancedTableColumnSource getColumnSource();
+
// enhanced parameter methods
public abstract ITableModel getTableModelValue();
@@ -151,16 +167,8 @@
public abstract void setClientAppState(Serializable sessionState);
public abstract List getTableActions();
-
- public abstract void setTableActions(List actions);
-
- /**
- * The component constructor. Invokes the component member initializations.
- */
- public TableView()
- {
- initialize();
- }
+
+ public abstract void setTableActions(List actions);
/**
* Invokes the component member initializations.
@@ -182,8 +190,9 @@
}
/**
- * 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.
+ * 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.
*/
public void reset()
{
@@ -217,12 +226,14 @@
if (m_objTableModel == null)
m_objTableModel = getCachedTableModelValue();
- // if the model from the binding is null, build a model from source and columns
+ // if the model from the binding is null, build a model from source and
+ // columns
if (m_objTableModel == null)
m_objTableModel = generateTableModel(null);
if (m_objTableModel == null)
- throw new ApplicationRuntimeException(TableMessages.missingTableModel(this));
+ throw new ApplicationRuntimeException(TableMessages
+ .missingTableModel(this));
return m_objTableModel;
}
@@ -238,7 +249,8 @@
if (objState == null)
{
objState = new SimpleTableState();
- objState.getSortingState().setSortColumn(getInitialSortColumn(), getInitialSortOrder());
+ objState.getSortingState().setSortColumn(getInitialSortColumn(),
+ getInitialSortOrder());
objState.getPagingState().setCurrentPage(getInitialPage());
}
@@ -248,42 +260,42 @@
// get the column model. if not possible, return null.
ITableColumnModel objColumnModel = getTableColumnModel();
- if (objColumnModel == null)
- return null;
+ if (objColumnModel == null) return null;
Object objSourceValue = getSource();
- if (objSourceValue == null)
- return null;
+ if (objSourceValue == null) return null;
// if the source parameter is of type {@link IBasicTableModel},
// create and return an appropriate wrapper
if (objSourceValue instanceof IBasicTableModel)
- return new BasicTableModelWrap((IBasicTableModel) objSourceValue, objColumnModel,
- objState);
+ return new BasicTableModelWrap((IBasicTableModel) objSourceValue,
+ objColumnModel, objState);
// otherwise, the source parameter must contain the data to be displayed
ITableDataModel objDataModel = null;
if (objSourceValue instanceof Object[])
- objDataModel = new SimpleListTableDataModel((Object[]) objSourceValue);
+ objDataModel = new SimpleListTableDataModel(
+ (Object[]) objSourceValue);
else if (objSourceValue instanceof List)
objDataModel = new SimpleListTableDataModel((List) objSourceValue);
else if (objSourceValue instanceof Collection)
- objDataModel = new SimpleListTableDataModel((Collection) objSourceValue);
+ objDataModel = new SimpleListTableDataModel(
+ (Collection) objSourceValue);
else if (objSourceValue instanceof Iterator)
- objDataModel = new SimpleListTableDataModel((Iterator) objSourceValue);
+ objDataModel = new SimpleListTableDataModel(
+ (Iterator) objSourceValue);
if (objDataModel == null)
- throw new ApplicationRuntimeException(TableMessages.invalidTableSource(
- this,
- objSourceValue));
+ throw new ApplicationRuntimeException(TableMessages
+ .invalidTableSource(this, objSourceValue));
return new SimpleTableModel(objDataModel, objColumnModel, objState);
}
/**
- * 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. If
+ * the value of the 'columns' binding is of a type different than
+ * ITableColumnModel, this method makes the appropriate conversion.
*
* @return The table column model as specified by the 'columns' binding
*/
@@ -291,13 +303,9 @@
{
Object objColumns = getColumns();
- if (objColumns == null)
- return null;
+ if (objColumns == null) return null;
- if (objColumns instanceof ITableColumnModel)
- {
- return (ITableColumnModel) objColumns;
- }
+ if (objColumns instanceof ITableColumnModel) { return (ITableColumnModel) objColumns; }
if (objColumns instanceof Iterator)
{
@@ -313,19 +321,19 @@
// validate that the list contains only ITableColumn instances
List arrColumnsList = (List) objColumns;
int nColumnsNumber = arrColumnsList.size();
- for (int i = 0; i < nColumnsNumber; i++)
+ for(int i = 0; i < nColumnsNumber; i++)
{
if (!(arrColumnsList.get(i) instanceof ITableColumn))
- throw new ApplicationRuntimeException(TableMessages.columnsOnlyPlease(this));
+ throw new ApplicationRuntimeException(TableMessages
+ .columnsOnlyPlease(this));
}
- //objColumns = arrColumnsList.toArray(new ITableColumn[nColumnsNumber]);
+ // objColumns = arrColumnsList.toArray(new
+ // ITableColumn[nColumnsNumber]);
return new SimpleTableColumnModel(arrColumnsList);
}
- if (objColumns instanceof ITableColumn[])
- {
- return new SimpleTableColumnModel((ITableColumn[]) objColumns);
- }
+ if (objColumns instanceof ITableColumn[]) { return new SimpleTableColumnModel(
+ (ITableColumn[]) objColumns); }
if (objColumns instanceof String)
{
@@ -342,21 +350,23 @@
return generateTableColumnModel(strColumns);
}
- throw new ApplicationRuntimeException(TableMessages.invalidTableColumns(this, objColumns));
+ throw new ApplicationRuntimeException(TableMessages
+ .invalidTableColumns(this, objColumns));
}
private void addAll(List arrColumnsList, Iterator objColumnsIterator)
{
- while (objColumnsIterator.hasNext())
+ while(objColumnsIterator.hasNext())
arrColumnsList.add(objColumnsIterator.next());
}
/**
- * 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.
+ * 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.
*
* @param strDesc
* the description of the column model to be generated
@@ -366,25 +376,28 @@
{
IComponent objColumnSettingsContainer = getColumnSettingsContainer();
IAdvancedTableColumnSource objColumnSource = getColumnSource();
-
- return getModelSource().generateTableColumnModel(objColumnSource, strDesc, this, objColumnSettingsContainer);
+
+ return getModelSource().generateTableColumnModel(objColumnSource,
+ strDesc, this, objColumnSettingsContainer);
}
/**
- * The default session state manager to be used in case no such manager is provided by the
- * corresponding parameter.
+ * The default session state manager to be used in case no such manager is
+ * provided by the corresponding parameter.
*
* @return the default session state manager
*/
public ITableSessionStateManager getDefaultTableSessionStateManager()
{
if (m_objDefaultSessionStateManager == null)
- m_objDefaultSessionStateManager = new TableViewSessionStateManager(this);
+ m_objDefaultSessionStateManager = new TableViewSessionStateManager(
+ this);
return m_objDefaultSessionStateManager;
}
/**
- * Invoked when there is a modification of the table state and it needs to be saved
+ * Invoked when there is a modification of the table state and it needs to
+ * be saved.
*
* @see org.apache.tapestry.contrib.table.model.ITableModelSource#fireObservedStateChange()
*/
@@ -394,31 +407,33 @@
}
/**
- * Ensures that the table state is saved before the render phase begins in case there are
- * modifications for which {@link #fireObservedStateChange()}has not been invoked.
+ * Ensures that the table state is saved before the render phase begins in
+ * case there are modifications for which {@link #fireObservedStateChange()}has
+ * not been invoked.
*
* @see org.apache.tapestry.event.PageBeginRenderListener#pageBeginRender(org.apache.tapestry.event.PageEvent)
*/
public void pageBeginRender(PageEvent event)
{
executeTableActions();
-
+
// 'suspenders': save the table model if it has been already loaded.
// this means that if a change has been made explicitly in a listener,
- // it will be saved. this is the last place before committing the changes
+ // it will be saved. this is the last place before committing the
+ // changes
// where a save can occur
- if (m_objTableModel != null)
- saveSessionState();
+ if (m_objTableModel != null) saveSessionState();
}
/**
- * Saves the table state using the SessionStateManager to determine what to save and the
- * SessionStoreManager to determine where to save it.
+ * Saves the table state using the SessionStateManager to determine what to
+ * save and the SessionStoreManager to determine where to save it.
*/
protected void saveSessionState()
{
ITableModel objModel = getTableModel();
- Serializable objState = getTableSessionStateManager().getSessionState(objModel);
+ Serializable objState = getTableSessionStateManager().getSessionState(
+ objModel);
storeSessionState(objState);
}
@@ -432,13 +447,12 @@
ITableSessionStoreManager objManager = getTableSessionStoreManager();
if (objManager != null)
return objManager.loadState(getPage().getRequestCycle());
- String strPersist = getPersist();
- if (strPersist.equals("client") || strPersist.equals("client:page"))
- return getClientState();
- else if (strPersist.equals("client:app"))
- return getClientAppState();
- else
- return getSessionState();
+ String strPersist = getPersist();
+ if (strPersist.equals("client") || strPersist.equals("client:page"))
+ return getClientState();
+ else if (strPersist.equals("client:app"))
+ return getClientAppState();
+ else return getSessionState();
}
/**
@@ -452,20 +466,20 @@
ITableSessionStoreManager objManager = getTableSessionStoreManager();
if (objManager != null)
objManager.saveState(getPage().getRequestCycle(), objState);
- else {
- String strPersist = getPersist();
- if (strPersist.equals("client") || strPersist.equals("client:page"))
- setClientState(objState);
- else if (strPersist.equals("client:app"))
- setClientAppState(objState);
- else
- setSessionState(objState);
+ else
+ {
+ String strPersist = getPersist();
+ if (strPersist.equals("client") || strPersist.equals("client:page"))
+ setClientState(objState);
+ else if (strPersist.equals("client:app"))
+ setClientAppState(objState);
+ else setSessionState(objState);
}
}
/**
- * Make sure that the values stored in the model are useable and correct. The changes made here
- * are not saved.
+ * Make sure that the values stored in the model are useable and correct.
+ * The changes made here are not saved.
*/
protected void validateValues()
{
@@ -490,45 +504,50 @@
}
/**
- * Stores a pointer to this component in the Request Cycle while rendering so that wrapped
- * components have access to it.
+ * Stores a pointer to this component in the Request Cycle while rendering
+ * so that wrapped components have access to it.
*
- * @see org.apache.tapestry.BaseComponent#renderComponent(IMarkupWriter, IRequestCycle)
+ * @see org.apache.tapestry.BaseComponent#renderComponent(IMarkupWriter,
+ * IRequestCycle)
*/
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
{
- Object objOldValue = cycle.getAttribute(ITableModelSource.TABLE_MODEL_SOURCE_ATTRIBUTE);
- cycle.setAttribute(ITableModelSource.TABLE_MODEL_SOURCE_ATTRIBUTE, this);
+ Object objOldValue = cycle
+ .getAttribute(ITableModelSource.TABLE_MODEL_SOURCE_ATTRIBUTE);
+ cycle
+ .setAttribute(ITableModelSource.TABLE_MODEL_SOURCE_ATTRIBUTE,
+ this);
initialize();
validateValues();
super.renderComponent(writer, cycle);
- cycle.setAttribute(ITableModelSource.TABLE_MODEL_SOURCE_ATTRIBUTE, objOldValue);
+ cycle.setAttribute(ITableModelSource.TABLE_MODEL_SOURCE_ATTRIBUTE,
+ objOldValue);
}
/**
- * Stores the provided table action
+ * Stores the provided table action.
*/
public void storeTableAction(ITableAction action)
{
List actions = getTableActions();
- if (actions == null) {
+ if (actions == null)
+ {
actions = new ArrayList(5);
setTableActions(actions);
}
-
+
actions.add(action);
}
-
+
/**
- * Executes the stored table actions
+ * Executes the stored table actions.
*/
public void executeTableActions()
{
List actions = getTableActions();
- if (actions == null || actions.isEmpty())
- return;
+ if (actions == null || actions.isEmpty()) return;
// save the actions and clear the list
List savedActions = new ArrayList(actions);
@@ -540,9 +559,9 @@
ITableAction action = (ITableAction) it.next();
action.executeTableAction(objTableModel);
}
-
+
// ensure that the changes are saved
fireObservedStateChange();
}
-
+
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/SimpleTableColumnComponent.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/SimpleTableColumnComponent.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/SimpleTableColumnComponent.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/SimpleTableColumnComponent.java Sat Mar 18 21:11:35 2006
@@ -29,122 +29,114 @@
import org.apache.tapestry.util.ComponentAddress;
/**
- * A component that renders the default column header.
- *
- * If the current column is sortable, it renders the header as a link.
- * Clicking on the link causes the table to be sorted on that column.
- * Clicking on the link again causes the sorting order to be reversed.
+ * A component that renders the default column header. If the current column is
+ * sortable, it renders the header as a link. Clicking on the link causes the
+ * table to be sorted on that column. Clicking on the link again causes the
+ * sorting order to be reversed.
*
* @author mindbridge
*/
-public abstract class SimpleTableColumnComponent
- extends BaseComponent
- implements ITableRendererListener, PageDetachListener
+public abstract class SimpleTableColumnComponent extends BaseComponent
+ implements ITableRendererListener, PageDetachListener
{
- // transient
- private ITableColumn m_objColumn;
- private ITableModelSource m_objModelSource;
-
- public SimpleTableColumnComponent()
- {
- init();
- }
-
- /**
- * @see org.apache.tapestry.event.PageDetachListener#pageDetached(PageEvent)
- */
- public void pageDetached(PageEvent arg0)
- {
- init();
- }
-
- private void init()
- {
- m_objColumn = null;
- m_objModelSource = null;
- }
+ // transient
+ private ITableColumn m_objColumn;
+ private ITableModelSource m_objModelSource;
+
+ public SimpleTableColumnComponent()
+ {
+ init();
+ }
/**
- * @see org.apache.tapestry.contrib.table.model.ITableRendererListener#initializeRenderer(IRequestCycle, ITableModelSource, ITableColumn, Object)
+ * @see org.apache.tapestry.event.PageDetachListener#pageDetached(PageEvent)
*/
- public void initializeRenderer(
- IRequestCycle objCycle,
- ITableModelSource objSource,
- ITableColumn objColumn,
- Object objRow)
+ public void pageDetached(PageEvent arg0)
+ {
+ init();
+ }
+
+ private void init()
+ {
+ m_objColumn = null;
+ m_objModelSource = null;
+ }
+
+ /**
+ * @see org.apache.tapestry.contrib.table.model.ITableRendererListener#initializeRenderer(IRequestCycle,
+ * ITableModelSource, ITableColumn, Object)
+ */
+ public void initializeRenderer(IRequestCycle objCycle,
+ ITableModelSource objSource, ITableColumn objColumn, Object objRow)
{
m_objModelSource = objSource;
m_objColumn = objColumn;
}
- public ITableModel getTableModel()
- {
- return m_objModelSource.getTableModel();
- }
-
- public boolean getColumnSorted()
- {
- return m_objColumn.getSortable();
- }
-
- public String getDisplayName()
- {
- if (m_objColumn instanceof SimpleTableColumn) {
+ public ITableModel getTableModel()
+ {
+ return m_objModelSource.getTableModel();
+ }
+
+ public boolean getColumnSorted()
+ {
+ return m_objColumn.getSortable();
+ }
+
+ public String getDisplayName()
+ {
+ if (m_objColumn instanceof SimpleTableColumn)
+ {
SimpleTableColumn objSimpleColumn = (SimpleTableColumn) m_objColumn;
- return objSimpleColumn.getDisplayName();
+ return objSimpleColumn.getDisplayName();
}
return m_objColumn.getColumnName();
- }
+ }
- public boolean getIsSorted()
- {
- ITableSortingState objSortingState = getTableModel().getSortingState();
- String strSortColumn = objSortingState.getSortColumn();
- return m_objColumn.getColumnName().equals(strSortColumn);
- }
-
- public IAsset getSortImage()
- {
- IAsset objImageAsset;
-
- IRequestCycle objCycle = getPage().getRequestCycle();
- ITableSortingState objSortingState = getTableModel().getSortingState();
- if (objSortingState.getSortOrder()
- == ITableSortingState.SORT_ASCENDING)
- {
- objImageAsset =
- (IAsset) objCycle.getAttribute(
- TableColumns.TABLE_COLUMN_ARROW_UP_ATTRIBUTE);
- if (objImageAsset == null)
- objImageAsset = getAsset("sortUp");
- }
- else
- {
- objImageAsset =
- (IAsset) objCycle.getAttribute(
- TableColumns.TABLE_COLUMN_ARROW_DOWN_ATTRIBUTE);
- if (objImageAsset == null)
- objImageAsset = getAsset("sortDown");
- }
-
- return objImageAsset;
- }
-
- public Object[] getColumnSelectedParameters()
- {
- return new Object[] {
- new ComponentAddress(m_objModelSource),
- m_objColumn.getColumnName()};
- }
-
- public void columnSelected(IRequestCycle objCycle)
- {
- Object[] arrArgs = objCycle.getListenerParameters();
- ComponentAddress objAddr = (ComponentAddress) arrArgs[0];
- String strColumnName = (String) arrArgs[1];
+ public boolean getIsSorted()
+ {
+ ITableSortingState objSortingState = getTableModel().getSortingState();
+ String strSortColumn = objSortingState.getSortColumn();
+ return m_objColumn.getColumnName().equals(strSortColumn);
+ }
+
+ public IAsset getSortImage()
+ {
+ IAsset objImageAsset;
+
+ IRequestCycle objCycle = getPage().getRequestCycle();
+ ITableSortingState objSortingState = getTableModel().getSortingState();
+ if (objSortingState.getSortOrder() == ITableSortingState.SORT_ASCENDING)
+ {
+ objImageAsset = (IAsset) objCycle
+ .getAttribute(TableColumns.TABLE_COLUMN_ARROW_UP_ATTRIBUTE);
+ if (objImageAsset == null) objImageAsset = getAsset("sortUp");
+ }
+ else
+ {
+ objImageAsset = (IAsset) objCycle
+ .getAttribute(TableColumns.TABLE_COLUMN_ARROW_DOWN_ATTRIBUTE);
+ if (objImageAsset == null) objImageAsset = getAsset("sortDown");
+ }
+
+ return objImageAsset;
+ }
+
+ public Object[] getColumnSelectedParameters()
+ {
+ return new Object[] { new ComponentAddress(m_objModelSource),
+ m_objColumn.getColumnName() };
+ }
+
+ public void columnSelected(IRequestCycle objCycle)
+ {
+ Object[] arrArgs = objCycle.getListenerParameters();
+ ComponentAddress objAddr = (ComponentAddress) arrArgs[0];
+ String strColumnName = (String) arrArgs[1];
- ITableModelSource objSource = (ITableModelSource)objAddr.findComponent(objCycle);
+ ITableModelSource objSource = (ITableModelSource) objAddr
+ .findComponent(objCycle);
objSource.storeTableAction(new TableActionColumnSort(strColumnName));
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/SimpleTableColumnFormComponent.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/SimpleTableColumnFormComponent.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/SimpleTableColumnFormComponent.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/SimpleTableColumnFormComponent.java Sat Mar 18 21:11:35 2006
@@ -26,99 +26,93 @@
import org.apache.tapestry.contrib.table.model.simple.SimpleTableColumn;
/**
- * A component that renders the default column header in a form.
- *
- * If the current column is sortable, it renders the header as a link.
- * Clicking on the link causes the table to be sorted on that column.
- * Clicking on the link again causes the sorting order to be reversed.
- *
- * This component renders links that cause the form to be submitted.
- * This ensures that the updated data in the other form fields is preserved.
+ * A component that renders the default column header in a form. If the current
+ * column is sortable, it renders the header as a link. Clicking on the link
+ * causes the table to be sorted on that column. Clicking on the link again
+ * causes the sorting order to be reversed. This component renders links that
+ * cause the form to be submitted. This ensures that the updated data in the
+ * other form fields is preserved.
*
* @author mindbridge
*/
-public abstract class SimpleTableColumnFormComponent
- extends BaseComponent
- implements ITableRendererListener
+public abstract class SimpleTableColumnFormComponent extends BaseComponent
+ implements ITableRendererListener
{
+
public abstract ITableColumn getTableColumn();
+
public abstract void setTableColumn(ITableColumn objColumn);
public abstract ITableModelSource getTableModelSource();
+
public abstract void setTableModelSource(ITableModelSource objSource);
public abstract String getSelectedColumnName();
/**
- * @see org.apache.tapestry.contrib.table.model.ITableRendererListener#initializeRenderer(IRequestCycle, ITableModelSource, ITableColumn, Object)
+ * @see org.apache.tapestry.contrib.table.model.ITableRendererListener#initializeRenderer(IRequestCycle,
+ * ITableModelSource, ITableColumn, Object)
*/
- public void initializeRenderer(
- IRequestCycle objCycle,
- ITableModelSource objSource,
- ITableColumn objColumn,
- Object objRow)
+ public void initializeRenderer(IRequestCycle objCycle,
+ ITableModelSource objSource, ITableColumn objColumn, Object objRow)
{
setTableModelSource(objSource);
setTableColumn(objColumn);
}
- public ITableModel getTableModel()
- {
- return getTableModelSource().getTableModel();
- }
-
- public boolean getColumnSorted()
- {
- return getTableColumn().getSortable();
- }
+ public ITableModel getTableModel()
+ {
+ return getTableModelSource().getTableModel();
+ }
- public String getDisplayName()
- {
+ public boolean getColumnSorted()
+ {
+ return getTableColumn().getSortable();
+ }
+
+ public String getDisplayName()
+ {
ITableColumn objColumn = getTableColumn();
-
- if (objColumn instanceof SimpleTableColumn) {
+
+ if (objColumn instanceof SimpleTableColumn)
+ {
SimpleTableColumn objSimpleColumn = (SimpleTableColumn) objColumn;
- return objSimpleColumn.getDisplayName();
+ return objSimpleColumn.getDisplayName();
}
return objColumn.getColumnName();
- }
+ }
- public boolean getIsSorted()
- {
- ITableSortingState objSortingState = getTableModel().getSortingState();
- String strSortColumn = objSortingState.getSortColumn();
- return getTableColumn().getColumnName().equals(strSortColumn);
- }
-
- public IAsset getSortImage()
- {
- IAsset objImageAsset;
-
- IRequestCycle objCycle = getPage().getRequestCycle();
- ITableSortingState objSortingState = getTableModel().getSortingState();
- if (objSortingState.getSortOrder()
- == ITableSortingState.SORT_ASCENDING)
- {
- objImageAsset =
- (IAsset) objCycle.getAttribute(
- TableColumns.TABLE_COLUMN_ARROW_UP_ATTRIBUTE);
- if (objImageAsset == null)
- objImageAsset = getAsset("sortUp");
- }
- else
- {
- objImageAsset =
- (IAsset) objCycle.getAttribute(
- TableColumns.TABLE_COLUMN_ARROW_DOWN_ATTRIBUTE);
- if (objImageAsset == null)
- objImageAsset = getAsset("sortDown");
- }
+ public boolean getIsSorted()
+ {
+ ITableSortingState objSortingState = getTableModel().getSortingState();
+ String strSortColumn = objSortingState.getSortColumn();
+ return getTableColumn().getColumnName().equals(strSortColumn);
+ }
- return objImageAsset;
- }
+ public IAsset getSortImage()
+ {
+ IAsset objImageAsset;
- public void columnSelected(IRequestCycle objCycle)
- {
+ IRequestCycle objCycle = getPage().getRequestCycle();
+ ITableSortingState objSortingState = getTableModel().getSortingState();
+ if (objSortingState.getSortOrder() == ITableSortingState.SORT_ASCENDING)
+ {
+ objImageAsset = (IAsset) objCycle
+ .getAttribute(TableColumns.TABLE_COLUMN_ARROW_UP_ATTRIBUTE);
+ if (objImageAsset == null) objImageAsset = getAsset("sortUp");
+ }
+ else
+ {
+ objImageAsset = (IAsset) objCycle
+ .getAttribute(TableColumns.TABLE_COLUMN_ARROW_DOWN_ATTRIBUTE);
+ if (objImageAsset == null) objImageAsset = getAsset("sortDown");
+ }
+
+ return objImageAsset;
+ }
+
+ public void columnSelected(IRequestCycle objCycle)
+ {
String strColumnName = getSelectedColumnName();
ITableModelSource objSource = getTableModelSource();
objSource.storeTableAction(new TableActionColumnSort(strColumnName));
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/TableActionColumnSort.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/TableActionColumnSort.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/TableActionColumnSort.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/components/inserted/TableActionColumnSort.java Sat Mar 18 21:11:35 2006
@@ -19,7 +19,7 @@
/**
- * <p>A table action that configures the table sorting to use a given column</p>
+ * <p>A table action that configures the table sorting to use a given column</p>.
*
* @author teo
*/
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IAdvancedTableColumn.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IAdvancedTableColumn.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IAdvancedTableColumn.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IAdvancedTableColumn.java Sat Mar 18 21:11:35 2006
@@ -16,13 +16,20 @@
import org.apache.tapestry.IComponent;
+/**
+ *
+ * @author hls
+ */
public interface IAdvancedTableColumn extends ITableColumn
{
- ITableRendererSource getColumnRendererSource();
- void setColumnRendererSource(ITableRendererSource columnRendererSource);
- ITableRendererSource getValueRendererSource();
- void setValueRendererSource(ITableRendererSource valueRendererSource);
-
- void loadSettings(IComponent objSettingsContainer);
+ ITableRendererSource getColumnRendererSource();
+
+ void setColumnRendererSource(ITableRendererSource columnRendererSource);
+
+ ITableRendererSource getValueRendererSource();
+
+ void setValueRendererSource(ITableRendererSource valueRendererSource);
+
+ void loadSettings(IComponent objSettingsContainer);
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IAdvancedTableColumnSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IAdvancedTableColumnSource.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IAdvancedTableColumnSource.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IAdvancedTableColumnSource.java Sat Mar 18 21:11:35 2006
@@ -17,9 +17,13 @@
*/
package org.apache.tapestry.contrib.table.model;
-
-public interface IAdvancedTableColumnSource
+/**
+ *
+ * @author mb
+ */
+public interface IAdvancedTableColumnSource
{
- IAdvancedTableColumn generateTableColumn(String strName, String strDisplayName,
- boolean bSortable, String strExpression);
+
+ IAdvancedTableColumn generateTableColumn(String strName,
+ String strDisplayName, boolean bSortable, String strExpression);
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IBasicTableModel.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IBasicTableModel.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IBasicTableModel.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IBasicTableModel.java Sat Mar 18 21:11:35 2006
@@ -26,7 +26,7 @@
public interface IBasicTableModel
{
/**
- * Returns the number of all records
+ * Returns the number of all records.
* @return the number of all rows
**/
int getRowCount();
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IFullTableModel.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IFullTableModel.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IFullTableModel.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IFullTableModel.java Sat Mar 18 21:11:35 2006
@@ -23,9 +23,10 @@
* @author mb
*/
public interface IFullTableModel extends ITableModel {
- /**
- * Iterates over all of the rows in the model
- * @return Iterator the iterator for access to the data
- */
- Iterator getRows();
+ /**
+ * Iterates over all of the rows in the model.
+ *
+ * @return Iterator the iterator for access to the data
+ */
+ Iterator getRows();
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IPrimaryKeyConvertor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IPrimaryKeyConvertor.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IPrimaryKeyConvertor.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/IPrimaryKeyConvertor.java Sat Mar 18 21:11:35 2006
@@ -25,7 +25,7 @@
public interface IPrimaryKeyConvertor
{
/**
- * Gets the serializable primary key of the given value
+ * Gets the serializable primary key of the given value.
*
* @param objValue the value for which a primary key needs to be extracted
* @return the serializable primary key of the value
@@ -33,7 +33,7 @@
Object getPrimaryKey(Object objValue);
/**
- * Gets the value corresponding the given primary key
+ * Gets the value corresponding the given primary key .
*
* @param objPrimaryKey the primary key for which a value needs to be generated
* @return the generated value corresponding to the given primary key
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableAction.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableAction.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableAction.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableAction.java Sat Mar 18 21:11:35 2006
@@ -28,7 +28,7 @@
public interface ITableAction
{
/**
- * Executes the desired action
+ * Executes the desired action.
*
* @param objTableModel the table model on which the action should be executed
*/
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableColumn.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableColumn.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableColumn.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableColumn.java Sat Mar 18 21:11:35 2006
@@ -20,69 +20,76 @@
import org.apache.tapestry.IRequestCycle;
/**
- * The interface defining a table column.
- *
- * A column is responsible for presenting a particular part of the data
- * from the objects in the table. This is done via the getValueRender() method.
- *
- * A column may be sortable, in which case it defines the way in which the
- * objects in the table must be sorted by providing a Comparator.
+ * The interface defining a table column. A column is responsible for presenting
+ * a particular part of the data from the objects in the table. This is done via
+ * the getValueRender() method. A column may be sortable, in which case it
+ * defines the way in which the objects in the table must be sorted by providing
+ * a Comparator.
*
* @author mindbridge
*/
public interface ITableColumn
{
- /**
- * Method getColumnName provides the name of the column.
- *
- * The column name must be unique and is generally used for the identification
- * of the column. It does not have to be the same as the display name
- * via which the column is identified to the user (see the getColumnRender() method).
- * @return String the name of the column
- */
- String getColumnName();
- /**
- * Method getSortable declares whether the column allows sorting.
- * If the column allows sorting, it must also return a valid Comparator
- * via the getComparator() method.
- * @return boolean whether the column is sortable or not
- */
- boolean getSortable();
+ /**
+ * Method getColumnName provides the name of the column. The column name
+ * must be unique and is generally used for the identification of the
+ * column. It does not have to be the same as the display name via which the
+ * column is identified to the user (see the getColumnRender() method).
+ *
+ * @return String the name of the column
+ */
+ String getColumnName();
+
+ /**
+ * Method getSortable declares whether the column allows sorting. If the
+ * column allows sorting, it must also return a valid Comparator via the
+ * getComparator() method.
+ *
+ * @return boolean whether the column is sortable or not
+ */
+ boolean getSortable();
- /**
- * Method getComparator returns the Comparator to be used to sort
- * the data in the table according to this column. The Comparator must
- * accept two different rows, compare them according to this column,
- * and return the appropriate value.
- * @return Comparator the Comparator used to sort the table data
- */
- Comparator getComparator();
+ /**
+ * Method getComparator returns the Comparator to be used to sort the data
+ * in the table according to this column. The Comparator must accept two
+ * different rows, compare them according to this column, and return the
+ * appropriate value.
+ *
+ * @return Comparator the Comparator used to sort the table data
+ */
+ Comparator getComparator();
- /**
- * Method getColumnRenderer provides a renderer that takes care of rendering
- * the column in the table header. If the column is sortable, the renderer
- * may provide a mechanism to sort the table in an ascending or descending
- * manner.
- * @param objCycle the current request cycle
- * @param objSource a component that can provide the table model (typically TableView)
- * @return IRender the renderer to present the column header
- */
- IRender getColumnRenderer(
- IRequestCycle objCycle,
- ITableModelSource objSource);
+ /**
+ * Method getColumnRenderer provides a renderer that takes care of rendering
+ * the column in the table header. If the column is sortable, the renderer
+ * may provide a mechanism to sort the table in an ascending or descending
+ * manner.
+ *
+ * @param objCycle
+ * the current request cycle
+ * @param objSource
+ * a component that can provide the table model (typically
+ * TableView)
+ * @return IRender the renderer to present the column header
+ */
+ IRender getColumnRenderer(IRequestCycle objCycle,
+ ITableModelSource objSource);
- /**
- * Method getValueRenderer provides a renderer for presenting the value of a
- * particular row in the current column.
- *
- * @param objCycle the current request cycle
- * @param objSource a component that can provide the table model (typically TableView)
- * @param objRow the row data
- * @return IRender the renderer to present the value of the row in this column
- */
- IRender getValueRenderer(
- IRequestCycle objCycle,
- ITableModelSource objSource,
- Object objRow);
+ /**
+ * Method getValueRenderer provides a renderer for presenting the value of a
+ * particular row in the current column.
+ *
+ * @param objCycle
+ * the current request cycle
+ * @param objSource
+ * a component that can provide the table model (typically
+ * TableView)
+ * @param objRow
+ * the row data
+ * @return IRender the renderer to present the value of the row in this
+ * column
+ */
+ IRender getValueRenderer(IRequestCycle objCycle,
+ ITableModelSource objSource, Object objRow);
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableColumnModel.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableColumnModel.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableColumnModel.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableColumnModel.java Sat Mar 18 21:11:35 2006
@@ -17,28 +17,34 @@
import java.util.Iterator;
/**
- * Defines a list model of ITableColumn objects
+ * Defines a list model of ITableColumn objects.
*
* @author mindbridge
*/
public interface ITableColumnModel
{
- /**
- * Method getColumnCount.
- * @return int the number of columns in the model
- */
- int getColumnCount();
- /**
- * Method getColumn.
- * @param strName the name of the requested column
- * @return ITableColumn the column with the given name. null if no such column exists.
- */
- ITableColumn getColumn(String strName);
+ /**
+ * Method getColumnCount.
+ *
+ * @return int the number of columns in the model
+ */
+ int getColumnCount();
- /**
- * Method getColumns.
- * @return Iterator an iterator of all columns in the model
- */
- Iterator getColumns();
+ /**
+ * Method getColumn.
+ *
+ * @param strName
+ * the name of the requested column
+ * @return ITableColumn the column with the given name. null if no such
+ * column exists.
+ */
+ ITableColumn getColumn(String strName);
+
+ /**
+ * Method getColumns.
+ *
+ * @return Iterator an iterator of all columns in the model
+ */
+ Iterator getColumns();
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableDataModel.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableDataModel.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableDataModel.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableDataModel.java Sat Mar 18 21:11:35 2006
@@ -17,38 +17,44 @@
import java.util.Iterator;
/**
- * A model of the table's data
- * This model need not be used. Implementations may choose to
- * access data via an abstraction.
+ * A model of the table's data This model need not be used. Implementations may
+ * choose to access data via an abstraction.
*
* @author mindbridge
*/
public interface ITableDataModel
{
- /**
- * Method getRowCount.
- * @return int the number of rows in the model
- */
- int getRowCount();
- /**
- * Iterates over all of the rows in the model
- * @return Iterator the iterator for access to the data
- */
- Iterator getRows();
-
- /**
- * Method addTableDataModelListener
- * Adds a listener that is notified when the data in the model is changed
- * @param objListener the listener to add
- */
+ /**
+ * Method getRowCount.
+ *
+ * @return int the number of rows in the model
+ */
+ int getRowCount();
+
+ /**
+ * Iterates over all of the rows in the model.
+ *
+ * @return Iterator the iterator for access to the data
+ */
+ Iterator getRows();
+
+ /**
+ * Method addTableDataModelListener Adds a listener that is notified when
+ * the data in the model is changed.
+ *
+ * @param objListener
+ * the listener to add
+ */
void addTableDataModelListener(ITableDataModelListener objListener);
- /**
- * Method removeTableDataModelListener.
- * Removes a listener that is notified when the data in the model is changed
- * @param objListener the listener to remove
- */
+ /**
+ * Method removeTableDataModelListener. Removes a listener that is notified
+ * when the data in the model is changed
+ *
+ * @param objListener
+ * the listener to remove
+ */
void removeTableDataModelListener(ITableDataModelListener objListener);
-
+
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModel.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModel.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModel.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModel.java Sat Mar 18 21:11:35 2006
@@ -17,37 +17,48 @@
import java.util.Iterator;
/**
- * The main interface defining the abstraction containing the table data and state
+ * The main interface defining the abstraction containing the table data and
+ * state.
*
* @author mindbridge
*/
public interface ITableModel
{
- /**
- * Method getColumnModel.
- * @return ITableColumnModel the column model of the table
- */
- ITableColumnModel getColumnModel();
- /**
- * Method getSortingState.
- * @return ITableSortingState the sorting state of the table
- */
- ITableSortingState getSortingState();
- /**
- * Method getPagingState.
- * @return ITablePagingState the paging state of the table
- */
- ITablePagingState getPagingState();
+ /**
+ * Method getColumnModel.
+ *
+ * @return ITableColumnModel the column model of the table
+ */
+ ITableColumnModel getColumnModel();
- /**
- * Method getPageCount.
- * @return int the number of pages this table would have given the current data and paging state
- */
- int getPageCount();
- /**
- * Method getCurrentPageRows.
- * @return Iterator the rows in the current table page given the current data, sorting, and paging state
- */
- Iterator getCurrentPageRows();
+ /**
+ * Method getSortingState.
+ *
+ * @return ITableSortingState the sorting state of the table
+ */
+ ITableSortingState getSortingState();
+
+ /**
+ * Method getPagingState.
+ *
+ * @return ITablePagingState the paging state of the table
+ */
+ ITablePagingState getPagingState();
+
+ /**
+ * Method getPageCount.
+ *
+ * @return int the number of pages this table would have given the current
+ * data and paging state
+ */
+ int getPageCount();
+
+ /**
+ * Method getCurrentPageRows.
+ *
+ * @return Iterator the rows in the current table page given the current
+ * data, sorting, and paging state
+ */
+ Iterator getCurrentPageRows();
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModelSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModelSource.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModelSource.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModelSource.java Sat Mar 18 21:11:35 2006
@@ -17,35 +17,38 @@
import org.apache.tapestry.IComponent;
/**
- * A Tapestry component that provides the current table model.
- * This interface is used for obtaining the table model source by
- * components wrapped by it, as well as by external renderers,
- * such as those provided by the column implementations
+ * A Tapestry component that provides the current table model. This interface is
+ * used for obtaining the table model source by components wrapped by it, as
+ * well as by external renderers, such as those provided by the column
+ * implementations
*
* @author mindbridge
*/
public interface ITableModelSource extends IComponent
{
- final static String TABLE_MODEL_SOURCE_ATTRIBUTE = "org.apache.tapestry.contrib.table.model.ITableModelSource";
- /**
- * Returns the table model currently used
- * @return ITableModel the current table model
- */
- ITableModel getTableModel();
+ String TABLE_MODEL_SOURCE_ATTRIBUTE = "org.apache.tapestry.contrib.table.model.ITableModelSource";
+
+ /**
+ * Returns the table model currently used.
+ *
+ * @return ITableModel the current table model
+ */
+ ITableModel getTableModel();
- /**
- * Notifies the model source that the model state has changed, and
- * that it should consider saving it.<p>
- * This method was added to allow using the table within a Block when
- * the pageBeginRender() listener of the implementation will not be called
- * and automatic state storage will therefore be hard to implement.
- */
+ /**
+ * Notifies the model source that the model state has changed, and that it
+ * should consider saving it.
+ * <p>
+ * This method was added to allow using the table within a Block when the
+ * pageBeginRender() listener of the implementation will not be called and
+ * automatic state storage will therefore be hard to implement.
+ */
void fireObservedStateChange();
/**
- * Stores the provided table action
+ * Stores the provided table action.
*/
- public void storeTableAction(ITableAction action);
+ void storeTableAction(ITableAction action);
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITablePagingState.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITablePagingState.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITablePagingState.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITablePagingState.java Sat Mar 18 21:11:35 2006
@@ -21,29 +21,38 @@
*/
public interface ITablePagingState
{
- /**
- * Method getPageSize provides the size of a page in a number of records.
- * This value may be meaningless if the model uses a different method for pagination.
- * @return int the current page size
- */
- int getPageSize();
- /**
- * Method setPageSize updates the size of a page in a number of records.
- * This value may be meaningless if the model uses a different method for pagination.
- * @param nPageSize the new page size
- */
- void setPageSize(int nPageSize);
+ /**
+ * Method getPageSize provides the size of a page in a number of records.
+ * This value may be meaningless if the model uses a different method for
+ * pagination.
+ *
+ * @return int the current page size
+ */
+ int getPageSize();
- /**
- * Gets the currently selected page. The page number is counted from 0.
- * @return int the current active page
- */
- int getCurrentPage();
+ /**
+ * Method setPageSize updates the size of a page in a number of records.
+ * This value may be meaningless if the model uses a different method for
+ * pagination.
+ *
+ * @param nPageSize
+ * the new page size
+ */
+ void setPageSize(int nPageSize);
- /**
- * Sets the newly selected page. The page number is counted from 0.
- * @param nPage the new active page
- */
- void setCurrentPage(int nPage);
+ /**
+ * Gets the currently selected page. The page number is counted from 0.
+ *
+ * @return int the current active page
+ */
+ int getCurrentPage();
+
+ /**
+ * Sets the newly selected page. The page number is counted from 0.
+ *
+ * @param nPage
+ * the new active page
+ */
+ void setCurrentPage(int nPage);
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRendererListener.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRendererListener.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRendererListener.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRendererListener.java Sat Mar 18 21:11:35 2006
@@ -18,16 +18,13 @@
import org.apache.tapestry.IRequestCycle;
/**
- *
* @see org.apache.tapestry.contrib.table.model.common.AbstractTableColumn
* @author mindbridge
* @since 2.3
*/
public interface ITableRendererListener extends IComponent
{
- void initializeRenderer(
- IRequestCycle objCycle,
- ITableModelSource objSource,
- ITableColumn objColumn,
- Object objRow);
+
+ void initializeRenderer(IRequestCycle objCycle,
+ ITableModelSource objSource, ITableColumn objColumn, Object objRow);
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRendererSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRendererSource.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRendererSource.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRendererSource.java Sat Mar 18 21:11:35 2006
@@ -20,9 +20,10 @@
import org.apache.tapestry.IRequestCycle;
/**
- * This interface provides a renderer to present the data in a table column.
- * It is usually used by the {@link org.apache.tapestry.contrib.table.model.ITableColumn}
- * implementations via aggregation.
+ * This interface provides a renderer to present the data in a table column. It
+ * is usually used by the
+ * {@link org.apache.tapestry.contrib.table.model.ITableColumn} implementations
+ * via aggregation.
*
* @see org.apache.tapestry.contrib.table.model.common.AbstractTableColumn
* @author mindbridge
@@ -30,17 +31,17 @@
*/
public interface ITableRendererSource extends Serializable
{
- /**
- * Returns a renderer to present the data of the row in the given column. <p>
- * This method can also be used to return a renderer to present the
- * heading of the column. In such a case the row passed would be null.
- *
- * @see org.apache.tapestry.contrib.table.model.ITableColumn#getValueRenderer(IRequestCycle, ITableModelSource, Object)
- */
- public IRender getRenderer(
- IRequestCycle objCycle,
- ITableModelSource objSource,
- ITableColumn objColumn,
- Object objRow);
+
+ /**
+ * Returns a renderer to present the data of the row in the given column.
+ * <p>
+ * This method can also be used to return a renderer to present the heading
+ * of the column. In such a case the row passed would be null.
+ *
+ * @see org.apache.tapestry.contrib.table.model.ITableColumn#getValueRenderer(IRequestCycle,
+ * ITableModelSource, Object)
+ */
+ IRender getRenderer(IRequestCycle objCycle,
+ ITableModelSource objSource, ITableColumn objColumn, Object objRow);
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRowSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRowSource.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRowSource.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableRowSource.java Sat Mar 18 21:11:35 2006
@@ -15,19 +15,20 @@
package org.apache.tapestry.contrib.table.model;
/**
- * A Tapestry component that provides the current row value.
- * This interface is used for obtaining the row source by components
- * wrapped by the row source
+ * A Tapestry component that provides the current row value. This interface is
+ * used for obtaining the row source by components wrapped by the row source
*
* @author mindbridge
*/
public interface ITableRowSource
{
- final static String TABLE_ROW_SOURCE_ATTRIBUTE = "org.apache.tapestry.contrib.table.model.ITableRowSource";
- /**
- * Method getTableRow
- * @return Object the current table row object
- */
+ String TABLE_ROW_SOURCE_ATTRIBUTE = "org.apache.tapestry.contrib.table.model.ITableRowSource";
+
+ /**
+ * Method getTableRow.
+ *
+ * @return Object the current table row object
+ */
Object getTableRow();
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSessionStateManager.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSessionStateManager.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSessionStateManager.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSessionStateManager.java Sat Mar 18 21:11:35 2006
@@ -17,28 +17,33 @@
import java.io.Serializable;
/**
- * An interface responsible for determining <b>what</b> data would be stored
- * in the session between requests.
- * It could be only the table state, it could be entire table including the data,
- * or it could be nothing at all.
- * It is all determined by the implemention of this interface.
+ * An interface responsible for determining <b>what</b> data would be stored in
+ * the session between requests. It could be only the table state, it could be
+ * entire table including the data, or it could be nothing at all. It is all
+ * determined by the implemention of this interface.
*
* @author mindbridge
*/
public interface ITableSessionStateManager
{
- /**
- * Method getSessionState extracts the "persistent" portion of the table model
- * @param objModel the table model to extract the session state from
- * @return Object the session state to be saved between the requests
- */
- Serializable getSessionState(ITableModel objModel);
+ /**
+ * Method getSessionState extracts the "persistent" portion of the table
+ * model.
+ *
+ * @param objModel
+ * the table model to extract the session state from
+ * @return Object the session state to be saved between the requests
+ */
+ Serializable getSessionState(ITableModel objModel);
- /**
- * Method recreateTableModel recreates a table model from the saved session state
- * @param objState the saved session state
- * @return ITableModel the recreated table model
- */
- ITableModel recreateTableModel(Serializable objState);
+ /**
+ * Method recreateTableModel recreates a table model from the saved session
+ * state.
+ *
+ * @param objState
+ * the saved session state
+ * @return ITableModel the recreated table model
+ */
+ ITableModel recreateTableModel(Serializable objState);
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSessionStoreManager.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSessionStoreManager.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSessionStoreManager.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSessionStoreManager.java Sat Mar 18 21:11:35 2006
@@ -19,23 +19,30 @@
import org.apache.tapestry.IRequestCycle;
/**
- * An interface responsible for determining <b>where</b> the session state
- * will be saved between requests.
- *
+ * An interface responsible for determining <b>where</b> the session state will
+ * be saved between requests.
+ *
* @author mindbridge
*/
public interface ITableSessionStoreManager
{
- /**
- * Method saveState saves the session sate
- * @param objCycle the current request cycle
- * @param objState the session state to be saved
- */
- void saveState(IRequestCycle objCycle, Serializable objState);
- /**
- * Method loadState loads the session state
- * @param objCycle the current request cycle
- * @return Object the loaded sessions state
- */
- Serializable loadState(IRequestCycle objCycle);
+
+ /**
+ * Method saveState saves the session state.
+ *
+ * @param objCycle
+ * the current request cycle
+ * @param objState
+ * the session state to be saved
+ */
+ void saveState(IRequestCycle objCycle, Serializable objState);
+
+ /**
+ * Method loadState loads the session state.
+ *
+ * @param objCycle
+ * the current request cycle
+ * @return Object the loaded sessions state
+ */
+ Serializable loadState(IRequestCycle objCycle);
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSortingState.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSortingState.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSortingState.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ITableSortingState.java Sat Mar 18 21:11:35 2006
@@ -21,25 +21,33 @@
*/
public interface ITableSortingState
{
- static final boolean SORT_ASCENDING = false;
- static final boolean SORT_DESCENDING = true;
- /**
- * Method getSortColumn defines the column that the table should be sorted upon
- * @return String the name of the sorting column or null if the table is not sorted
- */
- String getSortColumn();
+ boolean SORT_ASCENDING = false;
+ boolean SORT_DESCENDING = true;
- /**
- * Method getSortOrder defines the direction of the table sorting
- * @return boolean the sorting order (see constants)
- */
- boolean getSortOrder();
+ /**
+ * Method getSortColumn defines the column that the table should be sorted
+ * upon.
+ *
+ * @return String the name of the sorting column or null if the table is not
+ * sorted
+ */
+ String getSortColumn();
- /**
- * Method setSortColumn updates the table sorting column and order
- * @param strName the name of the column to sort by
- * @param bOrder the sorting order (see constants)
- */
- void setSortColumn(String strName, boolean bOrder);
+ /**
+ * Method getSortOrder defines the direction of the table sorting .
+ *
+ * @return boolean the sorting order (see constants)
+ */
+ boolean getSortOrder();
+
+ /**
+ * Method setSortColumn updates the table sorting column and order.
+ *
+ * @param strName
+ * the name of the column to sort by
+ * @param bOrder
+ * the sorting order (see constants)
+ */
+ void setSortColumn(String strName, boolean bOrder);
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/FullTableSessionStateManager.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/FullTableSessionStateManager.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/FullTableSessionStateManager.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/FullTableSessionStateManager.java Sat Mar 18 21:11:35 2006
@@ -20,31 +20,30 @@
import org.apache.tapestry.contrib.table.model.ITableSessionStateManager;
/**
- * A simple ITableSessionStateManager implementation
- * that saves the entire table model into the session.
+ * A simple ITableSessionStateManager implementation that saves the entire table
+ * model into the session.
*
* @author mindbridge
*/
public class FullTableSessionStateManager implements ITableSessionStateManager
{
- public final static FullTableSessionStateManager FULL_STATE_MANAGER =
- new FullTableSessionStateManager();
+ public static final FullTableSessionStateManager FULL_STATE_MANAGER = new FullTableSessionStateManager();
- /**
- * @see org.apache.tapestry.contrib.table.model.ITableSessionStateManager#getSessionState(ITableModel)
- */
- public Serializable getSessionState(ITableModel objModel)
- {
- return (Serializable) objModel;
- }
+ /**
+ * @see org.apache.tapestry.contrib.table.model.ITableSessionStateManager#getSessionState(ITableModel)
+ */
+ public Serializable getSessionState(ITableModel objModel)
+ {
+ return (Serializable) objModel;
+ }
- /**
- * @see org.apache.tapestry.contrib.table.model.ITableSessionStateManager#recreateTableModel(Serializable)
- */
- public ITableModel recreateTableModel(Serializable objState)
- {
- return (ITableModel) objState;
- }
+ /**
+ * @see org.apache.tapestry.contrib.table.model.ITableSessionStateManager#recreateTableModel(Serializable)
+ */
+ public ITableModel recreateTableModel(Serializable objState)
+ {
+ return (ITableModel) objState;
+ }
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/NullTableSessionStateManager.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/NullTableSessionStateManager.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/NullTableSessionStateManager.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/NullTableSessionStateManager.java Sat Mar 18 21:11:35 2006
@@ -20,31 +20,30 @@
import org.apache.tapestry.contrib.table.model.ITableSessionStateManager;
/**
- * A simple ITableSessionStateManager implementation
- * that saves nothing at all into the session.
+ * A simple ITableSessionStateManager implementation that saves nothing at all
+ * into the session.
*
* @author mindbridge
*/
public class NullTableSessionStateManager implements ITableSessionStateManager
{
-
- public final static NullTableSessionStateManager NULL_STATE_MANAGER =
- new NullTableSessionStateManager();
- /**
- * @see org.apache.tapestry.contrib.table.model.ITableSessionStateManager#getSessionState(ITableModel)
- */
- public Serializable getSessionState(ITableModel objModel)
- {
- return null;
- }
+ public static final NullTableSessionStateManager NULL_STATE_MANAGER = new NullTableSessionStateManager();
- /**
- * @see org.apache.tapestry.contrib.table.model.ITableSessionStateManager#recreateTableModel(Serializable)
- */
- public ITableModel recreateTableModel(Serializable objState)
- {
- return null;
- }
+ /**
+ * @see org.apache.tapestry.contrib.table.model.ITableSessionStateManager#getSessionState(ITableModel)
+ */
+ public Serializable getSessionState(ITableModel objModel)
+ {
+ return null;
+ }
+
+ /**
+ * @see org.apache.tapestry.contrib.table.model.ITableSessionStateManager#recreateTableModel(Serializable)
+ */
+ public ITableModel recreateTableModel(Serializable objState)
+ {
+ return null;
+ }
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/ReverseComparator.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/ReverseComparator.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/ReverseComparator.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/common/ReverseComparator.java Sat Mar 18 21:11:35 2006
@@ -18,23 +18,23 @@
/**
* @author mindbridge
- *
*/
public class ReverseComparator implements Comparator
{
- private Comparator m_objComparator;
- public ReverseComparator(Comparator objComparator)
- {
- m_objComparator = objComparator;
- }
+ private Comparator m_objComparator;
- /**
- * @see java.util.Comparator#compare(Object, Object)
- */
- public int compare(Object objValue1, Object objValue2)
- {
- return -m_objComparator.compare(objValue1, objValue2);
- }
+ public ReverseComparator(Comparator objComparator)
+ {
+ m_objComparator = objComparator;
+ }
+
+ /**
+ * @see java.util.Comparator#compare(Object, Object)
+ */
+ public int compare(Object objValue1, Object objValue2)
+ {
+ return -m_objComparator.compare(objValue1, objValue2);
+ }
}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ognl/ExpressionTableColumn.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ognl/ExpressionTableColumn.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ognl/ExpressionTableColumn.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ognl/ExpressionTableColumn.java Sat Mar 18 21:11:35 2006
@@ -22,8 +22,9 @@
*/
public class ExpressionTableColumn extends SimpleTableColumn
{
- private static final long serialVersionUID = 1L;
-
+
+ private static final long serialVersionUID = 1L;
+
/** @since 4.0 */
public ExpressionTableColumn(String strColumnName, String strExpression,
@@ -32,25 +33,29 @@
this(strColumnName, strExpression, false, expressionEvaluator);
}
- public ExpressionTableColumn(String strColumnName, String strExpression, boolean bSortable,
- ExpressionEvaluator expressionEvaluator)
+ public ExpressionTableColumn(String strColumnName, String strExpression,
+ boolean bSortable, ExpressionEvaluator expressionEvaluator)
{
- this(strColumnName, strColumnName, strExpression, bSortable, expressionEvaluator);
+ this(strColumnName, strColumnName, strExpression, bSortable,
+ expressionEvaluator);
}
- public ExpressionTableColumn(String strColumnName, String strDisplayName, String strExpression,
- ExpressionEvaluator expressionEvaluator)
+ public ExpressionTableColumn(String strColumnName, String strDisplayName,
+ String strExpression, ExpressionEvaluator expressionEvaluator)
{
- this(strColumnName, strDisplayName, strExpression, false, expressionEvaluator);
+ this(strColumnName, strDisplayName, strExpression, false,
+ expressionEvaluator);
}
- public ExpressionTableColumn(String strColumnName, String strDisplayName, String strExpression,
- boolean bSortable, ExpressionEvaluator expressionEvaluator
+ public ExpressionTableColumn(String strColumnName, String strDisplayName,
+ String strExpression, boolean bSortable,
+ ExpressionEvaluator expressionEvaluator
)
{
super(strColumnName, strDisplayName, bSortable);
- setEvaluator(new OgnlTableColumnEvaluator(strExpression, expressionEvaluator));
+ setEvaluator(new OgnlTableColumnEvaluator(strExpression,
+ expressionEvaluator));
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ognl/ExpressionTableColumnModel.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ognl/ExpressionTableColumnModel.java?rev=386927&r1=386926&r2=386927&view=diff
==============================================================================
--- jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ognl/ExpressionTableColumnModel.java (original)
+++ jakarta/tapestry/trunk/contrib/src/java/org/apache/tapestry/contrib/table/model/ognl/ExpressionTableColumnModel.java Sat Mar 18 21:11:35 2006
@@ -23,13 +23,14 @@
*/
public class ExpressionTableColumnModel extends SimpleTableColumnModel
{
- private static final long serialVersionUID = 1L;
-
+
+ private static final long serialVersionUID = 1L;
+
/**
* Constructs a table column model containting OGNL expression columns. <br>
- * The data for the columns is provided in the form of a string array, where the info of each
- * column is stored in two consecutive fields in the array, hence its size must be even. The
- * expected info is the following:
+ * The data for the columns is provided in the form of a string array, where
+ * the info of each column is stored in two consecutive fields in the array,
+ * hence its size must be even. The expected info is the following:
* <ul>
* <li>Column Name
* <li>OGNL expression
@@ -43,21 +44,22 @@
public ExpressionTableColumnModel(String[] arrColumnInfo, boolean bSorted,
ExpressionEvaluator expressionEvaluator)
{
- this(convertToDetailedArray(arrColumnInfo, bSorted), expressionEvaluator);
+ this(convertToDetailedArray(arrColumnInfo, bSorted),
+ expressionEvaluator);
}
/**
* Constructs a table column model containting OGNL expression columns. <br>
- * The data for the columns is provided in the form of a string array, where the info of each
- * column is stored in four consecutive fields in the array, hence its size must be divisible by
- * 4.<br>
+ * The data for the columns is provided in the form of a string array, where
+ * the info of each column is stored in four consecutive fields in the
+ * array, hence its size must be divisible by 4.<br>
* The expected info is the following:
* <ul>
* <li>Column Name
* <li>Display Name
* <li>OGNL expression
- * <li>Sorting of the column. This is either a Boolean, or a String representation of a
- * boolean.
+ * <li>Sorting of the column. This is either a Boolean, or a String
+ * representation of a boolean.
* </ul>
*
* @param arrColumnInfo
@@ -75,13 +77,14 @@
* @param bSorted
* @return Object[]
*/
- protected static Object[] convertToDetailedArray(String[] arrColumnInfo, boolean bSorted)
+ protected static Object[] convertToDetailedArray(String[] arrColumnInfo,
+ boolean bSorted)
{
int nColumns = arrColumnInfo.length / 2;
int nSize = nColumns * 4;
Object[] arrDetailedInfo = new Object[nSize];
- for (int i = 0; i < nColumns; i++)
+ for(int i = 0; i < nColumns; i++)
{
int nInputBaseIndex = 2 * i;
String strColumnName = arrColumnInfo[nInputBaseIndex];
@@ -91,7 +94,8 @@
arrDetailedInfo[nOutputBaseIndex] = strColumnName;
arrDetailedInfo[nOutputBaseIndex + 1] = strColumnName;
arrDetailedInfo[nOutputBaseIndex + 2] = strExpression;
- arrDetailedInfo[nOutputBaseIndex + 3] = bSorted ? Boolean.TRUE : Boolean.FALSE;
+ arrDetailedInfo[nOutputBaseIndex + 3] = bSorted ? Boolean.TRUE
+ : Boolean.FALSE;
}
return arrDetailedInfo;
@@ -109,25 +113,22 @@
int nColumns = arrDetailedInfo.length / 4;
ITableColumn[] arrColumns = new ITableColumn[nColumns];
- for (int i = 0; i < nColumns; i++)
+ for(int i = 0; i < nColumns; i++)
{
Object objTempValue;
int nBaseIndex = 4 * i;
String strColumnName = "";
objTempValue = arrDetailedInfo[nBaseIndex];
- if (objTempValue != null)
- strColumnName = objTempValue.toString();
+ if (objTempValue != null) strColumnName = objTempValue.toString();
String strDisplayName = "";
objTempValue = arrDetailedInfo[nBaseIndex + 1];
- if (objTempValue != null)
- strDisplayName = objTempValue.toString();
+ if (objTempValue != null) strDisplayName = objTempValue.toString();
String strExpression = "";
objTempValue = arrDetailedInfo[nBaseIndex + 2];
- if (objTempValue != null)
- strExpression = objTempValue.toString();
+ if (objTempValue != null) strExpression = objTempValue.toString();
boolean bSorted = false;
objTempValue = arrDetailedInfo[nBaseIndex + 3];
@@ -135,14 +136,14 @@
{
if (objTempValue instanceof Boolean)
bSorted = ((Boolean) objTempValue).booleanValue();
- else
- bSorted = Boolean.valueOf(objTempValue.toString()).booleanValue();
+ else bSorted = Boolean.valueOf(objTempValue.toString())
+ .booleanValue();
}
- arrColumns[i] = new ExpressionTableColumn(strColumnName, strDisplayName, strExpression,
- bSorted, expressionEvaluator);
+ arrColumns[i] = new ExpressionTableColumn(strColumnName,
+ strDisplayName, strExpression, bSorted, expressionEvaluator);
}
return arrColumns;
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org