/** * @param txtCode * @return une ligne de légende */ private HorizontalLayout getLegendLineLayout(String txtCode) { HorizontalLayout hlLineLegend = new HorizontalLayout(); hlLineLegend.setWidth(100, Unit.PERCENTAGE); hlLineLegend.setSpacing(true); Image flagImg = new Image(null, new ThemeResource("images/icon/Flag-" + txtCode + "-icon.png")); Label label = new Label(applicationContext.getMessage("formation.table.flagEtat.tooltip." + txtCode, null, UI.getCurrent().getLocale())); hlLineLegend.addComponent(flagImg); hlLineLegend.setComponentAlignment(flagImg, Alignment.MIDDLE_LEFT); hlLineLegend.addComponent(label); hlLineLegend.setComponentAlignment(label, Alignment.MIDDLE_LEFT); hlLineLegend.setExpandRatio(label, 1); return hlLineLegend; }
/** * @param toolbar * HorizontalLayout which contains all the action Buttons * @param toolbarButton * Which Tool bar button to create (Provided using ENUM constant) * @param listner * Click listener called when this button is clicked * @return */ public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton, ClickListener listner) { Button button = new Button(toolbarButton.getText()); button.addStyleName(StyleConstants.BUTTON_TOOLBAR); button.setDescription(toolbarButton.getTooltip()); button.setStyleName(ValoTheme.BUTTON_LINK); if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) { button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString()); } button.setEnabled(false); button.setId(toolbarButton.getId()); button.addClickListener(listner); toolbar.addComponent(button); return button; }
@SuppressWarnings("serial") private HorizontalLayout createHeader(String title) { HorizontalLayout header = ViewUtil.createSubHeader(title, getSubViewHelpGuid()); Button refresh = new Button(); refresh.setStyleName(Reindeer.BUTTON_LINK); refresh.setDescription("Refresh"); refresh.setIcon(new ThemeResource("img/Refresh.png")); refresh.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { populateTable(); } }); header.addComponent(refresh); return header; }
private Container createDataSource() { Container languageItems = new IndexedContainer(); languageItems.addContainerProperty("icon", ThemeResource.class, null); languageItems.addContainerProperty("caption", String.class, ""); fillItem(languageItems.addItem(Locale.ENGLISH), "English", "en"); fillItem(languageItems.addItem(new Locale("pl")), "Polski", "pl"); return languageItems; }
public static List<StaticCustomer> createDummyData() { LinkedList<StaticCustomer> list = new LinkedList<>(); for (int i = 1; i <= 10000; i++) { StaticCustomer customer = new StaticCustomer(); customer.setId(i); customer.setFirstName(testData.getFirstName()); customer.setLastName(testData.getLastName()); NativeSelect foodSelect = new NativeSelect(null, Arrays.asList(StaticCustomer.Food.values())); foodSelect.setValue(testData.getItem(StaticCustomer.Food.values())); customer.setFood(foodSelect); customer.setPhoto(new ThemeResource("../demotheme/demophotos/cat" + testData.getNumberBetween(1, 4) + ".jpg")); list.add(customer); } return list; }
public static List<Customer> createDummyData() { LinkedList<Customer> list = new LinkedList<>(); for (int i = 1; i <= 10000; i++) { Customer customer = new Customer(); customer.setId(i); customer.setFirstName(testData.getFirstName()); customer.setLastName(testData.getLastName()); customer.setFood(testData.getItem(Customer.Food.values())); customer.setPhoto(new ThemeResource("../demotheme/demophotos/cat" + testData.getNumberBetween(1, 4) + ".jpg")); list.add(customer); } return list; }
private Component createImageChild() { String resourceName; switch (childCounter.incrementAndGet() % 4) { case 1: resourceName = "images/goldenbridge2.jpg"; break; case 2: resourceName = "images/chavatar.png"; break; case 3: resourceName = "images/goldenbridge.jpg"; break; default: resourceName = "images/redwood.jpg"; break; } ScaleImage image = new ScaleImage(new ThemeResource(resourceName)); image.addStyleName("simple-cover"); image.setSizeFull(); return GridStackStyling.createPaperItemWrapper(image); }
/** * Gets getIcon corresponding to given localization key. * @param key The localization key. * @return The localized getIcon. */ public Resource getIcon(final String key) { if (PropertiesUtil.hasProperty("icon", key)) { final String value = PropertiesUtil.getProperty("icon", key).trim(); if (value.startsWith("FontAwesome.")) { final String iconName = value.substring(value.indexOf('.') + 1); for (final FontAwesome icon : FontAwesome.values()) { if (icon.name().equals(iconName)) { return icon; } } throw new IllegalArgumentException("No such icon in FontAwesome: " + iconName); } else { return new ThemeResource("icons/" + value + ".png"); } } return new ThemeResource("icons/" + key + ".png"); }
@Override protected ComponentContainer createEditFields() { final ExtaFormLayout form = new ExtaFormLayout(); appTitleField = new EditField("Заголовок приложения"); form.addComponent(appTitleField); iconPathField = new ComboBox("Иконка приложения"); for (final String icon : lookup(UserSettingsService.class).getFaviconPathList()) { iconPathField.addItem(icon); iconPathField.setItemIcon(icon, new ThemeResource(getLast(Splitter.on('/').split(icon)))); } iconPathField.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ICON_ONLY); iconPathField.setWidth(85, Unit.PIXELS); iconPathField.setTextInputAllowed(false); iconPathField.setNullSelectionAllowed(false); form.addComponent(iconPathField); isShowSalePointIdsField = new MCheckBox("Показывать раздел \"Идентификация\" в карточке торговой точки"); form.addComponent(isShowSalePointIdsField); isDevServerField = new MCheckBox("Режим отладки"); form.addComponent(isDevServerField); return form; }
public void createAddResidueMenu(MenuItem parent) { String notation=theCanvas.getWorkspace().getGlycanRenderer().getGraphicOptions().NOTATION; MenuItem structureMenu=parent.addItem("Add residue", null); for (String superclass : ResidueDictionary.getSuperclasses()) { MenuItem superClassMenu=structureMenu.addItem(superclass,null); for (ResidueType t : ResidueDictionary.getResidues(superclass)) { if (t.canHaveParent()){ superClassMenu.addItem(t.getName(), new Command(){ private static final long serialVersionUID=4750928193466060500L; @Override public void menuSelected(MenuItem selectedItem) { theCanvas.addResidueByNameToSelected(selectedItem.getText()); } }).setIcon(new ThemeResource("icons"+File.separator+"residues"+File.separator+notation+File.separator+t.getName()+".png")); } } if(superClassMenu.getChildren()==null){ structureMenu.removeChild(superClassMenu); } } }
private void createChangeResidueMenu(MenuItem parent) { MenuItem structureMenu=parent.addItem("Change residue", null); String notation=theCanvas.getWorkspace().getGlycanRenderer().getGraphicOptions().NOTATION; for (String superclass : ResidueDictionary.getSuperclasses()) { MenuItem superClassMenu=structureMenu.addItem(superclass,null); for (ResidueType t : ResidueDictionary.getResidues(superclass)){ superClassMenu.addItem(t.getName(), new Command(){ private static final long serialVersionUID=-7886271503255704127L; @Override public void menuSelected(MenuItem selectedItem) { theCanvas.changeSelectedToResidueByName(selectedItem.getText()); } }).setIcon(new ThemeResource("icons"+File.separator+"residues"+File.separator+notation+File.separator+t.getName()+".png")); } if(superClassMenu.getChildren()==null){ structureMenu.removeChild(superClassMenu); } } structureMenu.setEnabled(false); menuItemsWithResidueSelectionDependency.add(structureMenu); }
private Component buildUserMenu() { final User user = getCurrentUser(); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); settingsItem = settings.addItem("", new ThemeResource("img/profile-pic-300px.jpg"), null); if (!User.GUEST.equals(user)) { settingsItem.addItem(Messages.getString("Caption.Menu.EditProfile"), e -> userSettingsWindowPresenter.showWindow(user)); settingsItem.addSeparator(); } String itemCaption = Messages.getString("Caption.Menu.Logout"); if (User.GUEST.equals(user)) { itemCaption = Messages.getString("Caption.Menu.LoginOther"); user.setUsername(Messages.getString("Caption.User.Guest")); } settingsItem.addItem(itemCaption, e -> mainEvent.fire(new MainUIEvent.UserLoggedOutEvent())); updateUserName(); return settings; }
private void initLayoutHeader() { headerLayout.setWidth("100%"); headerLayout.setHeight("80px"); headerLayout.setId("header"); Link rdfunit = new Link("", new ExternalResource("http://rdfunit.aksw.org/")); rdfunit.setIcon(new ThemeResource("images/logo-rdfunit.png")); headerLayout.addComponent(rdfunit); Link aksw = new Link("", new ExternalResource("http://aksw.org/")); aksw.setIcon(new ThemeResource("images/logo-aksw.png")); aksw.addStyleName("align-right"); headerLayout.addComponent(aksw); }
public Tabsheet() { TabBarView tabBarView = new TabBarView(); tabBarView.addTab(getTable(), "First", new ThemeResource( "../runo/icons/64/folder.png")); tabBarView.addTab(getDateSelector(), "Other", new ThemeResource( "../runo/icons/64/document.png")); tabBarView.addTab(getComboBox(), "Third", new ThemeResource( "../runo/icons/64/document-pdf.png")); Tab tab = tabBarView.addTab(getFields(), "4th", new ThemeResource( "../runo/icons/64/email.png")); tabBarView.setSelectedTab(tab); makeSmallTabletSize(tabBarView); addComponent(tabBarView); }
public AboutView() { setCaption(Messages.getString("aboutTitle")); //$NON-NLS-1$ setModal(true); setResizable(false); center(); VerticalLayout main = new VerticalLayout(); Resource logoResource = new ThemeResource("img/omc-logo.png"); //$NON-NLS-1$ Image appLogoImage = new Image("",logoResource); //$NON-NLS-1$ Label appLabel = new Label(appName + " v." + version); //$NON-NLS-1$ Label developerLabel = new Label(developer); Link githubLink = new Link(github, new ExternalResource(github)); main.addComponents(appLogoImage, appLabel, developerLabel, githubLink); main.setComponentAlignment(appLabel, Alignment.MIDDLE_CENTER); main.setComponentAlignment(developerLabel, Alignment.MIDDLE_CENTER); main.setComponentAlignment(githubLink, Alignment.MIDDLE_CENTER); setContent(main); }
private void createPlaylistView() { playlistLayout = new HorizontalLayout(); playlistTable = new Table(); playlistLayout.addComponent(playlistTable); playlistTable.setSelectable(true); playlistTable.addValueChangeListener(this); playlistTable.addContainerProperty(Messages.getString("PlaylistView.0"), CheckBox.class, null); //$NON-NLS-1$ playlistTable.addContainerProperty(Messages.getString("PlaylistView.playList"), String.class, null); //$NON-NLS-1$ playlistTable.addContainerProperty(Messages.getString("PlaylistView.download"), Button.class, null); //$NON-NLS-1$ for(Playlist playlist : playlistService.getAllPlaylists()) { Button downloadButton = new Button(); downloadButton.addStyleName("download"); //$NON-NLS-1$ downloadButton.setIcon(new ThemeResource("img/download.png")); //$NON-NLS-1$ Button favouriteButton = new Button(); playlistTable.addItem(new Object[] {new CheckBox(), playlist.getName(), playlist.getId(), downloadButton, favouriteButton}, playlist.getId()); } }
private void filterTracksByArtistId(int artistId){ if(artistId >= 0) { trackTable.removeAllItems(); for(Track track : tracks) { if(track.getArtist().getId() == artistId){ Link downloadLink = new Link(null, new ExternalResource(track.getFile().getAudioMp3UrlString())); downloadLink.setIcon(new ThemeResource("img/download.png")); //$NON-NLS-1$ String albumTitle = ""; //$NON-NLS-1$ if(track.getAlbum() != null && track.getAlbum().getName().length() > 0) { track.getAlbum().getName(); } trackTable.addItem(new Object[] {new CheckBox(), track.getTitle(), albumTitle, downloadLink}, track.getId()); } } } }
public SearchView() { searchView = new HorizontalLayout(); searchTextField = new TextField(); searchTextField.addStyleName("searchbar"); //$NON-NLS-1$ searchTextField.setInputPrompt(Messages.getString("SearchView.searchTip")); //$NON-NLS-1$ searchTextField.addTextChangeListener(this); searchButton = new Button(); searchButton.setIcon(new ThemeResource("img/search.png")); //$NON-NLS-1$ searchView.addStyleName("searchview"); //$NON-NLS-1$ searchView.addComponent(searchTextField); searchView.addComponent(searchButton); setCompositionRoot(searchView); }
public DownoadLink(File file){ super(); Properties prop = new Properties(); String fileServerURL = ""; try(InputStream is = getClass().getResourceAsStream("/settings.properties")) { prop.load(is); is.close(); fileServerURL = prop.getProperty("SERVER_URL") + ":" + prop.getProperty("PORT_SHIVA_FILESERVER"); } catch(IOException e) { e.printStackTrace(); } if(file != null) { ExternalResource downloadRes = new ExternalResource(fileServerURL + file.getAudioMp3UrlString()); setResource(downloadRes); setIcon(new ThemeResource("img/download.png")); } }
/** * Get the default {@link Renderer} for given <code>property</code>. * @param property Property * @return The default {@link Renderer}, if available */ protected Optional<Renderer<?>> getDefaultPropertyRenderer(P property) { Class<?> type = getPropertyColumnType(property); // Images if (type != null && (ExternalResource.class.isAssignableFrom(type) || ThemeResource.class.isAssignableFrom(type))) { return Optional.of(new ImageRenderer()); } if (type != null && FontIcon.class.isAssignableFrom(type)) { return Optional.of(new HtmlRenderer("")); } return Optional.empty(); }
/** * Construit le titre de l'application */ private void buildTitle() { OneClickButton itemBtn = new OneClickButton(appName, new ThemeResource("logo.png")); String demo = ""; if (demoMode!=null && Boolean.valueOf(demoMode)){ demo = " - Version Demo"; } itemBtn.setDescription(appVersion+demo); itemBtn.setPrimaryStyleName(ValoTheme.MENU_TITLE); itemBtn.addStyleName(ValoTheme.MENU_ITEM); itemBtn.addClickListener(e->getNavigator().navigateTo(AccueilView.NAME)); menu.addComponent(itemBtn); }
@SuppressWarnings("unchecked") public ComboBoxLangue(List<Langue> liste, Boolean libelle){ super(false); this.liste = liste; BeanItemContainer<Langue> container = new BeanItemContainer<Langue>(Langue.class, null); container.addNestedContainerProperty(ConstanteUtils.PROPERTY_FLAG); liste.forEach(e -> {container.addItem(e).getItemProperty(ConstanteUtils.PROPERTY_FLAG).setValue(new ThemeResource("images/flags/" + e.getCodLangue()+ ".png"));}); setContainerDataSource(container); // Sets the combobox to show a certain property as the item caption if (libelle){ setItemCaptionPropertyId(Langue_.libLangue.getName()); setItemCaptionMode(ItemCaptionMode.PROPERTY); }else{ setItemCaptionPropertyId(Langue_.codLangue.getName()); setItemCaptionMode(ItemCaptionMode.ICON_ONLY); } // Sets the icon to use with the items setItemIconPropertyId(ConstanteUtils.PROPERTY_FLAG); setImmediate(true); // Disallow null selections setNullSelectionAllowed(false); }
@Override public String convertToModel(ThemeResource value, Class<? extends String> targetType, Locale locale) throws ConversionException { if (value == null){ return null; } return value.getResourceId(); }
@Override public ThemeResource convertToPresentation(String value, Class<? extends ThemeResource> targetType, Locale locale) throws ConversionException { if (value == null){ return null; } return new ThemeResource("images/icon/Flag-"+value+"-icon.png"); }
private CssLayout buildMainMenu() { buildSubmenu(this.status, this.statusViews); buildSubmenu(this.setup, this.setupViews); buildSubmenu(this.options, this.manageViews); this.accordion.addTab(this.status, "Status", new ThemeResource("img/status_header.png")); this.accordion.addTab(this.setup, "Setup", new ThemeResource("img/setup_header.png")); this.accordion.addTab(this.options, "Manage", new ThemeResource("img/manage_header.png")); this.menu.addComponent(this.accordion); this.menu.addStyleName("menu"); this.menu.setHeight("100%"); return this.menu; }
@SuppressWarnings("serial") private HorizontalLayout createHeader(String title, final boolean isChildTable) { HorizontalLayout header = null; if (isChildTable) { header = ViewUtil.createSubHeader(title, getChildHelpGuid()); } else { header = ViewUtil.createSubHeader(title, getParentHelpGuid()); } Button refresh = new Button(); refresh.setStyleName(Reindeer.BUTTON_LINK); refresh.setDescription("Refresh"); refresh.setIcon(new ThemeResource("img/Refresh.png")); refresh.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (isChildTable) { populateChildTable(getParentItem()); } else { populateParentTable(); } } }); header.addComponent(refresh); return header; }
private HorizontalLayout createHeaderForSslList() { HorizontalLayout header = ViewUtil.createSubHeader("List of available certificates", null); Button refresh = new Button(); refresh.setStyleName(Reindeer.BUTTON_LINK); refresh.setDescription("Refresh"); refresh.setIcon(new ThemeResource("img/Refresh.png")); refresh.addClickListener((Button.ClickListener) event -> buildSslConfigurationTable()); header.addComponent(refresh); return header; }
/** * @param caption * Caption Text Representing Header * @param guid * Help GUID for caller view * @return * Horizontal Layout containing Caption text and Help button */ public static HorizontalLayout createSubHeader(String caption, String guid) { HorizontalLayout subHeader = new HorizontalLayout(); subHeader.setWidth("100%"); subHeader.setHeight("35px"); subHeader.setSpacing(true); subHeader.addStyleName("toolbar"); final Label title = new Label(caption); title.setSizeUndefined(); subHeader.addComponent(title); subHeader.setComponentAlignment(title, Alignment.MIDDLE_LEFT); subHeader.setExpandRatio(title, 1); // create help button if we have some GUID else do not add this button if (guid != null) { Button helpButton = new Button(); helpButton.setImmediate(true); helpButton.setStyleName(Reindeer.BUTTON_LINK); helpButton.setDescription("Help"); helpButton.setIcon(new ThemeResource("img/Help.png")); subHeader.addComponent(helpButton); helpButton.addClickListener(new HelpButtonListener(guid)); } return subHeader; }
@Override protected Optional<Renderer<?>> getDefaultPropertyRenderer(Property property) { if (Component.class.isAssignableFrom(property.getType())) { return Optional.of(new ComponentRenderer()); } if (FontIcon.class.isAssignableFrom(property.getType())) { return Optional.of(new HtmlRenderer("")); } if (ExternalResource.class.isAssignableFrom(property.getType()) || ThemeResource.class.isAssignableFrom(property.getType())) { return Optional.of(new ImageRenderer()); } return super.getDefaultPropertyRenderer(property); }
@PostConstruct void init() { VerticalLayout encabezado = new VerticalLayout(); encabezado.setSizeUndefined(); Image logo = new Image(null, new ThemeResource("img/Header2.jpg")); encabezado.addComponent(logo); encabezado.setComponentAlignment(logo, Alignment.TOP_LEFT); addComponent(encabezado); setComponentAlignment(encabezado, Alignment.TOP_LEFT); contenedor.setSpacing(true); contenedor.setSizeUndefined(); contenedor.setMargin(true); contenedor.addComponent(txtUsuario, 1, 1); contenedor.addComponent(txtPassword, 1, 2); errorIngreso.setVisible(false); contenedor.addComponent(errorIngreso, 1, 3); btnIngresar.setImmediate(true); btnIngresar.setClickShortcut(KeyCode.ENTER); btnIngresar.setIcon(FontAwesome.SIGN_IN); contenedor.addComponent(btnIngresar, 1, 4); contenedor.setComponentAlignment(btnIngresar, Alignment.BOTTOM_CENTER); addComponent(contenedor); setComponentAlignment(contenedor, Alignment.MIDDLE_CENTER); setListener(); }
public Resource get(boolean isImage, int imageSize) { if (!isImage) { if (++this.iconCount >= ICONS.size()) { this.iconCount = 0; } return ICONS.get(this.iconCount); } return new ThemeResource("../runo/icons/" + imageSize + "/document.png"); }
private static void populateWithRandomHierarchicalData() { final Random random = new Random(); int hours = 0; String basePath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath(); final Object[] allProjects = new Object[] {"All Projects", 0, new Date(), new ThemeResource("images/balloons.png")}; for (final int year : Arrays.asList(2010, 2011, 2012, 2013)) { int yearHours = 0; final Object[] yearId = new Object[] { "Year " + year, yearHours, new Date(), new ThemeResource(getResourceId(year))}; addChild(allProjects, yearId); for (int project = 1; project < random.nextInt(4) + 2; project++) { int projectHours = 0; final Object[] projectId = new Object[] { "Customer Project " + project, projectHours, new Date(), new ThemeResource(getResourceId(year))}; addChild(yearId, projectId); for (final String phase : Arrays.asList("Implementation", "Planning", "Prototype")) { final int phaseHours = random.nextInt(50); final Object[] phaseId = new Object[] { phase, phaseHours, new Date(), new ThemeResource(getResourceId(year))}; leaves.add(phaseId); addChild(projectId, phaseId); projectHours += phaseHours; projectId[1] = projectHours; } yearHours += projectHours; yearId[1] = yearHours; } hours += yearHours; allProjects[1] = hours; } rootNodes.add(allProjects); }
public Resource getIcon() { if (this.data instanceof PolicySetType) { return new ThemeResource("../runo/icons/16/folder.png"); } if (this.data instanceof RuleType) { if (((RuleType) this.data).getEffect() == null) { logger.warn("Rule has a null Effect"); return new ThemeResource("icons/deny-16.png"); } if (((RuleType) this.data).getEffect() == EffectType.DENY) { return new ThemeResource("icons/deny-16.png"); } return new ThemeResource("icons/permit-16.png"); } if (this.data instanceof PolicyType) { return new ThemeResource("../runo/icons/16/document-txt.png"); } if (this.data instanceof TargetType) { return new ThemeResource("icons/target-green-16.png"); } if (this.data instanceof ObligationExpressionType) { return new ThemeResource("icons/obligation-16.png"); } if (this.data instanceof AdviceExpressionType) { return new ThemeResource("icons/advice-16.png"); } if (this.data instanceof ConditionType) { return new ThemeResource("icons/condition-16.png"); } if (this.data instanceof VariableDefinitionType) { return new ThemeResource("icons/variable-16.png"); } return null; }
@Override public Object generateCell(Table source, Object itemId, Object columnId) { User user = (User) itemId; Image image = new Image(); image.addStyleName("users-menu-image"); if (user.getImage() != null) { StreamResource.StreamSource imagesource = new UserImageSource(user.getImage().toStream()); StreamResource resource = new StreamResource(imagesource, UUID.randomUUID().toString()); image.setSource(resource); } else { image.setSource(new ThemeResource("img/profile-pic-300px.jpg")); } ValoUserItemButton btnUsername = new ValoUserItemButton(user, ValoUserItemButton.TYPE.USER_NAME); ValoUserItemButton btnFullName = new ValoUserItemButton(user, ValoUserItemButton.TYPE.FULL_NAME); VerticalLayout nameLayout = new VerticalLayout(btnFullName, btnUsername); nameLayout.setSizeFull(); nameLayout.setComponentAlignment(btnFullName, Alignment.BOTTOM_LEFT); nameLayout.setComponentAlignment(btnUsername, Alignment.TOP_LEFT); HorizontalLayout usersHorizontalLayout = new HorizontalLayout(image, nameLayout); usersHorizontalLayout.setComponentAlignment(image, Alignment.MIDDLE_CENTER); usersHorizontalLayout.setComponentAlignment(nameLayout, Alignment.MIDDLE_LEFT); usersHorizontalLayout.setExpandRatio(nameLayout, 1f); usersHorizontalLayout.addStyleName("users-horizontal-layout"); usersHorizontalLayout.setWidth(100, Unit.PERCENTAGE); usersHorizontalLayout.setHeight(45, Unit.PIXELS); usersHorizontalLayout.setSpacing(true); return usersHorizontalLayout; }
public void setUserImage() { User user = HybridbpmUI.getUser(); settingsItem.setText(user.getUsername()); if (user.getImage() != null) { StreamResource.StreamSource imagesource = new UserImageSource(user.getImage().toStream()); StreamResource resource = new StreamResource(imagesource, UUID.randomUUID().toString()); userImage.setSource(resource); } else { userImage.setSource(new ThemeResource("img/profile-pic-300px.jpg")); } }
public void setUserImage() { User user = HybridbpmUI.getUser(); if (user.getImage() != null) { StreamResource.StreamSource imagesource = new UserImageSource(user.getImage().toStream()); StreamResource resource = new StreamResource(imagesource, UUID.randomUUID().toString()); userImage.setSource(resource); } else { userImage.setSource(new ThemeResource("img/profile-pic-300px.jpg")); } }
public void setUserImage() { User user = HybridbpmUI.getAccessAPI().getUserById(comment.getCreator()); if (user.getImage() != null) { StreamResource.StreamSource imagesource = new UserImageSource(user.getImage().toStream()); StreamResource resource = new StreamResource(imagesource, UUID.randomUUID().toString()); userImage.setSource(resource); } else { userImage.setSource(new ThemeResource("img/profile-pic-300px.jpg")); } senderUsername.setCaption("@" + user.getUsername()); senderName.setValue(user.getFullName()); }
private static Resource getImage(final boolean gravatar) { if (!gravatar) { return new ThemeResource("images/profile-pic-57px.jpg"); } return UserDetailsFormatter.getCurrentUserEmail().map(email -> (Resource) new GravatarResource(email)) .orElse(new ThemeResource("images/profile-pic-57px.jpg")); }