@Override public void enter(ViewChangeEvent event) { pageHelper.setErrorHandler(this); this.removeAllComponents(); // Get application int appId = Integer.parseInt(event.getParameters()); Application app = pageHelper.getApp(appId); // Header this.addComponent(new PageHeader(app, "Endpoints")); // Add endpoints links app.endpoints().asList().stream() .forEach(endpointUrl -> this.addComponent(new Link(endpointUrl+".json", new ExternalResource(endpointUrl+".json"), "_blank", 0, 0, BorderStyle.DEFAULT))); }
@Test public void test() { ExternalResource resource = new ExternalResource("http://www.google.com"); FLink link = new FLink().withCaption("My link") .withResource(resource) .withTargetBorder(BorderStyle.MINIMAL) .withTargetHeight(500) .withTargetWidth(500) .withTargetName("_blank"); assertEquals("My link", link.getCaption()); assertEquals(resource, link.getResource()); assertEquals(BorderStyle.MINIMAL, link.getTargetBorder()); assertEquals(500, link.getTargetHeight()); assertEquals(500, link.getTargetWidth()); assertEquals("_blank", link.getTargetName()); }
@Test public void testAudio() { final Resource audioResource = new ExternalResource( "http://mirrors.creativecommons.org/ccmixter/contrib/Wired/The%20Rapture%20-%20Sister%20Saviour%20(Blackstrobe%20Remix).mp3"); FAudio audio = new FAudio().withAltText("alt") .withAutoplay(true) .withCaption("My audio") .withHtmlContentAllowed(true) .withMuted(true) .withLoop(true) .withPreload(PreloadMode.METADATA) .withSource(audioResource) .withShowControls(true); assertEquals("alt", audio.getAltText()); assertEquals("My audio", audio.getCaption()); assertTrue(audio.isAutoplay()); assertTrue(audio.isHtmlContentAllowed()); assertTrue(audio.isShowControls()); assertTrue(audio.isLoop()); assertTrue(audio.isMuted()); assertEquals(PreloadMode.METADATA, audio.getPreload()); assertEquals(audioResource, audio.getSources().get(0)); }
private Component buildMovieDetails(final Movie movie, final Date startTime, final Date endTime) { HorizontalLayout details = new HorizontalLayout(); details.setWidth(100.0f, Unit.PERCENTAGE); details.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); details.setMargin(true); details.setSpacing(true); final Image coverImage = new Image(null, new ExternalResource( movie.getThumbUrl())); coverImage.addStyleName("cover"); details.addComponent(coverImage); Component detailsForm = buildDetailsForm(movie, startTime, endTime); details.addComponent(detailsForm); details.setExpandRatio(detailsForm, 1); return details; }
public SourceView() { Label caption = new Label("Sources"); caption.addStyleName(DSTheme.LABEL_HUGE); addComponents(caption); List<Link> linkList = new ArrayList<Link>(); Link aidedd = new Link("AideDD", new ExternalResource("http://www.aidedd.org/")); linkList.add(aidedd); Link gemmaline = new Link("Gemmaline", new ExternalResource("http://www.gemmaline.com/faerun/")); linkList.add(gemmaline); Link frwiki = new Link("Wiki des royaumes oubliés", new ExternalResource("https://fr.wikipedia.org/wiki/Portail:Royaumes_oubli%C3%A9s")); linkList.add(frwiki); for (Link link : linkList) { link.setTargetName("_blank"); addComponent(link); } }
public WebNewWindowButton() { component = new CubaButton(); component.addStyleName(NEW_WINDOW_BUTTON_STYLENAME); component.setDescription(null); URL pageUrl; try { pageUrl = Page.getCurrent().getLocation().toURL(); } catch (MalformedURLException ignored) { LoggerFactory.getLogger(WebNewWindowButton.class).warn("Couldn't get URL of current Page"); return; } ExternalResource currentPage = new ExternalResource(pageUrl); final BrowserWindowOpener opener = new BrowserWindowOpener(currentPage); opener.setWindowName("_blank"); opener.extend(component); }
public MenuView() { setMargin(true); setSpacing(true); Label header = new Label("GridStack Vaadin add-on"); header.addStyleName(ValoTheme.LABEL_H1); addComponent(header); addComponents( createNavigation(SimpleView.class, SimpleView.VIEW_NAME, "Simple example"), createNavigation(TestView.class, TestView.VIEW_NAME, "Test it"), createNavigation(SplitView.class, SplitView.VIEW_NAME, "List demo") ); addComponent(new Link( "GridStack Vaadin add-on project page on GitHub", new ExternalResource("https://github.com/alump/GridStack"))); addComponent(new Link( "This project is based on gridstack.js JavaScript library, written by Pavel Reznikov", new ExternalResource("https://github.com/troolee/gridstack.js"))); }
/** * Shows QR Code dialog. * @param qrCodeUrl the QR code URL */ public static void showGrCodeDialog(final String qrCodeUrl) { final Window subWindow = new Window(Site.getCurrent().localize("header-scan-qr-code-with-google-authenticator")); subWindow.setModal(true); final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); final Image qrCodeImage = new Image(null, new ExternalResource(qrCodeUrl)); verticalLayout.addComponent(qrCodeImage); verticalLayout.setComponentAlignment(qrCodeImage, Alignment.MIDDLE_CENTER); subWindow.setContent(verticalLayout); subWindow.setResizable(false); subWindow.setWidth(230, Sizeable.Unit.PIXELS); subWindow.setHeight(260, Sizeable.Unit.PIXELS); subWindow.center(); UI.getCurrent().addWindow(subWindow); }
public AboutWindow() { MHorizontalLayout content = new MHorizontalLayout().withMargin(true).withFullWidth(); this.setContent(content); Image about = new Image("", new ExternalResource(StorageUtils.generateAssetRelativeLink(WebResourceIds._about))); MVerticalLayout rightPanel = new MVerticalLayout(); ELabel versionLbl = ELabel.h2(String.format("MyCollab Community Edition %s", Version.getVersion())); Label javaNameLbl = new Label(String.format("%s, %s", System.getProperty("java.vm.name"), System.getProperty("java.runtime.version"))); Label homeFolderLbl = new Label("Home folder: " + FileUtils.getHomeFolder().getAbsolutePath()); WebBrowser browser = Page.getCurrent().getWebBrowser(); Label osLbl = new Label(String.format("%s, %s", System.getProperty("os.name"), browser.getBrowserApplication())); osLbl.addStyleName(UIConstants.LABEL_WORD_WRAP); Div licenseDiv = new Div().appendChild(new Text("Powered by: ")) .appendChild(new A("https://www.mycollab.com") .appendText("MyCollab")).appendChild(new Text(". Open source under GPL license")); Label licenseLbl = ELabel.html(licenseDiv.write()); Label copyRightLbl = ELabel.html(String.format("© %s - %s MyCollab Ltd. All rights reserved", "2011", new GregorianCalendar().get(Calendar.YEAR) + "")); rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl) .withAlign(copyRightLbl, Alignment.BOTTOM_LEFT); content.with(about, rightPanel).expand(rightPanel); }
public static Component projectLogoComp(String projectShortname, Integer projectId, String projectAvatarId, int size) { AbstractComponent wrapper; if (!StringUtils.isBlank(projectAvatarId)) { wrapper = new Image(null, new ExternalResource(StorageUtils.getResourcePath (String.format("%s/%s_%d.png", PathUtils.getProjectLogoPath(AppUI.getAccountId(), projectId), projectAvatarId, size)))); } else { ELabel projectIcon = new ELabel(projectShortname).withStyleName(UIConstants.TEXT_ELLIPSIS, ValoTheme.LABEL_LARGE, "center"); projectIcon.setWidth(size, Sizeable.Unit.PIXELS); projectIcon.setHeight(size, Sizeable.Unit.PIXELS); wrapper = new VerticalLayout(); ((VerticalLayout) wrapper).addComponent(projectIcon); ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER); } wrapper.setWidth(size, Sizeable.Unit.PIXELS); wrapper.setHeight(size, Sizeable.Unit.PIXELS); wrapper.addStyleName(UIConstants.CIRCLE_BOX); wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE)); return wrapper; }
public static Component clientLogoComp(SimpleAccount account, int size) { AbstractComponent wrapper; if (!StringUtils.isBlank(account.getAvatarid())) { wrapper = new Image(null, new ExternalResource(StorageUtils.getEntityLogoPath(AppUI.getAccountId(), account.getAvatarid(), 100))); } else { String accountName = account.getAccountname(); accountName = (accountName.length() > 3) ? accountName.substring(0, 3) : accountName; ELabel projectIcon = new ELabel(accountName).withStyleName(UIConstants.TEXT_ELLIPSIS, "center"); wrapper = new VerticalLayout(); ((VerticalLayout) wrapper).addComponent(projectIcon); ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER); } wrapper.setWidth(size, Sizeable.Unit.PIXELS); wrapper.setHeight(size, Sizeable.Unit.PIXELS); wrapper.addStyleName(UIConstants.CIRCLE_BOX); wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE)); return wrapper; }
public AccountModuleImpl() { addStyleName("module"); ControllerRegistry.addController(new UserAccountController(this)); MHorizontalLayout topPanel = new MHorizontalLayout().withFullWidth().withMargin(true).withStyleName("border-bottom"); AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class); MButton helpBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_HELP)) .withIcon(FontAwesome.MORTAR_BOARD).withStyleName(WebThemes.BUTTON_LINK); ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/docs/account-management/"); BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes); helpOpener.extend(helpBtn); topPanel.with(breadcrumb, helpBtn).withAlign(helpBtn, Alignment.TOP_RIGHT); tabSheet = new VerticalTabsheet(); tabSheet.setSizeFull(); tabSheet.setNavigatorStyleName("sidebar-menu"); tabSheet.addToggleNavigatorControl(); VerticalLayout contentWrapper = tabSheet.getContentWrapper(); contentWrapper.addStyleName("main-content"); contentWrapper.addComponentAsFirst(topPanel); this.buildComponents(); this.setContent(tabSheet); }
private void buildComponents() { activityTabs.addTab(constructCalendarView(), "calendar", UserUIContext.getMessage(ActivityI18nEnum.TAB_CALENDAR_TITLE), new ExternalResource(StorageUtils.generateAssetRelativeLink("icons/22/crm/calendar.png"))); activityTabs.addTab(constructActivityListView(), "activities", UserUIContext.getMessage(ActivityI18nEnum.TAB_ACTIVITY_TITLE), new ExternalResource(StorageUtils.generateAssetRelativeLink("icons/22/crm/activitylist.png"))); activityTabs.addSelectedTabChangeListener(selectedTabChangeEvent -> { Tab tab = ((VerticalTabsheet) selectedTabChangeEvent.getSource()).getSelectedTab(); String caption = tab.getCaption(); if (UserUIContext.getMessage(ActivityI18nEnum.TAB_CALENDAR_TITLE).equals(caption)) { calendarPresenter.go(ActivityRootView.this, new ActivityScreenData.GotoCalendar()); } else if (UserUIContext.getMessage(ActivityI18nEnum.TAB_ACTIVITY_TITLE).equals(caption)) { ActivitySearchCriteria criteria = new ActivitySearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppUI.getAccountId())); eventPresenter.go(ActivityRootView.this, new ActivityScreenData.GotoActivityList(criteria)); } }); }
public static Component accountLogoComp(SimpleAccount account, int size) { AbstractComponent wrapper; if (!StringUtils.isBlank(account.getAvatarid())) { wrapper = new Image(null, new ExternalResource(StorageUtils.getEntityLogoPath(AppUI .getAccountId(), account.getAvatarid(), 100))); } else { String accountName = account.getAccountname(); accountName = (accountName.length() > 3) ? accountName.substring(0, 3) : accountName; ELabel accountIcon = new ELabel(accountName).withStyleName(UIConstants.TEXT_ELLIPSIS, "center"); accountIcon.setWidth(size, Sizeable.Unit.PIXELS); accountIcon.setHeight(size, Sizeable.Unit.PIXELS); wrapper = new VerticalLayout(); ((VerticalLayout) wrapper).addComponent(accountIcon); ((VerticalLayout) wrapper).setComponentAlignment(accountIcon, Alignment.MIDDLE_CENTER); } wrapper.setWidth(size, Sizeable.Unit.PIXELS); wrapper.setHeight(size, Sizeable.Unit.PIXELS); wrapper.addStyleName(UIConstants.CIRCLE_BOX); wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE)); return wrapper; }
@Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout); ActiveLink link = new ActiveLink("Click Me", new ExternalResource( "http://blog.porotype.com")); link.addListener(new LinkActivatedListener() { @Override public void linkActivated(LinkActivatedEvent event) { MouseEventDetails d = event.getMouseEventDetails(); String caption = "Link " + d.getButtonName() + "-clicked"; String msg = "Ctrl: " + d.isCtrlKey() + " Shift: " + d.isShiftKey() + " Alt: " + d.isAltKey() + " Meta: " + d.isMetaKey(); Notification.show(caption, msg, Type.WARNING_MESSAGE); System.err.println(caption + " " + msg); } }); layout.addComponent(link); }
public MenuView() { setWidth(100, Unit.PERCENTAGE); setMargin(true); setSpacing(true); Label header = new Label("ScaleImage Vaadin Add-on"); header.setWidth(100, Unit.PERCENTAGE); header.addStyleName(ValoTheme.LABEL_H1); addComponent(header); Button adjust = new Button("Java API Background Adjust", e -> { navigator.navigateTo(AdjustView.VIEW_NAME); }); addComponent(adjust); Button test = new Button("Test UI", e -> { navigator.navigateTo(TestView.VIEW_NAME); }); addComponent(test); Link link = new Link("Project's GitHub page", new ExternalResource("https://github.com/alump/ScaleImage")); addComponent(link); }
public IFramePortal(Tblportal portal, DashBoardController dashBoard, PortalConfigDelgate configDelegate) { super(portal, dashBoard, configDelegate); iFrame.setSizeFull(); String url = getConfigDelegate().getValueString(portal, "url"); if (StringUtils.isNotEmpty(url)) { iFrame.setSource(new ExternalResource(url)); } else { iFrame.setSource(new ExternalResource("http://www.bom.gov.au/products/IDR023.loop.shtml#skip")); } iFrame.setSizeFull(); addComponent(iFrame); setExpandRatio(iFrame, 1.0f); setSizeFull(); }
private void createEmailButton(String buttonHeight, HorizontalLayout buttonContainer) { emailButton = new NativeButton(); emailButton.setIcon(new ExternalResource("images/seanau/Send Email_32.png")); emailButton.setDescription("Email"); emailButton.setWidth("50"); emailButton.setHeight(buttonHeight); emailButton.addClickListener(new ClickEventLogged.ClickListener() { private static final long serialVersionUID = 7207441556779172217L; @Override public void clicked(ClickEvent event) { new JasperReportEmailWindow(reportProperties, builder.getReportParameters()); } }); buttonContainer.addComponent(emailButton); }
public SourceView(Example example){ super(example.getName()+" Source"); currentExample = example; VerticalLayout layout = new VerticalLayout(); layout.setSpacing(false); List<String> sources = example.getSources(); for(String source : sources){ Link link = new Link(source,new ExternalResource("https://github.com/nelsond6/vaadan-playground/blob/master/"+source)); link.setTargetName("_blank"); layout.addComponent(link); } Label expandingLabel = new Label(""); expandingLabel.setHeight("100%"); layout.addComponent(expandingLabel); layout.setExpandRatio(expandingLabel, 1.0f); setContent(layout); setPositionX(100); setPositionY(100); }
@Override protected void init(VaadinRequest request) { layout.setMargin(true); layout.setSpacing(true); setContent(layout); addTwitterButton(); addFacebookButton(); addLinkedInButton(); addGitHubButton(); addTwitterNativeButton(); layout.addComponent(new Link("Add-on at Vaadin Directory", new ExternalResource("http://vaadin.com/addon/oauth-popup-add-on"))); layout.addComponent(new Link("Source code at GitHub", new ExternalResource("https://github.com/ahn/vaadin-oauthpopup"))); }
private void drawPush(final UserProfile profile) { final String remote = remoteName(profile); String url = githubLinkFromOrigin(repo.getRemote(remote)); layout.addComponent(new Link(url, new ExternalResource(url))); Button b = new Button("Push to GitHub"); b.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { gitPush(profile.getToken().getToken(), remote); } catch (GitAPIException e) { Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE); e.printStackTrace(); } } }); layout.addComponent(b); }
private void startJetty() { File pomXml = project.getPomXmlFile(); String target = MavenUtil.targetDirFor(user); port = JettyUtil.runJetty(pomXml, contextPath, target, logView); startButton.setEnabled(false); stopButton.setEnabled(true); statusLabel.setValue("Running"); String uri = getServer() + ":" + port + contextPath + "/"; link.setResource(new ExternalResource(uri)); link.setVisible(true); qrCode.setValue(uri); qrCode.setVisible(true); }
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 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 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 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")); } }
public static void main(String[] args) { HorizontalLayout horizontalLayout = horizontalLayout() .with(margin().left().right()) .spacingEnabled() .sizeFull() .styleName("container") .addComponent(expandRatio(2.0f), verticalLayout() .marginEnabled() .addComponent(Alignment.TOP_LEFT, button("Click me"))) .addComponent(link().resource(new ExternalResource("google.com"))) .addComponent(textField("Name") .inputPrompt("Your name") .nullRepresentation("") .maxLength(20) .value("")) .addComponent(textField("Disabled input").disabled()) .build(); }
/** * 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(); }
/** * @param caption * @param bwo * @param icon * @return un bouton pour l'assistance */ private OneClickButton getButton(String caption, String bwo, com.vaadin.server.Resource icon){ BrowserWindowOpener browser = new BrowserWindowOpener(new ExternalResource(bwo)); OneClickButton btn = new OneClickButton(caption, icon); btn.addStyleName(ValoTheme.BUTTON_LINK); browser.extend(btn); return btn; }
private Button getDownloadSdkButtonForSdnController() throws URISyntaxException, MalformedURLException { SdkUtil sdkUtil = new SdkUtil(); Button downloadSdk = new Button(VmidcMessages.getString(VmidcMessages_.MAINTENANCE_SDNPLUGIN_DOWNLOAD_SDK)); URI currentLocation = UI.getCurrent().getPage().getLocation(); URI downloadLocation = new URI(currentLocation.getScheme(), null, currentLocation.getHost(), currentLocation.getPort(), sdkUtil.getSdk(SdkUtil.sdkType.SDN_CONTROLLER), null, null); FileDownloader downloader = new FileDownloader(new ExternalResource(downloadLocation.toURL().toString())); downloader.extend(downloadSdk); return downloadSdk; }
private Button getDownloadSdkButtonForManager() throws URISyntaxException, MalformedURLException { SdkUtil sdkUtil = new SdkUtil(); Button downloadSdk = new Button(VmidcMessages.getString(VmidcMessages_.MAINTENANCE_MANAGERPLUGIN_DOWNLOAD_SDK)); URI currentLocation = UI.getCurrent().getPage().getLocation(); URI downloadLocation = new URI(currentLocation.getScheme(), null, currentLocation.getHost(), currentLocation.getPort(), sdkUtil.getSdk(SdkUtil.sdkType.MANAGER), null, null); FileDownloader downloader = new FileDownloader(new ExternalResource(downloadLocation.toURL().toString())); downloader.extend(downloadSdk); return downloadSdk; }
public static Object generateMgrLink(String caption, String url) { Link mgrLink = new Link(); mgrLink.setCaption(caption); mgrLink.setResource(new ExternalResource(url)); mgrLink.setDescription("Click to go to application"); mgrLink.setTargetName("_blank"); return mgrLink; }
private static Link createInternalLink(String fragment, HashMap<String, Object> paramMap, String linkCaption, String linkDescription, ServerApi server) { String jobLinkUrl = createInternalUrl(fragment, paramMap, server); if (jobLinkUrl == null) { return null; } Link jobLink = new Link(); jobLink.setCaption(linkCaption); jobLink.setDescription(linkDescription); jobLink.setResource(new ExternalResource(jobLinkUrl)); return jobLink; }
@Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.setSpacing(true); setContent(layout); Label header = new Label(MaterialIcons.SENTIMENT_SATISFIED.getHtml() + " Material Icons Vaadin add-on"); header.addStyleName(ValoTheme.LABEL_H1); header.setContentMode(ContentMode.HTML); Label description = new Label( "This add-on brings Material Design Icons by Google to your Vaadin application"); Panel panel = new Panel(createButtons()); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setSizeFull(); HorizontalLayout links = new HorizontalLayout(); links.setWidth(100, Unit.PERCENTAGE); Link link = new Link("Browse Icons (material.io/icons)", new ExternalResource("https://material.io/icons/")); link.setIcon(MaterialIcons.LINK); Link link2 = new Link("Vaadin add-on project GitHub page (source code, issues, ...)", new ExternalResource("https://github.com/alump/materialicons/")); link2.setIcon(MaterialIcons.CODE); links.addComponents(link, link2); layout.addComponents(header, description, panel, links); layout.setExpandRatio(panel, 1f); }
private Layout getFooter() { Layout footer = new HorizontalLayout(); footer.addComponent(new Label("Persephone v"+persephoneVersion)); footer.addComponent(new Link("Created by Vianney FAIVRE", new ExternalResource("https://vianneyfaiv.re"), "_blank", 0, 0, BorderStyle.DEFAULT)); footer.addComponent(new Link("GitHub", new ExternalResource("https://github.com/vianneyfaivre/Persephone"), "_blank", 0, 0, BorderStyle.DEFAULT)); footer.setHeight(20, Unit.PIXELS); footer.setStyleName("persephone-footer"); return footer; }
@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); }
@Test public void testVideo() { final Resource mp4Resource = new ExternalResource("https://s3.amazonaws.com/videos.vaadin.com/vaadin_fin_web002.mp4"); final Resource ogvResource = new ExternalResource("https://s3.amazonaws.com/videos.vaadin.com/vaadin_fin_web002.ogv"); FVideo video = new FVideo().withAltText("alt") .withAutoplay(false) .withCaption("My video") .withHtmlContentAllowed(false) .withMuted(false) .withLoop(false) .withPreload(PreloadMode.METADATA) .withSources(mp4Resource, ogvResource) .withShowControls(true) .withPoster(VaadinIcons.POWER_OFF); assertEquals("alt", video.getAltText()); assertEquals("My video", video.getCaption()); assertFalse(video.isAutoplay()); assertFalse(video.isHtmlContentAllowed()); assertTrue(video.isShowControls()); assertFalse(video.isLoop()); assertFalse(video.isMuted()); assertEquals(PreloadMode.METADATA, video.getPreload()); assertTrue(video.getSources().contains(mp4Resource)); assertTrue(video.getSources().contains(ogvResource)); assertEquals(VaadinIcons.POWER_OFF, video.getPoster()); }
private Component buildCatalogView() { CssLayout catalog = new CssLayout(); catalog.setCaption("Catalog"); catalog.addStyleName("catalog"); for (final Movie movie : DashboardUI.getDataProvider().getMovies()) { VerticalLayout frame = new VerticalLayout(); frame.addStyleName("frame"); frame.setWidthUndefined(); Image poster = new Image(null, new ExternalResource( movie.getThumbUrl())); poster.setWidth(100.0f, Unit.PIXELS); poster.setHeight(145.0f, Unit.PIXELS); frame.addComponent(poster); Label titleLabel = new Label(movie.getTitle()); titleLabel.setWidth(120.0f, Unit.PIXELS); frame.addComponent(titleLabel); frame.addLayoutClickListener(new LayoutClickListener() { @Override public void layoutClick(final LayoutClickEvent event) { if (event.getButton() == MouseButton.LEFT) { MovieDetailsWindow.open(movie, null, null); } } }); catalog.addComponent(frame); } return catalog; }