Java Code Examples for com.vaadin.ui.HorizontalLayout#setExpandRatio()
The following examples show how to use
com.vaadin.ui.HorizontalLayout#setExpandRatio() .
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: AdminUI.java From sensorhub with Mozilla Public License 2.0 | 6 votes |
protected Component buildHeader() { HorizontalLayout header = new HorizontalLayout(); header.setMargin(false); header.setHeight(100.0f, Unit.PIXELS); header.setWidth(100.0f, Unit.PERCENTAGE); Image img = new Image(null, LOGO_ICON); img.setHeight(90, Unit.PIXELS); img.setStyleName(STYLE_LOGO); header.addComponent(img); Label title = new Label("SensorHub"); title.addStyleName(UIConstants.STYLE_H1); title.addStyleName(STYLE_LOGO); title.setWidth(null); header.addComponent(title); header.setExpandRatio(img, 0); header.setExpandRatio(title, 1); header.setComponentAlignment(img, Alignment.MIDDLE_LEFT); header.setComponentAlignment(title, Alignment.MIDDLE_RIGHT); return header; }
Example 2
Source File: FormUtils.java From jdal with Apache License 2.0 | 6 votes |
/** * Create a titled separator * @param title title * @return a {@link HorizontalLayout} with title and rule. */ public static Component createTitledSeparator(String title) { Label titleLabel = new Label(title); titleLabel.setStyleName(Reindeer.LABEL_H2); Label rule = new Label("<hr />", ContentMode.HTML); titleLabel.setSizeUndefined(); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(titleLabel); Box.addHorizontalStruct(hl, 20); hl.addComponent(rule); hl.setComponentAlignment(rule, Alignment.BOTTOM_CENTER); hl.setExpandRatio(rule, 1); hl.setWidth(100, Unit.PERCENTAGE); return hl; }
Example 3
Source File: ArtifactDetailsLayout.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
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: AbstractView.java From cia with Apache License 2.0 | 6 votes |
/** * Creates the top title header. * * @param topHeader * the top header */ private static void createTopTitleHeader(final HorizontalLayout topHeader) { final HorizontalLayout topTitleHeadertPanel = new HorizontalLayout(); final Label titleLabel = new Label("Citizen Intelligence Agency"); titleLabel.setStyleName("Header"); topTitleHeadertPanel.addComponent(titleLabel); topTitleHeadertPanel.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT); final Label sloganLabel = new Label("// Tracking politicians like bugs!"); sloganLabel.setStyleName("HeaderSlogan"); topTitleHeadertPanel.addComponent(sloganLabel); topTitleHeadertPanel.setComponentAlignment(sloganLabel, Alignment.MIDDLE_RIGHT); topHeader.addComponent(topTitleHeadertPanel); topHeader.setComponentAlignment(topTitleHeadertPanel, Alignment.MIDDLE_LEFT); topHeader.setExpandRatio(topTitleHeadertPanel, ContentRatio.GRID); }
Example 5
Source File: AbstractFilterHeader.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
private void buildLayout() { setStyleName("filter-btns-header-layout"); typeHeaderLayout = new HorizontalLayout(); typeHeaderLayout.setHeight(32, Unit.PIXELS); typeHeaderLayout.setWidth(100.0F, Unit.PERCENTAGE); typeHeaderLayout.addComponentAsFirst(title); typeHeaderLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE); typeHeaderLayout.setComponentAlignment(title, Alignment.TOP_LEFT); if (menu != null) { typeHeaderLayout.addComponent(menu); typeHeaderLayout.setComponentAlignment(menu, Alignment.TOP_RIGHT); } typeHeaderLayout.addComponent(hideIcon); typeHeaderLayout.setComponentAlignment(hideIcon, Alignment.TOP_RIGHT); typeHeaderLayout.setExpandRatio(title, 1.0F); addComponent(typeHeaderLayout); }
Example 6
Source File: SPUIComponentProvider.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
/** * Method to CreateName value labels. * * @param label * as string * @param values * as string * @return HorizontalLayout */ public static HorizontalLayout createNameValueLayout(final String label, final String... values) { final String valueStr = StringUtils.arrayToDelimitedString(values, " "); final Label nameValueLabel = new Label( label ); nameValueLabel.setContentMode(ContentMode.TEXT); nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE); nameValueLabel.addStyleName("text-bold"); nameValueLabel.setSizeUndefined(); final Label valueStrLabel = new Label(valueStr); valueStrLabel.setWidth("100%"); valueStrLabel.addStyleName("text-cut"); valueStrLabel.addStyleName(SPUIDefinitions.TEXT_STYLE); valueStrLabel.addStyleName(LABEL_STYLE); final HorizontalLayout nameValueLayout = new HorizontalLayout(); nameValueLayout.setMargin(false); nameValueLayout.setSpacing(true); nameValueLayout.setSizeFull(); nameValueLayout.addComponent(nameValueLabel); nameValueLayout.setComponentAlignment(nameValueLabel, Alignment.TOP_LEFT); nameValueLayout.setExpandRatio(nameValueLabel, 0.0F); nameValueLayout.addComponent(valueStrLabel); nameValueLayout.setComponentAlignment(valueStrLabel, Alignment.TOP_LEFT); nameValueLayout.setExpandRatio(valueStrLabel, 1.0F); return nameValueLayout; }
Example 7
Source File: TargetFilterHeader.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
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 8
Source File: AbstractMetadataPopupLayout.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
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 9
Source File: TargetDetails.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private void updateAttributesUpdateComponents(final HorizontalLayout attributesRequestLayout, final VerticalLayout attributesLayout, final String controllerId) { final boolean isRequestAttributes = targetManagement.isControllerAttributesRequested(controllerId); if (isRequestAttributes) { attributesLayout.addComponent(buildAttributesUpdateLabel(), 0); } attributesRequestLayout.addComponent(attributesLayout); attributesRequestLayout.setExpandRatio(attributesLayout, 1.0F); attributesRequestLayout.addComponent(buildRequestAttributesUpdateButton(controllerId, isRequestAttributes)); }
Example 10
Source File: SoftwareModuleDetailsTable.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
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 .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; }
Example 11
Source File: AbstractTableDetailsLayout.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
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 12
Source File: AdminApplicationSessionPageModContentFactoryImpl.java From cia with Apache License 2.0 | 4 votes |
@Secured({ "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout content = createPanelContent(); final String pageId = getPageId(parameters); final int pageNr= getPageNr(parameters); getMenuItemFactory().createMainPageMenuBar(menuBar); LabelFactory.createHeader2Label(content,ADMIN_APPLICATION_SESSION); final DataContainer<ApplicationSession, Long> dataContainer = getApplicationManager() .getDataContainer(ApplicationSession.class); final List<ApplicationSession> pageOrderBy = dataContainer.getPageOrderBy(pageNr,DEFAULT_RESULTS_PER_PAGE, ApplicationSession_.createdDate); getPagingUtil().createPagingControls(content,NAME,pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE); getGridFactory().createBasicBeanItemGrid(content, ApplicationSession.class, pageOrderBy, APPLICATION_SESSION, COLUMN_ORDER, HIDE_COLUMNS, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_SESSION_VIEW_NAME, "hjid"), null, new ListPropertyConverter[] { new ListPropertyConverter("page", "events", "actionName")}); if (pageId != null && !pageId.isEmpty()) { final ApplicationSession applicationSession = dataContainer.load(Long.valueOf(pageId)); if (applicationSession != null) { final VerticalLayout rightLayout = new VerticalLayout(); rightLayout.setSizeFull(); final HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setWidth(ContentSize.FULL_SIZE); content.addComponent(horizontalLayout); content.setExpandRatio(horizontalLayout, ContentRatio.GRID); getFormFactory().addFormPanelTextFields(horizontalLayout, applicationSession, ApplicationSession.class, AS_LIST); horizontalLayout.addComponent(rightLayout); horizontalLayout.setExpandRatio(rightLayout, ContentRatio.GRID); getGridFactory().createBasicBeanItemGrid(rightLayout, ApplicationActionEvent.class,applicationSession.getEvents(), APPLICATION_ACTION_EVENT, COLUMN_ORDER2, HIDE_COLUMNS2, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_EVENTS_VIEW_NAME, "hjid"), null, null); } } getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_SESSION_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId); return content; }
Example 13
Source File: AbstractTableHeader.java From hawkbit with Eclipse Public License 1.0 | 4 votes |
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"); }
Example 14
Source File: StorageView.java From chipster with MIT License | 4 votes |
public StorageView(ChipsterAdminUI app) { super(app); this.addComponent(getToolbar()); this.addComponent(super.getProggressIndicator()); entryTable = new StorageEntryTable(this); aggregateTable = new StorageAggregateTable(this); HorizontalLayout aggregatePanelLayout = new HorizontalLayout(); HorizontalLayout entryPanelLayout = new HorizontalLayout(); aggregatePanelLayout.setSizeFull(); entryPanelLayout.setSizeFull(); aggregatePanelLayout.addComponent(aggregateTable); entryPanelLayout.addComponent(entryTable); aggregatePanelLayout.setExpandRatio(aggregateTable, 1); entryPanelLayout.setExpandRatio(entryTable, 1); Panel aggregatePanel = new Panel("Disk usage by user"); Panel entryPanel = new Panel("Stored sessions"); aggregatePanel.setWidth(300, Unit.PIXELS); aggregatePanel.setHeight(100, Unit.PERCENTAGE); entryPanel.setSizeFull(); aggregatePanel.setContent(aggregatePanelLayout); entryPanel.setContent(entryPanelLayout); storagePanels = new HorizontalLayout(); storagePanels.setSizeFull(); storagePanels.addComponent(aggregatePanel); storagePanels.addComponent(entryPanel); storagePanels.setExpandRatio(entryPanel, 1); this.setSizeFull(); this.addComponent(storagePanels); this.setExpandRatio(storagePanels, 1); try { adminEndpoint = new StorageAdminAPI(app.getEndpoint()); entryDataSource = new StorageEntryContainer(adminEndpoint); aggregateDataSource = new StorageAggregateContainer(adminEndpoint); entryTable.setContainerDataSource(entryDataSource); aggregateTable.setContainerDataSource(aggregateDataSource); } catch (JMSException | IOException | IllegalConfigurationException | MicroarrayException | InstantiationException | IllegalAccessException e) { logger.error(e); } }
Example 15
Source File: XacmlAdminConsole.java From XACML with MIT License | 4 votes |
@AutoGenerated private HorizontalLayout buildHorizontalLayout_1() { // common part: create layout horizontalLayout_1 = new HorizontalLayout(); horizontalLayout_1.setImmediate(false); horizontalLayout_1.setWidth("100.0%"); horizontalLayout_1.setHeight("40px"); horizontalLayout_1.setMargin(false); // embedded_1 embedded_1 = new Embedded(); embedded_1.setImmediate(false); embedded_1.setWidth("30px"); embedded_1.setHeight("30px"); embedded_1.setSource(new ThemeResource("img/att.png")); embedded_1.setType(1); embedded_1.setMimeType("image/png"); horizontalLayout_1.addComponent(embedded_1); horizontalLayout_1.setComponentAlignment(embedded_1, new Alignment(33)); // caption caption = new Label(); caption.setImmediate(false); caption.setWidth("-1px"); caption.setHeight("-1px"); caption.setValue("AT&T Policy Engine Admin Console"); horizontalLayout_1.addComponent(caption); horizontalLayout_1.setExpandRatio(caption, 1.0f); horizontalLayout_1.setComponentAlignment(caption, new Alignment(33)); // labelWelcome labelWelcome = new Label(); labelWelcome.setImmediate(false); labelWelcome.setWidth("-1px"); labelWelcome.setHeight("40px"); labelWelcome.setValue("Label"); horizontalLayout_1.addComponent(labelWelcome); horizontalLayout_1.setComponentAlignment(labelWelcome, new Alignment(34)); return horizontalLayout_1; }
Example 16
Source File: ServerDescBasic.java From primecloud-controller with GNU General Public License v2.0 | 4 votes |
@Override public void attach() { setHeight("100%"); addStyleName(Reindeer.PANEL_LIGHT); VerticalLayout layout = (VerticalLayout) getContent(); layout.setWidth("100%"); layout.setHeight("100%"); layout.setMargin(true); layout.setSpacing(false); layout.addStyleName("server-desc-basic"); HorizontalLayout layout2 = new HorizontalLayout(); layout2.setWidth("100%"); layout2.setHeight("100%"); layout2.setMargin(true); layout2.setSpacing(true); layout2.addStyleName("server-desc-basic"); // サーバ基本情報 left = new BasicInfo(); left.setWidth("100%"); layout2.addComponent(left); // 表同士の間隔をあける Label padding = new Label(" "); padding.setWidth("7px"); padding.setHeight("99%"); padding.addStyleName("desc-padding"); layout2.addComponent(padding); Label padding2 = new Label(""); padding2.setWidth("1px"); layout2.addComponent(padding2); // 割り当てサービス String enableService = Config.getProperty("ui.enableService"); if (enableService == null || BooleanUtils.toBoolean(enableService)) { right = new AttachService(); right.setHeight("100%"); right.setWidth("100%"); layout2.addComponent(right); } layout2.setExpandRatio(left, 40); if (right != null) { layout2.setExpandRatio(right, 60); } else { VerticalLayout dummyLayout = new VerticalLayout(); dummyLayout.setSizeFull(); layout2.addComponent(dummyLayout); layout2.setExpandRatio(dummyLayout, 60); } layout.addComponent(layout2); layout.setExpandRatio(layout2, 1.0f); }
Example 17
Source File: LayoutUsageExample.java From viritin with Apache License 2.0 | 4 votes |
public void layoutCodeExample() { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); verticalLayout.setSpacing(true); verticalLayout.setHeight("100%"); HorizontalLayout horizontalLayout = new HorizontalLayout(c, d); horizontalLayout.setWidth("100%"); horizontalLayout.setMargin(false); horizontalLayout.setSpacing(true); verticalLayout.addComponents(a, b, horizontalLayout); setContent(verticalLayout); // Is same as setContent(new MVerticalLayout().withFullHeight().with(a, b, new MHorizontalLayout(c, d).withFullWidth().withMargin(false))); // Or ... VerticalLayout wrapper = new VerticalLayout(); wrapper.setMargin(true); wrapper.setSpacing(true); wrapper.setHeight("100%"); HorizontalLayout toolbar = new HorizontalLayout(c, d); toolbar.setWidth("100%"); toolbar.setMargin(false); toolbar.setSpacing(true); HorizontalLayout wrapper2 = new HorizontalLayout(); wrapper2.addComponent(menu); wrapper2.addComponent(mainContent); wrapper2.setSizeFull(); mainContent.setSizeFull(); wrapper2.setExpandRatio(mainContent, 1); wrapper.addComponents(toolbar, wrapper2); wrapper.setExpandRatio(wrapper2, 1); setContent(wrapper); // Is same as: setContent( new MVerticalLayout(new MHorizontalLayout(c, d).withFullWidth()) .expand( new MHorizontalLayout(menu) .expand(mainContent) ) ); // the expand call takes care of adding component and setting sane // values for layout and the added component }
Example 18
Source File: PagingUtilImpl.java From cia with Apache License 2.0 | 4 votes |
/** * Creates the paging controls. * * @param content the content * @param name the name * @param pageId the page id * @param size the size * @param pageNr the page nr * @param resultPerPage the result per page */ @Override public void createPagingControls(final AbstractOrderedLayout content, final String name, final String pageId, final Long size, final int pageNr, final int resultPerPage) { final HorizontalLayout pagingControls = new HorizontalLayout(); pagingControls.setSpacing(true); pagingControls.setMargin(true); final long maxPages = (size +resultPerPage-1) / resultPerPage; final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(PAGE_HEADER) .append(pageNr) .append(PAGE_SEPARATOR) .append(maxPages) .append(PAGES_TOTAL_RESULTS) .append(size) .append(RESULTS_PER_PAGE) .append(resultPerPage) .append(SHOW); final Label pageInfo = new Label(stringBuilder.toString()); pagingControls.addComponent(pageInfo); pagingControls.setExpandRatio(pageInfo, ContentRatio.SMALL); if (pageNr > PAGE_ONE) { addPagingLink(PREVIOUS_PAGE,name, pageId, pageNr -1L,pagingControls); } if (maxPages > PAGE_ONE && pageNr < maxPages) { addPagingLink(NEXT_PAGE,name, pageId, pageNr +1L,pagingControls); } if (maxPages > LIMIT_FOR_DISPLAYING_START_END_LINKS && pageNr > PAGE_ONE) { addPagingLink(FIRST_PAGE,name, pageId, 1,pagingControls); } if (maxPages > LIMIT_FOR_DISPLAYING_START_END_LINKS && pageNr < maxPages) { addPagingLink(LAST_PAGE,name, pageId, maxPages,pagingControls); } content.addComponent(pagingControls); content.setExpandRatio(pagingControls, ContentRatio.SMALL2); }
Example 19
Source File: ServiceDescBasic.java From primecloud-controller with GNU General Public License v2.0 | 4 votes |
@Override public void attach() { addStyleName(Reindeer.PANEL_LIGHT); setHeight("100%"); HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.setHeight("100%"); layout.setMargin(true); layout.setSpacing(true); layout.addStyleName("service-desc-basic"); setContent(layout); // サービス基本情報 VerticalLayout leftLayout = new VerticalLayout(); leftLayout.setMargin(false); leftLayout.setSpacing(false); leftLayout.setWidth("100%"); leftLayout.setHeight("100%"); left = new BasicInfoOpe(); left.setWidth("100%"); leftLayout.addComponent(left); leftLayout.setExpandRatio(left, 1.0f); layout.addComponent(leftLayout); // 表同士の間隔をあける Label padding = new Label(" "); padding.setWidth("7px"); padding.setHeight("99%"); padding.addStyleName("desc-padding"); layout.addComponent(padding); Label padding2 = new Label(""); padding2.setWidth("1px"); layout.addComponent(padding2); // 割り当てサーバ VerticalLayout rightLayout = new VerticalLayout(); rightLayout.setMargin(false); rightLayout.setSpacing(false); rightLayout.setWidth("100%"); rightLayout.setHeight("100%"); right = new AttachServersOpe(); right.setWidth("100%"); rightLayout.addComponent(right); serverOpe = new ServiceSvrOperation(); rightLayout.addComponent(serverOpe); rightLayout.setExpandRatio(right, 1.0f); layout.addComponent(rightLayout); layout.setExpandRatio(leftLayout, 40); layout.setExpandRatio(rightLayout, 60); }
Example 20
Source File: LoadBalancerDescServer.java From primecloud-controller with GNU General Public License v2.0 | 4 votes |
@Override public void attach() { addStyleName(Reindeer.PANEL_LIGHT); setHeight("100%"); VerticalLayout panel = (VerticalLayout) getContent(); panel.setWidth("100%"); panel.setHeight("100%"); panel.setMargin(true); panel.setSpacing(false); panel.addStyleName("loadbalancer-desc-basic"); HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.setHeight("100%"); layout.setMargin(true); layout.setSpacing(true); layout.addStyleName("loadbalancer-desc-basic"); // ロードバランサ詳細情報 VerticalLayout leftLayout = new VerticalLayout(); leftLayout.setWidth("100%"); leftLayout.setHeight("100%"); leftLayout.setMargin(true, false, false, false); leftLayout.setSpacing(false); loadBalancerInfo = new LoadBalancerDetailInfo(); leftLayout.addComponent(loadBalancerInfo); leftLayout.setExpandRatio(loadBalancerInfo, 10); layout.addComponent(leftLayout); // 表同士の間隔をあける Label padding = new Label(" "); padding.setWidth("7px"); padding.setHeight("99%"); padding.addStyleName("desc-padding"); layout.addComponent(padding); Label padding2 = new Label(""); padding2.setWidth("1px"); layout.addComponent(padding2); // 割り当てサーバ VerticalLayout rightLayout = new VerticalLayout(); rightLayout.setWidth("100%"); rightLayout.setHeight("100%"); rightLayout.setMargin(false); rightLayout.setSpacing(false); rightLayout.addStyleName("loadbalancer-desc-server-right"); attachServiceServerTable = new AttachSeriviceServerTable(); rightLayout.addComponent(attachServiceServerTable); loadBalancerOpe = new LoadbalancerServerOperation(); rightLayout.addComponent(loadBalancerOpe); rightLayout.setExpandRatio(attachServiceServerTable, 100); layout.addComponent(rightLayout); layout.setExpandRatio(leftLayout, 48); layout.setExpandRatio(rightLayout, 52); panel.addComponent(layout); }