Re: Custom UIBinder Widget, problem expecting only widgets
There are two ways to add html tag inside the HTMLPanel. You can add Unorder List / ListItem (UL/LI) directly to HTMLPanel, or using HTML class inside the HTMLPanel. Try the below code. //.xml file ?xml version=1.0 encoding=UTF-8? ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui' g:DockLayoutPanel unit='EM' g:west size='10' g:HTMLPanel g:HTML ul liListItem/li liListItem1/li liListItem2/li /ul /g:HTML /g:HTMLPanel /g:west /g:DockLayoutPanel /ui:UiBinder //.java public class HtmlTest extends Composite { interface Binder extends UiBinderWidget, HtmlTest{} Binder binder = GWT.create(Binder.class); public HtmlTest() { initWidget(binder.createAndBindUi(this)); } } S. Abraham www.DataStoreGwt.com Persist objects directly in GAE -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Custom UIBinder Widget, problem expecting only widgets
What I am trying to do is set up a blank UL container I can fill from my control code.. ie. below, where UnorderedList is a Java class that I used the source from HTMLPanel as a starting point.. ?xml version=1.0 encoding=UTF-8? ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:MyWidget='urn:import:com.mypackage.ui' g:HTMLPanel MyWidget:UnorderedList ui:field=galleryContainer/ /g:HTMLPanel /ui:UiBinder The above works fine, and I can access the galleryContainer object as a UIField in my control code.. but if I want to add some static list elements, mostly to see how they look in GWTDesigner, it fails.. i.e. ?xml version=1.0 encoding=UTF-8? ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:MyWidget='urn:import:com.mypackage.ui' g:HTMLPanel MyWidget:UnorderedList ui:field=galleryContainer liimg href=somepic.jpg//li /MyWidget:UnorderedList /g:HTMLPanel /ui:UiBinder When I go to open GWTDesigner, it fails initialization saying the element MyWidget:UnorderedList is only expecting Widgets. I pulled in the source for HTMLPanel into my UnorderedList class in its entirety and only modified it to produce UL elements instead of Div elements. Not sure what's going on here, I get the feeling that there is some description file somewhere telling which UI elements are allowed to contain HTML vs Widgets somewhere since the code is the same as HTMLPanel. -John Gentilin On 10/10/11 12:14 AM, Sudhakar Abraham wrote: There are two ways to add html tag inside the HTMLPanel. You can add Unorder List / ListItem (UL/LI) directly to HTMLPanel, or using HTML class inside the HTMLPanel. Try the below code. //.xml file ?xml version=1.0 encoding=UTF-8? ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui' g:DockLayoutPanel unit='EM' g:west size='10' g:HTMLPanel g:HTML ul liListItem/li liListItem1/li liListItem2/li /ul /g:HTML /g:HTMLPanel /g:west /g:DockLayoutPanel /ui:UiBinder //.java public class HtmlTest extends Composite { interface Binder extends UiBinderWidget, HtmlTest{} Binder binder = GWT.create(Binder.class); public HtmlTest() { initWidget(binder.createAndBindUi(this)); } } S. Abraham www.DataStoreGwt.com Persist objects directly in GAE -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Custom UIBinder Widget, problem expecting only widgets
hi, as far as gwt 2.1. HTMLPanel was treated somohow special by uibinder. (i'm not sure if it hasn't changed in newer versions) normally a widget in ui binder could contain text or html when implemented hasText and hasHTML interfaces. then the content of the node in ui.xml was parsed as text or html. however it was not allowed to contain subwidgets. on the other hand side if a widget implemented hasWidgets interface (so it was a panel :)) it contents in ui.xml has been parsed as widgets to be added to that panel. but HTMLPanel had its own dedicated parser in uibinder: com.google.gwt.uibinder.elementparsers.HTMLPanelParser, which was aware of how to parse both widgets-markup and plain-html. but widgets which inherited from HTMLParser has not been handled by that parser. but coming back to your particular example :) - if yuo only need a html markup (not widgets) inside your widget, do not inherit from HTMLPanel but use HTML widget instead, or Composite and implement hasHTML. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Custom UIBinder Widget, problem expecting only widgets
I am trying to create a custom to use in my UIBinder templates, UL/LI elements are curiously missing.. I used HTMLPanel as a template where I copied the class source to my project. The object itself works fine, but as soon as I try to include HTML code in the element, the UIBinder parser complains saying that my UL widget is only expecting Widgets, but the HTMLPanel can include both HTML and Widgets.. What am I doing wrong ? Thanks -John G -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.