Class ReportingTableModel

java.lang.Object
com.groiss.ds.ObjectTableModel
com.groiss.reporting.data.ReportingTableModel
All Implemented Interfaces:
TableModel

public class ReportingTableModel extends ObjectTableModel
reporting tablemodel holds data which are read from db and calculated data like grouping rows
  • Constructor Details

    • ReportingTableModel

      public ReportingTableModel(List<List<Object>> data, List<?> header, Query q)
      Constructor for ReportingTableModel
      Parameters:
      data - the data Matrix of the reportingtablemodel (rownumbers and groupingrows are not included)
      the list of lists contains instances of com.groiss.reporting.data.ReportingExportable or java.lang.String
      header - the header objects without a header for the row number columns
      q - The Query Objet
  • Method Details

    • addGroupingRows

      public void addGroupingRows(Map<Integer,List<Object>> groupingrows)
      Add Grouping Rows to Table Model
      Parameters:
      groupingrows - a map of grouping rows map has the row index of this gouping row as key and the row (list of objects) as value
    • getRowCount

      public int getRowCount()
      Description copied from class: ObjectTableModel
      Get amount of rows in the tablemodel.
      Specified by:
      getRowCount in interface TableModel
      Overrides:
      getRowCount in class ObjectTableModel
    • getColumnCount

      public int getColumnCount()
      Description copied from class: ObjectTableModel
      Get the amount of colums of the tablemodel.
      Specified by:
      getColumnCount in interface TableModel
      Overrides:
      getColumnCount in class ObjectTableModel
    • getColumnHeader

      public Object getColumnHeader(int c)
      Description copied from class: ObjectTableModel
      Returns the header at column c.
      Overrides:
      getColumnHeader in class ObjectTableModel
      Parameters:
      c - the column index
      Returns:
      the object representing column header
    • getColumnName

      public String getColumnName(int c)
      Description copied from class: ObjectTableModel
      Get the name of the Column. If the column name is an object, toString is called on the value.
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class ObjectTableModel
      Parameters:
      c - the column index
    • isGroupingRow

      public boolean isGroupingRow(int rowIndex)
      Returns boolean flag if a rowIndex references to a grouping row
      Parameters:
      rowIndex -
      Returns:
      true if passed rowIndex is a Grouping row.
    • addRow

      public void addRow(List row)
      Description copied from class: ObjectTableModel
      Add a row at the bottom of tablemodel.
      Overrides:
      addRow in class ObjectTableModel
      Parameters:
      row - the new row
    • setValueAt

      public void setValueAt(Object val, int r, int c)
      Sets a cell value in the table model.
      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class ObjectTableModel
      Parameters:
      val - the object
      r - the row index
      c - the column index
    • getFullData

      public List<List<Object>> getFullData()
      returns the completeted Data table including clickableIndex at index 0 (if exists), rownumber at index 0 or 1 (depends on clickableindex) and grouping rows (which habe no clickableIndex or rownumber Note: Method builds a new table, so this may cost performance.
    • getData

      public List<List<Object>> getData()
      Returns the Raw List of Data without clickableIndex, rownumber or groupingrows
      Overrides:
      getData in class ObjectTableModel
      Returns:
      the raw data table
    • showGroupingRows

      public void showGroupingRows(boolean showRows)
      Set Flag if grouping rows should be shown.
      Parameters:
      showRows - - true if sum Rows should be shown.
    • getValueAt

      public Object getValueAt(int rowIndex, int columnIndex)
      Description copied from class: ObjectTableModel
      Returns the value for the cell at columnIndex and rowIndex.
      Specified by:
      getValueAt in interface TableModel
      Overrides:
      getValueAt in class ObjectTableModel
      Parameters:
      rowIndex - the row index
      columnIndex - the column index
    • getDrillDownValues

      public static List<Pair<String,String>> getDrillDownValues(ReportingExportable re)
      Parameters:
      re -
      Returns:
    • getClickableIndex

      public int getClickableIndex()
      Returns:
      the columnIndex which holds the value, which is the clickable value of the row
    • getQuery

      public Query getQuery()
      Returns:
      the referenced query object. null if not set.
    • setSeriesDef

      public void setSeriesDef(Map<Integer,ReportingExportable> seriesDef)
    • getSeriesDef

      public ReportingExportable getSeriesDef(int col)