public void execute(Event<UICategorySelector> event) throws Exception { UICategorySelector selector = event.getSource(); ApplicationRegistryService appRegService = selector.getApplicationComponent(ApplicationRegistryService.class); List<ApplicationCategory> categories = appRegService.getApplicationCategories(); categories = categories != null ? categories : new ArrayList<ApplicationCategory>(); for (ApplicationCategory category : categories) { if (selector.getSelectedCategories().contains("category_" + category.getName())) { Application newApp = cloneApplication(selector.getApplication()); UIApplicationRegistryPortlet.setPermissionToAdminGroup(newApp); appRegService.save(category, newApp); } } selector.clearSelectedCategories(); UIContainer appInfo = selector.getParent(); appInfo.getChild(UICategorySelector.class).setRendered(false); UIApplicationRegistryPortlet uiPortlet = appInfo.getAncestorOfType(UIApplicationRegistryPortlet.class); UIApplicationOrganizer uiOrganizer = uiPortlet.getChild(UIApplicationOrganizer.class); UIGadgetManagement uiGadgetManagement = uiPortlet.getChild(UIGadgetManagement.class); uiOrganizer.reload(); if (uiGadgetManagement != null) { uiGadgetManagement.setSelectedGadget(selector.getApplication().getApplicationName()); } event.getRequestContext().addUIComponentToUpdateByAjax(appInfo); }
/** * Gets the popup container. * * @param container the current container * @return the popup container */ public static UIPopupContainer getPopupContainer(UIContainer container) { if (container instanceof UIPortletApplication) return container.getChild(UIPopupContainer.class); UIPortletApplication portletApplication = container.getAncestorOfType(UIPortletApplication.class); return portletApplication.getChild(UIPopupContainer.class); }
public void processRender(UIContainer uicomponent, WebuiRequestContext context) throws Exception { UIWorkingArea uiWorkingArea = uicomponent.getAncestorOfType(UIWorkingArea.class); UIActionBar uiActionBar = uiWorkingArea.getChild(UIActionBar.class); boolean isUISelectDocumentTemplateTitleRendered = uiWorkingArea.isUISelectDocumentTemplateTitleRendered(); context .getWriter() .append("<div class=\"") .append(uicomponent.getId()) .append( isUISelectDocumentTemplateTitleRendered || uiActionBar.isRendered() ? StringUtils.EMPTY : " uiDocumentWorkspaceBox") .append("\" id=\"") .append(uicomponent.getId()) .append("\">"); uicomponent.renderChildren(context); context.getWriter().append("</div>"); }
/** * Creates the popup message. * * @param container the current container * @param message the message key * @param args the arguments to show in the message * @param type the message's type (e.g. <code>ApplicationMessage.INFO</code>) * @see ApplicationMessage */ public static void createPopupMessage( UIContainer container, String message, Object[] args, int type) { UIApplication application = container.getAncestorOfType(UIApplication.class); application.addMessage(new ApplicationMessage(message, args, type)); }