[gatein-commits] gatein SVN: r2177 - in portal/trunk: webui/portal/src/main/java/org/exoplatform/portal/application and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Mar 11 11:37:59 EST 2010


Author: trong.tran
Date: 2010-03-11 11:37:57 -0500 (Thu, 11 Mar 2010)
New Revision: 2177

Modified:
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPagePreview.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
GTNPORTAL-847 Fix showing "Page Not Found" after creating new page

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -333,7 +333,10 @@
 
    /**
     * This method should update the PortalConfig object
-    *
+    * 
+    * @deprecated This method is not useful anymore. The preferred way to do this is 
+    * using directly {@link org.exoplatform.portal.config.DataStorage#save(PortalConfig)}
+    * 
     * @param portal
     * @throws Exception
     */
@@ -382,6 +385,10 @@
    /**
     * Removes a page and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#PAGE_REMOVED}
     * when the removal is successful.
+    * 
+    * @deprecated This method is not useful anymore. The preferred way to do this is 
+    * using directly {@link org.exoplatform.portal.config.DataStorage#remove(Page)}
+
     *
     * @param page the page to remove
     * @throws Exception any exception
@@ -395,6 +402,9 @@
    /**
     * Creates a page and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#CREATE_PAGE_EVENT}
     * when the creation is successful.
+    * 
+    * @deprecated This method is not useful anymore. The preferred way to do this is 
+    * using directly {@link org.exoplatform.portal.config.DataStorage#create(Page)}
     *
     * @param page the page to create
     * @throws Exception any exception
@@ -408,6 +418,10 @@
    /**
     * Updates a page and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#PAGE_UPDATED}
     * when the creation is successful.
+    * 
+    * @deprecated This method is not useful anymore. The preferred way to do this is 
+    * using directly {@link org.exoplatform.portal.config.DataStorage#save(Page)}
+
     *
     * @param page the page to update
     * @return the list of model changes that occured
@@ -423,6 +437,9 @@
    /**
     * Creates a navigation and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#CREATE_NAVIGATION_EVENT}
     * when the creation is successful.
+    * 
+    * @deprecated This method is not useful anymore. The preferred way to do this is 
+    * using directly {@link org.exoplatform.portal.config.DataStorage#create(PageNavigation)}
     *
     * @param navigation the navigation to create
     * @throws Exception any exception
@@ -436,6 +453,9 @@
    /**
     * Updates a page navigation broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#NAVIGATION_UPDATED}
     * when the creation is successful.
+    * 
+    * @deprecated This method is not useful anymore. The preferred way to do this is 
+    * using directly {@link org.exoplatform.portal.config.DataStorage#save(PageNavigation)}
     *
     * @param navigation the navigation to update
     * @throws Exception any exception
@@ -449,6 +469,9 @@
    /**
     * Removes a navigation and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#NAVIGATION_REMOVED}
     * when the removal is successful.
+    * 
+    * @deprecated This method is not useful anymore. The preferred way to do this is 
+    * using directly {@link org.exoplatform.portal.config.DataStorage#remove(PageNavigation)}
     *
     * @param navigation the navigation to remove
     * @throws Exception any exception
@@ -459,6 +482,15 @@
       storage_.remove(navigation);
    }
 
+   /**
+    * @deprecated This method is not useful anymore. The preferred way to do this is 
+    * using directly {@link org.exoplatform.portal.config.DataStorage#getPageNavigation(String, String)}
+    * 
+    * @param ownerType
+    * @param id
+    * @return
+    * @throws Exception
+    */
    @Deprecated
    public PageNavigation getPageNavigation(String ownerType, String id) throws Exception
    {
@@ -494,6 +526,9 @@
 
    /**
     * Clones a page.
+    * 
+    * @deprecated This method is not useful anymore. The preferred way to do this is 
+    * using directly {@link org.exoplatform.portal.config.DataStorage#clonePage(String, String, String, String)}
     *
     * @param pageId    the id of the page to clone
     * @param pageName  the new page name

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -19,6 +19,8 @@
 
 package org.exoplatform.portal.application;
 
+import com.sun.syndication.feed.atom.Link;
+
 import org.exoplatform.Constants;
 import org.exoplatform.commons.utils.PortalPrinter;
 import org.exoplatform.commons.utils.WriterPrinter;
@@ -364,11 +366,26 @@
       return response_;
    }
 
+   /**
+    * 
+    * @see org.exoplatform.web.application.RequestContext#getFullRender()
+    */
    final public boolean getFullRender()
    {
       return forceFullUpdate;
    }
 
+   /**
+    * Sets a boolean value to force whether portal will be fully rendered
+    * and it is only effective to an Ajax request.<p/>
+    * 
+    * if the value is set to <code>true</code>, it means :<br/>
+    *
+    * 1) Only portal ui components are rendered <br/>
+    * 2) Portlets will be fully rendered if are inner of the portal ui components being updated
+    * 
+    * @param forceFullUpdate
+    */
    final public void setFullRender(boolean forceFullUpdate)
    {
       this.forceFullUpdate = forceFullUpdate;

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -65,7 +65,7 @@
       loadNavigations();
    }
 
-   public void loadNavigations() throws Exception
+   private void loadNavigations() throws Exception
    {
       PageNavigation portalSelectedNav = Util.getUIPortal().getSelectedNavigation();
       if (portalSelectedNav != null)

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -237,16 +237,7 @@
             uiNavigation.selectedParent_ = selectNav;
          else
             uiNavigation.selectedParent_ = PageNavigationUtils.searchPageNodeByUri(selectNav, parentUri);
-         // UIPageBody uiPageBody =
-         // uiPortal.findFirstComponentOfType(UIPageBody.class);
-         // if(uiPageBody != null) {
-         // if(uiPageBody.getMaximizedUIComponent() != null) {
-         // UIPortlet currentPortlet = (UIPortlet)
-         // uiPageBody.getMaximizedUIComponent();
-         // currentPortlet.setCurrentWindowState(WindowState.NORMAL);
-         // uiPageBody.setMaximizedUIComponent(null);
-         // }
-         // }
+
          PageNodeEvent<UIPortal> pnevent;
          pnevent = new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uri);
          uiPortal.broadcast(pnevent, Event.Phase.PROCESS);

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -161,7 +161,7 @@
                newUIPortal.setSelectedNode(targetPageNode);
                newUIPortal.setSelectedPath(targetedPathNodes);
                uiPortalApp.setShowedUIPortal(newUIPortal);
-               uiPortalApp.addCachedUIPortal(newUIPortal);
+               uiPortalApp.putCachedUIPortal(newUIPortal);
                newUIPortal.refreshUIPage();
                return;
             }
