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

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

Introduction

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

Prototype

public void selectTab(int index) 

Source Link

Document

Programmatically selects the specified tab and fires events.

Usage

From source file:org.switchyard.console.client.ui.service.ServiceEditor.java

License:Apache License

/**
 * @return this editor as a Widget.//from ww  w  . j a v a2 s.c  o m
 */
public Widget asWidget() {
    VerticalPanel panel = new VerticalPanel();
    panel.add(new ContentGroupLabel(Singleton.MESSAGES.label_serviceDetails()));
    panel.add(new ContentDescription(Singleton.MESSAGES.description_serviceDetails()));
    panel.add(createImplementationDetailsPanel());

    TabPanel tabs = new TabPanel();
    tabs.setStyleName("default-tabpanel"); //$NON-NLS-1$
    tabs.getElement().setAttribute("style", "margin-top:15px;"); //$NON-NLS-1$ //$NON-NLS-2$
    tabs.add(createGatewayDetailsPanel(), Singleton.MESSAGES.label_gateways());
    tabs.add(createThrottlingDetailsPanel(), Singleton.MESSAGES.label_throttling());
    tabs.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
        @Override
        public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            _toolstrip.doCancel();
        }
    });

    panel.add(tabs);
    tabs.selectTab(0);

    return panel;
}

From source file:org.xwiki.gwt.wysiwyg.client.WysiwygEditor.java

License:Open Source License

/**
 * Build the editor tab panel. This panel contains two tabs, one for the WYSIWYG editor and one for the source
 * editor./* w w w  .j a  v a  2  s .co m*/
 * 
 * @return the newly created tab panel
 */
private TabPanel createTabPanel() {
    PlainTextEditor plainTextEditor = new PlainTextEditor(config.getHook());

    TabPanel tabs = new TabPanel();
    tabs.add(getRichTextEditor(), Strings.INSTANCE.wysiwyg());
    tabs.add(plainTextEditor, Strings.INSTANCE.source());
    tabs.setStyleName("xRichTextEditorTabPanel");
    tabs.setAnimationEnabled(false);
    tabs.selectTab(config.getSelectedTabIndex());

    // Enable the appropriate text area based on the type of input (source or HTML).
    boolean richTextAreaEnabled = config.isInputConverted();
    plainTextEditor.getTextArea().setEnabled(!richTextAreaEnabled);
    getRichTextEditor().getTextArea().setEnabled(richTextAreaEnabled);

    saveRegistration(tabs.addBeforeSelectionHandler(switcher));
    saveRegistration(tabs.addSelectionHandler(new SelectionHandler<Integer>() {
        public void onSelection(SelectionEvent<Integer> event) {
            // Cache the active text area.
            config.setSelectedTabIndex(event.getSelectedItem());
        }
    }));
    saveRegistration(tabs.addSelectionHandler(switcher));

    return tabs;
}

From source file:parceirosDaEstrada.web.client.ParceirosDaEstrada.java

License:Open Source License

public LayoutPanel carregaPainelCaronas() throws Exception {
    LayoutPanel painelDeCaronas = new LayoutPanel();
    painelDeCaronas.setSize("590px", "490px");
    final List<Carona> CONTACTS = SistemaWebMain.getSistema().localizarCarona("", "");

    DateCell dateCell = new DateCell();

    TabPanel tabPanel = new TabPanel();
    tabPanel.setSize("586px", "485px");
    CellTable<Carona> table = new CellTable<Carona>();
    table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);

    final SingleSelectionModel<Carona> selectionModel = new SingleSelectionModel<Carona>();
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            Carona selected = selectionModel.getSelectedObject();
            if (selected != null) {
                Window.alert(selected.toString() + "\n  Cadastre agora mesmo e solicite uma vaga!");
            }//from  w  w  w .  j a  v a  2  s .  c o  m
        }
    });
    TextColumn<Carona> nameColumn = new TextColumn<Carona>() {
        @Override
        public String getValue(Carona object) {
            return object.getOrigem();
        }
    };
    table.addColumn(nameColumn, "Origem");
    Column<Carona, Date> dateColumn = new Column<Carona, Date>(dateCell) {
        @SuppressWarnings("deprecation")
        @Override
        public Date getValue(Carona object) {
            String[] data = object.getData().split("/");
            return new Date(Integer.parseInt(data[2]) - 1900, Integer.parseInt(data[1]) - 1,
                    Integer.parseInt(data[0]));

        }
    };
    table.addColumn(dateColumn, "Data");

    TextColumn<Carona> addressColumn = new TextColumn<Carona>() {
        @Override
        public String getValue(Carona object) {
            return object.getDestino();
        }
    };
    table.addColumn(addressColumn, "Destino");
    table.setSelectionModel(selectionModel);

    tabPanel.add(table, "Proximas Caronas", false);
    table.setRowCount(CONTACTS.size(), true);
    table.setRowData(0, CONTACTS);
    table.setSize("572px", "446px");

    tabPanel.add((new PainelOProjeto()).carregaPainel(), "O Projeto", false);
    tabPanel.selectTab(0);
    painelDeCaronas.add(tabPanel);
    return painelDeCaronas;
}

From source file:pl.balon.gwt.diagramsexample.client.GwtDiagramsExample.java

License:Apache License

