As far as I know, you cannot put an arbitrary widget on the canvas. What you can do is draw images. Therefore, I think that the smartGWT widgets that you link to are nothing more than images.
If you have a GWT image object, here is how you draw it in a canvas:
import com.google.gwt.canvas.client.Canvas; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.dom.client.ImageElement; import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.RootLayoutPanel; public class ImageCanvasTest implements EntryPoint { public void onModuleLoad() { Image image = new Image( "http://upload.wikimedia.org/wikipedia/en/f/f6/Gwt-logo.png"); Canvas canvas = Canvas.createIfSupported(); canvas.getContext2d().drawImage( ImageElement.as(image.getElement()), 0, 0); RootLayoutPanel.get().add(canvas); } }
Adrian B.
source share