Tuesday, February 1, 2011

Re: Can CellWidgets contain custom composite widgets ?

Sorry, I should have been more clearer. Its not getHTML as I had stated. Should have said getInnerHtml(). Your custom widget need not implement HasHTML. Instead, its basically a standard UiBinder based composite with public methods to set the required  data to be rendered ( not the markup just the data like any other setters/getters of a view ). Your markup is inside the UIBinder XML. Once you set the data, you can call getElement().getInnerHTML() on the composite to get the HTML equivalent of the composite. 

One more improvement (more lightweight I guess) over the above approach is, You need not extend the UiBinder widget from Composite. You can just have a reference to a Widget inside the UiBinder Java file. Initialize this reference to the  object returned from createAndBindUi. In this case, you will have to call widget.getElement().getInnerHtml() for the HTML equivalent.

Hope this helps.


Prashant

On Wed, Feb 2, 2011 at 10:20 AM, zixzigma <zixzigma@gmail.com> wrote:
Thank You.

Prashant, I am following your suggestion,
I am a bit unclear about this part of your comment: "set the data and getHTML"

should my custom widget implement HasHTML ?
http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/HasHTML.html

could you please explain that part a bit more ?
I see that HasHTML has methods setHTML getText that I need to implement.
do you think I need to put html markup in this setHTML ?

Thank You


--
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment