Reviewers: rdayal,
Description:
Resubmitting code review 1660804
Allow absolute paths in ui:style's src=""
Thanks Thomas!
Fixes issue: 7230
Review by: rda...@google.com
Please review this at http://gwt-code-reviews.appspot.com/1716803/
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
===================================================================
--- user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java
(revision 10982)
+++ user/src/com/google/gwt/uibinder/rebind/model/ImplicitCssResource.java
(working copy)
@@ -193,8 +193,16 @@
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
===================================================================
--- user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml
(revision 10982)
+++ user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml
(working copy)
@@ -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