Package jmri.swing

Interface JTablePersistenceManager

All Known Implementing Classes:
JmriJTablePersistenceManager

public interface JTablePersistenceManager
Manager for ensuring that JTable user interface state is persisted.

JTable user interface state that can be persisted includes:

  • row sort order (if the table has a non-null RowSorter)
  • column order
  • column visibility
  • column width

Row sort order is only persisted for JTables that implement the RowSorter for sorting. If the RowSorter is null, the row sorting will not be persisted.

Column attributes (order, visibility, and width) are persisted by listening to changes in the TableColumnModel of the table. Column visibility is persisted only if the TableColumnModel is assignable from XTableColumnModel. Columns will be saved using the String representation of either TableColumn.getIdentifier() or TableColumn.getHeaderValue().

Tables against which persist(javax.swing.JTable) is called without first calling resetState(javax.swing.JTable) will not have state retained across application restarts.

Note: A JTable with UI state being persisted must have a unique non-null name; columns in the table must also have unique non-null identifiers or header text.

  • Method Summary

    Modifier and Type Method Description
    void cacheState​(JTable table)
    Add the current state for a table to the cache.
    void clearState​(JTable table)
    Remove the persistent state for a table from the cache.
    boolean isPaused()
    Determine if saving persistence data is paused.
    boolean isPersistenceDataRetained​(String name)
    Determine if persistence data is being held for a table.
    boolean isPersistenceDataRetained​(JTable table)
    Determine if persistence data is being held for a table.
    boolean isPersisting​(String name)
    Determine if a table is being persisted by name.
    boolean isPersisting​(JTable table)
    Determine if a table is being persisted.
    default void persist​(JTable table)
    Persist the user interface state for a table.
    void persist​(JTable table, boolean resetState)
    Persist the user interface state for a table.
    void resetState​(JTable table)
    Reset the table state to the cached state.
    void setPaused​(boolean paused)
    Pause saving persistence data to storage.
    void stopPersisting​(JTable table)
    Stop persisting the table.