Author: [email protected]
Date: Mon Jul 6 08:09:11 2009
New Revision: 5667
Modified:
trunk/user/src/com/google/gwt/resources/rg/CssResourceGenerator.java
trunk/user/test/com/google/gwt/resources/client/CSSResourceTest.java
Log:
Allow CssResource @url syntax to find DataResource methods declared in
bundle super-interfaces.
Misc formatting cleanups.
Patch by: nwolf
Review by: bobv
Modified:
trunk/user/src/com/google/gwt/resources/rg/CssResourceGenerator.java
==============================================================================
--- trunk/user/src/com/google/gwt/resources/rg/CssResourceGenerator.java
(original)
+++ trunk/user/src/com/google/gwt/resources/rg/CssResourceGenerator.java
Mon Jul 6 08:09:11 2009
@@ -946,10 +946,18 @@
String functionName =
def.getValues().get(0).isIdentValue().getIdent();
// Find the method
- JMethod method = context.getClientBundleType().findMethod(
- functionName, new JType[0]);
+ JMethod methods[] =
context.getClientBundleType().getOverridableMethods();
+ boolean foundMethod = false;
+ if (methods != null) {
+ for (JMethod method : methods) {
+ if (method.getName().equals(functionName)) {
+ foundMethod = true;
+ break;
+ }
+ }
+ }
- if (method == null) {
+ if (!foundMethod) {
logger.log(TreeLogger.ERROR, "Unable to find DataResource
method "
+ functionName + " in "
+ context.getClientBundleType().getQualifiedSourceName());
Modified:
trunk/user/test/com/google/gwt/resources/client/CSSResourceTest.java
==============================================================================
--- trunk/user/test/com/google/gwt/resources/client/CSSResourceTest.java
(original)
+++ trunk/user/test/com/google/gwt/resources/client/CSSResourceTest.java
Mon Jul 6 08:09:11 2009
@@ -28,6 +28,13 @@
*/
public class CSSResourceTest extends GWTTestCase {
+ interface ChildResources extends Resources {
+ ChildResources INSTANCE = GWT.create(ChildResources.class);
+
+ @Source("16x16.png")
+ ImageResource spriteMethod();
+ }
+
interface ConcatenatedResources extends ClientBundle {
@Source(value = {"concatenatedA.css", "concatenatedB.css"})
@Strict
@@ -44,10 +51,10 @@
String lengthString();
int overrideInt();
-
+
@ClassName("overrideInt")
String overrideIntClass();
-
+
double percentFloat();
int percentInt();
@@ -168,6 +175,14 @@
System.out.println(s);
}
+ public void testChildResources() {
+ Resources parentResource = GWT.create(Resources.class);
+ ChildResources childResource = GWT.create(ChildResources.class);
+
+ assertEquals(parentResource.dataMethod().getName(),
+ childResource.dataMethod().getName());
+ }
+
public void testConcatenatedResource() {
ConcatenatedResources r = GWT.create(ConcatenatedResources.class);
String text = r.css().getText();
@@ -270,7 +285,7 @@
assertEquals("100px", defines.lengthString());
assertEquals("#f00", defines.colorString());
-
+
assertEquals(10, defines.overrideInt());
assertNotNull(defines.overrideIntClass());
assertFalse("10px".equals(defines.overrideIntClass()));
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---