Package io.deephaven.web.client.api
Class JsTotalsTable
java.lang.Object
io.deephaven.web.client.api.JsTotalsTable
- All Implemented Interfaces:
JoinableTable
,ServerObject
@TsInterface
@TsName(namespace="dh",
name="TotalsTable")
public class JsTotalsTable
extends Object
implements JoinableTable, ServerObject
Behaves like a Table, but doesn't expose all of its API for changing the internal state. Instead, state is driven by
the upstream table - when it changes handle, this listens and updates its own handle accordingly.
Additionally, this is automatically subscribed to its one and only row, across all columns.
A new config is returned any time it is accessed, to prevent accidental mutation, and to allow it to be used as a
template when fetching a new totals table, or changing the totals table in use.
A simplistic Table, providing access to aggregation of the table it is sourced from. This table is always
automatically subscribed to its parent, and adopts changes automatically from it. This class has limited methods
found on Table. Instances of this type always have a size of one when no groupBy is set on the config, but may
potentially contain as few as zero rows, or as many as the parent table if each row gets its own group.
When using the `groupBy` feature, it may be desireable to also provide a row to the user with all values across all
rows. To achieve this, request the same Totals Table again, but remove the `groupBy` setting.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.web.client.api.ServerObject
ServerObject.Union
-
Constructor Summary
ConstructorsConstructorDescriptionJsTotalsTable
(JsTable wrappedTable, String directive, elemental2.core.JsArray<String> groupBy) Table is wrapped to let us delegate calls to it, the directive is a serialized string, and the groupBy is copied when passed in, as well as when it is accessed, to prevent accidental mutation of the array. -
Method Summary
Modifier and TypeMethodDescription<T> RemoverFn
addEventListener
(String name, EventFn<T> callback) elemental2.core.JsArray<CustomColumn>
applyCustomColumns
(elemental2.core.JsArray<JsTable.CustomColumnArgUnionType> customColumns) Replace the current custom columns with a new set.elemental2.core.JsArray<FilterCondition>
applyFilter
(FilterCondition[] filter) Replace the currently set filters on the table.elemental2.core.JsArray<Sort>
Replace the currently set sort on this table.elemental2.promise.Promise<JsTable>
asOfJoin
(JoinableTable rightTable, elemental2.core.JsArray<String> columnsToMatch, @JsNullable elemental2.core.JsArray<String> columnsToAdd, @JsNullable String asOfMatchRule) Performs an inexact timeseries join, where rows in this table will have columns added from the closest matching row from the right table.void
close()
Indicates that the table will no longer be used, and resources used to provide it can be freed up on the server.elemental2.promise.Promise<JsTable>
crossJoin
(JoinableTable rightTable, elemental2.core.JsArray<String> columnsToMatch, @JsNullable elemental2.core.JsArray<String> columnsToAdd, @JsNullable Double reserveBits) a promise that will be resolved with the newly created table holding the results of the specified cross join operation.elemental2.promise.Promise<JsTable>
exactJoin
(JoinableTable rightTable, elemental2.core.JsArray<String> columnsToMatch, @JsNullable elemental2.core.JsArray<String> columnsToAdd) a promise that will be resolved with the newly created table holding the results of the specified exact join operation.findColumn
(String key) a column by the given name.Column[]
findColumns
(String[] keys) multiple columns specified by the given names.elemental2.promise.Promise<JsTable>
freeze()
elemental2.core.JsArray<Column>
The columns present on this table.elemental2.core.JsArray<CustomColumn>
Read-only.elemental2.core.JsArray<FilterCondition>
An ordered list of Filters to apply to the table.double
getSize()
The total number of rows in this table.elemental2.core.JsArray<Sort>
getSort()
An ordered list of Sorts to apply to the table.elemental2.promise.Promise<@TsTypeRef(ViewportData.class) AbstractTableSubscription.UpdateEventData>
the currently visible viewport.boolean
hasListeners
(String name) boolean
isClosed()
True if this table has been closed.boolean
True if this table may receive updates from the server, including size changed events, updated events after initial snapshot.elemental2.promise.Promise<JsTable>
join
(String joinType, JoinableTable rightTable, elemental2.core.JsArray<String> columnsToMatch, elemental2.core.JsArray<String> columnsToAdd, String asOfMatchRule) Joins this table to the provided table, using one of the specified join types:AJ
,ReverseAJ
(orRAJ
) - inexact timeseries joins, based on the provided matching rule.CROSS_JOIN
(orJoin
) - cross join of all rows that have matching values in both tables.EXACT_JOIN
(orExactJoin
- matches values in exactly one row in the right table, with errors if there is not exactly one.NATURAL_JOIN
(orNatural
- matches values in at most one row in the right table, with nulls if there is no match or errors if there are multiple matches. Note thatLeft
join is not supported here, unlike DHE.elemental2.promise.Promise<JsTable>
naturalJoin
(JoinableTable rightTable, elemental2.core.JsArray<String> columnsToMatch, @JsNullable elemental2.core.JsArray<String> columnsToAdd) a promise that will be resolved with the newly created table holding the results of the specified natural join operation.<T> elemental2.promise.Promise<Event<T>>
void
<T> boolean
removeEventListener
(String name, EventFn<T> callback) void
setViewport
(double firstRow, double lastRow, elemental2.core.JsArray<Column> columns, Double updateIntervalMs, @JsNullable Boolean isReverseViewport) Specifies the range of items to pass to the client and update as they change.elemental2.promise.Promise<JsTable>
snapshot
(JsTable baseTable, @JsNullable Boolean doInitialSnapshot, @JsNullable String[] stampColumns) state()
The configuration used when creating this Totals Table.toString()
-
Constructor Details
-
JsTotalsTable
public JsTotalsTable(JsTable wrappedTable, String directive, elemental2.core.JsArray<String> groupBy) Table is wrapped to let us delegate calls to it, the directive is a serialized string, and the groupBy is copied when passed in, as well as when it is accessed, to prevent accidental mutation of the array.
-
-
Method Details
-
getConnection
- Specified by:
getConnection
in interfaceServerObject
-
refreshViewport
public void refreshViewport() -
state
The configuration used when creating this Totals Table.- Specified by:
state
in interfaceJoinableTable
- Returns:
ClientTableState
-
typedTicket
- Specified by:
typedTicket
in interfaceServerObject
-
getTotalsTableConfig
-
setViewport
@JsMethod public void setViewport(double firstRow, double lastRow, @JsOptional elemental2.core.JsArray<Column> columns, @JsOptional Double updateIntervalMs, @JsOptional @JsNullable Boolean isReverseViewport) Specifies the range of items to pass to the client and update as they change. If the columns parameter is not provided, all columns will be used. Until this is called, no data will be available. Invoking this will result in events to be fired once data becomes available, starting with an updated event and one rowadded event per row in that range.- Parameters:
firstRow
-lastRow
-columns
-updateIntervalMs
-
-
getViewportData
@JsMethod public elemental2.promise.Promise<@TsTypeRef(ViewportData.class) AbstractTableSubscription.UpdateEventData> getViewportData()the currently visible viewport. If the current set of operations has not yet resulted in data, it will not resolve until that data is ready.- Returns:
- Promise of
TableData
-
getColumns
The columns present on this table. Note that this may not include all columns in the parent table, and in cases where a given column has more than one aggregation applied, the column name will have a suffix indicating the aggregation used. This suffixed name will be of the form columnName + '__' + aggregationName.- Returns:
Column
array
-
findColumn
a column by the given name. You should prefer to always retrieve a new Column instance instead of caching a returned value.- Parameters:
key
-- Returns:
Column
-
findColumns
multiple columns specified by the given names.- Parameters:
keys
-- Returns:
Column
array
-
isRefreshing
@JsProperty(name="isRefreshing") public boolean isRefreshing()True if this table may receive updates from the server, including size changed events, updated events after initial snapshot.- Returns:
- boolean
-
isClosed
@JsProperty(name="isClosed") public boolean isClosed()True if this table has been closed.- Returns:
- boolean
-
close
@JsMethod public void close()Indicates that the table will no longer be used, and resources used to provide it can be freed up on the server. -
getSize
@JsProperty public double getSize()The total number of rows in this table. This may change as the base table's configuration, filter, or contents change.- Returns:
- double
-
toString
-
addEventListener
-
removeEventListener
-
nextEvent
-
hasListeners
-
applySort
Replace the currently set sort on this table. Returns the previously set value. Note that the sort property will immediately return the new value, but you may receive update events using the old sort before the new sort is applied, and the sortchanged event fires. Reusing existing, applied sorts may enable this to perform better on the server. The updated event will also fire, but rowadded and rowremoved will not.- Parameters:
sort
-- Returns:
Sort
array
-
applyCustomColumns
@JsMethod public elemental2.core.JsArray<CustomColumn> applyCustomColumns(elemental2.core.JsArray<JsTable.CustomColumnArgUnionType> customColumns) Replace the current custom columns with a new set. These columns can be used when adding new filter and sort operations to the table, as long as they are present.- Parameters:
customColumns
-- Returns:
-
applyFilter
Replace the currently set filters on the table. Returns the previously set value. Note that the filter property will immediately return the new value, but you may receive update events using the old filter before the new one is applied, and the filterchanged event fires. Reusing existing, applied filters may enable this to perform better on the server. The updated event will also fire, but rowadded and rowremoved will not.- Parameters:
filter
-- Returns:
FilterCondition
array
-
getWrappedTable
-
getSort
An ordered list of Sorts to apply to the table. To update, call applySort(). Note that this getter will return the new value immediately, even though it may take a little time to update on the server. You may listen for the sortchanged event to know when to update the UI.- Returns:
Sort
array
-
getFilter
An ordered list of Filters to apply to the table. To update, call applyFilter(). Note that this getter will return the new value immediately, even though it may take a little time to update on the server. You may listen for the filterchanged event to know when to update the UI.- Returns:
FilterCondition
array
-
getCustomColumns
Read-only. An ordered list of custom column formulas to add to the table, either adding new columns or replacing existing ones. To update, call applyCustomColumns().- Returns:
CustomColumn
array
-
freeze
- Specified by:
freeze
in interfaceJoinableTable
-
snapshot
@JsMethod public elemental2.promise.Promise<JsTable> snapshot(JsTable baseTable, @JsOptional @JsNullable Boolean doInitialSnapshot, @JsOptional @JsNullable String[] stampColumns) - Specified by:
snapshot
in interfaceJoinableTable
-
join
@JsMethod public elemental2.promise.Promise<JsTable> join(String joinType, JoinableTable rightTable, elemental2.core.JsArray<String> columnsToMatch, @JsOptional elemental2.core.JsArray<String> columnsToAdd, @JsOptional String asOfMatchRule) Description copied from interface:JoinableTable
Joins this table to the provided table, using one of the specified join types:AJ
,ReverseAJ
(orRAJ
) - inexact timeseries joins, based on the provided matching rule.CROSS_JOIN
(orJoin
) - cross join of all rows that have matching values in both tables.EXACT_JOIN
(orExactJoin
- matches values in exactly one row in the right table, with errors if there is not exactly one.NATURAL_JOIN
(orNatural
- matches values in at most one row in the right table, with nulls if there is no match or errors if there are multiple matches.
Left
join is not supported here, unlike DHE.See the Choose a join method document for more guidance on picking a join operation.
- Specified by:
join
in interfaceJoinableTable
- Parameters:
joinType
- The type of join to perform, see the list above.rightTable
- The table to match to values in this tablecolumnsToMatch
- Columns that should matchcolumnsToAdd
- Columns from the right table to add to the result - empty/null/absent to add all columnsasOfMatchRule
- If joinType is AJ/RAJ/ReverseAJ, the match rule to use- Returns:
- a promise that will resolve to the joined table
-
asOfJoin
@JsMethod public elemental2.promise.Promise<JsTable> asOfJoin(JoinableTable rightTable, elemental2.core.JsArray<String> columnsToMatch, @JsOptional @JsNullable elemental2.core.JsArray<String> columnsToAdd, @JsOptional @JsNullable String asOfMatchRule) Description copied from interface:JoinableTable
Performs an inexact timeseries join, where rows in this table will have columns added from the closest matching row from the right table.The
asOfMatchRule
value can be one of:- LESS_THAN_EQUAL
- LESS_THAN
- GREATER_THAN_EQUAL
- GREATER_THAN
- Specified by:
asOfJoin
in interfaceJoinableTable
- Parameters:
rightTable
- the table to match to values in this tablecolumnsToMatch
- the columns that should match, according to the asOfMatchRolecolumnsToAdd
- columns from the right table to add to the resulting table, empty/null/absent to add all columnsasOfMatchRule
- the match rule to use, see above- Returns:
- a promise that will resolve to the joined table
-
crossJoin
@JsMethod public elemental2.promise.Promise<JsTable> crossJoin(JoinableTable rightTable, elemental2.core.JsArray<String> columnsToMatch, @JsOptional @JsNullable elemental2.core.JsArray<String> columnsToAdd, @JsOptional @JsNullable Double reserveBits) Description copied from interface:JoinableTable
a promise that will be resolved with the newly created table holding the results of the specified cross join operation. The columnsToAdd parameter is optional, not specifying it will result in all columns from the right table being added to the output. The reserveBits optional parameter lets the client control how the key space is distributed between the rows in the two tables, see the Java Table class for details.- Specified by:
crossJoin
in interfaceJoinableTable
- Parameters:
rightTable
- the table to match to values in this tablecolumnsToMatch
- the columns that should match exactlycolumnsToAdd
- columns from the right table to add to the resulting table, empty/null/absent to add all columnsreserveBits
- the number of bits of key-space to initially reserve per group, null/absent will let the server select a value- Returns:
- a promise that will resolve to the joined table
-
exactJoin
@JsMethod public elemental2.promise.Promise<JsTable> exactJoin(JoinableTable rightTable, elemental2.core.JsArray<String> columnsToMatch, @JsOptional @JsNullable elemental2.core.JsArray<String> columnsToAdd) Description copied from interface:JoinableTable
a promise that will be resolved with the newly created table holding the results of the specified exact join operation. The `columnsToAdd` parameter is optional, not specifying it will result in all columns from the right table being added to the output.- Specified by:
exactJoin
in interfaceJoinableTable
- Parameters:
rightTable
- the table to match to values in this tablecolumnsToMatch
- the columns that should match exactlycolumnsToAdd
- columns from the right table to add to the resulting table, empty/null/absent to add all columns- Returns:
- a promise that will resolve to the joined table
-
naturalJoin
@JsMethod public elemental2.promise.Promise<JsTable> naturalJoin(JoinableTable rightTable, elemental2.core.JsArray<String> columnsToMatch, @JsOptional @JsNullable elemental2.core.JsArray<String> columnsToAdd) Description copied from interface:JoinableTable
a promise that will be resolved with the newly created table holding the results of the specified natural join operation. The columnsToAdd parameter is optional, not specifying it will result in all columns from the right table being added to the output.- Specified by:
naturalJoin
in interfaceJoinableTable
- Parameters:
rightTable
- the table to match to values in this tablecolumnsToMatch
- the columns that should match exactlycolumnsToAdd
- columns from the right table to add to the resulting table, empty/null/absent to add all columns- Returns:
- a promise that will resolve to the joined table
-