| Method from org.displaytag.render.TableWriterTemplate Detail: |
protected short groupColumns(String value,
String previous,
String next,
int currentGroup) {
short groupingKey = GROUP_NO_CHANGE;
if (lowestEndedGroup < currentGroup)
{
// if a lower group has ended, cascade so that all subgroups end as well
groupingKey += GROUP_END;
}
else if (next == null || !ObjectUtils.equals(value, next))
{
// at the end of the list
groupingKey += GROUP_END;
lowestEndedGroup = currentGroup;
}
if (lowestStartedGroup < currentGroup)
{
// if a lower group has started, cascade so that all subgroups restart as well
groupingKey += GROUP_START;
}
else if (previous == null || !ObjectUtils.equals(value, previous))
{
// At the start of the list
groupingKey += GROUP_START;
lowestStartedGroup = currentGroup;
}
return groupingKey;
}
This takes a column value and grouping index as the argument. It then groups the column and returns the
appropriate string back to the caller. |
abstract protected void writeBottomBanner(TableModel model) throws Exception
Called by writeTable to write the table's footer. |
abstract protected void writeCaption(TableModel model) throws Exception
Called by writeTable to write the table's caption. |
abstract protected void writeColumnCloser(Column column) throws Exception
Called by writeTableBody to write the end of the column structure. |
abstract protected void writeColumnOpener(Column column) throws Exception
Called by writeTableBody to write the start of the column structure. |
abstract protected void writeColumnValue(Object value,
Column column) throws Exception
Called by writeTableBody to write a column's value. |
abstract protected void writeDecoratedRowFinish(TableModel model) throws Exception
Called by writeTableBody to decorate the table. |
abstract protected void writeDecoratedRowStart(TableModel model) throws Exception
Called by writeTableBody to write to decorate the table. |
abstract protected void writeDecoratedTableFinish(TableModel model) throws Exception
Called by writeTable to decorate the table. |
abstract protected void writeEmptyListMessage(String emptyListMessage) throws Exception
Called by writeTable to write a message explaining that the table model contains no data. |
abstract protected void writeEmptyListRowMessage(String message) throws Exception
Called by writeTableBody to write a message explaining that the row contains no data. |
abstract protected void writePostBodyFooter(TableModel model) throws Exception
Called by writeTable to write table footer after table body. |
abstract protected void writePreBodyFooter(TableModel model) throws Exception
Called by writeTable to write table footer before table body. |
abstract protected void writeRowCloser(Row row) throws Exception
Called by writeTableBody to write the end of the row structure. |
abstract protected void writeRowOpener(Row row) throws Exception
Called by writeTableBody to write the start of the row structure. |
abstract protected void writeRowWithNoColumns(String value) throws Exception
Called by writeTableBody to write a row that has no columns. |
public void writeTable(TableModel model,
String id) throws JspException {
try
{
// table id used for logging
this.id = id;
TableProperties properties = model.getProperties();
if (log.isDebugEnabled())
{
log.debug("[" + this.id + "] writeTable called for table [" + this.id + "]");
}
// Handle empty table
boolean noItems = model.getRowListPage().size() == 0;
if (noItems && !properties.getEmptyListShowTable())
{
writeEmptyListMessage(properties.getEmptyListMessage());
return;
}
// Put the page stuff there if it needs to be there...
if (properties.getAddPagingBannerTop())
{
// search result and navigation bar
writeTopBanner(model);
}
// open table
writeTableOpener(model);
// render caption
if (model.getCaption() != null)
{
writeCaption(model);
}
// render headers
if (model.getProperties().getShowHeader())
{
writeTableHeader(model);
}
// render footer prior to body
if (model.getFooter() != null)
{
writePreBodyFooter(model);
}
// open table body
writeTableBodyOpener(model);
// render table body
writeTableBody(model);
// close table body
writeTableBodyCloser(model);
// render footer after body
if (model.getFooter() != null)
{
writePostBodyFooter(model);
}
// close table
writeTableCloser(model);
if (model.getTableDecorator() != null)
{
writeDecoratedTableFinish(model);
}
writeBottomBanner(model);
if (log.isDebugEnabled())
{
log.debug("[" + this.id + "] writeTable end");
}
}
catch (Exception e)
{
throw new JspException(e);
}
}
Given a table model, this method creates a table, sorting and grouping it per its configuration, while delegating
where and how it writes the table to subclass objects. (Background: This method refactors
TableTagData.writeHTMLData method. See above.) |
abstract protected void writeTableBodyCloser(TableModel model) throws Exception
Called by writeTable to write the end of the table's body. |
abstract protected void writeTableBodyOpener(TableModel model) throws Exception
Called by writeTable to write the start of the table's body. |
abstract protected void writeTableCloser(TableModel model) throws Exception
Called by writeTable to write the end of the table's structure. |
abstract protected void writeTableHeader(TableModel model) throws Exception
Called by writeTable to write the table's header columns. |
abstract protected void writeTableOpener(TableModel model) throws Exception
Called by writeTable to write the start of the table structure. |
abstract protected void writeTopBanner(TableModel model) throws Exception
Called by writeTable to write a summary of the search result this table reports and the table's pagination
interface. |