WICKET-6004 Wicket 8 cleanup - removed deprecated behavior to tweak disabled 
links


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

Branch: refs/heads/lambdas
Commit: 937f2d73a442d09cfa71060c3a8946c746cded54
Parents: 8c3f916
Author: Sven Meier <[email protected]>
Authored: Mon Oct 19 13:28:58 2015 +0200
Committer: Sven Meier <[email protected]>
Committed: Mon Oct 19 14:45:11 2015 +0200

----------------------------------------------------------------------
 .../markup/html/link/DisabledLinkBehavior.java  | 180 -------------------
 .../navomatic/NavomaticApplication.java         |   9 -
 2 files changed, 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/937f2d73/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
deleted file mode 100644
index 7bb2a3a..0000000
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DisabledLinkBehavior.java
+++ /dev/null
@@ -1,180 +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.link;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.application.IComponentInstantiationListener;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.markup.ComponentTag;
-
-/**
- * A behavior to change the representation of <em>disabled</em> links to that 
of Wicket 6.x:
- * <p>
- * Markup tags {@code <a>}, {@code <link>} and {@code <area>} are replaced 
with a {@code <span>}. By
- * default tags are enclosed in an {@code <em>} tag.
- * 
- * @deprecated altering the markup tag of disabled links is no longer 
recommended, thus clients
- *             should move to other solutions
- */
-@Deprecated
-public final class DisabledLinkBehavior extends Behavior
-{
-       private static final long serialVersionUID = 1L;
-
-       /**
-        * Simple insertion string to allow disabled links to look like 
<i>Disabled link </i>.
-        */
-       private String beforeDisabledLink;
-
-       /**
-        * Simple insertion string to allow disabled links to look like 
<i>Disabled link </i>.
-        */
-       private String afterDisabledLink;
-
-       /**
-        * Enclose each disabled link in {@code <em>}.
-        */
-       public DisabledLinkBehavior()
-       {
-               this("<em>", "</em>");
-       }
-
-       /**
-        * Enclose each disabled link in the given markup.
-        * 
-        * @param beforeDisabledLink
-        *            markup to write before the link
-        * @param afterDisabledLink
-        *            markup to write after the link
-        */
-       public DisabledLinkBehavior(String beforeDisabledLink, String 
afterDisabledLink)
-       {
-               this.beforeDisabledLink = beforeDisabledLink;
-               this.afterDisabledLink = afterDisabledLink;
-       }
-
-       /**
-        * Sets the insertion string to allow disabled links to look like 
<i>Disabled link </i>.
-        * 
-        * @param afterDisabledLink
-        *            The insertion string
-        * @return this
-        */
-       public DisabledLinkBehavior setAfterDisabledLink(final String 
afterDisabledLink)
-       {
-               if (afterDisabledLink == null)
-               {
-                       throw new IllegalArgumentException(
-                               "Value cannot be null.  For no text, specify an 
empty String instead.");
-               }
-               this.afterDisabledLink = afterDisabledLink;
-               return this;
-       }
-
-       /**
-        * Gets the insertion string to allow disabled links to look like 
<i>Disabled link </i>.
-        * 
-        * @return The insertion string
-        */
-       public String getAfterDisabledLink()
-       {
-               return afterDisabledLink;
-       }
-
-       /**
-        * Sets the insertion string to allow disabled links to look like 
<i>Disabled link </i>.
-        * 
-        * @param beforeDisabledLink
-        *            The insertion string
-        * @return this
-        */
-       public DisabledLinkBehavior setBeforeDisabledLink(final String 
beforeDisabledLink)
-       {
-               if (beforeDisabledLink == null)
-               {
-                       throw new IllegalArgumentException(
-                               "Value cannot be null.  For no text, specify an 
empty String instead.");
-               }
-               this.beforeDisabledLink = beforeDisabledLink;
-               return this;
-       }
-
-       /**
-        * Gets the insertion string to allow disabled links to look like 
<i>Disabled link </i>.
-        * 
-        * @return The insertion string
-        */
-       public String getBeforeDisabledLink()
-       {
-               return beforeDisabledLink;
-       }
-
-       @Override
-       public void beforeRender(Component component)
-       {
-               // Draw anything before the body?
-               if (!component.isEnabledInHierarchy() && 
getBeforeDisabledLink() != null)
-               {
-                       component.getResponse().write(getBeforeDisabledLink());
-               }
-       }
-
-       @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"))
-                       {
-                               // Change anchor link to span tag
-                               tag.setName("span");
-                       }
-               }
-       }
-
-       @Override
-       public void afterRender(Component component)
-       {
-               // Draw anything after the body?
-               if (!component.isEnabledInHierarchy() && getAfterDisabledLink() 
!= null)
-               {
-                       component.getResponse().write(getAfterDisabledLink());
-               }
-       }
-
-       /**
-        * A listener for instantiations of {@link AbstractLink} to restore the 
disabled representation
-        * to that of Wicket 6.x.
-        */
-       @Deprecated
-       public static class LinkInstantiationListener implements 
IComponentInstantiationListener
-       {
-               /**
-                * Adds an {@link DisabledLinkBehavior} to all {@link 
AbstractLink}s.
-                */
-               @Override
-               public void onInstantiation(Component component)
-               {
-                       if (component instanceof AbstractLink)
-                       {
-                               component.add(new DisabledLinkBehavior());
-                       }
-               }
-       }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/937f2d73/wicket-examples/src/main/java/org/apache/wicket/examples/navomatic/NavomaticApplication.java
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/navomatic/NavomaticApplication.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/navomatic/NavomaticApplication.java
index 2656575..5e21939 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/navomatic/NavomaticApplication.java
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/navomatic/NavomaticApplication.java
@@ -18,7 +18,6 @@ package org.apache.wicket.examples.navomatic;
 
 import org.apache.wicket.Page;
 import org.apache.wicket.examples.WicketExampleApplication;
-import org.apache.wicket.markup.html.link.DisabledLinkBehavior;
 
 /**
  * Application class.
@@ -34,14 +33,6 @@ public class NavomaticApplication extends 
WicketExampleApplication
        {
        }
 
-       @Override
-       protected void init()
-       {
-               super.init();
-
-               getComponentInstantiationListeners().add(new 
DisabledLinkBehavior.LinkInstantiationListener());
-       }
-
        /**
         * @see org.apache.wicket.Application#getHomePage()
         */

Reply via email to