Package org.displaytag.model
Class TableModel
java.lang.Object
org.displaytag.model.TableModel
Table Model. Holds table data for presentation.
- Version:
- $Revision$ ($Author$)
- Author:
- Fabrizio Giustina
-
Constructor Summary
ConstructorsConstructorDescriptionTableModel
(TableProperties tableProperties, String charEncoding, javax.servlet.jsp.PageContext pageContext) Constructor for TableModel. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addColumnHeader
(HeaderCell headerCell) Adds a column header (HeaderCell object).void
adds a Row object to the table.Obtain this table's caption.Getter for character encoding.Obtain this table's footer.getForm()
Getter forform
.List containing headerCell objects.getId()
get the table id.getMedia()
Gets the current media type.int
return the number of columns in the table.protected javax.servlet.jsp.PageContext
Returns the jsp page context.int
Getter forpageOffset
.Returns the table properties.getRowIterator
(boolean full) returns a RowIterator on the requested (full|page) list.get the full list.gets the partial (paginated) list.returns the HeaderCell for the sorted column.int
return the index of the sorted column.getter for the Table Decorator.Gets the totaler.boolean
isEmpty()
return true is the table has no columns.boolean
Checks if is local sort.boolean
isSorted()
returns true if the table is sorted.boolean
return the sort full table property.boolean
return the sort order of the page.void
reset()
Reset.void
setCaption
(String caption) Set this table's caption.void
Set this table's footer.void
Setter forform
.void
Setter for the tablemodel id.void
setLocalSort
(boolean localSort) Sets whether the table performs local in memory sorting of the data.void
setMedia
(MediaTypeEnum media) sets the current media type.void
setPageOffset
(int offset) Sets the starting offset for elements in the viewable list.void
setRowListPage
(List<Row> rowList) Sets the row list page.void
setSortedColumnName
(String sortedColumnName) sets the name of the currently sorted column.void
setSortedColumnNumber
(int sortIndex) set the sorted column index.void
setSortFullTable
(boolean sortFull) sets the sort full table property.void
setSortOrderAscending
(boolean isSortOrderAscending) set the sort order of the list.void
setTableDecorator
(TableDecorator decorator) setter for the table decorator.void
setTotaler
(TableTotaler totaler) Sets the totaler.void
sort the full list of data.void
sort the list displayed in page.toString()
To string.
-
Constructor Details
-
TableModel
public TableModel(TableProperties tableProperties, String charEncoding, javax.servlet.jsp.PageContext pageContext) Constructor for TableModel.- Parameters:
tableProperties
- table propertiescharEncoding
- response encodingpageContext
- the page context
-
-
Method Details
-
getPageContext
protected javax.servlet.jsp.PageContext getPageContext()Returns the jsp page context.- Returns:
- page context
-
getMedia
Gets the current media type.- Returns:
- current media (html, pdf ...)
-
setMedia
sets the current media type.- Parameters:
media
- current media (html, pdf ...)
-
setLocalSort
public void setLocalSort(boolean localSort) Sets whether the table performs local in memory sorting of the data.- Parameters:
localSort
- the new local sort
-
isLocalSort
public boolean isLocalSort()Checks if is local sort.- Returns:
- sorting in local memory
-
getForm
Getter forform
.- Returns:
- Returns the form.
-
setForm
Setter forform
.- Parameters:
form
- The form to set.
-
getPageOffset
public int getPageOffset()Getter forpageOffset
.- Returns:
- Returns the page offset.
-
setPageOffset
public void setPageOffset(int offset) Sets the starting offset for elements in the viewable list.- Parameters:
offset
- The page offset to set.
-
setId
Setter for the tablemodel id.- Parameters:
tableId
- same id of table tag, needed for logging
-
getId
get the table id.- Returns:
- table id
-
getRowListFull
get the full list.- Returns:
- the full list containing Row objects
-
getRowListPage
gets the partial (paginated) list.- Returns:
- the partial list to display in page (contains Row objects)
-
addRow
adds a Row object to the table.- Parameters:
row
- Row
-
setSortedColumnName
sets the name of the currently sorted column.- Parameters:
sortedColumnName
- the new sorted column name
-
setSortFullTable
public void setSortFullTable(boolean sortFull) sets the sort full table property. If true the full list is sorted, if false sorting is applied only to the displayed sublist.- Parameters:
sortFull
- boolean
-
isSortFullTable
public boolean isSortFullTable()return the sort full table property.- Returns:
- boolean true if sorting is applied to the full list
-
isSortOrderAscending
public boolean isSortOrderAscending()return the sort order of the page.- Returns:
- true if sort order is ascending
-
setSortOrderAscending
public void setSortOrderAscending(boolean isSortOrderAscending) set the sort order of the list.- Parameters:
isSortOrderAscending
- true to sort in ascending order
-
setRowListPage
Sets the row list page.- Parameters:
rowList
- - the new value for this.rowListPage
-
getTableDecorator
getter for the Table Decorator.- Returns:
- TableDecorator
-
setTableDecorator
setter for the table decorator.- Parameters:
decorator
- - the TableDecorator object
-
isSorted
public boolean isSorted()returns true if the table is sorted.- Returns:
- boolean true if the table is sorted
-
getSortedColumnHeader
returns the HeaderCell for the sorted column.- Returns:
- HeaderCell
-
getNumberOfColumns
public int getNumberOfColumns()return the number of columns in the table.- Returns:
- int number of columns
-
isEmpty
public boolean isEmpty()return true is the table has no columns.- Returns:
- boolean
-
getSortedColumnNumber
public int getSortedColumnNumber()return the index of the sorted column.- Returns:
- index of the sorted column or -1 if the table is not sorted
-
setSortedColumnNumber
public void setSortedColumnNumber(int sortIndex) set the sorted column index.- Parameters:
sortIndex
- - the index of the sorted column
-
addColumnHeader
Adds a column header (HeaderCell object).- Parameters:
headerCell
- HeaderCell
-
getHeaderCellList
List containing headerCell objects.- Returns:
- List containing headerCell objects
-
getRowIterator
returns a RowIterator on the requested (full|page) list.- Parameters:
full
- iftrue
returns an iterator on te full list, iffalse
only on the viewable part.- Returns:
- RowIterator
- See Also:
-
sortPageList
public void sortPageList()sort the list displayed in page. -
sortFullList
public void sortFullList()sort the full list of data. -
getProperties
Returns the table properties.- Returns:
- the configured table properties.
-
getEncoding
Getter for character encoding.- Returns:
- Returns the encoding used for response.
-
getCaption
Obtain this table's caption.- Returns:
- This table's caption.
-
setCaption
Set this table's caption.- Parameters:
caption
- This table's caption.
-
toString
To string. -
getTotaler
Gets the totaler.- Returns:
- the totaler
-
setTotaler
Sets the totaler.- Parameters:
totaler
- the new totaler
-
reset
public void reset()Reset.
-