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:info.magnolia.configuration.app.problem.toolbar.ProblemToolbarViewImpl.java

License:Open Source License

private void initGroupByLayout() {
    groupBySelect.setHeight("25px");
    groupBySelect.setWidth("160px");
    groupBySelect.setNullSelectionAllowed(false);
    for (ProblemView.SourceType type : ProblemView.SourceType.values()) {
        groupBySelect.addItem(type);//from   w w w .  j a va2  s.c o m
    }
    groupBySelect.setValue(ProblemView.SourceType.source);
    groupBySelect.addValueChangeListener(groupByChangeListener);

    fromSelect.setHeight("25px");
    fromSelect.setWidth("160px");
    fromSelect.setNullSelectionAllowed(true);
    for (Problem.SourceType type : Problem.SourceType.values()) {
        fromSelect.addItem(type);
    }
    fromSelect.addValueChangeListener(groupByChangeListener);
    fromSelect.setInputPrompt("All sources");

    groupByLayout.setSizeUndefined();

    groupByLayout.addComponent(decorateComponent(i18n.translate("toolbar.groupBy.label"), groupBySelect));
    Component formField = decorateComponent(i18n.translate("toolbar.fromSource.label"), fromSelect);
    formField.setVisible(false);
    groupByLayout.addComponent(formField);

    groupByLayout.addStyleName("entry");
    groupByLayout.setMargin(true);
    groupByLayout.setSpacing(true);

    addComponent(groupByLayout);
}

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());
    }//  w ww .  j  av a 2  s.  c  o  m
    super.setContent(content);
}

From source file:org.eclipse.hawkbit.ui.menu.DashboardMenu.java

License:Open Source License

/**
 * Creates the wrapper which contains the menu item and the adjacent label
 * for displaying the occurred events/*from  w w w. jav  a  2s .co m*/
 * 
 * @param menuItemButton
 *            the menu item
 * @param notificationLabel
 *            the label for displaying the occurred events
 * @return Component of type CssLayout
 */
private static Component buildLabelWrapper(final ValoMenuItemButton menuItemButton,
        final Component notificationLabel) {
    final CssLayout dashboardWrapper = new CssLayout(menuItemButton);
    dashboardWrapper.addStyleName("labelwrapper");
    dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM);
    notificationLabel.addStyleName(ValoTheme.MENU_BADGE);
    notificationLabel.setWidthUndefined();
    notificationLabel.setVisible(false);
    notificationLabel
            .setId(UIComponentIdProvider.NOTIFICATION_MENU_ID + menuItemButton.getCaption().toLowerCase());
    dashboardWrapper.addComponent(notificationLabel);
    return dashboardWrapper;
}

From source file:org.hip.vif.admin.permissions.ui.PermissionEditView.java

License:Open Source License

/** Constructor
 *
 * @param inPermissions {@link LoadedPermissionContainer} the permissions
 * @param inRoles {@link CodeList} the roles
 * @param inTask {@link PermissionsEditTask} */
