Add navigation buttons to an AbstractCell

62 views
Skip to first unread message

Ahmed Abida

unread,
Apr 11, 2012, 6:39:57 AM4/11/12
to google-we...@googlegroups.com
I've created a thread in stackoverflow site where I saied:

I've created an AbstractCell<String> to create the header that says "welcome to your mobile..." and I would like to add two buttons in this AbstractCell: the fist to return to the previous page, and the second to return to the welcome page. I've used to create the header element a class that extendsAbstractCell<String> using this code:

public class HeaderCell extends AbstractCell<String> {

    interface Templates extends SafeHtmlTemplates {

        String style = "HeaderPanel";

        @SafeHtmlTemplates.Template("<div class=\""+style+"\">{0}</div>")
        SafeHtml cell(SafeHtml value);
    }

    private Templates templates = GWT.create(Templates.class);

    interface templateWithButton extends SafeHtmlTemplates {

    }
    @Override
    public void render(com.google.gwt.cell.client.Cell.Context context,
            String value, SafeHtmlBuilder sb) {
        SafeHtml safeValue = SafeHtmlUtils.fromString(value);

        SafeHtml rendered = templates.cell(safeValue);

        sb.append(rendered);
    }

}


So please if you have any answer, please post it.
Thanks

Interbooker App

unread,
Apr 11, 2012, 7:22:41 AM4/11/12
to google-we...@googlegroups.com
Hi,

What I would do is the following:
// create the button element
Element button = DOM.createButton();
// set the inner html of the button
button.setInnerHTML("<button type=\"button\">Click Me!</button>");
// add it to the safehtmlbuilder
sb.appendHtmlConstant(button.getInnerHTML());

Cheers,
Lin


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Xn1rTF7wu4IJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Reply all
Reply to author
Forward
0 new messages