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:de.fatalix.timeline.web.VaadinWebProjectApp.java
@Override protected void init(VaadinRequest request) { setSizeFull();//from www. jav a 2 s . c om VerticalLayout navigatorLayout = new VerticalLayout(); navigatorLayout.setSizeFull(); navigatorLayout.setSpacing(true); Panel contentPanel = new Panel(navigatorLayout); contentPanel.setSizeFull(); Navigator navigator = new Navigator(VaadinWebProjectApp.this, contentPanel); navigator.addProvider(viewProvider); VerticalLayout rootLayout = new VerticalLayout(); //rootLayout.addComponent(header); rootLayout.addComponent(contentPanel); rootLayout.setExpandRatio(contentPanel, 1.0f); rootLayout.setSizeFull(); setContent(rootLayout); }
From source file:de.fzi.fhemapi.view.vaadin.ui.DeviceDetailsPanel.java
License:Apache License
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout VerticalLayout layout = new VerticalLayout(); layout.setImmediate(false);//from w ww.j a v a 2 s. co m layout.setWidth("100.0%"); layout.setHeight("-1"); layout.setMargin(false); HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setImmediate(false); titleLayout.setWidth("-1"); titleLayout.setHeight("50"); titleLayout.setMargin(false); layout.addComponent(titleLayout); layout.setComponentAlignment(titleLayout, Alignment.TOP_CENTER); // deviceTitle deviceTitle = new TextField(); deviceTitle.setImmediate(true); deviceTitle.setWidth("100%"); deviceTitle.setHeight("-1px"); deviceTitle.setValue(device.getName()); deviceTitle.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (((String) event.getProperty().getValue()).length() > 1) { device.rename((String) event.getProperty().getValue()); parent.reloadTree(); } } }); titleLayout.addComponent(deviceTitle); titleLayout.setComponentAlignment(deviceTitle, Alignment.TOP_CENTER); ComboBox combobox = new ComboBox(); String[] classes = DeviceFactory.getAvailableDevicetypes(); for (String name : classes) { combobox.addItem(name); } combobox.select(device.getClass().getSimpleName()); combobox.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { setDeviceType((String) event.getProperty().getValue()); } }); combobox.setImmediate(true); deviceTypeHoriLayout = UIHelper.buildAttributePanel("Device Type", combobox); layout.addComponent(deviceTypeHoriLayout); layout.setComponentAlignment(deviceTypeHoriLayout, Alignment.TOP_CENTER); layout.setExpandRatio(deviceTypeHoriLayout, 1); ioDevHoriLayout = buildAttributePanel("IO Device", device.getType()); layout.addComponent(ioDevHoriLayout); layout.setComponentAlignment(ioDevHoriLayout, Alignment.TOP_CENTER); layout.setExpandRatio(ioDevHoriLayout, 1); addDeviceDetails(DevicePanelManager.getDeviceDetails(device, this), layout); return layout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.DeviceDetailsPanel.java
License:Apache License
private void addDeviceDetails(List<DeviceDetailEntry> entries, VerticalLayout mainLayout) { for (DeviceDetailEntry entry : entries) { HorizontalLayout layout = UIHelper.buildAttributePanel(entry.caption, entry.component); mainLayout.addComponent(layout); mainLayout.setComponentAlignment(layout, Alignment.TOP_CENTER); mainLayout.setExpandRatio(layout, 1); }/*w w w .ja v a 2s .com*/ }
From source file:de.gedoplan.webclients.vaadin.VaadinDemoUi.java
@Override protected void init(VaadinRequest request) { if (!accessControl.isUserSignedIn()) { close();/*from w w w.j a v a2 s . co m*/ Page.getCurrent().setLocation(Konstanten.VAADIN_LOGIN_PATH); return; } VerticalLayout page = new VerticalLayout(); setContent(page); VerticalLayout content = new VerticalLayout(); content.setSizeFull(); page.addComponents(createMenu(), content, createFooter()); page.setExpandRatio(content, 1); page.setSizeFull(); navigator = new Navigator(this, content); navigator.addProvider(cDIViewProvider); navigator.setErrorView(ErrorView.class); }
From source file:de.mendelson.comm.as2.webclient2.OkDialog.java
public void init() { this.setModal(true); VerticalLayout okDialogLayout = new VerticalLayout(); HorizontalLayout contentLayout = new HorizontalLayout(); AbstractComponent contentPanel = this.getContentPanel(); contentLayout.addComponent(contentPanel); contentLayout.setMargin(true);//from ww w.j a va2s . c o m contentLayout.setSizeFull(); okDialogLayout.addComponent(contentLayout); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSizeFull(); buttonLayout.setMargin(false, true, false, false); buttonLayout.addComponent(this.okButton); buttonLayout.setComponentAlignment(this.okButton, Alignment.MIDDLE_RIGHT); this.okButton.addListener(this); okDialogLayout.addComponent(buttonLayout); okDialogLayout.setExpandRatio(contentLayout, 1.0f); okDialogLayout.setExpandRatio(buttonLayout, 0.0f); this.setContent(okDialogLayout); this.setHeight(this.height + "px"); this.setWidth(this.width + "px"); }
From source file:de.symeda.sormas.ui.dashboard.contacts.ContactsDashboardView.java
License:Open Source License
protected VerticalLayout createEpiCurveLayout() { if (epiCurveComponent == null) { throw new UnsupportedOperationException( "EpiCurveComponent needs to be initialized before calling createEpiCurveLayout"); }//w w w .j a v a 2 s . c o m VerticalLayout layout = new VerticalLayout(); layout.setMargin(false); layout.setSpacing(false); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(400, Unit.PIXELS); epiCurveComponent.setSizeFull(); layout.addComponent(epiCurveComponent); layout.setExpandRatio(epiCurveComponent, 1); epiCurveComponent.setExpandListener(expanded -> { if (expanded) { dashboardLayout.removeComponent(statisticsComponent); epiCurveAndMapLayout.removeComponent(mapLayout); ContactsDashboardView.this.setHeight(100, Unit.PERCENTAGE); epiCurveAndMapLayout.setHeight(100, Unit.PERCENTAGE); epiCurveLayout.setSizeFull(); } else { dashboardLayout.addComponent(statisticsComponent, 1); epiCurveAndMapLayout.addComponent(mapLayout, 1); epiCurveLayout.setHeight(400, Unit.PIXELS); ContactsDashboardView.this.setHeightUndefined(); epiCurveAndMapLayout.setHeightUndefined(); } }); return layout; }
From source file:de.symeda.sormas.ui.dashboard.contacts.ContactsDashboardView.java
License:Open Source License
protected VerticalLayout createMapLayout() { if (mapComponent == null) { throw new UnsupportedOperationException( "MapComponent needs to be initialized before calling createMapLayout"); }/*from w ww. jav a2 s. c om*/ VerticalLayout layout = new VerticalLayout(); layout.setMargin(false); layout.setSpacing(false); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(555, Unit.PIXELS); mapComponent.setSizeFull(); layout.addComponent(mapComponent); layout.setExpandRatio(mapComponent, 1); mapComponent.setExpandListener(expanded -> { if (expanded) { dashboardLayout.removeComponent(statisticsComponent); epiCurveAndMapLayout.removeComponent(epiCurveLayout); ContactsDashboardView.this.setHeight(100, Unit.PERCENTAGE); epiCurveAndMapLayout.setHeight(100, Unit.PERCENTAGE); mapLayout.setSizeFull(); } else { dashboardLayout.addComponent(statisticsComponent, 1); epiCurveAndMapLayout.addComponent(epiCurveLayout, 0); mapLayout.setHeight(400, Unit.PIXELS); ContactsDashboardView.this.setHeightUndefined(); epiCurveAndMapLayout.setHeightUndefined(); } }); return layout; }
From source file:de.symeda.sormas.ui.dashboard.surveillance.DiseaseTileComponent.java
License:Open Source License
void addTopLayout(Disease disease, Long casesCount, boolean isOutbreak) { HorizontalLayout layout = new HorizontalLayout(); layout.setMargin(false);/*from w ww. ja v a2 s .com*/ layout.setSpacing(false); CssStyles.style(layout, CssStyles.getDiseaseColor(disease)); layout.setHeight(75, Unit.PIXELS); layout.setWidth(100, Unit.PERCENTAGE); VerticalLayout nameAndOutbreakLayout = new VerticalLayout(); nameAndOutbreakLayout.setMargin(false); nameAndOutbreakLayout.setSpacing(false); nameAndOutbreakLayout.setHeight(100, Unit.PERCENTAGE); nameAndOutbreakLayout.setWidth(100, Unit.PERCENTAGE); HorizontalLayout nameLayout = new HorizontalLayout(); nameLayout.setMargin(false); nameLayout.setSpacing(false); nameLayout.setWidth(100, Unit.PERCENTAGE); nameLayout.setHeight(100, Unit.PERCENTAGE); Label nameLabel = new Label(disease.toShortString()); CssStyles.style(nameLabel, CssStyles.LABEL_WHITE, nameLabel.getValue().length() > 12 ? CssStyles.LABEL_LARGE : CssStyles.LABEL_XLARGE, CssStyles.LABEL_BOLD, CssStyles.ALIGN_CENTER, CssStyles.LABEL_UPPERCASE); nameLayout.addComponent(nameLabel); nameLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_CENTER); nameAndOutbreakLayout.addComponent(nameLayout); nameAndOutbreakLayout.setExpandRatio(nameLayout, 1); if (isOutbreak) { HorizontalLayout outbreakLayout = new HorizontalLayout(); outbreakLayout.setMargin(false); outbreakLayout.setSpacing(false); CssStyles.style(outbreakLayout, CssStyles.BACKGROUND_CRITICAL); outbreakLayout.setWidth(100, Unit.PERCENTAGE); outbreakLayout.setHeight(30, Unit.PIXELS); Label outbreakLabel = new Label(I18nProperties.getCaption(Captions.dashboardOutbreak)); CssStyles.style(outbreakLabel, CssStyles.LABEL_WHITE, CssStyles.ALIGN_CENTER, CssStyles.LABEL_UPPERCASE); outbreakLayout.addComponent(outbreakLabel); outbreakLayout.setComponentAlignment(outbreakLabel, Alignment.MIDDLE_CENTER); nameAndOutbreakLayout.addComponent(outbreakLayout); } layout.addComponent(nameAndOutbreakLayout); layout.setExpandRatio(nameAndOutbreakLayout, 1); HorizontalLayout countLayout = new HorizontalLayout(); countLayout.setMargin(false); countLayout.setSpacing(false); CssStyles.style(countLayout, CssStyles.getDiseaseColor(disease), CssStyles.BACKGROUND_DARKER); countLayout.setHeight(100, Unit.PERCENTAGE); countLayout.setWidth(100, Unit.PERCENTAGE); Label countLabel = new Label(casesCount.toString()); CssStyles.style(countLabel, CssStyles.LABEL_WHITE, CssStyles.LABEL_BOLD, CssStyles.LABEL_XXXLARGE, CssStyles.ALIGN_CENTER); countLayout.addComponent(countLabel); countLayout.setComponentAlignment(countLabel, Alignment.MIDDLE_CENTER); layout.addComponent(countLayout); layout.setExpandRatio(countLayout, 0.65f); addComponent(layout); }
From source file:de.symeda.sormas.ui.login.LoginScreen.java
License:Open Source License
private CssLayout buildLoginInformation() { CssLayout loginInformation = new CssLayout(); loginInformation.setStyleName("login-information"); VerticalLayout innerLayout = new VerticalLayout(); innerLayout.setSizeFull();/* w w w. j a v a 2 s.co m*/ Image img = new Image(null, new ThemeResource("img/sormas-logo-big.png")); img.setHeight(240, Unit.PIXELS); innerLayout.addComponent(img); innerLayout.setComponentAlignment(img, Alignment.TOP_CENTER); innerLayout.setExpandRatio(img, 0); Label loginInfoText = new Label("<h1>SORMAS</h1>" + "<h2 style='color:white'>Surveillance, Outbreak Response Management and Analysis System</h2>" + "<h3 style='color:white; text-transform:uppercase'>● Disease Prevention<br>● Disease Detection<br>● Outbreak Response</h3>", ContentMode.HTML); loginInfoText.setWidth(100, Unit.PERCENTAGE); innerLayout.addComponent(loginInfoText); innerLayout.setExpandRatio(loginInfoText, 1); Label loginInfoCopyright = new Label(" 2019 SORMAS. All Rights Reserved."); loginInfoCopyright.setWidth(100, Unit.PERCENTAGE); innerLayout.addComponent(loginInfoCopyright); innerLayout.setExpandRatio(loginInfoCopyright, 0); innerLayout.setComponentAlignment(loginInfoCopyright, Alignment.BOTTOM_LEFT); loginInformation.addComponent(innerLayout); return loginInformation; }
From source file:de.symeda.sormas.ui.samples.SampleGridComponent.java
License:Open Source License
private void styleGridLayout(VerticalLayout gridLayout) { gridLayout.setSpacing(false);/*from ww w . j ava 2 s .c o m*/ gridLayout.setSizeFull(); gridLayout.setExpandRatio(grid, 1); gridLayout.setStyleName("crud-main-layout"); }