public PermissionEditView(final LoadedPermissionContainer inPermissions, final CodeList inRoles,
        final PermissionsEditTask inTask) {
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);/*  w  w w.j av  a 2  s .  c  o m*/

    final IMessages lMessages = Activator.getMessages();
    lLayout.setStyleName("vif-table"); //$NON-NLS-1$
    lLayout.addComponent(new Label(
            String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$
                    lMessages.getMessage("component.menu.title")), //$NON-NLS-1$
            ContentMode.HTML));

    final Label lSubtitle = new Label(
            String.format(SUBTITLE_WARNING, lMessages.getMessage("ui.permission.remark.delete")), //$NON-NLS-1$
            ContentMode.HTML);
    lLayout.addComponent(lSubtitle);
    lSubtitle.setVisible(false);

    final Table lTable = new Table();
    lTable.setWidth("100%"); //$NON-NLS-1$
    lTable.setStyleName("vif-permission-table"); //$NON-NLS-1$
    lTable.setContainerDataSource(inPermissions);
    // generate column checkbox for delete
    lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_CHECK, new Table.ColumnGenerator() {
        @Override
        public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) {
            if (Constants.PERMISSION_EDIT.equals(((LoadedPermissionBean) inItemId).getLabel())) {
                return new Label();
            }
            return VIFViewHelper.createCheck((ISelectableBean) inItemId,
                    new VIFViewHelper.IConfirmationModeChecker() {
                        @Override
                        public boolean inConfirmationMode() {
                            return confirmationMode;
                        }
                    });
        }
    });
    // generate column label
    lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_LABEL, new Table.ColumnGenerator() {
        @Override
        public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) {
            final LoadedPermissionBean lPermission = (LoadedPermissionBean) inItemId;
            return new Label(String.format(TMPL_LABEL, lPermission.getDescription(), lPermission.getLabel()),
                    ContentMode.HTML);
        }
    });
    // generate column checkbox for roles
    lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_SU, new ColumnCheckBoxGenerator(Role.SU));
    lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_ADMIN,
            new ColumnCheckBoxGenerator(Role.ADMIN));
    lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_GROUPADMIN,
            new ColumnCheckBoxGenerator(Role.GROUP_ADMIN));
    lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_PARTICIPANT,
            new ColumnCheckBoxGenerator(Role.PARTICIPANT));
    lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_MEMBER,
            new ColumnCheckBoxGenerator(Role.MEMBER));
    lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_GUEST,
            new ColumnCheckBoxGenerator(Role.GUEST));
    lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_EXCLUDED,
            new ColumnCheckBoxGenerator(Role.EXCLUDED));

    lTable.setPageLength(inPermissions.size() > TABLE_SIZE ? TABLE_SIZE : 0);
    lTable.setColumnCollapsingAllowed(true);
    lTable.setColumnReorderingAllowed(true);
    lTable.setSelectable(true);
    lTable.setImmediate(true);

    lTable.setVisibleColumns(LoadedPermissionContainer.NATURAL_COL_ORDER);
    lTable.setColumnHeaders(getHeaders(inRoles, lMessages));
    lTable.setColumnExpandRatio(LoadedPermissionContainer.FIELD_LABEL, 1);
    lLayout.addComponent(lTable);

    final Button lDelete = new Button(lMessages.getMessage("ui.permission.button.delete")); //$NON-NLS-1$
    final Button lSave = new Button(lMessages.getMessage("ui.permission.button.save")); //$NON-NLS-1$
    lSave.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            if (!inTask.saveChanges()) {
                Notification.show(lMessages.getMessage("errmsg.permissions.save"), //$NON-NLS-1$
                        Type.WARNING_MESSAGE);
            }
        }
    });
    lLayout.addComponent(RiplaViewHelper.createButtons(lDelete, lSave));

    lLayout.addComponent(RiplaViewHelper.createSpacer());
    final Component lInput = createInput(inTask, lMessages);
    lLayout.addComponent(lInput);

    // add button click listeners
    lDelete.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent inEvent) {
            if (confirmationMode) {
                if (!inTask.deletePermissions()) {
                    Notification.show(lMessages.getMessage("errmsg.permissions.delete"), //$NON-NLS-1$
                            Type.WARNING_MESSAGE);
                }
            } else {
                if (VIFViewHelper.processAction(inPermissions)) {
                    confirmationMode = true;
                    inPermissions.addContainerFilter(new SelectedFilter());
                    lSubtitle.setVisible(true);
                    lTable.setSelectable(false);
                    lTable.setPageLength(0);
                    lInput.setVisible(false);
                    lSave.setVisible(false);
                }
            }
        }
    });
}

From source file:org.ikasan.dashboard.ui.framework.group.VisibilityGroup.java

License:BSD License

/**
 * Method to set if the components are visible.
 * //from  w  w w .ja v  a  2s .  co m
 * @param visible
 */
public void setVisible() {
    final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest()
            .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER);

    for (Component component : components.keySet()) {
        String policyName = this.components.get(component);

        if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
                || authentication.hasGrantedAuthority(policyName))) {
            component.setVisible(true);
        } else {
            component.setVisible(false);
        }
    }

    for (Table table : refreshableTables) {
        table.refreshRowCache();
    }
}

