List of usage examples for com.vaadin.ui Image setHeight
@Override public void setHeight(String height)
From source file:fi.semantum.strategia.Updates.java
License:Open Source License
private static void updateQueryGrid(final Main main, final FilterState state) { main.gridPanelLayout.removeAllComponents(); main.gridPanelLayout.setMargin(false); final List<String> keys = state.reportColumns; if (keys.isEmpty()) { Label l = new Label("Kysely ei tuottanut yhtn tulosta."); l.addStyleName(ValoTheme.LABEL_BOLD); l.addStyleName(ValoTheme.LABEL_HUGE); main.gridPanelLayout.addComponent(l); return;//from w w w.j ava 2s .c om } final IndexedContainer container = new IndexedContainer(); for (String key : keys) { container.addContainerProperty(key, String.class, ""); } rows: for (Map<String, ReportCell> map : state.report) { Object item = container.addItem(); for (String key : keys) if (map.get(key) == null) continue rows; for (Map.Entry<String, ReportCell> entry : map.entrySet()) { @SuppressWarnings("unchecked") com.vaadin.data.Property<String> p = container.getContainerProperty(item, entry.getKey()); p.setValue(entry.getValue().get()); } } HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); final TextField filter = new TextField(); filter.addStyleName(ValoTheme.TEXTFIELD_TINY); filter.setInputPrompt("rajaa hakutuloksia - kirjoitetun sanan tulee lyty rivin teksteist"); filter.setWidth("100%"); final Image clipboard = new Image(); clipboard.setSource(new ThemeResource("page_white_excel.png")); clipboard.setHeight("24px"); clipboard.setWidth("24px"); hl.addComponent(filter); hl.setExpandRatio(filter, 1.0f); hl.setComponentAlignment(filter, Alignment.BOTTOM_CENTER); hl.addComponent(clipboard); hl.setComponentAlignment(clipboard, Alignment.BOTTOM_CENTER); hl.setExpandRatio(clipboard, 0.0f); main.gridPanelLayout.addComponent(hl); main.gridPanelLayout.setExpandRatio(hl, 0f); filter.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 3033918399018888150L; @Override public void valueChange(ValueChangeEvent event) { container.removeAllContainerFilters(); container.addContainerFilter(new QueryFilter(filter.getValue(), true, false)); } }); AbsoluteLayout abs = new AbsoluteLayout(); abs.setSizeFull(); final Grid queryGrid = new Grid(container); queryGrid.setSelectionMode(SelectionMode.NONE); queryGrid.setHeightMode(HeightMode.CSS); queryGrid.setHeight("100%"); queryGrid.setWidth("100%"); for (String key : keys) { Column col = queryGrid.getColumn(key); col.setExpandRatio(1); } abs.addComponent(queryGrid); OnDemandFileDownloader dl = new OnDemandFileDownloader(new OnDemandStreamSource() { private static final long serialVersionUID = 981769438054780731L; File f; Date date = new Date(); @Override public InputStream getStream() { String uuid = UUID.randomUUID().toString(); File printing = new File(Main.baseDirectory(), "printing"); f = new File(printing, uuid + ".xlsx"); Workbook w = new XSSFWorkbook(); Sheet sheet = w.createSheet("Sheet1"); Row header = sheet.createRow(0); for (int i = 0; i < keys.size(); i++) { Cell cell = header.createCell(i); cell.setCellValue(keys.get(i)); } int row = 1; rows: for (Map<String, ReportCell> map : state.report) { for (String key : keys) if (map.get(key) == null) continue rows; Row r = sheet.createRow(row++); int column = 0; for (int i = 0; i < keys.size(); i++) { Cell cell = r.createCell(column++); ReportCell rc = map.get(keys.get(i)); cell.setCellValue(rc.getLong()); } } try { FileOutputStream s = new FileOutputStream(f); w.write(s); s.close(); } catch (Exception e) { e.printStackTrace(); } try { return new FileInputStream(f); } catch (FileNotFoundException e) { e.printStackTrace(); } throw new IllegalStateException(); } @Override public void onRequest() { // TODO Auto-generated method stub } @Override public long getFileSize() { return f.length(); } @Override public String getFileName() { return "Strategiakartta_" + Utils.dateString(date) + ".xlsx"; } }); dl.getResource().setCacheTime(0); dl.extend(clipboard); main.gridPanelLayout.addComponent(abs); main.gridPanelLayout.setExpandRatio(abs, 1f); }
From source file:fi.semantum.strategia.Updates.java
License:Open Source License
public static void updateTags(final Main main) { final Database database = main.getDatabase(); main.tags.removeAllComponents();/*from w w w . j av a2 s .co m*/ main.tags.setMargin(true); ArrayList<Tag> sorted = new ArrayList<Tag>(Tag.enumerate(database)); Collections.sort(sorted, new Comparator<Tag>() { @Override public int compare(Tag arg0, Tag arg1) { return arg0.getId(database).compareTo(arg1.getId(database)); } }); for (final Tag t : sorted) { final HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); Label l = new Label(t.getId(database)); l.setSizeUndefined(); l.addStyleName(ValoTheme.LABEL_HUGE); hl.addComponent(l); hl.setComponentAlignment(l, Alignment.BOTTOM_LEFT); final Image select = new Image("", new ThemeResource("cursor.png")); select.setHeight("24px"); select.setWidth("24px"); select.setDescription("Valitse"); select.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 3734678948272593793L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { main.setCurrentItem(t, main.getUIState().currentPosition); Utils.loseFocus(select); } }); hl.addComponent(select); hl.setComponentAlignment(select, Alignment.BOTTOM_LEFT); final Image edit = new Image("", new ThemeResource("table_edit.png")); edit.setHeight("24px"); edit.setWidth("24px"); edit.setDescription("Muokkaa"); edit.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = -3792353723974454702L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Utils.editTextAndId(main, "Muokkaa aihetunnistetta", t); updateTags(main); } }); hl.addComponent(edit); hl.setComponentAlignment(edit, Alignment.BOTTOM_LEFT); main.tags.addComponent(hl); main.tags.setComponentAlignment(hl, Alignment.MIDDLE_CENTER); Label l2 = new Label(t.getText(database)); l2.addStyleName(ValoTheme.LABEL_LIGHT); l2.setSizeUndefined(); main.tags.addComponent(l2); main.tags.setComponentAlignment(l2, Alignment.MIDDLE_CENTER); } }
From source file:fi.semantum.strategia.widget.Indicator.java
License:Open Source License
public static void updateIndicators(final Main main, final Base base, boolean canWrite) { final Database database = main.getDatabase(); List<IndicatorDescription> descs = new ArrayList<IndicatorDescription>(); fillIndicatorDescriptions(main, base, "", descs); boolean isMap = base instanceof Strategiakartta; if (isMap && (!descs.isEmpty() || canWrite)) { HorizontalLayout indiHeader = new HorizontalLayout(); indiHeader.setSpacing(true);//from www . j av a 2 s . com Label header = new Label("Indikaattorit (ennuste)"); main.propertyCells.add(Utils.excelRow(header.getValue())); header.setHeight("32px"); header.addStyleName(ValoTheme.LABEL_HUGE); header.addStyleName(ValoTheme.LABEL_BOLD); indiHeader.addComponent(header); indiHeader.setComponentAlignment(header, Alignment.BOTTOM_CENTER); if (canWrite) { final Image editIndicators = new Image(null, new ThemeResource("chart_line_edit.png")); editIndicators.setHeight("24px"); editIndicators.setWidth("24px"); editIndicators.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 2661060702097338722L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Utils.loseFocus(editIndicators); manageIndicators(main, main.getUIState().currentItem); } }); indiHeader.addComponent(editIndicators); indiHeader.setComponentAlignment(editIndicators, Alignment.BOTTOM_CENTER); } main.properties.addComponent(indiHeader); main.properties.setComponentAlignment(indiHeader, Alignment.MIDDLE_CENTER); VerticalLayout indicators = new VerticalLayout(); boolean showYears = main.getUIState().time.equals(Property.AIKAVALI_KAIKKI); Property time = Property.find(database, Property.AIKAVALI); int index = 0; for (final IndicatorDescription desc : descs) { ArrayList<String> excelRow = new ArrayList<String>(); Indicator indicator = desc.indicator; final HorizontalLayout hl = new HorizontalLayout(); hl.addStyleName((((index++) & 1) == 0) ? "evenProperty" : "oddProperty"); hl.setSpacing(true); Label l = new Label(desc.caption); excelRow.add(l.getValue().replace("%nbsp", "")); l.setContentMode(ContentMode.HTML); l.setWidth("450px"); l.addStyleName("propertyName"); l.setData(desc); hl.addComponent(l); hl.setComponentAlignment(l, Alignment.MIDDLE_LEFT); String value = updateIndicatorValue(main, hl, base, indicator, canWrite); excelRow.add(value); Label unit = new Label(indicator.getUnit()); unit.setWidth("100px"); hl.addComponent(unit); hl.setComponentAlignment(unit, Alignment.MIDDLE_LEFT); excelRow.add(unit.getValue()); Label comment = new Label(indicator.getValueShortComment()); comment.setWidth("150px"); hl.addComponent(comment); hl.setComponentAlignment(comment, Alignment.MIDDLE_LEFT); excelRow.add(comment.getValue()); if (showYears) { HorizontalLayout hl2 = new HorizontalLayout(); hl2.setWidth("70px"); hl2.setHeight("100%"); hl.addComponent(hl2); hl.setComponentAlignment(hl2, Alignment.MIDDLE_LEFT); String years = time.getPropertyValue(indicator); if (years == null) years = Property.AIKAVALI_KAIKKI; final Label region = new Label(years); region.setWidthUndefined(); excelRow.add(region.getValue()); hl2.addComponent(region); hl2.setComponentAlignment(region, Alignment.MIDDLE_CENTER); } final Image wiki = new Image(); wiki.setSource(new ThemeResource("table_edit.png")); wiki.setHeight("24px"); wiki.setWidth("24px"); wiki.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 2661060702097338722L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Wiki.openWiki(main, desc.indicator); } }); hl.addComponent(wiki); hl.setComponentAlignment(wiki, Alignment.MIDDLE_CENTER); indicators.addComponent(hl); indicators.setComponentAlignment(hl, Alignment.MIDDLE_CENTER); main.propertyCells.add(excelRow); } indicators.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = 3295743025581923380L; private String extractData(Component c) { if (c instanceof AbstractComponent) { Object data = ((AbstractComponent) c).getData(); if (data instanceof IndicatorDescription) { IndicatorDescription desc = (IndicatorDescription) data; return desc.indicator.getDescription(database); } } return null; } @Override public void layoutClick(LayoutClickEvent event) { String desc = extractData(event.getClickedComponent()); if (desc == null) return; String content = "<div style=\"width: 700px; border: 2px solid; padding: 5px\">"; content += "<div style=\"text-align: center; white-space:normal; font-size: 36px; padding: 10px\">" + desc + "</div>"; content += "</div>"; Notification n = new Notification(content, Notification.Type.HUMANIZED_MESSAGE); n.setHtmlContentAllowed(true); n.show(Page.getCurrent()); } }); main.properties.addComponent(indicators); main.properties.setComponentAlignment(indicators, Alignment.MIDDLE_CENTER); } }
From source file:fi.semantum.strategia.widget.Meter.java
License:Open Source License
public static void updateMeters(final Main main, boolean canWrite) { if (main.getUIState().currentItem instanceof Strategiakartta) return;// w w w . ja v a2s .c o m final Database database = main.getDatabase(); final Base base = main.getUIState().currentItem; List<MeterDescription> descs = makeMeterDescriptions(main, base, false); if (!descs.isEmpty() || canWrite) { HorizontalLayout meterHeader = new HorizontalLayout(); meterHeader.setSpacing(true); Label header = new Label("Mittarit"); main.propertyCells.add(Utils.excelRow(header.getValue())); header.setHeight("32px"); header.addStyleName(ValoTheme.LABEL_HUGE); header.addStyleName(ValoTheme.LABEL_BOLD); meterHeader.addComponent(header); meterHeader.setComponentAlignment(header, Alignment.BOTTOM_CENTER); if (canWrite) { final Image editMeters = new Image(null, new ThemeResource("chart_bar_edit.png")); editMeters.setHeight("24px"); editMeters.setWidth("24px"); editMeters.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 2661060702097338722L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Utils.loseFocus(editMeters); manageMeters(main, main.getUIState().currentItem); } }); meterHeader.addComponent(editMeters); meterHeader.setComponentAlignment(editMeters, Alignment.BOTTOM_CENTER); } main.properties.addComponent(meterHeader); main.properties.setComponentAlignment(meterHeader, Alignment.MIDDLE_CENTER); VerticalLayout meters = new VerticalLayout(); boolean showYears = main.getUIState().time.equals(Property.AIKAVALI_KAIKKI); Property time = Property.find(database, Property.AIKAVALI); int index = 0; for (final MeterDescription desc : descs) { ArrayList<String> excelRow = new ArrayList<String>(); final Meter meter = desc.meter; final HorizontalLayout hl = new HorizontalLayout(); hl.addStyleName((((index++) & 1) == 0) ? "evenProperty" : "oddProperty"); hl.setSpacing(true); Label l = new Label(desc.caption); excelRow.add(l.getValue().replace("%nbsp", "")); l.setContentMode(ContentMode.HTML); l.setWidth("450px"); l.addStyleName("propertyName"); l.setData(desc); hl.addComponent(l); hl.setComponentAlignment(l, Alignment.MIDDLE_LEFT); String value = updateMeterValue(main, hl, base, meter, canWrite); excelRow.add(value); String shortComment = ""; Indicator indicator = meter.getPossibleIndicator(database); if (indicator != null) shortComment = indicator.getValueShortComment(); Label comment = new Label(shortComment); comment.setWidth("150px"); hl.addComponent(comment); hl.setComponentAlignment(comment, Alignment.MIDDLE_LEFT); excelRow.add(comment.getValue()); if (showYears) { HorizontalLayout hl2 = new HorizontalLayout(); hl2.setWidth("70px"); hl2.setHeight("100%"); hl.addComponent(hl2); hl.setComponentAlignment(hl2, Alignment.MIDDLE_LEFT); String years = time.getPropertyValue(meter); if (years == null) years = Property.AIKAVALI_KAIKKI; final Label region = new Label(years); region.setWidthUndefined(); excelRow.add(region.getValue()); hl2.addComponent(region); hl2.setComponentAlignment(region, Alignment.MIDDLE_CENTER); } AbsoluteLayout image = new AbsoluteLayout(); image.setWidth("32px"); image.setHeight("32px"); image.addStyleName("meterColor" + index); String color = meter.getTrafficColor(database); Styles styles = Page.getCurrent().getStyles(); styles.add( ".fi_semantum_strategia div." + "meterColor" + index + " { background: " + color + "; }"); hl.addComponent(image); hl.setComponentAlignment(image, Alignment.MIDDLE_CENTER); hl.setExpandRatio(image, 0.0f); meters.addComponent(hl); meters.setComponentAlignment(hl, Alignment.MIDDLE_CENTER); ThemeResource res = desc.meter.showInMap ? new ThemeResource("zoom.png") : new ThemeResource("zoom_out.png"); final Image show = new Image(); show.setSource(res); show.setHeight("24px"); show.setWidth("24px"); if (canWrite) { show.setDescription("Klikkaamalla voit valita, nytetnk mittaria strategiakartassa"); show.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 7156984656942915939L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { desc.meter.setShowInMap(!desc.meter.showInMap); Updates.update(main, true); } }); } hl.addComponent(show); hl.setComponentAlignment(show, Alignment.MIDDLE_CENTER); final Image wiki = new Image(); wiki.setSource(new ThemeResource("table_edit.png")); wiki.setHeight("24px"); wiki.setWidth("24px"); wiki.setDescription("Klikkaamalla voit siirty tausta-asiakirjaan"); wiki.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 7156984656942915939L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Wiki.openWiki(main, desc.meter); } }); hl.addComponent(wiki); hl.setComponentAlignment(wiki, Alignment.MIDDLE_CENTER); if (canWrite) { final Button principalButton = new Button(); if (meter.isPrincipal) { principalButton.setCaption("Poista kokonaisarvio"); } else { principalButton.setCaption("Aseta kokonaisarvioksi"); } principalButton.setStyleName(ValoTheme.BUTTON_TINY); principalButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 8247560202892661226L; @Override public void buttonClick(ClickEvent event) { if (meter.isPrincipal) { meter.isPrincipal = false; } else { for (Meter m : base.getMeters(database)) m.isPrincipal = false; meter.isPrincipal = true; } Updates.update(main, true); } }); hl.addComponent(principalButton); hl.setComponentAlignment(principalButton, Alignment.MIDDLE_CENTER); } main.propertyCells.add(excelRow); } meters.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = 3295743025581923380L; private String extractData(Component c) { if (c instanceof AbstractComponent) { Object data = ((AbstractComponent) c).getData(); if (data instanceof MeterDescription) { MeterDescription desc = (MeterDescription) data; return desc.meter.getDescription(database); } } return null; } @Override public void layoutClick(LayoutClickEvent event) { String desc = extractData(event.getClickedComponent()); if (desc == null) return; String content = "<div style=\"width: 700px; border: 2px solid; padding: 5px\">"; content += "<div style=\"text-align: center; white-space:normal; font-size: 36px; padding: 10px\">" + desc + "</div>"; content += "</div>"; Notification n = new Notification(content, Notification.Type.HUMANIZED_MESSAGE); n.setHtmlContentAllowed(true); n.show(Page.getCurrent()); } }); main.properties.addComponent(meters); main.properties.setComponentAlignment(meters, Alignment.MIDDLE_CENTER); } }
From source file:fi.semantum.strategia.widget.Tag.java
License:Open Source License
public static void updateRelatedTags(final Main main, boolean canWrite) { final Database database = main.getDatabase(); final Base base = main.getUIState().currentItem; Collection<Tag> tags = base.getRelatedTags(database); if (!tags.isEmpty() || canWrite) { HorizontalLayout tagHeader = new HorizontalLayout(); tagHeader.setSpacing(true);// w ww.j a v a 2 s . c o m Label header2 = new Label("Aihetunnisteet"); header2.setHeight("32px"); header2.addStyleName(ValoTheme.LABEL_HUGE); header2.addStyleName(ValoTheme.LABEL_BOLD); tagHeader.addComponent(header2); tagHeader.setComponentAlignment(header2, Alignment.BOTTOM_CENTER); if (canWrite) { final Image editTags = new Image("", new ThemeResource("tag_blue_edit.png")); editTags.setHeight("24px"); editTags.setWidth("24px"); editTags.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = -6140867347404571880L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Utils.loseFocus(editTags); Utils.editTags(main, "Muokkaa aihetunnisteita", main.getUIState().currentItem); } }); tagHeader.addComponent(editTags); tagHeader.setComponentAlignment(editTags, Alignment.BOTTOM_CENTER); } main.properties.addComponent(tagHeader); main.properties.setComponentAlignment(tagHeader, Alignment.MIDDLE_CENTER); HorizontalLayout divider = new HorizontalLayout(); main.properties.addComponent(divider); main.properties.setComponentAlignment(divider, Alignment.MIDDLE_CENTER); VerticalLayout left = new VerticalLayout(); left.setSpacing(true); left.setWidth("400px"); left.setMargin(true); divider.addComponent(left); VerticalLayout right = new VerticalLayout(); right.setSpacing(true); right.setWidth("400px"); right.setMargin(true); divider.addComponent(right); Set<Tag> monitoredTags = getMonitoredTags(database, base); int i = 0; for (final Tag tag : tags) { final boolean monitor = base.hasMonitorTag(database, tag); String tagId = tag.getId(database); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setHeight("37px"); Button tagButton = Utils.tagButton(database, "list", tagId, i++); left.addComponent(tagButton); left.setComponentAlignment(tagButton, Alignment.MIDDLE_RIGHT); if (canWrite) { Button b = new Button(); b.addStyleName(ValoTheme.BUTTON_BORDERLESS); b.setIcon(FontAwesome.TIMES_CIRCLE); b.addClickListener(new ClickListener() { private static final long serialVersionUID = -4473258383318654850L; @Override public void buttonClick(ClickEvent event) { base.removeRelatedTags(database, tag); Utils.loseFocus(main.properties); Updates.update(main, true); } }); hl.addComponent(b); hl.setComponentAlignment(b, Alignment.MIDDLE_LEFT); } if (base instanceof Strategiakartta) { Button tagButton2 = new Button(); tagButton2.setCaption(monitor ? "Seurataan toteutuksessa" : "Ei seurata toteutuksessa"); tagButton2.addStyleName(monitor ? "greenButton" : "redButton"); tagButton2.addStyleName(ValoTheme.BUTTON_SMALL); tagButton2.setWidth("200px"); if (canWrite) { tagButton2.addClickListener(new ClickListener() { private static final long serialVersionUID = -1769769368034323594L; @Override public void buttonClick(ClickEvent event) { if (monitor) { base.removeMonitorTags(database, tag); } else { base.assertMonitorTags(database, tag); } Utils.loseFocus(main.properties); Updates.update(main, true); } }); tagButton2.setEnabled(true); } else { tagButton2.setEnabled(false); } hl.addComponent(tagButton2); hl.setComponentAlignment(tagButton2, Alignment.MIDDLE_LEFT); } else { if (monitoredTags.contains(tag)) { Label l = new Label(" toteuttaa seurattavaa aihetta "); hl.addComponent(l); hl.setComponentAlignment(l, Alignment.MIDDLE_LEFT); } } right.addComponent(hl); right.setComponentAlignment(hl, Alignment.MIDDLE_LEFT); } } }
From source file:org.investovator.ui.main.components.GameDetailsView.java
License:Open Source License
public Image getImage() { String iconName = "game_icon.jpg"; GameModes imageMode = null;//from w w w . jav a 2s.c o m if (gameInstance != null) { imageMode = controller.getGameMode(gameInstance); } else if (gameMode != null) { imageMode = gameMode; } if (imageMode != null) { switch (imageMode) { case AGENT_GAME: iconName = "agent2.jpg"; break; case NN_GAME: iconName = "prediction_based.jpg"; break; case PAYBACK_ENG: iconName = "game_icon.jpg"; break; } } FileResource resource = new FileResource(new File(ConfigHelper.getImagePath() + iconName)); Image img = new Image(null, resource); img.setHeight("50px"); img.setWidth("50px"); return img; }
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);//from w w w . j a v a2 s. c om 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 ww w . j ava 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.vaadin.easyuploads.ImagePreviewField.java
License:Apache License
@Override protected Component createDisplayComponent() { Image image = new Image(); image.setHeight("100px"); return image; }
From source file:uicomponents.BarcodePreviewComponent.java
License:Open Source License
public BarcodePreviewComponent(SampleToBarcodeFieldTranslator translator) { this.translator = translator; setSpacing(true);/*from w ww . j a v a2 s. com*/ setMargin(true); Resource res = new ThemeResource("img/qrtest.png"); Image qr = new Image(null, res); qr.setHeight("140px"); qr.setWidth("140px"); Image qr2 = new Image(null, res); qr2.setHeight("140px"); qr2.setWidth("140px"); code = new TextField(); info1 = new TextField(); info2 = new TextField(); codedName = new OptionGroup("Put ID on sticker:"); codedName.addItems(Arrays.asList("QBiC ID", "Lab ID", "Secondary Name")); codedName.setImmediate(true); codedName.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL); codedName.select("QBiC ID"); code.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS); code.setWidth("200px"); code.addStyleName("barcode-large"); styleInfoField(info1); styleInfoField(info2); styleInfoField(qbicInfo); VerticalLayout box = new VerticalLayout(); box.setHeight("110px"); box.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); box.addComponent(code); box.addComponent(info1); box.addComponent(info2); box.addComponent(qbicInfo); box.setWidth("190px"); HorizontalLayout test = new HorizontalLayout(); test.setSizeFull(); test.addComponent(qr); test.addComponent(box); test.addComponent(qr2); setFieldsReadOnly(true); List<String> options = new ArrayList<String>(Arrays.asList("Tissue/Extr. Material", "Secondary Name", "QBiC ID", "Lab ID", "MHC Type", "Used Antibody")); select1 = new ComboBox("First Info", options); select1.setStyleName(Styles.boxTheme); select1.setImmediate(true); select1.select("Tissue/Extr. Material"); select2 = new ComboBox("Second Info", options); select2.select("Secondary Name"); select2.setImmediate(true); select2.setStyleName(Styles.boxTheme); ValueChangeListener vc = new ValueChangeListener() { /** * */ private static final long serialVersionUID = -7466519211904860012L; @Override public void valueChange(ValueChangeEvent event) { refresh(); } }; codedName.addValueChangeListener(vc); select1.addValueChangeListener(vc); select2.addValueChangeListener(vc); HorizontalLayout designBox = new HorizontalLayout(); designBox.addComponent(select1); designBox.addComponent(select2); designBox.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); designBox.setSpacing(true); VerticalLayout previewBox = new VerticalLayout(); previewBox.setStyleName(ValoTheme.LAYOUT_CARD); previewBox.setCaption("Barcode Example"); previewBox.addComponent(test); addComponent(previewBox); addComponent(codedName); addComponent(designBox); // overwrite = new CheckBox("Overwrite existing Tube Barcode Files"); // addComponent(ProjectwizardUI.questionize(overwrite, // "Overwrites existing files of barcode stickers. This is useful when " // + "the design was changed after creating them.", "Overwrite Sticker Files")); }