UIRightClickPopupMenu uiPopupMenu = event.getSource();
UINavigationNodeSelector uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
// get Selected PageNode
PageNode selectedPageNode = null;
List<PageNode> pageNodes = uiNodeSelector.getEdittedNavigation().getNodes();
if (uri != null && uri.trim().length() > 0)
{
for (PageNode pageNode : pageNodes)
{
selectedPageNode = PageNavigationUtils.searchPageNodeByUri(pageNode, uri);
if (selectedPageNode != null)
{
break;
}
}
}
UIPortalApplication uiApp = Util.getUIPortalApplication();
if (selectedPageNode.getPageReference() == null)
{
uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.notAvailable", null));
return;
}
UIWorkingWorkspace uiWorkingWS = uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
UIPortalToolPanel uiToolPanel =
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class).setRendered(true);
UserPortalConfigService userService = uiToolPanel.getApplicationComponent(UserPortalConfigService.class);
// get selected page
String pageId = selectedPageNode.getPageReference();
Page selectPage = (pageId != null) ? userService.getPage(pageId) : null;
if (selectPage != null)
{
UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
if (!userACL.hasEditPermission(selectPage))
{
uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[]{pageId}, 1));
return;
}
uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
//uiWorkingWS.setRenderedChild(UIPortalToolPanel.class);
//uiWorkingWS.addChild(UIPortalComposer.class, "UIPageEditor", null);
uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);
UIPortalComposer portalComposer =
uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(true);
portalComposer.setShowControl(true);
portalComposer.setEditted(false);
portalComposer.setCollapse(false);
portalComposer.setId("UIPageEditor");
portalComposer.setComponentConfig(UIPortalComposer.class, "UIPageEditor");
uiToolPanel.setShowMaskLayer(false);
uiToolPanel.setWorkingComponent(UIPage.class, null);
UIPage uiPage = (UIPage)uiToolPanel.getUIComponent();
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
if(selectPage.getTitle() == null)
selectPage.setTitle(selectedPageNode.getLabel());
// convert Page to UIPage
PortalDataMapper.toUIPage(uiPage, selectPage);
Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
Util.getPortalRequestContext().setFullRender(true);