Example usage for com.vaadin.ui TabSheet.Tab getCaption

List of usage examples for com.vaadin.ui TabSheet.Tab getCaption

Introduction

In this page you can find the example usage for com.vaadin.ui TabSheet.Tab getCaption.

Prototype

@Override
    public String getCaption() 

Source Link

Usage

From source file:com.esofthead.mycollab.module.user.accountsettings.customize.view.AccountSettingContainer.java

License:Open Source License

private void buildComponents() {
    generalSettingPresenter = PresenterResolver.getPresenter(GeneralSettingPresenter.class);
    settingTab.addTab(generalSettingPresenter.getView(),
            AppContext.getMessage(AdminI18nEnum.OPT_GENERAL_SETTINGS));

    if (!SiteConfiguration.isCommunityEdition()) {
        themeCustomizePresenter = PresenterResolver.getPresenter(IThemeCustomizePresenter.class);
        settingTab.addTab(this.themeCustomizePresenter.getView(),
                AppContext.getMessage(AdminI18nEnum.OPT_THEME));
    }//from  w  w  w . j a  va  2 s .  c  o m

    settingTab.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
            TabSheet.Tab tab = ((TabSheetDecorator) event.getTabSheet()).getSelectedTabInfo();
            String caption = tab.getCaption();
            if (AppContext.getMessage(AdminI18nEnum.OPT_GENERAL_SETTINGS).equals(caption)
                    && !AppContext.getMessage(AdminI18nEnum.OPT_GENERAL_SETTINGS).equals(selectedTabId)) {
                generalSettingPresenter.go(AccountSettingContainer.this, null);
            } else if (AppContext.getMessage(AdminI18nEnum.OPT_THEME).equals(caption)
                    && !AppContext.getMessage(AdminI18nEnum.OPT_THEME).equals(selectedTabId)) {
                themeCustomizePresenter.go(AccountSettingContainer.this, null);
            }
            selectedTabId = "";
        }
    });
}

From source file:com.mycollab.module.user.accountsettings.customize.view.AccountSettingContainer.java

License:Open Source License

private void buildComponents() {
    generalSettingPresenter = PresenterResolver.getPresenter(GeneralSettingPresenter.class);
    settingTab.addTab(generalSettingPresenter.getView(),
            UserUIContext.getMessage(AdminI18nEnum.OPT_GENERAL_SETTINGS));

    if (!SiteConfiguration.isCommunityEdition()) {
        themeCustomizePresenter = PresenterResolver.getPresenter(IThemeCustomizePresenter.class);
        settingTab.addTab(this.themeCustomizePresenter.getView(),
                UserUIContext.getMessage(AdminI18nEnum.OPT_THEME));
    }/*from   w  ww .j a va  2s . com*/

    settingTab.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
            TabSheet.Tab tab = ((TabSheetDecorator) event.getTabSheet()).getSelectedTabInfo();
            String caption = tab.getCaption();
            if (UserUIContext.getMessage(AdminI18nEnum.OPT_GENERAL_SETTINGS).equals(caption)
                    && !UserUIContext.getMessage(AdminI18nEnum.OPT_GENERAL_SETTINGS).equals(selectedTabId)) {
                generalSettingPresenter.go(AccountSettingContainer.this, null);
            } else if (UserUIContext.getMessage(AdminI18nEnum.OPT_THEME).equals(caption)
                    && !UserUIContext.getMessage(AdminI18nEnum.OPT_THEME).equals(selectedTabId)) {
                themeCustomizePresenter.go(AccountSettingContainer.this, null);
            }
            selectedTabId = "";
        }
    });
}

From source file:org.vaadin.addons.serverpush.samples.chat.ManualPushChatApplication.java

License:Apache License

private void fireNewTab(User user, User from) {
    if (user == null)
        return;//from   www .j av a2  s  . c om

    final String to = user.getUsername();
    boolean exists = false;
    for (int i = 0; i < this.tabSheet.getComponentCount(); i++) {
        TabSheet.Tab tab = this.tabSheet.getTab(i);
        if (to.equals(tab.getCaption())) {
            exists = true;
            break;
        }
    }
    if (!exists) {
        TabSheet.Tab tab = this.tabSheet.addTab(new ChatLayout(user, from), to);
        tab.setClosable(true);
        tab.setDescription("Chatting with " + to);
    }
}