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">
         <li><img 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>
         <li>ListItem</li>
         <li>ListItem1</li>
         <li>ListItem2</li>
       </ul>
     </g:HTML>
     </g:HTMLPanel>
   </g:west>
</g:DockLayoutPanel>
  </ui:UiBinder>

//.java
public class HtmlTest extends Composite
{
        interface Binder extends UiBinder<Widget, 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to