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 sm...@apache.org on 2006/11/09 10:22:50 UTC

svn commit: r472826 - in /portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration: AbstractDecoratorActionsFactory.java BaseDecoration.java DecoratorAction.java DecoratorActionTemplate.java

Author: smilek
Date: Thu Nov  9 01:22:49 2006
New Revision: 472826

URL: http://svn.apache.org/viewvc?view=rev&rev=472826
Log:
added getActionType to DecoratorAction and DecoratorActionTemplate (values are state, mode and both); added getCurrentModeAction and getCurrentStateAction to BaseDecoration; added getActionName to DecoratorAction to provide access to non-localized action name

Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/BaseDecoration.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java?view=diff&rev=472826&r1=472825&r2=472826
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java Thu Nov  9 01:22:49 2006
@@ -50,7 +50,7 @@
         boolean customAction = (template.getMode() != null && !template.getMode().equals(template.getCustomMode()))
                         || (template.getState() != null && !template.getState().equals(template.getCustomState()));
 
-        return new DecoratorAction(actionName, rc.getLocale(), linkURL, actionURL, customAction);
+        return new DecoratorAction( actionName, rc.getLocale(), linkURL, actionURL, customAction, template.getActionType() );
     }
         
 }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/BaseDecoration.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/BaseDecoration.java?view=diff&rev=472826&r1=472825&r2=472826
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/BaseDecoration.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/BaseDecoration.java Thu Nov  9 01:22:49 2006
@@ -43,6 +43,8 @@
     private final PathResolverCache cache;
     private final String styleSheet;
     private List actions;
+    private String currentModeAction;
+    private String currentStateAction;
     
     /**
      * 
@@ -152,6 +154,25 @@
     public String getBaseCSSClass()
     {
         return config.getProperty(Decoration.BASE_CSS_CLASS_PROP, getName());
+    }
+
+
+    public String getCurrentModeAction()
+    {
+        return this.currentModeAction;
+    }
+    public void setCurrentModeAction( String currentModeAction )
+    {
+        this.currentModeAction = currentModeAction;
+    }
+
+    public String getCurrentStateAction()
+    {
+        return this.currentStateAction;
+    }
+    public void setCurrentStateAction( String currentStateAction )
+    {
+        this.currentStateAction = currentStateAction;
     }
     
 }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java?view=diff&rev=472826&r1=472825&r2=472826
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java Thu Nov  9 01:22:49 2006
@@ -28,6 +28,8 @@
  */
 public class DecoratorAction implements Serializable
 {
+    String actionName = null;
+    String actionType = null;
     String name = null;
     String link = null;
     String alt = null;
@@ -70,9 +72,11 @@
         return value;
     }
 
-    public DecoratorAction(String name, String alt, Locale locale, String link, String action, boolean custom)
+    public DecoratorAction(String name, String alt, Locale locale, String link, String action, boolean custom, String actionType)
     {
         ResourceBundle bundle = getBundle("org.apache.jetspeed.decoration.resources.DecoratorActions", locale);
+        this.actionName = name;
+        this.actionType = actionType;
         this.name = getResourceString(bundle,name,name);
         this.alt = getResourceString(bundle,alt,alt);
         this.link = link;
@@ -80,19 +84,37 @@
         this.custom = custom;
     }
     
-    public DecoratorAction(String name, Locale locale, String link, String action, boolean custom)
+    public DecoratorAction(String name, Locale locale, String link, String action, boolean custom, String actionType)
     {
-        this(name,name,locale,link,action,custom);
+        this(name,name,locale,link,action,custom,actionType);
     }
     
-    public DecoratorAction(String name, Locale locale, String link, String action)
+    public DecoratorAction(String name, Locale locale, String link, String action, String actionType)
     {
-        this(name,name,locale,link,action,false);
+        this(name,name,locale,link,action,false,actionType);
     }
     
