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:com.allen_sauer.gwt.dnd.demo.client.ui.MultiRowTabPanel.java

License:Apache License

private void addRow() {
    TabBar tabBar = new TabBar();
    tabBarsVerticalPanel.add(tabBar);//from  ww  w . ja  v  a  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.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);//from   w w  w  . j av  a 2  s  . c  om
    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);

    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: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  ww  .j a  v  a2s.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();
            }
        }
    });

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

From source file:com.ikon.frontend.client.widget.TabWorkspace.java

License:Open Source License

/**
 * Tab Workspace/*from w  w  w. j  a  v a 2s.c  o m*/
 */
public TabWorkspace() {
    widgetExtensionList = new ArrayList<TabWorkspaceExtension>();
    workHandlerExtensionList = new ArrayList<WorkspaceHandlerExtension>();
    tabBar = new TabBar();
    tabBar.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            int index = indexCorrectedChangeViewIndex(event.getSelectedItem().intValue());

            switch (index) {
            case UIDockPanelConstants.DESKTOP:
                Main.get().mainPanel.setView(UIDockPanelConstants.DESKTOP);
                if (Main.get().activeFolderTree != null) { // On start up is null
                    Main.get().activeFolderTree.centerActulItemOnScroll(); // Center the actual item every time
                }
                break;

            case UIDockPanelConstants.SEARCH:
                Main.get().mainPanel.setView(UIDockPanelConstants.SEARCH);
                break;

            case UIDockPanelConstants.DASHBOARD:
                Main.get().mainPanel.setView(UIDockPanelConstants.DASHBOARD);
                break;

            case UIDockPanelConstants.ADMINISTRATION:
                Main.get().mainPanel.setView(UIDockPanelConstants.ADMINISTRATION);
                break;

            default:
                loginJS(GeneralComunicator.getUser(),
                        Main.get().workspaceUserProperties.getWorkspace().getWorkflowUrl());
                Main.get().mainPanel.setView(index);
                break;
            }

            fireEvent(HasWorkspaceEvent.STACK_CHANGED);
            tabVisited[index] = true;
        }
    });

    initWidget(tabBar);
}

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  . ja v a  2s. com
    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.nanosim.client.ContentWidget.java

License:Apache License

/**
 * Constructor.
 * 
 * @param constants the constants
 */
public ContentWidget(CwConstants constants) {
    this.constants = constants;
    tabBar = new TabBar();
}

From source file:com.openkm.frontend.client.widget.TabWorkspace.java

License:Open Source License

/**
 * Tab Workspace//from   ww  w . j a  v  a  2 s .c  o m
 */
public TabWorkspace() {
    widgetExtensionList = new ArrayList<TabWorkspaceExtension>();
    workHandlerExtensionList = new ArrayList<WorkspaceHandlerExtension>();
    tabBar = new TabBar();
    tabBar.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            int index = indexCorrectedChangeViewIndex(event.getSelectedItem().intValue());

            switch (index) {
            case UIDockPanelConstants.DESKTOP:
                Main.get().mainPanel.setView(UIDockPanelConstants.DESKTOP);
                if (Main.get().activeFolderTree != null) { // On start up is null
                    Main.get().activeFolderTree.centerActulItemOnScroll(); // Center the actual item every time
                }
                break;

            case UIDockPanelConstants.SEARCH:
                Main.get().mainPanel.setView(UIDockPanelConstants.SEARCH);
                break;

            case UIDockPanelConstants.DASHBOARD:
                Main.get().mainPanel.setView(UIDockPanelConstants.DASHBOARD);
                break;

            case UIDockPanelConstants.ADMINISTRATION:
                Main.get().mainPanel.setView(UIDockPanelConstants.ADMINISTRATION);
                break;

            default:
                Main.get().mainPanel.setView(index);
                break;
            }

            fireEvent(HasWorkspaceEvent.STACK_CHANGED);
            tabVisited[index] = true;
        }
    });

    initWidget(tabBar);
}

From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java

License:Open Source License

