Revision: 10066
Author:   mdemp...@google.com
Date:     Mon Apr 25 11:52:46 2011
Log:      Change default UiBinder template file for inner classes from
pkg/Outer/Inner.ui.xml to pkg/Outer.Inner.ui.xml.

Fixes issue: 4776

Review at http://gwt-code-reviews.appspot.com/1423807

Review by: rj...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=10066

Added:
/trunk/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.InnerWidget.ui.xml
 /trunk/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.java
Modified:
 /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java
 /trunk/user/test/com/google/gwt/uibinder/UiBinderGwtSuite.java

=======================================
--- /dev/null
+++ /trunk/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.InnerWidget.ui.xml Mon Apr 25 11:52:46 2011
@@ -0,0 +1,4 @@
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+  xmlns:g="urn:import:com.google.gwt.user.client.ui">
+  <g:Label ui:field="greeting">Hello world</g:Label>
+</ui:UiBinder>
=======================================
--- /dev/null
+++ /trunk/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.java Mon Apr 25 11:52:46 2011
@@ -0,0 +1,51 @@
+/*
+ * 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.UiField;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Label;
+
+/**
+ * Test that UiBinder picks the correct template file for inner classes.
+ */
+public class InnerWidgetTest extends GWTTestCase {
+  static class InnerWidget extends Composite {
+    interface Binder extends UiBinder<Label, InnerWidget> {
+    }
+
+    static final Binder binder = GWT.create(Binder.class);
+
+    @UiField Label greeting;
+
+    InnerWidget() {
+      initWidget(binder.createAndBindUi(this));
+    }
+  }
+
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.uibinder.test.UiBinderTestApp";
+  }
+
+  public void testHappy() {
+    InnerWidget widget = new InnerWidget();
+    assertNotNull(widget.greeting);
+  }
+}
=======================================
--- /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java Fri Apr 22 11:18:50 2011 +++ /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java Mon Apr 25 11:52:46 2011
@@ -64,7 +64,7 @@
       if (interfaceType.getEnclosingType() != null) {
         interfaceType = interfaceType.getEnclosingType();
       }
- return slashify(interfaceType.getQualifiedSourceName()) + TEMPLATE_SUFFIX; + return slashify(interfaceType.getQualifiedBinaryName()) + TEMPLATE_SUFFIX;
     } else {
       templateName = annotation.value();
       if (!templateName.endsWith(TEMPLATE_SUFFIX)) {
@@ -88,7 +88,7 @@
   }

   private static String slashify(String s) {
-    return s.replace(".", "/");
+    return s.replace(".", "/").replace("$", ".");
   }

   private final UiBinderContext uiBinderCtx = new UiBinderContext();
=======================================
--- /trunk/user/test/com/google/gwt/uibinder/UiBinderGwtSuite.java Wed Feb 3 14:30:31 2010 +++ /trunk/user/test/com/google/gwt/uibinder/UiBinderGwtSuite.java Mon Apr 25 11:52:46 2011
@@ -17,6 +17,7 @@

 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;

@@ -33,6 +34,7 @@
     suite.addTestSuite(UiBinderTest.class);
     suite.addTestSuite(UiBinderUtilTest.class);
     suite.addTestSuite(TestParameterizedWidgets.class);
+    suite.addTestSuite(InnerWidgetTest.class);

     return suite;
   }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to