Class SwappableTable<KEY_TYPE,VALUE_TYPE>
java.lang.Object
com.illumon.iris.db.plot.util.tables.SwappableTable<KEY_TYPE,VALUE_TYPE>
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SwappableTableOneClickAbstract
public abstract class SwappableTable<KEY_TYPE,VALUE_TYPE> extends Object implements Serializable
Holds a handle on a table that may get swapped out for another table.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SwappableTable.LocalTableUpdateListener
Listens for when the table gets swapped out. -
Field Summary
Fields Modifier and Type Field Description protected TableMapHandle
tableMapHandle
-
Constructor Summary
Constructors Constructor Description SwappableTable(TableMapHandle tableMapHandle)
Creates a SwappableTable instance with thetableHandle
. -
Method Summary
Modifier and Type Method Description abstract void
addColumn(String column)
Adds a column to the underlying table structures.void
addDataChangeListener(DataChangeListener listener)
Adds a listener to the update list.Table
addLocalTableUpdateListener(SwappableTable.LocalTableUpdateListener listener)
Adds a listener to the update list.protected void
beginBatchUpdate()
protected abstract Table
computeRemoteTable()
Computes the remote table.protected void
endBatchUpdate()
void
freezeSnapshots()
protected abstract String
getFriendlyName()
Get a readable name for use with threads/logs etc.protected FigureTableSnapshotManager
getManager()
TableSnapshot
getReplicatedTableSnapshot()
Map<String,Object>
getSnapshotData()
TableDefinition
getTableDefinition()
Gets the signature (columns and types) of the table, \even if the data is transformed.TableMapHandle
getTableMapHandle()
Gets theTableHandle
for this SwappableTable.protected void
invokeRecompute()
protected abstract void
localRecomputeComplete()
protected void
maybeInitializeTransient()
void
removeLocalTableUpdateListener(SwappableTable.LocalTableUpdateListener listener)
Removes a listener to the update list.void
setManager(FigureTableSnapshotManager manager)
boolean
tableCalculationChanged(KEY_TYPE key, VALUE_TYPE value)
Updates the local table with the specified calculation.boolean
thawSnapshots()
void
unsubscribeLocalTable()
protected abstract boolean
updateState(KEY_TYPE key, VALUE_TYPE value)
Update the state for a given column selection.
-
Field Details
-
Constructor Details
-
SwappableTable
Creates a SwappableTable instance with thetableHandle
.- Parameters:
tableMapHandle
- holds the table
-
-
Method Details
-
getTableMapHandle
Gets theTableHandle
for this SwappableTable.- Returns:
- this SwappableTable's
TableHandle
-
addColumn
Adds a column to the underlying table structures.- Parameters:
column
- column
-
getTableDefinition
Gets the signature (columns and types) of the table, \even if the data is transformed.- Returns:
- table with the columns and types of the final table
-
updateState
Update the state for a given column selection.- Parameters:
key
- key for table calculationvalue
- value for table calculation- Returns:
- whether this table should recompute
-
computeRemoteTable
Computes the remote table.- Returns:
- computed remote table
-
tableCalculationChanged
Updates the local table with the specified calculation.- Parameters:
key
- keyvalue
- value- Returns:
- true if the table calculation changed
-
invokeRecompute
protected void invokeRecompute() -
getFriendlyName
Get a readable name for use with threads/logs etc.- Returns:
- a name to use
-
localRecomputeComplete
protected abstract void localRecomputeComplete() -
setManager
-
getManager
-
getReplicatedTableSnapshot
-
freezeSnapshots
public void freezeSnapshots() -
thawSnapshots
public boolean thawSnapshots() -
getSnapshotData
-
addLocalTableUpdateListener
Adds a listener to the update list. Thelistener
will be notified of local table updates.- Parameters:
listener
- listener- Returns:
- current local table
-
removeLocalTableUpdateListener
Removes a listener to the update list.- Parameters:
listener
- listener
-
addDataChangeListener
Adds a listener to the update list. Thelistener
will be notified of data changes.- Parameters:
listener
- listener
-
unsubscribeLocalTable
public void unsubscribeLocalTable() -
maybeInitializeTransient
protected void maybeInitializeTransient() -
beginBatchUpdate
protected void beginBatchUpdate() -
endBatchUpdate
protected void endBatchUpdate()
-