Pergunta

I have a basic ui-binder layout file, and want to place a canvas into the main content area.

But using the following gives an error:

No class matching "canvas" in urn:import:com.google.gwt.canvas.client: <c:canvas ui:field='canvas'>

What is wrong with my sources?

.ui.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!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'>
    <g:DockLayoutPanel>
    <!-- other stuff... ->

        <g:center>
            <c:canvas ui:field="canvas" />
        </g:center>
    </g:DockLayoutPanel>
</ui:UiBinder>

.java:

@UiField//(provided = true)
Canvas canvas;

@Override
public void onModuleLoad() { 
    canvas = Canvas.createIfSupported();
    canvas.setWidth("400px");
    canvas.setHeight("400px"); 
    canvas.setCoordinateSpaceWidth(400);
    canvas.setCoordinateSpaceHeight(400);
}
Foi útil?

Solução

OMG the canvas element in uibuilder has to start with a capital letter...

<c:Canvas...
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top