Java Code Examples for com.vaadin.ui.HorizontalLayout#addComponents()

The following examples show how to use com.vaadin.ui.HorizontalLayout#addComponents() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IdentifierForm.java    From doecode with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public IdentifierForm(RepositoryForm form) {
    this.parent = form;
    
    setSizeUndefined();
    setSpacing(true);
    
    setEnabled(false);
    // load the drop-down values
    identifierType.addItems(Identifier.identifierTypes);
    relationType.addItems(Identifier.relationTypes);
    
    // set up a layout for the form buttons
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponents(save, delete);
    save.setStyleName(ValoTheme.BUTTON_FRIENDLY);
    save.addClickListener(e->this.save());
    delete.setStyleName(ValoTheme.BUTTON_DANGER);
    delete.addClickListener(e->this.delete());
    
    // disable functionality until needed
    save.setEnabled(false);
    delete.setEnabled(false);
    
    addComponents(value, identifierType, relationType, buttons);
}
 
Example 2
Source File: AbstractHawkbitLoginUI.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
protected Component buildFields() {
    final HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.addStyleName("fields");
    buildTenantField();
    buildUserField();
    buildPasswordField();
    buildSignInButton();
    if (multiTenancyIndicator.isMultiTenancySupported()) {
        fields.addComponents(tenant, username, password, signIn);
    } else {
        fields.addComponents(username, password, signIn);
    }
    fields.setComponentAlignment(signIn, Alignment.BOTTOM_LEFT);
    signIn.addClickListener(event -> handleLogin());

    return fields;
}
 
Example 3
Source File: ArtifactDetailsLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void buildLayout() {
    final HorizontalLayout header = new HorizontalLayout();
    header.addStyleName("artifact-details-header");
    header.addStyleName("bordered-layout");
    header.addStyleName("no-border-bottom");
    header.setSpacing(false);
    header.setMargin(false);
    header.setSizeFull();
    header.setHeightUndefined();
    header.setImmediate(true);
    header.addComponents(headerCaptionLayout, maxMinButton);
    header.setComponentAlignment(headerCaptionLayout, Alignment.TOP_LEFT);
    header.setComponentAlignment(maxMinButton, Alignment.TOP_RIGHT);
    header.setExpandRatio(headerCaptionLayout, 1.0F);

    setSizeFull();
    setImmediate(true);
    addStyleName("artifact-table");
    addStyleName("table-layout");
    addComponent(header);
    setComponentAlignment(header, Alignment.MIDDLE_CENTER);
    addComponent(artifactDetailsTable);
    setComponentAlignment(artifactDetailsTable, Alignment.MIDDLE_CENTER);
    setExpandRatio(artifactDetailsTable, 1.0F);
}
 
Example 4
Source File: TargetBulkUpdateWindowLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void buildLayout() {
    mainLayout = new VerticalLayout();
    mainLayout.setSpacing(Boolean.TRUE);
    mainLayout.setSizeUndefined();
    mainLayout.setWidth("200px");

    final HorizontalLayout captionLayout = new HorizontalLayout();
    captionLayout.setSizeFull();
    captionLayout.addComponents(windowCaption, minimizeButton, closeButton);
    captionLayout.setExpandRatio(windowCaption, 1.0F);
    captionLayout.addStyleName("v-window-header");

    final HorizontalLayout uploaderLayout = new HorizontalLayout();
    uploaderLayout.addComponent(bulkUploader);
    uploaderLayout.addComponent(linkToSystemConfigHelp);
    uploaderLayout.setComponentAlignment(linkToSystemConfigHelp, Alignment.BOTTOM_RIGHT);
    uploaderLayout.setExpandRatio(bulkUploader, 1.0F);
    uploaderLayout.setSizeFull();
    mainLayout.addComponents(captionLayout, dsNamecomboBox, descTextArea, tokenVerticalLayout, descTextArea,
            progressBar, targetsCountLabel, uploaderLayout);
}
 
Example 5
Source File: AbstractGridHeader.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void buildLayout() {
    final HorizontalLayout titleFilterIconsLayout = createHeaderFilterIconLayout();
    titleFilterIconsLayout.addComponents(headerCaptionLayout);

    if (isAllowSearch() && isRollout()) {
        titleFilterIconsLayout.addComponents(searchField, searchResetIcon);
        titleFilterIconsLayout.setExpandRatio(headerCaptionLayout, 0.3F);
        titleFilterIconsLayout.setExpandRatio(searchField, 0.7F);
    }
    if (hasCreatePermission() && isRollout()) {
        titleFilterIconsLayout.addComponent(addButton);
        titleFilterIconsLayout.setComponentAlignment(addButton, Alignment.TOP_LEFT);
    }
    if (showCloseButton()) {
        titleFilterIconsLayout.addComponent(closeButton);
        titleFilterIconsLayout.setComponentAlignment(closeButton, Alignment.TOP_RIGHT);
    }

    titleFilterIconsLayout.setHeight("40px");
    addComponent(titleFilterIconsLayout);
    addStyleName("bordered-layout");
    addStyleName("no-border-bottom");
}
 
