Revision: 6028 Author: [email protected] Date: Fri Aug 28 06:46:54 2009 Log: Rolling back changes that broke the continuous build. $ svn merge -r6024:6018 .
http://code.google.com/p/google-web-toolkit/source/detail?r=6028 Deleted: /trunk/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3962.java /trunk/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3973.java /trunk/user/src/com/google/gwt/user/client/ui/ResetButton.java /trunk/user/src/com/google/gwt/user/client/ui/SubmitButton.java Modified: /trunk/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/LatestTimeJar.java /trunk/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java /trunk/user/src/com/google/gwt/dom/client/DOMImpl.java /trunk/user/src/com/google/gwt/dom/client/DOMImplTrident.java /trunk/user/src/com/google/gwt/dom/client/Document.java /trunk/user/src/com/google/gwt/user/client/ui/Button.java /trunk/user/src/com/google/gwt/user/client/ui/FormPanel.java /trunk/user/test/com/google/gwt/dom/client/DocumentTest.java /trunk/user/test/com/google/gwt/dom/client/ElementTest.java /trunk/user/test/com/google/gwt/user/UISuite.java /trunk/user/test/com/google/gwt/user/client/ui/ButtonTest.java /trunk/user/test/com/google/gwt/user/client/ui/FormPanelTest.java ======================================= --- /trunk/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3962.java Thu Aug 27 09:33:30 2009 +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.google.gwt.museum.client.defaultmuseum; - -import com.google.gwt.museum.client.common.AbstractIssue; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.FormPanel; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.user.client.ui.FormPanel.SubmitEvent; -import com.google.gwt.user.client.ui.FormPanel.SubmitHandler; - -/** - * Buttons default to type=submit in WebKit (Safari and Chrome) and IE8 (in IE8 - * mode). - */ -public class Issue3962 extends AbstractIssue { - private FormPanel form; - - @Override - public Widget createIssue() { - form = new FormPanel(); - form.addSubmitHandler(new SubmitHandler() { - public void onSubmit(SubmitEvent event) { - Window.alert("Form is being submitted."); - event.cancel(); - } - }); - form.setWidget(new Button("Submit")); - return form; - } - - @Override - public String getInstructions() { - return "Click the button, it should have no effect."; - } - - @Override - public String getSummary() { - return "In IE8 (in IE8 mode) and WebKit (Safari and Chrome), buttons default" - + " to type submit."; - } - - @Override - public boolean hasCSS() { - return false; - } -} ======================================= --- /trunk/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3973.java Thu Aug 27 09:07:32 2009 +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.google.gwt.museum.client.defaultmuseum; - -import com.google.gwt.museum.client.common.AbstractIssue; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.FormPanel; -import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.user.client.ui.FormPanel.SubmitEvent; -import com.google.gwt.user.client.ui.FormPanel.SubmitHandler; - -/** - * When a {...@link FormPanel} does not use a synthesized hidden iframe and is - * being submit by means other than {...@link FormPanel#submit()}, it doesn't fire - * submit events. - */ -public class Issue3973 extends AbstractIssue { - private FormPanel form; - - @Override - public Widget createIssue() { - form = new FormPanel("_blank"); - form.setAction("http://www.google.com/search"); - form.addSubmitHandler(new SubmitHandler() { - public void onSubmit(SubmitEvent event) { - Window.alert("Did you see me?"); - event.cancel(); - } - }); - TextBox box = new TextBox(); - box.setName("q"); - form.setWidget(box); - return form; - } - - @Override - public String getInstructions() { - return "Enter some text and press the ENTER key, it should show an alert. It shouldn't open Google within a new window/tab!"; - } - - @Override - public String getSummary() { - return "FormPanel doesn't hook events when not using a synthesized hidden iframe."; - } - - @Override - public boolean hasCSS() { - return false; - } -} ======================================= --- /trunk/user/src/com/google/gwt/user/client/ui/ResetButton.java Thu Aug 27 09:33:30 2009 +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.google.gwt.user.client.ui; - -import com.google.gwt.dom.client.ButtonElement; -import com.google.gwt.dom.client.Document; -import com.google.gwt.event.dom.client.ClickHandler; - -/** - * A standard push-button widget which will automatically reset its enclosing - * {...@link FormPanel} if any. - * - * <h3>CSS Style Rules</h3> - * <dl> - * <dt>.gwt-ResetButton</dt> - * <dd>the outer element</dd> - * </dl> - */ -public class ResetButton extends Button { - - /** - * Creates a ResetButton widget that wraps an existing <button> element. - * - * This element must already be attached to the document. If the element is - * removed from the document, you must call - * {...@link RootPanel#detachNow(Widget)}. - * - * @param element the element to be wrapped - */ - public static Button wrap(com.google.gwt.dom.client.Element element) { - // Assert that the element is attached. - assert Document.get().getBody().isOrHasChild(element); - - ResetButton button = new ResetButton(element); - - // Mark it attached and remember it for cleanup. - button.onAttach(); - RootPanel.detachOnWindowClose(button); - - return button; - } - - /** - * Creates a button with no caption. - */ - public ResetButton() { - super(Document.get().createResetButtonElement()); - setStyleName("gwt-ResetButton"); - } - - /** - * Creates a button with the given HTML caption. - * - * @param html the HTML caption - */ - public ResetButton(String html) { - this(); - setHTML(html); - } - - /** - * Creates a button with the given HTML caption and click listener. - * - * @param html the HTML caption - * @param handler the click handler - */ - public ResetButton(String html, ClickHandler handler) { - this(html); - addClickHandler(handler); - } - - /** - * This constructor may be used by subclasses to explicitly use an existing - * element. This element must be a <button> element with type reset. - * - * @param element the element to be used - */ - protected ResetButton(com.google.gwt.dom.client.Element element) { - super(element); - assert "reset".equalsIgnoreCase(element.<ButtonElement> cast().getType()); - } -} ======================================= --- /trunk/user/src/com/google/gwt/user/client/ui/SubmitButton.java Thu Aug 27 09:33:30 2009 +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.google.gwt.user.client.ui; - -import com.google.gwt.dom.client.ButtonElement; -import com.google.gwt.dom.client.Document; -import com.google.gwt.event.dom.client.ClickHandler; - -/** - * A standard push-button widget which will automatically submit its enclosing - * {...@link FormPanel} if any. - * - * <h3>CSS Style Rules</h3> - * <dl> - * <dt>.gwt-SubmitButton</dt> - * <dd>the outer element</dd> - * </dl> - */ -public class SubmitButton extends Button { - - /** - * Creates a SubmitButton widget that wraps an existing <button> - * element. - * - * This element must already be attached to the document. If the element is - * removed from the document, you must call - * {...@link RootPanel#detachNow(Widget)}. - * - * @param element the element to be wrapped - */ - public static Button wrap(com.google.gwt.dom.client.Element element) { - // Assert that the element is attached. - assert Document.get().getBody().isOrHasChild(element); - - SubmitButton button = new SubmitButton(element); - assert "submit".equalsIgnoreCase(button.getButtonElement().getType()); - - // Mark it attached and remember it for cleanup. - button.onAttach(); - RootPanel.detachOnWindowClose(button); - - return button; - } - - /** - * Creates a button with no caption. - */ - public SubmitButton() { - super(Document.get().createSubmitButtonElement()); - setStyleName("gwt-SubmitButton"); - } - - /** - * Creates a button with the given HTML caption. - * - * @param html the HTML caption - */ - public SubmitButton(String html) { - this(); - setHTML(html); - } - - /** - * Creates a button with the given HTML caption and click listener. - * - * @param html the HTML caption - * @param handler the click handler - */ - public SubmitButton(String html, ClickHandler handler) { - this(html); - addClickHandler(handler); - } - - /** - * This constructor may be used by subclasses to explicitly use an existing - * element. This element must be a <button> element with type submit. - * - * @param element the element to be used - */ - protected SubmitButton(com.google.gwt.dom.client.Element element) { - super(element); - assert "submit".equalsIgnoreCase(element.<ButtonElement> cast().getType()); - } -} ======================================= --- /trunk/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/LatestTimeJar.java Thu Aug 27 11:09:46 2009 +++ /trunk/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/LatestTimeJar.java Fri Aug 28 06:46:54 2009 @@ -1,12 +1,12 @@ /* * Copyright 2008 Google Inc. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -28,13 +28,12 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.Map; -import java.util.Random; import java.util.TreeMap; /** * A variation on Jar which handles duplicate entries by only archiving the most * recent of any given path. This is done by keeping a map of paths (as shown in - * the jar file) against {...@link EntryInfo} objects identifying the input source + * the jar file) against {...@link #EntryInfo} objects identifying the input source * and its timestamp. Most of the actual archiving is deferred until archive * finalization, when we've decided on the actual de-duplicated set of entries. */ @@ -55,7 +54,7 @@ /** * Called to actually add the entry to a given zip stream. - * + * * @param out * @param path * @throws IOException @@ -102,7 +101,7 @@ public FileEntryInfo(InputStream in, long lastModified, File fromArchive, int mode) throws IOException { super(lastModified, mode); - tmpFile = createTempFile("gwtjar", ""); + tmpFile = File.createTempFile("gwtjar", ""); tmpFile.deleteOnExit(); OutputStream fos = new FileOutputStream(tmpFile); int readLen = in.read(buffer); @@ -125,54 +124,6 @@ } } } - - /** - * Used to generate temporary file names. - */ - private static long counter = -1; - - /** - * Creates a temporary file. - * - * @param prefix the file prefix - * @param suffix the file suffix - * @return the new file - * @throws IOException if the file cannot be created - */ - private static File createTempFile(String prefix, String suffix) - throws IOException { - if (suffix == null) { - suffix = ".tmp"; - } - - // Get the temp file directory. - File tmpDir = new File(System.getProperty("java.io.tmpdir")); - tmpDir.mkdirs(); - - // Generate a random name. - if (counter == -1) { - counter = new Random().nextLong(); - } - boolean created = false; - File tmpFile; - do { - counter++; - tmpFile = new File(tmpDir, prefix + Long.toString(counter) + suffix); - if (!tmpFile.exists()) { - created = tmpFile.createNewFile(); - if (!created) { - // If we fail the create the temp file, it must have been created by - // another thread between lines 161 and 162. We re-seed to avoid - // further race conditions. - counter = new Random().nextLong(); - } - } - } while (!created); - - // Create the file. - tmpFile.createNewFile(); - return tmpFile; - } private byte buffer[] = new byte[16 * 1024]; private Map<String, EntryInfo> paths = new TreeMap<String, EntryInfo>(); @@ -237,10 +188,10 @@ /** * Checks whether an entry should be replaced, by touch dates and duplicates * setting. - * + * * @param path the path of an entry being considered * @param touchTime the lastModified of the candiate replacement - * @return true if the file should be replaced + * @return */ private boolean shouldReplace(String path, long touchTime) { EntryInfo oldInfo = paths.get(path); ======================================= --- /trunk/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java Thu Aug 27 09:33:30 2009 +++ /trunk/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/DefaultMuseum.java Fri Aug 28 06:46:54 2009 @@ -49,8 +49,6 @@ addIssue(new Issue2553()); addIssue(new Issue2855()); addIssue(new Issue3172()); - addIssue(new Issue3962()); - addIssue(new Issue3973()); } public void addVisuals() { ======================================= --- /trunk/user/src/com/google/gwt/dom/client/DOMImpl.java Thu Aug 27 09:33:30 2009 +++ /trunk/user/src/com/google/gwt/dom/client/DOMImpl.java Fri Aug 28 06:46:54 2009 @@ -25,12 +25,6 @@ button.click(); }-*/; - public native ButtonElement createButtonElement(Document doc, String type) /*-{ - var e = doc.createElement("BUTTON"); - e.type = type; - return e; - }-*/; - public native Element createElement(Document doc, String tag) /*-{ return doc.createElement(tag); }-*/; ======================================= --- /trunk/user/src/com/google/gwt/dom/client/DOMImplTrident.java Thu Aug 27 09:33:30 2009 +++ /trunk/user/src/com/google/gwt/dom/client/DOMImplTrident.java Fri Aug 28 06:46:54 2009 @@ -21,17 +21,11 @@ * This field *must* be filled in from JSNI code before dispatching an event * on IE. It should be set to the 'this' context of the handler that receives * the event, then restored to its initial value when the dispatcher is done. - * See - * {...@link com.google.gwt.user.client.impl.DOMImplTrident#initEventSystem()} + * See {...@link com.google.gwt.user.client.impl.DOMImplTrident#initEventSystem()} * for an example of how this should be done. */ private static EventTarget currentEventTarget; - @Override - public native ButtonElement createButtonElement(Document doc, String type) /*-{ - return doc.createElement("<BUTTON type='" + type + "'></BUTTON>"); - }-*/; - @Override public Element createElement(Document doc, String tagName) { if (tagName.contains(":")) { @@ -54,8 +48,8 @@ } @Override - public native NativeEvent createHtmlEvent(Document doc, String type, - boolean canBubble, boolean cancelable) /*-{ + public native NativeEvent createHtmlEvent(Document doc, String type, boolean canBubble, + boolean cancelable) /*-{ // NOTE: IE doesn't support changing bubbling and canceling behavior (this // is documented publicly in Document.createHtmlEvent()). var evt = doc.createEventObject(); @@ -69,9 +63,9 @@ }-*/; @Override - public native NativeEvent createKeyEvent(Document doc, String type, - boolean canBubble, boolean cancelable, boolean ctrlKey, boolean altKey, - boolean shiftKey, boolean metaKey, int keyCode, int charCode) /*-{ + public native NativeEvent createKeyEvent(Document doc, String type, boolean canBubble, + boolean cancelable, boolean ctrlKey, boolean altKey, boolean shiftKey, + boolean metaKey, int keyCode, int charCode) /*-{ // NOTE: IE doesn't support changing bubbling and canceling behavior (this // is documented publicly in Document.createKeyEvent()). var evt = doc.createEventObject(); @@ -87,10 +81,10 @@ }-*/; @Override - public native NativeEvent createMouseEvent(Document doc, String type, - boolean canBubble, boolean cancelable, int detail, int screenX, - int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, - boolean shiftKey, boolean metaKey, int button, Element relatedTarget) /*-{ + public native NativeEvent createMouseEvent(Document doc, String type, boolean canBubble, + boolean cancelable, int detail, int screenX, int screenY, int clientX, + int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, + boolean metaKey, int button, Element relatedTarget) /*-{ // NOTE: IE doesn't support changing bubbling and canceling behavior (this // is documented publicly in Document.createMouseEvent()). var evt = doc.createEventObject(); @@ -174,7 +168,7 @@ /** * IE returns a numeric type for some attributes that are really properties, - * such as offsetWidth. We need to coerce these to strings to prevent a + * such as offsetWidth. We need to coerce these to strings to prevent a * runtime JS exception. */ @Override @@ -198,7 +192,6 @@ return elem.innerText; }-*/; - @Override public String getTagName(Element elem) { String tagName = getTagNameInternal(elem); String scopeName = getScopeNameInternal(elem); ======================================= --- /trunk/user/src/com/google/gwt/dom/client/Document.java Thu Aug 27 09:33:30 2009 +++ /trunk/user/src/com/google/gwt/dom/client/Document.java Fri Aug 28 06:46:54 2009 @@ -68,8 +68,7 @@ * @return the newly created element */ public final QuoteElement createBlockQuoteElement() { - return (QuoteElement) DOMImpl.impl.createElement(this, - QuoteElement.TAG_BLOCKQUOTE); + return (QuoteElement) DOMImpl.impl.createElement(this, QuoteElement.TAG_BLOCKQUOTE); } /** @@ -90,28 +89,12 @@ /** * Creates a <button> element. - * <p> - * <b>Warning!</b> The button type is actually implementation-dependent and is - * read-only. * * @return the newly created element - * @deprecated use {...@link #createPushButtonElement()}, - * {...@link #createResetButtonElement()} or - * {...@link #createSubmitButtonElement()} instead. */ - @Deprecated public final ButtonElement createButtonElement() { return (ButtonElement) DOMImpl.impl.createElement(this, ButtonElement.TAG); } - - /** - * Creates an <input type='button'> element. - * - * @return the newly created element - */ - public final InputElement createButtonInputElement() { - return DOMImpl.impl.createInputElement(this, "button"); - } /** * Creates a <caption> element. @@ -119,8 +102,7 @@ * @return the newly created element */ public final TableCaptionElement createCaptionElement() { - return (TableCaptionElement) DOMImpl.impl.createElement(this, - TableCaptionElement.TAG); + return (TableCaptionElement) DOMImpl.impl.createElement(this, TableCaptionElement.TAG); } /** @@ -158,8 +140,8 @@ * @param metaKey <code>true</code> if the meta key is depressed * @return the event object */ - public final NativeEvent createClickEvent(int detail, int screenX, - int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, + public final NativeEvent createClickEvent(int detail, int screenX, int screenY, + int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey) { // We disallow setting the button here, because IE doesn't provide the // button property for click events. @@ -174,8 +156,7 @@ * @return the newly created element */ public final TableColElement createColElement() { - return (TableColElement) DOMImpl.impl.createElement(this, - TableColElement.TAG_COL); + return (TableColElement) DOMImpl.impl.createElement(this, TableColElement.TAG_COL); } /** @@ -184,8 +165,7 @@ * @return the newly created element */ public final TableColElement createColGroupElement() { - return (TableColElement) DOMImpl.impl.createElement(this, - TableColElement.TAG_COLGROUP); + return (TableColElement) DOMImpl.impl.createElement(this, TableColElement.TAG_COLGROUP); } /** @@ -224,8 +204,8 @@ * @param metaKey <code>true</code> if the meta key is depressed * @return the event object */ - public final NativeEvent createDblClickEvent(int detail, int screenX, - int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, + public final NativeEvent createDblClickEvent(int detail, int screenX, int screenY, + int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey) { // We disallow setting the button here, because IE doesn't provide the // button property for click events. @@ -286,8 +266,7 @@ * @return the newly created element */ public final FieldSetElement createFieldSetElement() { - return (FieldSetElement) DOMImpl.impl.createElement(this, - FieldSetElement.TAG); + return (FieldSetElement) DOMImpl.impl.createElement(this, FieldSetElement.TAG); } /** @@ -332,8 +311,7 @@ * @return the newly created element */ public final FrameSetElement createFrameSetElement() { - return (FrameSetElement) DOMImpl.impl.createElement(this, - FrameSetElement.TAG); + return (FrameSetElement) DOMImpl.impl.createElement(this, FrameSetElement.TAG); } /** @@ -599,8 +577,8 @@ * {...@link NativeEvent#BUTTON_LEFT} et al) * @return the event object */ - public final NativeEvent createMouseDownEvent(int detail, int screenX, - int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, + public final NativeEvent createMouseDownEvent(int detail, int screenX, int screenY, + int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button) { return createMouseEvent("mousedown", true, true, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, null); @@ -665,8 +643,8 @@ * {...@link NativeEvent#BUTTON_LEFT} et al) * @return the event object */ - public final NativeEvent createMouseMoveEvent(int detail, int screenX, - int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, + public final NativeEvent createMouseMoveEvent(int detail, int screenX, int screenY, + int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button) { return createMouseEvent("mousemove", true, true, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, null); @@ -692,8 +670,8 @@ * @param relatedTarget the event's related target * @return the event object */ - public final NativeEvent createMouseOutEvent(int detail, int screenX, - int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, + public final NativeEvent createMouseOutEvent(int detail, int screenX, int screenY, + int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button, Element relatedTarget) { return createMouseEvent("mouseout", true, true, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, @@ -720,8 +698,8 @@ * @param relatedTarget the event's related target * @return the event object */ - public final NativeEvent createMouseOverEvent(int detail, int screenX, - int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, + public final NativeEvent createMouseOverEvent(int detail, int screenX, int screenY, + int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button, Element relatedTarget) { return createMouseEvent("mouseover", true, true, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, @@ -744,8 +722,8 @@ * {...@link NativeEvent#BUTTON_LEFT} et al) * @return the event object */ - public final NativeEvent createMouseUpEvent(int detail, int screenX, - int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, + public final NativeEvent createMouseUpEvent(int detail, int screenX, int screenY, + int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button) { return createMouseEvent("mouseup", true, true, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, null); @@ -775,8 +753,7 @@ * @return the newly created element */ public final OptGroupElement createOptGroupElement() { - return (OptGroupElement) DOMImpl.impl.createElement(this, - OptGroupElement.TAG); + return (OptGroupElement) DOMImpl.impl.createElement(this, OptGroupElement.TAG); } /** @@ -812,8 +789,7 @@ * @return the newly created element */ public final ParagraphElement createPElement() { - return (ParagraphElement) DOMImpl.impl.createElement(this, - ParagraphElement.TAG); + return (ParagraphElement) DOMImpl.impl.createElement(this, ParagraphElement.TAG); } /** @@ -824,15 +800,6 @@ public final PreElement createPreElement() { return (PreElement) DOMImpl.impl.createElement(this, PreElement.TAG); } - - /** - * Creates a <button type='button'> element. - * - * @return the newly created element - */ - public final ButtonElement createPushButtonElement() { - return DOMImpl.impl.createButtonElement(this, "button"); - } /** * Creates a <q> element. @@ -852,24 +819,6 @@ public final InputElement createRadioInputElement(String name) { return DOMImpl.impl.createInputRadioElement(this, name); } - - /** - * Creates a <button type='reset'> element. - * - * @return the newly created element - */ - public final ButtonElement createResetButtonElement() { - return DOMImpl.impl.createButtonElement(this, "reset"); - } - - /** - * Creates an <input type='reset'> element. - * - * @return the newly created element - */ - public final InputElement createResetInputElement() { - return DOMImpl.impl.createInputElement(this, "reset"); - } /** * Creates a <script> element. @@ -938,15 +887,6 @@ public final StyleElement createStyleElement() { return (StyleElement) DOMImpl.impl.createElement(this, StyleElement.TAG); } - - /** - * Creates a <button type='submit'> element. - * - * @return the newly created element - */ - public final ButtonElement createSubmitButtonElement() { - return DOMImpl.impl.createButtonElement(this, "submit"); - } /** * Creates an <input type='submit'> element. @@ -972,8 +912,7 @@ * @return the newly created element */ public final TableSectionElement createTBodyElement() { - return (TableSectionElement) DOMImpl.impl.createElement(this, - TableSectionElement.TAG_TBODY); + return (TableSectionElement) DOMImpl.impl.createElement(this, TableSectionElement.TAG_TBODY); } /** @@ -982,8 +921,7 @@ * @return the newly created element */ public final TableCellElement createTDElement() { - return (TableCellElement) DOMImpl.impl.createElement(this, - TableCellElement.TAG_TD); + return (TableCellElement) DOMImpl.impl.createElement(this, TableCellElement.TAG_TD); } /** @@ -992,8 +930,7 @@ * @return the newly created element */ public final TextAreaElement createTextAreaElement() { - return (TextAreaElement) DOMImpl.impl.createElement(this, - TextAreaElement.TAG); + return (TextAreaElement) DOMImpl.impl.createElement(this, TextAreaElement.TAG); } /** @@ -1021,8 +958,7 @@ * @return the newly created element */ public final TableSectionElement createTFootElement() { - return (TableSectionElement) DOMImpl.impl.createElement(this, - TableSectionElement.TAG_TFOOT); + return (TableSectionElement) DOMImpl.impl.createElement(this, TableSectionElement.TAG_TFOOT); } /** @@ -1031,8 +967,7 @@ * @return the newly created element */ public final TableSectionElement createTHeadElement() { - return (TableSectionElement) DOMImpl.impl.createElement(this, - TableSectionElement.TAG_THEAD); + return (TableSectionElement) DOMImpl.impl.createElement(this, TableSectionElement.TAG_THEAD); } /** @@ -1041,8 +976,7 @@ * @return the newly created element */ public final TableCellElement createTHElement() { - return (TableCellElement) DOMImpl.impl.createElement(this, - TableCellElement.TAG_TH); + return (TableCellElement) DOMImpl.impl.createElement(this, TableCellElement.TAG_TH); } /** @@ -1060,8 +994,7 @@ * @return the newly created element */ public final TableRowElement createTRElement() { - return (TableRowElement) DOMImpl.impl.createElement(this, - TableRowElement.TAG); + return (TableRowElement) DOMImpl.impl.createElement(this, TableRowElement.TAG); } /** ======================================= --- /trunk/user/src/com/google/gwt/user/client/ui/Button.java Thu Aug 27 09:33:30 2009 +++ /trunk/user/src/com/google/gwt/user/client/ui/Button.java Fri Aug 28 06:46:54 2009 @@ -28,10 +28,9 @@ * </p> * * <h3>CSS Style Rules</h3> - * <dl> - * <dt>.gwt-Button</dt> - * <dd>the outer element</dd> - * </dl> + * <ul class="css"> + * <li>.gwt-Button { }</li> + * </ul> * * <p> * <h3>Example</h3> @@ -54,7 +53,6 @@ assert Document.get().getBody().isOrHasChild(element); Button button = new Button(element); - assert "button".equalsIgnoreCase(button.getButtonElement().getType()); // Mark it attached and remember it for cleanup. button.onAttach(); @@ -63,11 +61,22 @@ return button; } + static native void adjustType(Element button) /*-{ + // Check before setting this attribute, as not all browsers define it. + if (button.type == 'submit') { + try { + button.setAttribute("type", "button"); + } catch (e) { + } + } + }-*/; + /** * Creates a button with no caption. */ public Button() { - super(Document.get().createPushButtonElement()); + super(Document.get().createButtonElement()); + adjustType(getElement()); setStyleName("gwt-Button"); } @@ -123,12 +132,8 @@ getButtonElement().click(); } - /** - * Get the underlying button element. - * - * @return the {...@link ButtonElement} - */ - protected ButtonElement getButtonElement() { + private ButtonElement getButtonElement() { return getElement().cast(); } } + ======================================= --- /trunk/user/src/com/google/gwt/user/client/ui/FormPanel.java Thu Aug 27 09:07:32 2009 +++ /trunk/user/src/com/google/gwt/user/client/ui/FormPanel.java Fri Aug 28 06:46:54 2009 @@ -569,23 +569,24 @@ // Create and attach a hidden iframe to the body element. createFrame(); Document.get().getBody().appendChild(synthesizedFrame); - } - // Hook up the underlying iframe's onLoad event when attached to the DOM. - // Making this connection only when attached avoids memory-leak issues. - // The FormPanel cannot use the built-in GWT event-handling mechanism - // because there is no standard onLoad event on iframes that works across - // browsers. - impl.hookEvents(synthesizedFrame, getElement(), this); + + // Hook up the underlying iframe's onLoad event when attached to the DOM. + // Making this connection only when attached avoids memory-leak issues. + // The FormPanel cannot use the built-in GWT event-handling mechanism + // because there is no standard onLoad event on iframes that works across + // browsers. + impl.hookEvents(synthesizedFrame, getElement(), this); + } } @Override protected void onDetach() { super.onDetach(); - // Unhook the iframe's onLoad when detached. - impl.unhookEvents(synthesizedFrame, getElement()); - if (synthesizedFrame != null) { + // Unhook the iframe's onLoad when detached. + impl.unhookEvents(synthesizedFrame, getElement()); + // And remove it from the document. Document.get().getBody().removeChild(synthesizedFrame); synthesizedFrame = null; ======================================= --- /trunk/user/test/com/google/gwt/dom/client/DocumentTest.java Thu Aug 27 09:33:30 2009 +++ /trunk/user/test/com/google/gwt/dom/client/DocumentTest.java Fri Aug 28 06:46:54 2009 @@ -37,6 +37,7 @@ assertEquals("blockquote", doc.createBlockQuoteElement().getTagName().toLowerCase()); assertEquals("br", doc.createBRElement().getTagName().toLowerCase()); + assertEquals("button", doc.createButtonElement().getTagName().toLowerCase()); assertEquals("caption", doc.createCaptionElement().getTagName().toLowerCase()); assertEquals("col", doc.createColElement().getTagName().toLowerCase()); @@ -90,20 +91,6 @@ assertEquals("tr", doc.createTRElement().getTagName().toLowerCase()); assertEquals("ul", doc.createULElement().getTagName().toLowerCase()); - assertEquals("button", - doc.createPushButtonElement().getTagName().toLowerCase()); - assertEquals("button", - doc.createResetButtonElement().getTagName().toLowerCase()); - assertEquals("button", - doc.createSubmitButtonElement().getTagName().toLowerCase()); - - assertEquals("button", - doc.createPushButtonElement().getType().toLowerCase()); - assertEquals("reset", - doc.createResetButtonElement().getType().toLowerCase()); - assertEquals("submit", - doc.createSubmitButtonElement().getType().toLowerCase()); - assertEquals("input", doc.createCheckInputElement().getTagName().toLowerCase()); assertEquals("input", @@ -119,8 +106,6 @@ assertEquals("input", doc.createTextInputElement().getTagName().toLowerCase()); - assertEquals("button", - doc.createButtonInputElement().getType().toLowerCase()); assertEquals("checkbox", doc.createCheckInputElement().getType().toLowerCase()); assertEquals("file", doc.createFileInputElement().getType().toLowerCase()); @@ -131,9 +116,6 @@ doc.createPasswordInputElement().getType().toLowerCase()); assertEquals("radio", doc.createRadioInputElement("foo").getType().toLowerCase()); - assertEquals("reset", doc.createResetInputElement().getType().toLowerCase()); - assertEquals("submit", - doc.createSubmitInputElement().getType().toLowerCase()); assertEquals("text", doc.createTextInputElement().getType().toLowerCase()); } ======================================= --- /trunk/user/test/com/google/gwt/dom/client/ElementTest.java Thu Aug 27 09:33:30 2009 +++ /trunk/user/test/com/google/gwt/dom/client/ElementTest.java Fri Aug 28 06:46:54 2009 @@ -75,7 +75,7 @@ * Test round-trip of the 'disabled' property. */ public void testDisabled() { - ButtonElement button = Document.get().createPushButtonElement(); + ButtonElement button = Document.get().createButtonElement(); assertFalse(button.isDisabled()); button.setDisabled(true); assertTrue(button.isDisabled()); ======================================= --- /trunk/user/test/com/google/gwt/user/UISuite.java Thu Aug 27 13:38:45 2009 +++ /trunk/user/test/com/google/gwt/user/UISuite.java Fri Aug 28 06:46:54 2009 @@ -133,7 +133,6 @@ suite.addTestSuite(FlexTableTest.class); suite.addTestSuite(FlowPanelTest.class); suite.addTestSuite(FocusPanelTest.class); - // Old Mozilla complains about the cross-site forms in FormPanelTest. // suite.addTestSuite(FormPanelTest.class); suite.addTestSuite(GridTest.class); suite.addTestSuite(HiddenTest.class); ======================================= --- /trunk/user/test/com/google/gwt/user/client/ui/ButtonTest.java Thu Aug 27 09:33:30 2009 +++ /trunk/user/test/com/google/gwt/user/client/ui/ButtonTest.java Fri Aug 28 06:46:54 2009 @@ -19,16 +19,12 @@ import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.junit.client.GWTTestCase; -import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.ui.FormPanel.SubmitEvent; -import com.google.gwt.user.client.ui.FormPanel.SubmitHandler; /** * Tests for {...@link Button}. */ public class ButtonTest extends GWTTestCase { - @Override public String getModuleName() { return "com.google.gwt.user.User"; } @@ -42,26 +38,6 @@ clicked = true; } } - - private static class H2 implements SubmitHandler { - boolean submitted; - - public void onSubmit(SubmitEvent event) { - submitted = true; - event.cancel(); - } - } - - public void testButton() { - Button pushButton = new Button(); - assertEquals("button", pushButton.getButtonElement().getType()); - - ResetButton resetButton = new ResetButton(); - assertEquals("reset", resetButton.getButtonElement().getType()); - - SubmitButton submitButton = new SubmitButton(); - assertEquals("submit", submitButton.getButtonElement().getType()); - } public void testClick() { Button b = new Button(); @@ -77,30 +53,5 @@ // synthesized clicks. This tests the workaround in DOMImplMozillaOld. assertEquals(b.getElement(), h.target); } - - /** - * Tests issues 1585 and 3962: a button shouldn't submit a form. - */ - public void testPushButton() { - FormPanel f = new FormPanel(); - f.setAction("javascript:''"); - RootPanel.get().add(f); - - Button b = new Button(); - f.setWidget(b); - - final H2 h = new H2(); - f.addSubmitHandler(h); - - delayTestFinish(5000); - new Timer() { - @Override - public void run() { - assertFalse(h.submitted); - finishTest(); - } - }.schedule(2500); - - b.click(); - } -} +} + ======================================= --- /trunk/user/test/com/google/gwt/user/client/ui/FormPanelTest.java Thu Aug 27 13:38:45 2009 +++ /trunk/user/test/com/google/gwt/user/client/ui/FormPanelTest.java Fri Aug 28 06:46:54 2009 @@ -18,22 +18,18 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.InputElement; import com.google.gwt.junit.client.GWTTestCase; import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.ui.FormPanel.SubmitEvent; -import com.google.gwt.user.client.ui.FormPanel.SubmitHandler; import com.google.gwt.user.client.ui.HasWidgetsTester.WidgetAdder; /** * Tests the FormPanel. * - * @see com.google.gwt.user.server.ui.FormPanelTestServlet + * @see FormPanelTestServlet */ public class FormPanelTest extends GWTTestCase { public static boolean clicked = false; - @Override public String getModuleName() { return "com.google.gwt.user.FormPanelTest"; } @@ -165,48 +161,15 @@ form.submit(); } - - public void testNamedTargetSubmitEvent() { - // Create a form and frame in the document we can wrap. - String uid = Document.get().createUniqueId(); - HTML formAndFrame = new HTML( - "<form id='" - + uid - + "' method='post' target='targetFrame' action='" - + GWT.getModuleBaseURL() - + "formHandler?sendHappyHtml'>" - + "<input type='submit' id='submitBtn'></input></form>" - + "<iframe src='javascript:\'\'' id='targetMe' name='targetFrame'></iframe>"); - RootPanel.get().add(formAndFrame); - - // Wrap the form and make sure its target frame is intact. - FormPanel form = FormPanel.wrap(Document.get().getElementById(uid)); - assertEquals("targetFrame", form.getTarget()); - - // Ensure that no synthesized iframe was created. - assertNull(form.getSynthesizedIFrame()); - - // Submit the form using the submit button and make sure the submit event fires. - delayTestFinish(5000); - form.addSubmitHandler(new SubmitHandler() { - public void onSubmit(SubmitEvent event) { - finishTest(); - } - }); - - Document.get().getElementById("submitBtn").<InputElement>cast().click(); - } public void testReset() { FormPanel form = new FormPanel(); - RootPanel.get().add(form); TextBox textBox = new TextBox(); textBox.setText("Hello World"); form.setWidget(textBox); assertEquals("Hello World", textBox.getText()); form.reset(); assertEquals("", textBox.getText()); - RootPanel.get().remove(form); } public void testSubmitAndHideDialog() { @@ -256,7 +219,6 @@ delayTestFinish(10000); Timer t = new Timer() { - @Override public void run() { // Make sure the frame got the contents we expected. assertTrue(isHappyDivPresent(frame.getElement())); --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
