You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2004/12/28 06:16:26 UTC

cvs commit: jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/portal/controls FusionPortletControl.java

taylor      2004/12/27 21:16:26

  Modified:    fusion/src/java/org/apache/jetspeed/fusion/portal/portlets
                        JetspeedFusionPortlet.java
               fusion/src/java/org/apache/jetspeed/fusion/util/template
                        FusionJetspeedLink.java
               fusion/src/java/org/apache/jetspeed/fusion/portal/controls
                        FusionPortletControl.java
  Log:
  fixed up nav state and fusion
  - restore button now fuctioning
  - modes are no longer displayed in the window decorator if not supported
  - sync up from j1 to j2 nav state
  - about 90% on sync up from j2 to j1 nav state
  
  Revision  Changes    Path
  1.11      +8 -2      jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/portal/portlets/JetspeedFusionPortlet.java
  
  Index: JetspeedFusionPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/portal/portlets/JetspeedFusionPortlet.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JetspeedFusionPortlet.java	9 Nov 2004 00:42:29 -0000	1.10
  +++ JetspeedFusionPortlet.java	28 Dec 2004 05:16:25 -0000	1.11
  @@ -371,6 +371,7 @@
   
       private static final String SUPPORTS_EDIT_MODE = "org.apache.jetspeed.fusion.edit.mode";
       private static final String SUPPORTS_VIEW_MODE = "org.apache.jetspeed.fusion.view.mode";
  +    private static final String SUPPORTS_HELP_MODE = "org.apache.jetspeed.fusion.help.mode";
        
       private boolean supportsMode(PortletMode mode, RunData rundata, String modeType)
       {
  @@ -396,7 +397,12 @@
       {
           return super.getAllowEdit(rundata) && supportsMode(PortletMode.EDIT, rundata, SUPPORTS_EDIT_MODE);
       }
  -    
  + 
  +    public boolean getAllowInfo( RunData rundata )
  +    {
  +        return supportsMode(PortletMode.HELP, rundata, SUPPORTS_HELP_MODE);
  +    }
  +     
       public boolean getAllowView( RunData rundata )
       {
           return super.getAllowView(rundata) && supportsMode(PortletMode.VIEW, rundata, SUPPORTS_VIEW_MODE);
  
  
  
  1.5       +2 -2      jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/util/template/FusionJetspeedLink.java
  
  Index: FusionJetspeedLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/util/template/FusionJetspeedLink.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FusionJetspeedLink.java	9 Nov 2004 00:42:29 -0000	1.4
  +++ FusionJetspeedLink.java	28 Dec 2004 05:16:25 -0000	1.5
  @@ -80,7 +80,7 @@
           DynamicURI uri = super.getLink(rootType, rootValue, pageName, elementType, elementValue, actionName, templateName, mediaType, language, country);
           
           //NavigationalState state = getNavigationalState(this.rundata);
  -        RequestContext context = (RequestContext) this.rundata.getRequest().getAttribute(JetspeedFusionPortlet.FUSION_NAV_STATE);
  +        //RequestContext context = (RequestContext) this.rundata.getRequest().getAttribute(JetspeedFusionPortlet.FUSION_NAV_STATE);
           /*
           if (context != null)
           {
  
  
  
  1.4       +25 -14    jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/portal/controls/FusionPortletControl.java
  
  Index: FusionPortletControl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/portal/controls/FusionPortletControl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FusionPortletControl.java	8 Nov 2004 05:20:45 -0000	1.3
  +++ FusionPortletControl.java	28 Dec 2004 05:16:25 -0000	1.4
  @@ -27,6 +27,7 @@
   
   import org.apache.jetspeed.Jetspeed;
   import org.apache.jetspeed.PortalReservedParameters;
  +import org.apache.jetspeed.container.state.MutableNavigationalState;
   import org.apache.jetspeed.container.state.NavigationalState;
   import org.apache.jetspeed.engine.Engine;
   import org.apache.jetspeed.fusion.portal.portlets.JetspeedFusionPortlet;
  @@ -139,22 +140,32 @@
               mode2 = nav.getMode(window);
               state2 = nav.getState(window);
           }
  -                
  -        String action = jdata.getAction();
  +
  +        int m = jdata.getMode();
  +        System.out.println("j1 mode = " + m);
           
  -        boolean targeted = fusion.isTargeted(jdata, instance, action);
  -                
  -        boolean customized = (jdata.getMode() == JetspeedRunData.CUSTOMIZE ||
  +        String action = jdata.getAction();        
  +        boolean targeted = fusion.isTargeted(jdata, instance, action);                
  +        boolean restoring = false;
  +        if (targeted && action != null && action.equals(J1_RESTORE_ACTION))
  +        {
  +            restoring = true;
  +            MutableNavigationalState mnav = (MutableNavigationalState)nav;
  +            mnav.setMode(window, PortletMode.VIEW);
  +            //nav.sync(context);            
  +        }
  +        
  +        boolean customized = (!restoring && (jdata.getMode() == JetspeedRunData.CUSTOMIZE ||
                                 targeted && action.equals(J1_EDIT_ACTION) ||
  -                              mode2 == PortletMode.EDIT);
  +                              mode2 == PortletMode.EDIT));
           
  -        boolean maximized = (jdata.getMode() == JetspeedRunData.MAXIMIZE ||
  -                            state2 == WindowState.MAXIMIZED);
  -        boolean helped = (mode2 == PortletMode.HELP || (targeted && action.equals(J1_HELP_ACTION)));
  +        boolean maximized = (!restoring && (jdata.getMode() == JetspeedRunData.MAXIMIZE ||
  +                            state2 == WindowState.MAXIMIZED));
  +        boolean helped = (!restoring && (mode2 == PortletMode.HELP || (targeted && action.equals(J1_HELP_ACTION))));
     
  -        boolean minimized = (state.isMinimized( rundata ) || state2 == WindowState.MINIMIZED);
  +        boolean minimized = (!restoring && (state.isMinimized( rundata ) || state2 == WindowState.MINIMIZED));
           
  -        if (!customized && state.allowCustomize(rundata))
  +        if (!customized && fusion.getAllowEdit(rundata))// state.allowCustomize(rundata))
           {
               actions.add( new PortletAction("customize", "Customize") );
           }
  @@ -164,7 +175,7 @@
               actions.add( new PortletAction("print", "Print Friendly Format") );
           }
   
  -        if (!helped && state.allowInfo(rundata))
  +        if (!helped && fusion.getAllowInfo(rundata))//state.allowInfo(rundata))
           {
               actions.add( new PortletAction("info", "Information") );
           }
  @@ -174,7 +185,7 @@
               actions.add( new PortletAction("close", "Close") );
           }
           
  -        if (maximized || customized || helped || minimized)
  +        if (!restoring && (maximized || customized || helped || minimized))
           {
               actions.add( new PortletAction("restore", "Restore") );
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org