Class ClientTableState

java.lang.Object
io.deephaven.web.client.api.batch.TableConfig
io.deephaven.web.client.state.ClientTableState

public final class ClientTableState extends TableConfig
Container for state information pertaining to a given TableTicket. Where JsTable is a mutable object which can point to any given ClientTableState, each ClientTableState represents an immutable table configuration / handle which can have zero or more JsTable objects bound to it. This type is used to replace Table#StackEntry, and works with TableList to form an arbitrary "chain of table mutations leading to table state at handle N". Each JsTable maintains their own TableList / linking structure of ClientTableState instances, and each CTS holds maps of "the state each bound JsTable holds -for this particular handle-". Being mutable, a JsTable can change its binding to any given CTS instance, and will need to temporarily abandon it's current state when transitioning to a new one. We need to be able to reinstate the last good active state whenever a request fails, otherwise we will releaseTable from the given state. Once no JsTable is making any use of any ClientTableState, that state should be released on the server and discarded by the client (an interim state which an active state is based on must always be retained). By making the JsTable read it's state from a ClientTableState, switching to another state should be relatively seamless; JsTable is mutable and as stateless as possible, with as much state as possible shoved into CTS (so it can go away and be restored sanely). Consider making this a js type with restricted, read-only property access.
  • Field Details

  • Constructor Details

  • Method Details

    • maybeRevive

      public elemental2.promise.Promise<ClientTableState> maybeRevive(BrowserHeaders metadata)
    • hasDefinition

      public boolean hasDefinition()
    • isRunning

      public boolean isRunning()
    • isResolved

      public boolean isResolved()
    • getHandle

      public TableTicket getHandle()
    • columnTypes

      public Class<?>[] columnTypes()
      Returns the Java Class to represent each column in the table. This lets the client replace certain JVM-only classes with alternative implementations, but still use the simple BarrageTypeInfo wrapper.
    • componentTypes

      public Class<?>[] componentTypes()
      Returns the Java Class to represent the component type in any list/array type. At this time, this value is not used by the chunk reading implementation.
    • newState

      public ClientTableState newState(TableTicket newHandle, TableConfig config)
    • getResolution

      public ClientTableState.ResolutionState getResolution()
    • setResolution

      public void setResolution(ClientTableState.ResolutionState resolution)
    • setResolution

      public void setResolution(ClientTableState.ResolutionState resolution, String failMsg)
    • getCustomColumnsString

      public List<String> getCustomColumnsString()
    • getCustomColumnsObject

      public List<CustomColumn> getCustomColumnsObject()
    • getColumns

      public Column[] getColumns()
    • getAllColumns

      public Column[] getAllColumns()
    • getLayoutHints

      public JsLayoutHints getLayoutHints()
    • getTotalsTableConfig

      public JsTotalsTableConfig getTotalsTableConfig()
    • getSize

      public long getSize()
    • setSize

      public void setSize(long size)
    • getTableDef

      public InitialTableDefinition getTableDef()
    • getRowFormatColumn

      public Column getRowFormatColumn()
    • setRowFormatColumn

      public void setRowFormatColumn(Column rowFormatColumn)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class TableConfig
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TableConfig
    • onRunning

      public void onRunning(JsConsumer<ClientTableState> callback, JsRunnable other)
    • onRunning

      public void onRunning(JsConsumer<ClientTableState> callback, JsConsumer<String> failed, JsRunnable release)
    • onFailed

      public void onFailed(JsConsumer<String> callback, JsRunnable other)
    • isCompatible

      public boolean isCompatible(List<Sort> sorts, List<FilterCondition> filters, List<CustomColumnDescriptor> customColumns, boolean flat)
      Checks if the current state can be used as a root to turn into the state described by the supplied arguments. While it is technically valid to interleave filters and sorts, for maximal performance, we want to ensure filters are always applied before sorts; so, if you have added a filter, but the current state has any sorts at all, we will return false, even though this state would be correct when used, it won't be maximally efficient. Additionally, custom columns might be used in filters and sorts, but a filter or sort on a custom column cannot be created until that custom column has been exported and provides a table definition so that we can supply Column instances to operate upon.
      Parameters:
      sorts - The full set of sorts we want in our resulting table state
      filters - The full set of filters we want in our resulting table state
      customColumns - The full set of custom columns we want in our resulting table state
      flat - True if the resulting table should have a flatten index, false otherwise
      Returns:
      true if this state can be used to add
    • findColumn

      public Column findColumn(String key)
    • isEmpty

      public boolean isEmpty()
      Overrides:
      isEmpty in class TableConfig
      Returns:
      true if there are no tables bound to this state. If a table that had a subscription for this state was orphaned by a pending request, we want to clear the subscription immediately so it becomes inert (immediately remove the subscription), but we may need to rollback the request, and we don't want to release the handle until the pending request is finished (whereupon we will remove the binding).
    • retain

      public JsRunnable retain(Object retainer)
      Call this with a marker object that you want to use to cause the state to be retained. You either need to hold onto the returned function to clear your binding, or call unretain(Object) when finished to avoid keeping this handle alive beyond its usefulness.
    • unretain

      public void unretain(Object retainer)
    • hasSort

      public boolean hasSort(Sort candidate)
    • hasCustomColumn

      public boolean hasCustomColumn(CustomColumnDescriptor candidate)
    • hasFilter

      public boolean hasFilter(FilterCondition candidate)
    • isFinished

      public boolean isFinished()
    • isDisconnected

      public boolean isDisconnected()
    • addPaused

      public void addPaused(JsTable table, PausedTableBinding paused)
    • createBinding

      public ActiveTableBinding createBinding(JsTable table)
    • releaseTable

      public boolean releaseTable(JsTable table)
    • makeBitset

      public BitSet makeBitset(Column[] columns)
    • getBoundTables

      public MappedIterable<JsTable> getBoundTables()
    • forActiveTables

      public void forActiveTables(JsConsumer<JsTable> callback)
    • forActiveLifecycles

      public void forActiveLifecycles(JsConsumer<HasLifecycle> callback)
    • toString

      public String toString()
      Overrides:
      toString in class TableConfig
    • toStringMinimal

      public String toStringMinimal()
    • getPrevious

      public ClientTableState getPrevious()
    • getBinding

      public HasTableState<ClientTableState> getBinding(JsTable table)
    • getActiveBinding

      public ActiveTableBinding getActiveBinding(JsTable table)
    • getActiveBindings

      public Iterable<ActiveTableBinding> getActiveBindings()
    • pause

      public void pause(JsTable table)
    • unpause

      public void unpause(JsTable table)
    • ancestors

      public MappedIterable<ClientTableState> ancestors()
    • reversed

      public MappedIterable<ClientTableState> reversed()
    • cleanup

      public void cleanup()
      Look through paused tables to see if any of them have been closed.
    • getLastTouched

      public double getLastTouched()
    • newestFirst

      public static Comparator<? super ClientTableState> newestFirst()
    • fetchTable

      public elemental2.promise.Promise<JsTable> fetchTable(HasEventHandling failHandler, BrowserHeaders metadata)
    • refetch

      public elemental2.promise.Promise<ClientTableState> refetch(HasEventHandling failHandler, BrowserHeaders metadata)
    • applyTableCreationResponse

      public void applyTableCreationResponse(ExportedTableCreationResponse def)
    • isAncestor

      public boolean isAncestor(ClientTableState was)
    • doNotResuscitate

      public void doNotResuscitate()
    • shouldResuscitate

      public boolean shouldResuscitate()
    • hasRetainer

      public boolean hasRetainer(Object test)
    • getConnection

      public WorkerConnection getConnection()
    • getFetchSummary

      public String getFetchSummary()
    • isStatic

      public boolean isStatic()