Wednesday, August 7, 2013

Canvas and UIBinder - CSS class

Hi,
  I'm using UIBinder and I would like to add style to Canvas. For example :

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:c='urn:import:com.google.gwt.canvas.client'>
<ui:style>
.canvas {
background : white;
}
</ui:style>
<g:FlowPanel>
<c:Canvas class="{style.canvas}" ui:field="canvasSign" />
</g:FlowPanel>
</ui:UiBinder>                

-----------------------------

@UiField
Canvas canvasSign;

@UiFactory
Canvas createCanvasSign() {
canvasWidth = Window.getClientWidth() - 20;
canvasHeight = Window.getClientHeight() - 20 - 75;
canvasSign = Canvas.createIfSupported();
canvasSign.setWidth(canvasWidth + "px");
canvasSign.setHeight(canvasHeight + "px"); 
canvasSign.setCoordinateSpaceWidth(canvasWidth);
canvasSign.setCoordinateSpaceHeight(canvasHeight);
context = canvasSign.getContext2d();
    }

--------------------------
But I get an error : Class Canvas has no appropriate setClass() method: <c:Canvas class='{style.canvas}' ui:field='canvasSign'> (:28)

Any idea how can I assign UIBinder style to Canvas? Thank you.

Regards,
   Matic

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate