Class TableModel
java.lang.Object
org.displaytag.model.TableModel
Table Model. Holds table data for presentation.
-
Constructor Summary
ConstructorsConstructorDescriptionTableModel(TableProperties tableProperties, String charEncoding, jakarta.servlet.jsp.PageContext pageContext) Constructor for TableModel. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumnHeader(HeaderCell headerCell) Adds a column header (HeaderCell object).voidadds a Row object to the table.Obtain this table's caption.Returns the column visibilities to apply sort column properly.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.intreturn the number of columns in the table.protected jakarta.servlet.jsp.PageContextReturns the jsp page context.intGetter 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.intreturn the index of the sorted column.getter for the Table Decorator.Gets the totaler.booleanisEmpty()return true is the table has no columns.booleanChecks if is local sort.booleanisSorted()returns true if the table is sorted.booleanreturn the sort full table property.booleanreturn the sort order of the page.voidreset()Reset.voidsetCaption(String caption) Set this table's caption.voidSet this table's footer.voidSetter forform.voidSetter for the tablemodel id.voidsetLocalSort(boolean localSort) Sets whether the table performs local in memory sorting of the data.voidsetMedia(MediaTypeEnum media) sets the current media type.voidsetPageOffset(int offset) Sets the starting offset for elements in the viewable list.voidsetRowListPage(List<Row> rowList) Sets the row list page.voidsetSortedColumnName(String sortedColumnName) sets the name of the currently sorted column.voidsetSortedColumnNumber(int sortIndex) set the sorted column index.voidsetSortFullTable(boolean sortFull) sets the sort full table property.voidsetSortOrderAscending(boolean isSortOrderAscending) set the sort order of the list.voidsetTableDecorator(TableDecorator decorator) setter for the table decorator.voidsetTotaler(TableTotaler totaler) Sets the totaler.voidsort the full list of data.voidsort the list displayed in page.toString()To string.
-
Constructor Details
-
TableModel
public TableModel(TableProperties tableProperties, String charEncoding, jakarta.servlet.jsp.PageContext pageContext) Constructor for TableModel.- Parameters:
tableProperties- table propertiescharEncoding- response encodingpageContext- the page context
-
-
Method Details
-
getPageContext
protected jakarta.servlet.jsp.PageContext getPageContext()Returns the jsp page context.- Returns:
- page context
-
getMedia
-
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
-
setForm
-
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
-
getRowListFull
-
getRowListPage
-
addRow
-
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
-
getTableDecorator
-
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- iftruereturns an iterator on te full list, iffalseonly 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
-
setCaption
Set this table's caption.- Parameters:
caption- This table's caption.
-
toString
-
getTotaler
-
setTotaler
Sets the totaler.- Parameters:
totaler- the new totaler
-
reset
public void reset()Reset. -
getColumnVisibilities
-