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

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

Introduction

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

Prototype

public HandlerRegistration addSelectionHandler(SelectionHandler<Integer> handler) 

Source Link

Usage

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

License:Apache License

private void addRow() {
    TabBar tabBar = new TabBar();
    tabBarsVerticalPanel.add(tabBar);//from w w w.ja va  2  s.  c  o  m
    tabBar.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            int row = tabBarsVerticalPanel.getWidgetIndex((TabBar) event.getSource());
            whenTabSelected(row, event.getSelectedItem());
        }
    });
    tabBarIndexOffsetMap.put(tabBar, Integer.valueOf(tabCount));
    tabBarsVerticalPanel.setCellStyleName(tabBar, CSS_DEMO_MULTI_ROW_TAB_PANEL_ROW);

    rows++;
}

From source file:com.google.gerrit.client.change.RelatedChanges.java

License:Apache License

private void initTabBar() {
    TabBar tabBar = getTabBar();
    tabBar.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override//  w w w .  j a v  a 2s .  c  o  m
        public void onSelection(SelectionEvent<Integer> event) {
            if (selectedTab >= 0) {
                tabs.get(selectedTab).registerKeys(false);
            }
            selectedTab = event.getSelectedItem();
            tabs.get(selectedTab).registerKeys(true);
        }
    });

    for (Tab tabInfo : Tab.values()) {
        RelatedChangesTab panel = new RelatedChangesTab(tabInfo);
        add(panel, tabInfo.defaultTitle);
        tabs.add(panel);

        TabBar.Tab tab = tabBar.getTab(tabInfo.ordinal());
        tab.setWordWrap(false);
        ((Composite) tab).setTitle(tabInfo.tooltip);

        setTabEnabled(tabInfo, false);
    }
    getTab(Tab.RELATED_CHANGES).setShowIndirectAncestors(true);
    getTab(Tab.CHERRY_PICKS).setShowBranches(true);
    getTab(Tab.SAME_TOPIC).setShowBranches(true);
    getTab(Tab.SAME_TOPIC).setShowProjects(true);
    getTab(Tab.SAME_TOPIC).setShowSubmittable(true);
    getTab(Tab.SUBMITTED_TOGETHER).setShowBranches(true);
    getTab(Tab.SUBMITTED_TOGETHER).setShowProjects(true);
    getTab(Tab.SUBMITTED_TOGETHER).setShowSubmittable(true);
}

From source file:com.google.gwt.examples.TabBarExample.java

License:Apache License

public void onModuleLoad() {
    // Create a tab bar with three items.
    TabBar bar = new TabBar();
    bar.addTab("foo");
    bar.addTab("bar");
    bar.addTab("baz");

    // Hook up a tab listener to do something when the user selects a tab.
    bar.addSelectionHandler(new SelectionHandler<Integer>() {
        public void onSelection(SelectionEvent<Integer> event) {
            // Let the user know what they just did.
            Window.alert("You clicked tab " + event.getSelectedItem());
        }/*from w  w w  .  ja v  a  2 s  .com*/
    });

    // Just for fun, let's disallow selection of 'bar'.
    bar.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
        public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            if (event.getItem().intValue() == 1) {
                event.cancel();
            }
        }
    });

    // Add it to the root panel.
    RootPanel.get().add(bar);
}

From source file:com.mansi.client.board.MultiRowTabPanel.java

License:Apache License

private void addRow() {
    TabBar tabBar = new TabBar();
    tabBarsVerticalPanel.add(tabBar);//from w  w w.  j av a2  s. c om
    tabBar.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            int row = tabBarsVerticalPanel.getWidgetIndex((TabBar) event.getSource());
            whenTabSelected(row, event.getSelectedItem());
        }
    });
    tabBarIndexOffsetMap.put(tabBar, Integer.valueOf(tabCount));
    //   tabBarsVerticalPanel.setCellStyleName(tabBar, CSS_DEMO_MULTI_ROW_TAB_PANEL_ROW);

    rows++;
}

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

License:Open Source License

/**
 * This is the entry point method.//  w w  w  . java 2 s  .  com
 */
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();

}

From source file:tn.spindox.client.ui.TabBarExample.java

License:Apache License

public TabBar onModuleLoad() {
    // Create a tab bar with three items.
    TabBar bar = new TabBar();
    bar.addTab("Person Management");
    bar.addTab("Technology Area Management");
    bar.addTab("Technology Management");
    bar.addTab("Competence Management");

    // Hook up a tab listener to do something when the user selects a tab.
    bar.addSelectionHandler(new SelectionHandler<Integer>() {
        public void onSelection(SelectionEvent<Integer> event) {
            // Let the user know what they just did.
            Window.alert("You clicked tab " + event.getSelectedItem());
        }/* www  .  j a v a 2s  .  c  o  m*/
    });

    // Just for fun, let's disallow selection of 'bar'.
    bar.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
        public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            if (event.getItem().intValue() == 1) {
                event.cancel();
            }
        }
    });

    return bar;

}