public void onLoad() {

    final TabPanel tabs = new TabPanel();
    RootPanel.get("tabs").add(tabs);

    tabs.add(new RectilinearExample(), "Rectilinear");
    tabs.add(new BezierExample(), "Bezier");
    tabs.add(new StraightConnectionsExample(), "Straight");
    tabs.add(new DiagramBuilderExample(), "Diagram builder");
    tabs.add(new MultiConnectionsExample(), "Multi");
    tabs.add(new ConnectionEndingsExample(), "Endings");

    tabs.addTabListener(new TabListener() {
        public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) {
            return true;
        }//  w w w  . j av a 2  s .c o  m

        public void onTabSelected(SourcesTabEvents sender, int tabIndex) {
            AbstractConnectionsExample e = (AbstractConnectionsExample) tabs.getWidget(tabIndex);
            e.update();
        }
    });

    String tab = getUrlParam("tab");
    if (tab == null || "".equals(tab)) {
        tab = "0";
    }
    tabs.selectTab(Integer.parseInt(tab));

}

From source file:ro.zg.opengroups.gwt.client.views.EntityUserActionsTabView.java

License:Apache License

private void addCommandDefinitionsList(final CommandDefinitionsList cdl, final List<Integer> desiredActionPath,
        final TabPanel tabPanel) {
    final Map<Integer, CommandDefinition> commandsMap = new LinkedHashMap<Integer, CommandDefinition>();
    final Map<Integer, BaseGwtView> viewsMap = new HashMap<Integer, BaseGwtView>();

    if (cdl != null) {
        int tabIndex = 0;
        for (CommandDefinition cd : cdl.getCommandDefinitions().values()) {
            commandsMap.put(tabIndex, cd);
            if (cd instanceof CommandDefinitionsList) {
                EntityUserActionsTabView newView = (EntityUserActionsTabView) createViewForType(
                        ViewsTypes.ENTITY_USER_ACTIONS_TAB_VIEW, this);
                TabPanel currentTabPanel = newView.construct();
                currentTabPanel.getTabBar().setStylePrimaryName("og-CommandsTabBar");
                currentTabPanel.getDeckPanel().setStylePrimaryName("og-CommandsTabPanelBottom");
                tabPanel.add(currentTabPanel, cd.getDisplayName());
                viewsMap.put(tabIndex, newView);
            } else {
                BaseGwtView newView = (BaseGwtView) createViewForCommand(cd.getActionName(), this);
                tabPanel.add(newView.construct(), cd.getDisplayName());
                viewsMap.put(tabIndex, newView);
            }/*from w  ww  .j  a  va 2s  . com*/
            tabIndex++;
        }
        /* set the selection listener */
        handlerReg = tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
            public void onSelection(SelectionEvent<Integer> event) {
                Integer si = event.getSelectedItem();
                updateCurrentActionPath(si);
                BaseGwtView view = viewsMap.get(si);
                if (view instanceof EntityUserActionsTabView) {
                    ((EntityUserActionsTabView) view).update((CommandDefinitionsList) commandsMap.get(si),
                            desiredActionPath, new ArrayList<Integer>(currentActionPath));
                } else {
                    CommandDefinition cd = commandsMap.get(si);
                    UserEvent userEvent = new UserEvent();
                    userEvent.setSourceViewType(getViewType());
                    userEvent.setElementId(COMMANDS_TAB);
                    userEvent.setEventType(UserEvent.CLICK);
                    userEvent.addEventParam(UserEventParams.COMMAND_ID, cd.getUniqueCommandDesc());
                    userEvent.addEventParam(OpenGroupsParams.CURRENT_TAB_ACTION_PATH,
                            new ArrayList<Integer>(currentActionPath));
                    userEvent.setTargetViewId(view.getId());
                    System.out.println(userEvent.getFullEventType());
                    dispatchEventToManager(userEvent);
                }
            }
        });
        /* if didn't tell otherwise, select the first action */
        int nextIndex = 0;
        /* select the desired action */
        if (desiredActionPath != null && desiredActionPath.size() > 0) {
            nextIndex = desiredActionPath.remove(0);
        }
        currentActionPath.add(nextIndex);
        tabPanel.selectTab(nextIndex);
    }
}

From source file:therandomhomepage.lightboximagedemoclient.LightboxImageDemo.java

License:Apache License

public void onModuleLoad() {
    TabPanel tabs = new TabPanel();
    tabs.setWidth("100%");

    tabs.add(new SingleLightboxImagePanel(), "Single Image");
    tabs.add(new ImageSetsPanel(), "Image Sets");
    tabs.add(new SlideshowLightboxImagePanel(), "Slideshow");
    tabs.add(new SlideshowLightboxWithBackgroundMusicPanel(), "Slideshow with music");
    tabs.add(new SetupPanel(), "Setup");

    tabs.selectTab(0);

    RootPanel.get().add(getPageHeader());
    RootPanel.get().add(tabs);//from   ww  w  . j  a v  a  2  s  .  c  o  m
}

From source file:tv.dyndns.kishibe.qmaclone.client.chat.PanelChat.java

License:Open Source License

public PanelChat() {
    setWidth("800px");

    add(new Label("?(??ON/OFF?????)"));

    if (SharedData.get().isAdministoratorMode()) {
        final TabPanel panel = new TabPanel();
        panel.setAnimationEnabled(true);
        panel.add(new LazyPanel() {
            @Override//from  w  ww  . j  a  v  a  2  s.c om
            protected Widget createWidget() {
                return new PanelRealtime();
            }
        }, "");
        panel.add(new LazyPanel() {
            @Override
            protected Widget createWidget() {
                return new PanelPast();
            }
        }, "?");
        panel.selectTab(0);
        add(panel);
    } else {
        add(new PanelRealtime());
    }
}