Example 6
Source File: DefaultGridHeader.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Builds the title layout.
 *
 * @return title-layout
 */
protected HorizontalLayout buildTitleLayout() {
    titleLayout = new HorizontalLayout();
    titleLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
    titleLayout.setSpacing(false);
    titleLayout.setMargin(false);
    titleLayout.setSizeFull();
    titleLayout.addComponent(prefixWithTitle);
    titleLayout.setComponentAlignment(prefixWithTitle, Alignment.TOP_LEFT);
    titleLayout.setExpandRatio(prefixWithTitle, 0.8F);

    if (hasHeaderMaximizeSupport()) {
        titleLayout.addComponents(getHeaderMaximizeSupport().maxMinButton);
        titleLayout.setComponentAlignment(getHeaderMaximizeSupport().maxMinButton, Alignment.TOP_RIGHT);
        titleLayout.setExpandRatio(getHeaderMaximizeSupport().maxMinButton, 0.2F);
    }

    return titleLayout;
}
 
Example 7
Source File: AgentForm.java    From doecode with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public AgentForm(RepositoryForm form) {
    this.parent = form;
    
    setSizeUndefined();
    
    GridLayout formContainer = new GridLayout(2,5);
    formContainer.setSpacing(true);
    
    agentTypeCode.addItems(Agent.agentTypes);
    agentTypeSpecific.addItems(Agent.specificTypes);
    
    Validator phoneValidator = new RegexpValidator("^((\\d{3}-|\\(\\d{3}\\)\\s?)?\\d{3}-|^\\d{3}(\\.)?\\d{3}\\3)\\d{4}$", "Please enter a valid phone number.");
    phoneNumber.addValidator(phoneValidator);
            
    formContainer.addComponent(firstName);
    formContainer.addComponent(lastName);
    formContainer.addComponent(agentTypeCode,0,1);
    formContainer.addComponent(agentTypeSpecific,1,1);
    formContainer.addComponent(email,0,2);
    formContainer.addComponent(affiliation,1,2);
    formContainer.addComponent(orcid,0,3);
    formContainer.addComponent(phoneNumber,1,3);
    
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponents(save, delete);
    
    save.setStyleName(ValoTheme.BUTTON_FRIENDLY);
    delete.setStyleName(ValoTheme.BUTTON_DANGER);
    
    save.setEnabled(false);
    delete.setEnabled(false);
    
    save.addClickListener(e->this.save());
    delete.addClickListener(e->this.delete());
    
    formContainer.addComponent(buttons, 0,4,1,4);
    
    addComponent(formContainer);
}
 
Example 8
Source File: CreateOrUpdateFilterHeader.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
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();
    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");
}
 
Example 9
Source File: TargetFilterHeader.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void buildLayout() {
    final HorizontalLayout titleFilterIconsLayout = createHeaderFilterIconLayout();
    titleFilterIconsLayout.addComponents(headerCaption, searchField, searchResetIcon);
    if (permissionChecker.hasCreateTargetPermission()) {
        titleFilterIconsLayout.addComponent(createfilterButton);
        titleFilterIconsLayout.setComponentAlignment(createfilterButton, Alignment.TOP_LEFT);
    }
    titleFilterIconsLayout.setExpandRatio(headerCaption, 0.3F);
    titleFilterIconsLayout.setExpandRatio(searchField, 0.7F);
    titleFilterIconsLayout.setHeight("40px");
    addComponent(titleFilterIconsLayout);
    addStyleName("bordered-layout");
    addStyleName("no-border-bottom");

}
 
Example 10
Source File: AbstractTagLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected void buildLayout() {
    mainLayout = new GridLayout(3, 2);
    mainLayout.setSpacing(true);
    colorPickerLayout = new ColorPickerLayout();
    ColorPickerHelper.setRgbSliderValues(colorPickerLayout);
    contentLayout = new VerticalLayout();

    colorLabelLayout = new HorizontalLayout();
    colorLabelLayout.setMargin(false);
    colorLabelLayout.addComponents(colorLabel, tagColorPreviewBtn);

    formLayout.addComponent(tagName);
    formLayout.addComponent(tagDesc);
    formLayout.setSizeFull();

    contentLayout.addComponent(formLayout);
    contentLayout.addComponent(colorLabelLayout);
    contentLayout.setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER);
    contentLayout.setComponentAlignment(colorLabelLayout, Alignment.MIDDLE_LEFT);
    contentLayout.setSizeUndefined();

    mainLayout.setSizeFull();
    mainLayout.addComponent(contentLayout, 0, 0);

    colorPickerLayout.setVisible(false);
    mainLayout.addComponent(colorPickerLayout, 1, 0);
    mainLayout.setComponentAlignment(colorPickerLayout, Alignment.MIDDLE_CENTER);

    setCompositionRoot(mainLayout);
    tagName.focus();
}
 
