Example usage for com.vaadin.ui Component isVisible

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

Introduction

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

Prototype

public boolean isVisible();

Source Link

Document

Tests the visibility property of the component.

Usage

From source file:com.foc.vaadin.gui.xmlForm.FocXMLLayout.java

License:Apache License

private boolean scanComponentsAndcopyGuiToMemory_Local() {
    boolean error = false;
    try {/* w  w w .  j  av a  2  s .co m*/
        Iterator<FocXMLGuiComponent> iter = getComponentMap().values().iterator();
        while (iter != null && iter.hasNext()) {
            Component comp = (Component) iter.next();
            if (comp.isVisible() && comp instanceof FocXMLGuiComponent) {
                FocXMLGuiComponent obj = (FocXMLGuiComponent) comp;
                if (obj.getFocData() instanceof FProperty) {
                    boolean localError = copyGuiToMemoryForASingleComponent(obj);
                    error = error || localError;
                }
            }
        }
    } catch (Exception e) {
        Globals.logException(e);
    }
    return error;
}

From source file:com.foc.web.unitTesting.FocUnitTestingCommand.java

License:Apache License

public void component_AssertVisible(String componentName, boolean visible) throws Exception {
    FocXMLLayout navigationLayout = getCurrentCentralPanel();
    FocXMLGuiComponent component = findComponent(navigationLayout, componentName);
    if (component == null) {
        getLogger().addFailure("Component " + componentName + " not found");
    } else {//from   w ww.  j  av  a2  s  .c o  m
        if (component instanceof Component) {
            Component comp = (Component) component;
            boolean compVisible = comp.isVisible();
            while (compVisible && comp != null) {
                comp = comp.getParent();
                if (comp != null)
                    compVisible = comp.isVisible();
            }

            if (compVisible == visible) {
                getLogger()
                        .addInfo("Component " + componentName + (visible ? " is Visible " : " is not Visible"));
            } else {
                getLogger().addFailure("Component " + componentName
                        + (visible ? " should be Visible " : " should not be Visible"));
            }
        }
    }
}

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

License:Apache License

protected void updateCompositionStylesTopPanelVisible() {
    if (topPanel != null) {
        boolean hasChildren = topPanel.getComponentCount() > 0;
        boolean anyChildVisible = false;
        for (Component childComponent : topPanel) {
            if (childComponent.isVisible()) {
                anyChildVisible = true;//from   w  w  w. ja  va  2  s .co  m
                break;
            }
        }
        boolean topPanelVisible = hasChildren && anyChildVisible;

        if (!topPanelVisible) {
            componentComposition.removeStyleName(HAS_TOP_PANEL_STYLENAME);

            internalStyles.remove(HAS_TOP_PANEL_STYLENAME);
        } else {
            componentComposition.addStyleName(HAS_TOP_PANEL_STYLENAME);

            if (!internalStyles.contains(HAS_TOP_PANEL_STYLENAME)) {
                internalStyles.add(HAS_TOP_PANEL_STYLENAME);
            }
        }
    }
}

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

License:Apache License

protected void updateCompositionStylesTopPanelVisible() {
    if (topPanel != null) {
        boolean hasChildren = topPanel.getComponentCount() > 0;
        boolean anyChildVisible = false;
        for (com.vaadin.ui.Component childComponent : topPanel) {
            if (childComponent.isVisible()) {
                anyChildVisible = true;/*w ww .ja va  2s . com*/
                break;
            }
        }
        boolean topPanelVisible = hasChildren && anyChildVisible;

        if (!topPanelVisible) {
            componentComposition.removeStyleName(HAS_TOP_PANEL_STYLENAME);

            internalStyles.remove(HAS_TOP_PANEL_STYLENAME);
        } else {
            componentComposition.addStyleName(HAS_TOP_PANEL_STYLENAME);

            if (!internalStyles.contains(HAS_TOP_PANEL_STYLENAME)) {
                internalStyles.add(HAS_TOP_PANEL_STYLENAME);
            }
        }
    }
}

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

License:Apache License

