From fc685f50a6eaa7582454ca522259607817633667 Mon Sep 17 00:00:00 2001 From: Mike Bender Date: Mon, 3 Jun 2024 09:28:05 -0400 Subject: [PATCH] fix: Expose layoutHints in JS API for TreeTable (#5555) - You could set layout hints in Groovy, but they were not accessible through the JS API - Required for DH-17076 --- .../web/client/api/tree/JsTreeTable.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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 aea546f81a5..10454bcb05c 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 @@ -359,6 +359,7 @@ private enum RebuildStep { private Column rowExpandedCol; private final Column actionCol; private final JsArray groupedColumns; + private JsLayoutHints layoutHints; // The source JsTable behind the original HierarchicalTable, lazily built at this time private final JsLazy> sourceTable; @@ -1082,6 +1083,25 @@ public String getDescription() { return tableDefinition.getAttributes().getDescription(); } + @JsProperty + @JsNullable + public JsLayoutHints getLayoutHints() { + if (layoutHints == null) { + createLayoutHints(); + } + return layoutHints; + } + + private void createLayoutHints() { + String hintsString = tableDefinition.getAttributes().getLayoutHints(); + JsLayoutHints jsHints = new JsLayoutHints(); + if (hintsString == null) { + layoutHints = null; + } else { + layoutHints = jsHints.parse(hintsString); + } + } + /** * The current number of rows given the table's contents and the various expand/collapse states of each node. (No * totalSize is provided at this time; its definition becomes unclear between roll-up and tree tables, especially