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 ra...@apache.org on 2001/07/22 22:29:59 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets VelocityPortlet.java

raphael     01/07/22 13:29:59

  Modified:    src/java/org/apache/jetspeed/portal BasePortletSet.java
                        PortletCustomizer.java
               src/java/org/apache/jetspeed/portal/controls
                        VelocityPortletControl.java
               src/java/org/apache/jetspeed/portal/portlets
                        VelocityPortlet.java
  Removed:     src/java/org/apache/jetspeed/portal PortalState.java
  Log:
  Update customization features:
  - remove static PortalState class and refactor layout flow
  
  Revision  Changes    Path
  1.11      +8 -17     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java
  
  Index: BasePortletSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- BasePortletSet.java	2001/06/25 10:46:35	1.10
  +++ BasePortletSet.java	2001/07/22 20:29:59	1.11
  @@ -80,7 +80,7 @@
    *
    * @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
    * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
  - * @version $Id: BasePortletSet.java,v 1.10 2001/06/25 10:46:35 raphael Exp $
  + * @version $Id: BasePortletSet.java,v 1.11 2001/07/22 20:29:59 raphael Exp $
    */
   public class BasePortletSet implements PortletSet, Portlet, PortletState
   {
  @@ -270,21 +270,7 @@
       public ConcreteElement getContent(RunData rundata)
       {
   
  -        if (PortalState.hasCustomized(rundata))
  -        {
  -            //handle the customize special case
  -            return PortalState.getCustomizeContent( this, rundata );
  -        }
  -        else if (PortalState.hasMaximized(rundata))
  -        {
  -            //handle the maximize special case
  -            return PortalState.getMaximizeContent( this, rundata );
  -        }
  -        
           ConcreteElement content = null;
  -
  -        //process the normal rendering flow
  -            
           PortletController controller = getController();
               
           if ( controller == null )
  @@ -293,14 +279,19 @@
       
               if (p!=null)
               {
  -                return p.getContent( rundata );
  +                content = p.getContent( rundata );
               }
           }
           else
           {
  -            return controller.getContent( rundata );
  +            content = controller.getContent( rundata );
           }
   
  +        if (content == null)
  +        {
  +            content = new ConcreteElement();
  +        }
  +        
           return content;
       }
   
  
  
  
  1.2       +1 -1      jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletCustomizer.java
  
  Index: PortletCustomizer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletCustomizer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortletCustomizer.java	2001/05/31 17:10:54	1.1
  +++ PortletCustomizer.java	2001/07/22 20:29:59	1.2
  @@ -58,7 +58,7 @@
    * This interface is used as a marker for identifying the portlet
    * classes that can be used as their own customizer
    *
  - * This marker is detected by the PortalState class when rendering
  + * This marker is detected by the customization system when rendering
    * the customizer for a given portlet
    *
    * @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
  
  
  
  1.9       +10 -8     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java
  
  Index: VelocityPortletControl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- VelocityPortletControl.java	2001/07/07 21:10:50	1.8
  +++ VelocityPortletControl.java	2001/07/22 20:29:59	1.9
  @@ -67,11 +67,12 @@
   import org.apache.jetspeed.portal.PortletControl;
   import org.apache.jetspeed.portal.PortletState;
   import org.apache.jetspeed.portal.PortletCustomizer;
  -import org.apache.jetspeed.portal.PortalState;
   import org.apache.jetspeed.services.TemplateLocator;
   import org.apache.jetspeed.services.PortletFactory;
   import org.apache.jetspeed.services.resources.JetspeedResources;
  +import org.apache.jetspeed.services.rundata.JetspeedRunData;
   import org.apache.jetspeed.util.MimeType;
  +import org.apache.jetspeed.util.template.JetspeedTool;
   
   // Ecs stuff
   import org.apache.ecs.ConcreteElement;
  @@ -120,6 +121,7 @@
       public ConcreteElement getContent( RunData rundata )
       {
           Portlet portlet = getPortlet();
  +        JetspeedRunData jdata = (JetspeedRunData)rundata;
   
           // Create a new Velocity context and load default 
           // application pull tools
  @@ -129,15 +131,14 @@
           context.put("actions", buildActionList( rundata, portlet ) );
           context.put("config", getConfig() );
           context.put("skin", portlet.getPortletConfig().getPortletSkin() );
  -        context.put("customized", PortalState.getCustomized(rundata));
   
           // Put the request and session based contexts
           TurbinePull.populateContext(context, rundata);
   
  -        if ( portlet.getName().equals(PortalState.getCustomized(rundata))
  -             && (! (portlet instanceof PortletCustomizer) ) )
  +        if ( portlet.getName().equals(jdata.getCustomized())
  +             && (!(portlet instanceof PortletCustomizer)) )
           {            
  -            context.put("portlet",PortalState.getCustomizer(portlet, rundata));
  +            context.put("portlet",JetspeedTool.getCustomizer(portlet));
           }
           else
           {
  @@ -190,14 +191,15 @@
       protected List buildActionList( RunData rundata, Portlet portlet )
       {
           List actions = new Vector();
  -                
  +        JetspeedRunData jdata = (JetspeedRunData)rundata;
  +        
           // list the available actiosn for this portlet
           if (portlet instanceof PortletState)
           {            
               // the portlet is state aware
               PortletState state = (PortletState)portlet;
  -            boolean maximized = portlet.getName().equals(PortalState.getMaximized(rundata));
  -            boolean customized = portlet.getName().equals(PortalState.getCustomized(rundata));
  +            boolean customized = (jdata.getMode()==jdata.CUSTOMIZE);
  +            boolean maximized = customized||(jdata.getMode()==jdata.MAXIMIZE);
                       
               if ( state.allowCustomize( rundata ) )
               {
  
  
  
  1.6       +13 -6     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/VelocityPortlet.java
  
  Index: VelocityPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/VelocityPortlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- VelocityPortlet.java	2001/07/07 21:10:53	1.5
  +++ VelocityPortlet.java	2001/07/22 20:29:59	1.6
  @@ -100,6 +100,13 @@
           context.put( "portlet", this );
           context.put( "conf", this.getPortletConfig() );
           context.put( "skin", this.getPortletConfig().getPortletSkin() );
  +        
  +        String template = getPortletConfig().getInitParameter("template");
  +        
  +        if (template != null)
  +        {
  +            context.put("template",template); 
  +        }
   
           // Put the request and session based contexts
           TurbinePull.populateContext(context, rundata);
  @@ -109,7 +116,7 @@
           if (actionName != null)
           {
               // store the context so that the action can retrieve it
  -            Log.note("VelocityPortlet found action "+actionName);
  +            Log.debug("VelocityPortlet found action "+actionName+" context "+context);
               rundata.getTemplateInfo().setTemplateContext( "VelocityPortletContext", context );
   
               // if there is an action with the same name in modules/actions/portlets exec it
  @@ -125,13 +132,11 @@
    
           // either the action selected the template, or use the default template 
           // defined in the registry
  -        String template = (String)context.get( "template" );
  -        
  -        if (template == null)
  +        if (context.get( "template" )!=null)
           {
  -            template = getPortletConfig().getInitParameter("template");
  +            template = (String)context.get( "template" );
           }
  -
  +        
           // generate the content
           String s = null;
   
  @@ -148,6 +153,8 @@
           }
           
           TurbineVelocity.requestFinished(context);
  +        
  +        if (s == null) s = "";
   
           return new StringElement( s );
       }
  
  
  

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