{
return;
}
PageNode newNode = selectedNode.getNode().clone();
PageNavigation targetNav = uiNodeSelector.getSelectedNavigation();
PageNode targetNode = PageNavigationUtils.searchPageNodeByUri(targetNav, targetUri);
if (targetNode != null && newNode.getUri().equals(targetNode.getUri()))
{
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.paste.sameSrcAndDes", null));
return;
}
if (isExistChild(targetNode, newNode) || (targetNode == null && isExitChild(targetNav, newNode)))
{
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.paste.sameName", null));
return;
}
if (selectedNode.isDeleteNode())
{
if (selectedNode.getParentNode() != null)
{
selectedNode.getParentNode().getChildren().remove(selectedNode.getNode());
}
else
{
selectedNode.getPageNavigation().getNodes().remove(selectedNode.getNode());
}
}
event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector);
uiNodeSelector.setCopyNode(null);
UITree uitree = uiNodeSelector.getChild(UITree.class);
UIRightClickPopupMenu popup = uitree.getUIRightClickPopupMenu();
popup.setActions(new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CutNode",
"CloneNode", "DeleteNode", "MoveUp", "MoveDown"});
UserPortalConfigService service = uiPopupMenu.getApplicationComponent(UserPortalConfigService.class);
if (targetNode == null)
{
newNode.setUri(newNode.getName());
targetNav.addNode(newNode);
if (selectedNode.isCloneNode())
{
clonePageFromNode(newNode, targetNav.getOwnerType(), targetNav.getOwnerId(), service);
}
return;
}
setNewUri(targetNode, newNode);
targetNode.getChildren().add(newNode);
if (selectedNode.isCloneNode())
{
clonePageFromNode(newNode, targetNav.getOwnerType(), targetNav.getOwnerId(), service);
}
uiNodeSelector.selectPageNodeByUri(targetNode.getUri());
}