@@ -260,7 +260,7 @@
        * @param pathNodes
        * @return
        */
-      private static PageNode getTargetedNode(PageNavigation targetedNav, String[] pathNodes)
+      private PageNode getTargetedNode(PageNavigation targetedNav, String[] pathNodes)
       {
          //Case users browses to a URL of the form  */portal/public/classic
          if(pathNodes.length == 0)
@@ -302,7 +302,7 @@
        * @param nav
        * @return
        */
-      private static PageNode getDefaultNode(PageNavigation nav)
+      private PageNode getDefaultNode(PageNavigation nav)
       {
          PageNode defaultNode;
          try
@@ -323,7 +323,7 @@
          }
       }
       
-      private static List<PageNode> findPath(PageNavigation nav, String[] pathNodes)
+      private List<PageNode> findPath(PageNavigation nav, String[] pathNodes)
       {
          List<PageNode> nodes = new ArrayList<PageNode>(4);
          
@@ -355,7 +355,7 @@
          return nodes;
       }
 
-      private static UIPortal buildUIPortal(PageNavigation newPageNav, UIPortalApplication uiPortalApp, UserPortalConfig userPortalConfig) throws Exception
+      private UIPortal buildUIPortal(PageNavigation newPageNav, UIPortalApplication uiPortalApp, UserPortalConfig userPortalConfig) throws Exception
       {
          DataStorage storage = uiPortalApp.getApplicationComponent(DataStorage.class);
          if(storage == null){
@@ -374,7 +374,7 @@
          return uiPortal;
       }
       
-      private static void redirectToNotFoundNode(UIPortal uiPortal) throws Exception
+      private void redirectToNotFoundNode(UIPortal uiPortal) throws Exception
       {
          PageNodeEvent<UIPortal> changePageNodeEvent = new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, "/notfound");
          uiPortal.broadcast(changePageNodeEvent, Event.Phase.PROCESS);

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -83,24 +83,10 @@
 
    private void saveData() throws Exception
    {
-      DataStorage dataService = getApplicationComponent(DataStorage.class); 
       UIPagePreview uiPagePreview = getChild(UIPagePreview.class);
       UIPage uiPage = (UIPage)uiPagePreview.getUIComponent();
       UIPortal uiPortal = Util.getUIPortal();
-      /*if (PortalConfig.PORTAL_TYPE.equals(uiPage.getOwnerType()))
-      {
-         uiPage.setAccessPermissions(uiPortal.getAccessPermissions());
-         uiPage.setEditPermission(uiPortal.getEditPermission());
-      }
-      else if (PortalConfig.GROUP_TYPE.equals(uiPage.getOwnerType()))
-      {
-         UserACL acl = getApplicationComponent(UserACL.class);
-         String ownerId = uiPage.getOwnerId();
-         ownerId = ownerId.startsWith("/") ? ownerId : "/" + ownerId;
-         uiPage.setAccessPermissions(new String[]{"*:" + ownerId});
-         uiPage.setEditPermission(acl.getMakableMT() + ":" + ownerId);
-      }
-       */
+
       UIWizardPageSetInfo uiPageInfo = getChild(UIWizardPageSetInfo.class);
       UIPageNodeSelector uiNodeSelector = uiPageInfo.getChild(UIPageNodeSelector.class);
       PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
@@ -127,11 +113,11 @@
       }
       uiNodeSelector.selectPageNodeByUri(pageNode.getUri());
 
+      DataStorage dataService = getApplicationComponent(DataStorage.class); 
       dataService.create(page);
       dataService.save(pageNav);
       setNavigation(uiPortal.getNavigations(), uiNodeSelector.getSelectedNavigation());
-      String uri = pageNav.getId() + "::" + pageNode.getUri();
-      PageNodeEvent<UIPortal> pnevent = new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uri);
+      PageNodeEvent<UIPortal> pnevent = new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, pageNode.getUri());
       uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
    }
 
