List of usage examples for com.vaadin.ui VerticalLayout 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.hawkbit.ui.common.AbstractMetadataPopupLayout.java
License:Open Source License
protected VerticalLayout createMetadataFieldsLayout() { final VerticalLayout metadataFieldsLayout = new VerticalLayout(); metadataFieldsLayout.setSizeFull();//w w w . j a va 2 s . com metadataFieldsLayout.setHeight("100%"); metadataFieldsLayout.addComponent(keyTextField); metadataFieldsLayout.addComponent(valueTextArea); metadataFieldsLayout.setSpacing(true); metadataFieldsLayout.setExpandRatio(valueTextArea, 1F); return metadataFieldsLayout; }
From source file:org.eclipse.hawkbit.ui.common.grid.AbstractGridComponentLayout.java
License:Open Source License
/** * Layouts header, grid and optional footer. *///w ww . j a va2 s . c o m protected void buildLayout() { setSizeFull(); setSpacing(true); setMargin(false); setStyleName("group"); final VerticalLayout gridHeaderLayout = new VerticalLayout(); gridHeaderLayout.setSizeFull(); gridHeaderLayout.setSpacing(false); gridHeaderLayout.setMargin(false); gridHeaderLayout.setStyleName("table-layout"); gridHeaderLayout.addComponent(gridHeader); gridHeaderLayout.setComponentAlignment(gridHeader, Alignment.TOP_CENTER); gridHeaderLayout.addComponent(grid); gridHeaderLayout.setComponentAlignment(grid, Alignment.TOP_CENTER); gridHeaderLayout.setExpandRatio(grid, 1.0F); addComponent(gridHeaderLayout); setComponentAlignment(gridHeaderLayout, Alignment.TOP_CENTER); setExpandRatio(gridHeaderLayout, 1.0F); if (hasFooterSupport()) { final Layout footerLayout = getFooterSupport().createFooterMessageComponent(); addComponent(footerLayout); setComponentAlignment(footerLayout, Alignment.BOTTOM_CENTER); } }
From source file:org.eclipse.hawkbit.ui.common.grid.AbstractGridLayout.java
License:Open Source License
private void buildLayout() { setSizeFull();//from w w w . jav a 2 s.c o m setSpacing(true); setMargin(false); setStyleName("group"); final VerticalLayout tableHeaderLayout = new VerticalLayout(); tableHeaderLayout.setSizeFull(); tableHeaderLayout.setSpacing(false); tableHeaderLayout.setMargin(false); tableHeaderLayout.setStyleName("table-layout"); tableHeaderLayout.addComponent(tableHeader); tableHeaderLayout.setComponentAlignment(tableHeader, Alignment.TOP_CENTER); tableHeaderLayout.addComponent(grid); tableHeaderLayout.setComponentAlignment(grid, Alignment.TOP_CENTER); tableHeaderLayout.setExpandRatio(grid, 1.0f); addComponent(tableHeaderLayout); setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER); setExpandRatio(tableHeaderLayout, 1.0f); if (hasCountMessage()) { final HorizontalLayout rolloutGroupTargetsCountLayout = createCountMessageComponent(); addComponent(rolloutGroupTargetsCountLayout); setComponentAlignment(rolloutGroupTargetsCountLayout, Alignment.BOTTOM_CENTER); } }
From source file:org.eclipse.hawkbit.ui.common.table.AbstractTableLayout.java
License:Open Source License
private void buildLayout() { setSizeFull();/* www . j av a 2 s . c o m*/ setSpacing(true); setMargin(false); setStyleName("group"); final VerticalLayout tableHeaderLayout = new VerticalLayout(); tableHeaderLayout.setSizeFull(); tableHeaderLayout.setSpacing(false); tableHeaderLayout.setMargin(false); tableHeaderLayout.setStyleName("table-layout"); tableHeaderLayout.addComponent(tableHeader); tableHeaderLayout.setComponentAlignment(tableHeader, Alignment.TOP_CENTER); if (isShortCutKeysRequired()) { final Panel tablePanel = new Panel(); tablePanel.setStyleName("table-panel"); tablePanel.setHeight(100.0F, Unit.PERCENTAGE); tablePanel.setContent(table); tablePanel.addActionHandler(getShortCutKeysHandler(i18n)); tablePanel.addStyleName(ValoTheme.PANEL_BORDERLESS); tableHeaderLayout.addComponent(tablePanel); tableHeaderLayout.setComponentAlignment(tablePanel, Alignment.TOP_CENTER); tableHeaderLayout.setExpandRatio(tablePanel, 1.0F); } else { tableHeaderLayout.addComponent(table); tableHeaderLayout.setComponentAlignment(table, Alignment.TOP_CENTER); tableHeaderLayout.setExpandRatio(table, 1.0F); } addComponent(tableHeaderLayout); addComponent(detailsLayout); setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER); setComponentAlignment(detailsLayout, Alignment.TOP_CENTER); setExpandRatio(tableHeaderLayout, 1.0F); }
From source file:org.eclipse.hawkbit.ui.filtermanagement.FilterManagementView.java
License:Open Source License
private void buildFilterDetailOrCreateView() { removeAllComponents();//from w w w .j a v a2 s .c om final VerticalLayout tableHeaderLayout = new VerticalLayout(); tableHeaderLayout.setSizeFull(); tableHeaderLayout.setSpacing(false); tableHeaderLayout.setMargin(false); tableHeaderLayout.setStyleName("table-layout"); tableHeaderLayout.addComponent(createNewFilterHeader); tableHeaderLayout.setComponentAlignment(createNewFilterHeader, Alignment.TOP_CENTER); tableHeaderLayout.addComponent(createNewFilterTable); tableHeaderLayout.setComponentAlignment(createNewFilterTable, Alignment.TOP_CENTER); tableHeaderLayout.setExpandRatio(createNewFilterTable, 1.0F); addComponent(tableHeaderLayout); setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER); setExpandRatio(tableHeaderLayout, 1.0F); final HorizontalLayout targetsCountmessageLabelLayout = addTargetFilterMessageLabel(); addComponent(targetsCountmessageLabelLayout); setComponentAlignment(targetsCountmessageLabelLayout, Alignment.BOTTOM_CENTER); }
From source file:org.eclipse.hawkbit.ui.filtermanagement.FilterManagementView.java
License:Open Source License
private void viewListView() { removeAllComponents();// w w w . j av a 2s. co m final VerticalLayout tableListViewLayout = new VerticalLayout(); tableListViewLayout.setSizeFull(); tableListViewLayout.setSpacing(false); tableListViewLayout.setMargin(false); tableListViewLayout.setStyleName("table-layout"); tableListViewLayout.addComponent(targetFilterHeader); tableListViewLayout.setComponentAlignment(targetFilterHeader, Alignment.TOP_CENTER); tableListViewLayout.addComponent(targetFilterTable); tableListViewLayout.setComponentAlignment(targetFilterTable, Alignment.TOP_CENTER); tableListViewLayout.setExpandRatio(targetFilterTable, 1.0F); addComponent(tableListViewLayout); }
From source file:org.eclipse.hawkbit.ui.HawkbitUI.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 ww . j a va 2s .co m*/ } addDetachListener(this); SpringContextHelper.setContext(context); Responsive.makeResponsive(this); addStyleName(ValoTheme.UI_WITH_MENU); setResponsive(Boolean.TRUE); final HorizontalLayout rootLayout = new HorizontalLayout(); rootLayout.setSizeFull(); 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()); // set locale is required for I18N class also, to get the locale from // cookie final String locale = getLocaleId(SPUIDefinitions.getAvailableLocales()); setLocale(new Locale(locale)); if (UI.getCurrent().getErrorHandler() == null) { UI.getCurrent().setErrorHandler(new HawkbitUIErrorHandler()); } LOG.info("Current locale of the application is : {}", HawkbitCommonUtil.getLocale()); }
From source file:org.eclipse.hawkbit.ui.login.HawkbitLoginUI.java
License:Open Source License
@Override protected void init(final VaadinRequest request) { SpringContextHelper.setContext(context); final VerticalLayout rootLayout = new VerticalLayout(); final Component header = buildHeader(); rootLayout.addComponent(header);/*from w ww . j a v a 2 s .c om*/ rootLayout.setSizeFull(); final HorizontalLayout content = new HorizontalLayout(); rootLayout.addComponent(content); content.setStyleName("view-content"); content.setSizeFull(); rootLayout.setStyleName("main-content"); rootLayout.setExpandRatio(header, 1.0F); rootLayout.setExpandRatio(content, 2.0F); final Resource resource = context .getResource("classpath:/VAADIN/themes/" + UI.getCurrent().getTheme() + "/layouts/footer.html"); try (InputStream resourceStream = resource.getInputStream()) { final CustomLayout customLayout = new CustomLayout(resourceStream); customLayout.setSizeUndefined(); rootLayout.addComponent(customLayout); } catch (final IOException ex) { LOG.error("Footer file cannot be loaded", ex); } setContent(rootLayout); final Navigator navigator = new Navigator(this, content); navigator.addProvider(viewProvider); setNavigator(navigator); }
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();//ww w .ja va2s .c om 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 a2s . co m 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; }