{
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
uiApp.addMessage(new ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore", null));
UIPortalApplication uiPortalApp = (UIPortalApplication)prContext.getUIApplication();
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
UIPopupWindow uiPopup = uiForm.getParent();
uiPopup.setShow(false);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
return;
}
WebuiRequestContext pcontext = event.getRequestContext();
// if edit navigation
if (pageNav != null)
{
uiForm.invokeSetBindingBean(pageNav);
UIFormSelectBox uiSelectBox = uiForm.findComponentById("priority");
int priority = Integer.parseInt(uiSelectBox.getValue());
pageNav.setPriority(priority);
// update navigation
dataService.save(pageNav);
UIPopupWindow uiPopup = uiForm.getParent();
uiPopup.setShow(false);
UIComponent opener = uiPopup.getParent();
pcontext.addUIComponentToUpdateByAjax(opener);
return;
}
// if add navigation
pageNav = new PageNavigation();
// set properties for navigation
uiForm.invokeSetBindingBean(pageNav);
UIFormStringInput uiOwnerId = uiForm.findComponentById("ownerId");
UIFormStringInput uiOwnerType = uiForm.findComponentById("ownerType");
UIFormSelectBox uiSelectBox = uiForm.findComponentById("priority");
int priority = Integer.parseInt(uiSelectBox.getValue());
pageNav.setPriority(priority);
pageNav.setModifiable(true);
pageNav.setOwnerId(uiOwnerId.getValue());
pageNav.setOwnerType(uiOwnerType.getValue());
//UIPortalApplication uiPortalApp = uiForm.getAncestorOfType(UIPortalApplication.class);
UIPortalApplication uiPortalApp = Util.getUIPortal().getAncestorOfType(UIPortalApplication.class);
// ensure this navigation is not exist
if (dataService.getPageNavigation(pageNav.getOwnerType(), pageNav.getOwnerId()) != null)
{
uiPortalApp.addMessage(new ApplicationMessage("UIPageNavigationForm.msg.existPageNavigation",
new String[]{pageNav.getOwnerId()}));;
return;
}
// create navigation for group
dataService.create(pageNav);
// close popup window, update popup window
UIPopupWindow uiPopup = uiForm.getParent();
uiPopup.setShow(false);
UIComponent opener = uiPopup.getParent();
pcontext.addUIComponentToUpdateByAjax(opener);
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChild(UIWorkingWorkspace.class);
uiWorkingWS.updatePortletsByName("GroupNavigationPortlet");