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: rjrjr@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10066 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java b/user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java
index 8eace4e..ede0383 100644
--- a/user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java
+++ b/user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java
@@ -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();
diff --git a/user/test/com/google/gwt/uibinder/UiBinderGwtSuite.java b/user/test/com/google/gwt/uibinder/UiBinderGwtSuite.java
index 54c8e37..e251075 100644
--- a/user/test/com/google/gwt/uibinder/UiBinderGwtSuite.java
+++ b/user/test/com/google/gwt/uibinder/UiBinderGwtSuite.java
@@ -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;
   }
diff --git a/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.InnerWidget.ui.xml b/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.InnerWidget.ui.xml
new file mode 100644
index 0000000..6e63bff
--- /dev/null
+++ b/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.InnerWidget.ui.xml
@@ -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>
diff --git a/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.java b/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.java
new file mode 100644
index 0000000..bc04e5c
--- /dev/null
+++ b/user/test/com/google/gwt/uibinder/test/client/InnerWidgetTest.java
@@ -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);
+  }
+}