portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/portaltoolkit JetspeedPortalToolkitService.java
Date Wed, 02 Apr 2003 15:10:01 GMT
weaver      2003/04/02 07:10:01

  Modified:    src/java/org/apache/jetspeed/portal BasePortletSkin.java
                        PortletSkin.java
               webapp/WEB-INF/conf skins.xreg
               src/java/org/apache/jetspeed/services/portaltoolkit
                        JetspeedPortalToolkitService.java
  Added:       webapp/images/html/skins/3D-icons minimize.gif close.gif
                        restore.gif info.gif maximize.gif customize.gif
                        print.gif info1.gif
  Log:
  see bug id 18208 for a full description of this enhancement.
  
  - PortletSkin: Added the setCapabilityMap() method signature so that the PortalToolkitService

    can provide each skin with a capaibilty so it can figure out were to locate the image.paths
    property.
  
  - BasePortletSkin: Implemented the new setCapabilityMap() method.  BasePortletSkin.getImage

    can now parse comma sperated list of directories relactive images/{perferred content}/skins

    and search for/locate an image by name with or without a valid image extension.
  
  - JetspeedPortalToolkitService: the getSkin() method now populates the each portlet skin

    created with a CapabilityMap.
  
  - Added a new skin to skins.xreg, orange-red-3d-icons, that shows an example of the new
