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

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

Introduction

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

Prototype

@Override
    public boolean isVisible() 

Source Link

Usage

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

License:Open Source License

@Override
protected void resetContextMenu() {
    if (getFormFieldSet().hasOptionalTabs()) {
        Set<String> tabNames = getFormFieldSet().getViewableTabNames();
        for (String tabName : tabNames) {
            TabSheet.Tab tab = getTabByName(tabName);

            String caption = uiMessageSource.getMessage("typedForm.add") + " " + tabName;
            if (menu.containsItem(caption)) {
                menu.getContextMenuItem(caption).setVisible(!tab.isVisible() && !isViewMode());
            }//from w ww.j  a  v a 2s .  c  o m
            caption = uiMessageSource.getMessage("typedForm.remove") + " " + tabName;
            if (menu.containsItem(caption)) {
                menu.getContextMenuItem(caption).setVisible(tab.isVisible() && !isViewMode());
            }
        }
    }
}

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

License:Open Source License

/**
 * Resets the context menu for the tabs so that optional tabs can be added/removed, if there are any.
 *///from  w w w  . j  a  v a 2  s .  c om
protected void resetContextMenu() {
    if (getFormFieldSet().hasOptionalTabs()) {
        Set<String> tabNames = getFormFieldSet().getViewableTabNames();
        for (String tabName : tabNames) {
            TabSheet.Tab tab = getTabByName(tabName);

            String caption = uiMessageSource.getMessage("typedForm.add") + " " + tabName;
            if (menu.containsItem(caption)) {
                menu.getContextMenuItem(caption).setVisible(!tab.isVisible());
            }
            caption = uiMessageSource.getMessage("typedForm.remove") + " " + tabName;
            if (menu.containsItem(caption)) {
                menu.getContextMenuItem(caption).setVisible(tab.isVisible());
            }
        }
    }
}

From source file:com.haulmont.cuba.web.gui.components.WebComponentsHelper.java

License:Apache License

/**
 * Tests if component visible and its container visible.
 *
 * @param child component// ww  w .j a v  a  2 s .com
 * @return component visibility
 */
public static boolean isComponentVisible(Component child) {
    if (child.getParent() instanceof TabSheet) {
        TabSheet tabSheet = (TabSheet) child.getParent();
        TabSheet.Tab tab = tabSheet.getTab(child);
        if (!tab.isVisible()) {
            return false;
        }
    }

    if (child.getParent() instanceof CubaGroupBox) {
        // ignore groupbox content container visibility
        return isComponentVisible(child.getParent());
    }

    return child.isVisible() && (child.getParent() == null || isComponentVisible(child.getParent()));
}

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

License:Open Source License

@Override
protected void resetContextMenu() {
    if (getFormFields().hasOptionalTabs()) {
        Set<String> tabNames = getFormFields().getViewableTabNames();
        for (String tabName : tabNames) {
            TabSheet.Tab tab = getTabByName(tabName);

            String caption = uiMessageSource.getMessage("formComponent.add") + " " + tabName;
            if (menu.containsItem(caption)) {
                menu.getContextMenuItem(caption).setVisible(!tab.isVisible() && !isViewMode());
            }//from ww  w.j a  va2s  .  c om
            caption = uiMessageSource.getMessage("formComponent.remove") + " " + tabName;
            if (menu.containsItem(caption)) {
                menu.getContextMenuItem(caption).setVisible(tab.isVisible() && !isViewMode());
            }
        }
    }
}

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

License:Open Source License

/**
 * Reset the context menu for the tabs so that optional tabs can be added/removed, if there are any.
 *///from  w  w  w  . j a  v a  2s  .c  o m
protected void resetContextMenu() {
    if (getFormFields().hasOptionalTabs()) {
        Set<String> tabNames = getFormFields().getViewableTabNames();
        for (String tabName : tabNames) {
            TabSheet.Tab tab = getTabByName(tabName);

            String caption = uiMessageSource.getMessage("formComponent.add") + " " + tabName;
            if (menu.containsItem(caption)) {
                menu.getContextMenuItem(caption).setVisible(!tab.isVisible());
            }
            caption = uiMessageSource.getMessage("formComponent.remove") + " " + tabName;
            if (menu.containsItem(caption)) {
                menu.getContextMenuItem(caption).setVisible(tab.isVisible());
            }
        }
    }
}