Reviewers: ,

Message:
I'm looking for a reviewer: who's in charge of UiBinder these days?

Note that this patch doesn't address the TODO, as that'd mean
refactoring UiBinder too to pass the GeneratorContext down to the
ImplicitCssResource (through ImplicitClientBundle).

Description:
Issue 7230: allow absolute paths in ui:style's src=""


Please review this at https://gwt-code-reviews.appspot.com/1660804/

Affected files:
  M user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java
  M user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml


Index: user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java diff --git a/user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java b/user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java index 5a2b817372565a1e149e5662760b6f92cbc55e72..63e7b0d38dd1e6eb31d181fb4604459ece511277 100644
--- a/user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java
+++ b/user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java
@@ -193,8 +193,16 @@ public class ImplicitCssResource {

     for (String s : sources) {
       String resourcePath = path + '/' + s;
+      // Try to find the resource relative to the package.
       URL found = classLoader.getResource(resourcePath);
-      if (null == found) {
+      /*
+       * If we didn't find the resource relative to the package, assume it
+       * is absolute.
+       */
+      if (found == null) {
+        found = classLoader.getResource(s);
+      }
+      if (found == null) {
         logger.die("Unable to find resource: " + resourcePath);
       }
       urls.add(found);
Index: user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml
diff --git a/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml b/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml index 93b818ff31bb10023d18e6fc9d51c6650992105a..1365691c7c9d69f64a562c5e9df4a49f62265076 100644
--- a/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml
+++ b/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml
@@ -107,7 +107,7 @@
 <!--
   Tests creating a CssResource from an external file.
  -->
-<ui:style field='myStyle' src='WidgetBasedUi.css Menu.css'
+<ui:style field='myStyle' src='WidgetBasedUi.css com/google/gwt/uibinder/test/client/Menu.css'
     type='com.google.gwt.uibinder.test.client.WidgetBasedUi.Style'>
     .menuBar {
       font-family: sans-serif;


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

Reply via email to