Thanks for the reply!

I don't think UIBinder is quite what I'm looking for. The XML has to
validate against a RelaxNG definition. Also, after a lab gets parsed
into a structure, it gets stored in a database, and uses that data to
create the views. The data also gets used in other ways than just UI.

I can't seem to get your other suggestion working, if I understood
correctly. Here is my attempt assuming I want a button wrapped in a
<b> tag.

public class MyButton extends Button {
        private final Element e = (Element)
Document.get().createElement("b");

        public MyButton(String name) {
                super(name);
        }

        @Override
        public Element getElement() {
                return e;
        }
}

Then add it,

MyButton button = new MyButton("Run");
RootPanel.get("myButtonContainer").add(button);

And it produces

<b tabindex="0"></b>

A normal button produces

<button type="button" class="gwt-Button">Run</button>

I also tried the approach from 
http://osdir.com/ml/GoogleWebToolkit/2009-05/msg01379.html
with no luck, although same concept.

Thanks,

Tom


On Jul 23, 12:58 am, cokol <eplisc...@googlemail.com> wrote:
> hi, so what you want is actually NOT that user-written XML directly is
> injected into the DOM, rather you're about to create an own UiBinder?
> So, if someone writes the code
>
> <b><lab:button name="Run Me" evaluate="MyEvaluator"/></b>
>
> you want to map the <lab:button/> element to the GWT-Button widget,
> right? - start using UiBinder :-)
> if you want to handle it absolutely dynamically, so - <lab:button/>
> would really cause a DOM.addWidget(new Button()) then you have to
> extend all of GWT widgets you want to support and override the
> getElement() method - this would be the DOM element the widget appends
> its own code to. So you can control it then
>
> On 23 Jul., 00:16, Thomas Dvornik <amp...@gmail.com> wrote:
>
> > Hello,
>
> > I'm creating an application that parses XML. After parsing, the
> > corresponding widgets gets created and added to the page. To provide
> > more customization, a user can include XHTML tags for formatting.
> > These tags should go directly to the page in the spot they were
> > specified. For example, lets say I have a "button" tag and the user
> > writes:
>
> > <b> <lab:button name="Run Me" evaluate="MyEvaluator"> </b>
>
> > the HTML should look something like
>
> > <b> <GWT button widget code> </b>
>
> > My first attempt was to do the following.
>
> > dBox.add(new HTML("<"+tagName+">"));
> > dBox.add(button);
> > dBox.add(new HTML("</"+tagName+">"));
>
> > GWT, in the case where the tagName is "b", produces
>
> > <div class="GWT-html"> <b></b> <div>
> > <GWT button widget code>
>
> > Since then, I also tried overwriting methods and classes, turning
> > everything into HTML then adding one HTML widget, and some other
> > unsuccessful approaches. I don't want to write the GWT button code by
> > hand, because that defeats the purpose of using GWT. Plus I am using a
> > lot more widgets then just buttons.
>
> > Does anyone know a solution to this problem or can get me pointed in
> > the right direction. It seems the simplest solution is to stop GWT
> > from creating the additional div tag. Ideally, the solution would also
> > work for SmartGWT, although I'll take anything at this point.
>
> > Thanks!
>
> > Tom

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

Reply via email to