コード例 #1
0
  /**
   * The central area is called the WorkingWorkspace. It is composed of: 1) A UIPortal child which
   * is filled with portal data using the PortalDataMapper helper tool 2) A UIPortalToolPanel which
   * is not rendered by default A UIMaskWorkspace is also added to provide powerfull focus only
   * popups
   *
   * @throws Exception
   */
  private void addWorkingWorkspace() throws Exception {
    UIWorkingWorkspace uiWorkingWorkspace =
        addChild(UIWorkingWorkspace.class, UIPortalApplication.UI_WORKING_WS_ID, null);
    UIComponentDecorator uiViewWS =
        uiWorkingWorkspace.addChild(UIComponentDecorator.class, null, UI_VIEWING_WS_ID);

    DataStorage dataStorage = getApplicationComponent(DataStorage.class);
    Container container = dataStorage.getSharedLayout();
    UIPortal uiPortal = createUIComponent(UIPortal.class, null, null);
    PortalDataMapper.toUIPortal(uiPortal, userPortalConfig_);
    //    uiWorkingWorkspace.addChild(UIEditInlineWorkspace.class, null,
    // UI_EDITTING_WS_ID).setRendered(false);
    if (container != null) {
      org.exoplatform.portal.webui.container.UIContainer uiContainer =
          createUIComponent(org.exoplatform.portal.webui.container.UIContainer.class, null, null);
      PortalDataMapper.toUIContainer(uiContainer, container);
      UISiteBody uiSiteBody = uiContainer.findFirstComponentOfType(UISiteBody.class);
      uiSiteBody.setUIComponent(uiPortal);
      uiContainer.setRendered(true);
      uiViewWS.setUIComponent(uiContainer);
    } else {
      uiViewWS.setUIComponent(uiPortal);
    }
    uiWorkingWorkspace.addChild(UIPortalToolPanel.class, null, null).setRendered(false);
    addChild(UIMaskWorkspace.class, UIPortalApplication.UI_MASK_WS_ID, null);
  }
コード例 #2
0
  private static void buildUIContainer(UIContainer uiContainer, Object model, boolean dashboard)
      throws Exception {
    UIComponent uiComponent = null;
    WebuiRequestContext context = Util.getPortalRequestContext();

    if (model instanceof SiteBody) {
      UISiteBody uiSiteBody = uiContainer.createUIComponent(context, UISiteBody.class, null, null);
      uiSiteBody.setStorageId(((SiteBody) model).getStorageId());
      uiComponent = uiSiteBody;
    } else if (model instanceof PageBody) {
      UIPageBody uiPageBody = uiContainer.createUIComponent(context, UIPageBody.class, null, null);
      uiPageBody.setStorageId(((PageBody) model).getStorageId());
      uiComponent = uiPageBody;
    } else if (model instanceof Application) {
      Application application = (Application) model;

      if (dashboard && application.getType() == ApplicationType.GADGET) {
        Application<Gadget> ga = (Application<Gadget>) application;
        UIGadget uiGadget = uiContainer.createUIComponent(context, UIGadget.class, null, null);
        uiGadget.setStorageId(application.getStorageId());
        toUIGadget(uiGadget, ga);
        uiComponent = uiGadget;
      } else {
        UIPortlet uiPortlet = uiContainer.createUIComponent(context, UIPortlet.class, null, null);
        uiPortlet.setStorageId(application.getStorageId());
        if (application.getStorageName() != null) {
          uiPortlet.setStorageName(application.getStorageName());
        }
        toUIPortlet(uiPortlet, application);
        uiComponent = uiPortlet;
      }
    } else if (model instanceof Container) {
      Container container = (Container) model;

      UIComponentFactory<? extends UIContainer> factory =
          UIComponentFactory.getInstance(UIContainer.class);
      UIContainer uiTempContainer = factory.createUIComponent(container.getFactoryId(), context);

      if (uiTempContainer == null) {
        log.warn(
            "Can't find container factory for: {}. Default container is used",
            container.getFactoryId());
        uiTempContainer = uiContainer.createUIComponent(context, UIContainer.class, null, null);
      }

      toUIContainer(uiTempContainer, (Container) model, dashboard);
      uiComponent = uiTempContainer;
    }
    uiContainer.addChild(uiComponent);
  }
コード例 #3
0
  private static void buildUIContainer(UIContainer uiContainer, Object model, boolean dashboard)
      throws Exception {
    UIComponent uiComponent = null;
    WebuiRequestContext context = Util.getPortalRequestContext();

    if (model instanceof SiteBody) {
      UISiteBody uiSiteBody = uiContainer.createUIComponent(context, UISiteBody.class, null, null);
      uiSiteBody.setStorageId(((SiteBody) model).getStorageId());
      uiComponent = uiSiteBody;
    } else if (model instanceof PageBody) {
      UIPageBody uiPageBody = uiContainer.createUIComponent(context, UIPageBody.class, null, null);
      uiPageBody.setStorageId(((PageBody) model).getStorageId());
      uiComponent = uiPageBody;
    } else if (model instanceof Application) {
      Application application = (Application) model;

      if (dashboard && application.getType() == ApplicationType.GADGET) {
        Application<Gadget> ga = (Application<Gadget>) application;
        UIGadget uiGadget = uiContainer.createUIComponent(context, UIGadget.class, null, null);
        uiGadget.setStorageId(application.getStorageId());
        toUIGadget(uiGadget, ga);
        uiComponent = uiGadget;
      } else {
        UIPortlet uiPortlet = uiContainer.createUIComponent(context, UIPortlet.class, null, null);
        uiPortlet.setStorageId(application.getStorageId());
        if (application.getStorageName() != null) {
          uiPortlet.setStorageName(application.getStorageName());
        }
        toUIPortlet(uiPortlet, application);
        uiComponent = uiPortlet;
      }
    } else if (model instanceof Container) {
      Container container = (Container) model;
      UIContainer uiTempContainer;
      if (UITabContainer.TAB_CONTAINER.equals(container.getFactoryId())) {
        uiTempContainer = uiContainer.createUIComponent(context, UITabContainer.class, null, null);
      } else if (UIColumnContainer.COLUMN_CONTAINER.equals(container.getFactoryId())) {
        uiTempContainer =
            uiContainer.createUIComponent(context, UIColumnContainer.class, null, null);
      } else {
        uiTempContainer = uiContainer.createUIComponent(context, UIContainer.class, null, null);
      }

      toUIContainer(uiTempContainer, (Container) model, dashboard);
      uiComponent = uiTempContainer;
    }
    uiContainer.addChild(uiComponent);
  }