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

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

Introduction

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

Prototype

public void setDescription(String description) 

Source Link

Document

Sets the component's description.

Usage

From source file:com.expressui.core.view.form.TypedForm.java

License:Open Source License

private void initializeOptionalTabs(VerticalLayout layout) {
    final Set<String> tabNames = getFormFieldSet().getTabNames();
    menu = new LayoutContextMenu(layout);
    for (String tabName : tabNames) {
        TabSheet.Tab tab = getTabByName(tabName);
        if (getFormFieldSet().isTabOptional(tabName)) {
            tab.setClosable(true);/*from  w w  w .j a va 2s.c  om*/
            menu.addAction(uiMessageSource.getMessage("typedForm.add") + " " + tabName, this,
                    "executeContextAction").setVisible(true);
            menu.addAction(uiMessageSource.getMessage("typedForm.remove") + " " + tabName, this,
                    "executeContextAction").setVisible(false);
            setIsRequiredEnable(tabName, false);
            tab.setVisible(false);
        }
        tab.setDescription(uiMessageSource.getToolTip("typedForm.tab.toolTip"));
    }

    formTabSheet.setCloseHandler(new TabSheet.CloseHandler() {
        @Override
        public void onTabClose(TabSheet tabsheet, Component tabContent) {
            String tabName = tabsheet.getTab(tabContent).getCaption();
            String actionName = uiMessageSource.getMessage("typedForm.remove") + " " + tabName;
            executeContextAction(actionName);
        }
    });
}

From source file:com.haulmont.cuba.web.gui.WebWindow.java

License:Apache License

protected void setTabCaptionAndDescription(TabSheet.Tab tabWindow) {
    String formattedCaption = formatTabCaption(caption, description);
    String formattedDescription = formatTabDescription(caption, description);

    tabWindow.setCaption(formattedCaption);
    if (!Objects.equals(formattedCaption, formattedDescription)) {
        tabWindow.setDescription(formatTabDescription(caption, description));
    } else {//from   w  w  w.  j a v  a2 s  . co  m
        tabWindow.setDescription(null);
    }
}

From source file:com.purebred.core.view.FormComponent.java

License:Open Source License

private void initializeOptionalTabs(VerticalLayout layout) {
    final Set<String> tabNames = getFormFields().getTabNames();
    menu = new LayoutContextMenu(layout);
    for (String tabName : tabNames) {
        TabSheet.Tab tab = getTabByName(tabName);
        if (getFormFields().isTabOptional(tabName)) {
            tab.setClosable(true);/*from w w  w. j  a va2  s  .c  o  m*/
            menu.addAction(uiMessageSource.getMessage("formComponent.add") + " " + tabName, this,
                    "executeContextAction").setVisible(true);
            menu.addAction(uiMessageSource.getMessage("formComponent.remove") + " " + tabName, this,
                    "executeContextAction").setVisible(false);
            setIsRequiredEnable(tabName, false);
            tab.setVisible(false);
        }
        tab.setDescription(uiMessageSource.getMessage("formComponent.tab.description"));
    }

    tabSheet.setCloseHandler(new TabSheet.CloseHandler() {
        @Override
        public void onTabClose(TabSheet tabsheet, Component tabContent) {
            String tabName = tabsheet.getTab(tabContent).getCaption();
            String actionName = uiMessageSource.getMessage("formComponent.remove") + " " + tabName;
            executeContextAction(actionName);
        }
    });
}

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;/*w  w w  . jav  a2 s. co m*/

    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);
    }
}