Example usage for com.vaadin.ui Layout setVisible

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

Introduction

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

Prototype

public void setVisible(boolean visible);

Source Link

Document

Sets the visibility of the component.

Usage

From source file:com.antonjohansson.lprs.view.ServiceView.java

License:Apache License

/**
 * Shows a stage.//from   ww  w  .ja va  2 s. c o m
 *
 * @param stage The stage to show.
 */
void show(Stage stage) {
    Layout layout = getLayout(stage);

    currentLayout.ifPresent(l -> l.setVisible(false));
    currentLayout = Optional.of(layout);
    layout.setVisible(true);
}

From source file:com.haulmont.cuba.web.sys.WindowBreadCrumbs.java

License:Apache License

public WindowBreadCrumbs(AppWorkArea workArea) {
    setWidth(100, Unit.PERCENTAGE);/*from ww w  .  ja  v  a  2  s. co  m*/
    setHeightUndefined();
    setPrimaryStyleName(C_HEADLINE_CONTAINER);

    tabbedMode = workArea.getMode() == AppWorkArea.Mode.TABBED;

    if (tabbedMode) {
        super.setVisible(false);
    }

    addAttachListener((AttachListener) event -> adjustParentStyles());

    logoLayout = createLogoLayout();

    linksLayout = createLinksLayout();
    linksLayout.setSizeUndefined();

    if (!tabbedMode) {
        closeBtn = new CubaButton("", (Button.ClickListener) event -> {
            Window window = getCurrentWindow();
            if (!isCloseWithCloseButtonPrevented(window)) {
                window.close(Window.CLOSE_ACTION_ID);
            }
        });
        closeBtn.setIcon(WebComponentsHelper.getIcon("icons/close.png"));
        closeBtn.setStyleName("c-closetab-button");
    }

    AppUI ui = AppUI.getCurrent();
    if (ui.isTestMode()) {
        TestIdManager testIdManager = ui.getTestIdManager();
        linksLayout.setId(testIdManager.getTestId("breadCrumbs"));
        linksLayout.setCubaId("breadCrumbs");

        if (closeBtn != null) {
            closeBtn.setId(testIdManager.getTestId("closeBtn"));
            closeBtn.setCubaId("closeBtn");
        }
    }

    Layout enclosingLayout = createEnclosingLayout();
    enclosingLayout.addComponent(linksLayout);

    addComponent(logoLayout);
    addComponent(enclosingLayout);

    boolean controlsVisible = AppBeans.get(Configuration.class).getConfig(WebConfig.class).getShowBreadCrumbs();

    enclosingLayout.setVisible(controlsVisible);

    if (closeBtn != null) {
        addComponent(closeBtn);
    }
}