protected void updateCompositionStylesTopPanelVisible() {
    if (topPanel != null) {
        boolean hasChildren = topPanel.getComponentCount() > 0;
        boolean anyChildVisible = false;
        for (Component childComponent : topPanel) {
            if (childComponent.isVisible()) {
                anyChildVisible = true;//from  w w w.j  a  v a  2s . c  om
                break;
            }
        }
        boolean topPanelVisible = hasChildren && anyChildVisible;

        if (!topPanelVisible) {
            componentComposition.removeStyleName(HAS_TOP_PANEL_STYLE_NAME);

            internalStyles.remove(HAS_TOP_PANEL_STYLE_NAME);
        } else {
            componentComposition.addStyleName(HAS_TOP_PANEL_STYLE_NAME);

            if (!internalStyles.contains(HAS_TOP_PANEL_STYLE_NAME)) {
                internalStyles.add(HAS_TOP_PANEL_STYLE_NAME);
            }
        }
    }
}

From source file:com.mymita.vaadlets.VaadletsBuilder.java

License:Apache License

private static void setComponentAttributes(final com.vaadin.ui.Component vaadinComponent,
        final com.mymita.vaadlets.core.Component c) {
    vaadinComponent.setCaption(c.getCaption());
    vaadinComponent.setEnabled(c.isEnabled());
    vaadinComponent.setReadOnly(c.isReadonly());
    vaadinComponent.setVisible(c.isVisible());
    if (c.getHeight() != null) {
        vaadinComponent.setHeight(c.getHeight());
    }/*from   ww  w .  j  a v  a2  s . co  m*/
    if (c.getWidth() != null) {
        vaadinComponent.setWidth(c.getWidth());
    }
    if (c.isSizeUndefined() != null && c.isSizeUndefined().booleanValue()) {
        vaadinComponent.setSizeUndefined();
    }
    if (c.isSizeFull() != null && c.isSizeFull().booleanValue()) {
        vaadinComponent.setSizeFull();
    }
}

From source file:helpers.Utils.java

License:Open Source License

public static HorizontalLayout questionize(Component c, final String info, final String header) {
    final HorizontalLayout res = new HorizontalLayout();
    res.setSpacing(true);/*from  www  .j  a  va2  s  .co m*/
    if (c instanceof CustomVisibilityComponent) {
        CustomVisibilityComponent custom = (CustomVisibilityComponent) c;
        c = custom.getInnerComponent();
        custom.addListener(new VisibilityChangeListener() {

            @Override
            public void setVisible(boolean b) {
                res.setVisible(b);
            }
        });
    }

    res.setVisible(c.isVisible());
    res.setCaption(c.getCaption());
    c.setCaption(null);
    res.addComponent(c);

    PopupView pv = new PopupView(new Content() {

        @Override
        public Component getPopupComponent() {
            Label l = new Label(info, ContentMode.HTML);
            l.setCaption(header);
            l.setIcon(FontAwesome.INFO);
            l.setWidth("250px");
            l.addStyleName("info");
            return new VerticalLayout(l);
        }

        @Override
        public String getMinimizedValueAsHTML() {
            return "[?]";
        }
    });
    pv.setHideOnMouseOut(false);

    res.addComponent(pv);

    return res;
}

From source file:info.magnolia.ui.vaadin.tabsheet.MagnoliaTab.java

License:Open Source License

@Override
public void setContent(Component content) {
    final Component currentContent = super.getContent();
    if (currentContent != null) {
        content.setVisible(currentContent.isVisible());
    }/*from w ww.j  a v  a 2  s  . c o  m*/
    super.setContent(content);
}

From source file:org.vaadin.addons.layouts.CardLayout.java

License:Apache License

private void setVisible(int index) {
    this.checkBounds(index);
    int idx = 0;// w  w w  .  j  a v  a  2  s.c  om
    for (Component c : this) {
        if (idx == index) {
            c.setVisible(true);
        } else if (c.isVisible()) {
            c.setVisible(false);
        }
        idx++;
    }
    this.currentCard = index;
}