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

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

Introduction

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

Prototype

public TabBar() 

Source Link

Document

Creates an empty tab bar.

Usage

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());
        }//from   w  ww . 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;

}