You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2012/07/27 19:02:35 UTC

[1/3] git commit: WICKET-4641 AjaxFallbackLink is allowed on if it is disabled

Updated Branches:
  refs/heads/master 6be1e79db -> 06e745361


WICKET-4641 AjaxFallbackLink is allowed on <span> if it is disabled


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

Branch: refs/heads/master
Commit: 06e745361951f8407dfdfe4dc13da49e9e344e35
Parents: 1cd6653
Author: svenmeier <sv...@apache.org>
Authored: Fri Jul 27 18:34:42 2012 +0200
Committer: svenmeier <sv...@apache.org>
Committed: Fri Jul 27 18:34:42 2012 +0200

----------------------------------------------------------------------
 .../wicket/ajax/markup/html/AjaxFallbackLink.java  |   24 ++++++++-------
 1 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/06e74536/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
index 471bd98..d2a77bf 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxFallbackLink.java
@@ -28,13 +28,13 @@ import org.apache.wicket.model.IModel;
 /**
  * An ajax link that will degrade to a normal request if ajax is not available or javascript is
  * disabled.
- *
- *  <p>
+ * 
+ * <p>
  * If JavaScript is enabled then the registered JavaScript event 'click' handler will be used,
- * otherwise the 'href' attribute if the markup element is an &lt;a&gt;, &lt;area&gt; or &lt;link&gt;.
- * AjaxFallbackLink doesn't fallback if the markup element is none of the three above.
+ * otherwise the 'href' attribute if the markup element is an &lt;a&gt;, &lt;area&gt; or
+ * &lt;link&gt;. AjaxFallbackLink doesn't fallback if the markup element is none of the three above.
  * </p>
- *
+ * 
  * @since 1.2
  * 
  * @author Igor Vaynberg (ivaynberg)
@@ -160,7 +160,7 @@ public abstract class AjaxFallbackLink<T> extends Link<T> implements IAjaxLink
 
 	/**
 	 * Removes any inline 'onclick' attributes set by Link#onComponentTag(ComponentTag).
-	 *
+	 * 
 	 * @param tag
 	 *            the component tag
 	 */
@@ -173,12 +173,14 @@ public abstract class AjaxFallbackLink<T> extends Link<T> implements IAjaxLink
 		tag.remove("onclick");
 
 		String tagName = tag.getName();
-		if (!("a".equalsIgnoreCase(tagName) || "area".equalsIgnoreCase(tagName) || "link".equalsIgnoreCase(tagName)))
+		if (isLinkEnabled() &&
+			!("a".equalsIgnoreCase(tagName) || "area".equalsIgnoreCase(tagName) || "link".equalsIgnoreCase(tagName)))
 		{
-			String msg = String.format("%s must be used only with <a>, <area> or <link> markup elements. " +
-					"The fallback functionality doesn't work for other markup elements. " +
-					"Component path: %s, markup element: <%s>.",
-					AjaxFallbackLink.class.getSimpleName(), getClassRelativePath(), tagName);
+			String msg = String.format(
+				"%s must be used only with <a>, <area> or <link> markup elements. "
+					+ "The fallback functionality doesn't work for other markup elements. "
+					+ "Component path: %s, markup element: <%s>.",
+				AjaxFallbackLink.class.getSimpleName(), getClassRelativePath(), tagName);
 			findMarkupStream().throwMarkupException(msg);
 		}
 	}