Class TableModel

java.lang.Object
org.displaytag.model.TableModel

public class TableModel extends Object
Table Model. Holds table data for presentation.
Version:
$Revision$ ($Author$)
Author:
Fabrizio Giustina
  • Constructor Details

    • TableModel

      public TableModel(TableProperties tableProperties, String charEncoding, javax.servlet.jsp.PageContext pageContext)
      Constructor for TableModel.
      Parameters:
      tableProperties - table properties
      charEncoding - response encoding
      pageContext - the page context
  • Method Details

    • getPageContext

      protected javax.servlet.jsp.PageContext getPageContext()
      Returns the jsp page context.
      Returns:
      page context
    • getMedia

      public MediaTypeEnum getMedia()
      Gets the current media type.
      Returns:
      current media (html, pdf ...)
    • setMedia

      public void setMedia(MediaTypeEnum media)
      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

      public String getForm()
      Getter for form.
      Returns:
      Returns the form.
    • setForm

      public void setForm(String form)
      Setter for form.
      Parameters:
      form - The form to set.
    • getPageOffset

      public int getPageOffset()
      Getter for pageOffset.
      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

      public void setId(String tableId)
      Setter for the tablemodel id.
      Parameters:
      tableId - same id of table tag, needed for logging
    • getId

      public String getId()
      get the table id.
      Returns:
      table id
    • getRowListFull

      public List<Row> getRowListFull()
      get the full list.
      Returns:
      the full list containing Row objects
    • getRowListPage

      public List<Row> getRowListPage()
      gets the partial (paginated) list.
      Returns:
      the partial list to display in page (contains Row objects)
    • addRow

      public void addRow(Row row)
      adds a Row object to the table.
      Parameters:
      row - Row
    • setSortedColumnName

      public void setSortedColumnName(String sortedColumnName)
      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

      public void setRowListPage(List<Row> rowList)
      Sets the row list page.
      Parameters:
      rowList - - the new value for this.rowListPage
    • getTableDecorator

      public TableDecorator getTableDecorator()
      getter for the Table Decorator.
      Returns:
      TableDecorator
    • setTableDecorator

      public void setTableDecorator(TableDecorator decorator)
      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

      public HeaderCell 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

      public void addColumnHeader(HeaderCell headerCell)
      Adds a column header (HeaderCell object).
      Parameters:
      headerCell - HeaderCell
    • getHeaderCellList

      public List<HeaderCell> getHeaderCellList()
      List containing headerCell objects.
      Returns:
      List containing headerCell objects
    • getRowIterator

      public RowIterator getRowIterator(boolean full)
      returns a RowIterator on the requested (full|page) list.
      Parameters:
      full - if true returns an iterator on te full list, if false 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

      public TableProperties getProperties()
      Returns the table properties.
      Returns:
      the configured table properties.
    • getEncoding

      public String getEncoding()
      Getter for character encoding.
      Returns:
      Returns the encoding used for response.
    • getCaption

      public String getCaption()
      Obtain this table's caption.
      Returns:
      This table's caption.
    • setCaption

      public void setCaption(String caption)
      Set this table's caption.
      Parameters:
      caption - This table's caption.
    • getFooter

      public String getFooter()
      Obtain this table's footer.
      Returns:
      This table's footer.
    • setFooter

      public void setFooter(String footer)
      Set this table's footer.
      Parameters:
      footer - This table's footer.
    • toString

      public String toString()
      To string.
      Overrides:
      toString in class Object
      Returns:
      the string
      See Also:
    • getTotaler

      public TableTotaler getTotaler()
      Gets the totaler.
      Returns:
      the totaler
    • setTotaler

      public void setTotaler(TableTotaler totaler)
      Sets the totaler.
      Parameters:
      totaler - the new totaler
    • reset

      public void reset()
      Reset.