Example usage for com.vaadin.ui VerticalLayout setComponentAlignment

List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setComponentAlignment.

Prototype

@Override
    public void setComponentAlignment(Component childComponent, Alignment alignment) 

Source Link

Usage

From source file:org.eclipse.hawkbit.ui.management.targettag.MultipleTargetFilter.java

License:Open Source License

private Component getSimpleFilterTab() {
    simpleFilterTab = new VerticalLayout();
    final VerticalLayout targetTagTableLayout = new VerticalLayout();
    targetTagTableLayout.setSizeFull();//from   w w w .j  ava2s .c  o m
    if (null != config) {
        targetTagTableLayout.addComponent(config);
        targetTagTableLayout.setComponentAlignment(config, Alignment.TOP_RIGHT);
    }
    targetTagTableLayout.addComponent(filterByButtons);
    targetTagTableLayout.setComponentAlignment(filterByButtons, Alignment.MIDDLE_CENTER);
    targetTagTableLayout.setId(UIComponentIdProvider.TARGET_TAG_DROP_AREA_ID);
    targetTagTableLayout.setExpandRatio(filterByButtons, 1.0F);
    simpleFilterTab.setCaption(i18n.getMessage("caption.filter.simple"));
    simpleFilterTab.addComponent(targetTagTableLayout);
    simpleFilterTab.setExpandRatio(targetTagTableLayout, 1.0F);
    simpleFilterTab.addComponent(filterByStatusFotter);
    simpleFilterTab.setComponentAlignment(filterByStatusFotter, Alignment.MIDDLE_CENTER);
    simpleFilterTab.setSizeFull();
    simpleFilterTab.addStyleName(SPUIStyleDefinitions.SIMPLE_FILTER_HEADER);
    return simpleFilterTab;
}

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

License:Open Source License

private Component buildContent() {
    final VerticalLayout dashboardMenuLayout = new VerticalLayout();
    dashboardMenuLayout.setSizeFull();// ww w .  j a  v  a  2 s .c om
    final VerticalLayout menuContent = getMenuLayout();
    menuContent.addComponent(buildUserMenu(uiProperties));
    menuContent.addComponent(buildToggleButton());

    final VerticalLayout menus = buildMenuItems();
    final VerticalLayout links = buildLinksAndVersion();
    menus.addComponent(links);
    menus.setComponentAlignment(links, Alignment.BOTTOM_CENTER);
    menus.setExpandRatio(links, 1.0F);
    menuContent.addComponent(menus);
    menuContent.setExpandRatio(menus, 1.0F);

    dashboardMenuLayout.addComponent(menuContent);
    return dashboardMenuLayout;
}

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

License:Open Source License

private VerticalLayout buildLinksAndVersion() {
    final VerticalLayout links = new VerticalLayout();
    links.setSpacing(true);/* w  w  w .ja  v a 2 s . c o  m*/
    links.addStyleName("links");
    final String linkStyle = "v-link";

    if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) {
        final Link docuLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_DOCUMENTATION,
                i18n.getMessage("link.documentation.name"),
                uiProperties.getLinks().getDocumentation().getRoot(), FontAwesome.QUESTION_CIRCLE, "_blank",
                linkStyle);
        docuLink.setSizeFull();
        links.addComponent(docuLink);
        links.setComponentAlignment(docuLink, Alignment.BOTTOM_CENTER);
    }

    if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
        final Link userManagementLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_USERMANAGEMENT,
                i18n.getMessage("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(),
                FontAwesome.USERS, "_blank", linkStyle);
        links.addComponent(userManagementLink);
        userManagementLink.setSizeFull();
        links.setComponentAlignment(userManagementLink, Alignment.BOTTOM_CENTER);
    }

    if (!uiProperties.getLinks().getSupport().isEmpty()) {
        final Link supportLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_SUPPORT,
                i18n.getMessage("link.support.name"), uiProperties.getLinks().getSupport(),
                FontAwesome.ENVELOPE_O, "", linkStyle);
        supportLink.setSizeFull();
        links.addComponent(supportLink);
        links.setComponentAlignment(supportLink, Alignment.BOTTOM_CENTER);

    }

    final Component buildVersionInfo = buildVersionInfo();
    links.addComponent(buildVersionInfo);
    links.setComponentAlignment(buildVersionInfo, Alignment.BOTTOM_CENTER);
    links.setSizeFull();
    links.setHeightUndefined();
    return links;
}

From source file:org.eclipse.hawkbit.ui.tenantconfiguration.TenantConfigurationDashboardView.java

License:Open Source License

/**
 * Init method adds all Configuration Views to the list of Views.
 *///from   w  w  w .  ja va  2s  .  c o m
