Example usage for com.google.gwt.query.client GQuery widget

List of usage examples for com.google.gwt.query.client GQuery widget

Introduction

In this page you can find the example usage for com.google.gwt.query.client GQuery widget.

Prototype

@SuppressWarnings("unchecked")
public <W extends Widget> W widget() 

Source Link

Document

Return the first non null attached widget from the matched elements or null if there isn't any.

Usage

From source file:gwtquery.plugins.enhance.client.gwt.TabPanelWidgetFactory.java

License:Apache License

public TabPanel create(Element e) {
    TabPanel tabPanel = new TabPanel();

    GQuery tabs = $(options.getTabSelector(), e);
    GQuery titles = $(options.getTitleSelector(), e);

    for (int i = 0; i < tabs.length(); i++) {
        GQuery tab = tabs.eq(i);
        GQuery title = titles.eq(i);/*from ww w .ja v a  2s .  co m*/

        Widget tabWidget = tab.widget();
        if (tabWidget == null) {
            tabWidget = new WidgetsHtmlPanel(tab.get(0));
        }

        tabPanel.add(tabWidget, title.get(0) != null ? title.text() : "Tab " + (i + 1));

    }
    if (tabs.length() > 0) {
        tabPanel.selectTab(0);
    }

    WidgetsUtils.replaceOrAppend(e, tabPanel);
    return tabPanel;
}