Hello, I'm learning GWT and I stumbled on a situation I can't get
around. I'm trying to implement a Composite widget, similar in
behavior to an HTMLPanel, with an icon on the left side and whatever
content is inside the widget, on the right. The ui.xml would look
like:

<my:IconItem icon="hello.gif">
        <g:Label>label text here</g:Label>
        And some other text here
</my:IconItem>

My current implementation looks like this:

public class IconItem extends Composite implements HasWidgets, HasText
{
        private FlowPanel container;
        private HTMLPanel content;
        private String icon;

        public IconItem(String icon) {
                this.icon = icon;

                container = new FlowPanel();
                container.setStylePrimaryName("iconItem");
                // TODO: add the icon image somewhere in this container

                content = new HTMLPanel("Test");
                content.setStylePrimaryName("iconItemContent");

                container.add(content);;

                initWidget(container);
        }

        public IconItem() {
                this("");
        }

        public void setIcon(String icon) {
                this.icon = icon;
        }

        @Override
        public void add(Widget w) {
                this.content.add(w);
        }

        @Override
        public void clear() {
                this.content.clear();
        }

        @Override
        public Iterator<Widget> iterator() {
                return this.content.iterator();
        }

        @Override
        public boolean remove(Widget w) {
                return this.content.remove(w);
        }

        @Override
        public String getText() {
                // TODO Auto-generated method stub
                return null;
        }

        @Override
        public void setText(String text) {
                this.content.add(new HTMLPanel(text));
                // TODO Auto-generated method stub
        }
}

However, when I run the project, I get this error:
> Unexpected text in element: "asdf" Element <my:IconItem icon='hello.gif'>

Can anyone please tell me what I am doing wrong?

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 [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