List of usage examples for com.vaadin.ui HorizontalLayout setExpandRatio
public void setExpandRatio(Component component, float ratio)
This method is used to control how excess space in layout is distributed among components.
From source file:org.eclipse.emf.ecp.controls.vaadin.AbstractVaadinSimpleControlRenderer.java
License:Open Source License
protected void createSetOrUnsetComponent(final Component component, final HorizontalLayout horizontalLayout, final Setting setting) { final Label unsetLabel = getUnsetComponent(); final Button setButton = getUnsetButton(component, horizontalLayout, setting); setButton.setEnabled(getVElement().isEnabled()); setButton.setVisible(getVElement().isVisible()); setButton.setReadOnly(getVElement().isReadonly()); horizontalLayout.addStyleName("textheight"); horizontalLayout.removeAllComponents(); Component addComponent = component; if (setting.isSet()) { setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Set); unsetLabel.setCaption(getUnsetLabel()); addComponent = unsetLabel;/* www . j ava 2 s.c o m*/ } else { setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Unset); } horizontalLayout.setData(addComponent); horizontalLayout.addComponent(addComponent); horizontalLayout.setExpandRatio(addComponent, 1f); horizontalLayout.addComponent(setButton); horizontalLayout.setComponentAlignment(setButton, Alignment.BOTTOM_RIGHT); }
From source file:org.eclipse.hawkbit.ui.AbstractHawkbitUI.java
License:Open Source License
@Override protected void init(final VaadinRequest vaadinRequest) { LOG.info("ManagementUI init starts uiid - {}", getUI().getUIId()); if (pushStrategy != null) { pushStrategy.init(getUI());//from w w w . java 2 s. c o m } addDetachListener(this); SpringContextHelper.setContext(context); Responsive.makeResponsive(this); addStyleName(ValoTheme.UI_WITH_MENU); setResponsive(Boolean.TRUE); final HorizontalLayout rootLayout = new HorizontalLayout(); rootLayout.setSizeFull(); HawkbitCommonUtil.initLocalization(this, uiProperties.getLocalization(), i18n); dashboardMenu.init(); dashboardMenu.setResponsive(true); final VerticalLayout contentVerticalLayout = new VerticalLayout(); contentVerticalLayout.setSizeFull(); contentVerticalLayout.setStyleName("main-content"); contentVerticalLayout.addComponent(buildHeader()); contentVerticalLayout.addComponent(buildViewTitle()); final Panel content = buildContent(); contentVerticalLayout.addComponent(content); contentVerticalLayout.setExpandRatio(content, 1); rootLayout.addComponent(dashboardMenu); rootLayout.addComponent(contentVerticalLayout); rootLayout.setExpandRatio(contentVerticalLayout, 1); setContent(rootLayout); final Navigator navigator = new Navigator(this, content); navigator.addViewChangeListener(new ViewChangeListener() { private static final long serialVersionUID = 1L; @Override public boolean beforeViewChange(final ViewChangeEvent event) { return true; } @Override public void afterViewChange(final ViewChangeEvent event) { final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName()); dashboardMenu.postViewChange(new PostViewChangeEvent(view)); if (view == null) { viewTitle.setCaption(null); return; } viewTitle.setCaption(view.getDashboardCaptionLong()); notificationUnreadButton.setCurrentView(event.getNewView()); } }); navigator.setErrorView(errorview); navigator.addProvider(new ManagementViewProvider()); setNavigator(navigator); navigator.addView(EMPTY_VIEW, new Navigator.EmptyView()); if (UI.getCurrent().getErrorHandler() == null) { UI.getCurrent().setErrorHandler(new HawkbitUIErrorHandler()); } LOG.info("Current locale of the application is : {}", getLocale()); }
From source file:org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout.java
License:Open Source License
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);//w w w .j a v a 2s. com header.setMargin(false); header.setSizeFull(); header.setHeightUndefined(); header.setImmediate(true); header.addComponents(titleOfArtifactDetails, maxMinButton); header.setComponentAlignment(titleOfArtifactDetails, Alignment.TOP_LEFT); header.setComponentAlignment(maxMinButton, Alignment.TOP_RIGHT); header.setExpandRatio(titleOfArtifactDetails, 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); }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadProgressInfoWindow.java
License:Open Source License
private HorizontalLayout getCaptionLayout() { final HorizontalLayout captionLayout = new HorizontalLayout(); captionLayout.setSizeFull();// w ww .ja v a 2 s . c o m captionLayout.setHeight("36px"); captionLayout.addComponents(windowCaption, closeButton); captionLayout.setExpandRatio(windowCaption, 1.0F); captionLayout.addStyleName("v-window-header"); return captionLayout; }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusInfoWindow.java
License:Open Source License
private HorizontalLayout getCaptionLayout() { final HorizontalLayout captionLayout = new HorizontalLayout(); captionLayout.setSizeFull();/*from w ww. ja va2 s. c om*/ captionLayout.setHeight("36px"); captionLayout.addComponents(windowCaption, minimizeButton, resizeButton, closeButton); captionLayout.setExpandRatio(windowCaption, 1.0F); captionLayout.addStyleName("v-window-header"); return captionLayout; }
From source file:org.eclipse.hawkbit.ui.common.AbstractMetadataPopupLayout.java
License:Open Source License
private void buildLayout() { final HorizontalLayout headerLayout = new HorizontalLayout(); headerLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE); headerLayout.setSpacing(false);/* w ww . j av a 2s . c o m*/ 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(); }
From source file:org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable.java
License:Open Source License
private VerticalLayout createSoftModuleLayout(final SoftwareModuleType swModType, final DistributionSet distributionSet, final Set<SoftwareModule> alreadyAssignedSwModules) { final VerticalLayout verticalLayout = new VerticalLayout(); for (final SoftwareModule sw : alreadyAssignedSwModules) { if (swModType.getKey().equals(sw.getType().getKey())) { final HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeFull(); final Label softwareModule = HawkbitCommonUtil.getFormatedLabel(""); final Button reassignSoftModule = SPUIComponentProvider.getButton(sw.getName(), "", "", "", true, FontAwesome.TIMES, SPUIButtonStyleNoBorder.class); reassignSoftModule/*from w w w . jav a 2 s .c o m*/ .addClickListener(event -> unassignSW(event, distributionSet, alreadyAssignedSwModules)); final String softwareModNameVersion = HawkbitCommonUtil.getFormattedNameVersion(sw.getName(), sw.getVersion()); softwareModule.setValue(softwareModNameVersion); softwareModule.setDescription(softwareModNameVersion); softwareModule.setId(sw.getName() + "-label"); horizontalLayout.addComponent(softwareModule); horizontalLayout.setExpandRatio(softwareModule, 1F); if (isUnassignSoftModAllowed && permissionChecker.hasUpdateRepositoryPermission() && !isTargetAssigned && (isSoftModAvaiableForSoftType(alreadyAssignedSwModules, swModType))) { horizontalLayout.addComponent(reassignSoftModule); } verticalLayout.addComponent(horizontalLayout); } } return verticalLayout; }
From source file:org.eclipse.hawkbit.ui.common.grid.AbstractGridHeader.java
License:Open Source License
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); }//from w w w. j a va2 s.c o m 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"); }
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); }//from w w w.java 2 s . c o 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.distributions.disttype.CreateUpdateDistSetTypeLayout.java
License:Open Source License
private HorizontalLayout createTwinColumnLayout() { final HorizontalLayout twinColumnLayout = new HorizontalLayout(); twinColumnLayout.setSizeFull();/*from w ww . j a v a 2s . c om*/ twinColumnLayout.setWidth("400px"); buildSourceTable(); buildSelectedTable(); final VerticalLayout selectButtonLayout = new VerticalLayout(); final Button selectButton = SPUIComponentProvider.getButton(UIComponentIdProvider.SELECT_DIST_TYPE, "", "", "arrow-button", true, FontAwesome.FORWARD, SPUIButtonStyleSmallNoBorder.class); selectButton.addClickListener(event -> addSMType()); final Button unSelectButton = SPUIComponentProvider.getButton("unselect-dist-type", "", "", "arrow-button", true, FontAwesome.BACKWARD, SPUIButtonStyleSmallNoBorder.class); unSelectButton.addClickListener(event -> removeSMType()); selectButtonLayout.addComponent(selectButton); selectButtonLayout.addComponent(unSelectButton); selectButtonLayout.setComponentAlignment(selectButton, Alignment.MIDDLE_CENTER); selectButtonLayout.setComponentAlignment(unSelectButton, Alignment.MIDDLE_CENTER); twinColumnLayout.addComponent(sourceTable); twinColumnLayout.addComponent(selectButtonLayout); twinColumnLayout.addComponent(selectedTable); twinColumnLayout.setComponentAlignment(sourceTable, Alignment.MIDDLE_LEFT); twinColumnLayout.setComponentAlignment(selectButtonLayout, Alignment.MIDDLE_CENTER); twinColumnLayout.setComponentAlignment(selectedTable, Alignment.MIDDLE_RIGHT); twinColumnLayout.setExpandRatio(sourceTable, 0.45F); twinColumnLayout.setExpandRatio(selectButtonLayout, 0.07F); twinColumnLayout.setExpandRatio(selectedTable, 0.48F); sourceTable.setVisibleColumns(DIST_TYPE_NAME); return twinColumnLayout; }