Example usage for com.vaadin.ui Component setVisible

List of usage examples for com.vaadin.ui Component setVisible

Introduction

In this page you can find the example usage for com.vaadin.ui Component setVisible.

Prototype

public void setVisible(boolean visible);

Source Link

Document

Sets the visibility of the component.

Usage

From source file:annis.gui.resultview.VisualizerPanel.java

License:Apache License

private Component createComponent() {
    if (visPlugin == null) {
        return null;
    }/*from  ww  w  .  ja  v  a2s  .  c om*/

    final VisualizerInput input = createInput();

    Component c = visPlugin.createComponent(input, this);
    c.setVisible(false);
    c.addStyleName(Helper.CORPUS_FONT);
    c.addStyleName("vis-content");

    return c;
}

From source file:com.foc.vaadin.gui.FocXMLGuiComponentStatic.java

License:Apache License

public static void applyAttributes(FocXMLGuiComponent xmlComponent, Attributes attributes) {
    if (attributes != null && xmlComponent != null) {
        try {/*from   w w  w. java 2 s  .c  om*/
            Component component = (Component) xmlComponent;

            String visible = attributes.getValue(FXML.ATT_VISIBLE);
            if (visible != null) {
                if (visible.equals("false")) {
                    component.setVisible(false);
                } else {
                    component.setVisible(true);
                }
            }

            String captionMode = attributes.getValue(FXML.ATT_CAPTION_MODE);
            if (captionMode != null) {
                if (captionMode.equals("vertical")) {
                    component.addStyleName("vertical");
                }
            }

            applyAttributes_WidthHeight(component, attributes);

            if (component instanceof AbstractOrderedLayout) {
                String spacing = attributes.getValue(FXML.ATT_SPACING);
                if (spacing == null || spacing.equals("false")) {
                    ((AbstractOrderedLayout) component).setSpacing(false);
                } else {
                    ((AbstractOrderedLayout) component).setSpacing(true);
                }
            }

            if (component instanceof AbstractLayout) {
                String margin = attributes.getValue(FXML.ATT_MARGIN);
                if (Globals.isValo()) {
                    if (margin != null && margin.equals("true")) {
                        ((AbstractLayout) component).addStyleName("focMargin");
                    }
                } else {
                    if (margin == null || margin.equals("false")) {
                        ((AbstractLayout) component).addStyleName("focNoMargin");
                    }
                }
            }

            String description = attributes.getValue(FXML.ATT_DESCRIPTION);
            if (description != null && !description.isEmpty() && component instanceof AbstractComponent) {
                AbstractComponent abstractComponent = (AbstractComponent) component;
                abstractComponent.setDescription(description);
            }

            String caption = attributes.getValue(FXML.ATT_CAPTION);
            String captPos = attributes.getValue(FXML.ATT_CAPTION_POSITION);
            if (caption != null) {
                if (captPos != null) {
                    if (!captPos.equals("left") && !captPos.equals("right"))
                        component.setCaption(caption);
                } else {
                    component.setCaption(caption);
                }
            }

            String captMargin = attributes.getValue(FXML.ATT_CAPTION_MARGIN);
            if (captMargin != null && captMargin.equals("0")
                    && (caption == null || (captPos != null && !captPos.equals("top")))) {
                setCaptionMargin_Zero(component);
            }

            //Style Attribute
            String style = attributes.getValue(FXML.ATT_STYLE);
            applyStyle(component, style);

            xmlComponent.refreshEditable();
            if (attributes != null) {
                String border = attributes.getValue(FXML.ATT_BORDER);
                if (border != null) {
                    border = border.toLowerCase();
                    if (border.equals("true")) {
                        component.addStyleName("border");
                    } else {
                        component.addStyleName("foc-border-" + border);
                    }
                }
            }

            String tabIndexString = attributes.getValue(FXML.ATT_TABINDEX);
            if (!Utils.isStringEmpty(tabIndexString) && xmlComponent.getFormField() != null) {
                int tabIndex = Utils.parseInteger(tabIndexString, -1);
                xmlComponent.getFormField().setTabIndex(tabIndex);
            }

            String iconName = attributes.getValue(FXML.ATT_ICON);
            if (!Utils.isStringEmpty(iconName)) {
                FontIcon icon = FontAwesome.valueOf(iconName.toUpperCase());
                if (icon != null) {
                    component.setIcon(icon);
                }
            }
            if (!(component instanceof Layout) && ConfigInfo.isGuiRTL() && !(component instanceof FVTextField)
                    && !(component instanceof FVDateField) && !(component instanceof FVComboBox)
                    && !(component instanceof FVTextArea) && !(component instanceof FVObjectComboBox)
                    && !(component instanceof FVMultipleChoiceComboBox)) {
                component.addStyleName("foc-floatNone");
            }
        } catch (Exception e) {
            Globals.logException(e);
        }
    }
}

From source file:com.foc.vaadin.gui.layouts.FVMoreLayout.java

License:Apache License

public void setExtended(boolean extended) {
    this.extended = extended;
    boolean arabic = ConfigInfo.isArabic();
    String caption = arabic ? "" : "More";
    if (attributes != null && attributes.getValue(FXML.ATT_MORE_CAPTION) != null) {
        caption = attributes.getValue(FXML.ATT_MORE_CAPTION);
    }//w ww  .  j  a  v a2 s .  co m

    if (arabic) {
        getMoreLayoutButton().setCaption(extended ? "? " + caption + " >>>" : " <<<  " + caption);
    } else {
        getMoreLayoutButton().setCaption(extended ? " <<< Hide " + caption : "Show " + caption + " >>>");
    }
    for (int i = 0; i < getComponentCount(); i++) {
        Component comp = getComponent(i);
        if (comp != getButton()) {
            comp.setVisible(isExtended());
        }
    }
}

