List of usage examples for com.vaadin.ui Link setIcon
@Override public void setIcon(Resource icon)
From source file:fr.amapj.view.engine.excelgenerator.TelechargerPopup.java
License:Open Source License
private void addLink(VerticalLayout contentLayout, FileInfoDTO fileInfoDTO) { String titre = fileInfoDTO.nameToDisplay; String fileName = fileInfoDTO.fileName; String extension = fileInfoDTO.extension; StreamResource streamResource = new StreamResource(new CoreResource(fileInfoDTO.generator), fileName + "." + extension); streamResource.setCacheTime(1000);/*from ww w.j a v a2 s . c om*/ Link extractFile = new Link(titre, streamResource); extractFile.setIcon(FontAwesome.DOWNLOAD); extractFile.setTargetName("_blank"); contentLayout.addComponent(extractFile); }
From source file:fr.amapj.view.views.advanced.devtools.PopupAttachementDisplay.java
License:Open Source License
public Link createLink(int pieceNumber, ByteArrayInputStream bais, String fileName) { StreamResource streamResource = new StreamResource(() -> bais, fileName); streamResource.setCacheTime(1000);//from www.j ava 2 s .c om Link extractFile = new Link("Pice " + pieceNumber + " - " + fileName, streamResource); extractFile.setIcon(FontAwesome.DOWNLOAD); extractFile.setTargetName("_blank"); return extractFile; }
From source file:fr.amapj.view.views.advanced.devtools.PopupHtmlToPdf.java
License:Open Source License
private void addFieldSaisie() { setStepTitle("Conversion"); tf = new TextArea("Contenu html"); tf.setWidth("90%"); tf.setHeight(10, Unit.CM);//from w w w .j av a 2 s .c o m tf.setImmediate(true); form.addComponent(tf); StreamResource streamResource = new StreamResource(new PdfResource(tf), "test.pdf"); streamResource.setCacheTime(1000); Link extractFile = new Link("Tlcharger le pdf", streamResource); extractFile.setIcon(FontAwesome.DOWNLOAD); extractFile.setTargetName("_blank"); form.addComponent(extractFile); }
From source file:jp.primecloud.auto.ui.TopBar.java
License:Open Source License
@Override public void attach() { addStyleName("TopBar"); setWidth("100%"); setHeight("30px"); setMargin(false, true, false, false); // PrimeCloud Label plbl = new Label(IconUtils.createImageTag(getApplication(), Icons.PCCLOGO), Label.CONTENT_XHTML); plbl.addStyleName("logo"); addComponent(plbl);/*w ww. ja va 2s. co m*/ // ?? String versionProp = Config.getVersionProperty("version"); if (StringUtils.isNotEmpty(versionProp)) { StringBuilder version = new StringBuilder(); version.append("ver").append(versionProp); Label versionNo = new Label("<p>" + version.toString() + "</p>", Label.CONTENT_XHTML); versionNo.addStyleName("versionNo"); addComponent(versionNo); } else { Label versionNo = new Label("<p></p>", Label.CONTENT_XHTML); versionNo.addStyleName("versionNoNone"); addComponent(versionNo); } // myCloud? Button myCloudButton = new Button(ViewProperties.getCaption("button.myCloudManage")); myCloudButton.setDescription(ViewProperties.getCaption("description.myCloudManage")); myCloudButton.addStyleName("borderless"); myCloudButton.addStyleName("mycloud"); myCloudButton.setIcon(Icons.CLOUDBIG.resource()); myCloudButton.setVisible(true); myCloudButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { showCloudEditWindow(); } }); addComponent(myCloudButton); // (Zabbix) String useZabbix = Config.getProperty("zabbix.useZabbix"); if (useZabbix == null || BooleanUtils.toBoolean(useZabbix)) { String url = Config.getProperty("zabbix.display"); Link zabbix = new Link(ViewProperties.getCaption("link.zabbix"), new ExternalResource(url)); zabbix.setDescription(ViewProperties.getCaption("description.link.zabbix")); zabbix.setIcon(Icons.MNGSYSTEM.resource()); zabbix.setTargetName("_blank"); zabbix.addStyleName("zabbix"); addComponent(zabbix); } // Button eventLogButton = new Button(ViewProperties.getCaption("link.eventlog")); eventLogButton.setDescription(ViewProperties.getCaption("description.link.eventlog")); eventLogButton.addStyleName("borderless"); eventLogButton.addStyleName("eventlog"); eventLogButton.setIcon(Icons.CUSTOM.resource()); eventLogButton.setVisible(true); eventLogButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { WinLogView window = new WinLogView(); getApplication().addWindow(window); getApplication().getMainWindow().open(new ExternalResource(window.getURL()), "_blank"); } }); addComponent(eventLogButton); // Boolean usePayment = BooleanUtils.toBooleanObject(Config.getProperty("payment.usePayment")); if (BooleanUtils.isTrue(usePayment)) { String url2 = Config.getProperty("payment.display"); Link payment = new Link(ViewProperties.getCaption("link.payment"), new ExternalResource(url2)); payment.setDescription(ViewProperties.getCaption("description.link.payment")); payment.setIcon(Icons.PAYSYSTEM.resource()); payment.setTargetName("_payment"); payment.addStyleName("payment"); addComponent(payment); } // Button logoutButton = new Button(ViewProperties.getCaption("button.logout")); logoutButton.setDescription(ViewProperties.getCaption("description.logout")); logoutButton.addStyleName("borderless"); logoutButton.addStyleName("logout"); logoutButton.setIcon(Icons.LOGOUT.resource()); logoutButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.dialogConfirm"), ViewMessages.getMessage("IUI-000001"), Buttons.OKCancel); Callback callback = new Callback() { @Override public void onDialogResult(Result result) { if (result == Result.OK) { // ? LoggingUtils.removeContext(); ContextUtils.invalidateSession(); accountButton.setVisible(false); // ???? getApplication().close(); } } }; dialog.setCallback(callback); getApplication().getMainWindow().addWindow(dialog); } }); addComponent(logoutButton); // ? accountButton = new Button(ViewProperties.getCaption("button.account")); accountButton.setDescription(ViewProperties.getCaption("description.account")); accountButton.addStyleName("borderless"); accountButton.addStyleName("account"); accountButton.setIcon(Icons.USER.resource()); accountButton.setVisible(false); addComponent(accountButton); }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getButtonPreviews() { Layout grid = getPreviewLayout("Buttons"); Button button = new Button("Button"); grid.addComponent(button);// w w w. jav a 2s . co m button = new Button("Default"); button.setStyleName("default"); grid.addComponent(button); button = new Button("Small"); button.setStyleName("small"); grid.addComponent(button); button = new Button("Small Default"); button.setStyleName("small default"); grid.addComponent(button); button = new Button("Big"); button.setStyleName("big"); grid.addComponent(button); button = new Button("Big Default"); button.setStyleName("big default"); grid.addComponent(button); button = new Button("Disabled"); button.setEnabled(false); grid.addComponent(button); button = new Button("Disabled default"); button.setEnabled(false); button.setStyleName("default"); grid.addComponent(button); button = new Button("Link style"); button.setStyleName(BaseTheme.BUTTON_LINK); grid.addComponent(button); button = new Button("Disabled link"); button.setStyleName(BaseTheme.BUTTON_LINK); button.setEnabled(false); grid.addComponent(button); button = new Button("120px overflows out of the button"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); button.setWidth("120px"); grid.addComponent(button); button = new Button("Small"); button.setStyleName("small"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big"); button.setStyleName("big"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big Default"); button.setStyleName("big default"); button.setIcon(new ThemeResource("../runo/icons/32/document-txt.png")); grid.addComponent(button); button = new Button("Big link"); button.setStyleName(BaseTheme.BUTTON_LINK + " big"); button.setIcon(new ThemeResource("../runo/icons/32/document.png")); grid.addComponent(button); button = new Button("Borderless"); button.setStyleName("borderless"); button.setIcon(new ThemeResource("../runo/icons/32/note.png")); grid.addComponent(button); button = new Button("Borderless icon on top"); button.setStyleName("borderless icon-on-top"); button.setIcon(new ThemeResource("../runo/icons/32/note.png")); grid.addComponent(button); button = new Button("Icon on top"); button.setStyleName("icon-on-top"); button.setIcon(new ThemeResource("../runo/icons/32/users.png")); grid.addComponent(button); button = new Button("Wide Default"); button.setStyleName("wide default"); grid.addComponent(button); button = new Button("Wide"); button.setStyleName("wide"); grid.addComponent(button); button = new Button("Tall"); button.setStyleName("tall"); grid.addComponent(button); button = new Button("Wide, Tall & Big"); button.setStyleName("wide tall big"); grid.addComponent(button); button = new Button("Icon on right"); button.setStyleName("icon-on-right"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big icon"); button.setStyleName("icon-on-right big"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Toggle (down)"); button.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (event.getButton().getStyleName().endsWith("down")) { event.getButton().removeStyleName("down"); } else { event.getButton().addStyleName("down"); } } }); button.addStyleName("down"); grid.addComponent(button); button.setDescription( button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>"); button = new Button(); button.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (event.getButton().getStyleName().endsWith("down")) { event.getButton().removeStyleName("down"); } else { event.getButton().addStyleName("down"); } } }); button.addStyleName("icon-only"); button.addStyleName("down"); button.setIcon(new ThemeResource("../runo/icons/16/user.png")); grid.addComponent(button); button.setDescription( button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>"); Link l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com")); grid.addComponent(l); l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com")); l.setIcon(new ThemeResource("../runo/icons/32/globe.png")); grid.addComponent(l); return grid; }
From source file:org.activiti.explorer.ui.content.file.ImageAttachmentRenderer.java
License:Apache License
@Override public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeUndefined();//from ww w .j av a 2s.c o m verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description); // Image TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); String mimeType = extractMineType(attachment.getType()); InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()), mimeType, 900, 550); Resource resource = new StreamResource(new InputStreamStreamSource(imageStream), attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get()); Embedded image = new Embedded(null, resource); verticalLayout.addComponent(image); // Linke HorizontalLayout LinkLayout = new HorizontalLayout(); LinkLayout.setSpacing(true); verticalLayout.addComponent(LinkLayout); verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER); Label fullSizeLabel = new Label( ExplorerApp.get().getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE)); LinkLayout.addComponent(fullSizeLabel); Link link = null; if (attachment.getUrl() != null) { link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); } else { taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); Resource res = new StreamResource( new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())), attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get()); link = new Link(attachment.getName(), res); } link.setIcon(Images.RELATED_CONTENT_PICTURE); link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); LinkLayout.addComponent(link); return verticalLayout; }
From source file:org.activiti.explorer.ui.custom.SkypeLabel.java
License:Apache License
/** * Constructs a {@link SkypeLabel} based on the given Skype id *//*from w w w . j a va2 s . c o m*/ public SkypeLabel(String skypeId) { CssLayout layout = new CssLayout(); setCompositionRoot(layout); Label label = new Label( "<script type='text/javascript' src='http://download.skype.com/share/skypebuttons/js/skypeCheck.js'></script>", Label.CONTENT_XHTML); layout.addComponent(label); Link link = new Link(null, new ExternalResource("skype:" + skypeId + "?call")); link.setIcon(Images.SKYPE); layout.addComponent(link); setWidth(16, UNITS_PIXELS); setHeight(16, UNITS_PIXELS); }
From source file:org.eclipse.hawkbit.ui.components.SPUIComponentProvider.java
License:Open Source License
/** * Method to create a link./*from w ww . j a v a 2 s. com*/ * * @param id * of the link * @param name * of the link * @param resource * path of the link * @param icon * of the link * @param targetOpen * specify how the link should be open (f. e. new windows = * _blank) * @param style * chosen style of the link. Might be {@code null} if no style * should be used * @return a link UI component */ public static Link getLink(final String id, final String name, final String resource, final FontAwesome icon, final String targetOpen, final String style) { final Link link = new Link(name, new ExternalResource(resource)); link.setId(id); link.setIcon(icon); link.setDescription(name); link.setTargetName(targetOpen); if (style != null) { link.setStyleName(style); } return link; }
From source file:org.eclipse.hawkbit.ui.components.SPUIComponentProvider.java
License:Open Source License
/** * Generates help/documentation links from within management UI. * * @param i18n/*from w ww. jav a2 s .co m*/ * the i18n * @param uri * to documentation site * * @return generated link */ public static Link getHelpLink(final VaadinMessageSource i18n, final String uri) { final Link link = new Link("", new ExternalResource(uri)); link.setTargetName("_blank"); link.setIcon(FontAwesome.QUESTION_CIRCLE); link.setDescription(i18n.getMessage("tooltip.documentation.link")); return link; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsStudyTableHelper.java
License:Open Source License
private static Link createLinkByResourcePath(String inputUrl) { Preconditions.checkNotNull(inputUrl, "URL is null"); String urlString = inputUrl.trim(); if (!urlString.toLowerCase().startsWith(HTTP) && !urlString.toLowerCase().startsWith(HTTPS)) { urlString = HTTP + urlString;/*from ww w .j av a 2 s.c om*/ } String inputString = urlString; String fileFormat; while (inputString.endsWith("/")) { inputString = inputString.substring(0, inputString.length() - 1); } fileFormat = inputString.substring(inputString.lastIndexOf(".") + 1).toLowerCase(); final Link link = new Link(urlString, new ExternalResource(urlString)); link.setTargetName("_blank"); if (fileFormat.startsWith("doc")) { link.setIcon(ELabsViewContants.ICON_16_DOC_DOC); } else if (fileFormat.startsWith("pdf")) { link.setIcon(ELabsViewContants.ICON_16_DOC_PDF); } else if (fileFormat.startsWith("ppt")) { link.setIcon(ELabsViewContants.ICON_16_DOC_PPT); } else if (fileFormat.startsWith("txt")) { link.setIcon(ELabsViewContants.ICON_16_DOC_TXT); } else if (fileFormat.startsWith("jpg") || fileFormat.startsWith("jpeg") || fileFormat.startsWith("png")) { link.setIcon(ELabsViewContants.ICON_16_DOC_IMG); } else { link.setIcon(ELabsViewContants.ICON_16_DOC_WEB); } return link; }