From 8fa6559d0f70e10f28fa28faa3beea4d2a65618b Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Mon, 20 Apr 2026 14:29:36 -0500 Subject: [PATCH] Add feature flag --- .../deephaven/web/client/api/CoreClient.java | 11 ++++++++ .../io/deephaven/web/client/api/Features.java | 28 +++++++++++++++++++ .../web/client/api/tree/JsTreeTable.java | 7 +++-- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 web/client-api/src/main/java/io/deephaven/web/client/api/Features.java diff --git a/web/client-api/src/main/java/io/deephaven/web/client/api/CoreClient.java b/web/client-api/src/main/java/io/deephaven/web/client/api/CoreClient.java index 0abbdd30efe..62184029d2d 100644 --- a/web/client-api/src/main/java/io/deephaven/web/client/api/CoreClient.java +++ b/web/client-api/src/main/java/io/deephaven/web/client/api/CoreClient.java @@ -22,6 +22,7 @@ import io.deephaven.web.shared.data.ConnectToken; import io.deephaven.web.shared.fu.JsBiConsumer; import io.deephaven.web.shared.fu.JsFunction; +import jsinterop.annotations.JsNullable; import jsinterop.annotations.JsOptional; import jsinterop.annotations.JsType; import jsinterop.base.Js; @@ -32,6 +33,16 @@ @JsType(namespace = "dh") public class CoreClient extends HasEventHandling { + /** + * A collection of feature flags that the JS API advertises. All must be nullable booleans, and if listed, the value + * is true. + *

+ * Marked as nullable as past releases will not have this property, be sure to test for null if an older release + * might be in use. + */ + @JsNullable + public static final Features FEATURES = new Features(); + public static final String EVENT_CONNECT = "connect", EVENT_DISCONNECT = "disconnect", EVENT_RECONNECT = "reconnect", diff --git a/web/client-api/src/main/java/io/deephaven/web/client/api/Features.java b/web/client-api/src/main/java/io/deephaven/web/client/api/Features.java new file mode 100644 index 00000000000..35582debe3c --- /dev/null +++ b/web/client-api/src/main/java/io/deephaven/web/client/api/Features.java @@ -0,0 +1,28 @@ +// +// Copyright (c) 2016-2026 Deephaven Data Labs and Patent Pending +// +package io.deephaven.web.client.api; + +import io.deephaven.web.client.api.tree.JsTreeTable; +import jsinterop.annotations.JsNullable; +import jsinterop.annotations.JsType; + +/** + * Collection of feature flags that the JS API advertises. All must be nullable booleans, and if listed, the value is + * true. + *

+ * Preferred format is to first list the type or category of feature, then the feature name. Docs should link + * bidirectionally with the feature in question. + * + * Exposed as {@link CoreClient#FEATURES}, which may be null in older releases. + */ +@JsType(namespace = "dh") +public class Features { + /** + * {@link io.deephaven.web.client.api.tree.JsTreeTable} support for providing a number rather than a boolean when + * {@link io.deephaven.web.client.api.tree.JsTreeTable#expand(JsTreeTable.RowReferenceUnion, JsTreeTable.ExpandDescendantsUnion) + * expanding} to signify expanding to a depth relative to the given element. + */ + @JsNullable + public final Boolean treeTableExpandToDepth = true; +} diff --git a/web/client-api/src/main/java/io/deephaven/web/client/api/tree/JsTreeTable.java b/web/client-api/src/main/java/io/deephaven/web/client/api/tree/JsTreeTable.java index 23d423ee487..156e477afda 100644 --- a/web/client-api/src/main/java/io/deephaven/web/client/api/tree/JsTreeTable.java +++ b/web/client-api/src/main/java/io/deephaven/web/client/api/tree/JsTreeTable.java @@ -926,13 +926,14 @@ private void setRowAction(RowReferenceUnion row, double action) { * {@code true} to expand the row and all descendants, a {@code number} to expand to a specified depth relative to * the target node, or omit / pass {@code false} to expand only the row itself. A depth of 1 is equivalent to a * regular expand (one level). A depth of 2 expands the node and its children, etc. Equivalent to - * {@code setExpanded(row, true)} with an optional third parameter. + * {@code setExpanded(row, true)} with an optional third parameter. Numeric value is only supported if + * {@link Features#treeTableExpandToDepth} is true. * * @param row The row to expand - either the absolute row index or the row object. * @param expandDescendants Controls descendant expansion: {@code true} for all descendants, a {@code number} for * depth-limited expansion (relative to the target node), or {@code false}/omitted for a single level. */ - public void expand(RowReferenceUnion row, @JsOptional ExpandDescendantsUnion expandDescendants) { + public void expand(RowReferenceUnion row, @JsOptional @JsNullable ExpandDescendantsUnion expandDescendants) { setExpanded(row, true, expandDescendants); } @@ -1037,7 +1038,7 @@ default int asInt() { * Defaults to {@code false}. */ public void setExpanded(RowReferenceUnion row, boolean isExpanded, - @JsOptional ExpandDescendantsUnion expandDescendants) { + @JsOptional @JsNullable ExpandDescendantsUnion expandDescendants) { // TODO check row number is within bounds final double action; if (!isExpanded) {