Class TableContainer

All Implemented Interfaces:
Component, Container, Serializable, Cloneable

public class TableContainer extends AbstractContainer
Container for a HTML table.
See Also:
  • Field Details

    • tm

      protected TableModel tm
    • headerNames

      protected List<Serializable> headerNames
    • colouredRows

      protected boolean colouredRows
    • counter

      protected int counter
  • Constructor Details

    • TableContainer

      public TableContainer()
      constructs a new empty tablecontainer
    • TableContainer

      public TableContainer(String id)
      Constructs a new empty table-container.
      Parameters:
      id - id of the table element
    • TableContainer

      public TableContainer(String className, String width, boolean colored)
    • TableContainer

      public TableContainer(String id, TableModel t)
      constructs a new tablecontainer
      Parameters:
      id - - the id
      t - - the tablemodel
    • TableContainer

      public TableContainer(TableModel t)
      constructs a new tablecontainer
      Parameters:
      t - - the tablemodel
    • TableContainer

      public TableContainer(List<Object> headers, TableModel t)
      constructs a new tablecontainer
      Parameters:
      t - - the tablemodel
  • Method Details

    • setUseTableBody

      public void setUseTableBody(boolean use)
    • setModel

      public void setModel(TableModel t)
    • dataChanged

      protected void dataChanged(TableModel src)
      builds the tree in a new order (moveRow)
      Parameters:
      src - - the new sorted TableModel
    • setValueAt

      public void setValueAt(Object o, int rowIndex, int colIndex)
      sets a new value (a new component) to the specified position in the table
      Parameters:
      o - - the new component
      rowIndex - - the row index of the new component
      colIndex - - the column index of the new component
    • addRow

      public void addRow(List<?> rowData)
      adds a new row at the end of the table with the content of the vector
      Parameters:
      rowData -
    • addRow

      public void addRow(List<?> rowData, boolean isHeader)
    • addRow

      public void addRow(List<?> rowData, List<Pair<String,String>> dataprops)
      adds a new row with the specified dataproperties
      Parameters:
      rowData - the data of the new row
      dataprops - the properties of each data in the row
    • addRow

      public void addRow(List<?> rowData, List<Pair<String,String>> rowprops, List<Pair<String,String>> dataprops)
      adds a new row with the properties in the vector if the row is a systemstep row, the row is always red!!
      Parameters:
      rowData - the data of the new row
      rowprops - the properties of the row (Pairs)
      dataprops - the properties of each cell in the row (Pairs)
    • addRow

      public void addRow(List<?> rowData, String id, List<Pair<String,String>> rowprops, List<Pair<String,String>> dataprops)
      Adds a new Row with a row id.
      Parameters:
      rowData - the data of the new row
      id - id of row
      rowprops - the properties of the row (Pairs)
      dataprops - the properties of each cell in the row (Pairs)
    • addHeader

      public void addHeader(List<?> rowData)
    • getRows

      public List<Element> getRows(boolean isHeader)
    • addRow

      public void addRow(Object... row)
    • addRow

      public void addRow(Object[] row, String id, List<Pair<String,String>> rowprops, List<Pair<String,String>> dataprops, boolean isHeader)
    • addRow

      public void addRow(List<?> rowData, String id, List<Pair<String,String>> rowprops, List<Pair<String,String>> dataprops, boolean isHeader)
      Add a row to the table.
      Parameters:
      rowData - a list of row data
      id - id of the row
      rowprops - list of row properties
      dataprops - list of properties for each table cell
      isHeader - true if the row is a header row (TH elements)
    • setCellValue

      protected void setCellValue(Element cell, Object data, List<Pair<String,String>> cellprops, int colindex)
    • removeRow

      protected List<Element> removeRow(int index)
      removes the rows at the specified position INDEX from the table
      Parameters:
      index - - the index of the first row
      Returns:
      - vector of deleted objects (elements)
    • getTableAttributes

      public List<Pair<String,String>> getTableAttributes()
      returns a vector of pairs (names, attributes) of the table element
    • getHeaderContent

      public List<Object> getHeaderContent()
      returns the content of the column header (first row)
    • setHeaderName

      public void setHeaderName(int index, String name)
      sets the columnname of a specified column
      Parameters:
      index - - the specified column
      name - - the new name of the column
    • getHeaderNames

      public List<Serializable> getHeaderNames()
      returns the names of the columns
    • setHeaderAttribute

      public void setHeaderAttribute(String name, String value)
      sets an attribute of the column header (first row)
      Parameters:
      name - - the attribute name
      value - - the attribute value
    • setCellAttribute

      public void setCellAttribute(int rowIndex, int colIndex, String name, String value)
      sets the attribute in the specified cell
      Parameters:
      rowIndex - - the row index of the specified cell
      colIndex - - the column index of the specified cell
      name - - the name of the attribute
      value - - the value of the attribute
    • getCellAttributes

      public List<Attribute> getCellAttributes(int rowIndex, int colIndex)
      returns a vector of attributes of the chosen cell
      Parameters:
      rowIndex - - the row index of the specified cell
      colIndex - - the column index of the specified cell
    • setColumnWidth

      public void setColumnWidth(int colIndex, int width)
      sets the width of a specified column
      Parameters:
      colIndex - - the column index
      width - - the width
    • setColumnHeight

      public void setColumnHeight(int colIndex, int height)
      sets the height of a specified column
      Parameters:
      colIndex - - the column index
      height - - the height
    • setColumnAlign

      public void setColumnAlign(int colIndex, String align)
      sets the attribute, which controls whether the text is aligned to the left to the right or in the center
      Parameters:
      colIndex - - the specified column
      align - - center, left or right
    • setColumnValign

      public void setColumnValign(int colIndex, String valign)
      sets the attribute, which controls whether the text is vertical aligned to the to the top, middle bottom or in the baseline
      Parameters:
      colIndex - - the specified column
      valign - - top, middle, bottom or baseline
    • getColumnWidth

      public int getColumnWidth(int colIndex) throws DataConversionException
      returns the width of a specified column
      Parameters:
      colIndex - - the column index
      Returns:
      - the width in int
      Throws:
      DataConversionException
    • setColumnAttribute

      public void setColumnAttribute(int colIndex, String name, String value)
      sets the specified attribute in the whole column
      Parameters:
      colIndex - - the column
      name - - the attribute name
      value - - the attribute value
    • setRowAttribute

      public void setRowAttribute(int rowIndex, String name, String value)
      sets the specified attribute in the whole row
      Parameters:
      rowIndex - - the row
      name - - the attribute name
      value - - the attribute value
    • getColumnAttributes

      @Deprecated public List<Object> getColumnAttributes(int colIndex)
      Deprecated.
      since 10.0
      Returns:
      always null
    • setComponent

      public void setComponent(int colIndex, Class<? extends Component> cl)
      sets a specified component in the chosen column sets the component for all elements except the first one (row 0 - header column!!!)
      Parameters:
      colIndex - - the column
      cl - - the specified component as class
    • getComponentAt

      public Component getComponentAt(int rowIndex, int colIndex)
      returns the component at the specified position
      Parameters:
      rowIndex - - the row index
      colIndex - - the column index
      Returns:
      - the component
    • getValueAt

      public String getValueAt(int rowIndex, int colIndex)
      returns a string representation of the component at the specified position
      Parameters:
      rowIndex - - the row index
      colIndex - - the column index
      Returns:
      - the string representation of the component
    • build

      protected void build()
      builds the table with the elements of the TableModel.
    • getModel

      public TableModel getModel()
    • setContent

      public void setContent(Object o)
      Initialize the table with the given tabel model.
      Specified by:
      setContent in interface Component
      Overrides:
      setContent in class AbstractComponent
      Parameters:
      o - a table model
    • getContent

      public Object getContent()
      Returns null.
      Specified by:
      getContent in interface Component
      Overrides:
      getContent in class AbstractComponent
      Returns:
      null
    • showRows

      public String showRows()
    • setColouredRows

      public void setColouredRows(boolean coloured)
      sets whether every second row is coloured or not sets the counter for counting the number of rows 0
      Parameters:
      coloured -
    • addColspanRow

      public void addColspanRow(List<?> rowData, boolean add, int from, int length)
      adds a new row with colspan
      Parameters:
      rowData - the data of the row
      add - specifies whether the row is an comment (true) or not
      from - the number of the cell, where the colspan starts
      length - the size of the colspan