]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixes Button onClick event handling to support TestBench.
authorJouni Koivuviita <jouni.koivuviita@itmill.com>
Fri, 28 Aug 2009 09:02:59 +0000 (09:02 +0000)
committerJouni Koivuviita <jouni.koivuviita@itmill.com>
Fri, 28 Aug 2009 09:02:59 +0000 (09:02 +0000)
Minor fixes to link-style Button base styles.

svn changeset:8570/svn branch:6.1

WebContent/VAADIN/themes/base/button/button.css
WebContent/VAADIN/themes/base/styles.css
WebContent/VAADIN/themes/reindeer/styles.css
WebContent/VAADIN/themes/runo/styles.css
src/com/vaadin/terminal/gwt/client/ui/VButton.java

index 31f091487c31acac235876c20aed073ae1400ae5..47dffb5f8646883c96d60fa7b76bdac240ec83a8 100644 (file)
 .v-ie6 .v-nativebutton {\r
        width: 1px;\r
 }\r
-.v-ie6 .v-nativebutton,\r
-.v-ie7 .v-nativebutton,\r
-.v-ie8 .v-nativebutton {\r
+.v-ie .v-nativebutton {\r
        overflow: visible;\r
        padding-left: 1em;\r
        padding-right: 1em;\r
 }\r
 \r
+.v-ie .v-nativebutton-link {\r
+       padding: 0;\r
+}\r
+\r
 /*\r
  * Checkbox styles\r
  * -------------------------------------- */\r
index fcd22a8afc68cc7ae1c35eb50b3dbd1e445e78e9..9bdd99a852ed726270cb85e2c7799b6805ea8d1d 100644 (file)
 .v-ie6 .v-nativebutton {
        width: 1px;
 }
-.v-ie6 .v-nativebutton,
-.v-ie7 .v-nativebutton,
-.v-ie8 .v-nativebutton {
+.v-ie .v-nativebutton {
        overflow: visible;
        padding-left: 1em;
        padding-right: 1em;
 }
 
+.v-ie .v-nativebutton-link {
+       padding: 0;
+}
+
 /*
  * Checkbox styles
  * -------------------------------------- */
index 78be75158f537d4548269684439a87c2151b4f0b..8d51ea1262190193ed1bd4c74985501c7d10909d 100644 (file)
 .v-ie6 .v-nativebutton {
        width: 1px;
 }
-.v-ie6 .v-nativebutton,
-.v-ie7 .v-nativebutton,
-.v-ie8 .v-nativebutton {
+.v-ie .v-nativebutton {
        overflow: visible;
        padding-left: 1em;
        padding-right: 1em;
 }
 
+.v-ie .v-nativebutton-link {
+       padding: 0;
+}
+
 /*
  * Checkbox styles
  * -------------------------------------- */
index a90b1a5a5da7b4abc221f862e3943eca224c2af0..79dab019b12875a2b5ba8f8a207e286e323afc28 100644 (file)
 .v-ie6 .v-nativebutton {
        width: 1px;
 }
-.v-ie6 .v-nativebutton,
-.v-ie7 .v-nativebutton,
-.v-ie8 .v-nativebutton {
+.v-ie .v-nativebutton {
        overflow: visible;
        padding-left: 1em;
        padding-right: 1em;
 }
 
+.v-ie .v-nativebutton-link {
+       padding: 0;
+}
+
 /*
  * Checkbox styles
  * -------------------------------------- */
index b3213b1b8f599a9f534d43d97edcc0dd87222c2f..aaa615b30571d62c6b9d1500d479de91bc761ab6 100644 (file)
@@ -44,6 +44,10 @@ public class VButton extends FocusWidget implements Paintable {
      */
     private boolean clickPending;
 
+    private boolean enabled = true;
+
+    private int tabIndex = 0;
+
     /*
      * BELOW PRIVATE MEMBERS COPY-PASTED FROM GWT CustomButton
      */
@@ -62,10 +66,8 @@ public class VButton extends FocusWidget implements Paintable {
      * Used to decide whether to allow clicks to propagate up to the superclass
      * or container elements.
      */
-    private boolean allowClick;
+    private boolean disallowNextClick = false;
     private boolean isHovering;
-    private boolean enabled = true;
-    private int tabIndex = 0;
 
     public VButton() {
         super(DOM.createDiv());
@@ -178,17 +180,20 @@ public class VButton extends FocusWidget implements Paintable {
         }
 
         int type = DOM.eventGetType(event);
+        System.out.println(DOM.eventGetTypeString(event));
         switch (type) {
         case Event.ONCLICK:
             // If clicks are currently disallowed, keep it from bubbling or
             // being passed to the superclass.
-            if (!allowClick) {
+            if (disallowNextClick) {
                 event.stopPropagation();
+                disallowNextClick = false;
                 return;
             }
             break;
         case Event.ONMOUSEDOWN:
             if (event.getButton() == Event.BUTTON_LEFT) {
+                disallowNextClick = true;
                 clickPending = true;
                 setFocus(true);
                 DOM.setCapture(getElement());
@@ -205,7 +210,8 @@ public class VButton extends FocusWidget implements Paintable {
                 isCapturing = false;
                 DOM.releaseCapture(getElement());
                 if (isHovering() && event.getButton() == Event.BUTTON_LEFT) {
-                    onClick();
+                    // Click ok
+                    disallowNextClick = false;
                 }
                 if (BrowserInfo.get().isIE() || BrowserInfo.get().isOpera()) {
                     removeStyleName(CLASSNAME_PRESSED);
@@ -309,15 +315,14 @@ public class VButton extends FocusWidget implements Paintable {
         // Allow the click we're about to synthesize to pass through to the
         // superclass and containing elements. Element.dispatchEvent() is
         // synchronous, so we simply set and clear the flag within this method.
-        allowClick = true;
+
+        disallowNextClick = false;
 
         // Mouse coordinates are not always available (e.g., when the click is
         // caused by a keyboard event).
         NativeEvent evt = Document.get().createClickEvent(1, 0, 0, 0, 0, false,
                 false, false, false);
         getElement().dispatchEvent(evt);
-
-        allowClick = false;
     }
 
     /**