*/
public HierarchicalDataCommunicator() {
super();
- dataProvider = new TreeDataProvider<>(
- new TreeData<>());
+ dataProvider = new TreeDataProvider<>(new TreeData<>());
}
@Override
JsonObject hierarchyData = Json.createObject();
if (depth != -1) {
- hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_DEPTH, depth);
+ hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_DEPTH,
+ depth);
}
boolean isLeaf = !getDataProvider().hasChildren(item);
if (isLeaf) {
- hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_LEAF, true);
+ hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_LEAF,
+ true);
} else {
String key = getKeyMapper().key(item);
- hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_COLLAPSED,
+ hierarchyData.put(
+ HierarchicalDataCommunicatorConstants.ROW_COLLAPSED,
mapper.isCollapsed(key));
- hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_LEAF, false);
+ hierarchyData.put(HierarchicalDataCommunicatorConstants.ROW_LEAF,
+ false);
hierarchyData.put(
HierarchicalDataCommunicatorConstants.ROW_COLLAPSE_ALLOWED,
itemCollapseAllowedProvider.test(item));
}
// add hierarchy information to row as metadata
- dataObject.put(HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION,
+ dataObject.put(
+ HierarchicalDataCommunicatorConstants.ROW_HIERARCHY_DESCRIPTION,
hierarchyData);
return dataObject;
}
int collapsedSubTreeSize = mapper.collapse(collapsedRowKey,
collapsedRowIndex);
- getClientRpc().removeRows(collapsedRowIndex + 1,
- collapsedSubTreeSize);
+ getClientRpc().removeRows(collapsedRowIndex + 1, collapsedSubTreeSize);
// FIXME seems like a slight overkill to do this just for refreshing
// expanded status
expandedNodeSize);
rowKeysPendingExpand.remove(expandedRowKey);
- boolean success = doPushRows(Range.withLength(expandedRowIndex + 1,
- Math.min(expandedNodeSize, latestCacheSize)), expandedNodeSize);
+ boolean success = doPushRows(
+ Range.withLength(expandedRowIndex + 1,
+ Math.min(expandedNodeSize, latestCacheSize)),
+ expandedNodeSize);
if (success) {
// FIXME seems like a slight overkill to do this just for refreshing
/**
* Returns parent index for the row or {@code null}
*
- * @param rowIndex the row index
+ * @param rowIndex
+ * the row index
* @return the parent index or {@code null} for top-level items
*/
public Integer getParentIndex(int rowIndex) {
return mapper.getParentIndex(rowIndex);
}
+
+ /**
+ * Gets the item collapse allowed provider.
+ *
+ * @return the item collapse allowed provider
+ */
+ public ItemCollapseAllowedProvider<T> getItemCollapseAllowedProvider() {
+ return itemCollapseAllowedProvider;
+ }
}
treeGrid.setStyleGenerator(styleGenerator);
}
+ /**
+ * Gets the item caption generator.
+ *
+ * @return the item caption generator
+ */
+ public ItemCaptionGenerator<T> getItemCaptionGenerator() {
+ return captionGenerator;
+ }
+
+ /**
+ * Gets the item icon generator.
+ *
+ * @see IconGenerator
+ *
+ * @return the item icon generator
+ */
+ public IconGenerator<T> getItemIconGenerator() {
+ return iconProvider;
+ }
+
+ /**
+ * Gets the item collapse allowed provider.
+ *
+ * @return the item collapse allowed provider
+ */
+ public ItemCollapseAllowedProvider<T> getItemCollapseAllowedProvider() {
+ return treeGrid.getItemCollapseAllowedProvider();
+ }
+
+ /**
+ * Gets the style generator.
+ *
+ * @see StyleGenerator
+ *
+ * @return the item style generator
+ */
+ public StyleGenerator<T> getStyleGenerator() {
+ return treeGrid.getStyleGenerator();
+ }
+
/**
* Adds an item click listener. The listener is called when an item of this
* {@code Tree} is clicked.