virtualList.dataBind(source);
}
public static class AddNavigationActionListener extends EventListener<UIAddGroupNavigation> {
public void execute(Event<UIAddGroupNavigation> event) throws Exception {
WebuiRequestContext ctx = event.getRequestContext();
UIAddGroupNavigation uicomp = event.getSource();
// get navigation id
String ownerId = event.getRequestContext().getRequestParameter(OBJECTID);
ownerId = URLDecoder.decode(ownerId);
UIPortalApplication uiPortalApp = Util.getUIPortal().getAncestorOfType(UIPortalApplication.class);
// ensure this navigation does not exist
NavigationService navigationService = uicomp.getApplicationComponent(NavigationService.class);
NavigationContext navigation = navigationService.loadNavigation(SiteKey.group(ownerId));
if (navigation != null && navigation.getState() != null) {
uiPortalApp.addMessage(new ApplicationMessage("UIPageNavigationForm.msg.existPageNavigation",
new String[] { ownerId }));
} else {
// Create portal config of the group when it does not exist
DataStorage dataService = uicomp.getApplicationComponent(DataStorage.class);
if (dataService.getPortalConfig("group", ownerId) == null) {
UserPortalConfigService configService = uicomp.getApplicationComponent(UserPortalConfigService.class);
configService.createGroupSite(ownerId);
}
// create navigation for group
SiteKey key = SiteKey.group(ownerId);
NavigationContext existing = navigationService.loadNavigation(key);
if (existing == null) {
navigationService.saveNavigation(new NavigationContext(key, new NavigationState(0)));
}
}
// Update group navigation list
ctx.addUIComponentToUpdateByAjax(uicomp);
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChild(UIWorkingWorkspace.class);
uiWorkingWS.updatePortletsByName("GroupNavigationPortlet");
uiWorkingWS.updatePortletsByName("UserToolbarGroupPortlet");
}