use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.
the class PageTreeMenuAction method intro.
public String intro() {
String pageCode = (this.getSelectedNode() != null ? this.getSelectedNode() : this.getPageCode());
if (StringUtils.isBlank(pageCode)) {
ITreeNode rootNode = this.getAllowedTreeRootNode();
pageCode = rootNode.getCode();
if (VIRTUAL_ROOT_CODE.equals(pageCode)) {
if (null != rootNode.getChildrenCodes() && rootNode.getChildrenCodes().length > 0) {
pageCode = rootNode.getChildrenCodes()[0];
} else {
this.addActionError(this.getText("error.page.virtualRootSelected"));
return "noRoot";
}
}
}
this.setPageCode(pageCode);
this.setSelectedNode(pageCode);
String check = this.checkSelectedNode(pageCode);
if (null != check) {
return check;
}
return SUCCESS;
}
use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.
the class AbstractTreeAction method getShowableTree.
@Override
public ITreeNode getShowableTree() {
ITreeNode node = null;
try {
ITreeNode allowedTree = this.getAllowedTreeRootNode();
node = this.getTreeHelper().getShowableTree(this.getTreeNodesToOpen(), allowedTree, this.getNodeGroupCodes());
} catch (Throwable t) {
_logger.error("error in getShowableTree", t);
}
return node;
}
use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.
the class TreeNodeBaseActionHelper method addTreeWrapper.
private void addTreeWrapper(TreeNodeWrapper currentNode, ITreeNode currentTreeNode) {
String[] children = currentTreeNode.getChildrenCodes();
for (int i = 0; i < children.length; i++) {
ITreeNode newCurrentTreeNode = this.getTreeNode(children[i]);
TreeNodeWrapper newNode = this.buildWrapper(newCurrentTreeNode);
currentNode.addChildCode(newNode.getCode());
currentNode.addChild(newNode);
this.addTreeWrapper(newNode, newCurrentTreeNode);
}
}
use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.
the class TreeNodeBaseActionHelper method checkTargetNodesOnClosing.
@Override
public Set<String> checkTargetNodesOnClosing(String nodeToCloseCode, Set<String> lastOpenedNodes, Collection<String> groupCodes) throws ApsSystemException {
ITreeNode nodeToClose = this.getTreeNode(nodeToCloseCode);
if (null == nodeToCloseCode || null == nodeToClose) {
return this.checkTargetNodes(null, lastOpenedNodes, groupCodes);
}
Set<String> checkedTargetNodes = new HashSet<String>();
try {
if (nodeToClose.isRoot()) {
return checkedTargetNodes;
}
if (null != lastOpenedNodes) {
Iterator<String> iter = lastOpenedNodes.iterator();
while (iter.hasNext()) {
String code = (String) iter.next();
if (null != code && this.checkNode(code, groupCodes) && !code.equals(nodeToCloseCode) && !this.getTreeNode(code).isChildOf(nodeToCloseCode)) {
checkedTargetNodes.add(code);
}
}
}
if (null != nodeToClose.getParent() && this.checkNode(nodeToClose.getParent().getCode(), groupCodes)) {
checkedTargetNodes.add(nodeToClose.getParent().getCode());
}
} catch (Throwable t) {
_logger.error("Error check target nodes on closing tree", t);
throw new ApsSystemException("Error check target nodes on closing tree", t);
}
return checkedTargetNodes;
}
use of com.agiletec.aps.system.common.tree.ITreeNode in project entando-core by entando.
the class TreeNodeBaseActionHelper method buildCheckNodes.
private void buildCheckNodes(Set<String> treeNodesToOpen, Set<String> nodesToShow, Collection<String> groupCodes) {
if (null == treeNodesToOpen) {
return;
}
Iterator<String> iter = treeNodesToOpen.iterator();
while (iter.hasNext()) {
String targetNode = (String) iter.next();
ITreeNode treeNode = this.getTreeNode(targetNode);
if (null != treeNode) {
this.buildCheckNodes(treeNode, nodesToShow, groupCodes);
}
}
}
Aggregations