Repository: wicket
Updated Branches:
  refs/heads/master 9a79f67ea -> 5a3fd0d2a


[WICKET-4904] Refactoring for behavior DisabledAttributeLinkBehavior

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/5a3fd0d2
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/5a3fd0d2
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/5a3fd0d2

Branch: refs/heads/master
Commit: 5a3fd0d2a3e501e3f7363293eb938ce04d7c25fc
Parents: 9a79f67
Author: bitstorm <[email protected]>
Authored: Mon May 19 17:01:14 2014 +0200
Committer: bitstorm <[email protected]>
Committed: Mon May 19 17:02:20 2014 +0200

----------------------------------------------------------------------
 .../link/DisabledAttributeLinkBehavior.java     | 49 ++++++++++++++++++++
 .../markup/html/link/DisabledLinkBehavior.java  |  2 +-
 .../paging/DisabledLinkPagingBehavior.java      | 45 ------------------
 .../paging/PagingNavigationIncrementLink.java   |  3 +-
 .../navigation/paging/PagingNavigationLink.java |  3 +-
 5 files changed, 54 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/5a3fd0d2/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DisabledAttributeLinkBehavior.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DisabledAttributeLinkBehavior.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DisabledAttributeLinkBehavior.java
new file mode 100644
index 0000000..c8ed992
--- /dev/null
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DisabledAttributeLinkBehavior.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.wicket.markup.html.link;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.behavior.Behavior;
+import org.apache.wicket.markup.ComponentTag;
+
+/**
+ * 
+ * A behavior to add attribute "disabled" to a Link component when it is 
disabled.
+ *
+ */
+public class DisabledAttributeLinkBehavior extends Behavior
+{
+
+    private static final long serialVersionUID = 1L;
+
+       @Override
+       public void onComponentTag(Component component, ComponentTag tag)
+       {
+               if (!component.isEnabledInHierarchy())
+               {
+                       // if the tag is an anchor proper
+                       String tagName = tag.getName();
+                       
+                       if (tagName.equalsIgnoreCase("a") || 
tagName.equalsIgnoreCase("link") ||
+                               tagName.equalsIgnoreCase("area"))
+                       {
+                           tag.put("disabled", "disabled");
+                       }
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/5a3fd0d2/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DisabledLinkBehavior.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DisabledLinkBehavior.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DisabledLinkBehavior.java
index 66dffd9..a198b87 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DisabledLinkBehavior.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DisabledLinkBehavior.java
@@ -22,7 +22,7 @@ import org.apache.wicket.behavior.Behavior;
 import org.apache.wicket.markup.ComponentTag;
 
 /**
- * A behavior to change the representation fo disabled links.
+ * A behavior to change the representation for disabled links.
  * <p>
  * Markup tags {@code <a>}, {@code <link>} and {@code <area>} are replaced 
with a {@code <span>}.
  */

http://git-wip-us.apache.org/repos/asf/wicket/blob/5a3fd0d2/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/DisabledLinkPagingBehavior.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/DisabledLinkPagingBehavior.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/DisabledLinkPagingBehavior.java
deleted file mode 100644
index 4066608..0000000
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/DisabledLinkPagingBehavior.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.wicket.markup.html.navigation.paging;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.markup.ComponentTag;
-
-public class DisabledLinkPagingBehavior extends Behavior
-{
-
-       /**
-     * 
-     */
-    private static final long serialVersionUID = 1L;
-
-       @Override
-       public void onComponentTag(Component component, ComponentTag tag)
-       {
-               if (!component.isEnabledInHierarchy())
-               {
-                       // if the tag is an anchor proper
-                       if (tag.getName().equalsIgnoreCase("a") || 
tag.getName().equalsIgnoreCase("link") ||
-                               tag.getName().equalsIgnoreCase("area"))
-                       {
-                           tag.put("disabled", "disabled");
-                       }
-               }
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/5a3fd0d2/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationIncrementLink.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationIncrementLink.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationIncrementLink.java
index 77ed511..39a4f63 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationIncrementLink.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationIncrementLink.java
@@ -17,6 +17,7 @@
 package org.apache.wicket.markup.html.navigation.paging;
 
 import org.apache.wicket.Page;
+import org.apache.wicket.markup.html.link.DisabledAttributeLinkBehavior;
 import org.apache.wicket.markup.html.link.Link;
 
 /**
@@ -66,7 +67,7 @@ public class PagingNavigationIncrementLink<T> extends Link<T>
                this.increment = increment;
                this.pageable = pageable;
                
-               add(new DisabledLinkPagingBehavior());
+               add(new DisabledAttributeLinkBehavior());
        }
 
        /**

http://git-wip-us.apache.org/repos/asf/wicket/blob/5a3fd0d2/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationLink.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationLink.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationLink.java
index 2ffbd5c..461a9e0 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationLink.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigationLink.java
@@ -17,6 +17,7 @@
 package org.apache.wicket.markup.html.navigation.paging;
 
 import org.apache.wicket.Page;
+import org.apache.wicket.markup.html.link.DisabledAttributeLinkBehavior;
 import org.apache.wicket.markup.html.link.Link;
 
 /**
@@ -56,7 +57,7 @@ public class PagingNavigationLink<T> extends Link<T>
                this.pageNumber = pageNumber;
                this.pageable = pageable;
                
-               add(new DisabledLinkPagingBehavior());
+               add(new DisabledAttributeLinkBehavior());
        }
 
        /**

Reply via email to