}
}
public static class EditPageNodeActionListener extends BaseActionListener<UIRightClickPopupMenu> {
public void execute(Event<UIRightClickPopupMenu> event) throws Exception {
UIPortalApplication uiApp = Util.getUIPortalApplication();
UIRightClickPopupMenu popupMenu = event.getSource();
UINavigationNodeSelector uiNodeSelector = popupMenu.getAncestorOfType(UINavigationNodeSelector.class);
String nodeID = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
TreeNode node = uiNodeSelector.findNode(nodeID);
try {
node = rebaseNode(node, uiNodeSelector);
if (node == null)
return;
} catch (NavigationServiceException ex) {
handleError(ex.getError(), uiNodeSelector);
return;
}
UserPortalConfigService userService = uiNodeSelector.getApplicationComponent(UserPortalConfigService.class);
// get selected page
String pageId = node.getPageRef();
PageContext pageContext = (pageId != null) ? userService.getPageService().loadPage(PageKey.parse(pageId)) : null;
if (pageContext != null) {
UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
if (!userACL.hasEditPermission(pageContext)) {
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);
UIWorkingWorkspace uiWorkingWS = uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class).setRendered(true);
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();
if (pageContext.getState().getDisplayName() == null)
pageContext.getState().builder().displayName(node.getLabel());
Page page = userService.getDataStorage().getPage(pageId);
pageContext.update(page);
// convert Page to UIPage
PortalDataMapper.toUIPage(uiPage, page);
Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
} else {
uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.notAvailable", null));
}
}