List of usage examples for com.vaadin.ui Label setHeight
@Override public void setHeight(String height)
From source file:org.jdal.vaadin.ui.Box.java
License:Apache License
/** * Try to imitate a VerticalGlue of Swing BoxLayout */// w w w. j a v a 2 s. c om public static void addVerticalGlue(AbstractOrderedLayout layout) { Label label = new Label(" "); label.setHeight("100%"); layout.addComponent(label); layout.setExpandRatio(label, 1.0f); }
From source file:org.jdal.vaadin.ui.Box.java
License:Apache License
/** * Try to imitate VerticalStruct of Swing BoxLayout * @param layout layout to add struct/* www. j av a 2s . co m*/ * @param height struct height */ public static void addVerticalStruct(AbstractOrderedLayout layout, int height) { Label label = new Label(); label.setHeight(height + "px"); layout.addComponent(label); layout.setExpandRatio(label, 0f); }
From source file:org.jdal.vaadin.ui.form.SimpleBoxFormBuilder.java
License:Apache License
public void addHorizontalGlue() { Label label = new Label(); label.setHeight("0px"); add(label, SIZE_FULL);// ww w. j a v a 2s.c o m }
From source file:org.jpos.qi.system.MemoryUsageView.java
License:Open Source License
public MemoryUsageView() { super();// w w w .j a va 2 s .c o m qi = (QI) UI.getCurrent(); setSpacing(false); setMargin(true); setSizeFull(); available = createLabel(); allocated = createLabel(); used = createLabel(); forceGC = new Button(qi.getMessage("memory-usage.force.gc")); GridLayout gl = new GridLayout(3, 3); gl.addComponent(strong(qi.getMessage("memory-usage.availableMemory"))); gl.addComponent(available); gl.setComponentAlignment(available, Alignment.TOP_RIGHT); gl.addComponent(createMBLabel()); gl.addComponent(strong(qi.getMessage("memory-usage.allocatedMemory"))); gl.addComponent(allocated); gl.setComponentAlignment(allocated, Alignment.TOP_RIGHT); gl.addComponent(createMBLabel()); gl.addComponent(strong(qi.getMessage("memory-usage.usedMemory"))); gl.addComponent(used); gl.setComponentAlignment(used, Alignment.TOP_RIGHT); gl.addComponent(createMBLabel()); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("75%"); hl.addComponent(gl); hl.setComponentAlignment(gl, Alignment.MIDDLE_CENTER); hl.addComponent(memoryGauge = createGauge("Memory", 0)); hl.setComponentAlignment(memoryGauge, Alignment.MIDDLE_CENTER); hl.addComponent(forceGC); hl.setComponentAlignment(forceGC, Alignment.MIDDLE_CENTER); forceGC.addClickListener((Button.ClickListener) event -> gc()); addComponent(hl); setComponentAlignment(hl, Alignment.MIDDLE_CENTER); Label l = new Label(""); l.setHeight("30px"); addComponent(l); chart = new DCharts(); ds = new DataSeries(); AxesDefaults axesDefaults = new AxesDefaults().setLabelRenderer(LabelRenderers.CANVAS); Axes axes = new Axes() .addAxis(new XYaxis(XYaxes.X).setLabel("Time (last 300 seconds)") .setLabelRenderer(LabelRenderers.AXIS).setPad(0)) .addAxis(new XYaxis(XYaxes.Y).setLabel("In use memory percentage").setPad(0) .setTickOptions(new AxisTickRenderer().setFormatString("%.2f%"))); Cursor cursor = new Cursor().setShow(true); Series series = new Series().addSeries(new XYseries().setLineWidth(0.5f) .setMarkerOptions(new MarkerRenderer().setStyle(MarkerStyles.CIRCLE).setShadow(true))); Options options = new Options().setAxesDefaults(axesDefaults).setCursor(cursor).setSeries(series) .setAxes(axes); chart.setDataSeries(ds).show(); chart.setOptions(options); chart.setSizeFull(); // chart.setHeight("450px"); // chart.setWidth("450px"); addComponent(chart); // setComponentAlignment(chart, Alignment.BOTTOM_CENTER); }
From source file:org.lunifera.christmastree.control.DesktopControlComponent.java
License:Creative Commons License
protected AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);/* w w w. jav a 2 s. c o m*/ mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // title area ThemeResource resource = new ThemeResource("images/Title.png"); Image title = new Image(" ", resource); title.setHeight("108px"); title.setWidth("827px"); mainLayout.addComponent(title, "top:22.0px;left:120.0px"); VerticalLayout vl = new VerticalLayout(); vl.setHeight("500px"); vl.setWidth("400px"); vl.setSpacing(true); mainLayout.addComponent(vl, "top:140.0px;left:100.0px;"); contentLayout = buildContent(); vl.addComponent(contentLayout); vl.setExpandRatio(contentLayout, 1.0f); // licenses PopupView licenseLink = new PopupView("Attributions", new Label("<div><i>Monitor/tablet/smartphone</i> and <i>tree</i> icons </br> made by " + "<a href=\"http://www.freepik.com\" title=\"Freepik\">Freepik</a> " + "from <a href=\"http://www.flaticon.com\" title=\"Flaticon\">www.flaticon.com</a> </br>" + "is licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" " + "title=\"Creative Commons BY 3.0\">CC BY 3.0</a></div>", ContentMode.HTML)); licenseLink.setPrimaryStyleName("attributions"); vl.addComponent(licenseLink); Label image = new Label(); image.setHeight("400px"); image.setWidth("100%"); // image.setValue("<div style=\"overflow:hidden; width: 400px; // margin-left: -60px;\">" // + "<img src=\"http://77.119.240.22:8081\"/>" + "</div>"); image.setValue("<div style=\"overflow:hidden; width: 370px; margin-left: -60px;\">" + "<img src=\"http://192.168.0.108:8081\"/>" + "</div>"); image.setContentMode(ContentMode.HTML); mainLayout.addComponent(image, "top:140.0px;left:600.0px;"); return mainLayout; }
From source file:org.lunifera.christmastree.control.MobileControlComponent.java
License:Creative Commons License
protected AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);/*from w ww .j a v a 2 s . co m*/ mainLayout.setWidth("1280px"); mainLayout.setHeight("720px"); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // title area ThemeResource resource = new ThemeResource("images/Title.png"); Image title = new Image(" ", resource); title.setHeight("54px"); title.setWidth("413px"); mainLayout.addComponent(title, "top:11.0px;left:60.0px"); Label image = new Label(); image.setHeight("340px"); image.setWidth("600px"); image.setValue("<div style=\"overflow:hidden; width: 320px; height: 600px; margin-left: -60px;\">" + "<img src=\"http://192.168.0.108:8081\"/>" + "</div>"); image.setContentMode(ContentMode.HTML); mainLayout.addComponent(image, "top:70.0px;left:125px;"); // Image image = new Image(); // image.setHeight("240px"); // image.setWidth("320px"); // image.setSource(new // ExternalResource("http://192.168.0.108:8081/stream", // "video/x-motion-jpeg")); // mainLayout.addComponent(image, "top:70.0px;left:50.0px;"); VerticalLayout vl = new VerticalLayout(); // vl.setHeight("250px"); vl.setWidth("200px"); vl.setSpacing(true); mainLayout.addComponent(vl, "top:180.0px;left:535.0px;"); contentLayout = buildContent(); vl.addComponent(contentLayout); vl.setExpandRatio(contentLayout, 1.0f); // licenses PopupView licenseLink = new PopupView("Attributions", new Label("<div><i>Monitor/tablet/smartphone</i> and <i>tree</i> icons </br> made by " + "<a href=\"http://www.freepik.com\" title=\"Freepik\">Freepik</a> " + "from <a href=\"http://www.flaticon.com\" title=\"Flaticon\">www.flaticon.com</a> </br>" + "is licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" " + "title=\"Creative Commons BY 3.0\">CC BY 3.0</a></div>", ContentMode.HTML)); licenseLink.setPrimaryStyleName("attributions"); vl.addComponent(licenseLink); return mainLayout; }
From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.LicenceDescriptorPanel.java
License:Apache License
/** * updates the metadata fields from the licence string * if unable to read the metadata then returns false * @param licenceStr/*from w ww. j av a2 s . c o m*/ * @return true if metadata read, false if not */ public boolean updateMetadata(String licenceStr) { boolean success = false; if (licenceStr != null) { LicenceMetadata licenceMetadata = null; try { licenceMetadata = Licence.getUnverifiedMetadata(licenceStr); } catch (Exception e) { // can't decode string licenceMetadata will be null } if (licenceMetadata == null) { //create empty licenceMetadata panel licenceMetadata = new LicenceMetadata(); licenceMetadata.setStartDate(null); licenceMetadata.setProductId("cannot decode licence string"); success = false; } else success = true; productIdTextField.setReadOnly(false); productIdTextField .setValue((licenceMetadata.getProductId() == null) ? "" : licenceMetadata.getProductId()); productIdTextField.setReadOnly(noUpdate); featureRepositoryTextField.setReadOnly(false); featureRepositoryTextField.setValue( (licenceMetadata.getFeatureRepository() == null) ? "" : licenceMetadata.getFeatureRepository()); featureRepositoryTextField.setReadOnly(noUpdate); Format formatter = new SimpleDateFormat("yyyy-MM-dd"); startDateTextField.setReadOnly(false); startDateTextField.setValue((licenceMetadata.getStartDate() == null) ? "" : formatter.format(licenceMetadata.getStartDate())); startDateTextField.setReadOnly(noUpdate); expiryDateTextField.setReadOnly(false); expiryDateTextField.setValue((licenceMetadata.getExpiryDate() == null) ? "" : formatter.format(licenceMetadata.getExpiryDate())); expiryDateTextField.setReadOnly(noUpdate); durationTextField.setReadOnly(false); durationTextField .setValue((licenceMetadata.getDuration() == null) ? "" : licenceMetadata.getDuration()); durationTextField.setReadOnly(noUpdate); licenseeTextField.setReadOnly(false); licenseeTextField .setValue((licenceMetadata.getLicensee() == null) ? "" : licenceMetadata.getLicensee()); licenseeTextField.setReadOnly(noUpdate); licensorTextField.setReadOnly(false); licensorTextField .setValue((licenceMetadata.getLicensor() == null) ? "" : licenceMetadata.getLicensor()); licensorTextField.setReadOnly(noUpdate); maxSizeSystemIdsTextField.setReadOnly(false); maxSizeSystemIdsTextField.setValue( (licenceMetadata.getMaxSizeSystemIds() == null) ? "" : licenceMetadata.getMaxSizeSystemIds()); maxSizeSystemIdsTextField.setReadOnly(noUpdate); // display systemIds if present systemIdsVerticalLayout.removeAllComponents(); // add error messages if system ids defined when not expected Label l1 = new Label(); l1.setContentMode(ContentMode.HTML); Integer licenceMetadataMaxSizeSystemIds = null; try { licenceMetadataMaxSizeSystemIds = Integer.parseInt(licenceMetadata.getMaxSizeSystemIds()); } catch (Exception e) { } if (licenceMetadataMaxSizeSystemIds == null || licenceMetadataMaxSizeSystemIds == 0) { // if maxSizeSystemIds=0 check if systemId's list has entries (an error) if (licenceMetadata.getSystemIds() == null || licenceMetadata.getSystemIds().isEmpty()) { l1.setValue("<div style=\"color: green;\">" + "All SystemId's Accepted" + "</div>"); } else { l1.setValue("<div style=\"color: red;\">" + "Licence Error: MaxSizeSystemIds=0 but " + licenceMetadata.getSystemIds().size() + " systemId's are defined" + "</div>"); } systemIdsVerticalLayout.addComponent(l1); } else if (licenceMetadata.getSystemIds() == null || licenceMetadata.getSystemIds().isEmpty()) { l1.setValue("<div style=\"color: green;\">" + "No SystemId's Defined" + "</div>"); systemIdsVerticalLayout.addComponent(l1); } else if (licenceMetadata.getSystemIds().size() > licenceMetadataMaxSizeSystemIds) { l1.setValue("<div style=\"color: red;\">Licence Error: more system id's defined in licence (" + licenceMetadata.getSystemIds().size() + ") than allowed in maxSizeSystemIds=" + licenceMetadata.getMaxSizeSystemIds() + "</div>"); systemIdsVerticalLayout.addComponent(l1); } // add system id strings if present if (licenceMetadata.getSystemIds() != null) { for (String systemId : licenceMetadata.getSystemIds()) { Label systemIdField = new Label(); systemIdField.setImmediate(true); systemIdField.setWidth("400px"); systemIdField.setHeight("-1px"); systemIdField.setValue(systemId); systemIdsVerticalLayout.addComponent(systemIdField); } } // display licence options if present licenceOptionsVerticalLayout.removeAllComponents(); if (licenceMetadata.getOptions() == null || licenceMetadata.getOptions().isEmpty()) { Label l = new Label("No Licence Options Defined"); licenceOptionsVerticalLayout.addComponent(l); } else { for (OptionMetadata option : licenceMetadata.getOptions()) { TextField optionField = new TextField(); optionField.setImmediate(true); optionField.setWidth("400px"); optionField.setHeight("-1px"); optionField.setCaption(option.getName()); optionField.setValue(option.getValue()); optionField.setDescription(option.getDescription()); optionField.setReadOnly(noUpdate); licenceOptionsVerticalLayout.addComponent(optionField); } } mainLayout.markAsDirty(); } return success; }
From source file:org.semanticsoft.vaaclipse.presentation.renderers.PerspectiveStackRenderer.java
License:Open Source License
private void initializedPerspectiveSwticherPanel(MPerspectiveStack perspectiveStack) { if (perspectiveSwitcherPanel != null) return;//from www. ja v a2 s . c o m //initialize perspective switcher panel perspectiveStackForSwitcher = perspectiveStack; boolean iconsOnly = perspectiveStackForSwitcher.getTags().contains(Tags.ICONS_ONLY); perspectiveSwitcherPanel = new HorizontalLayout(); perspectiveSwitcherPanel.setStyleName("perspectivepanel"); perspectiveSwitcherPanel.setSizeUndefined(); Button openPerspectiveButton = new Button("Open"); openPerspectiveButton.addStyleName("vaaclipsebutton"); openPerspectiveButton.addStyleName("icononly"); openPerspectiveButton.setIcon(new ThemeResource("../vaaclipse_default_theme/img/open_perspective.png")); perspectiveSwitcherPanel.addComponent(openPerspectiveButton); openPerspectiveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { openOpenPerspectiveWindow(); //change focus Component parent = event.getButton().getParent(); while (parent != null) { if (parent instanceof Component.Focusable) { ((Component.Focusable) parent).focus(); break; } else { parent = parent.getParent(); } } } }); //add separator between openPerspectiveButton and perspective's buttons Label separator = new Label(); separator.setSizeUndefined(); separator.addStyleName("horizontalseparator"); separator.setHeight("100%"); perspectiveSwitcherPanel.addComponent(separator); //add buttons to perspective switch panel for (final MPerspective perspective : perspectiveStackForSwitcher.getChildren()) { Component button = createPerspectiveButton(perspective); if (button != null) perspectiveSwitcherPanel.addComponent(button); } }
From source file:org.semanticsoft.vaaclipse.presentation.utils.GuiUtils.java
License:Open Source License
public static Component createSeparator(MTrimElement trimElement) { if ((MElementContainer<?>) trimElement.getParent() instanceof MTrimBar) { Label separator = new Label(); separator.setSizeUndefined();//from w w w .j av a 2s .c o m MTrimBar parentTrimBar = (MTrimBar) (MElementContainer<?>) trimElement.getParent(); int orientation = parentTrimBar.getSide().getValue(); if (orientation == SideValue.TOP_VALUE || orientation == SideValue.BOTTOM_VALUE) { separator.addStyleName("horizontalseparator"); separator.setHeight("100%"); } else { separator.addStyleName("verticalseparator"); separator.setWidth("100%"); } return separator; } else return null; }
From source file:probe.com.view.body.QuantCompareDataLayout.java
public QuantCompareDataLayout(CSFPRHandler CSFPR_Handler) { this.setWidth("100%"); this.setHeightUndefined(); this.setStyleName(Reindeer.LAYOUT_WHITE); this.setSpacing(true); topLabelMarker = new VerticalLayout(); this.addComponent(topLabelMarker); this.setExpandRatio(topLabelMarker, 0.01f); topLabelMarker.setHeight("10px"); topLabelMarker.setWidth("20px"); topLabelMarker.setStyleName(Reindeer.LAYOUT_WHITE); this.CSFPR_Handler = CSFPR_Handler; Map<String, QuantDatasetInitialInformationObject> quantDatasetInitialInformationObjectMap = CSFPR_Handler .getQuantDatasetInitialInformationObject(); diseaseGroupNames = new TreeSet<String>(); for (String diseaseCategory : quantDatasetInitialInformationObjectMap.keySet()) { QuantDatasetInitialInformationObject quantDatasetInitialInformationObject = quantDatasetInitialInformationObjectMap .get(diseaseCategory);/*from w w w .j av a2s . c om*/ for (QuantDatasetObject qdsObject : quantDatasetInitialInformationObject.getQuantDatasetsList() .values()) { diseaseGroupNames.add(qdsObject.getPatientsSubGroup1().split("\n")[0].trim()); diseaseGroupNames.add(qdsObject.getPatientsSubGroup2().split("\n")[0].trim()); } } int width = 400; if (Page.getCurrent().getBrowserWindowWidth() < 800) { width = Page.getCurrent().getBrowserWindowWidth() / 2; } HorizontalLayout userDataLayout = new HorizontalLayout(); userDataLayout.setSpacing(true); HorizontalLayout miniSelectDiseaseGroupsLayout = new HorizontalLayout(); miniSelectDiseaseGroupsLayout.setStyleName("diseasegroupselectionresult"); miniSelectDiseaseGroupsLayout.setSpacing(true); miniSelectDiseaseGroupsLayout.setWidthUndefined(); miniselectionResultsLabel = new Label(); // miniselectionResultsLabel.setWidth("300px"); miniSelectDiseaseGroupsLayout.addComponent(miniselectionResultsLabel); selectionResultsOverview = new Label(); // selectionResultsOverview.setWidth("300px"); miniSelectDiseaseGroupsLayout.addComponent(selectionResultsOverview); selectionResultsOverview.setContentMode(ContentMode.HTML); userDataLayoutContainer = new HideOnClickLayout("User Data", userDataLayout, miniSelectDiseaseGroupsLayout, Alignment.TOP_LEFT, "info data", null); userDataLayoutContainer.setMargin(new MarginInfo(false, false, false, true)); userDataLayoutContainer.setVisability(true); this.addComponent(userDataLayoutContainer); VerticalLayout leftUserDataLayout = new VerticalLayout(); userDataLayout.addComponent(leftUserDataLayout); //select or enter new disease groups layout selectionResultsLabel = new Label("Selection:"); selectDiseaseGroupsContainer = initSelectEnterDatasetDiseaseGroups(width); // selectDiseaseGroupsContainer.setVisability(true); selectDiseaseGroupsContainer.setReadOnly(true); leftUserDataLayout.addComponent(selectDiseaseGroupsContainer); proteinsDataCaptureLayout = initProteinsDataCapture(width); leftUserDataLayout.addComponent(proteinsDataCaptureLayout); ResultsOverviewLayout.setStyleName("compareresults"); ResultsOverviewLayout.setWidth("350px"); ResultsOverviewLayout.setHeightUndefined(); ResultsOverviewLayout.setSpacing(true); ResultsOverviewLayout.setMargin(new MarginInfo(false, false, false, true)); Label resultsTitleLabel = new Label("Results Overview"); resultsTitleLabel.setContentMode(ContentMode.HTML); resultsTitleLabel.setStyleName("normalheader"); resultsTitleLabel.setHeight("20px"); ResultsOverviewLayout.addComponent(resultsTitleLabel); ResultsOverviewLayout.setComponentAlignment(resultsTitleLabel, Alignment.TOP_LEFT); resultContainer = new GridLayout(3, 5); resultContainer.setSpacing(true); resultContainer.setMargin(true); resultContainer.setHideEmptyRowsAndColumns(true); ResultsOverviewLayout.addComponent(resultContainer); ResultsOverviewLayout.setComponentAlignment(resultContainer, Alignment.TOP_LEFT); resultContainer.setWidth("100%"); foundPublicationLabel = new Label(); // resultContainer.addComponent(foundPublicationLabel, 0, 0); foundStudiesLabel = new Label(); // resultContainer.addComponent(foundStudiesLabel, 1, 0); foundProteinsLabel = new Label(); resultContainer.addComponent(foundProteinsLabel, 0, 0); newProteinsDownloadBtn = new Button(); newProteinsDownloadBtn.setCaptionAsHtml(true); newProteinsDownloadBtn.setStyleName(Reindeer.BUTTON_LINK); // ResultsOverviewLayout.addComponent(newProteinsDownloadBtn); newProteinsDownloadBtn.setDescription("Download new proteins (not found in CSF-PR) records"); // ResultsOverviewLayout.addComponent(newProteinsTextArea); newProteinsTextArea.setWidth("302px"); newProteinsTextArea.setHeight("200px"); newProteinsTextArea.setReadOnly(true); newProteinsDownloadBtn.addClickListener(QuantCompareDataLayout.this); newProteinsDownloadBtn.setId("notfounderrorbtn"); userDataLayout.addComponent(ResultsOverviewLayout); this.addComponent(resultsLayout); }