@@ -147,7 +133,14 @@
       }
    }
 
-   public boolean isSelectedNodeExist() throws Exception
+   /**
+    * Returns <code>true</code> if the creating node is existing already.
+    * Otherwise it returns <code>false</code>
+    * 
+    * @return true if the creating node is existing, otherwise it's false
+    * @throws Exception
+    */
+   private boolean isSelectedNodeExist() throws Exception
    {
       UIWizardPageSetInfo uiPageSetInfo = getChild(UIWizardPageSetInfo.class);
       PageNavigation navigation = uiPageSetInfo.getChild(UIPageNodeSelector.class).getSelectedNavigation();
@@ -181,7 +174,6 @@
       public void execute(Event<UIPageWizard> event) throws Exception
       {
          UIPageWizard uiWizard = event.getSource();
-         uiWizard.setDescriptionWizard(FIRST_STEP);
 
          uiWizard.updateWizardComponent();
          uiWizard.viewStep(FIRST_STEP);
@@ -207,7 +199,6 @@
          if (uiWizard.getSelectedStep() < SECONDE_STEP)
          {
             uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.StepByStep", null));
-            uiWizard.setDescriptionWizard(FIRST_STEP);
             uiWizard.viewStep(FIRST_STEP);
             uiWizard.updateWizardComponent();
             return;
@@ -223,7 +214,6 @@
 
          UIWizardPageSetInfo uiPageSetInfo = uiWizard.getChild(UIWizardPageSetInfo.class);
          UIPageNodeSelector uiNodeSelector = uiPageSetInfo.getChild(UIPageNodeSelector.class);
-         uiWizard.setDescriptionWizard(SECONDE_STEP);
          uiWizard.updateWizardComponent();
          PageNavigation navigation = uiNodeSelector.getSelectedNavigation();
          if (navigation == null)
@@ -284,7 +274,6 @@
          if (uiWizard.isSelectedNodeExist())
          {
             uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.NameNotSame", null));
-            uiWizard.setDescriptionWizard(FIRST_STEP);
             uiWizard.viewStep(FIRST_STEP);
             uiWizard.updateWizardComponent();
             return;
@@ -294,7 +283,6 @@
          if (uiWizard.getSelectedStep() < THIRD_STEP)
          {
             uiWizard.setShowActions(true);
-            uiWizard.setDescriptionWizard(uiWizard.getSelectedStep());
             uiWizard.updateWizardComponent();
             uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.StepByStep", null));
             return;
@@ -318,7 +306,6 @@
          if (storage.getPage(pageId) != null)
          {
             uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.NameNotSame", null));
-            uiWizard.setDescriptionWizard(FIRST_STEP);
             uiWizard.viewStep(FIRST_STEP);
             uiWizard.updateWizardComponent();
          }
@@ -376,14 +363,12 @@
          if (uiWizard.isSelectedNodeExist())
          {
             uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.NameNotSame", null));
-            uiWizard.setDescriptionWizard(FIRST_STEP);
             uiWizard.viewStep(FIRST_STEP);
             uiWizard.updateWizardComponent();
             return;
          }
          uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
          uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
-         Util.getPortalRequestContext().setFullRender(true);
          uiWizard.saveData();
          UIPortalToolPanel toolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
          toolPanel.setUIComponent(null);

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPagePreview.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPagePreview.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPagePreview.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -37,22 +37,6 @@
    )})
 public class UIPagePreview extends UIComponentDecorator
 {
-   //  private UIComponent uiBackComponent ;
-   //  
-   //  public UIComponent getBackComponent() { return uiBackComponent ; }
-   //  public void setBackComponent(UIComponent uiComp) { uiBackComponent = uiComp ; }
-   //  
-   //  public boolean hasBackEvent(){ return uiBackComponent != null; }
-
-   //  static public class BackActionListener extends EventListener<UIPagePreview> {
-   //    public void execute(Event<UIPagePreview> event) throws Exception {
-   //      UIPagePreview uiPreview = event.getSource() ;
-   //      UIPortalToolPanel uiToolPanel = Util.getUIPortalToolPanel();      
-   //      UIComponent uiComp = uiPreview.getBackComponent() ;
-   //      uiToolPanel.setUIComponent(uiComp) ;
-   //      event.getRequestContext().addUIComponentToUpdateByAjax(uiToolPanel) ;
-   //    }
-   //  }
    public boolean isPageHasApplication()
    {
       if (uicomponent_ == null)

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -114,50 +114,6 @@
       pcontext.setFullRender(true);
    }
 
-   // TODO: Need to place UIPageCreateDescription component in other component
-
-   public void setDescriptionWizard() throws Exception
-   {
-      // UIPortalApplication uiPortalApp =
-      // getAncestorOfType(UIPortalApplication.class);
-      // UIExoStart uiExoStart =
-      // uiPortalApp.findFirstComponentOfType(UIExoStart.class);
-      // uiExoStart.setUIControlWSWorkingComponent(UIPageCreateDescription.class);
-      // UIPageCreateDescription uiPageDescription =
-      // uiExoStart.getUIControlWSWorkingComponent();
-      // if (this.getClass() == UIPageEditWizard.class) {
-      // uiPageDescription.setTitleKey("UIPageCreateDescription.title.edit");
-      // uiPageDescription.addChild(UIDescription.class, null, "pageEditWizard");
-      // return;
-      // }
-      // uiPageDescription.setTitleKey("UIPageCreateDescription.title.create");
-      // uiPageDescription.addChild(UIDescription.class, null, "pageWizard");
-   }
-
-   // TODO: Need to place UIPageCreateDescription component in other component
-
-   public void setDescriptionWizard(int step) throws Exception
-   {
-      // UIPortalApplication uiPortalApp =
-      // getAncestorOfType(UIPortalApplication.class);
-      // UIExoStart uiExoStart =
-      // uiPortalApp.findFirstComponentOfType(UIExoStart.class);
-      // uiExoStart.setUIControlWSWorkingComponent(UIPageCreateDescription.class);
-      // UIPageCreateDescription uiPageDescription =
-      // uiExoStart.getUIControlWSWorkingComponent();
-      //
-      // if (this.getClass() == UIPageEditWizard.class) {
-      // uiPageDescription.setTitleKey("UIPageCreateDescription.title.edit");
-      // uiPageDescription.addChild(UIDescription.class, null, "pageEditWizard"
-      // + Integer.toString(step));
-      // return;
-      // }
-      //
-      // uiPageDescription.setTitleKey("UIPageCreateDescription.title.create");
-      // uiPageDescription.addChild(UIDescription.class, null, "pageWizard" +
-      // Integer.toString(step));
-   }
-
    static public class AbortActionListener extends EventListener<UIPageWizard>
    {
       public void execute(Event<UIPageWizard> event) throws Exception

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -262,6 +262,7 @@
    
    public synchronized void setSelectedNode(PageNode node)
    {
+      System.out.println("\n\n\nSetting the selected node : " + node);
       selectedNode_ = node;
    }
 
@@ -300,34 +301,6 @@
    {
       selectedPath = nodes;
    }
-
-   /*
-   public PageNavigation getSelectedNavigation() throws Exception
-   {
-      if (selectedNavigation_ != null && selectedNavigation_.getNodes() != null
-         && selectedNavigation_.getNodes().size() > 0)
-      {
-         return selectedNavigation_;
-      }
-      if (getNavigations().size() < 1)
-         return null;
-      // TODO dang.tung: get right selectedNavigation 
-      // -------------------------------------------
-      List<PageNavigation> navs = getNavigations();
-      PageNavigation pNav = navs.get(0);
-      for (PageNavigation nav : navs)
-      {
-         if (nav.getNodes() != null && nav.getNodes().size() > 0)
-         {
-            pNav = nav;
-            break;
-         }
-      }
-      // -------------------------------------------
-      setSelectedNavigation(pNav);
-      return pNav;
-   }
-   */
    
    public PageNavigation getSelectedNavigation() throws Exception
    {

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -157,6 +157,11 @@
       isShowControl = state;
    }
 
+   /**
+    * Return true if the edition is in the page creation wizard
+    * 
+    * @return
+    */
    private boolean isUsedInWizard()
    {
       UIWorkingWorkspace uiWorkingWS = getAncestorOfType(UIWorkingWorkspace.class);
@@ -465,7 +470,7 @@
             PortalDataMapper.toUIPortal(uiPortal, uiPortalApp.getUserPortalConfig());
 
             //Update the cache of UIPortal from UIPortalApplication
-            uiPortalApp.updateCachedUIPortal(uiPortal);
+            uiPortalApp.putCachedUIPortal(uiPortal);
             uiPortalApp.setShowedUIPortal(uiPortal);
             
             //To init the UIPage, that fixed a bug on AdminToolbarPortlet when edit the layout. Here is only a
@@ -643,6 +648,12 @@
       }
    }
 
+   /**
+    * This action listener is for the page edition
+    * 
+    * @author <a href="trong.tran at exoplatform.com">Trong Tran</a>
+    * @version $Revision$
+    */
    static public class Finish2ActionListener extends EventListener<UIPortalComposer>
    {
       public void execute(Event<UIPortalComposer> event) throws Exception
@@ -659,6 +670,10 @@
 
          UserPortalConfigService portalConfigService =
             uiWorkingWS.getApplicationComponent(UserPortalConfigService.class);
+         
+         /*
+          * if it is a edition of the current page
+          */
          if (page.getStorageId() != null && portalConfigService.getPage(pageId) == null)
          {
             uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{pageId}, 1));
@@ -675,6 +690,8 @@
          }
          UIPortalComposer composer = uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(false);
          composer.setEditted(false);
+         
+         // If it is a page creation wizard
          if (composer.isUsedInWizard())
          {
             UIWizard wizard = (UIWizard)uiToolPanel.getUIComponent();

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java	2010-03-11 15:56:20 UTC (rev 2176)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java	2010-03-11 16:37:57 UTC (rev 2177)
@@ -119,14 +119,15 @@
    
    /**
     * The constructor of this class is used to build the tree of UI components
-    * that will be aggregated in the portal page. 1) The component is stored in
-    * the current PortalRequestContext ThreadLocal 2) The configuration for the
-    * portal associated with the current user request is extracted from the
-    * PortalRequestContext 3) Then according to the context path, either a
-    * public or private portal is initiated. Usually a public portal does not
-    * contain the left column and only the private one has it. 4) The skin to
-    * use is setup 5) Finally, the current component is associated with the
-    * current portal owner
+    * that will be aggregated in the portal page.<br/>
+    * 1) The component is stored in the current PortalRequestContext ThreadLocal<br/>
+    * 2) The configuration for the portal associated with the current user request 
+    *    is extracted from the PortalRequestContext<br/>
+    * 3) Then according to the context path, either a public or private portal is initiated.
+    *    Usually a public portal does not contain the left column and only the private one has it.<br/>
+    * 4) The skin to use is setup <br/>
+    * 5) Finally, the current component is associated with the
+    *    current portal owner
     * 
     * @throws Exception
     */
@@ -178,7 +179,8 @@
       // -------------------------------------------------------------------------------
       context.setUIApplication(this);
 
-      setupUIPortalCache();
+      this.all_UIPortals = new HashMap<UIPortalKey, UIPortal>(5);
+      
       addWorkingWorkspace();
 
       String currentSkin = userPortalConfig_.getPortalConfig().getSkin();
@@ -191,6 +193,11 @@
       localizeNavigations();
    }
 
+   /**
+    * Sets the specified portal to be showed in the normal mode currently
+    * 
+    * @param uiPortal
+    */
    public void setShowedUIPortal(UIPortal uiPortal)
    {
       this.showedUIPortal = uiPortal;
@@ -203,11 +210,23 @@
       }
    }
    
+   /**
+    * Returns current UIPortal which being showed in normal mode
+    * 
+    * @return
+    */
    public UIPortal getShowedUIPortal()
    {
       return showedUIPortal;
    }
    
+   /**
+    * Returns a cached UIPortal matching to OwnerType and OwnerId if any
+    * 
+    * @param ownerType
+    * @param ownerId
+    * @return
+    */
    public UIPortal getCachedUIPortal(String ownerType, String ownerId)
    {
       if(ownerType == null || ownerId == null)
@@ -217,7 +236,12 @@
       return this.all_UIPortals.get(new UIPortalKey(ownerType, ownerId));
    }
    
-   public void addCachedUIPortal(UIPortal uiPortal)
+   /**
+    * Associates the specified UIPortal to a cache map with specified key which bases on OwnerType and OwnerId
+    * 
+    * @param uiPortal
+    */
+   public void putCachedUIPortal(UIPortal uiPortal)
    {
       String ownerType = uiPortal.getOwnerType();
       String ownerId = uiPortal.getOwner();
@@ -228,6 +252,12 @@
       }
    }
    
