Class GTableWidget<T>

Type Parameters:
T - the row object type that will be in the table
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class GTableWidget<T> extends JPanel
A GUI that provides a filterable table. You are required to provide the method names of T that should be used to create columns in the table.
See Also:
  • Constructor Details

    • GTableWidget

      public GTableWidget(String modelName, Class<T> tClass, String... methodNames)
    • GTableWidget

      public GTableWidget(String modelName, Method... methods)
    • GTableWidget

      public GTableWidget(String modelName, Class<T> tClass, List<String> methodNames)
    • GTableWidget

      public GTableWidget(String modelName, List<Method> methodNames)
  • Method Details

    • setColumnPreferredWidths

      public void setColumnPreferredWidths(int... widths)
      Sets the column preferred widths. If you give less widths then there are columns, then the widths will be applied in order, with the remaining columns going untouched.

      Note: this method needs to be called after building your columns. So, call this after making any calls to addColumn(AbstractDynamicTableColumn).

      WARNING! If you set the widths to a size that is smaller than the total display, then the table model will apply the extra space equally across your columns, resulting in sizes that you did not set. So, the best way to use this method is to set the actual preferred size for your small columns and then set a very large size (400 or so) for your columns that can be any size.

      Parameters:
      widths - the widths to apply
    • setSortColumn

      public void setSortColumn(int column)
    • setSortColumn

      public void setSortColumn(int column, boolean ascending)
    • processMouseClicked

      protected void processMouseClicked(MouseEvent e)
    • setItemPickListener

      public void setItemPickListener(TableItemPickedListener<T> listener)
    • getData

      public List<T> getData()
    • setData

      public void setData(List<T> data)
    • setData

      public void setData(Collection<T> data)
    • getSelectedRowObjects

      public List<T> getSelectedRowObjects()
    • getSelectedRowCount

      public int getSelectedRowCount()
    • setSelectionMode

      public void setSelectionMode(int mode)
      Sets the selection mode of this table.
      Parameters:
      mode - the mode
      See Also:
    • getSelectionMode

      public int getSelectionMode()
    • addSelectionListener

      public void addSelectionListener(ObjectSelectedListener<T> l)
    • removeSelectionListener

      public void removeSelectionListener(ObjectSelectedListener<T> l)
    • getItemAt

      public T getItemAt(Point point)
    • getModel

      public AnyObjectTableModel<T> getModel()
    • addColumn

      public void addColumn(AbstractDynamicTableColumn<T,?,Object> column)
    • addColumn

      public void addColumn(AbstractDynamicTableColumn<T,?,Object> column, int index)
    • getRowCount

      public int getRowCount()
    • getRowObject

      public T getRowObject(int row)
    • selectRow

      public void selectRow(int row)
    • selectRowObject

      public void selectRowObject(T rowObject)
    • getSelectedRow

      public int getSelectedRow()
    • rowAtPoint

      public int rowAtPoint(Point point)
    • isRowSelected

      public boolean isRowSelected(int row)
    • getTable

      public GTable getTable()
    • focusFilter

      public void focusFilter()
    • setFilterText

      public void setFilterText(String text)
    • dispose

      public void dispose()