Hi Thomas, Thanks for your help. I think i just did something wrong when I posted above message with the code snipet in it.
Actually I am not having UIBinder xml for the MyImageButton class. I am trying to create a separate class with UIBinder and trying to use MyImageButton in it which you can say that I wrote in GWT1.5.3. Is there any way to achieve this? Where can find some of the advanced or complex UIBinder xml examples. -Thanks On Apr 8, 7:06 pm, Thomas Broyer <t.bro...@gmail.com> wrote: > On Apr 8, 12:33 pm, San <sandip.pati...@gmail.com> wrote: > > > > > Hi all, > > > I was trying to use UIBinders for my own custom widget. > > > public class MyImageButton extends CustomButton{ > > public @UiConstructor MyImageButton(Image upImage) { > > super(upImage); > > // TODO Auto-generated constructor stub > > } > > > } > > > My UiBinder.xml is as follows > > > <g:FlowPanel ui:field="flowPanel"> > > <my:MyImageButton > > ui:field="imageButton"></my:MyImageButton> > > </g:FlowPanel> > > > At run time I am getting following error > > > 15:59:00.437 [ERROR] [toolbar] <my:MyImageButton > > ui:field='imageButton'> missing required attribute(s): upImage > > > Can anyone help me how i cann set the attribute's value as a object of > > Image class in UI Binder. > > You can only do so if your Image comes from a class "imported" with an > <ui:with> *or* if you provide a @UiFactory method or > @UiField(provided=true) the imageButton field. > > This would result in, either: > <ui:with field='res' type='com.company.myapp.client.SomeClass' > ... > <my:MyImageButton upImage='${res.myImage}' /> > or > <my:MyImageButton /> > ... > �...@uifactory MyImageButton createMyImageButton() { > return new MyImageButton(myImage); > } > or > <my:MyImageButton field='imageButton' /> > ... > �...@uifield(provided=true) MyImageButton imageButton; > ... > imageButton = new MyImageButton(myImage); > ... > binder.createAndBindUi(this); > > You could also replace the Image with an ImageResource so you can call > the image's resource from the ui.xml with an <ui:image/>: > <ui:image field='myImage' resource='path/to/myImage.png' /> > ... > <my:MyImageButton upImage='${myImage}' /> -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.