image 
    skinning capabilities.
  
  - Added images/html/skins/3D-icons directory with alterantive portlet action icons.
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed/webapp/images/html/skins/3D-icons/minimize.gif
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/webapp/images/html/skins/3D-icons/close.gif
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/webapp/images/html/skins/3D-icons/restore.gif
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/webapp/images/html/skins/3D-icons/info.gif
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/webapp/images/html/skins/3D-icons/maximize.gif
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/webapp/images/html/skins/3D-icons/customize.gif
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/webapp/images/html/skins/3D-icons/print.gif
  
  	<<Binary file>>
  
  
  1.1                  jakarta-jetspeed/webapp/images/html/skins/3D-icons/info1.gif
  
  	<<Binary file>>
  
  
  1.5       +136 -2    jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSkin.java
  
  Index: BasePortletSkin.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSkin.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BasePortletSkin.java	27 Mar 2003 17:46:20 -0000	1.4
  +++ BasePortletSkin.java	2 Apr 2003 15:09:58 -0000	1.5
  @@ -54,6 +54,12 @@
   
   package org.apache.jetspeed.portal;
   
  +import java.io.File;
  +import java.util.StringTokenizer;
  +
  +import org.apache.jetspeed.capability.CapabilityMap;
  +import org.apache.turbine.services.servlet.TurbineServlet;
  +
   /**
    * This default implementation of PortletSkin stores every property
    * as a Map of text properties
  @@ -67,6 +73,8 @@
   {
   
       public String name = null;
  +    private CapabilityMap cm;
  +    private static final String[] VALID_EXTENSIONS = new String[] { "gif", "jpg", "png"
};
       
       /**
        * Returns the name of this color scheme
  @@ -389,11 +397,137 @@
   
           if (containsKey("image-" + name))
           {
  -            return (String) get("image-" + name);
  +            return buildMediaTypeSpecificPath((String) get("image-" + name));
  +        }
  +
  +        String path = imageDiscovery(name);
  +        if (path != null)
  +        {
  +            return path;
           }
           else
           {
               return dftPath;
  +        }
  +    }
  +
  +  
  +    /**
  +    * This allows the PortalToolKit to make the PortletSkin aware
  +    * of the current user-agents's capabilities
  +    * @param CapabilityMap cm Current capaibilities of the user-agent
  +    * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
  +    */
  +    public void setCapabilityMap(CapabilityMap cm)
  +    {
  +        this.cm = cm;
  +    }
  +    
  +    /**
  +     * builds a media type specific path for the relative path provided
  +     */    
  +    private String buildMediaTypeSpecificPath(String relativePath)
  +    {
  +        String path = "images/" + cm.getPreferredMediaType() + "/skins/" + relativePath;
  +        return path;
  +    }
  +    
  +    /**
  +     * builds a media type specific path using this skin's name.
  +     */ 
  +    private String buildMediaTypeSpecificPath()
  +    {        
  +        return buildMediaTypeSpecificPath(name);
  +    }
  +    
  +    private  String imageDiscovery(String imageName)
  +    {
  +        String imagePathes = (String) get("image.paths");
  +        boolean hasExtension = hasImageExtension(imageName);
  +        String fullPath = null;
  +        if (imagePathes != null)
  +        {
  +            StringTokenizer tokenizer = new StringTokenizer(imagePathes, ",");
  +            while (tokenizer.hasMoreTokens())
  +            {
  +                fullPath =
  +                    buildValidImage(
  +                        buildMediaTypeSpecificPath(tokenizer.nextToken()),
  +                        imageName,
  +                        hasExtension);
  +                if (fullPath != null)
  +                {
  +                    return fullPath;
  +                }
  +            }
  +        }
  +
  +        if (fullPath == null)
  +        {
  +            String skinBasedPath = buildMediaTypeSpecificPath();
  +            fullPath = buildValidImage(skinBasedPath, imageName, hasExtension);
  +        }
  +        return fullPath;
  +    }
  +    
  +    /**
  +     * Does the path contain a valid image extension?
  +     */
  +    private boolean hasImageExtension(String path)
  +    {
  +        return (path.indexOf(".gif") > -1)
  +            || (path.indexOf(".jpg") > -1)
  +            || (path.indexOf(".png") > -1);
  +    }
  +    
  +    /**
  +     * makes every attempt to locate a valid image based on the combination 
  +     * of an absoulte path and relative path or name.  The relPath may pr may not
  +     * contain a valid image extension (.gif, .png, .jpg).
  +     */
  +    private String buildValidImage(String absPath, String relPath, boolean hasExtension)
  +    {
  +        String path = null;
  +
  +        if (hasExtension)
  +        {
  +            path = absPath + "/" + relPath;
  +            if (fileExists(path))
  +            {
  +                return path;
  +            }
  +        }
  +        else
  +        {
  +            for (int i = 0; i < VALID_EXTENSIONS.length; i++)
  +            {
  +                path = absPath + "/" + relPath + "." + VALID_EXTENSIONS[i];
  +                if (fileExists(path))
  +                {
  +                    return path;
  +                }
  +            }           
  +        }
  +        
  +        return null;
  +    }
  +    
  +    /**
  +     * Does this <code>path</code> exist in the current file system.
  +     */
  +    private boolean fileExists(String path)
  +    {
  +        File testPath = null;
  +        testPath = new File(TurbineServlet.getRealPath(path));
  +        if (testPath.exists())
  +        {
  +            testPath = null;
  +            return true;
  +        }
  +        else
  +        {
  +            testPath = null;
  +            return false;
           }
       }
   
  
  
  
  1.5       +11 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletSkin.java
  
  Index: PortletSkin.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletSkin.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PortletSkin.java	27 Mar 2003 17:46:20 -0000	1.4
  +++ PortletSkin.java	2 Apr 2003 15:09:58 -0000	1.5
  @@ -54,6 +54,8 @@
   
   package org.apache.jetspeed.portal;
   
  +import org.apache.jetspeed.capability.CapabilityMap;
  +
   /**
    * The PortletSkin defines the color scheme to use for displaying a
    * specified portlet (and associated control)
  @@ -267,5 +269,13 @@
        * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
        */
       String getImage(String name, String dftPath);
  +    
  +   /**
  +    * This allows the PortalToolKit to make the PortletSkin aware
  +    * of the current user-agents's capabilities
  +    * @param CapabilityMap cm Current capaibilities of the user-agent
  +    * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
  +    */
  +    void setCapabilityMap(CapabilityMap cm);
   
   }
  
  
  
  1.9       +11 -0     jakarta-jetspeed/webapp/WEB-INF/conf/skins.xreg
  
  Index: skins.xreg
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/skins.xreg,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- skins.xreg	30 Dec 2001 09:32:33 -0000	1.8
  +++ skins.xreg	2 Apr 2003 15:09:58 -0000	1.9
  @@ -88,4 +88,15 @@
           <property name="tab-title-style-class" value="TabTitleStyleClass" hidden="false"/>
           <property name="tab-content-style-class" value="TabContentStyleClass" hidden="false"/>
       </skin-entry>
  +    <skin-entry name="orange-red-3d-icons" hidden="false">
  +        <property name="text-color" value="#000000" hidden="false"/>
  +        <property name="background-color" value="#ffffff" hidden="false"/>
  +        <property name="title-text-color" value="#000000" hidden="false"/>
  +        <property name="title-background-color" value="#ffcc00" hidden="false"/>
  +        <property name="title-style-class" value="TitleStyleClass" hidden="false"/>
  +        <property name="highlight-text-color" value="#ffffff" hidden="false"/>
  +        <property name="highlight-background-color" value="#990000" hidden="false"/>
  +        <property name="highlight-title-style-class" value="HighlightTitleStyleClass"
