public void execute(Event<UICategorySelector> event) throws Exception {
   UICategorySelector selector = event.getSource();
   selector.clearSelectedCategories();
   UIContainer appInfo = selector.getParent();
   appInfo.getChild(UICategorySelector.class).setRendered(false);
   event.getRequestContext().addUIComponentToUpdateByAjax(appInfo);
 }
 private String getAddSkinScript(Set<UIComponent> updateComponents) {
   if (updateComponents == null) return null;
   List<UIPortlet> uiportlets = new ArrayList<UIPortlet>();
   for (UIComponent uicomponent : updateComponents) {
     if (uicomponent instanceof UIContainer) {
       UIContainer uiContainer = (UIContainer) uicomponent;
       uiContainer.findComponentOfType(uiportlets, UIPortlet.class);
     }
   }
   List<SkinConfig> skins = new ArrayList<SkinConfig>();
   SkinService skinService = getApplicationComponent(SkinService.class);
   for (UIPortlet uiPortlet : uiportlets) {
     String module =
         uiPortlet.getExoWindowID().getPortletApplicationName()
             + "/"
             + uiPortlet.getExoWindowID().getPortletName();
     SkinConfig skinConfig = skinService.getSkin(module, skin_);
     if (skinConfig != null) skins.add(skinConfig);
   }
   StringBuilder b = new StringBuilder(1000);
   for (SkinConfig ele : skins) {
     SkinURL url = ele.createURL();
     url.setOrientation(orientation_);
     b.append("eXo.core.Skin.addSkin('")
         .append(ele.getId())
         .append("','")
         .append(url)
         .append("');\n");
   }
   return b.toString();
 }
    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);
    }
示例#4
0
文件: Utils.java 项目: canhpv/ecms
 /**
  * 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 static void addButtonToComponent(org.exoplatform.webui.core.UIContainer uicomponent)
     throws Exception {
   if (isShowButton()) {
     PushNavigationActionComponent pushNavigationActionComponent =
         uicomponent.getChild(PushNavigationActionComponent.class);
     if (pushNavigationActionComponent == null) {
       pushNavigationActionComponent =
           uicomponent.addChild(PushNavigationActionComponent.class, null, null);
     }
     pushNavigationActionComponent.setRendered(true);
     uicomponent.renderChild(PushNavigationActionComponent.class);
     pushNavigationActionComponent.setRendered(false);
   }
 }
 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>");
 }
示例#7
0
  public void processRender(WebuiRequestContext context) throws Exception {
    UIJCRExplorerPortlet uiPortlet = getAncestorOfType(UIJCRExplorerPortlet.class);
    UIActionBar uiActionBar = findFirstComponentOfType(UIActionBar.class);
    uiActionBar.setRendered(uiPortlet.isShowActionBar());
    UISelectDocumentTemplateTitle uiTemplateTitle =
        findFirstComponentOfType(UISelectDocumentTemplateTitle.class);
    boolean isUITemplateTitleRendered = isUISelectDocumentTemplateTitleRendered();
    uiTemplateTitle.setRendered(isUITemplateTitleRendered);

    super.processRender(context);
  }
示例#8
0
 @Override
 public void processRender(WebuiRequestContext context) throws Exception {
   if (getTemplate() != null) {
     super.processRender(context);
     return;
   }
   Writer writer = context.getWriter();
   writer.append("<div class='UIForm ").append(getId()).append("'>");
   begin();
   renderChildren(context);
   end();
   writer.append("</div>");
 }
  @Override
  public void processRender(WebuiRequestContext context) throws Exception {
    RenderingService renderingService =
        (RenderingService) PortalContainer.getComponent(RenderingService.class);
    WikiService wikiService = (WikiService) PortalContainer.getComponent(WikiService.class);
    String syntaxId = org.exoplatform.wiki.commons.Utils.getDefaultSyntax();

    PageImpl syntaxHelpPage = wikiService.getHelpSyntaxPage(syntaxId);
    this.syntaxName = syntaxId.replace("/", " ").toUpperCase();
    if (syntaxHelpPage != null) {
      String markup = syntaxHelpPage.getContent().getText();
      this.htmlOutput =
          renderingService.render(markup, syntaxId, Syntax.XHTML_1_0.toIdString(), false);
      this.syntaxFullPageUrl =
          "/"
              + PortalContainer.getInstance().getRestContextName()
              + "/wiki/help/"
              + syntaxId.replace("/", Utils.SLASH).replace(".", Utils.DOT);
    } else {
      this.htmlOutput = null;
    }
    super.processRender(context);
  }
 /* (non-Javadoc)
  * @see org.exoplatform.webui.core.UIComponent#processRender(org.exoplatform.webui.application.WebuiRequestContext)
  */
 public void processRender(WebuiRequestContext context) throws Exception {
   if (getComponentConfig() != null) {
     super.processRender(context);
     return;
   }
   UIForm uiForm = getAncestorOfType(UIForm.class);
   Writer writer = context.getWriter();
   writer.write("<div class=\"" + getId() + "\">");
   writer.write("<fieldset>");
   writer.write("<legend>" + uiForm.getLabel(getId()) + "</legend>");
   writer.write("<table class=\"UIFormGrid\">");
   for (UIComponent component : getChildren()) {
     if (component.isRendered()) {
       writer.write("<tr>");
       String componentName = uiForm.getLabel(component.getId());
       if (componentName != null && componentName.length() > 0 && !componentName.equals(getId())) {
         writer.write(
             "<td class=\"FieldLabel\"><label for=\""
                 + component.getId()
                 + "\">"
                 + componentName
                 + "</td>");
         writer.write("<td class=\"FieldComponent\">");
         renderUIComponent(component);
         writer.write("</td>");
       } else {
         writer.write("<td class=\"FieldComponent\" colspans=\"2\">");
         renderUIComponent(component);
         writer.write("</td>");
       }
       writer.write("</tr>");
     }
   }
   writer.write("</table>");
   writer.write("</fieldset>");
   writer.write("</div>");
 }
示例#11
0
文件: Utils.java 项目: canhpv/ecms
 /**
  * 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));
 }
示例#12
0
 @Override
 public void processRender(WebuiRequestContext context) throws Exception {
   getChild(UITaggingForm.class).activate();
   super.processRender(context);
 }