Author: ehillenius
Date: Thu Feb 22 10:32:23 2007
New Revision: 510617

URL: http://svn.apache.org/viewvc?view=rev&rev=510617
Log:
added component argument to IBehavior#isEnabled

Modified:
    
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/AttributeModifier.java
    
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Component.java
    
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/AbstractBehavior.java
    
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/IBehavior.java
    
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/SimpleAttributeModifier.java

Modified: 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/AttributeModifier.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/AttributeModifier.java?view=diff&rev=510617&r1=510616&r2=510617
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/AttributeModifier.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/AttributeModifier.java
 Thu Feb 22 10:32:23 2007
@@ -194,7 +194,7 @@
         * 
         * @return Whether enabled or not
         */
-       public boolean isEnabled()
+       public boolean isEnabled(Component component)
        {
                return enabled;
        }
@@ -223,7 +223,7 @@
         */
        public final void replaceAttibuteValue(final Component component, final 
ComponentTag tag)
        {
-               if (isEnabled())
+               if (isEnabled(component))
                {
                        final ValueMap attributes = tag.getAttributes();
                        final Object replacementValue = 
getReplacementOrNull(component);
@@ -278,8 +278,8 @@
         */
        public String toString()
        {
-               return "[AttributeModifier attribute=" + attribute + ", 
enabled=" + isEnabled()
-                               + ", pattern=" + pattern + ", 
replacementModel=" + replaceModel + "]";
+               return "[AttributeModifier attribute=" + attribute + ", 
enabled=" + enabled + ", pattern="
+                               + pattern + ", replacementModel=" + 
replaceModel + "]";
        }
 
        /**

Modified: 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Component.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Component.java?view=diff&rev=510617&r1=510616&r2=510617
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Component.java 
(original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Component.java 
Thu Feb 22 10:32:23 2007
@@ -2594,7 +2594,7 @@
                        return false;
                }
 
-               return behavior.isEnabled();
+               return behavior.isEnabled(this);
        }
 
        /**

Modified: 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/AbstractBehavior.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/AbstractBehavior.java?view=diff&rev=510617&r1=510616&r2=510617
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/AbstractBehavior.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/AbstractBehavior.java
 Thu Feb 22 10:32:23 2007
@@ -150,9 +150,9 @@
        }
        
        /**
-        * @see wicket.behavior.IBehavior#isEnabled()
+        * @see wicket.behavior.IBehavior#isEnabled(Component)
         */
-       public boolean isEnabled()
+       public boolean isEnabled(Component component)
        {
                return true;
        }

Modified: 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/IBehavior.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/IBehavior.java?view=diff&rev=510617&r1=510616&r2=510617
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/IBehavior.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/IBehavior.java
 Thu Feb 22 10:32:23 2007
@@ -103,6 +103,17 @@
        boolean getStatelessHint();
 
        /**
+        * Called when a components is rendering and wants to render this 
behavior.
+        * If false is returned this behavior will be ignored.
+        * 
+        * @param component
+        *            the component that has this behavior coupled
+        * 
+        * @return true if this behaviour must be executed/rendered
+        */
+       boolean isEnabled(Component component);
+
+       /**
         * Called any time a component that has this behavior registered is
         * rendering the component tag.
         * 
@@ -120,12 +131,4 @@
         *            the component that has this behavior coupled
         */
        void rendered(Component component);
-       
-       /**
-        * Called when a components is rendering and wants to render this
-        * behavior. If false is returned this behavior will be ignored.
-        * 
-        * @return true if this behaviour must be executed/rendered
-        */
-       boolean isEnabled();
 }

Modified: 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/SimpleAttributeModifier.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/SimpleAttributeModifier.java?view=diff&rev=510617&r1=510616&r2=510617
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/SimpleAttributeModifier.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/behavior/SimpleAttributeModifier.java
 Thu Feb 22 10:32:23 2007
@@ -64,7 +64,7 @@
         */
        public void onComponentTag(final Component component, final 
ComponentTag tag)
        {
-               if (isEnabled())
+               if (isEnabled(component))
                {
                        tag.getAttributes().put(attribute, value);
                }


Reply via email to