Example usage for com.google.gwt.user.client.ui TabBar selectTab

List of usage examples for com.google.gwt.user.client.ui TabBar selectTab

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui TabBar selectTab.

Prototype

public boolean selectTab(int index) 

Source Link

Document

Programmatically selects the specified tab and fires events.

Usage

From source file:com.allen_sauer.gwt.dnd.demo.client.ui.MultiRowTabPanel.java

License:Apache License

public void selectTab(int index) {
    int row = index / tabsPerRow;
    int tabIndex = index % tabsPerRow;
    TabBar tabBar = (TabBar) tabBarsVerticalPanel.getWidget(row);
    tabBar.selectTab(tabIndex);
}

From source file:com.allen_sauer.gwt.dnd.demo.client.ui.MultiRowTabPanel.java

License:Apache License

private void whenTabSelected(int row, int tabIndex) {
    if (tabIndex == -1) {
        return;//  w  w  w.j  a  v a 2 s .c o m
    }
    if (row != selectedRow) {
        selectedRow = row;
        for (int i = 0; i < rows; i++) {
            if (i != row) {
                TabBar tabBar = (TabBar) tabBarsVerticalPanel.getWidget(i);
                tabBar.selectTab(-1);
            }
        }
    }
    TabBar tabBar = (TabBar) tabBarsVerticalPanel.getWidget(selectedRow);
    Integer widgetOffset = tabBarIndexOffsetMap.get(tabBar);
    int index = widgetOffset.intValue() + tabIndex;
    masterDeckPanel.showWidget(index);
    History.newItem(historyTokenMap.getHistoryToken(index));
    Window.setTitle(historyTokenMap.getPageTitle(historyTokenMap.getHistoryToken(index)));
}

From source file:com.audata.client.record.RecordPropertiesDialog.java

License:Open Source License

public RecordPropertiesDialog(UpdateListener parent, String rType, String record, String checkedOutTo) {
    this.parent = parent;
    this.recorduuid = record;
    this.recordType = rType;
    this.checkedOutTo = checkedOutTo;

    this.fields = new ArrayList();
    this.properties = new RecordProperties(this, this.checkedOutTo);
    this.revisions = new Revisions(this.recorduuid);
    this.main = new VerticalPanel();

    TabBar tabs = new TabBar();
    tabs.addTab(LANG.props_Text());
    tabs.addTab("Revisions");
    tabs.addTabListener(this);
    tabs.selectTab(0);
    this.main.add(tabs);

    this.main.add(this.properties);
    this.main.add(this.revisions);
    this.revisions.setVisible(false);

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(4);// w w w . j av  a  2s  .  com

    this.okButton = new Button(LANG.ok_Text());
    this.okButton.addClickListener(this);
    buttonPanel.add(this.okButton);
    this.cancelButton = new Button(LANG.cancel_Text());
    this.cancelButton.addClickListener(this);
    buttonPanel.add(this.cancelButton);
    this.main.add(buttonPanel);
    this.addFields();
    this.getFields();
    this.getRecord();
    this.setWidget(this.main);
}

From source file:net.s17fabu.vip.gwt.showcase.client.Showcase.java

License:Apache License

/**
 * Create the options that appear next to the title.
 *///from  ww  w.  j  a v a2s . c o m
private void setupOptionsPanel(ShowcaseConstants constants) {
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        vPanel.getElement().setAttribute("align", "left");
    } else {
        vPanel.getElement().setAttribute("align", "right");
    }
    app.setOptionsWidget(vPanel);

    // Add the option to change the locale
    final ListBox localeBox = new ListBox();
    String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName();
    if (currentLocale.equals("default")) {
        currentLocale = "en_US";
    }
    String[] localeNames = LocaleInfo.getAvailableLocaleNames();
    for (String localeName : localeNames) {
        if (!localeName.equals("default")) {
            String nativeName = LocaleInfo.getLocaleNativeDisplayName(localeName);
            localeBox.addItem(nativeName, localeName);
            if (localeName.equals(currentLocale)) {
                localeBox.setSelectedIndex(localeBox.getItemCount() - 1);
            }
        }
    }
    localeBox.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            String localeName = localeBox.getValue(localeBox.getSelectedIndex());
            Window.open(getHostPageLocation() + "?locale=" + localeName, "_self", "");
        }
    });
    HorizontalPanel localeWrapper = new HorizontalPanel();
    localeWrapper.add(images.locale().createImage());
    localeWrapper.add(new Label(constants.chooseLocale()));
    localeWrapper.add(localeBox);
    vPanel.add(localeWrapper);

    // Add the option to change the style
    final HorizontalPanel styleWrapper = new HorizontalPanel();
    vPanel.add(styleWrapper);
    for (int i = 0; i < ShowcaseConstants.STYLE_THEMES.length; i++) {
        final ThemeButton button = new ThemeButton(ShowcaseConstants.STYLE_THEMES[i]);
        styleWrapper.add(button);
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                // Update the current theme
                CUR_THEME = button.getTheme();

                // Reload the current tab, loading the new theme if necessary
                TabBar bar = ((TabBar) app.getContentTitle());
                bar.selectTab(bar.getSelectedTab());

                // Load the new style sheets
                updateStyleSheets();
            }
        });
    }
}

From source file:org.cloud4gl.client.Cloud4gl.java

License:Open Source License

/**
 * This is the entry point method./*  w  ww.ja  v  a 2s .  c  om*/
 */
public void onModuleLoad() {

    //create AppController passing in parameter AppConf
    AppController appController = new AppController(appConf);
    RootPanel.get("titlecell").getElement().setInnerText(appConf.getName());
    // Create a tab bar for the main menu which is integrated with the places framework
    final TabBar tbar = appController.getTabMenu();
    RootPanel.get("tabmenu").add(tbar);
    tbar.addSelectionHandler(new MenuSelectionEventHandler(appController));
    RootPanel.get("appmessage").setVisible(false);
    SimplePanel sPanel = new SimplePanel();
    RootPanel.get("maincontent").add(sPanel);
    appController.setContainer(sPanel);
    tbar.selectTab(0);

    appController.getHistoryHandler().handleCurrentHistory();

}