Author: [email protected]
Date: Tue Mar 10 18:13:47 2009
New Revision: 4979
Removed:
releases/1.6/user/src/com/google/gwt/user/client/impl/DocumentRootImplSafari.java
Modified:
releases/1.6/user/src/com/google/gwt/dom/client/DOMImplIE6.java
releases/1.6/user/src/com/google/gwt/dom/client/DOMImplSafari.java
releases/1.6/user/src/com/google/gwt/dom/client/Document.java
releases/1.6/user/test/com/google/gwt/user/client/ui/RadioButtonTest.java
Log:
Sort / format / checkstyle cleanup.
Modified: releases/1.6/user/src/com/google/gwt/dom/client/DOMImplIE6.java
==============================================================================
--- releases/1.6/user/src/com/google/gwt/dom/client/DOMImplIE6.java
(original)
+++ releases/1.6/user/src/com/google/gwt/dom/client/DOMImplIE6.java Tue Mar
10 18:13:47 2009
@@ -148,26 +148,6 @@
/ getZoomMultiple(doc) + doc.getScrollTop());
}
- private native int getBoundingClientRectLeft(Element elem) /*-{
- // getBoundingClientRect() throws a JS exception if the elem is not
attached
- // to the document, so we wrap it in a try/catch block
- try {
- return elem.getBoundingClientRect().left;
- } catch (e) {
- return 0;
- }
- }-*/;
-
- private native int getBoundingClientRectTop(Element elem) /*-{
- // getBoundingClientRect() throws a JS exception if the elem is not
attached
- // to the document, so we wrap it in a try/catch block
- try {
- return elem.getBoundingClientRect().top;
- } catch (e) {
- return 0;
- }
- }-*/;
-
/**
* 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
@@ -241,6 +221,26 @@
@Override
public native void setInnerText(Element elem, String text) /*-{
elem.innerText = text || '';
+ }-*/;
+
+ private native int getBoundingClientRectLeft(Element elem) /*-{
+ // getBoundingClientRect() throws a JS exception if the elem is not
attached
+ // to the document, so we wrap it in a try/catch block
+ try {
+ return elem.getBoundingClientRect().left;
+ } catch (e) {
+ return 0;
+ }
+ }-*/;
+
+ private native int getBoundingClientRectTop(Element elem) /*-{
+ // getBoundingClientRect() throws a JS exception if the elem is not
attached
+ // to the document, so we wrap it in a try/catch block
+ try {
+ return elem.getBoundingClientRect().top;
+ } catch (e) {
+ return 0;
+ }
}-*/;
/**
Modified: releases/1.6/user/src/com/google/gwt/dom/client/DOMImplSafari.java
==============================================================================
--- releases/1.6/user/src/com/google/gwt/dom/client/DOMImplSafari.java
(original)
+++ releases/1.6/user/src/com/google/gwt/dom/client/DOMImplSafari.java Tue
Mar 10 18:13:47 2009
@@ -143,6 +143,20 @@
}-*/;
@Override
+ public int getScrollLeft(Document doc) {
+ // Safari always applies document scrolling to the body element, even
in
+ // strict mode.
+ return doc.getBody().getScrollLeft();
+ }
+
+ @Override
+ public int getScrollTop(Document doc) {
+ // Safari always applies document scrolling to the body element, even
in
+ // strict mode.
+ return doc.getBody().getScrollTop();
+ }
+
+ @Override
public native boolean isOrHasChild(Element parent, Element child) /*-{
while (child) {
if (parent == child) {
@@ -185,20 +199,6 @@
public native void selectRemoveOption(SelectElement select, int index)
/*-{
select.removeChild(select.children[index]);
}-*/;
-
- @Override
- public int getScrollLeft(Document doc) {
- // Safari always applies document scrolling to the body element, even
in
- // strict mode.
- return doc.getBody().getScrollLeft();
- }
-
- @Override
- public int getScrollTop(Document doc) {
- // Safari always applies document scrolling to the body element, even
in
- // strict mode.
- return doc.getBody().getScrollTop();
- }
@Override
public void setScrollLeft(Document doc, int left) {
Modified: releases/1.6/user/src/com/google/gwt/dom/client/Document.java
==============================================================================
--- releases/1.6/user/src/com/google/gwt/dom/client/Document.java
(original)
+++ releases/1.6/user/src/com/google/gwt/dom/client/Document.java Tue Mar
10 18:13:47 2009
@@ -1216,20 +1216,6 @@
}-*/;
/**
- * Gets the document's viewport element. This is the element that should
be
- * used to for scrolling and client-area measurement. In quirks-mode it
is the
- * <body> element, while in standards-mode it is the <html>
- * element.
- *
- * This is package-protected because the viewport is
- *
- * @return the document's viewport element
- */
- final Element getViewportElement() {
- return isCSS1Compat() ? getDocumentElement() : getBody();
- }
-
- /**
* Imports a node from another document to this document.
*
* The returned node has no parent; ({...@link Node#getParentNode()} is
null).
@@ -1293,4 +1279,18 @@
public final native void setTitle(String title) /*-{
this.title = title;
}-*/;
+
+ /**
+ * Gets the document's viewport element. This is the element that should
be
+ * used to for scrolling and client-area measurement. In quirks-mode it
is the
+ * <body> element, while in standards-mode it is the <html>
+ * element.
+ *
+ * This is package-protected because the viewport is
+ *
+ * @return the document's viewport element
+ */
+ final Element getViewportElement() {
+ return isCSS1Compat() ? getDocumentElement() : getBody();
+ }
}
Modified:
releases/1.6/user/test/com/google/gwt/user/client/ui/RadioButtonTest.java
==============================================================================
---
releases/1.6/user/test/com/google/gwt/user/client/ui/RadioButtonTest.java
(original)
+++
releases/1.6/user/test/com/google/gwt/user/client/ui/RadioButtonTest.java
Tue Mar 10 18:13:47 2009
@@ -32,6 +32,7 @@
private static class Changeable implements ValueChangeHandler<Boolean> {
Boolean received;
+
public void onValueChange(ValueChangeEvent<Boolean> event) {
received = event.getValue();
}
@@ -56,7 +57,7 @@
UIObjectTest.assertDebugId("myRadio-input", newInput);
UIObjectTest.assertDebugIdContents("myRadio-label", "myLabel");
}
-
+
/**
* Test the name and grouping methods.
*/
@@ -89,7 +90,7 @@
assertFalse(r2.getValue());
assertTrue(r3.getValue());
}
-
+
/**
* Test the name and grouping methods via deprecated calls.
*/
@@ -123,33 +124,33 @@
assertFalse(r2.isChecked());
assertTrue(r3.isChecked());
}
-
+
public void testValueChangeViaClick() {
RadioButton r1 = new RadioButton("group1", "Radio 1");
RadioButton r2 = new RadioButton("group1", "Radio 2");
RootPanel.get().add(r1);
RootPanel.get().add(r2);
r1.setValue(true);
-
+
Changeable c1 = new Changeable();
r1.addValueChangeHandler(c1);
-
+
Changeable c2 = new Changeable();
r2.addValueChangeHandler(c2);
-
+
// Brittle, but there's no public access
InputElement r1Radio = getRadioElement(r1);
InputElement r2Radio = getRadioElement(r2);
-
+
doClick(r1Radio);
assertEquals(null, c1.received);
assertEquals(null, c2.received);
-
+
doClick(r2Radio);
assertEquals(null, c1.received);
assertEquals(Boolean.TRUE, c2.received);
c2.received = null;
-
+
doClick(r1Radio);
assertEquals(Boolean.TRUE, c1.received);
assertEquals(null, c2.received);
@@ -161,70 +162,52 @@
RootPanel.get().add(r1);
RootPanel.get().add(r2);
r1.setValue(true);
-
+
Changeable c1 = new Changeable();
r1.addValueChangeHandler(c1);
-
+
Changeable c2 = new Changeable();
r2.addValueChangeHandler(c2);
-
+
LabelElement r1Label = getLabelElement(r1);
LabelElement r2Label = getLabelElement(r2);
-
+
doClick(r1Label);
assertEquals(null, c1.received);
assertEquals(null, c2.received);
-
+
doClick(r2Label);
assertEquals(null, c1.received);
assertEquals(Boolean.TRUE, c2.received);
c2.received = null;
-
+
doClick(r1Label);
assertEquals(Boolean.TRUE, c1.received);
assertEquals(null, c2.received);
}
private void doClick(Element elm) {
- NativeEvent e =
- Document.get().createMouseDownEvent(0, 25, 25, 25, 25, false,
false,
- false, false, NativeEvent.BUTTON_LEFT);
+ NativeEvent e = Document.get().createMouseDownEvent(0, 25, 25, 25, 25,
+ false, false, false, false, NativeEvent.BUTTON_LEFT);
elm.dispatchEvent(e);
e = Document.get().createMouseUpEvent(0, 25, 25, 25, 25, false, false,
- false, false, NativeEvent.BUTTON_LEFT);
+ false, false, NativeEvent.BUTTON_LEFT);
elm.dispatchEvent(e);
e = Document.get().createClickEvent(0, 25, 25, 25, 25, false, false,
false,
- false);
- elm.dispatchEvent(e);
- }
-
- private void doSpacebar(Element elm) {
- NativeEvent e =
- Document.get().createFocusEvent();
- elm.dispatchEvent(e);
-
- e = Document.get().createKeyDownEvent(false, false, false, false, 32,
32);
- elm.dispatchEvent(e);
-
- e = Document.get().createKeyPressEvent(false, false, false, false, 32,
32);
- elm.dispatchEvent(e);
-
- e = Document.get().createKeyUpEvent(false, false, false, false, 32,
32);
+ false);
elm.dispatchEvent(e);
}
private LabelElement getLabelElement(RadioButton radioButton) {
- LabelElement r1Label =
- LabelElement.as(Element.as(getRadioElement(radioButton)
- .getNextSiblingElement()));
+ LabelElement r1Label = LabelElement.as(Element.as(getRadioElement(
+ radioButton).getNextSiblingElement()));
return r1Label;
}
-
+
private InputElement getRadioElement(RadioButton radioButton) {
- InputElement r1Radio =
-
InputElement.as(Element.as(radioButton.getElement().getFirstChild()));
+ InputElement r1Radio =
InputElement.as(Element.as(radioButton.getElement().getFirstChild()));
return r1Radio;
}
}
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---