Revision: 10110
Author: [email protected]
Date: Thu Apr 28 13:42:59 2011
Log: Rollback of r10107 due to broken ui binder templates
Was
Add ability to include SafeHtml objects in dom based UI's if the lazy
widget option is being used (this is the only way that the setters
will work correctly).
Adds missing integration test for @UiChild, covering bug exposed by
the first shot at this change. Tidies the UiBinder test suites in the
process.
Also fixes some warnings in UiBinderWriter.
Restores r10100 (rolled back in r10103)
http://code.google.com/p/google-web-toolkit/source/detail?r=10110
Added:
/trunk/user/test/com/google/gwt/uibinder/UiBinderGwtSuite.java
/trunk/user/test/com/google/gwt/uibinder/test/client/TestParameterizedWidgets.java
Deleted:
/trunk/user/test/com/google/gwt/uibinder/LazyWidgetBuilderSuite.java
/trunk/user/test/com/google/gwt/uibinder/UiBinderSuite.java
/trunk/user/test/com/google/gwt/uibinder/test/LazyWidgetBuilderSuite.gwt.xml
/trunk/user/test/com/google/gwt/uibinder/test/UiBinderSuite.gwt.xml
/trunk/user/test/com/google/gwt/uibinder/test/client/ParameterizedWidgetsTest.java
/trunk/user/test/com/google/gwt/uibinder/test/client/SafeHtmlAsComponentsTest.Ui.ui.xml
/trunk/user/test/com/google/gwt/uibinder/test/client/SafeHtmlAsComponentsTest.java
/trunk/user/test/com/google/gwt/uibinder/test/client/SafeHtmlObject.java
/trunk/user/test/com/google/gwt/uibinder/test/client/UiChildTest.Ui.ui.xml
/trunk/user/test/com/google/gwt/uibinder/test/client/UiChildTest.java
Modified:
/trunk/user/src/com/google/gwt/uibinder/elementparsers/HtmlInterpreter.java
/trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java
/trunk/user/test/com/google/gwt/uibinder/All.java
/trunk/user/test/com/google/gwt/uibinder/client/UiBinderUtilTest.java
/trunk/user/test/com/google/gwt/uibinder/elementparsers/AbsolutePanelParserTest.java
/trunk/user/test/com/google/gwt/uibinder/test/UiBinderTestApp.gwt.xml
/trunk/user/test/com/google/gwt/uibinder/test/UiJavaResources.java
/trunk/user/test/com/google/gwt/uibinder/test/client/Abstract.java
/trunk/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.java
/trunk/user/test/com/google/gwt/uibinder/test/client/ParameterizedWidget.java
/trunk/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java
=======================================
--- /dev/null
+++ /trunk/user/test/com/google/gwt/uibinder/UiBinderGwtSuite.java Thu Apr
28 13:42:59 2011
@@ -0,0 +1,44 @@
+/*
+ * 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.uibinder;
+
+import com.google.gwt.junit.tools.GWTTestSuite;
+import com.google.gwt.uibinder.client.UiBinderUtilTest;
+import com.google.gwt.uibinder.test.client.InnerWidgetTest;
+import com.google.gwt.uibinder.test.client.TestParameterizedWidgets;
+import com.google.gwt.uibinder.test.client.UiBinderTest;
+
+import junit.framework.Test;
+
+/**
+ * Test suite for UiBinder GWTTestCases.
+ */
+public class UiBinderGwtSuite {
+ public static Test suite() {
+ GWTTestSuite suite = new GWTTestSuite(
+ "Test suite for UiBinder GWTTestCases");
+
+ suite.addTestSuite(UiBinderTest.class);
+ suite.addTestSuite(UiBinderUtilTest.class);
+ suite.addTestSuite(TestParameterizedWidgets.class);
+ suite.addTestSuite(InnerWidgetTest.class);
+
+ return suite;
+ }
+
+ private UiBinderGwtSuite() {
+ }
+}
=======================================
--- /dev/null
+++
/trunk/user/test/com/google/gwt/uibinder/test/client/TestParameterizedWidgets.java
Thu Apr 28 13:42:59 2011
@@ -0,0 +1,33 @@
+/*
+ * 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.uibinder.test.client;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Test that {@literal @}UiFactory and parameterized return types get
along.
+ */
+public class TestParameterizedWidgets extends GWTTestCase {
+ @Override
+ public String getModuleName() {
+ return "com.google.gwt.uibinder.test.UiBinderTestApp";
+ }
+
+ public void testHappy() {
+ ParameterizedWidget<String> ui = new ParameterizedWidget<String>();
+ assertNotNull(ui.fromFactory);
+ }
+}
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/LazyWidgetBuilderSuite.java
Thu Apr 28 15:24:12 2011
+++ /dev/null
@@ -1,38 +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.uibinder;
-
-import com.google.gwt.junit.tools.GWTTestSuite;
-import com.google.gwt.uibinder.test.client.SafeHtmlAsComponentsTest;
-
-import junit.framework.Test;
-
-/**
- * Test suite for UiBinder GWTTestCases.
- */
-public class LazyWidgetBuilderSuite {
- public static Test suite() {
- GWTTestSuite suite = new GWTTestSuite(
- "Tests that rely on the useLazyWidgetBuilders switch");
-
- suite.addTestSuite(SafeHtmlAsComponentsTest.class);
-
- return suite;
- }
-
- private LazyWidgetBuilderSuite() {
- }
-}
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/UiBinderSuite.java Thu Apr 28
15:24:12 2011
+++ /dev/null
@@ -1,46 +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.uibinder;
-
-import com.google.gwt.junit.tools.GWTTestSuite;
-import com.google.gwt.uibinder.client.UiBinderUtilTest;
-import com.google.gwt.uibinder.test.client.InnerWidgetTest;
-import com.google.gwt.uibinder.test.client.ParameterizedWidgetsTest;
-import com.google.gwt.uibinder.test.client.UiBinderTest;
-import com.google.gwt.uibinder.test.client.UiChildTest;
-
-import junit.framework.Test;
-
-/**
- * Test suite for UiBinder GWTTestCases.
- */
-public class UiBinderSuite {
- public static Test suite() {
- GWTTestSuite suite = new GWTTestSuite(
- "Integration tests for UiBinder");
-
- suite.addTestSuite(InnerWidgetTest.class);
- suite.addTestSuite(UiBinderTest.class);
- suite.addTestSuite(UiBinderUtilTest.class);
- suite.addTestSuite(UiChildTest.class);
- suite.addTestSuite(ParameterizedWidgetsTest.class);
-
- return suite;
- }
-
- private UiBinderSuite() {
- }
-}
=======================================
---
/trunk/user/test/com/google/gwt/uibinder/test/LazyWidgetBuilderSuite.gwt.xml
Thu Apr 28 15:24:12 2011
+++ /dev/null
@@ -1,19 +0,0 @@
-<!-- Copyright 2011 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 -->
-<!-- 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. License for the specific language governing permissions
and -->
-<!-- limitations under the
License. -->
-
-<!-- Tests that rely on the useLazyWidgetBuilders
switch -->
-<module>
- <inherits name="com.google.gwt.user.User" />
- <inherits name="com.google.gwt.debug.Debug"/>
- <set-configuration-property name="UiBinder.useLazyWidgetBuilders"
value="true"/>
-</module>
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/test/UiBinderSuite.gwt.xml Thu
Apr 28 15:24:12 2011
+++ /dev/null
@@ -1,18 +0,0 @@
-<!-- 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 -->
-<!-- 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. License for the specific language governing permissions
and -->
-<!-- limitations under the
License. -->
-
-<!-- UiBinder integration
tests -->
-<module>
- <inherits name="com.google.gwt.user.User" />
- <inherits name="com.google.gwt.debug.Debug"/>
-</module>
=======================================
---
/trunk/user/test/com/google/gwt/uibinder/test/client/ParameterizedWidgetsTest.java
Thu Apr 28 15:24:12 2011
+++ /dev/null
@@ -1,33 +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.uibinder.test.client;
-
-import com.google.gwt.junit.client.GWTTestCase;
-
-/**
- * Test that {@literal @}UiFactory and parameterized return types get
along.
- */
-public class ParameterizedWidgetsTest extends GWTTestCase {
- @Override
- public String getModuleName() {
- return "com.google.gwt.uibinder.test.UiBinderSuite";
- }
-
- public void testHappy() {
- ParameterizedWidget<String> ui = new ParameterizedWidget<String>();
- assertNotNull(ui.fromFactory);
- }
-}
=======================================
---
/trunk/user/test/com/google/gwt/uibinder/test/client/SafeHtmlAsComponentsTest.Ui.ui.xml
Thu Apr 28 15:24:12 2011
+++ /dev/null
@@ -1,21 +0,0 @@
-<!--
-->
-<!-- Copyright 2011 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 -->
-<!-- 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. License for the specific language governing permissions
and -->
-<!-- limitations under the
License. -->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:demo='urn:import:com.google.gwt.uibinder.test.client'
- >
- <div>
- <div ui:field='div'><demo:SafeHtmlObject ui:field='safeObject'
name="Bob" /></div>
- </div>
-</ui:UiBinder>
=======================================
---
/trunk/user/test/com/google/gwt/uibinder/test/client/SafeHtmlAsComponentsTest.java
Thu Apr 28 15:24:12 2011
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2011 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.uibinder.test.client;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.DivElement;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.junit.client.GWTTestCase;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-
-/**
- * Test the use of SafeHtml objects as UiBinder components. E.g.
- *
- * <pre>
- * <div><my:SafeHtmlThingy foo="bar"/></div></pre>
- */
-public class SafeHtmlAsComponentsTest extends GWTTestCase {
- static class Ui {
- interface Binder extends UiBinder<Element, Ui> {
- }
-
- static final Binder binder = GWT.create(Binder.class);
-
- @UiField
- DivElement div;
- @UiField
- SafeHtmlObject safeObject;
-
- Ui() {
- binder.createAndBindUi(this);
- }
- }
-
- @Override
- public String getModuleName() {
- return "com.google.gwt.uibinder.test.LazyWidgetBuilderSuite";
- }
-
- public void testSafeHtml() {
- Ui domUi = new Ui();
- assertNotNull(domUi.safeObject);
- assertEquals(domUi.safeObject.asString(), domUi.div.getInnerHTML());
- assertEquals("Hello <b>Bob</b>".toLowerCase(),
domUi.div.getInnerHTML().toLowerCase());
- }
-}
=======================================
---
/trunk/user/test/com/google/gwt/uibinder/test/client/SafeHtmlObject.java
Thu Apr 28 15:24:12 2011
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2011 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.uibinder.test.client;
-
-import com.google.gwt.safehtml.shared.SafeHtml;
-
-/**
- * Used by UiBinderTest.
- */
-public class SafeHtmlObject implements SafeHtml {
- private String name = "unset";
-
- @Override
- public String asString() {
- return "Hello <b>" + name + "</b>";
- }
-
- public void setName(String name) {
- // Bad - should escape this name
- this.name = name;
- }
-}
=======================================
---
/trunk/user/test/com/google/gwt/uibinder/test/client/UiChildTest.Ui.ui.xml
Thu Apr 28 15:24:12 2011
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-->
-<!-- Copyright 2011 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 -->
-<!-- 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. License for the specific language governing permissions
and -->
-<!-- limitations under the
License. -->
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:test='urn:import:com.google.gwt.uibinder.test.client'
- >
- <g:HTMLPanel>
- <test:UiChildTest.MyPanel ui:field="panel">
- <test:childAsInterface>
- <test:UiChildTest.MyView ui:field="asInterface" name="interface"/>
- </test:childAsInterface>
- <test:childAsImpl>
- <test:UiChildTest.MyViewImpl ui:field="asImpl" name="impl"/>
- </test:childAsImpl>
- </test:UiChildTest.MyPanel>
- </g:HTMLPanel>
-</ui:UiBinder>
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/test/client/UiChildTest.java
Thu Apr 28 15:24:12 2011
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2011 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.uibinder.test.client;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.junit.client.GWTTestCase;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiChild;
-import com.google.gwt.uibinder.client.UiFactory;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.IsWidget;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * Integration tests of @UiChild.
- */
-public class UiChildTest extends GWTTestCase {
- static class MyPanel extends FlowPanel {
- @UiChild(tagname = "childAsImpl")
- public void addChildAsImpl(MyViewImpl child) {
- this.add(child);
- }
-
- @UiChild(tagname = "childAsInterface")
- public void addChildAsInterface(MyView child) {
- this.add(child);
- }
- }
-
- interface MyView extends IsWidget {
- String getName();
-
- void setName(String name);
- }
-
- static class MyViewImpl extends Composite implements MyView {
- MyViewImpl() {
- initWidget(new Label());
- }
-
- public String getName() {
- return asLabel().getText();
- }
-
- public void setName(String name) {
- asLabel().setText(name);
- }
-
- private Label asLabel() {
- return ((Label) getWidget());
- }
- }
-
- static class Ui extends Composite {
- interface Binder extends UiBinder<HTMLPanel, Ui> {
- }
-
- static final Binder BINDER = GWT.create(Binder.class);
-
- @UiField
- MyViewImpl asImpl;
-
- @UiField
- MyView asInterface;
-
- @UiField
- MyPanel panel;
-
- Ui() {
- initWidget(BINDER.createAndBindUi(this));
- }
-
- @Override
- public Widget asWidget() {
- return this;
- }
-
- @UiFactory
- MyView createForInterface() {
- return new MyViewImpl();
- }
- }
-
- Ui subject;
-
- @Override
- public String getModuleName() {
- return "com.google.gwt.uibinder.test.UiBinderSuite";
- }
-
- public void testIsWidget() {
- assertNotNull(subject.asImpl);
- assertEquals("interface", subject.asInterface.getName());
- assertSame(subject.panel, subject.asInterface.asWidget().getParent());
- }
-
- public void testSimple() {
- assertNotNull(subject.asImpl);
- assertEquals("impl", subject.asImpl.getName());
- assertSame(subject.panel, subject.asImpl.getParent());
- }
-
- @Override
- protected void gwtSetUp() {
- subject = new Ui();
- }
-}
=======================================
---
/trunk/user/src/com/google/gwt/uibinder/elementparsers/HtmlInterpreter.java
Thu Apr 28 15:24:12 2011
+++
/trunk/user/src/com/google/gwt/uibinder/elementparsers/HtmlInterpreter.java
Thu Apr 28 13:42:59 2011
@@ -16,7 +16,6 @@
package com.google.gwt.uibinder.elementparsers;
import com.google.gwt.core.ext.UnableToCompleteException;
-import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.uibinder.rebind.UiBinderWriter;
import com.google.gwt.uibinder.rebind.XMLElement;
import com.google.gwt.uibinder.rebind.XMLElement.Interpreter;
@@ -85,11 +84,6 @@
if (writer.isWidgetElement(elem)) {
writer.die(elem, "Found widget in an HTML context");
}
- if (writer.useLazyWidgetBuilders() &&
- writer.isSubclassOf(elem, SafeHtml.class)) {
- String childFieldName = writer.parseElementToField(elem);
- return writer.tokenForSafeHtmlExpression(childFieldName);
- }
return pipe.interpretElement(elem);
}
}
=======================================
--- /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java Thu
Apr 28 15:24:12 2011
+++ /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java Thu
Apr 28 13:42:59 2011
@@ -39,7 +39,6 @@
import com.google.gwt.uibinder.rebind.model.OwnerClass;
import com.google.gwt.uibinder.rebind.model.OwnerField;
import com.google.gwt.user.client.ui.Attachable;
-import com.google.gwt.user.client.ui.IsWidget;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -558,7 +557,7 @@
throws UnableToCompleteException {
String tagName = elem.getLocalName();
- if (!isImportedElement(elem)) {
+ if (!isWidgetElement(elem)) {
return findDomElementTypeForTag(tagName);
}
@@ -674,19 +673,9 @@
return uri != null && UiBinderGenerator.BINDER_URI.equals(uri);
}
- public boolean isSubclassOf(XMLElement elem, Class<?> clazz)
- throws UnableToCompleteException {
- JClassType t = findFieldType(elem);
- if (t == null) {
- return false;
- }
- JClassType widgetType = oracle.findType(clazz.getCanonicalName());
- return t.isAssignableTo(widgetType);
- }
-
- public boolean isWidgetElement(XMLElement elem)
- throws UnableToCompleteException {
- return isSubclassOf(elem, IsWidget.class);
+ public boolean isWidgetElement(XMLElement elem) {
+ String uri = elem.getNamespaceUri();
+ return uri != null && uri.startsWith(PACKAGE_URI_SCHEME);
}
/**
@@ -781,29 +770,32 @@
* {@link com.google.gwt.safehtml.shared.SafeHtmlUtils#fromSafeConstant}
to
* keep the expression from being escaped by the SafeHtml template.
*
- * @param expression must resolve to trusted HTML string
+ * @param expression
*/
public String tokenForSafeConstant(String expression) {
if (!useSafeHtmlTemplates) {
return tokenForStringExpression(expression);
}
- expression = "SafeHtmlUtils.fromSafeConstant(" + expression + ")";
- htmlTemplates.noteSafeConstant(expression);
- return tokenator.nextToken(expression);
+ String token = tokenator.nextToken("SafeHtmlUtils.fromSafeConstant(" +
+ expression + ")");
+ htmlTemplates.noteSafeConstant("SafeHtmlUtils.fromSafeConstant(" +
+ expression + ")");
+ return token;
}
/**
- * Like {@link #tokenForStringExpression}, but used for runtime
- * {@link com.google.gwt.safehtml.shared.SafeHtml SafeHtml} instances.
- *
- * @param expression must resolve to SafeHtml object
+ * Like {@link #tokenForStringExpression}, but used for runtime {@link
SafeHtml}
+ * instances.
+ *
+ * @param expression
*/
public String tokenForSafeHtmlExpression(String expression) {
if (!useSafeHtmlTemplates) {
return tokenForStringExpression(expression);
}
+ String token = tokenator.nextToken(expression);
htmlTemplates.noteSafeConstant(expression);
return tokenator.nextToken(expression);
}
@@ -816,7 +808,7 @@
* setInnerHTML() and setText() calls, to allow a unique dom id
attribute or
* other runtime expression in the string.
*
- * @param expression must resolve to String
+ * @param expression
*/
public String tokenForStringExpression(String expression) {
return tokenator.nextToken(("\" + " + expression + " + \""));
@@ -1034,11 +1026,6 @@
return parsers;
}
-
- private boolean isImportedElement(XMLElement elem) {
- String uri = elem.getNamespaceUri();
- return uri != null && uri.startsWith(PACKAGE_URI_SCHEME);
- }
/**
* Writes a field setter if the field is not provided and the field
class is
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/All.java Thu Apr 28 15:24:12
2011
+++ /trunk/user/test/com/google/gwt/uibinder/All.java Thu Apr 28 13:42:59
2011
@@ -32,7 +32,7 @@
GWTTestSuite suite = new GWTTestSuite("All UiBinder tests");
suite.addTest(UiBinderJreSuite.suite());
- suite.addTest(UiBinderSuite.suite());
+ suite.addTest(UiBinderGwtSuite.suite());
return suite;
}
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/client/UiBinderUtilTest.java
Thu Apr 28 15:24:12 2011
+++ /trunk/user/test/com/google/gwt/uibinder/client/UiBinderUtilTest.java
Thu Apr 28 13:42:59 2011
@@ -32,7 +32,7 @@
@Override
public String getModuleName() {
- return "com.google.gwt.uibinder.test.UiBinderSuite";
+ return "com.google.gwt.uibinder.UiBinder";
}
public void testAttachToDomAndGetChildUnattached() {
=======================================
---
/trunk/user/test/com/google/gwt/uibinder/elementparsers/AbsolutePanelParserTest.java
Thu Apr 28 15:24:12 2011
+++
/trunk/user/test/com/google/gwt/uibinder/elementparsers/AbsolutePanelParserTest.java
Thu Apr 28 13:42:59 2011
@@ -95,7 +95,7 @@
b.append(" <g:at left='1' top='2'>");
b.append(" <g:Button/>");
b.append(" </g:at>");
- b.append(" <g:Label/>");
+ b.append(" <g:TextBox/>");
b.append(" <g:at left='10' top='20'>");
b.append(" <g:Label/>");
b.append(" </g:at>");
@@ -104,7 +104,7 @@
tester.parse(b.toString());
assertStatements("fieldName.add(<g:Button>, 1, 2);",
- "fieldName.add(<g:Label>);", "fieldName.add(<g:Label>, 10, 20);");
+ "fieldName.add(<g:TextBox>);", "fieldName.add(<g:Label>, 10,
20);");
}
private void assertStatements(String... expected) {
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/test/UiBinderTestApp.gwt.xml
Thu Apr 28 15:24:12 2011
+++ /trunk/user/test/com/google/gwt/uibinder/test/UiBinderTestApp.gwt.xml
Thu Apr 28 13:42:59 2011
@@ -11,7 +11,7 @@
<!-- implied. License for the specific language governing permissions
and -->
<!-- limitations under the
License. -->
-<!-- Allows the test app to be run
directly. -->
+<!-- GWT UiBinder
support. -->
<module>
<inherits name="com.google.gwt.user.User" />
<inherits name="com.google.gwt.debug.Debug"/>
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/test/UiJavaResources.java Thu
Apr 28 15:24:12 2011
+++ /trunk/user/test/com/google/gwt/uibinder/test/UiJavaResources.java Thu
Apr 28 13:42:59 2011
@@ -648,8 +648,7 @@
public CharSequence getContent() {
StringBuffer code = new StringBuffer();
code.append("package com.google.gwt.user.client.ui;\n");
- code.append("public class Widget extends UIObject implements
IsWidget {\n");
- code.append(" public Widget asWidget() { return this; }");
+ code.append("public class Widget extends UIObject {\n");
code.append("}\n");
return code;
}
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/test/client/Abstract.java Thu
Apr 28 15:24:12 2011
+++ /trunk/user/test/com/google/gwt/uibinder/test/client/Abstract.java Thu
Apr 28 13:42:59 2011
@@ -20,7 +20,7 @@
/**
* Used by {@link ParameterizedWidget}.
- * @see ParameterizedWidgetsTest
+ * @see TestParameterizedWidgets
*/
abstract class Abstract<T> extends Widget {
Abstract() {
=======================================
---
/trunk/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.java
Thu Apr 28 15:24:12 2011
+++
/trunk/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.java
Thu Apr 28 13:42:59 2011
@@ -41,7 +41,7 @@
@Override
public String getModuleName() {
- return "com.google.gwt.uibinder.test.UiBinderSuite";
+ return "com.google.gwt.uibinder.test.UiBinderTestApp";
}
public void testHappy() {
=======================================
---
/trunk/user/test/com/google/gwt/uibinder/test/client/ParameterizedWidget.java
Thu Apr 28 15:24:12 2011
+++
/trunk/user/test/com/google/gwt/uibinder/test/client/ParameterizedWidget.java
Thu Apr 28 13:42:59 2011
@@ -23,7 +23,7 @@
import com.google.gwt.user.client.ui.Widget;
/**
- * Used by {@link ParameterizedWidgetsTest}.
+ * Used by {@link TestParameterizedWidgets}.
*/
class ParameterizedWidget<T> extends Composite {
interface Binder extends UiBinder<Widget, ParameterizedWidget<?>> {
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java
Thu Apr 28 15:24:12 2011
+++ /trunk/user/test/com/google/gwt/uibinder/test/client/UiBinderTest.java
Thu Apr 28 13:42:59 2011
@@ -53,7 +53,7 @@
@Override
public String getModuleName() {
- return "com.google.gwt.uibinder.test.UiBinderSuite";
+ return "com.google.gwt.uibinder.test.UiBinderTestApp";
}
@Override
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors