Repository: wicket Updated Branches: refs/heads/wicket-6.x cdc28993d -> 3c6c41f19
Code improved for AbstractLink Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/3c6c41f1 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/3c6c41f1 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/3c6c41f1 Branch: refs/heads/wicket-6.x Commit: 3c6c41f19f6d4d9a236a7d902ed62816af41c00b Parents: cdc2899 Author: adelbene <an.delb...@gmail.com> Authored: Mon May 19 19:30:58 2014 +0200 Committer: adelbene <an.delb...@gmail.com> Committed: Mon May 19 19:30:58 2014 +0200 ---------------------------------------------------------------------- .../wicket/markup/html/link/AbstractLink.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/3c6c41f1/wicket-core/src/main/java/org/apache/wicket/markup/html/link/AbstractLink.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/AbstractLink.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/AbstractLink.java index 86c2c89..d267a1c 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/AbstractLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/AbstractLink.java @@ -165,7 +165,9 @@ public abstract class AbstractLink extends WebMarkupContainer public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { // Draw anything before the body? - if (!isLinkEnabled() && getBeforeDisabledLink() != null) + boolean linkEnabled = isLinkEnabled(); + + if (!linkEnabled && getBeforeDisabledLink() != null) { getResponse().write(getBeforeDisabledLink()); } @@ -184,7 +186,7 @@ public abstract class AbstractLink extends WebMarkupContainer super.onComponentTagBody(markupStream, openTag); } // Draw anything after the body? - if (!isLinkEnabled() && getAfterDisabledLink() != null) + if (!linkEnabled && getAfterDisabledLink() != null) { getResponse().write(getAfterDisabledLink()); } @@ -201,8 +203,10 @@ public abstract class AbstractLink extends WebMarkupContainer protected void disableLink(final ComponentTag tag) { // if the tag is an anchor proper - if (tag.getName().equalsIgnoreCase("a") || tag.getName().equalsIgnoreCase("link") || - tag.getName().equalsIgnoreCase("area")) + String tagName = tag.getName(); + + if (tagName.equalsIgnoreCase("a") || tagName.equalsIgnoreCase("link") || + tagName.equalsIgnoreCase("area")) { // Change anchor link to span tag tag.setName("span"); @@ -213,8 +217,8 @@ public abstract class AbstractLink extends WebMarkupContainer tag.remove("onclick"); } // if the tag is a button or input - else if ("button".equalsIgnoreCase(tag.getName()) || - "input".equalsIgnoreCase(tag.getName())) + else if ("button".equalsIgnoreCase(tagName) || + "input".equalsIgnoreCase(tagName)) { tag.put("disabled", "disabled"); }