-    public DecoratorAction(String name, String alt, String link)
+    public DecoratorAction(String name, String alt, String link, String actionType)
     {
-        this(name,alt,null,link,null,false);
+        this(name,alt,null,link,null,false,actionType);
+    }
+
+    public String getActionName()
+    {
+        return this.actionName;
+    }
+    public void setActionName( String actionName )
+    {
+        this.actionName = actionName;
+    }
+
+    public String getActionType()
+    {
+        return this.actionType;
+    }
+    public void setActionType( String actionType )
+    {
+        this.actionType = actionType;
     }
     
     public String getName()

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java?view=diff&rev=472826&r1=472825&r2=472826
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java Thu Nov  9 01:22:49 2006
@@ -5,12 +5,18 @@
 
 public class DecoratorActionTemplate
 {
+    protected static final String ACTION_TYPE_MODE = "mode";
+    protected static final String ACTION_TYPE_STATE = "state";
+    protected static final String ACTION_TYPE_BOTH = "both";
+
     private String action;
     private PortletMode mode;
     private PortletMode customMode;
     private WindowState state;
     private WindowState customState;
 
+    private String actionType;
+
     public DecoratorActionTemplate(String action, PortletMode mode, PortletMode customMode, WindowState state, WindowState customState)
     {
         this.action = action;
@@ -18,6 +24,14 @@
         this.customMode = customMode;
         this.state = state;
         this.customState = customState;
+        if ( mode != null )
+        {
+            this.actionType = ( state != null ) ? ACTION_TYPE_BOTH : ACTION_TYPE_MODE;
+        }
+        else if ( state != null )
+        {
+            this.actionType = ACTION_TYPE_STATE;
+        }
     }
 
     public DecoratorActionTemplate(String action, PortletMode mode, WindowState state)
@@ -50,6 +64,11 @@
         return action;
     }
 
