Class CustomTable

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class CustomTable extends JPanel
Custom JPanel that provides a JTable with search functionality and sorting capabilities. It allows adding, removing, and clearing rows, and supports custom behaviors for row clicks and favorite checks.
Author:
Riccardo Finocchiaro, Samuele Lombardi
See Also:
  • Constructor Details

    • CustomTable

      public CustomTable(CustomTable.Builder builder)
      Create a CustomTable with the specified parameters inside the builder.
      Parameters:
      builder - The builder containing the configuration parameters for the table.
  • Method Details

    • addRow

      public void addRow(Object[] rowData)
      Adds a new row to the JTable with the specified data.
      Parameters:
      rowData - An array of objects representing the data for the new row.
    • removeRow

      public void removeRow(String string, ColumnName columnName)
      Adds a new row to the table with the specified data. If the row already exists, it will not be added again.
      Parameters:
      string - the string used to check if the row exists.
      columnName - the column name to check for the string.
    • clear

      public void clear()
      Removes all the rows from the JTable.
      See Also:
    • addAllRows

      public void addAllRows(Object[][] rowsData)
    • setTableRowClickBehaviour

      public void setTableRowClickBehaviour(TableRowClickBehaviour tableRowClickBehaviour)
      Sets the TableCheckIsFavBehaviour to check if a row is marked as favorite.
      Parameters:
      tableRowClickBehaviour - The behavior to set.
      See Also:
    • setSearchColumns

      public void setSearchColumns(ColumnName[] columns)
      Sets the columns to be used for searching in the table.
      Parameters:
      columns -
    • getTable

      public JTable getTable()
      Gets the JTable.
      Returns:
      the JTable instance.
      See Also: