Interface JTablePersistenceManager
- 
- All Known Implementing Classes:
- JmriJTablePersistenceManager
 
 public interface JTablePersistenceManager Manager for ensuring thatJTableuser 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 RowSorterfor 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 TableColumnModelof the table. Column visibility is persisted only if the TableColumnModel is assignable fromXTableColumnModel. Columns will be saved using the String representation of eitherTableColumn.getIdentifier()orTableColumn.getHeaderValue().Tables against which persist(javax.swing.JTable)is called without first callingresetState(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 SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcacheState(javax.swing.JTable table)Add the current state for a table to the cache.voidclearState(javax.swing.JTable table)Remove the persistent state for a table from the cache.booleanisPaused()Determine if saving persistence data is paused.booleanisPersistenceDataRetained(java.lang.String name)Determine if persistence data is being held for a table.booleanisPersistenceDataRetained(javax.swing.JTable table)Determine if persistence data is being held for a table.booleanisPersisting(java.lang.String name)Determine if a table is being persisted by name.booleanisPersisting(javax.swing.JTable table)Determine if a table is being persisted.default voidpersist(javax.swing.JTable table)Persist the user interface state for a table.voidpersist(javax.swing.JTable table, boolean resetState)Persist the user interface state for a table.voidresetState(javax.swing.JTable table)Reset the table state to the cached state.voidsetPaused(boolean paused)Pause saving persistence data to storage.voidstopPersisting(javax.swing.JTable table)Stop persisting the table.
 
- 
- 
- 
Method Detail- 
persistdefault void persist(@Nonnull javax.swing.JTable table) throws java.lang.IllegalArgumentException, java.lang.NullPointerException Persist the user interface state for a table. The name returned byComponent.getName()is used to persist the table, so ensure the name is set such that it can be retrieved by the same name in a later JMRI execution.Note that the current state of the table, if not already persisted, at the time of this call is retained as the table state. Using this method is the same as calling persist(javax.swing.JTable, boolean)with false for the second argument.- Parameters:
- table- the table to persist
- Throws:
- java.lang.IllegalArgumentException- if another table instance is already persisted by the same name
- java.lang.NullPointerException- if the table name is null
 
 - 
persistvoid persist(@Nonnull javax.swing.JTable table, boolean resetState) throws java.lang.IllegalArgumentException, java.lang.NullPointerException Persist the user interface state for a table. The name returned byComponent.getName()is used to persist the table, so ensure the name is set such that it can be retrieved by the same name in a later JMRI execution.Note that the current state of the table, if not already persisted, at the time of this call is retained as the table state unless resetStateis true.Using this method with resetStateset to true is the same asresetState(javax.swing.JTable)immediately prior to callingpersist(javax.swing.JTable).- Parameters:
- table- the table to persist
- resetState- reset the table to the stored state if true; retain the current state if false
- Throws:
- java.lang.IllegalArgumentException- if another table instance is already persisted by the same name
- java.lang.NullPointerException- if the table name is null
 
 - 
stopPersistingvoid stopPersisting(@Nonnull javax.swing.JTable table) throws java.lang.NullPointerException Stop persisting the table. This does not clear the persistence state, but merely causes the JTablePersistenceManager to stop listening to the table. No error is thrown if the table state was not being persisted.- Parameters:
- table- the table to stop persisting
- Throws:
- java.lang.NullPointerException- if the table name is null
 
 - 
clearStatevoid clearState(@Nonnull javax.swing.JTable table) throws java.lang.NullPointerException Remove the persistent state for a table from the cache. This does not cause the JTablePersistanceManager to stop persisting the table.- Parameters:
- table- the table to clear
- Throws:
- java.lang.NullPointerException- if the table name is null
 
 - 
cacheStatevoid cacheState(@Nonnull javax.swing.JTable table) throws java.lang.NullPointerException Add the current state for a table to the cache. This does not cause the JTablePersistanceManager to start persisting the table.- Parameters:
- table- the table to cache
- Throws:
- java.lang.NullPointerException- if the table name is null
 
 - 
resetStatevoid resetState(@Nonnull javax.swing.JTable table) throws java.lang.NullPointerException Reset the table state to the cached state. This does not cause the JTablePersistanceManager to start persisting the table.- Parameters:
- table- the table to reset
- Throws:
- java.lang.NullPointerException- if the table name is null
 
 - 
setPausedvoid setPaused(boolean paused) Pause saving persistence data to storage. If setting paused to false, pending persistence data is written immediately.- Parameters:
- paused- true if saving persistence data should be paused; false otherwise.
 
 - 
isPausedboolean isPaused() Determine if saving persistence data is paused.- Returns:
- true if saving persistence data is paused; false otherwise.
 
 - 
isPersistingboolean isPersisting(@Nonnull javax.swing.JTable table) Determine if a table is being persisted.- Parameters:
- table- the table to check against
- Returns:
- true if the table is being persisted; false otherwise
 
 - 
isPersistingboolean isPersisting(@Nonnull java.lang.String name) Determine if a table is being persisted by name.- Parameters:
- name- the name of the table to check against
- Returns:
- true if the table is being persisted; false otherwise
 
 - 
isPersistenceDataRetainedboolean isPersistenceDataRetained(@Nonnull javax.swing.JTable table) Determine if persistence data is being held for a table.- Parameters:
- table- the table to check against
- Returns:
- true if the table has persistence data; false otherwise
 
 - 
isPersistenceDataRetainedboolean isPersistenceDataRetained(@Nonnull java.lang.String name) Determine if persistence data is being held for a table.- Parameters:
- name- the name of the table to check against
- Returns:
- true if the table has persistence data; false otherwise
 
 
- 
 
-