Ok, here's the example code:
---------------------------------------------------------------
public class Settings {
/**
* The size of the blocks to draw on the client-side, in pixels.
*/
public static final int PIXEL_SIZE = 5;
/**
* The length of the array to draw on the client-side.
*/
public static final int MAX = 100;
/**
* The HTML ID for the canvas that is drawn.
*/
public static final String CANVAS_ID = "drawingCanvas";
public static final String APP_ID = "appPanel";
public static final String CLIENTID = "clientId";
public static final String FUNCNAME = "funcName";
public static final String CODE = "code";
public static final int LIST_SIZE = 200;
public int listSize() {
return LIST_SIZE;
}
public int mainSize() {
return canvasSize() + LIST_SIZE;
}
public int canvasSize() {
return PIXEL_SIZE * MAX;
}
}
public interface Resources extends ClientBundle {
@Source("ShowSort.css")
Style style();
GwtCreateResource<Settings> settings();
public interface Style extends CssResource {
public String customFlowPanel();
public String algobutton();
public String notlive();
}
}
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:graph='urn:import:com.google.gwt.widgetideas.graphics.client'>
<ui:with field="res" type="org.darkhelm.showsort.client.Resources"/
>
<g:HTMLPanel>
<graph:GWTCanvas ui:field="canvas"
pixelWidth="{res.settings.canvasSize}"
pixelHeight="{res.settings.canvasSize}"/>
</g:HTMLPanel>
</ui:UiBinder>
---------------------------------------------------------------
The problem I am having, is it is failing to provide access to the
methods in my Settings class, I have three defined, with zero-args. I
am trying to access the canvasSize() method within the above uibinder
XML file, and compilation is failing with the following:
---------------------------------------------------------------
Scanning for additional dependencies: file:/E:/Documents/NetBeans/
ShowSort/src/java/org/darkhelm/showsort/client/display/Display.java
Computing all possible rebind results for
'org.darkhelm.showsort.client.display.Display.DisplayUiBinder'
Rebinding
org.darkhelm.showsort.client.display.Display.DisplayUiBinder
Invoking
com.google.gwt.dev.javac.standardgeneratorcont...@1ebd825
validating {res.settings.canvasSize}
[ERROR] Could not find no-arg method named
canvasSize in type com.google.gwt.resources.client.GwtCreateResource
[ERROR] Errors in 'file:/E:/Documents/NetBeans/ShowSort/src/java/
org/darkhelm/showsort/client/display/Display.java'
[ERROR] Line 49: Failed to resolve
'org.darkhelm.showsort.client.display.Display.DisplayUiBinder' via
deferred binding
Scanning for additional dependencies:
generated://51C155C0C4847D2F0E6091D0115F8667/org/darkhelm/showsort/client/org_darkhelm_showsort_client_Resources_default_StaticClientBundleGenerator.java
[WARN] For the following type(s), generated source was never
committed (did you forget to call commit()?)
[WARN]
org.darkhelm.showsort.client.display.Display_DisplayUiBinderImpl
[ERROR] Cannot proceed due to previous errors
---------------------------------------------------------------
I'm at a loss, it says there is no "no-arg" method named canvasSize in
the GwtCreateResource type. I must be doing something wrong here.
What I am trying to do, is have the parameters I define in
Settings.java to be able to be accessed through the ClientBundle,
eventually so then I can use them within my own defined CssResource
(the ShowSort.css resource in Resources.java above), through the use
of the value() function in CSS, as defined here:
http://code.google.com/p/google-web-toolkit/wiki/CssResource#Value_function
I want to programattically be able to define/set some of the
parameters used in the CSS code, with the same Settings class I have
being used for my server & client code currently. But for me to be
able to make this work, I need to be able to have the Settings values
be available in the ClientBundle that contains the CssResource, from
my understanding. This doesn't seem to be working... I thought
GwtCreateResource<> was the correct thing to use, but it is failing.
Please help :)
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.