-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use style properties on SVGImage in UiBinder #15
Comments
Hi, I have not been able to reproduce the probem. Here is what I have attempted.
is changed to:
I then rebuilt the code, and looked at the code generated by GWT/UiBinder for this part, in target/gen/org/vectomatic/svg/samples/client/widgets/WidgetsSample_WidgetsSampleBinderImpl.java. Here is the relevant excerpt for the generated code
As can be seen, the resource is clearly set immediately after the constructor is called, which seems in accordance to what is done by the org.vectomatic.dev.svg.impl.gen.SVGImageParser in lib-gwt-svg. NPE cannot occur in this context. Can you provide more details on the issue or a test case to reproduce ? |
Hello, <svg:SVGImage ui:field="imguser" resource="{resources.loginsvg}" styleName="picall"/> Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot set property 'className' of undefined |
I see i have version 0.5.10 ! |
I'm using lib-gwt-svg 0.5.10 with GWT-2.7.0, and found that when I tried:
<svg:SVGImage ui:field="popoutButton" resource="{my.resourceBundle.mySVGresource}" />
it works fine, but as soon as I try to add style name attributes, I see a null pointer exception when instantiating the UiBinder implementation class due to 'element' var not being set in the UiObject super class of SVGImage (I think. Each debugging method and browser I tested gave me a null pointer assertion or exception in different but related classes in the library). The failing markup looked like this:
<svg:SVGImage ui:field="popoutButton" resource="{my.resourceBundle.mySVGresource}" classNameBaseVal="{style.popoutBtn}"/>
or this:
<svg:SVGImage ui:field="popoutButton" resource="{my.resourceBundle.mySVGresource}" styleName="{style.popoutBtn}"/>
The workaround was to leave the classNameBaseVal attribute there, but set the resource at the java level by calling the SVGResource contructor of SVGImage, and setting @UiField(provided = true) on the popoutButton field.
The text was updated successfully, but these errors were encountered: