Example usage for com.vaadin.ui Alignment TOP_LEFT

List of usage examples for com.vaadin.ui Alignment TOP_LEFT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment TOP_LEFT.

Prototype

Alignment TOP_LEFT

To view the source code for com.vaadin.ui Alignment TOP_LEFT.

Click Source Link

Usage

From source file:org.eclipse.hawkbit.ui.common.table.AbstractTableHeader.java

License:Open Source License

private void buildLayout() {
    final HorizontalLayout titleFilterIconsLayout = createHeaderFilterIconLayout();

    titleFilterIconsLayout.addComponents(headerCaption, searchField, searchResetIcon, showFilterButtonLayout);
    titleFilterIconsLayout.setComponentAlignment(headerCaption, Alignment.TOP_LEFT);
    titleFilterIconsLayout.setComponentAlignment(searchField, Alignment.TOP_RIGHT);
    titleFilterIconsLayout.setComponentAlignment(searchResetIcon, Alignment.TOP_RIGHT);
    titleFilterIconsLayout.setComponentAlignment(showFilterButtonLayout, Alignment.TOP_RIGHT);
    if (hasCreatePermission() && isAddNewItemAllowed()) {
        titleFilterIconsLayout.addComponent(addIcon);
        titleFilterIconsLayout.setComponentAlignment(addIcon, Alignment.TOP_RIGHT);
    }/*w  ww  . j  a v a 2s .  co m*/
    if (hasCreatePermission() && isBulkUploadAllowed()) {
        titleFilterIconsLayout.addComponent(bulkUploadIcon);
        titleFilterIconsLayout.setComponentAlignment(bulkUploadIcon, Alignment.TOP_RIGHT);
    }
    titleFilterIconsLayout.addComponent(maxMinIcon);
    titleFilterIconsLayout.setComponentAlignment(maxMinIcon, Alignment.TOP_RIGHT);
    titleFilterIconsLayout.setExpandRatio(headerCaption, 0.4F);
    titleFilterIconsLayout.setExpandRatio(searchField, 0.6F);

    addComponent(titleFilterIconsLayout);

    final HorizontalLayout dropHintDropFilterLayout = new HorizontalLayout();
    dropHintDropFilterLayout.addStyleName("filter-drop-hint-layout");
    dropHintDropFilterLayout.setWidth(100, Unit.PERCENTAGE);
    if (isDropFilterRequired()) {
        filterDroppedInfo = new HorizontalLayout();
        filterDroppedInfo.setImmediate(true);
        filterDroppedInfo.setStyleName("target-dist-filter-info");
        filterDroppedInfo.setHeightUndefined();
        filterDroppedInfo.setSizeUndefined();
        displayFilterDropedInfoOnLoad();
        final DragAndDropWrapper dropFilterLayout = new DragAndDropWrapper(filterDroppedInfo);
        dropFilterLayout.setId(getDropFilterId());
        dropFilterLayout.setDropHandler(getDropFilterHandler());

        dropHintDropFilterLayout.addComponent(dropFilterLayout);
        dropHintDropFilterLayout.setComponentAlignment(dropFilterLayout, Alignment.TOP_CENTER);
        dropHintDropFilterLayout.setExpandRatio(dropFilterLayout, 1.0F);
    }
    addComponent(dropHintDropFilterLayout);
    setComponentAlignment(dropHintDropFilterLayout, Alignment.TOP_CENTER);
    addStyleName("bordered-layout");
    addStyleName("no-border-bottom");
}

From source file:org.eclipse.hawkbit.ui.filtermanagement.CreateOrUpdateFilterHeader.java

License:Open Source License

private void buildLayout() {
    captionLayout = new HorizontalLayout();
    captionLayout.setDescription(i18n.getMessage("tooltip.click.to.edit"));
    captionLayout.setId(UIComponentIdProvider.TARGET_FILTER_QUERY_NAME_LAYOUT_ID);

    titleFilterIconsLayout = new HorizontalLayout();
    titleFilterIconsLayout.addComponents(headerCaption, captionLayout);
    titleFilterIconsLayout.setSpacing(true);

    final HorizontalLayout breadcrumbLayout = new HorizontalLayout();
    breadcrumbLayout.addComponent(breadcrumbButton);
    breadcrumbLayout.addComponent(new Label(">"));
    breadcrumbName = new LabelBuilder().buildCaptionLabel();
    breadcrumbLayout.addComponent(breadcrumbName);
    breadcrumbName.addStyleName("breadcrumbPaddingLeft");

    final HorizontalLayout titleFilterLayout = new HorizontalLayout();
    titleFilterLayout.setSizeFull();//  w  w  w  . j a v a2s  . c  om
    titleFilterLayout.addComponents(titleFilterIconsLayout, closeIcon);
    titleFilterLayout.setExpandRatio(titleFilterIconsLayout, 1.0F);
    titleFilterLayout.setComponentAlignment(titleFilterIconsLayout, Alignment.TOP_LEFT);
    titleFilterLayout.setComponentAlignment(closeIcon, Alignment.TOP_RIGHT);

    final HorizontalLayout iconLayout = new HorizontalLayout();
    iconLayout.setSizeUndefined();
    iconLayout.setSpacing(false);
    iconLayout.addComponents(helpLink, searchIcon, saveButton);

    final HorizontalLayout queryLayout = new HorizontalLayout();
    queryLayout.setSizeUndefined();
    queryLayout.setSpacing(true);
    queryLayout.addComponents(queryTextField, iconLayout);

    addComponent(breadcrumbLayout);
    addComponent(titleFilterLayout);
    addComponent(queryLayout);
    setSpacing(true);
    addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
    addStyleName("bordered-layout");
}

From source file:org.eclipse.hawkbit.ui.filtermanagement.TargetFilterHeader.java

License:Open Source License

private void buildLayout() {
    final HorizontalLayout titleFilterIconsLayout = createHeaderFilterIconLayout();
    titleFilterIconsLayout.addComponents(headerCaption, searchField, searchResetIcon);
    if (permissionChecker.hasCreateTargetPermission()) {
        titleFilterIconsLayout.addComponent(createfilterButton);
        titleFilterIconsLayout.setComponentAlignment(createfilterButton, Alignment.TOP_LEFT);
    }//from www. j a  va 2 s.  com
    titleFilterIconsLayout.setExpandRatio(headerCaption, 0.3F);
    titleFilterIconsLayout.setExpandRatio(searchField, 0.7F);
    titleFilterIconsLayout.setHeight("40px");
    addComponent(titleFilterIconsLayout);
    addStyleName("bordered-layout");
    addStyleName("no-border-bottom");

}

From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryHeader.java

License:Open Source License

private void buildLayout() {
    final HorizontalLayout titleMaxIconsLayout = new HorizontalLayout();
    titleMaxIconsLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
    titleMaxIconsLayout.setSpacing(false);
    titleMaxIconsLayout.setMargin(false);
    titleMaxIconsLayout.setSizeFull();/*from www  .j a  va  2  s.c o m*/
    titleMaxIconsLayout.addComponents(titleOfActionHistory, maxMinButton);
    titleMaxIconsLayout.setComponentAlignment(titleOfActionHistory, Alignment.TOP_LEFT);
    titleMaxIconsLayout.setComponentAlignment(maxMinButton, Alignment.TOP_RIGHT);
    titleMaxIconsLayout.setExpandRatio(titleOfActionHistory, 0.8f);
    titleMaxIconsLayout.setExpandRatio(maxMinButton, 0.2f);

    // Note: here the only purpose of adding drop hints to the layout is to
    // maintain consistent
    // height for all widgets headers.
    addComponent(titleMaxIconsLayout);
    setComponentAlignment(titleMaxIconsLayout, Alignment.TOP_LEFT);
    setWidth(100, Unit.PERCENTAGE);
    setImmediate(true);
    addStyleName("action-history-header");
    addStyleName("bordered-layout");
    addStyleName("no-border-bottom");
}

From source file:org.eclipse.hawkbit.ui.management.DeploymentView.java

License:Open Source License

private void maximizeActionHistory() {
    removeComponent(countMessageLabel);/*  w w w  .j av  a  2s .  c  o  m*/
    mainLayout.removeAllComponents();
    mainLayout.setColumns(3);
    mainLayout.setRows(1);
    mainLayout.addComponent(actionHistoryLayout, 0, 0);
    mainLayout.addComponent(actionStatusLayout, 1, 0);
    mainLayout.addComponent(actionStatusMsgLayout, 2, 0);
    mainLayout.setColumnExpandRatio(0, 0.55F);
    mainLayout.setColumnExpandRatio(1, 0.18F);
    mainLayout.setColumnExpandRatio(2, 0.27F);
    mainLayout.setComponentAlignment(actionHistoryLayout, Alignment.TOP_LEFT);
}

From source file:org.eclipse.skalli.view.component.MultiLinkField.java

License:Open Source License

@SuppressWarnings({ "serial", "deprecation" })
private void render() {
    layout.removeAllComponents();//from w w  w  . j a v a 2s .c  om
    if (!readOnly) {
        layout.setColumns(2);
    }

    int groupsIdx = 0;
    int groupsSize = linkGroups.getItems().size();
    for (final LinkGroup linkGroup : linkGroups.getItems()) {
        Label linkGroupLabel = new Label(linkGroup.getCaption());
        linkGroupLabel.addStyleName(STYLE_LABEL_GROUP);

        layout.addComponent(linkGroupLabel);
        layout.setComponentAlignment(linkGroupLabel, Alignment.TOP_RIGHT);

        if (!readOnly) {
            Button btnUpGroup = null;
            Button btnDownGroup = null;
            Button btnRemoveGroup = null;
            // up
            if (groupsIdx > 0) {
                btnUpGroup = new Button("up");
                btnUpGroup.setStyleName(Button.STYLE_LINK);
                btnUpGroup.addStyleName(STYLE_BUTTON_GROUPACTION);
                btnUpGroup.setDescription(String.format("Move up group '%s'", linkGroup.getCaption()));
                btnUpGroup.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        modified = linkGroups.moveUp(linkGroup);
                        renderIfModified();
                    }
                });
            }
            // down
            if (groupsIdx < groupsSize - 1) {
                btnDownGroup = new Button("down");
                btnDownGroup.setStyleName(Button.STYLE_LINK);
                btnDownGroup.addStyleName(STYLE_BUTTON_GROUPACTION);
                btnDownGroup.setDescription(String.format("Move down group '%s'", linkGroup.getCaption()));
                btnDownGroup.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        modified = linkGroups.moveDown(linkGroup);
                        renderIfModified();
                    }
                });
            }
            // remove
            btnRemoveGroup = new Button("remove");
            btnRemoveGroup.setStyleName(Button.STYLE_LINK);
            btnRemoveGroup.addStyleName(STYLE_BUTTON_GROUPACTION);
            btnRemoveGroup.setDescription(String.format("Remove group '%s'", linkGroup.getCaption()));
            btnRemoveGroup.addListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    modified = linkGroups.remove(linkGroup);
                    renderIfModified();
                }
            });

            HorizontalLayout toolbar = getToolbar(btnUpGroup, btnDownGroup, btnRemoveGroup);
            layout.addComponent(toolbar);
            layout.setComponentAlignment(toolbar, Alignment.TOP_RIGHT);
        }

        layout.newLine();

        Collection<Link> links = linkGroup.getItems();
        int linksIdx = 0;
        int linksSize = links.size();
        for (final Link link : links) {

            if (readOnly) {
                // view
                Label linkLabel = new Label(link.getLabel());
                linkLabel.addStyleName(STYLE_LABEL_LINK);
                linkLabel.setDescription(StringUtils.abbreviate(link.getUrl(), 50));
                layout.addComponent(linkLabel);
                layout.setComponentAlignment(linkLabel, Alignment.TOP_LEFT);
            } else {
                // edit
                Button btnEditLink = new Button(link.getLabel());
                btnEditLink.setStyleName(Button.STYLE_LINK);
                btnEditLink.addStyleName(STYLE_LABEL_LINK);
                btnEditLink.setDescription(String.format("Edit link '%s' %s", link.getLabel(),
                        StringUtils.isBlank(link.getUrl()) ? "" : "[" + link.getUrl() + "]"));
                btnEditLink.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        LinkWindow editLinkWindow = new LinkWindow(MultiLinkField.this, linkGroups.getItems(),
                                linkGroup, link, MultiLinkField.this);
                        editLinkWindow.show();
                    }
                });
                layout.addComponent(btnEditLink);
                layout.setComponentAlignment(btnEditLink, Alignment.TOP_LEFT);
            }

            if (!readOnly) {
                Button btnUpLink = null;
                Button btnDownLink = null;
                Button btnRemoveLink = null;
                // up
                if (linksIdx > 0) {
                    btnUpLink = new Button("up");
                    btnUpLink.setStyleName(Button.STYLE_LINK);
                    btnUpLink.addStyleName(STYLE_BUTTON_LINKACTION);
                    btnUpLink.setDescription(String.format("Move up link '%s'", link.getLabel()));
                    btnUpLink.addListener(new Button.ClickListener() {
                        @Override
                        public void buttonClick(ClickEvent event) {
                            modified = linkGroup.moveUp(link);
                            renderIfModified();
                        }
                    });
                }
                // down
                if (linksIdx < linksSize - 1) {
                    btnDownLink = new Button("down");
                    btnDownLink.setStyleName(Button.STYLE_LINK);
                    btnDownLink.addStyleName(STYLE_BUTTON_LINKACTION);
                    btnDownLink.setDescription(String.format("Move down link '%s'", link.getLabel()));
                    btnDownLink.addListener(new Button.ClickListener() {
                        @Override
                        public void buttonClick(ClickEvent event) {
                            modified = linkGroup.moveDown(link);
                            renderIfModified();
                        }
                    });
                }
                // remove
                btnRemoveLink = new Button("remove");
                btnRemoveLink.setStyleName(Button.STYLE_LINK);
                btnRemoveLink.addStyleName(STYLE_BUTTON_LINKACTION);
                btnRemoveLink.setDescription(String.format("Remove link '%s'", link.getLabel()));
                btnRemoveLink.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        modified = linkGroup.remove(link);
                        if (linkGroup.getItems().isEmpty()) {
                            linkGroups.remove(linkGroup);
                        }
                        renderIfModified();
                    }
                });

                HorizontalLayout toolbar = getToolbar(btnUpLink, btnDownLink, btnRemoveLink);
                layout.addComponent(toolbar);
                layout.setComponentAlignment(toolbar, Alignment.TOP_RIGHT);
            }

            layout.newLine();

            linksIdx++;
        }

        groupsIdx++;
    }

    if (!readOnly) {
        Button btnAddLink = new Button(buttonCaption, new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                LinkWindow addLinkWindow = new LinkWindow(MultiLinkField.this, linkGroups.getItems(),
                        MultiLinkField.this);
                addLinkWindow.show();
            }
        });
        btnAddLink.setStyleName(Button.STYLE_LINK);
        btnAddLink.addStyleName(STYLE_BUTTON_ADD);
        btnAddLink.setDescription("Add Link");
        layout.addComponent(btnAddLink);
    }
}

From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java

License:Open Source License

public static HorizontalLayout createHorizontalLayoutWithELabsLabelAndRelatedDataForRig(final String labelTxt,
        Property dataProperty, RigBean rigBean, final IRigAction controller, LabsRigTableHelper helper,
        boolean required) {
    synchronized (LOCK_1) {
        Preconditions.checkNotNull(labelTxt, "Label is null");
        Preconditions.checkNotNull(dataProperty, "DataSource is null");
        Preconditions.checkNotNull(rigBean, "RigBean is null");
        Preconditions.checkNotNull(helper, "Helper is null");
        Preconditions.checkNotNull(controller, "Controller is null");
        HorizontalLayout horizontalLayout = new HorizontalLayout();
        horizontalLayout.setSizeUndefined();
        horizontalLayout.setEnabled(true);
        horizontalLayout.setSpacing(true);
        horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL_FOR_TABLE);
        Label label = new Label();
        label.setWidth(LABEL_WIDTH);//from  w ww  . j a v a2s  .  c  om
        label.setValue(
                DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END);
        label.setContentMode(Label.CONTENT_XHTML);
        label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
        label.setStyleName(STYLE_ELABS_HOR_PANEL);
        horizontalLayout.addComponent(label, 0);
        horizontalLayout.addComponent(helper.createTableLayoutForRig(rigBean, controller), 1);
        horizontalLayout.setComponentAlignment(label, Alignment.TOP_LEFT);
        return horizontalLayout;
    }
}

From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java

License:Open Source License