hidden="false"/>
  +        <property name="image.paths" value="3D-icons" hidden="false"/>
  +    </skin-entry>
   </registry>
  
  
  
  1.28      +141 -126  jakarta-jetspeed/src/java/org/apache/jetspeed/services/portaltoolkit/JetspeedPortalToolkitService.java
  
  Index: JetspeedPortalToolkitService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/portaltoolkit/JetspeedPortalToolkitService.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- JetspeedPortalToolkitService.java	19 Feb 2003 17:39:45 -0000	1.27
  +++ JetspeedPortalToolkitService.java	2 Apr 2003 15:09:58 -0000	1.28
  @@ -80,6 +80,8 @@
   import org.apache.jetspeed.om.profile.ProfileLocator;
   import org.apache.jetspeed.om.profile.PSMLDocument;
   import org.apache.jetspeed.services.Profiler;
  +import org.apache.jetspeed.services.rundata.JetspeedRunData;
  +import org.apache.jetspeed.services.rundata.JetspeedRunDataService;
   
   import org.apache.jetspeed.services.Registry;
   import org.apache.jetspeed.services.PortletFactory;
  @@ -89,6 +91,7 @@
   import org.apache.jetspeed.om.registry.SkinEntry;
   import org.apache.jetspeed.util.MetaData;
   import org.apache.jetspeed.util.JetspeedException;
  +import org.apache.jetspeed.util.ServiceUtil;
   import org.apache.jetspeed.om.BaseSecurityReference;
   import org.apache.jetspeed.om.SecurityReference;
   import org.apache.jetspeed.om.registry.SecurityEntry;
  @@ -97,6 +100,7 @@
   import org.apache.turbine.services.TurbineBaseService;
   import org.apache.turbine.services.InitializationException;
   import org.apache.turbine.services.resources.ResourceService;
  +import org.apache.turbine.services.rundata.RunDataService;
   import org.apache.turbine.util.Log;
   
   import java.util.Iterator;
  @@ -114,7 +118,8 @@
    *
    * @version $Id$
    */
  -public class JetspeedPortalToolkitService extends TurbineBaseService
  +public class JetspeedPortalToolkitService
  +    extends TurbineBaseService
       implements PortalToolkitService
   {
   
  @@ -143,11 +148,12 @@
        * This is the early initialization method called by the
        * Turbine <code>Service</code> framework
        */
  -    public void init( ServletConfig conf ) throws InitializationException
  +    public void init(ServletConfig conf) throws InitializationException
       {
   
  -        ResourceService serviceConf = ((TurbineServices)TurbineServices.getInstance())
  -                                                     .getResources(PortalToolkitService.SERVICE_NAME);
  +        ResourceService serviceConf =
  +            ((TurbineServices) TurbineServices.getInstance()).getResources(
  +                PortalToolkitService.SERVICE_NAME);
   
           this.defaultControl = serviceConf.getString("default.control");
           this.defaultController = serviceConf.getString("default.controller");
  @@ -167,14 +173,14 @@
        * @param name a PortletControl name available in the registry or a classname
        * @return the created PortletControl
        */
  -    public PortletControl getControl( String name )
  +    public PortletControl getControl(String name)
       {
           PortletControl pc = null;
           PortletControlEntry entry = null;
   
           if (name != null)
           {
  -            entry = (PortletControlEntry)Registry.getEntry(Registry.PORTLET_CONTROL, name);
  +            entry = (PortletControlEntry) Registry.getEntry(Registry.PORTLET_CONTROL, name);
           }
   
           Map params = null;
  @@ -183,32 +189,30 @@
           {
               if (entry == null)
               {
  -                if (name!=null)
  +                if (name != null)
                   {
  -                    pc = (PortletControl)Class.forName(name).newInstance();
  +                    pc = (PortletControl) Class.forName(name).newInstance();
                       params = new Hashtable();
                   }
               }
               else
               {
  -                pc = (PortletControl)Class.forName(entry.getClassname()).newInstance();
  +                pc = (PortletControl) Class.forName(entry.getClassname()).newInstance();
                   params = entry.getParameterMap();
               }
           }
           catch (Exception e)
           {
  -            Log.error("Unable to instanciate control "+name+", using default", e);
  +            Log.error("Unable to instanciate control " + name + ", using default", e);
           }
   
  -        if (    (pc == null)
  -             && (defaultControl != null)
  -             && (!defaultControl.equals(name)) )
  +        if ((pc == null) && (defaultControl != null) && (!defaultControl.equals(name)))
           {
  -            return getControl( defaultControl );
  +            return getControl(defaultControl);
           }
   
           PortletControlConfig pcConf = new BasePortletControlConfig();
  -        pcConf.setName( name );
  +        pcConf.setName(name);
           pcConf.setInitParameters(params);
           pc.setConfig(pcConf);
   
  @@ -221,18 +225,18 @@
        * @param control the PSML control object
        * @return the created PortletControl
        */
  -    public PortletControl getControl( Control control )
  +    public PortletControl getControl(Control control)
       {
           PortletControl pc = null;
   
  -        if (control!=null)
  +        if (control != null)
           {
               pc = getControl(control.getName());
               pc.getConfig().getInitParameters().putAll(getParameters(control));
           }
           else
           {
  -            if (defaultControl!=null)
  +            if (defaultControl != null)
               {
                   pc = getControl(this.defaultControl);
               }
  @@ -241,8 +245,7 @@
           return pc;
       }
   
  -
  -    protected PortletControl getControl( Control control, PortletEntry entry )
  +    protected PortletControl getControl(Control control, PortletEntry entry)
       {
           PortletControl pc = null;
   
  @@ -269,7 +272,6 @@
           return pc;
       }
   
  -
       /**
        * Instanciates a PortletController based on a Registry entry, if available
        * or directly from a classname.
  @@ -277,16 +279,14 @@
        * @param name a PortletController name available in the registry or a classname
        * @return the created PortletController
        */
  -    public PortletController getController( String name )
  +    public PortletController getController(String name)
       {
           PortletController pc = null;
           PortletControllerEntry entry = null;
   
  -
           if (name != null)
           {
  -            entry = (PortletControllerEntry)Registry
  -                                            .getEntry(Registry.PORTLET_CONTROLLER, name);
  +            entry = (PortletControllerEntry) Registry.getEntry(Registry.PORTLET_CONTROLLER,
name);
           }
   
           Map params = null;
  @@ -295,32 +295,30 @@
           {
               if (entry == null)
               {
  -                if (name!=null)
  +                if (name != null)
                   {
  -                    pc = (PortletController)Class.forName(name).newInstance();
  +                    pc = (PortletController) Class.forName(name).newInstance();
                       params = new Hashtable();
                   }
               }
               else
               {
  -                pc = (PortletController)Class.forName(entry.getClassname()).newInstance();
  +                pc = (PortletController) Class.forName(entry.getClassname()).newInstance();
                   params = entry.getParameterMap();
               }
           }
           catch (Exception e)
           {
  -            Log.error("Unable to instanciate controller "+name+", using default");
  +            Log.error("Unable to instanciate controller " + name + ", using default");
           }
   
  -        if (   (pc == null)
  -            && (defaultController != null)
  -            && (!defaultController.equals(name)) )
  +        if ((pc == null) && (defaultController != null) && (!defaultController.equals(name)))
           {
  -            return getController( defaultController );
  +            return getController(defaultController);
           }
   
           PortletControllerConfig pcConf = new BasePortletControllerConfig();
  -        pcConf.setName( name );
  +        pcConf.setName(name);
           pcConf.setInitParameters(params);
           pc.setConfig(pcConf);
           pc.init();
  @@ -334,19 +332,19 @@
        * @param controller the PSML controller object
        * @return the created PortletController
        */
  -    public PortletController getController( Controller controller )
  +    public PortletController getController(Controller controller)
       {
   
           PortletController pc = null;
   
  -        if (controller!=null)
  +        if (controller != null)
           {
               pc = getController(controller.getName());
               pc.getConfig().getInitParameters().putAll(getParameters(controller));
           }
           else
           {
  -            if (defaultController!=null)
  +            if (defaultController != null)
               {
                   pc = getController(this.defaultController);
               }
  @@ -363,15 +361,15 @@
        * @param name the registry SkinEntry name
        * @return the new PortletSkin object
        */
  -    public PortletSkin getSkin( String name )
  +    public PortletSkin getSkin(String name)
       {
           BasePortletSkin result = new BasePortletSkin();
   
           SkinEntry entry = null;
   
  -        if (name!=null)
  +        if (name != null)
           {
  -            entry = (SkinEntry)Registry.getEntry(Registry.SKIN, name);
  +            entry = (SkinEntry) Registry.getEntry(Registry.SKIN, name);
           }
   
           // either we don't have any skin defined, the skin reference is null
  @@ -379,16 +377,21 @@
           // skin entry
           if (entry == null)
           {
  -            entry = (SkinEntry)Registry.getEntry(Registry.SKIN, this.defaultSkin);
  +            entry = (SkinEntry) Registry.getEntry(Registry.SKIN, this.defaultSkin);
           }
   
  -        if (entry!=null)
  +        if (entry != null)
           {
               // build the PortletSkin object
               result.setName(entry.getName());
               result.putAll(entry.getParameterMap());
           }
   
  +        // Make the skin aware of what the user agent is capable of.
  +        JetspeedRunDataService jrds =
  +            (JetspeedRunDataService) ServiceUtil.getServiceByName(RunDataService.SERVICE_NAME);
  +        JetspeedRunData jData = jrds.getCurrentRunData();
  +        result.setCapabilityMap(jData.getCapability()); 
           return result;
       }
   
  @@ -398,7 +401,7 @@
        * @param skin the PSML Skin object
        * @return the new PortletSkin object
        */
  -    public PortletSkin getSkin( Skin skin )
  +    public PortletSkin getSkin(Skin skin)
       {
           PortletSkin result = null;
           String name = null;
  @@ -408,7 +411,7 @@
               name = skin.getName();
   
               // create the PortletSkin corresponding to this entry
  -            result = getSkin( name );
  +            result = getSkin(name);
   
               // override the values with the locally defined properties
               result.putAll(getParameters(skin));
  @@ -424,10 +427,10 @@
        * @param portlets the PSML portlet set description
        * @return a new instance of PortletSet
        */
  -    public PortletSet getSet( Portlets portlets )
  +    public PortletSet getSet(Portlets portlets)
       {
           VariableInteger lastID = new VariableInteger(0);
  -        return getSet( portlets, new VariableInteger(0) );
  +        return getSet(portlets, new VariableInteger(0));
       }
   
       /**
  @@ -438,12 +441,12 @@
        * @param count the portletset number within the complete tree
        * @return a new instance of PortletSet
        */
  -    protected PortletSet getSet( Portlets portlets, VariableInteger theCount)
  +    protected PortletSet getSet(Portlets portlets, VariableInteger theCount)
       {
           // Create a new BasePortletSet to handle the portlets
           BasePortletSet set = new BasePortletSet();
  -        PortletController controller = getController( portlets.getController() );
  -        set.setController( controller );
  +        PortletController controller = getController(portlets.getController());
  +        set.setController(controller);
           String name = portlets.getName();
           if (name != null)
           {
  @@ -454,78 +457,84 @@
   
           set.setID(portlets.getId());
   
  -        theCount.setValue(theCount.getValue()+1);
  +        theCount.setValue(theCount.getValue() + 1);
   
           //FIXME: this sucks ! we should either associate the portlet set
           //with its portlets peer or set the porpoerties directly on the portlet
           //set object
           //Unfortunately, this would change the API too drastically for now...
  -        set.setPortletConfig( getPortletConfig( portlets ) );
  +        set.setPortletConfig(getPortletConfig(portlets));
   
           // Add all sub portlet sets in the main set
  -//        Portlets[] subsets = portlets.getPortlets();
  -//        for (int i=0; i < subsets.length; i++ )
  +        //        Portlets[] subsets = portlets.getPortlets();
  +        //        for (int i=0; i < subsets.length; i++ )
   
  -        for (Iterator it = portlets.getPortletsIterator(); it.hasNext(); )
  +        for (Iterator it = portlets.getPortletsIterator(); it.hasNext();)
           {
  -            Portlets subset = (Portlets)it.next();
  +            Portlets subset = (Portlets) it.next();
               // Set this subset's parent Portlets collection.          
               subset.setParentPortlets(portlets);
   
               Map constraints = getParameters(subset.getLayout());
  -            int position = getPosition( subset.getLayout() );
  -            set.addPortlet( getSet( subset, theCount ),
  -                            controller.getConstraints(constraints),
  -                            position );
  +            int position = getPosition(subset.getLayout());
  +            set.addPortlet(
  +                getSet(subset, theCount),
  +                controller.getConstraints(constraints),
  +                position);
           }
   
           // Populate the PortletSet with Portlets
  -//        Entry[] entries = portlets.getEntry();
  -//        for( int i = 0; i < entries.length; ++i )
  +        //        Entry[] entries = portlets.getEntry();
  +        //        for( int i = 0; i < entries.length; ++i )
   
  -        for (Iterator eit = portlets.getEntriesIterator(); eit.hasNext(); )
  +        for (Iterator eit = portlets.getEntriesIterator(); eit.hasNext();)
           {
               try
               {
   
  -                Entry psmlEntry = (Entry)eit.next();
  -                PortletEntry entry = (PortletEntry)Registry.getEntry( Registry.PORTLET,
psmlEntry.getParent() );
  +                Entry psmlEntry = (Entry) eit.next();
  +                PortletEntry entry =
  +                    (PortletEntry) Registry.getEntry(Registry.PORTLET, psmlEntry.getParent());
   
  -                if ( entry != null )
  +                if (entry != null)
                   {
  -                    Portlet p = PortletFactory.getPortlet( psmlEntry );
  +                    Portlet p = PortletFactory.getPortlet(psmlEntry);
   
                       if (p != null)
                       {
                           Map constraints = getParameters(psmlEntry.getLayout());
  -                        int position = getPosition( psmlEntry.getLayout() );
  +                        int position = getPosition(psmlEntry.getLayout());
   
  -                        PortletControl control =  getControl(psmlEntry.getControl(), entry);
  +                        PortletControl control = getControl(psmlEntry.getControl(), entry);
   
  -                        set.addPortlet( initControl(control,p),
  -                                        controller.getConstraints( constraints ),
  -                                        position );
  +                        set.addPortlet(
  +                            initControl(control, p),
  +                            controller.getConstraints(constraints),
  +                            position);
                       }
                   }
                   else
                   {
  -                    Log.error(" The portlet "+psmlEntry.getParent()+" does not exist in
the Registry ");
  +                    Log.error(
  +                        " The portlet "
  +                            + psmlEntry.getParent()
  +                            + " does not exist in the Registry ");
                       continue;
                   }
               }
  -            catch ( JetspeedException e )
  +            catch (JetspeedException e)
               {
  -                Log.error( e );
  +                Log.error(e);
                   continue;
               }
   
           }
   
           // Decorate with a control if required and return
  -        if ( portlets.getControl() != null )
  +        if (portlets.getControl() != null)
           {
               PortletControl control = getControl(portlets.getControl());
  -            return initControl(control,set);
  +            return initControl(control, set);
           }
   
           set.sortPortletSet();
  @@ -541,20 +550,20 @@
        * @param portlet the existing Portlet to be associated with the control
        * @return first PortletControl associated with the portlet
        */
  -    protected PortletControl initControl( PortletControl pc, Portlet portlet )
  +    protected PortletControl initControl(PortletControl pc, Portlet portlet)
       {
   
           if (portlet == null)
           {
  -            throw new IllegalArgumentException( "Portlet not specified" );
  +            throw new IllegalArgumentException("Portlet not specified");
           }
   
  -        if ( pc == null )
  +        if (pc == null)
           {
  -            throw new IllegalArgumentException( "PortletControl not specified" );
  +            throw new IllegalArgumentException("PortletControl not specified");
           }
   
  -        pc.init( portlet );
  +        pc.init(portlet);
   
           return pc;
   
  @@ -562,23 +571,23 @@
   
       /**
       Given a PSML Portlets, get the value of what its PortletConfig would be.
  -
  +    
       @param entry the Portlets containing the config
       @return the newly created PortletConfig object
       */
  -    protected PortletConfig getPortletConfig( Portlets portlets )
  +    protected PortletConfig getPortletConfig(Portlets portlets)
       {
   
           PortletConfig pc = new BasePortletConfig();
   
  -        pc.setName( portlets.getName() );
  -        pc.setInitParameters( getParameters( portlets ) );
  +        pc.setName(portlets.getName());
  +        pc.setInitParameters(getParameters(portlets));
   
           //Invocation of new skin-locating algorithim
  -        pc.setPortletSkin( getSkin( findSkin(portlets) ) );
  +        pc.setPortletSkin(getSkin(findSkin(portlets)));
   
  -        pc.setSecurityRef( portlets.getSecurityRef() );
  -        pc.setMetainfo( getMetaData( portlets ) );
  +        pc.setSecurityRef(portlets.getSecurityRef());
  +        pc.setMetainfo(getMetaData(portlets));
   
           return pc;
       }
  @@ -590,7 +599,7 @@
        * @return a Map containing the parameters names/values, an empty Dictionary
        *        is returned if there are no parameters
        */
  -    protected static Map getParameters( Portlets portlets )
  +    protected static Map getParameters(Portlets portlets)
       {
           Hashtable hash = new Hashtable();
   
  @@ -598,9 +607,9 @@
           {
               Parameter[] props = portlets.getParameter();
   
  -            for(int i = 0; i < props.length; ++i)
  +            for (int i = 0; i < props.length; ++i)
               {
  -                hash.put(props[i].getName(), props[i].getValue() );
  +                hash.put(props[i].getName(), props[i].getValue());
               }
           }
   
  @@ -617,13 +626,13 @@
       {
           Hashtable hash = new Hashtable();
   
  -        if (control!=null)
  +        if (control != null)
           {
               Parameter[] params = control.getParameter();
   
  -            for (int i=0; i < params.length; i++ )
  +            for (int i = 0; i < params.length; i++)
               {
  -                hash.put(params[i].getName(),params[i].getValue());
  +                hash.put(params[i].getName(), params[i].getValue());
               }
           }
           return hash;
  @@ -639,13 +648,13 @@
       {
           Hashtable hash = new Hashtable();
   
  -        if (controller!=null)
  +        if (controller != null)
           {
               Parameter[] params = controller.getParameter();
   
  -            for (int i=0; i < params.length; i++ )
  +            for (int i = 0; i < params.length; i++)
               {
  -                hash.put(params[i].getName(),params[i].getValue());
  +                hash.put(params[i].getName(), params[i].getValue());
               }
           }
           return hash;
  @@ -662,13 +671,13 @@
       {
           Hashtable hash = new Hashtable();
   
  -        if (layout!=null)
  +        if (layout != null)
           {
               Parameter[] props = layout.getParameter();
   
  -            for(int i = 0; i < props.length; ++i)
  +            for (int i = 0; i < props.length; ++i)
               {
  -                hash.put(props[i].getName(), props[i].getValue() );
  +                hash.put(props[i].getName(), props[i].getValue());
               }
           }
   
  @@ -686,13 +695,13 @@
       {
           Hashtable hash = new Hashtable();
   
  -        if (skin!=null)
  +        if (skin != null)
           {
               Parameter[] props = skin.getParameter();
   
  -            for(int i = 0; i < props.length; ++i)
  +            for (int i = 0; i < props.length; ++i)
               {
  -                hash.put(props[i].getName(), props[i].getValue() );
  +                hash.put(props[i].getName(), props[i].getValue());
               }
           }
   
  @@ -701,9 +710,9 @@
   
       /**
       Create a MetaData object from a PSML Metainfo object
  -
  +    
       @param meta the Metainfo to copy
  -
  +    
       @return the new MetaData object, empty if meta is null
       */
       protected static MetaData getMetaData(Portlets portlets)
  @@ -711,21 +720,21 @@
           MetaData data = new MetaData();
           MetaInfo meta = portlets.getMetaInfo();
   
  -        if ( meta != null )
  +        if (meta != null)
           {
  -            if ( meta.getTitle() != null )
  +            if (meta.getTitle() != null)
               {
  -                data.setTitle( meta.getTitle() );
  +                data.setTitle(meta.getTitle());
               }
   
  -            if ( meta.getDescription() != null )
  +            if (meta.getDescription() != null)
               {
  -                data.setDescription( meta.getDescription() );
  +                data.setDescription(meta.getDescription());
               }
   
  -            if ( meta.getImage() != null )
  +            if (meta.getImage() != null)
               {
  -                data.setImage( meta.getImage() );
  +                data.setImage(meta.getImage());
               }
           }
   
  @@ -742,11 +751,14 @@
        */
       protected static int getPosition(Layout layout)
       {
  -        int pos=-1;
  +        int pos = -1;
   
  -        try {
  -            pos=(int)layout.getPosition();
  -        } catch (RuntimeException e) {
  +        try
  +        {
  +            pos = (int) layout.getPosition();
  +        }
  +        catch (RuntimeException e)
  +        {
               // either layout is null or the position isn't an integer
               // keep the default value
           }
  @@ -770,7 +782,7 @@
   
           public void setValue(int value)
           {
  -            this.value=value;
  +            this.value = value;
           }
       }
   
  @@ -799,12 +811,11 @@
           }
           catch (Exception e)
           {
  -            Log.error( e );
  +            Log.error(e);
               return null;
           }
       }
   
  -    
       /**
        * Helps locate a skin, recursively if neccesary.
        * <ul>
  @@ -818,11 +829,11 @@
        */
       protected String findSkin(Portlets portlets)
       {
  -        if(portlets.getSkin() != null)
  +        if (portlets.getSkin() != null)
           {
               return portlets.getSkin().getName();
           }
  -        else if(portlets.getParentPortlets() != null)
  +        else if (portlets.getParentPortlets() != null)
           {
               return findSkin(portlets.getParentPortlets());
           }
  @@ -831,7 +842,7 @@
               return this.defaultSkin;
           }
       }
  -     
  +
       /**
        * Gets default security ref based on the profile type (user|role|group). Returns
        * null if no default is defined.
  @@ -900,7 +911,8 @@
           entry = (SecurityEntry) Registry.getEntry(Registry.SECURITY, defaultRef);
           if (Log.getLogger().isDebugEnabled())
           {
  -            Log.debug("JetspeedPortalToolkit: default security for type: " + type + " is
" + defaultRef);
  +            Log.debug(
  +                "JetspeedPortalToolkit: default security for type: " + type + " is " +
defaultRef);
           }
           if (entry != null)
           {
  @@ -908,7 +920,11 @@
               result.setParent(entry.getName());
               if (Log.getLogger().isDebugEnabled())
               {
  -                Log.debug("JetspeedPortalToolkit: default security for type: " + type +
" was set to " + entry.getName());
  +                Log.debug(
  +                    "JetspeedPortalToolkit: default security for type: "
  +                        + type
  +                        + " was set to "
  +                        + entry.getName());
               }
           }
   
  @@ -916,4 +932,3 @@
   
       }
   }
  -
  
  
  

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


Mime
View raw message