diff options
author | Aleksi Hietanen <aleksi@vaadin.com> | 2017-05-11 08:27:29 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-05-16 15:35:17 +0300 |
commit | d9ce1e8fb70e9cd6937a3174eeea3a244e52b770 (patch) | |
tree | 23d4a6fbc38dfed098226796580a7fbe3473ec20 | |
parent | 2e879d11f8b052bd95a84ffbeac47f65afff3a89 (diff) | |
download | vaadin-framework-d9ce1e8fb70e9cd6937a3174eeea3a244e52b770.tar.gz vaadin-framework-d9ce1e8fb70e9cd6937a3174eeea3a244e52b770.zip |
Rename TreeGridCommunicationConstants to HierarchicalDataCommunicatorConstants
-rw-r--r-- | client/src/main/java/com/vaadin/client/connectors/data/HierarchicalDataCommunicatorConnector.java | 16 | ||||
-rw-r--r-- | client/src/main/java/com/vaadin/client/connectors/treegrid/TreeGridConnector.java | 16 | ||||
-rw-r--r-- | client/src/main/java/com/vaadin/client/renderers/HierarchyRenderer.java | 12 | ||||
-rw-r--r-- | server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java | 14 | ||||
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/ui/treegrid/HierarchicalDataCommunicatorConstants.java (renamed from shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridCommunicationConstants.java) | 7 |
5 files changed, 33 insertions, 32 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/data/HierarchicalDataCommunicatorConnector.java b/client/src/main/java/com/vaadin/client/connectors/data/HierarchicalDataCommunicatorConnector.java index c4a6e75a88..c370d1e2e2 100644 --- a/client/src/main/java/com/vaadin/client/connectors/data/HierarchicalDataCommunicatorConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/data/HierarchicalDataCommunicatorConnector.java @@ -17,7 +17,7 @@ package com.vaadin.client.connectors.data; import com.vaadin.data.provider.HierarchicalDataCommunicator; import com.vaadin.shared.ui.Connect; -import com.vaadin.shared.ui.treegrid.TreeGridCommunicationConstants; +import com.vaadin.shared.ui.treegrid.HierarchicalDataCommunicatorConstants; import elemental.json.JsonObject; @@ -35,9 +35,9 @@ public class HierarchicalDataCommunicatorConnector protected void onRowDataUpdate(JsonObject newRowData, JsonObject oldRowData) { assert newRowData.hasKey( - TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION); + HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION); assert oldRowData.hasKey( - TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION); + HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION); /* * Since server side can't know the index of a random item, any @@ -45,14 +45,14 @@ public class HierarchicalDataCommunicatorConnector * previous item. */ JsonObject hierarchyData = newRowData.getObject( - TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION); - if (!hierarchyData.hasKey(TreeGridCommunicationConstants.ROW_DEPTH)) { - hierarchyData.put(TreeGridCommunicationConstants.ROW_DEPTH, + HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION); + if (!hierarchyData.hasKey(HierarchicalDataCommunicatorConstants.ROW_DEPTH)) { + hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_DEPTH, oldRowData .getObject( - TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION) + HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION) .getNumber( - TreeGridCommunicationConstants.ROW_DEPTH)); + HierarchicalDataCommunicatorConstants.ROW_DEPTH)); } } diff --git a/client/src/main/java/com/vaadin/client/connectors/treegrid/TreeGridConnector.java b/client/src/main/java/com/vaadin/client/connectors/treegrid/TreeGridConnector.java index 11848f69e0..d7267c30cf 100644 --- a/client/src/main/java/com/vaadin/client/connectors/treegrid/TreeGridConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/treegrid/TreeGridConnector.java @@ -43,7 +43,7 @@ import com.vaadin.shared.ui.treegrid.FocusParentRpc; import com.vaadin.shared.ui.treegrid.FocusRpc; import com.vaadin.shared.ui.treegrid.NodeCollapseRpc; import com.vaadin.shared.ui.treegrid.TreeGridClientRpc; -import com.vaadin.shared.ui.treegrid.TreeGridCommunicationConstants; +import com.vaadin.shared.ui.treegrid.HierarchicalDataCommunicatorConstants; import com.vaadin.shared.ui.treegrid.TreeGridState; import elemental.json.JsonObject; @@ -356,11 +356,11 @@ public class TreeGridConnector extends GridConnector { // let's scroll the row into the view getWidget().scrollToRow(cell.getRowIndex()); } else if (rowData.hasKey( - TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION)) { + HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION)) { JsonObject rowDescription = rowData.getObject( - TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION); + HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION); boolean leaf = rowDescription.getBoolean( - TreeGridCommunicationConstants.ROW_LEAF); + HierarchicalDataCommunicatorConstants.ROW_LEAF); boolean collapsed = isCollapsed(rowData); switch (domEvent.getKeyCode()) { case KeyCodes.KEY_RIGHT: @@ -414,12 +414,12 @@ public class TreeGridConnector extends GridConnector { private static boolean isCollapsed(JsonObject rowData) { assert rowData - .hasKey(TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION) : "missing hierarchy data for row " + .hasKey(HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION) : "missing hierarchy data for row " + rowData.asString(); return rowData .getObject( - TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION) - .getBoolean(TreeGridCommunicationConstants.ROW_COLLAPSED); + HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION) + .getBoolean(HierarchicalDataCommunicatorConstants.ROW_COLLAPSED); } /** @@ -430,6 +430,6 @@ public class TreeGridConnector extends GridConnector { */ public static boolean isCollapseAllowed(JsonObject row) { return row.getBoolean( - TreeGridCommunicationConstants.ROW_COLLAPSE_ALLOWED); + HierarchicalDataCommunicatorConstants.ROW_COLLAPSE_ALLOWED); } } diff --git a/client/src/main/java/com/vaadin/client/renderers/HierarchyRenderer.java b/client/src/main/java/com/vaadin/client/renderers/HierarchyRenderer.java index 914656244a..d66a86110e 100644 --- a/client/src/main/java/com/vaadin/client/renderers/HierarchyRenderer.java +++ b/client/src/main/java/com/vaadin/client/renderers/HierarchyRenderer.java @@ -32,7 +32,7 @@ import com.vaadin.client.WidgetUtil; import com.vaadin.client.connectors.treegrid.TreeGridConnector; import com.vaadin.client.widget.grid.RendererCellReference; import com.vaadin.client.widget.treegrid.HierarchyRendererCellReferenceWrapper; -import com.vaadin.shared.ui.treegrid.TreeGridCommunicationConstants; +import com.vaadin.shared.ui.treegrid.HierarchicalDataCommunicatorConstants; import elemental.json.JsonObject; @@ -162,30 +162,30 @@ public class HierarchyRenderer extends ClickableRenderer<Object, Widget> { private int getDepth(JsonObject rowDescription) { return (int) rowDescription - .getNumber(TreeGridCommunicationConstants.ROW_DEPTH); + .getNumber(HierarchicalDataCommunicatorConstants.ROW_DEPTH); } private JsonObject getHierarchyData(JsonObject row) { return row.getObject( - TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION); + HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION); } private boolean hasHierarchyData(JsonObject row) { return row.hasKey( - TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION); + HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION); } private boolean isLeaf(JsonObject rowDescription) { boolean leaf; leaf = rowDescription - .getBoolean(TreeGridCommunicationConstants.ROW_LEAF); + .getBoolean(HierarchicalDataCommunicatorConstants.ROW_LEAF); return leaf; } private boolean isCollapsed(JsonObject rowDescription) { boolean collapsed; collapsed = rowDescription - .getBoolean(TreeGridCommunicationConstants.ROW_COLLAPSED); + .getBoolean(HierarchicalDataCommunicatorConstants.ROW_COLLAPSED); return collapsed; } diff --git a/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java b/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java index 4a8ae62772..9ac6feaeb4 100644 --- a/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java +++ b/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java @@ -34,7 +34,7 @@ import com.vaadin.server.SerializableConsumer; import com.vaadin.server.SerializablePredicate; import com.vaadin.shared.Range; import com.vaadin.shared.extension.datacommunicator.HierarchicalDataCommunicatorState; -import com.vaadin.shared.ui.treegrid.TreeGridCommunicationConstants; +import com.vaadin.shared.ui.treegrid.HierarchicalDataCommunicatorConstants; import elemental.json.Json; import elemental.json.JsonArray; @@ -226,24 +226,24 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { JsonObject hierarchyData = Json.createObject(); if (depth != -1) { - hierarchyData.put(TreeGridCommunicationConstants.ROW_DEPTH, depth); + hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_DEPTH, depth); } boolean isLeaf = !getDataProvider().hasChildren(item); if (isLeaf) { - hierarchyData.put(TreeGridCommunicationConstants.ROW_LEAF, true); + hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_LEAF, true); } else { String key = getKeyMapper().key(item); - hierarchyData.put(TreeGridCommunicationConstants.ROW_COLLAPSED, + hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_COLLAPSED, mapper.isCollapsed(key)); - hierarchyData.put(TreeGridCommunicationConstants.ROW_LEAF, false); + hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_LEAF, false); hierarchyData.put( - TreeGridCommunicationConstants.ROW_COLLAPSE_ALLOWED, + HierarchicalDataCommunicatorConstants.ROW_COLLAPSE_ALLOWED, itemCollapseAllowedProvider.test(item)); } // add hierarchy information to row as metadata - dataObject.put(TreeGridCommunicationConstants.ROW_HIERARCHY_DESCRIPTION, + dataObject.put(HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION, hierarchyData); return dataObject; diff --git a/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridCommunicationConstants.java b/shared/src/main/java/com/vaadin/shared/ui/treegrid/HierarchicalDataCommunicatorConstants.java index 0e678aeb3a..913aab64b6 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridCommunicationConstants.java +++ b/shared/src/main/java/com/vaadin/shared/ui/treegrid/HierarchicalDataCommunicatorConstants.java @@ -18,13 +18,14 @@ package com.vaadin.shared.ui.treegrid; import java.io.Serializable; /** - * Set of contants used by TreeGrid. These are commonly used JsonObject keys - * which are considered to be reserved for internal use. + * Set of contants used in data communication of hierarchical data. These are + * commonly used JsonObject keys which are considered to be reserved for + * internal use. * * @author Vaadin Ltd * @since 8.1 */ -public class TreeGridCommunicationConstants implements Serializable { +public class HierarchicalDataCommunicatorConstants implements Serializable { public static final String ROW_HIERARCHY_DESCRIPTION = "rhd"; public static final String ROW_DEPTH = "d"; public static final String ROW_COLLAPSED = "c"; |