public static HorizontalLayout createHorizontalLayoutWithPublicationDataForStudy(final String labelTxt,
        Property dataProperty, boolean isMotNotResPublication, LabsStudyTableHelper helper, boolean required) {
    synchronized (LOCK_2) {
        Preconditions.checkNotNull(labelTxt, "Label is null");
        Preconditions.checkNotNull(dataProperty, "DataSource is null");
        Preconditions.checkNotNull(helper, "Helper is null");
        HorizontalLayout horizontalLayout = new HorizontalLayout();
        horizontalLayout.setSizeUndefined();
        horizontalLayout.setEnabled(true);
        horizontalLayout.setSpacing(true);
        horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL_FOR_TABLE);
        Label label = new Label();
        label.setWidth(LABEL_WIDTH);//from  www. ja  v a2  s  .co m
        label.setValue(
                DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END);
        label.setContentMode(Label.CONTENT_XHTML);
        label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
        label.setStyleName(STYLE_ELABS_HOR_PANEL);
        horizontalLayout.addComponent(label, 0);
        if (isMotNotResPublication) {
            horizontalLayout.addComponent(helper.createTableLayoutForMotPublications(), 1);
        } else {
            horizontalLayout.addComponent(helper.createTableLayoutForResPublications(), 1);
        }
        horizontalLayout.setComponentAlignment(label, Alignment.TOP_LEFT);
        return horizontalLayout;
    }
}

From source file:org.escidoc.browser.ui.maincontent.ContainerMetadataRecordsView.java

License:Open Source License

private Panel lblMetadaRecs() {
    panel.setSizeFull();//from   ww w. jav  a2  s.  c  o m
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    final CssLayout cssLayout = new CssLayout();
    cssLayout.setHeight("20px");
    buildPanelHeader(cssLayout, ViewConstants.METADATA);
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");

    if (containerController.hasAccess()) {
        final Button btnAddNew = new Button();
        btnAddNew.addListener(new OnAddContainerMetadata(mainWindow, repositories, resourceProxy));
        btnAddNew.setStyleName(BaseTheme.BUTTON_LINK);
        btnAddNew.addStyleName("floatright paddingtop3");
        btnAddNew.setWidth("20px");
        btnAddNew.setIcon(ICON);
        cssLayout.addComponent(btnAddNew);
    }
    vl.addComponent(cssLayout);
    ContainerMetadataTable metadataTable = new ContainerMetadataTable(resourceProxy.getMetadataRecords(),
            containerController, router, resourceProxy, repositories);
    metadataTable.buildTable();
    vl.addComponent(metadataTable);
    vl.setComponentAlignment(metadataTable, Alignment.TOP_LEFT);
    vl.setExpandRatio(metadataTable, 0.9f);
    panel.setContent(vl);

    return panel;
}

From source file:org.escidoc.browser.ui.maincontent.ContextRightPanel.java

License:Open Source License

@SuppressWarnings("serial")
private Panel buildOrganizationUnit() {
    final Panel pnlOrgUnit = new Panel();
    pnlOrgUnit.setSizeFull();/* w ww  .  j av a  2 s  .c  om*/
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();

    final CssLayout cssLayout = new CssLayout();
    buildPanelHeader(cssLayout, ViewConstants.ORGANIZATIONAL_UNIT);
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");

    if (contextController.canAddOUs()) {
        final Button addResourceButton = new Button();
        addResourceButton.setStyleName(BaseTheme.BUTTON_LINK);
        addResourceButton.addStyleName("floatright paddingtop3");
        addResourceButton.setWidth("20px");
        addResourceButton.setIcon(ICON);
        addResourceButton.addListener(new ClickListener() {

            @Override
            public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) {
                final Window subwindow = new Window("A modal subwindow");
                subwindow.setModal(true);
                subwindow.setWidth("650px");
                VerticalLayout layout = (VerticalLayout) subwindow.getContent();
                layout.setMargin(true);
                layout.setSpacing(true);

                try {
                    subwindow.addComponent(new AddOrgUnitstoContext(router, resourceProxy, contextController,
                            resourceProxy.getOrganizationalUnit()));
                } catch (EscidocClientException e) {
                    contextController.showError(e);
                }
                Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() {
                    @Override
                    public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
                        subwindow.getParent().removeWindow(subwindow);
                    }
                });
                layout.addComponent(close);
                layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

                router.getMainWindow().addWindow(subwindow);

            }

        });
        cssLayout.addComponent(addResourceButton);
    }
    vl.addComponent(cssLayout);

    OrganizationalUnitsTableVH orgUnitTable = new OrganizationalUnitsTableVH(contextController,
            resourceProxy.getOrganizationalUnit(), router, resourceProxy);
    orgUnitTable.buildTable();
    vl.addComponent(orgUnitTable);
    vl.setComponentAlignment(orgUnitTable, Alignment.TOP_LEFT);
    vl.setExpandRatio(orgUnitTable, 9f);

    pnlOrgUnit.setContent(vl);
    return pnlOrgUnit;
}