patch would be either like the attachement, or a special class,
SimpleLink (same fashion as SimpleAttributeModifier?) which would be a
WebComponent rather than a WebMarkupContainer.

Eelco
Index: 
/Users/eelcohillenius/Documents/workspace/wicket/src/main/java/wicket/markup/html/link/Link.java
===================================================================
--- 
/Users/eelcohillenius/Documents/workspace/wicket/src/main/java/wicket/markup/html/link/Link.java
    (revision 467267)
+++ 
/Users/eelcohillenius/Documents/workspace/wicket/src/main/java/wicket/markup/html/link/Link.java
    (working copy)
@@ -554,6 +554,11 @@
                }
        }
 
+       protected String getLabel()
+       {
+               return null;
+       }
+
        /**
         * Renders this link's body.
         * 
@@ -566,19 +571,40 @@
        protected final void onComponentTagBody(final MarkupStream markupStream,
                        final ComponentTag openTag)
        {
-               // Draw anything before the body?
-               if (!isEnabled() && getBeforeDisabledLink() != null)
+               String label = getLabel();
+               if (label != null)
                {
-                       getResponse().write(getBeforeDisabledLink());
-               }
+                       StringBuffer b = new StringBuffer();
+                       if (!isEnabled() && getBeforeDisabledLink() != null)
+                       {
+                               b.append(getBeforeDisabledLink());
+                       }
+
+                       b.append(label);
 
-               // Render the body of the link
-               renderComponentTagBody(markupStream, openTag);
+                       if (!isEnabled() && getAfterDisabledLink() != null)
+                       {
+                               b.append(getAfterDisabledLink());
+                       }
 
-               // Draw anything after the body?
-               if (!isEnabled() && getAfterDisabledLink() != null)
+                       replaceComponentTagBody(markupStream, openTag, 
b.toString());
+               }
+               else
                {
-                       getResponse().write(getAfterDisabledLink());
+                       // Draw anything before the body?
+                       if (!isEnabled() && getBeforeDisabledLink() != null)
+                       {
+                               getResponse().write(getBeforeDisabledLink());
+                       }
+
+                       // Render the body of the link
+                       renderComponentTagBody(markupStream, openTag);
+
+                       // Draw anything after the body?
+                       if (!isEnabled() && getAfterDisabledLink() != null)
+                       {
+                               getResponse().write(getAfterDisabledLink());
+                       }
                }
        }
 }

Reply via email to