List of usage examples for com.vaadin.ui HorizontalLayout setHeight
@Override public void setHeight(float height, Unit unit)
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);/* w w w. ja v a2s . c om*/ 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.dashboard.surveillance.SurveillanceDiseaseCarouselLayout.java
License:Open Source License
private HorizontalLayout createEpiCurveAndMapLayout() { HorizontalLayout epiCurveAndMapLayout = new HorizontalLayout(); epiCurveAndMapLayout.setWidth(100, Unit.PERCENTAGE); final int BASE_HEIGHT = 480; epiCurveAndMapLayout.setHeight(BASE_HEIGHT, Unit.PIXELS); epiCurveAndMapLayout.addComponent(epiCurveComponent); epiCurveAndMapLayout.addComponent(mapComponent); epiCurveComponent.setExpandListener(expanded -> { if (expanded) { removeComponent(statisticsComponent); epiCurveAndMapLayout.removeComponent(mapComponent); epiCurveAndMapLayout.setHeight(100, Unit.PERCENTAGE); setHeight(100, Unit.PERCENTAGE); } else {//from ww w. ja va 2 s .c o m addComponent(statisticsComponent, 1); epiCurveAndMapLayout.addComponent(mapComponent, 1); epiCurveAndMapLayout.setHeight(BASE_HEIGHT, Unit.PIXELS); setHeightUndefined(); } if (externalExpandListener != null) { externalExpandListener.accept(expanded); } }); mapComponent.setExpandListener(expanded -> { if (expanded) { removeComponent(statisticsComponent); epiCurveAndMapLayout.removeComponent(epiCurveComponent); epiCurveAndMapLayout.setHeight(100, Unit.PERCENTAGE); setHeight(100, Unit.PERCENTAGE); } else { addComponent(statisticsComponent, 1); epiCurveAndMapLayout.addComponent(epiCurveComponent, 0); epiCurveAndMapLayout.setHeight(BASE_HEIGHT, Unit.PIXELS); setHeightUndefined(); } if (externalExpandListener != null) { externalExpandListener.accept(expanded); } }); return epiCurveAndMapLayout; }
From source file:fi.csc.pathway.TutkaUI.java
License:Creative Commons License
/** * Pohjelma, joka luo kyttliittymn.// w w w . j a v a 2s . co m */ @Override protected void init(VaadinRequest request) { final String portletContextName = getPortletContextName(request); final VerticalLayout vasenpalkki = new VerticalLayout(); final HorizontalLayout layout = new HorizontalLayout(); //main final HorizontalLayout karttapalkki = new HorizontalLayout(); final HorizontalLayout lkmnext = new HorizontalLayout(); final Label hr = new Label(" ____________________", ContentMode.HTML); final Label aika = new Label("Time", ContentMode.HTML); final Label lkm = new Label("0", ContentMode.HTML); final Button next = new Button("Next"); final OptionGroup tyyppi = new OptionGroup("Type"); final OptionGroup tutka = new OptionGroup("Radar"); final OptionGroup kulma = new OptionGroup("Angle"); final OptionGroup krjet = new OptionGroup("Min vertices"); final Googlekartta gma = new Googlekartta(aika, tutka, kulma, tyyppi, krjet, portletContextName, lkm); final Tutkat tutkat = new Tutkat(); final PopupDateField enddate = new PopupDateField("To:"); final PopupDateField startdate = new PopupDateField("From:"); final GoogleMap oldComponent = gma.getOrigMap(); final GridLayout parametrit = new GridLayout(2, 2); tutkat.alusta(tutka, krjet, oldComponent); parametrit.addComponent(tutka); parametrit.addComponent(krjet); Ilmiot ilmio = new Ilmiot(tyyppi, tutka); kulma.addItem("1.5"); kulma.addItem("0.7"); kulma.addItem(Tutkat.LOW); //luostolla ei ole matalampaa kuin 0.7 kulma.setValue("1.5"); parametrit.addComponent(kulma); parametrit.addComponent(ilmio.getTyyppi()); vasenpalkki.addComponent(parametrit); Tarkista tarkista = new Tarkista(enddate, startdate); vasenpalkki.addComponent(tarkista.getstartdate()); vasenpalkki.addComponent(tarkista.getenddate()); next.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -8146345475859196611L; public void buttonClick(ClickEvent event) { if (gma.updateMap()) { next.setEnabled(false); } } }); final Button button = new Button("Query"); button.addClickListener(new Button.ClickListener() { //Component oldC = oldComponent; private static final long serialVersionUID = -8146345475859196612L; public void buttonClick(ClickEvent event) { if (gma.getMap(startdate.getValue(), enddate.getValue(), tutka.getValue())) { // tm ei ole kaunista, mutta uudelleen lisminen ei haittaa vasenpalkki.addComponent(hr); vasenpalkki.addComponent(aika); lkmnext.addComponent(lkm); next.setEnabled(true); lkmnext.addComponent(next); vasenpalkki.addComponent(lkmnext); } } }); vasenpalkki.addComponent(button); layout.addComponent(vasenpalkki); karttapalkki.setHeight(600, Sizeable.Unit.PIXELS); karttapalkki.addComponent(oldComponent); layout.addComponent(karttapalkki); layout.setMargin(true); setContent(layout); }
From source file:info.magnolia.ui.form.field.MultiField.java
License:Open Source License
/** * Create a single element.<br>/*from w w w .jav a 2 s . c om*/ * This single element is composed of:<br> * - a configured field <br> * - a remove Button<br> */ private Component createEntryComponent(Object propertyId, Property<?> property) { final HorizontalLayout layout = new HorizontalLayout(); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(-1, Unit.PIXELS); final Field<?> field = createLocalField(fieldDefinition, property, true); // creates property datasource if given property is null layout.addComponent(field); // bind the field's property to the item if (property == null) { property = field.getPropertyDataSource(); ((PropertysetItem) getPropertyDataSource().getValue()).addItemProperty(propertyId, property); } final Property<?> propertyReference = property; // set layout to full width layout.setWidth(100, Unit.PERCENTAGE); // distribute space in favour of field over delete button layout.setExpandRatio(field, 1); if (definition.isReadOnly()) { return layout; } // move up Button Button moveUpButton = new Button(); moveUpButton.setHtmlContentAllowed(true); moveUpButton.setCaption("<span class=\"" + "icon-arrow2_n" + "\"></span>"); moveUpButton.addStyleName("inline"); moveUpButton.setDescription(buttonCaptionMoveUp); moveUpButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { onMove(layout, propertyReference, true); } }); // move down Button Button moveDownButton = new Button(); moveDownButton.setHtmlContentAllowed(true); moveDownButton.setCaption("<span class=\"" + "icon-arrow2_s" + "\"></span>"); moveDownButton.addStyleName("inline"); moveDownButton.setDescription(buttonCaptionMoveDown); moveDownButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { onMove(layout, propertyReference, false); } }); // Delete Button Button deleteButton = new Button(); deleteButton.setHtmlContentAllowed(true); deleteButton.setCaption("<span class=\"" + "icon-trash" + "\"></span>"); deleteButton.addStyleName("inline"); deleteButton.setDescription(buttonCaptionRemove); deleteButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { onDelete(layout, propertyReference); } }); layout.addComponents(moveUpButton, moveDownButton, deleteButton); // make sure button stays aligned with the field and not with the optional field label when used layout.setComponentAlignment(deleteButton, Alignment.BOTTOM_RIGHT); layout.setComponentAlignment(moveUpButton, Alignment.BOTTOM_RIGHT); layout.setComponentAlignment(moveDownButton, Alignment.BOTTOM_RIGHT); return layout; }
From source file:io.subutai.plugin.accumulo.ui.manager.Manager.java
public Manager(final ExecutorService executorService, final Accumulo accumulo, Hadoop hadoop, final Zookeeper zookeeper, Tracker tracker, EnvironmentManager environmentManager) throws NamingException { this.executorService = executorService; this.accumulo = accumulo; this.hadoop = hadoop; this.zookeeper = zookeeper; this.tracker = tracker; this.environmentManager = environmentManager; contentRoot = new GridLayout(); contentRoot.setSpacing(true);//from ww w . ja v a 2s . c om contentRoot.setMargin(true); contentRoot.setSizeFull(); contentRoot.setRows(10); contentRoot.setColumns(1); //tables go here mastersTable = createTableTemplate("Masters"); mastersTable.setId("MastersTable"); tracersTable = createTableTemplate("Tracers"); tracersTable.setId("TracersTable"); slavesTable = createTableTemplate("Tablet Servers"); slavesTable.setId("Slavestable"); HorizontalLayout controlsContent = new HorizontalLayout(); controlsContent.setSpacing(true); controlsContent.setHeight(100, Sizeable.Unit.PERCENTAGE); Label clusterNameLabel = new Label("Select the cluster"); controlsContent.addComponent(clusterNameLabel); controlsContent.setComponentAlignment(clusterNameLabel, Alignment.MIDDLE_CENTER); ComboBox clustersCombo = getClusterCombo(); controlsContent.addComponent(clustersCombo); controlsContent.setComponentAlignment(clustersCombo, Alignment.MIDDLE_CENTER); refreshClustersBtn = getRefreshClustersButton(); controlsContent.addComponent(refreshClustersBtn); controlsContent.setComponentAlignment(refreshClustersBtn, Alignment.MIDDLE_CENTER); checkAllBtn = getCheckAllButton(); controlsContent.addComponent(checkAllBtn); controlsContent.setComponentAlignment(checkAllBtn, Alignment.MIDDLE_CENTER); startClusterBtn = getStartAllButton(); controlsContent.addComponent(startClusterBtn); controlsContent.setComponentAlignment(startClusterBtn, Alignment.MIDDLE_CENTER); stopClusterBtn = getStopAllButton(); controlsContent.addComponent(stopClusterBtn); controlsContent.setComponentAlignment(stopClusterBtn, Alignment.MIDDLE_CENTER); destroyClusterBtn = getDestroyClusterButton(); controlsContent.addComponent(destroyClusterBtn); controlsContent.setComponentAlignment(destroyClusterBtn, Alignment.MIDDLE_CENTER); addTracerBtn = getAddTracerNodeButton(); controlsContent.addComponent(addTracerBtn); controlsContent.setComponentAlignment(addTracerBtn, Alignment.MIDDLE_CENTER); addTabletServerButton = getAddSlaveButton(); controlsContent.addComponent(addTabletServerButton); controlsContent.setComponentAlignment(addTabletServerButton, Alignment.MIDDLE_CENTER); //auto scale button autoScaleBtn = new CheckBox(AUTO_SCALE_BUTTON_CAPTION); autoScaleBtn.setValue(false); autoScaleBtn.addStyleName("default"); controlsContent.addComponent(autoScaleBtn); controlsContent.setComponentAlignment(autoScaleBtn, Alignment.MIDDLE_CENTER); autoScaleBtn.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final Property.ValueChangeEvent event) { if (accumuloClusterConfig == null) { show("Select cluster"); } else { boolean value = (Boolean) event.getProperty().getValue(); accumuloClusterConfig.setAutoScaling(value); try { accumulo.saveConfig(accumuloClusterConfig); } catch (ClusterException e) { show(e.getMessage()); } } } }); addStyleName(refreshClustersBtn, checkAllBtn, startClusterBtn, stopClusterBtn, destroyClusterBtn, addTracerBtn, addTabletServerButton); PROGRESS_ICON.setVisible(false); PROGRESS_ICON.setId("indicator"); controlsContent.addComponent(PROGRESS_ICON); controlsContent.setComponentAlignment(PROGRESS_ICON, Alignment.MIDDLE_CENTER); contentRoot.addComponent(controlsContent, 0, 0); contentRoot.addComponent(mastersTable, 0, 1, 0, 3); contentRoot.addComponent(tracersTable, 0, 4, 0, 6); contentRoot.addComponent(slavesTable, 0, 7, 0, 9); }
From source file:it.vige.greenarea.bpm.custom.ui.LoginPanel.java
License:Apache License
private void initGuidonia() { HorizontalLayout panel = new HorizontalLayout(); panel.setHeight(90, UNITS_PIXELS); Label title = new Label(); title.addStyleName(LABEL_H1);//from w ww . jav a2s .c om title.setWidth(80, UNITS_PIXELS); if (get().getEnvironment().equals(ALFRESCO)) { title.addStyleName(STYLE_WORKFLOW_CONSOLE_LOGO); } else { title.addStyleName(STYLE_APPLICATION_MINI_GUIDONIA); } Label city = new Label(); city.addStyleName(LABEL_H1); city.setValue(i18nManager.getMessage(GUIDONIA_TITLE)); city.addStyleName(STYLE_APPLICATION_TITLE_GUIDONIA); city.setWidth(310, UNITS_PIXELS); panel.addComponent(title); panel.addComponent(city); sperimentazioni.addComponent(panel); }
From source file:it.vige.greenarea.bpm.custom.ui.LoginPanel.java
License:Apache License
private void initLivorno() { HorizontalLayout panel = new HorizontalLayout(); panel.setHeight(90, UNITS_PIXELS); Label title = new Label(); title.addStyleName(LABEL_H1);//from ww w . j a v a2s.com title.setWidth(80, UNITS_PIXELS); if (get().getEnvironment().equals(ALFRESCO)) { title.addStyleName(STYLE_WORKFLOW_CONSOLE_LOGO); } else { title.addStyleName(STYLE_APPLICATION_MINI_LIVORNO); } Label city = new Label(); city.addStyleName(LABEL_H1); city.setValue(i18nManager.getMessage(LIVORNO_TITLE)); city.addStyleName(STYLE_APPLICATION_TITLE_LIVORNO); city.setWidth(310, UNITS_PIXELS); panel.addComponent(title); panel.addComponent(city); sperimentazioni.addComponent(panel); }
From source file:it.vige.greenarea.bpm.custom.ui.LoginPanel.java
License:Apache License
private void initPomezia() { HorizontalLayout panel = new HorizontalLayout(); panel.setHeight(90, UNITS_PIXELS); Label title = new Label(); title.addStyleName(LABEL_H1);/*from w w w .j a v a 2s . c om*/ title.setWidth(80, UNITS_PIXELS); if (get().getEnvironment().equals(ALFRESCO)) { title.addStyleName(STYLE_WORKFLOW_CONSOLE_LOGO); } else { title.addStyleName(STYLE_APPLICATION_MINI_POMEZIA); } Label city = new Label(); city.addStyleName(LABEL_H1); city.setValue(i18nManager.getMessage(POMEZIA_TITLE)); city.addStyleName(STYLE_APPLICATION_TITLE_POMEZIA); city.setWidth(310, UNITS_PIXELS); panel.addComponent(title); panel.addComponent(city); sperimentazioni.addComponent(panel); }
From source file:no.uib.probe.csf.pr.touch.view.core.SearchingField.java
/** * Default constructor to initialize the main attributes. */// ww w . java2s.co m public SearchingField() { this.setSpacing(true); this.setHeightUndefined(); HorizontalLayout searchFieldContainerLayout = new HorizontalLayout(); searchFieldContainerLayout.setWidthUndefined(); searchFieldContainerLayout.setHeight(100, Unit.PERCENTAGE); searchFieldContainerLayout.setSpacing(true); TextField searchField = new TextField(); searchField.setDescription("Search proteins by name or accession"); searchField.setImmediate(true); searchField.setWidth(100, Unit.PIXELS); searchField.setHeight(18, Unit.PIXELS); searchField.setInputPrompt("Search..."); searchFieldContainerLayout.addComponent(searchField); searchField.setTextChangeTimeout(1500); searchField.setStyleName(ValoTheme.TEXTFIELD_SMALL); searchField.addStyleName(ValoTheme.TEXTFIELD_TINY); final Button b = new Button(); searchField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY); searchField.addShortcutListener(new Button.ClickShortcut(b, ShortcutListener.KeyCode.ENTER)); VerticalLayout searchingBtn = new VerticalLayout(); searchingBtn.setWidth(22, Unit.PIXELS); searchingBtn.setHeight(18, Unit.PIXELS); searchingBtn.setStyleName("tablesearchingbtn"); searchFieldContainerLayout.addComponent(searchingBtn); searchFieldContainerLayout.setComponentAlignment(searchingBtn, Alignment.TOP_CENTER); this.addComponent(searchFieldContainerLayout); this.setComponentAlignment(searchFieldContainerLayout, Alignment.TOP_CENTER); searchingCommentLabel = new Label(); searchingCommentLabel.setWidth(100, Unit.PERCENTAGE); searchingCommentLabel.setHeight(23, Unit.PIXELS); searchingCommentLabel.addStyleName(ValoTheme.LABEL_BOLD); searchingCommentLabel.addStyleName(ValoTheme.LABEL_SMALL); searchingCommentLabel.addStyleName(ValoTheme.LABEL_TINY); this.addComponent(searchingCommentLabel); this.setComponentAlignment(searchingCommentLabel, Alignment.TOP_CENTER); searchingBtn.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> { b.click(); }); searchField.addTextChangeListener((FieldEvents.TextChangeEvent event) -> { SearchingField.this.textChanged(event.getText()); }); b.addClickListener((Button.ClickEvent event) -> { SearchingField.this.textChanged(searchField.getValue()); }); }
From source file:org.escidoc.browser.ui.tools.LoadExampleView.java
License:Open Source License
private void init() { setCompositionRoot(cssLayout);/* ww w .j a v a2 s .c o m*/ cssLayout.setMargin(true); Label text = new H2(ViewConstants.LOAD_EXAMPLE); text.setContentMode(Label.CONTENT_XHTML); cssLayout.addComponent(text); cssLayout.addComponent(new Ruler()); text = new Label(ViewConstants.LOAD_EXAMPLE_TEXT, Label.CONTENT_XHTML); cssLayout.addComponent(text); final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setWidth(100, UNITS_PERCENTAGE); hLayout.setHeight(100, UNITS_PERCENTAGE); loadExampleButton.setWidth(150, UNITS_PIXELS); loadExampleButton.addListener(new ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { try { List<Entry> loadedExamples = adminRepository.loadCommonExamples(); for (Entry entry : loadedExamples) { cssLayout.addComponent(new Label(entry.getMessage())); } } catch (EscidocClientException e) { String msg = "Internal Server Error while loading example set." + e.getMessage(); LOG.error(msg); router.getMainWindow().showNotification("Error at LoadExampleView ", msg, Window.Notification.TYPE_ERROR_MESSAGE); } } }); hLayout.addComponent(loadExampleButton); cssLayout.addComponent(hLayout); }