static public class PasteNodeActionListener extends EventListener<UIRightClickPopupMenu>
{
public void execute(Event<UIRightClickPopupMenu> event) throws Exception
{
String targetUri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
UIRightClickPopupMenu uiPopupMenu = event.getSource();
UINavigationNodeSelector uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
UINavigationManagement uiManagement = uiNodeSelector.getParent();
Class<?>[] childrenToRender = new Class<?>[]{UINavigationNodeSelector.class};
uiManagement.setRenderedChildrenOfTypes(childrenToRender);
event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
TreeNodeData selectedNode = uiNodeSelector.getCopyNode();
if (selectedNode == null)
{
return;
}
PageNode newNode = selectedNode.getNode().clone();
PageNavigation targetNav = uiNodeSelector.getEdittedNavigation();
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)
{