Example 11
Source File: UploadProgressInfoWindow.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private HorizontalLayout getCaptionLayout() {
    final HorizontalLayout captionLayout = new HorizontalLayout();
    captionLayout.setSizeFull();
    captionLayout.setHeight("36px");
    captionLayout.addComponents(windowCaption, closeButton);
    captionLayout.setExpandRatio(windowCaption, 1.0F);
    captionLayout.addStyleName("v-window-header");
    return captionLayout;
}
 
Example 12
Source File: AbstractTableDetailsLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected void buildLayout() {
    nameEditLayout = new HorizontalLayout();

    final HorizontalLayout headerCaptionLayout = new HorizontalLayout();
    headerCaptionLayout.setMargin(false);
    headerCaptionLayout.setSpacing(true);
    headerCaptionLayout.setSizeFull();
    headerCaptionLayout.addStyleName("header-caption");

    headerCaptionLayout.addComponent(captionPrefix);
    headerCaptionLayout.setComponentAlignment(captionPrefix, Alignment.TOP_LEFT);
    headerCaptionLayout.setExpandRatio(captionPrefix, 0.0F);

    headerCaptionLayout.addComponent(captionNameVersion);
    headerCaptionLayout.setComponentAlignment(captionNameVersion, Alignment.TOP_LEFT);
    headerCaptionLayout.setExpandRatio(captionNameVersion, 1.0F);

    nameEditLayout.setWidth(100.0F, Unit.PERCENTAGE);
    nameEditLayout.addComponents(headerCaptionLayout);
    nameEditLayout.setComponentAlignment(headerCaptionLayout, Alignment.TOP_LEFT);
    if (hasEditPermission()) {
        nameEditLayout.addComponent(editButton);
        nameEditLayout.setComponentAlignment(editButton, Alignment.TOP_RIGHT);
        nameEditLayout.addComponent(manageMetadataBtn);
        nameEditLayout.setComponentAlignment(manageMetadataBtn, Alignment.TOP_RIGHT);
    }
    nameEditLayout.setExpandRatio(headerCaptionLayout, 1.0F);
    nameEditLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);

    addComponent(nameEditLayout);
    setComponentAlignment(nameEditLayout, Alignment.TOP_CENTER);
    addComponent(detailsTab);
    setComponentAlignment(nameEditLayout, Alignment.TOP_CENTER);

    setSizeFull();
    setHeightUndefined();
    addStyleName(SPUIStyleDefinitions.WIDGET_STYLE);
}
 
Example 13
Source File: AbstractMetadataPopupLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void buildLayout() {
    final HorizontalLayout headerLayout = new HorizontalLayout();
    headerLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
    headerLayout.setSpacing(false);
    headerLayout.setMargin(false);
    headerLayout.setSizeFull();
    headerLayout.addComponent(headerCaption);
    if (hasCreatePermission()) {
        headerLayout.addComponents(addIcon);
        headerLayout.setComponentAlignment(addIcon, Alignment.MIDDLE_RIGHT);
    }
    headerLayout.setExpandRatio(headerCaption, 1.0F);

    final HorizontalLayout headerWrapperLayout = new HorizontalLayout();
    headerWrapperLayout.addStyleName("bordered-layout" + " " + "no-border-bottom" + " " + "metadata-table-margin");
    headerWrapperLayout.addComponent(headerLayout);
    headerWrapperLayout.setWidth("100%");
    headerLayout.setHeight("30px");

    final VerticalLayout tableLayout = new VerticalLayout();
    tableLayout.setSizeFull();
    tableLayout.setHeight("100%");
    tableLayout.addComponent(headerWrapperLayout);
    tableLayout.addComponent(metaDataGrid);
    tableLayout.addStyleName("table-layout");
    tableLayout.setExpandRatio(metaDataGrid, 1.0F);

    final VerticalLayout metadataFieldsLayout = createMetadataFieldsLayout();

    mainLayout = new HorizontalLayout();
    mainLayout.addComponent(tableLayout);
    mainLayout.addComponent(metadataFieldsLayout);
    mainLayout.setExpandRatio(tableLayout, 0.5F);
    mainLayout.setExpandRatio(metadataFieldsLayout, 0.5F);
    mainLayout.setSizeFull();
    mainLayout.setSpacing(true);
    setCompositionRoot(mainLayout);
    setSizeFull();
}
 
Example 14
Source File: AbstractTableHeader.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
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);
    }
    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");
}