List of usage examples for com.vaadin.ui Image Image
public Image(String caption, Resource source)
From source file:tad.grupo7.ccamistadeslargas.AdminIndexView.java
public AdminIndexView() { setMenuCaption("CCAmistadesLargas - ADMIN"); String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath() + "/WEB-INF/wallpaper2.jpg"; FileResource resource = new FileResource(new File(basepath)); Image image = new Image(null, resource); image.setSizeFull();/*from w w w . j a va2 s . c o m*/ addComponent(image); addMenuItem("Listado", FontAwesome.LIST, () -> { removeAllComponents(); addComponent(new ListadoLayout()); }); addMenuItem("Grafica", FontAwesome.PIE_CHART, () -> { removeAllComponents(); addComponent(new GraficaLayout()); }); addMenuItem("Cerrar sesin", FontAwesome.POWER_OFF, () -> { Session.destroy(); UI.getCurrent().getNavigator().navigateTo(""); }); }
From source file:tad.grupo7.ccamistadeslargas.IndexView.java
public IndexView() { setMenuCaption("CCAmistadesLargas"); String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath() + "/WEB-INF/wallpaper2.jpg"; FileResource resource = new FileResource(new File(basepath)); Image image = new Image(null, resource); image.setSizeFull();//from w ww . jav a2s . c o m addComponent(image); addMenuItem("Perfil", FontAwesome.USER, () -> { removeAllComponents(); addComponent(new PerfilLayout()); }); addMenuItem("Eventos", FontAwesome.COMPASS, () -> { removeAllComponents(); addComponent(new EventosLayout()); }); addMenuItem("Amigos", FontAwesome.USERS, () -> { removeAllComponents(); addComponent(new AmigosLayout()); }); addMenuItem("Cerrar sesin", FontAwesome.POWER_OFF, () -> { Session.destroy(); UI.getCurrent().getNavigator().navigateTo(""); }); }
From source file:ui.user.UserView.java
License:Apache License
private static Image getUserImage(final Integer userId, String language) { return new Image("", new StreamResource(new StreamResource.StreamSource() { @Override//from w w w . ja v a 2 s . c om public InputStream getStream() { try { Photo photo = ServiceLocator.findLifetimeService().getUserPhoto(userId); return new ByteArrayInputStream(photo.getImage()); } catch (UserWithoutPhotoException ex) { Logger.getLogger(UserView.class.getName()).log(Level.SEVERE, null, ex); return new ByteArrayInputStream(new byte[] {}); } } }, "user_" + userId)); }
From source file:ui.visitor.VisitorView.java
License:Apache License
private static Image getVisitorImage(final Integer userId, String language) { return new Image("", new StreamResource(new StreamResource.StreamSource() { @Override// w w w . j a v a 2 s .c om public InputStream getStream() { try { Photo photo = ServiceLocator.findLifetimeService().getUserPhoto(userId); return new ByteArrayInputStream(photo.getImage()); } catch (UserWithoutPhotoException ex) { Logger.getLogger(UserView.class.getName()).log(Level.SEVERE, null, ex); return new ByteArrayInputStream(new byte[] {}); } } }, "visitor_" + userId)); }
From source file:ui.welcome.WelcomeView.java
License:Apache License
private static Image getWelcomeImage(String language) { return new Image("", new ThemeResource("../img/background.jpg")); }
From source file:uicomponents.BarcodePreviewComponent.java
License:Open Source License
public BarcodePreviewComponent(SampleToBarcodeFieldTranslator translator) { this.translator = translator; setSpacing(true);// www.j av a 2s . c o m 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")); }