From source file:com.foc.web.modules.photoAlbum.PhotoAlbum_Form.java

License:Apache License

@Override
protected void afterLayoutConstruction() {
    super.afterLayoutConstruction();

    PhotoAlbumConfig config = PhotoAlbumConfig.getInstance();
    if (config != null && config.isSingleGroup()) {
        FVVerticalLayout verticalLayout = (FVVerticalLayout) getComponentByName("_ACCESS_GROUPS");
        if (verticalLayout != null) {
            verticalLayout.setVisible(false);
        }//from  w w w. jav a 2  s  .c  om
    }
    if (config != null && !config.isUseKeywords()) {
        Component compKeyword = getComponentByName("KEYWORD");
        if (compKeyword != null) {
            compKeyword.setVisible(false);
        }
    }
}

From source file:com.google.code.vaadin.internal.preconfigured.VaadinComponentsInjector.java

License:Apache License

private void configureComponentApi(Component component, Preconfigured preconfigured) {
    component.setEnabled(preconfigured.enabled());
    component.setVisible(preconfigured.visible());
    component.setReadOnly(preconfigured.readOnly());

    String[] styleName = preconfigured.styleName();
    if (styleName.length > 0) {
        for (String style : styleName) {
            component.addStyleName(style);
        }//from   w  w  w.j a  va 2 s. c o m
    }

    configureLocalization(component, preconfigured);

    String id = preconfigured.id();
    if (!id.isEmpty()) {
        component.setId(id);
    }

    if (preconfigured.sizeFull()) {
        component.setSizeFull();
    } else if (preconfigured.sizeUndefined()) {
        component.setSizeUndefined();
    } else {
        float width = preconfigured.width();
        if (width > -1.0f) {
            Sizeable.Unit widthUnits = preconfigured.widthUnits();
            component.setWidth(width, widthUnits);
        }
        float height = preconfigured.height();
        if (height > -1.0f) {
            Sizeable.Unit heightUnits = preconfigured.heightUnits();
            component.setHeight(height, heightUnits);
        }
    }
}

From source file:com.hybridbpm.ui.component.dashboard.tab.DashboardTab.java

License:Apache License

public void toggleMaximized(final DashboardPanel dashboardPanel, final boolean maximized) {
    if (panels.root instanceof VerticalLayoutContainer || panels.root instanceof HorizontalLayoutContainer) {
        for (Component c : panels.root) {
            c.setVisible(!maximized);
        }//from w  w  w  . jav  a  2  s  . c  om
    } else if (panels.root instanceof GridLayoutContainer) {
        if (maximized) {
            ((GridLayoutContainer) panels.root).maximize(dashboardPanel);
        } else {
            ((GridLayoutContainer) panels.root).minimize();
        }
    }
    if (maximized) {
        dashboardPanel.setVisible(true);
        dashboardPanel.addStyleName("max");
    } else {
        dashboardPanel.removeStyleName("max");
    }
}

From source file:com.hybridbpm.ui.component.dashboard.tab.GridLayoutContainer.java

License:Apache License

public void maximize(DashboardPanel dashboardPanel) {
    setSpacing(false);/*from ww w.j a va 2s  . co  m*/
    for (Component comp : this) {
        if (!Objects.equals(comp, dashboardPanel)) {
            comp.setVisible(false);
        }
        setColumnExpandRatio(this.getComponentArea(comp).getColumn1(), 0f);
        setRowExpandRatio(this.getComponentArea(comp).getRow1(), 0f);
    }
    setColumnExpandRatio(this.getComponentArea(dashboardPanel).getColumn1(), 1f);
    setRowExpandRatio(this.getComponentArea(dashboardPanel).getRow1(), 1f);
}

From source file:com.hybridbpm.ui.component.dashboard.tab.GridLayoutContainer.java

License:Apache License

public void minimize() {
    setSpacing(true);/*  ww  w  .  ja  v a  2 s  .c o  m*/
    for (Component comp : this) {
        comp.setVisible(true);
        if (comp instanceof DashboardPanel) {
            setColumnExpandRatio(this.getComponentArea(comp).getColumn1(), 1f);
            setRowExpandRatio(this.getComponentArea(comp).getRow1(), 1f);
        }
    }

}

From source file:com.jain.addon.action.ActionGroup.java

License:Apache License

/**
 * Reinitialize a Action Bar by updating resources {@link JNAction} visibility after login.<br/> 
 *///ww  w. ja va2 s  . c o  m
public void onLogin() {
    for (JNAction action : actions) {
        for (Iterator<Component> iterator = iterator(); iterator.hasNext();) {
            Component component = iterator.next();
            if (actionsToName.get(action).equalsIgnoreCase(I18NHelper.getKey(component))) {
                component.setVisible(validatePermission(action));
            }
        }
    }
    markAsDirty();
}

From source file:com.jain.addon.web.layout.segment.ButtonSegment.java

License:Apache License

/**
 * Reinitialize a button segment by updating resources {@link JNINamedResourceVisible} visibility after login.<br/> 
 *//*from  w ww  . j a v  a 2s.c o  m*/
public void onLogin() {
    if (namedResources != null) {
        for (JNINamedResourceVisible named : namedResources) {
            for (Iterator<Component> iterator = iterator(); iterator.hasNext();) {
                Component component = iterator.next();
                if (named.getDisplayName().equalsIgnoreCase(I18NHelper.getKey(component))) {
                    component.setVisible(named.isVisible());
                }
            }
        }
    }
    markAsDirty();
}