+    public String getActionType()
+    {
+        return actionType;
+    }
+
     public PortletMode getCustomMode()
     {
         return customMode;
@@ -87,6 +106,11 @@
     public void setAction(String action)
     {
         this.action = action;
+    }
+
+    public void setActionType( String actionType )
+    {
+        this.actionType = actionType;
     }
 
     public void setCustomMode(PortletMode customMode)



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


Re: svn commit: r472826 - in /portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration: AbstractDecoratorActionsFactory.java BaseDecoration.java DecoratorAction.java DecoratorActionTemplate.java

Posted by Philip Mark Donaghy <ph...@gmail.com>.
I'm testing and it seems this commit breaks the build, there is a
missing method in the jetspeed-api for Decoration.java

public void setCurrentModeAction( String currentModeAction );

Phil

On 11/9/06, smilek@apache.org <sm...@apache.org> wrote:
> Author: smilek
> Date: Thu Nov  9 01:22:49 2006
> New Revision: 472826
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=472826
> Log:
> added getActionType to DecoratorAction and DecoratorActionTemplate (values are state, mode and both); added getCurrentModeAction and getCurrentStateAction to BaseDecoration; added getActionName to DecoratorAction to provide access to non-localized action name
>
> Modified:
>     portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java
>     portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/BaseDecoration.java
>     portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java
>     portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java
>
> Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java
> URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java?view=diff&rev=472826&r1=472825&r2=472826
> ==============================================================================
> --- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java (original)
> +++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java Thu Nov  9 01:22:49 2006
> @@ -50,7 +50,7 @@
>          boolean customAction = (template.getMode() != null && !template.getMode().equals(template.getCustomMode()))
>                          || (template.getState() != null && !template.getState().equals(template.getCustomState()));
>
> -        return new DecoratorAction(actionName, rc.getLocale(), linkURL, actionURL, customAction);
> +        return new DecoratorAction( actionName, rc.getLocale(), linkURL, actionURL, customAction, template.getActionType() );
>      }
>
>  }
>
> Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/BaseDecoration.java
> URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/BaseDecoration.java?view=diff&rev=472826&r1=472825&r2=472826
> ==============================================================================
> --- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/BaseDecoration.java (original)
> +++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/BaseDecoration.java Thu Nov  9 01:22:49 2006
> @@ -43,6 +43,8 @@
>      private final PathResolverCache cache;
>      private final String styleSheet;
>      private List actions;
> +    private String currentModeAction;
> +    private String currentStateAction;
>
>      /**
>       *
> @@ -152,6 +154,25 @@
>      public String getBaseCSSClass()
>      {
>          return config.getProperty(Decoration.BASE_CSS_CLASS_PROP, getName());
> +    }
> +
> +
> +    public String getCurrentModeAction()
> +    {
> +        return this.currentModeAction;
> +    }
> +    public void setCurrentModeAction( String currentModeAction )
> +    {
> +        this.currentModeAction = currentModeAction;
> +    }
> +
> +    public String getCurrentStateAction()
> +    {
> +        return this.currentStateAction;
> +    }
> +    public void setCurrentStateAction( String currentStateAction )
> +    {
> +        this.currentStateAction = currentStateAction;
>      }
>
>  }
>
> Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java
> URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java?view=diff&rev=472826&r1=472825&r2=472826
> ==============================================================================
> --- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java (original)
> +++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java Thu Nov  9 01:22:49 2006
> @@ -28,6 +28,8 @@
>   */
>  public class DecoratorAction implements Serializable
>  {
> +    String actionName = null;
> +    String actionType = null;
>      String name = null;
>      String link = null;
>      String alt = null;
> @@ -70,9 +72,11 @@
>          return value;
>      }
>
> -    public DecoratorAction(String name, String alt, Locale locale, String link, String action, boolean custom)
> +    public DecoratorAction(String name, String alt, Locale locale, String link, String action, boolean custom, String actionType)
>      {
>          ResourceBundle bundle = getBundle("org.apache.jetspeed.decoration.resources.DecoratorActions", locale);
> +        this.actionName = name;
> +        this.actionType = actionType;
>          this.name = getResourceString(bundle,name,name);
>          this.alt = getResourceString(bundle,alt,alt);
>          this.link = link;
> @@ -80,19 +84,37 @@
>          this.custom = custom;
>      }
>
> -    public DecoratorAction(String name, Locale locale, String link, String action, boolean custom)
> +    public DecoratorAction(String name, Locale locale, String link, String action, boolean custom, String actionType)
>      {
> -        this(name,name,locale,link,action,custom);
> +        this(name,name,locale,link,action,custom,actionType);
>      }
>
> -    public DecoratorAction(String name, Locale locale, String link, String action)
> +    public DecoratorAction(String name, Locale locale, String link, String action, String actionType)
>      {
> -        this(name,name,locale,link,action,false);
> +        this(name,name,locale,link,action,false,actionType);
>      }
>
> -    public DecoratorAction(String name, String alt, String link)
> +    public DecoratorAction(String name, String alt, String link, String actionType)
>      {
> -        this(name,alt,null,link,null,false);
> +        this(name,alt,null,link,null,false,actionType);
> +    }
> +
> +    public String getActionName()
> +    {
> +        return this.actionName;
> +    }
> +    public void setActionName( String actionName )
> +    {
> +        this.actionName = actionName;
> +    }
> +
> +    public String getActionType()
> +    {
> +        return this.actionType;
> +    }
> +    public void setActionType( String actionType )
> +    {
> +        this.actionType = actionType;
>      }
>
>      public String getName()
>
> Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java
> URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java?view=diff&rev=472826&r1=472825&r2=472826
> ==============================================================================
> --- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java (original)
> +++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java Thu Nov  9 01:22:49 2006
> @@ -5,12 +5,18 @@
>
>  public class DecoratorActionTemplate
>  {
> +    protected static final String ACTION_TYPE_MODE = "mode";
> +    protected static final String ACTION_TYPE_STATE = "state";
> +    protected static final String ACTION_TYPE_BOTH = "both";
> +
>      private String action;
>      private PortletMode mode;
>      private PortletMode customMode;
>      private WindowState state;
>      private WindowState customState;
>
> +    private String actionType;
> +
>      public DecoratorActionTemplate(String action, PortletMode mode, PortletMode customMode, WindowState state, WindowState customState)
>      {
>          this.action = action;
> @@ -18,6 +24,14 @@
>          this.customMode = customMode;
>          this.state = state;
>          this.customState = customState;
> +        if ( mode != null )
> +        {
> +            this.actionType = ( state != null ) ? ACTION_TYPE_BOTH : ACTION_TYPE_MODE;
> +        }
> +        else if ( state != null )
> +        {
> +            this.actionType = ACTION_TYPE_STATE;
> +        }
>      }
>
>      public DecoratorActionTemplate(String action, PortletMode mode, WindowState state)
> @@ -50,6 +64,11 @@
>          return action;
>      }
>
> +    public String getActionType()
> +    {
> +        return actionType;
> +    }
> +
>      public PortletMode getCustomMode()
>      {
>          return customMode;
> @@ -87,6 +106,11 @@
>      public void setAction(String action)
>      {
>          this.action = action;
> +    }
> +
> +    public void setActionType( String actionType )
> +    {
> +        this.actionType = actionType;
>      }
>
>      public void setCustomMode(PortletMode customMode)
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>
>


-- 
Philip Donaghy
donaghy.blogspot.com del.icio.us/donaghy/philip
Skype: philipmarkdonaghy
Office: +33 5 56 60 88 02
Mobile: +33 6 20 83 22 62

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