public void displayBarAndTabs(String message) {
    /* top bar */
    displayStatusPage("Drawing the tabs...");

    HorizontalPanel top_bar = new HorizontalPanel();
    top_bar.getElement().setClassName("euca-top-bar");

    HorizontalPanel name_panel = new HorizontalPanel();
    name_panel.getElement().setClassName("euca-top-bar-left");
    name_panel.setSpacing(5);//from  w  ww. j  a v  a 2s  . c  om
    name_panel.add(new HTML(Theme.draw_header()));
    top_bar.add(name_panel);

    top_bar.setCellHorizontalAlignment(name_panel, HorizontalPanel.ALIGN_LEFT);
    top_bar.setCellVerticalAlignment(name_panel, HorizontalPanel.ALIGN_TOP); // michael left this as MIDDLE

    HorizontalPanel upanel = new HorizontalPanel();
    upanel.getElement().setClassName("euca-top-bar-right");
    Label user_name = new HTML(
            "Logged in as <b>" + loggedInUser.getUserName() + "</b>&nbsp;&nbsp;|&nbsp;&nbsp;");
    Hyperlink logout_button = new Hyperlink("Logout", "logout");
    logout_button.addClickListener(LogoutButtonListener);
    upanel.add(user_name);
    upanel.add(logout_button);
    top_bar.add(upanel);
    top_bar.setCellHorizontalAlignment(upanel, HorizontalPanel.ALIGN_RIGHT);
    top_bar.setCellVerticalAlignment(upanel, HorizontalPanel.ALIGN_TOP);

    final HorizontalPanel messageBox = new HorizontalPanel();
    messageBox.setStyleName("euca-message-bar");
    messageBox.setSpacing(3);
    messageBox.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    messageBox.add(statusMessage);
    statusMessage.setStyleName("euca-small-text");

    final VerticalPanel wrapper = new VerticalPanel();
    wrapper.setStyleName("euca-tab-contents");
    //        wrapper.setSize("100%", "80%");
    //        wrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    //        wrapper.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // set up tab layout so that *TabIndex variables are set in the beginning
    int nTabs = 0;
    allTabs = new TabBar();

    allTabs.addTab("Credentials");
    credsTabIndex = nTabs++;
    allTabs.addTab("Images");
    imgTabIndex = nTabs++;
    /////allTabs.addTab ("Instances"); instTabIndex = nTabs++;
    if (loggedInUser.isAdministrator() != null && loggedInUser.isAdministrator().booleanValue()) {
        allTabs.addTab("Users");
        usrTabIndex = nTabs++;
        allTabs.addTab("Configuration");
        confTabIndex = nTabs++;
        allTabs.addTab("Extras");
        downTabIndex = nTabs++;
        if (extensions != null && extensions.contains("store")) {
            allTabs.addTab("Store");
            storeTabIndex = nTabs++;
        }
    }
    // can happen if admin user re-logs in as regular without reloading
    if (currentTabIndex > (nTabs - 1)) {
        currentTabIndex = 0;
    }
    allTabs.addTabListener(new TabListener() {
        public void onTabSelected(SourcesTabEvents sender, int tabIndex) {
            String error = "This tab is not implemented yet, sorry!";
            statusMessage.setText("");
            wrapper.clear();
            currentTabIndex = tabIndex;
            if (tabIndex == credsTabIndex) {
                displayCredentialsTab(wrapper);
            } else if (tabIndex == imgTabIndex) {
                displayImagesTab(wrapper);
            } else if (tabIndex == usrTabIndex) {
                displayUsersTab(wrapper);
            } else if (tabIndex == confTabIndex) {
                displayConfTab(wrapper);
            } else if (tabIndex == downTabIndex) {
                displayDownloadsTab(wrapper);
            } else if (tabIndex == storeTabIndex) {
                displayStoreTab(wrapper);
            } else {
                displayErrorPage("Invalid tab!");
            }
        }

        public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) {
            return true; /* here we could do checking for clicks on disabled tabs */
        }
    });

    RootPanel.get().clear();
    RootPanel.get().add(top_bar);
    RootPanel.get().add(allTabs);
    RootPanel.get().add(messageBox);
    RootPanel.get().add(wrapper);
    allTabs.selectTab(currentTabIndex);
}

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

License:Open Source License

private static TabBar makeTabBar(AppConf appConf) {
    TabBar tabbar = new TabBar();
    List<PlaceConf> places = appConf.getPlaces();
    for (PlaceConf placeConf : places) {
        tabbar.addTab(placeConf.getName());
    }/*from   w  ww. j a  v a  2 s .c  o m*/
    return tabbar;
}

From source file:org.jboss.errai.workspaces.client.widgets.WSTabPanel.java

License:Apache License

public WSTabPanel() {
    layoutPanel = new DockPanel();
    layoutPanel.setSize("98%", "100%");

    tabBar = new TabBar();
    deckPanel = new DeckPanel();
    deckPanel.setWidth("100%");

    deckPanel.addStyleName("gwt-TabPanelBottom");

    layoutPanel.add(tabBar, DockPanel.NORTH);
    layoutPanel.add(deckPanel, DockPanel.CENTER);

    tabBar.addSelectionHandler(new SelectionHandler<Integer>() {
        public void onSelection(SelectionEvent<Integer> integerSelectionEvent) {
            deckPanel.showWidget(integerSelectionEvent.getSelectedItem());
        }//www.  j  a va 2  s. com
    });

    initWidget(layoutPanel);
}