+   /**
+    * Remove the UIPortal from the cache map
+    * 
+    * @param ownerType
+    * @param ownerId
+    */
    public void removeCachedUIPortal(String ownerType, String ownerId)
    {
       if(ownerType == null || ownerId == null)
@@ -237,19 +267,6 @@
       this.all_UIPortals.remove(new UIPortalKey(ownerType, ownerId));
    }
    
-   /** Update the UIPortal in the cache **/
-   public void updateCachedUIPortal(UIPortal uiPortal)
-   {
-      String ownerType = uiPortal.getOwnerType();
-      String ownerId = uiPortal.getOwner();
-      
-      if(ownerType != null && ownerId != null)
-      {
-         this.all_UIPortals.put(new UIPortalKey(ownerType, ownerId), uiPortal);
-      }
-   }
-   
-   
    public boolean isSessionOpen()
    {
       return isSessionOpen;
@@ -438,21 +455,6 @@
       }
    }
    
-   private void setupUIPortalCache()
-   {
-      this.all_UIPortals = new HashMap<UIPortalKey, UIPortal>(5);
-   }
-   
-   private void setupSkin()
-   {
-      
-   }
-   
-   private void setupLocale()
-   {
-      
-   }
-   
    /**
     * The central area is called the WorkingWorkspace. It is composed of: 1) A
     * UIPortal child which is filled with portal data using the PortalDataMapper
@@ -472,7 +474,7 @@
       UIPortal uiPortal = createUIComponent(UIPortal.class, null, null);
       PortalDataMapper.toUIPortal(uiPortal, userPortalConfig_);
       
-      this.addCachedUIPortal(uiPortal);
+      this.putCachedUIPortal(uiPortal);
       this.showedUIPortal = uiPortal;
       
       uiWorkingWorkspace.addChild(UIEditInlineWorkspace.class, null, UI_EDITTING_WS_ID).setRendered(false);
@@ -734,13 +736,10 @@
 
       private String ownerId;
 
-      private final int hashCode;
-      
       UIPortalKey(String _ownerType, String _ownerId)
       {
          this.ownerType = _ownerType;
          this.ownerId = _ownerId;
-         this.hashCode = this.ownerType.hashCode() * 2 + this.ownerId.hashCode();
       }
 
       @Override
@@ -760,7 +759,7 @@
       @Override
       public int hashCode()
       {
-         return this.hashCode;
+         return this.ownerType.hashCode() * 2 + this.ownerId.hashCode();
       }
       
       @Override



More information about the gatein-commits mailing list