Author: knopp Date: Wed Dec 19 15:00:03 2007 New Revision: 605730 URL: http://svn.apache.org/viewvc?rev=605730&view=rev Log: comment improvement
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/link/Link.java Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/link/Link.java URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/link/Link.java?rev=605730&r1=605729&r2=605730&view=diff ============================================================================== --- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/link/Link.java (original) +++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/link/Link.java Wed Dec 19 15:00:03 2007 @@ -33,7 +33,7 @@ * other element, an onclick javascript event handler attribute will be generated. * <p> * You can use a link like: - * + * * <pre> * add(new Link("myLink") * { @@ -43,23 +43,23 @@ * } * ); * </pre> - * + * * and in your HTML file: - * + * * <pre> * <a href="#" wicket:id="myLink">click here</a> * </pre> - * + * * or: - * + * * <pre> * <td wicket:id="myLink">my clickable column</td> * </pre> - * + * * </p> * The following snippet shows how to pass a parameter from the Page creating the Page to the Page * responded by the Link. - * + * * <pre> * add(new Link("link", listItem.getModel()) * { @@ -69,7 +69,7 @@ * setResponsePage(new MyPage(obj.getId(), ... )); * } * </pre> - * + * * @author Jonathan Locke * @author Eelco Hillenius */ @@ -85,7 +85,7 @@ /** * Construct. - * + * * @param anchor */ public AnchorChange(Component anchor) @@ -139,7 +139,7 @@ /** * Gets any anchor component. - * + * * @return Any anchor component to jump to, might be null */ public Component getAnchor() @@ -149,7 +149,7 @@ /** * Gets whether link should automatically enable/disable based on current page. - * + * * @return Whether this link should automatically enable/disable based on current page. */ public final boolean getAutoEnable() @@ -160,7 +160,7 @@ /** * Gets the popup specification. If not-null, a javascript on-click event handler will be * generated that opens a new window using the popup properties. - * + * * @return the popup specification. */ public PopupSettings getPopupSettings() @@ -194,10 +194,10 @@ /** * THIS METHOD IS NOT PART OF THE WICKET API. DO NOT ATTEMPT TO OVERRIDE OR CALL IT. - * + * * Called when a link is clicked. The implementation of this method is currently to simply call * onClick(), but this may be augmented in the future. - * + * * @see ILinkListener */ public final void onLinkClicked() @@ -221,7 +221,7 @@ * [EMAIL PROTECTED] Component#getOutputMarkupId()} flag true, or it must be attached to a <a tag with a * href attribute of more than one character starting with '#' ('<a href="#someAnchor" ... * '). - * + * * @param anchor * The anchor * @return this @@ -235,7 +235,7 @@ /** * Sets whether this link should automatically enable/disable based on current page. - * + * * @param autoEnable * whether this link should automatically enable/disable based on current page. * @return This @@ -249,7 +249,7 @@ /** * Sets the popup specification. If not-null, a javascript on-click event handler will be * generated that opens a new window using the popup properties. - * + * * @param popupSettings * the popup specification. * @return This @@ -275,7 +275,7 @@ * with any set anchor component yourself. You also have to manually append the '#' at the right * place. * </p> - * + * * @param tag * The component tag * @param url @@ -355,7 +355,7 @@ /** * Gets the url to use for this link. - * + * * @return The URL that this link links to */ protected CharSequence getURL() @@ -365,7 +365,7 @@ /** * Whether this link refers to the given page. - * + * * @param page * A page * @return True if this link goes to the given page @@ -377,7 +377,7 @@ /** * Handles this link's tag. OVERRIDES MUST CALL SUPER. - * + * * @param tag * the component tag * @see org.apache.wicket.Component#onComponentTag(ComponentTag) @@ -436,11 +436,17 @@ else { // or generate an onclick JS handler directly - // this special check for the window code is for fast (double/triple clicking) - tag.put("onclick", "var win = this.ownerDocument.defaultView || this.ownerDocument.parentWindow; if (win == window) { window.location.href='" + url + "'; } ;return false"); + // in firefox when the element is quickly clicked 3 times a second request is + // generated during page load. This check ensures that the click is ignored + tag.put( + "onclick", + "var win = this.ownerDocument.defaultView || this.ownerDocument.parentWindow; " + + "if (win == window) { window.location.href='" + + url + + "'; } ;return false"); } } - + // If the subclass specified javascript, use that final CharSequence onClickJavaScript = getOnClickScript(url);