From source file:org.ikasan.dashboard.ui.framework.group.VisibilityGroup.java

License:BSD License

/**
 * Method to set if the components are visible.
 * //from w w w . ja  va 2s .  c  o  m
 * @param visible
 */
public void setVisible(String linkedItemType, Long linkedItemId) {
    final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest()
            .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER);

    for (Component component : components.keySet()) {
        String policyName = this.components.get(component);

        if (authentication != null
                && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
                        || authentication.hasGrantedAuthority(policyName))
                || authentication.canAccessLinkedItem(linkedItemType, linkedItemId)) {
            component.setVisible(true);
        } else {
            component.setVisible(false);
        }
    }

    for (Table table : refreshableTables) {
        table.refreshRowCache();
    }
}

From source file:org.ikasan.dashboard.ui.framework.panel.LandingViewPanel.java

License:BSD License

private void toggleMaximized(final Component panel, final boolean maximized) {
    if (maximized) {
        panel.setVisible(true);
        panel.addStyleName("max");
    } else {/* w  w  w.j  a  va 2 s  .  co  m*/
        panel.removeStyleName("max");
    }
}

From source file:org.ikasan.dashboard.ui.IkasanUI.java

License:BSD License

@Override
protected void init(VaadinRequest request) {
    VaadinSession.getCurrent().setAttribute(DashboardSessionValueConstants.TOPOLOGY_STATE_CACHE,
            this.topologyStateCache);

    addStyleName(ValoTheme.UI_WITH_MENU);

    this.mainLayout.setSizeFull();
    this.setContent(this.mainLayout);

    this.imagePanelLayout.removeAllComponents();
    this.imagePanelLayout.setHeight("70px");

    this.mainLayout.removeAllComponents();
    this.mainLayout.addComponent(imagePanelLayout, 0, 0);

    this.imagePanelLayout.setStyleName("v-header");

    this.imagePanelLayout.addComponent(this.bannerImage);
    this.bannerImage.setHeight("150%");
    this.imagePanelLayout.setExpandRatio(this.bannerImage, 0.5f);

    this.bannerLabel.setStyleName("ikasan-maroon");
    this.bannerLabel.setHeight("100%");
    this.imagePanelLayout.addComponent(this.bannerLabel);
    this.imagePanelLayout.setExpandRatio(this.bannerLabel, 0.5f);
    this.imagePanelLayout.setComponentAlignment(this.bannerLabel, Alignment.BOTTOM_LEFT);

    this.mainLayout.addComponent(navigationPanel, 0, 1);

    loadTopLevelNavigator();//from   w w w.  jav  a 2  s.  c  o  m
    buildContent();
    this.menuLayout.addMenu(this.menuContent);
    this.mainLayout.addComponent(this.menuLayout, 0, 2);

    this.mainLayout.setRowExpandRatio(2, 1);

    this.navigationPanel.resetCurrentView();
    this.navigationPanel.setToggleButton(buildToggleButton());

    for (Component component : menu.getMenuComponents().keySet()) {
        component.setVisible(false);
    }

    this.navigationPanel.setMenuComponents(menu.getMenuComponents());

    UI.getCurrent().getNavigator().navigateTo("landingView");
    this.navigationPanel.setVisible(true);
}

From source file:org.ikasan.dashboard.ui.monitor.component.MonitorPanel.java

License:BSD License

protected void toggleMaximized(final Component panel, final boolean maximized) {
    if (maximized) {

        panel.setVisible(true);
        panel.addStyleName("max");

    } else {/* www.j  av  a 2  s .c  o m*/
        panel.removeStyleName("max");
    }
}

From source file:org.opennms.features.vaadin.jmxconfiggenerator.ui.mbeans.MBeansContentPanel.java

License:Open Source License

private void setContent(Component component) {
    emptyLayout.setVisible(false);
    contentLayout.setVisible(false);
    component.setVisible(true);
}