Table Model. Holds table data for presentation.
| Method from org.displaytag.model.TableModel Detail: |
public void addColumnHeader(HeaderCell headerCell) {
if (this.sortedColumnName == null)
{
if (this.sortedColumn == this.headerCellList.size())
{
headerCell.setAlreadySorted();
}
}
else
{
// the sorted parameter was a string so try and find that column name and set it as sorted
if (this.sortedColumnName.equals(headerCell.getSortName()))
{
headerCell.setAlreadySorted();
}
}
headerCell.setColumnNumber(this.headerCellList.size());
this.headerCellList.add(headerCell);
}
Adds a column header (HeaderCell object). |
public void addRow(Row row) {
row.setParentTable(this);
if (log.isDebugEnabled())
{
log.debug("[" + this.id + "] adding row " + row);
}
this.rowListFull.add(row);
}
adds a Row object to the table. |
public String getCaption() {
return this.caption;
}
Obtain this table's caption. |
public String getEncoding() {
return encoding;
}
Getter for character encoding. |
public String getFooter() {
return this.footer;
}
Obtain this table's footer. |
public List getHeaderCellList() {
return this.headerCellList;
}
List containing headerCell objects. |
public String getId() {
return this.id;
}
|
public MediaTypeEnum getMedia() {
return this.media;
}
Gets the current media type. |
public int getNumberOfColumns() {
return this.headerCellList.size();
}
return the number of columns in the table. |
protected PageContext getPageContext() {
return this.pageContext;
}
Returns the jsp page context. |
public TableProperties getProperties() {
return this.properties;
}
Returns the table properties. |
public RowIterator getRowIterator(boolean full) {
RowIterator iterator = new RowIterator(
full ? this.rowListFull : this.rowListPage,
this.headerCellList,
this.tableDecorator,
this.pageOffset);
// copy id for logging
iterator.setId(this.id);
return iterator;
}
returns a RowIterator on the requested (full|page) list. |
public List getRowListFull() {
return this.rowListFull;
}
|
public List getRowListPage() {
return this.rowListPage;
}
gets the partial (paginated) list. |
public HeaderCell getSortedColumnHeader() {
if (this.sortedColumn < 0 || (this.sortedColumn > (this.headerCellList.size() - 1)))
{
return null;
}
return (HeaderCell) this.headerCellList.get(this.sortedColumn);
}
returns the HeaderCell for the sorted column. |
public int getSortedColumnNumber() {
return this.sortedColumn;
}
return the index of the sorted column. |
public TableDecorator getTableDecorator() {
return this.tableDecorator;
}
getter for the Table Decorator. |
public boolean isEmpty() {
return this.headerCellList.size() == 0;
}
return true is the table has no columns. |
public boolean isLocalSort() {
return localSort;
}
|
public boolean isSortFullTable() {
return this.sortFullTable;
}
return the sort full table property. |
public boolean isSortOrderAscending() {
return this.sortOrderAscending;
}
return the sort order of the page. |
public boolean isSorted() {
return this.sortedColumn != -1;
}
returns true if the table is sorted. |
public void setCaption(String caption) {
this.caption = caption;
}
Set this table's caption. |
public void setFooter(String footer) {
this.footer = footer;
}
|
public void setId(String tableId) {
this.id = tableId;
}
Setter for the tablemodel id. |
public void setLocalSort(boolean localSort) {
this.localSort = localSort;
}
Sets whether the table performs local in memory sorting of the data. |
public void setMedia(MediaTypeEnum media) {
this.media = media;
}
sets the current media type. |
public void setPageOffset(int offset) {
this.pageOffset = offset;
}
Sets the starting offset for elements in the viewable list. |
public void setRowListPage(List rowList) {
this.rowListPage = rowList;
}
|
public void setSortFullTable(boolean sortFull) {
this.sortFullTable = sortFull;
}
sets the sort full table property. If true the full list is sorted, if false sorting is applied only to the
displayed sublist. |
public void setSortOrderAscending(boolean isSortOrderAscending) {
this.sortOrderAscending = isSortOrderAscending;
}
set the sort order of the list. |
public void setSortedColumnName(String sortedColumnName) {
this.sortedColumnName = sortedColumnName;
}
sets the name of the currently sorted column |
public void setSortedColumnNumber(int sortIndex) {
this.sortedColumn = sortIndex;
}
set the sorted column index. |
public void setTableDecorator(TableDecorator decorator) {
this.tableDecorator = decorator;
}
setter for the table decorator. |
public void sortFullList() {
if (log.isDebugEnabled())
{
log.debug("[" + this.id + "] sorting full data");
}
sortRowList(this.rowListFull);
}
sort the full list of data. |
public void sortPageList() {
if (log.isDebugEnabled())
{
log.debug("[" + this.id + "] sorting page list");
}
sortRowList(this.rowListPage);
}
sort the list displayed in page. |
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) //
.append("rowListFull", this.rowListFull) //$NON-NLS-1$
.append("rowListPage", this.rowListPage) //$NON-NLS-1$
.append("properties", this.properties) //$NON-NLS-1$
.append("empty", this.isEmpty()) //$NON-NLS-1$
.append("encoding", this.encoding) //$NON-NLS-1$
.append("numberOfColumns", this.getNumberOfColumns()) //$NON-NLS-1$
.append("headerCellList", this.headerCellList) //$NON-NLS-1$
.append("sortFullTable", this.sortFullTable) //$NON-NLS-1$
.append("sortedColumnNumber", this.getSortedColumnNumber()) //$NON-NLS-1$
.append("sortOrderAscending", this.sortOrderAscending) //$NON-NLS-1$
.append("sortedColumnHeader", this.getSortedColumnHeader()) //$NON-NLS-1$
.append("sorted", this.isSorted()) //$NON-NLS-1$
.append("tableDecorator", this.tableDecorator) //$NON-NLS-1$
.append("caption", this.caption) //$NON-NLS-1
.append("footer", this.footer) //$NON-NLS-1
.append("media", this.media) //$NON-NLS-1
.toString();
}
|