Package org.exoplatform.webui.core

Examples of org.exoplatform.webui.core.UIComponent


   static public class ViewPropertiesActionListener extends EventListener<UIPortalComposer>
   {

      public void execute(Event<UIPortalComposer> event) throws Exception
      {
         UIComponent temp = null;
         UIPortal uiPortal = null;
         String portalOwner = null;
         UIEditInlineWorkspace uiEditWS = event.getSource().getAncestorOfType(UIEditInlineWorkspace.class);
         temp = uiEditWS.getUIComponent();
         if (temp != null && (temp instanceof UIPortal))
View Full Code Here


   {
      public void execute(Event<UITabPane> event) throws Exception
      {
         super.execute(event);
         UITabPane uiTabPane = event.getSource();
         UIComponent uiComponent = uiTabPane.getChildById(uiTabPane.getSelectedTabId());
         UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
         int portalMode = uiPortalApp.getModeState();

         if (uiComponent instanceof UIApplicationList)
         { // Swicth to Porlets Tab
View Full Code Here

         UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
         UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
         UIMaskWorkspace uiMaskWS = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
         UIPageForm uiPageForm = uiPortalApp.createUIComponent(UIPageForm.class, null, null);

         UIComponent uiPage = uiToolPanel.findFirstComponentOfType(UIPage.class);
         uiPageForm.setValues((UIPage)uiPage);
         uiMaskWS.setUIComponent(uiPageForm);
         event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
      }
View Full Code Here

   static public class DeleteComponentActionListener extends EventListener<UIComponent>
   {
      public void execute(Event<UIComponent> event) throws Exception
      {
         UIComponent uiComponentTobeRemoved = event.getSource();
         String id = uiComponentTobeRemoved.getId();
         UIPortalApplication uiApp = Util.getUIPortalApplication();
         if (uiComponentTobeRemoved.findFirstComponentOfType(UIPageBody.class) != null)
         {
            uiApp.addMessage(new ApplicationMessage("UIPortalApplication.msg.deletePageBody", new Object[]{},
               ApplicationMessage.WARNING));
            return;
         }

         UIPortalComposer portalComposer = uiApp.findFirstComponentOfType(UIPortalComposer.class);
         portalComposer.setEditted(true);

         UIPage uiPage = uiComponentTobeRemoved.getAncestorOfType(UIPage.class);
         if (uiPage != null && uiPage.getMaximizedUIPortlet() != null)
         {
            if (id.equals(uiPage.getMaximizedUIPortlet().getId()))
            {
               uiPage.setMaximizedUIPortlet(null);
            }
         }
         else
         {
            UIPortal uiPortal = Util.getUIPortal();
            if (uiPortal != null && uiPortal.getMaximizedUIComponent() != null)
            {
               if (id.equals(uiPortal.getMaximizedUIComponent().getId()))
               {
                  uiPortal.setMaximizedUIComponent(null);
               }
            }
            else
            {
               UIPageBody uiPageBody = uiPortal.findFirstComponentOfType(UIPageBody.class);
               if (uiPageBody != null && uiPageBody.getMaximizedUIComponent() != null)
               {
                  if (id.equals(uiPageBody.getMaximizedUIComponent().getId()))
                  {
                     uiPageBody.setMaximizedUIComponent(null);
                  }
               }
            }
         }
         Util.showComponentLayoutMode(uiComponentTobeRemoved.getClass());

         PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext();

         org.exoplatform.portal.webui.container.UIContainer uiParent = uiComponentTobeRemoved.getParent();
         if (UITabContainer.TAB_CONTAINER.equals(uiParent.getFactoryId()))
         {
            /*
             * Check if it is removing the last tab then we will remove the TabContainer as well
             *
 
View Full Code Here

            portalComposer.updateWorkspaceComponent();
            pcontext.setFullRender(true);
         }

         UIWorkingWorkspace uiWorkingWS = uiApp.getChild(UIWorkingWorkspace.class);
         UIComponent uiWorking = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
         if (!uiWorking.isRendered())
         {
            UIEditInlineWorkspace uiEditWS = uiWorkingWS.getChild(UIEditInlineWorkspace.class);
            uiWorking = uiEditWS.getUIComponent();
         }

         String sourceId = pcontext.getRequestParameter("srcID");
         UIComponent uiSource = uiWorking.findComponentById(sourceId);

         UIContainer uiTarget = uiWorking.findComponentById(pcontext.getRequestParameter("targetID"));
         if (position < 0 && uiTarget.getChildren().size() > 0)
         {
            position = uiTarget.getChildren().size();
         }
         else if (position < 0)
         {
            position = 0;
         }

         if (uiSource == null)
         {
            UITabPane subTabPane = portalComposer.getChild(UITabPane.class);
            UIContainerList uiContainerConfig = subTabPane.getChild(UIContainerList.class);
            if (uiContainerConfig != null && subTabPane.getSelectedTabId().equals(uiContainerConfig.getId()))
            {
               org.exoplatform.portal.webui.container.UIContainer uiContainer =
                  uiTarget.createUIComponent(org.exoplatform.portal.webui.container.UIContainer.class, null, null);
               Container container = uiContainerConfig.getContainer(sourceId);
               container.setId(String.valueOf(container.hashCode()));
               uiContainer.setStorageId(container.getStorageId());
               PortalDataMapper.toUIContainer(uiContainer, container);
               String[] accessPers = uiContainer.getAccessPermissions();
               for (String accessPer : accessPers)
               {
                  if (accessPer.equals(""))
                     accessPer = null;
               }
               if (accessPers == null || accessPers.length == 0)
                  accessPers = new String[]{UserACL.EVERYONE};
               uiContainer.setAccessPermissions(accessPers);
               uiSource = uiContainer;
            }
            else
            {
               Application app = null;
               UIApplicationList appList = uiApp.findFirstComponentOfType(UIApplicationList.class);
               app = appList.getApplication(sourceId);
               ApplicationType applicationType = app.getType();

               //
               UIPortlet uiPortlet = uiTarget.createUIComponent(UIPortlet.class, null, null);
               if (app.getDisplayName() != null)
               {
                  uiPortlet.setTitle(app.getDisplayName());
               }
               else if (app.getApplicationName() != null)
               {
                  uiPortlet.setTitle(app.getApplicationName());
               }
               uiPortlet.setDescription(app.getDescription());
               List<String> accessPersList = app.getAccessPermissions();
               String[] accessPers = accessPersList.toArray(new String[accessPersList.size()]);
               for (String accessPer : accessPers)
               {
                  if (accessPer.equals(""))
                     accessPers = null;
               }
               if (accessPers == null || accessPers.length == 0)
                  accessPers = new String[]{UserACL.EVERYONE};
               uiPortlet.setAccessPermissions(accessPers);
               UIPage uiPage = uiTarget.getAncestorOfType(UIPage.class);

               // Hardcode on state to fix error while drag/drop Dashboard
               if ("dashboard/DashboardPortlet".equals(app.getContentId()))
               {
                  TransientApplicationState state = new TransientApplicationState<Object>(app.getContentId());
                  uiPortlet.setState(new PortletState(state, applicationType));
               }
               else
               {
                  ApplicationState state;
                  // if we have a new portlet added to the page we need for it to have its own state.
                  // otherwise all new portlets added to a page will have the same state.
                  if (newComponent)
                  {
                     state = new TransientApplicationState<Object>(app.getContentId());
                  }
                  // if the portlet is not new, then we should clone it from the original portlet
                  else
                  {
                     state = new CloneApplicationState<Object>(app.getStorageId());
                  }
                  uiPortlet.setState(new PortletState(state, applicationType));
               }
               uiPortlet.setPortletInPortal(uiTarget instanceof UIPortal);
               uiPortlet.setShowEditControl(true);
               uiSource = uiPortlet;
            }
            List<UIComponent> children = uiTarget.getChildren();
            uiSource.setParent(uiTarget);
            children.add(position, uiSource);
            return;
         }

         org.exoplatform.portal.webui.container.UIContainer uiParent = uiSource.getParent();
         if (uiParent == uiTarget)
         {
            int currentIdx = uiTarget.getChildren().indexOf(uiSource);
            if (position <= currentIdx)
            {
               uiTarget.getChildren().add(position, uiSource);
               currentIdx++;
               uiTarget.getChildren().remove(currentIdx);
               return;
            }
            uiTarget.getChildren().remove(currentIdx);
            if (position >= uiTarget.getChildren().size())
            {
               position = uiTarget.getChildren().size();
            }
            uiTarget.getChildren().add(position, uiSource);
            return;
         }
        
         uiTarget.getChildren().add(position, uiSource);
         uiSource.setParent(uiTarget);

         if (UITabContainer.TAB_CONTAINER.equals(uiParent.getFactoryId()))
         {
            if (uiParent.getChildren().size() == 1)
            {
View Full Code Here

      {
         uiPortal.setMaximizedUIComponent(uiPage);
      }
      else
      {
         UIComponent maximizedComponent = uiPortal.getMaximizedUIComponent();
         if (maximizedComponent != null && maximizedComponent instanceof UIPage)
         {
            uiPortal.setMaximizedUIComponent(null);
         }
         maximizedComponent = this.getMaximizedUIComponent();
View Full Code Here

   {
      public void execute(Event<UITabContainer> event) throws Exception
      {
         String objectId = event.getRequestContext().getRequestParameter(OBJECTID);
         UITabContainer container = event.getSource();
         UIComponent goal = container.findComponentById(objectId);
         if (goal == null)
         {
            return;
         }
         UITabContainer parent = goal.getParent();
         List<UIComponent> children = parent.getChildren();
         for (UIComponent child : children)
         {
            if (child.getId().equals(objectId))
            {
View Full Code Here

      uiPortal.setNavigation(userPortalConfig.getSelectedNavigation());
   }

   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);
View Full Code Here

      }
   }

   public String event(String eventName, String comId, String beanId) throws Exception
   {
      UIComponent component = findComponentById(comId);
      if (component == null)
         return super.event(eventName, comId, beanId);
      return component.event(eventName, beanId);
   }
View Full Code Here

        }
    }

    public static class DeleteComponentActionListener extends EventListener<UIComponent> {
        public void execute(Event<UIComponent> event) throws Exception {
            UIComponent uiComponentTobeRemoved = event.getSource();
            String id = uiComponentTobeRemoved.getId();
            UIPortalApplication uiApp = Util.getUIPortalApplication();
            if (uiComponentTobeRemoved.findFirstComponentOfType(UIPageBody.class) != null) {
                uiApp.addMessage(new ApplicationMessage("UIPortalApplication.msg.deletePageBody", new Object[] {},
                        ApplicationMessage.WARNING));
                return;
            }

            UIPortalComposer portalComposer = uiApp.findFirstComponentOfType(UIPortalComposer.class);
            portalComposer.setEditted(true);

            UIPage uiPage = uiComponentTobeRemoved.getAncestorOfType(UIPage.class);
            if (uiPage != null && uiPage.getMaximizedUIPortlet() != null) {
                if (id.equals(uiPage.getMaximizedUIPortlet().getId())) {
                    uiPage.setMaximizedUIPortlet(null);
                }
            } else {
                UIPortal uiPortal = Util.getUIPortal();
                if (uiPortal != null && uiPortal.getMaximizedUIComponent() != null) {
                    if (id.equals(uiPortal.getMaximizedUIComponent().getId())) {
                        uiPortal.setMaximizedUIComponent(null);
                    }
                } else {
                    UIPageBody uiPageBody = uiPortal.findFirstComponentOfType(UIPageBody.class);
                    if (uiPageBody != null && uiPageBody.getMaximizedUIComponent() != null) {
                        if (id.equals(uiPageBody.getMaximizedUIComponent().getId())) {
                            uiPageBody.setMaximizedUIComponent(null);
                        }
                    }
                }
            }

            PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();

            org.exoplatform.portal.webui.container.UIContainer uiParent = uiComponentTobeRemoved.getParent();
            if (UITabContainer.TAB_CONTAINER.equals(uiParent.getFactoryId())) {
                /*
                 * Check if it is removing the last tab then we will remove the TabContainer as well
                 *
                 * Indeed, a TabContainer is nested into a normal container so we should remove the its parent instead of itself
View Full Code Here

TOP

Related Classes of org.exoplatform.webui.core.UIComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.