Author: jcompagner
Date: Wed Dec 19 13:56:03 2007
New Revision: 605716

URL: http://svn.apache.org/viewvc?rev=605716&view=rev
Log:
fix for fast double/tripple clicking in FF 

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=605716&r1=605715&r2=605716&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 13:56: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(&quot;myLink&quot;)
  * {
@@ -43,23 +43,23 @@
  *     }
  * );
  * </pre>
- * 
+ *
  * and in your HTML file:
- * 
+ *
  * <pre>
  *  &lt;a href=&quot;#&quot; wicket:id=&quot;myLink&quot;&gt;click 
here&lt;/a&gt;
  * </pre>
- * 
+ *
  * or:
- * 
+ *
  * <pre>
  *  &lt;td wicket:id=&quot;myLink&quot;&gt;my clickable column&lt;/td&gt;
  * </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(&quot;link&quot;, 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()
@@ -208,7 +208,7 @@
                if (popupSettings != null)
                {
                        
RequestCycle.get().getRequest().getRequestParameters().setPageMapName(
-                                       
popupSettings.getPageMap(this).getName());
+                               popupSettings.getPageMap(this).getName());
                }
                // Invoke subclass handler
                onClick();
@@ -221,7 +221,7 @@
         * [EMAIL PROTECTED] Component#getOutputMarkupId()} flag true, or it 
must be attached to a &lt;a tag with a
         * href attribute of more than one character starting with '#' ('&lt;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
@@ -308,8 +308,8 @@
                                        else
                                        {
                                                throw new 
WicketRuntimeException("an achor component was set on " + this +
-                                                               " but it 
neither has outputMarkupId set to true " +
-                                                               "nor has a id 
set explicitly");
+                                                       " but it neither has 
outputMarkupId set to true " +
+                                                       "nor has a id set 
explicitly");
                                        }
                                }
                        }
@@ -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)
@@ -406,7 +406,7 @@
                {
                        // if the tag is an anchor proper
                        if (tag.getName().equalsIgnoreCase("a") || 
tag.getName().equalsIgnoreCase("link") ||
-                                       tag.getName().equalsIgnoreCase("area"))
+                               tag.getName().equalsIgnoreCase("area"))
                        {
                                // generate the href attribute
                                tag.put("href", Strings.replaceAll(url, "&", 
"&amp;"));
@@ -420,7 +420,7 @@
                                }
                        }
                        else if (tag.getName().equalsIgnoreCase("script") ||
-                                       tag.getName().equalsIgnoreCase("style"))
+                               tag.getName().equalsIgnoreCase("style"))
                        {
                                tag.put("src", Strings.replaceAll(url, "&", 
"&amp;"));
                        }
@@ -436,9 +436,11 @@
                                else
                                {
                                        // or generate an onclick JS handler 
directly
-                                       tag.put("onclick", 
"window.location.href='" + url + "';return false;");
+                                       // 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");
                                }
                        }
+                       
 
                        // If the subclass specified javascript, use that
                        final CharSequence onClickJavaScript = 
getOnClickScript(url);


Reply via email to