FacesContext context = FacesContext.getCurrentInstance(); context.getExternalContext().getRequestMap().put(var, ((TreeNode) obj1).getData()); Object value1 = sortBy.getValue(context.getELContext()); context.getExternalContext().getRequestMap().put(var, ((TreeNode) obj2).getData()); Object value2 = sortBy.getValue(context.getELContext());
protected TreeNode createNewNode(TreeNode node, TreeNode parent) { TreeNode newNode = null; if (node instanceof CheckboxTreeNode) { newNode = new CheckboxTreeNode(node.getType(), node.getData(), parent); } else { newNode = new DefaultTreeNode(node.getType(), node.getData(), parent); } newNode.setSelected(node.isSelected()); newNode.setExpanded(node.isExpanded()); return newNode; }
public TreeNode createCopyOfTreeNode(TreeNode node) { TreeNode newNode; if (node instanceof CheckboxTreeNode) { newNode = new CheckboxTreeNode(node.getData()); } else { newNode = new DefaultTreeNode(node.getData()); } newNode.setSelectable(node.isSelectable()); newNode.setExpanded(node.isExpanded()); for (TreeNode childNode : node.getChildren()) { newNode.getChildren().add(createCopyOfTreeNode(childNode)); } return newNode; }
public void setRowKey(String rowKey) { Map<String, Object> requestMap = getFacesContext().getExternalContext().getRequestMap(); saveDescendantState(); String nodeVar = getNodeVar(); this.rowKey = rowKey; if (rowKey == null) { requestMap.remove(getVar()); rowNode = null; if (nodeVar != null) { requestMap.remove(nodeVar); } } else { TreeNode root = getValue(); rowNode = findTreeNode(root, rowKey); if (rowNode != null) { requestMap.put(getVar(), rowNode.getData()); if (nodeVar != null) { requestMap.put(nodeVar, rowNode); } } else { requestMap.remove(getVar()); if (nodeVar != null) { requestMap.remove(nodeVar); } } } restoreDescendantState(); }
protected void encodeFilteredNodes(FacesContext context, Tree tree, TreeNode node, String filteredValue, Locale filterLocale) throws IOException { int childCount = node.getChildCount(); if (childCount > 0) { String var = tree.getVar(); Map<String, Object> requestMap = context.getExternalContext().getRequestMap(); ValueExpression filterByVE = tree.getValueExpression(Tree.PropertyKeys.filterBy.toString()); FilterConstraint filterConstraint = getFilterConstraint(tree); for (int i = 0; i < childCount; i++) { TreeNode childNode = node.getChildren().get(i); requestMap.put(var, childNode.getData()); if (filterConstraint.applies(filterByVE.getValue(context.getELContext()), filteredValue, filterLocale)) { tree.getFilteredRowKeys().add(childNode.getRowKey()); } encodeFilteredNodes(context, tree, childNode, filteredValue, filterLocale); } requestMap.remove(var); } }
context.getExternalContext().getRequestMap().put(tree.getVar(), tree.getValue().getData()); writer.writeAttribute("data-rowkey", ROOT_ROW_KEY, null);
public GChartModelBuilder importTreeNode(TreeNode root) { String label = String.valueOf(root.getData()); String parentLabel = root.getParent() != null ? String.valueOf(root.getParent().getData()) : Constants.EMPTY_STRING; this.addRow(label, parentLabel); for (TreeNode node : root.getChildren()) { this.importTreeNode(node); } return this; }
/** * @param e */ public void onDrop(DragDropEvent e) { String dragId = e.getDragId(); if (StringUtils.isEmpty(dragId)) { return; } List<Integer> path = getNodePath(dragId); boolean fromNavigator = isSourceNode(e.getDragId()); if (fromNavigator) { return; } TreeNode node = findNodeFromPath(getTargetNode(), path); if (node.getData() instanceof Hierarchy) { Axis axis = (Axis) node.getParent().getData(); Hierarchy hierarchy = (Hierarchy) node.getData(); removeHierarhy(axis, hierarchy); } else if (node.getData() instanceof Level) { Axis axis = (Axis) node.getParent().getParent().getData(); Level level = (Level) node.getData(); removeLevel(axis, level); } else if (node.getData() instanceof Member) { Member member = (Member) node.getData(); removeMember(member); } }
FacesContext context = FacesContext.getCurrentInstance(); context.getExternalContext().getRequestMap().put(var, ((TreeNode) obj1).getData()); Object value1 = sortBy.getValue(context.getELContext()); context.getExternalContext().getRequestMap().put(var, ((TreeNode) obj2).getData()); Object value2 = sortBy.getValue(context.getELContext());
protected TreeNode createNewNode(TreeNode node, TreeNode parent) { TreeNode newNode = null; if (node instanceof CheckboxTreeNode) { newNode = new CheckboxTreeNode(node.getType(), node.getData(), parent); } else { newNode = new DefaultTreeNode(node.getType(), node.getData(), parent); } newNode.setSelected(node.isSelected()); return newNode; }
protected void encodeFilteredNodes(FacesContext context, Tree tree, TreeNode node, String filteredValue, Locale filterLocale) throws IOException { int childCount = node.getChildCount(); for (int i = 0; i < childCount; i++) { TreeNode childNode = node.getChildren().get(i); FilterConstraint filterConstraint = this.getFilterConstraint(tree); if (filterConstraint.applies(childNode.getData(), filteredValue, filterLocale)) { tree.getFilteredRowKeys().add(childNode.getRowKey()); } encodeFilteredNodes(context, tree, childNode, filteredValue, filterLocale); } }
public TreeNode createCopyOfTreeNode(TreeNode node) { TreeNode newNode; if(node instanceof CheckboxTreeNode) { newNode = new CheckboxTreeNode(node.getData()); } else { newNode = new DefaultTreeNode(node.getData()); } newNode.setSelectable(node.isSelectable()); newNode.setExpanded(node.isExpanded()); for(TreeNode childNode : node.getChildren()) { newNode.getChildren().add(createCopyOfTreeNode(childNode)); } return newNode; }
/** * @param e */ public void onDropOnHierarchy(DragDropEvent e) { List<Integer> sourcePath = getNodePath(e.getDragId()); List<Integer> targetPath = getNodePath(e.getDropId()); int position = targetPath.get(targetPath.size() - 1) + 1; boolean fromNavigator = isSourceNode(e.getDragId()); TreeNode root = fromNavigator ? getCubeNode() : getTargetNode(); TreeNode source = findNodeFromPath(root, sourcePath); TreeNode target = findNodeFromPath(getTargetNode(), targetPath); if (fromNavigator) { onDropOnHierarchy(source, target, position); } else if (source.getData() instanceof Hierarchy) { Axis targetAxis = (Axis) target.getParent().getData(); Hierarchy hierarchy = (Hierarchy) source.getData(); if (source.getParent().equals(target.getParent())) { moveHierarhy(targetAxis, hierarchy, position); } else { Axis sourceAxis = (Axis) source.getParent().getData(); removeHierarhy(sourceAxis, hierarchy); addHierarhy(targetAxis, hierarchy, position); } } else if (source.getData() instanceof Member) { if (source.getParent().equals(target)) { moveMember((Member) source.getData(), 0); } } }
public void setRowKey(String rowKey) { Map<String, Object> requestMap = getFacesContext().getExternalContext().getRequestMap(); saveDescendantState(); String nodeVar = this.getNodeVar(); this.rowKey = rowKey; if (rowKey == null) { requestMap.remove(getVar()); this.rowNode = null; if (nodeVar != null) { requestMap.remove(nodeVar); } } else { TreeNode root = getValue(); this.rowNode = findTreeNode(root, rowKey); if (this.rowNode != null) { requestMap.put(getVar(), this.rowNode.getData()); if (nodeVar != null) { requestMap.put(nodeVar, this.rowNode); } } else { requestMap.remove(getVar()); if (nodeVar != null) { requestMap.remove(nodeVar); } } } restoreDescendantState(); }
/** * @param sourceNode * @param targetNode * @param position */ protected void onDropOnHierarchy(TreeNode sourceNode, TreeNode targetNode, int position) { Axis axis = (Axis) targetNode.getParent().getData(); if (sourceNode instanceof HierarchyNode) { HierarchyNode node = (HierarchyNode) sourceNode; Hierarchy hierarchy = node.getObject(); addHierarhy(axis, hierarchy, position); } else if (sourceNode instanceof LevelNode) { LevelNode node = (LevelNode) sourceNode; Level level = node.getObject(); addLevel(axis, level, position); } else if (sourceNode instanceof MeasureNode) { MeasureNode node = (MeasureNode) sourceNode; Member member = node.getObject(); if (member.getHierarchy().equals(targetNode.getData())) { addMember(axis, member); } else { addMember(axis, member, position); } } }
/** * @param e */ public void onDropOnAxis(DragDropEvent e) { List<Integer> sourcePath = getNodePath(e.getDragId()); List<Integer> targetPath = getNodePath(e.getDropId()); boolean fromNavigator = isSourceNode(e.getDragId()); TreeNode root = fromNavigator ? getCubeNode() : getTargetNode(); TreeNode source = findNodeFromPath(root, sourcePath); TreeNode target = findNodeFromPath(getTargetNode(), targetPath); if (fromNavigator) { onDropOnAxis(source, target); } else if (source.getData() instanceof Hierarchy) { Axis targetAxis = (Axis) target.getData(); Hierarchy hierarchy = (Hierarchy) source.getData(); if (source.getParent().equals(target)) { moveHierarhy(targetAxis, hierarchy, 0); } else { Axis sourceAxis = (Axis) source.getParent().getData(); removeHierarhy(sourceAxis, hierarchy); addHierarhy(targetAxis, hierarchy); } } }
/** * @param e */ public void onDropOnMember(DragDropEvent e) { List<Integer> sourcePath = getNodePath(e.getDragId()); List<Integer> targetPath = getNodePath(e.getDropId()); int position = targetPath.get(targetPath.size() - 1) + 1; boolean fromNavigator = isSourceNode(e.getDragId()); TreeNode root = fromNavigator ? getCubeNode() : getTargetNode(); TreeNode source = findNodeFromPath(root, sourcePath); TreeNode target = findNodeFromPath(getTargetNode(), targetPath); Member member; if (fromNavigator) { if (!(source instanceof MeasureNode)) { return; } member = ((MeasureNode) source).getObject(); Axis axis = (Axis) target.getParent().getParent().getData(); addMember(axis, member, position); } else { if (!(source.getData() instanceof Member)) { return; } member = (Member) source.getData(); moveMember(member, position); } }
/** * @param sourceNode * @param targetNode */ protected void onDropOnAxis(TreeNode sourceNode, TreeNode targetNode) { Axis axis = (Axis) targetNode.getData(); if (sourceNode instanceof HierarchyNode) { HierarchyNode node = (HierarchyNode) sourceNode; Hierarchy hierarchy = node.getObject(); addHierarhy(axis, hierarchy); } else if (sourceNode instanceof LevelNode) { LevelNode node = (LevelNode) sourceNode; Level level = node.getObject(); addLevel(axis, level); } else if (sourceNode instanceof MeasureNode) { MeasureNode node = (MeasureNode) sourceNode; Member member = node.getObject(); addMember(axis, member); } }
context.getExternalContext().getRequestMap().put(tree.getVar(), tree.getValue().getData()); writer.writeAttribute("data-rowkey", "root", null);