@PostConstruct
public void init() {
    if (defaultDistributionSetTypeLayout.getComponentCount() > 0) {
        configurationViews.add(defaultDistributionSetTypeLayout);
    }
    configurationViews.add(repositoryConfigurationView);
    configurationViews.add(rolloutConfigurationView);
    configurationViews.add(authenticationConfigurationView);
    configurationViews.add(pollingConfigurationView);
    if (customConfigurationViews != null) {
        configurationViews.addAll(customConfigurationViews.stream().filter(ConfigurationGroup::show)
                .collect(Collectors.toList()));
    }

    final Panel rootPanel = new Panel();
    rootPanel.setStyleName("tenantconfig-root");

    final VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.setSizeFull();
    rootLayout.setMargin(true);
    rootLayout.setSpacing(true);

    configurationViews.forEach(rootLayout::addComponent);

    final HorizontalLayout buttonContent = saveConfigurationButtonsLayout();
    rootLayout.addComponent(buttonContent);
    rootLayout.setComponentAlignment(buttonContent, Alignment.BOTTOM_LEFT);
    rootPanel.setContent(rootLayout);
    setCompositionRoot(rootPanel);

    configurationViews.forEach(view -> view.addChangeListener(this));
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ReviewComponent.java

License:Open Source License

@SuppressWarnings("serial")
private Window createReviewWindow(final ProjectRating rating) {
    final Window subwindow = new Window("Rate and Review");
    subwindow.setModal(true);/*from  w w w .j av  a 2 s.c o  m*/
    subwindow.setWidth("420px"); //$NON-NLS-1$
    subwindow.setHeight("320px"); //$NON-NLS-1$

    VerticalLayout vl = (VerticalLayout) subwindow.getContent();
    vl.setSpacing(true);
    vl.setSizeFull();

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeUndefined();

    Embedded icon = new Embedded(null, getIcon(rating));
    Label iconLabel = new Label("<b>" + HSPACE + getReviewComment(rating) + "</b>", Label.CONTENT_XHTML); //$NON-NLS-1$ //$NON-NLS-2$
    String captionTextField = getReviewCommentQuestion(rating);
    hl.addComponent(icon);
    hl.addComponent(iconLabel);
    hl.setComponentAlignment(iconLabel, Alignment.MIDDLE_LEFT);
    vl.addComponent(hl);

    final TextField editor = new TextField(captionTextField);
    editor.setRows(3);
    editor.setColumns(30);
    editor.setImmediate(true);
    vl.addComponent(editor);

    final User user = util.getLoggedInUser();
    final ArrayList<String> userSelects = new ArrayList<String>(2);
    userSelects.add("I want to vote as " + user.getDisplayName());
    if (extension.getAllowAnonymous()) {
        userSelects.add("I want to vote as Anonymous!");
    }
    final OptionGroup userSelect = new OptionGroup(null, userSelects);
    userSelect.setNullSelectionAllowed(false);
    userSelect.select(userSelects.get(0));
    vl.addComponent(userSelect);

    CssLayout css = new CssLayout() {
        @Override
        protected String getCss(Component c) {
            return "margin-left:5px;margin-right:5px;margin-top:10px"; //$NON-NLS-1$
        }
    };

    Button okButton = new Button("OK");
    okButton.setIcon(ICON_BUTTON_OK);
    okButton.setDescription("Commit changes");
    okButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            String comment = (String) editor.getValue();
            if (StringUtils.isBlank(comment)) {
                comment = "No Comment";
            }
            ((Window) subwindow.getParent()).removeWindow(subwindow);
            String userName = "Anonymous";
            if (userSelects.get(0).equals(userSelect.getValue())) {
                userName = user.getDisplayName();
            }
            ReviewEntry review = new ReviewEntry(rating, comment, userName, System.currentTimeMillis());
            extension.addReview(review);
            util.persist(project);
            reviews = extension.getReviews();
            size = reviews.size();
            currentPage = 0;
            lastPage = size / currentPageLength;
            paintReviewList();
        }
    });
    css.addComponent(okButton);

    Button cancelButton = new Button("Cancel");
    cancelButton.setIcon(ICON_BUTTON_CANCEL);
    cancelButton.setDescription("Discard changes");
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            ((Window) subwindow.getParent()).removeWindow(subwindow);
        }
    });
    css.addComponent(cancelButton);

    vl.addComponent(css);
    vl.setComponentAlignment(css, Alignment.MIDDLE_CENTER);

    return subwindow;
}

From source file:org.eclipse.skalli.view.internal.window.NewProjectPanel.java

License:Open Source License

/**
 * Renders the content of the panel./*from  ww w  .j a  v a 2  s  .c o  m*/
 */
private void renderContent(VerticalLayout content) {

    CssLayout layout = new CssLayout();
    layout.setWidth("600px"); //$NON-NLS-1$
    content.addComponent(layout);
    content.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);

    Label title = new Label("<h2>" + "Available Project Templates" + "</h2>", Label.CONTENT_XHTML); //$NON-NLS-1$//$NON-NLS-3$
    layout.addComponent(title);

    TreeSet<RadioSelect.Entry> entries = new TreeSet<RadioSelect.Entry>();
    for (ProjectTemplate projectTemplate : projectTemplates) {
        entries.add(new RadioSelect.Entry(projectTemplate.getId(), projectTemplate.getDisplayName(),
                projectTemplate.getDescription(), projectTemplate.getRank()));
    }
    select = new RadioSelect("", entries); //$NON-NLS-1$
    layout.addComponent(select);

    renderButtons(content);

    // for ui debugging
    content.setDebugId(DEBUG_ID_CONTENT);
}

