List of usage examples for com.vaadin.server ThemeResource ThemeResource
public ThemeResource(String resourceId)
From source file:sph.vaadin.ui.ComponentFactory.java
License:Apache License
/** * Creates a new large blue push Button with an optional icon image. * /*from www .j a va 2 s . c o m*/ * @.post <em>RESULT.getStyleNames().equals({@link SPH_Theme#LARGE_BLUE_BUTTON})</em> * @param caption component's caption String. Caption is the visible name of the component. * @param enabled a boolean value specifying if the component should be enabled or not. * @param pathToIcon the path to the icon image of the button or null. * @return the created component. */ public static Button createLargeBlueButton(String caption, boolean enabled, String pathToIcon) { Button btn = new Button(caption); btn.setStyleName(SPH_Theme.LARGE_BLUE_BUTTON); btn.setEnabled(enabled); if (pathToIcon != null) { btn.setIcon(new ThemeResource(pathToIcon)); } return btn; }
From source file:sph.vaadin.ui.ComponentFactory.java
License:Apache License
/** * Creates a new small blue push Button with an optional icon image. * //from ww w . j av a 2 s .co m * @.post <em>RESULT.getStyleNames().equals({@link SPH_Theme#SMALL_BLUE_BUTTON})</em> * @param caption component's caption String. Caption is the visible name of the component. * @param enabled a boolean value specifying if the component should be enabled or not. * @param pathToIcon the path to the icon image of the button or null. * @return the created component. */ public static Button createSmallBlueButton(String caption, boolean enabled, String pathToIcon) { Button btn = new Button(caption); btn.setStyleName(SPH_Theme.SMALL_BLUE_BUTTON); btn.setEnabled(enabled); if (pathToIcon != null) { btn.setIcon(new ThemeResource(pathToIcon)); } return btn; }
From source file:ubu.digit.ui.components.Footer.java
License:Creative Commons License
/** * Aade la informacin de la licencia del proyecto. *///from ww w. j a va 2 s . c o m private void addLicense() { VerticalLayout license = new VerticalLayout(); license.setMargin(false); license.setSpacing(true); Link ccImage = new Link(null, new ExternalResource("https://creativecommons.org/licenses/by/4.0/")); ccImage.setIcon(new ThemeResource("img/cc.png")); Label licenseText = new Label("This work is licensed under a: "); Link ccLink = new Link("Creative Commons Attribution 4.0 International License.", new ExternalResource("https://creativecommons.org/licenses/by/4.0/")); license.addComponents(ccImage, licenseText, ccLink); if (fileName != null) { String lastModified = getLastModified(fileName); license.addComponent(new Label("Ultima actualizacin: " + lastModified)); } Button login = new Button("Actualizar"); login.addClickListener(new LoginClickListener()); license.addComponent(login); content.addComponent(license); }
From source file:ui.helper.UserArea.java
private Resource getResource(Integer userId) { if (userId != null) { return new ThemeResource("../img/photo.jpg"); }//from ww w . j av a2 s .c o m return new ThemeResource("../img/space3.jpg"); }
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);//from w w w.ja v a 2 s.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")); }
From source file:uk.co.intec.keyDatesApp.components.HeaderComponent.java
License:Apache License
/** * Constructor, passing the Vaadin application page * * @param ui/*w w w . j av a2 s. co m*/ * MainUI application page */ public HeaderComponent(MainUI ui) { setHeight("50px"); setStyleName("header"); final HorizontalLayout bannerArea = new HorizontalLayout(); bannerArea.setStyleName("menuArea"); bannerArea.setSizeFull(); final ThemeResource resource = new ThemeResource("img/intec-logo.gif.png"); final Image bannerImg = new Image(); bannerImg.setAlternateText("Intec"); bannerImg.setHeight("50px"); bannerImg.setDescription("Intec Logo"); bannerImg.setSource(resource); bannerImg.setWidth(null); bannerImg.setStyleName("bannerImg"); setMenubar(new MenuBar()); getMenubar().setStyleName(ValoTheme.MENU_SUBTITLE); getMenubar().addStyleName("valo-menu-subtitle-indent"); getMenubar().setWidth(100, Unit.PERCENTAGE); if (!"Anonymous".equals(getUserName())) { final MenuItem logout = menubar.addItem("Logout", null); logout.setStyleName("menuRight"); } final MenuItem userItem = menubar.addItem(getUserName(), null); userItem.setStyleName("menuRight"); bannerArea.addComponents(bannerImg, menubar); bannerArea.setExpandRatio(menubar, 1); addComponent(bannerArea); setExpandRatio(bannerArea, 1); setSizeFull(); }
From source file:uk.q3c.util.testutil.ExampleUtil.java
License:Apache License
private static void fillIso3166Container(IndexedContainer container) { container.addContainerProperty(iso3166_PROPERTY_NAME, String.class, null); container.addContainerProperty(iso3166_PROPERTY_SHORT, String.class, null); container.addContainerProperty(iso3166_PROPERTY_FLAG, Resource.class, null); for (int i = 0; i < iso3166.length; i++) { String name = iso3166[i++]; String id = iso3166[i];//ww w . jav a 2s . c o m Item item = container.addItem(id); item.getItemProperty(iso3166_PROPERTY_NAME).setValue(name); item.getItemProperty(iso3166_PROPERTY_SHORT).setValue(id); item.getItemProperty(iso3166_PROPERTY_FLAG) .setValue(new ThemeResource("../sampler/flags/" + id.toLowerCase() + ".gif")); } container.sort(new Object[] { iso3166_PROPERTY_NAME }, new boolean[] { true }); }
From source file:util.LifetimeUtils.java
License:Apache License
public static Resource getFlag(String lang) { if (lang.equalsIgnoreCase("en")) { return new ThemeResource("../img/Flags/flags_iso/16/gb.png"); }// w w w. j a v a 2s. c o m return new ThemeResource("../img/Flags/flags_iso/16/" + lang + ".png"); }