From source file:org.eclipse.skalli.view.internal.window.NewProjectPanel.java

License:Open Source License

/**
 * Renders the OK/Cancel button bar.//from w ww  .  j a v a 2s  .co  m
 */
private void renderButtons(VerticalLayout content) {
    CssLayout buttons = new CssLayout();
    buttons.addStyleName(STYLE_TEMPLATE_SELECT_BUTTONS);

    Button okButton = new Button("Create Project");
    okButton.setIcon(ICON_BUTTON_OK);
    okButton.addListener(new OKButtonListener());
    buttons.addComponent(okButton);

    Button cancelButton = new Button("Cancel");
    cancelButton.setIcon(ICON_BUTTON_CANCEL);
    cancelButton.addListener(new CancelButtonListener());
    buttons.addComponent(cancelButton);

    content.addComponent(buttons);
    content.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER);
}

From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java

License:Open Source License

private void renderProgessIndicator(VerticalLayout layout) {
    indicatorArea = new CssLayout();
    indicatorArea.setVisible(false);/*from ww  w . j  av a 2s  . c  om*/
    indicatorArea.setMargin(true);
    indicatorArea.setWidth(PANEL_WIDTH);
    indicatorArea
            .addComponent(new Label("<strong>Project is checked for issues</strong>", Label.CONTENT_XHTML));
    progressIndicator = new ProgressIndicator();
    progressIndicator.setWidth("300px");
    progressIndicator.setIndeterminate(false);
    indicatorArea.addComponent(progressIndicator);
    layout.addComponent(indicatorArea);
    layout.setComponentAlignment(indicatorArea, Alignment.MIDDLE_CENTER);
}

From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java

License:Open Source License

private Label renderMessageArea(VerticalLayout layout) {
    CssLayout messageArea = new CssLayout();
    messageArea.setMargin(true);//from   ww  w.  j  ava  2  s  .  co  m
    messageArea.setWidth(PANEL_WIDTH);
    Label label = new Label("", Label.CONTENT_XHTML); //$NON-NLS-1$
    label.addStyleName(STYLE_ISSUES);
    label.setVisible(false);
    messageArea.addComponent(label);
    layout.addComponent(messageArea);
    layout.setComponentAlignment(messageArea, Alignment.MIDDLE_CENTER);
    return label;
}

From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java

License:Open Source License

/**
 * Renders a OK/Cancel/Validate/Expand All/Collapse All button bar.
 */// w  ww. j  ava  2  s  .  com
@SuppressWarnings("serial")
private Button renderButtons(VerticalLayout layout, boolean header) {
    CssLayout buttons = new CssLayout();
    buttons.addStyleName(STYLE_EDIT_PROJECT_BUTTONS);
    String prefix = header ? HEADER : FOOTER;

    Button okButton = new Button("OK");
    okButton.setIcon(ICON_BUTTON_OK);
    okButton.setDescription("Save the modified project");
    okButton.addStyleName(prefix + BUTTON_OK);
    okButton.addListener(new OKButtonListener());
    buttons.addComponent(okButton);

    Button cancelButton = new Button("Cancel");
    cancelButton.setIcon(ICON_BUTTON_CANCEL);
    cancelButton.setDescription("Discard all changes to the project");
    cancelButton.addStyleName(prefix + BUTTON_CANCEL);
    cancelButton.addListener(new CancelButtonListener());
    buttons.addComponent(cancelButton);

    Button checkButton = new Button("Check");
    checkButton.setIcon(ICON_BUTTON_VALIDATE);
    checkButton.setDescription("Checks the modified project for issues without saving it");
    checkButton.addStyleName(prefix + BUTTON_VALIDATE);
    checkButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            validateModifiedProject();
        }
    });
    buttons.addComponent(checkButton);

    Button expandAllButton = new Button("Expand All");
    expandAllButton.setIcon(ICON_BUTTON_EXPAND_ALL);
    expandAllButton.setDescription("Expand all panels");
    expandAllButton.addStyleName(prefix + BUTTON_EXPAND_ALL);
    expandAllButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            expandAllPanels();
        }
    });
    buttons.addComponent(expandAllButton);

    Button collapseAllButton = new Button("Collapse All");
    collapseAllButton.setIcon(ICON_BUTTON_COLLAPSE_ALL);
    collapseAllButton.setDescription("Collapse all panels");
    collapseAllButton.addStyleName(prefix + BUTTON_COLLAPSE_ALL);
    collapseAllButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            collapseAllPanels();
        }
    });
    buttons.addComponent(collapseAllButton);

    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER);
    return checkButton;
}