List of usage examples for com.vaadin.ui Embedded setSource
public void setSource(Resource source)
From source file:com.hris.payroll.reports.ReportViewer.java
public ReportViewer(String reportType, int branchId, Date payrollDate) { this.reportType = reportType; this.branchId = branchId; this.payrollDate = payrollDate; setWidth("900px"); setHeight("600px"); center();// www. ja v a2 s. c o m StreamResource resource = null; switch (reportType) { case "Payslip": { String filename = "Payslip-" + new Date().getTime() + ".pdf"; resource = new StreamResource(new PayslipReportPDF(getBranchId(), getPayrollDate()), filename); break; } case "Advances Summary": { String filename = "Advances-" + new Date().getTime() + ".pdf"; resource = new StreamResource(new AdvancesSummaryReportPdf(getBranchId(), getPayrollDate()), filename); break; } default: { String filename = "Advances-" + new Date().getTime() + ".pdf"; resource = new StreamResource(new AdvancesReportPdf(getBranchId(), getPayrollDate(), reportType), filename); break; } } resource.setMIMEType("application/pdf"); VerticalLayout v = new VerticalLayout(); v.setSizeFull(); v.setSpacing(true); v.setMargin(new MarginInfo(false, false, true, false)); Embedded em = new Embedded(); em.setSource(resource); em.setSizeFull(); em.setType(Embedded.TYPE_BROWSER); v.addComponent(em); v.setExpandRatio(em, 1); setContent(v); }
From source file:de.unioninvestment.portal.explorer.view.vfs.VFSMainView.java
License:Apache License
public VFSMainView(ConfigBean cb, VFSFileExplorerPortlet instance) throws Exception { final String vfsUrl = cb.getVfsUrl(); if (vfsUrl.length() != 0) { removeAllComponents();//from w ww .j av a 2 s . c om explorerPanel.setStyleName(Reindeer.PANEL_LIGHT); filePanel.setStyleName(Reindeer.PANEL_LIGHT); FileSystemOptions opts = new FileSystemOptions(); logger.log(Level.INFO, "Check Type "); if (cb.getVfsType().equalsIgnoreCase("FTP") || cb.getVfsType().equalsIgnoreCase("SFTP")) { if (cb.getUsername() != null && cb.getUsername().length() > 0) { StaticUserAuthenticator auth = new StaticUserAuthenticator(null, cb.getUsername(), cb.getPassword()); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth); } } if (cb.getVfsType().equalsIgnoreCase("FTP")) { FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true); FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, true); } if (cb.getVfsType().equalsIgnoreCase("SFTP")) { SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true); if (cb.getKeyfile() != null && cb.getKeyfile().length() > 0) { logger.log(Level.INFO, "Keyfile " + cb.getKeyfile()); SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, "no"); File keyFile = new File(cb.getKeyfile()); SftpFileSystemConfigBuilder.getInstance().setIdentities(opts, new File[] { keyFile }); } SftpFileSystemConfigBuilder.getInstance().setProxyType(opts, SftpFileSystemConfigBuilder.PROXY_HTTP); if (cb.getProxyHost() != null && cb.getProxyHost().length() > 0) { SftpFileSystemConfigBuilder.getInstance().setProxyHost(opts, cb.getProxyHost()); logger.log(Level.INFO, "ProxyHost " + cb.getProxyHost()); } if (cb.getProxyPort() != null && cb.getProxyPort().length() > 0) { SftpFileSystemConfigBuilder.getInstance().setProxyPort(opts, Integer.valueOf(cb.getProxyPort())); logger.log(Level.INFO, "ProxyPort " + cb.getProxyPort()); } } DefaultFileSystemManager fsManager = null; fsManager = getManager(); final HorizontalSplitPanel panel = new HorizontalSplitPanel(); panel.setHeight(500, UNITS_PIXELS); panel.setWidth(1400, UNITS_PIXELS); panel.setSplitPosition(350, Sizeable.UNITS_PIXELS); panel.setFirstComponent(explorerPanel); panel.setSecondComponent(filePanel); addComponent(panel); final Embedded image = new Embedded(); image.setType(Embedded.TYPE_IMAGE); image.setSource(FOLDER); image.setHeight(15, Sizeable.UNITS_PIXELS); explorerPanel.setSizeFull(); filePanel.setSizeFull(); explorerPanel.addComponent(tree); filePanel.addComponent(new TableView(instance, fsManager, opts, cb)); tree.setImmediate(true); tree.addListener(new ItemClickEvent.ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(ItemClickEvent event) { VFSFileExplorerPortlet app = (VFSFileExplorerPortlet) getApplication(); String newDir = (String) event.getItemId(); app.getEventBus().fireEvent(new TableChangedEvent(newDir)); } }); scanDirectory(fsManager, opts, vfsUrl); } else { addComponent(new Label("Please configure Portlet !")); } }
From source file:edu.nps.moves.mmowgli.utility.Res.java
License:Open Source License
public Embedded getClasspathImage(String filename) { ClassResource clR = getClasspathImageResource(filename); Embedded emb = new Embedded(); emb.setSource(clR); return emb;/* w w w . jav a 2 s . c om*/ }
From source file:edu.nps.moves.mmowgli.utility.Res.java
License:Open Source License
public Embedded getExternalImage(String url) { ExternalResource exR = new ExternalResource(url); Embedded emb = new Embedded(); emb.setSource(exR); return emb;//from w w w . j a va 2 s.co m }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthExchange.java
License:Open Source License
private Popover getPopoverPDF(String val, String title) { Popover popover = new Popover(); popover.setModal(true);// w ww . j a v a 2 s .c o m popover.setClosable(true); popover.setWidth("700px"); popover.setHeight("100%"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); popLayout.setMargin(true); NavigationView navView = new NavigationView(popLayout); navView.setCaption(title); CssLayout layout2 = new CssLayout(); Embedded pdf = new Embedded(); pdf.setType(Embedded.TYPE_BROWSER); pdf.setMimeType("application/pdf"); pdf.setSizeFull(); pdf.setWidth("100%"); pdf.setHeight("700px"); pdf.setSource(createPdf(val)); layout2.addComponent(pdf); popLayout.addComponent(layout2); Button close = new Button(null, new ClickListener() { public void buttonClick(ClickEvent event) { event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow()); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setRightComponent(close); popover.setContent(navView); return popover; }
From source file:nl.amc.biolab.nsg.display.component.ProcessingStatusForm.java
License:Open Source License
private void showHTML(final String htmlContent, final Application app) throws IllegalArgumentException, NullPointerException { app.getMainWindow().addWindow(new Window() { private static final long serialVersionUID = -2307854110750435145L; {/*from w ww . j av a 2 s.co m*/ center(); setWidth("75%"); setHeight("600px"); StreamResource.StreamSource source = new StreamResource.StreamSource() { private static final long serialVersionUID = -3745013501121916404L; public InputStream getStream() { return new ByteArrayInputStream(htmlContent.getBytes()); } }; StreamResource resource = new StreamResource(source, "TestReport.html", app); Embedded e = new Embedded(); e.setMimeType("text/html"); e.setType(Embedded.TYPE_BROWSER); e.setWidth("100%"); e.setHeight("590px"); e.setSource(resource); addComponent(e); } }); }
From source file:org.diretto.web.richwebclient.view.sections.UploadSection.java
/** * Loads the content of this {@link Section}. *//*from ww w . j a va2 s . c o m*/ private void loadComponents() { removeAllComponents(); captionLayout = new HorizontalLayout(); captionLayout.addComponent(StyleUtils.getLabelH1(title)); captionLayout.addComponent(getPollingProgressIndicator()); addComponent(captionLayout); mainLayout = new VerticalLayout(); mainLayout.setStyleName(Reindeer.LAYOUT_BLACK); mainLayout.setMargin(true); mainLayout.setSpacing(true); addComponent(mainLayout); mainLayout.addComponent(StyleUtils.getLabelH2("File Upload")); mainLayout.addComponent(StyleUtils.getHorizontalLine()); mainLayout.addComponent(StyleUtils.getLabel("Select the files which you want to upload")); mainLayout.addComponent(StyleUtils .getLabelSmall("(To choose multiple files, just press the CTRL-key while selecting the files)")); mainLayout.addComponent(StyleUtils.getVerticalSpaceSmall()); multipleUpload = new MultipleUpload(application, "Select Files", Reindeer.BUTTON_DEFAULT); multipleUpload.addMultipleUploadHandler(new MultipleUploadHandler() { @Override public void onUploadsSelected(List<FileInfo> fileInfos) { for (FileInfo file : fileInfos) { if (file != null) { files.put(file.getName(), file); if (!fileNames.contains(file.getName())) { fileNames.add(file.getName()); } } } handleNextFile(); } @Override public void onUploadStarted(FileInfo fileInfo) { return; } @SuppressWarnings("unchecked") @Override public void onUploadFinished(final FileInfo fileInfo, final File file) { final UploadSettings uploadSettings = settings.remove(fileInfo.getName()); final UserSession userSession = authenticationRegistry.getActiveUserSession(); Embedded embedded; synchronized (UploadSection.this) { embedded = ((List<Embedded>) uploadedEmbeddeds.get(fileInfo)).get(0); uploadedEmbeddeds.remove(fileInfo, embedded); if (embedded != null) { embedded.setSource(ResourceUtils.RUNO_ICON_32_OK_RESOURCE); requestRepaint(); } } new Thread(new Runnable() { @Override public void run() { if (uploadSettings != null && userSession != null) { PlatformMediaType platformMediaType = coreService .getPlatformMediaType(fileInfo.getType()); PlatformAttachmentCreationData platformAttachmentCreationData = ((PlatformAttachmentCreationData.Builder) new PlatformAttachmentCreationData.Builder() .fileSize(fileInfo.getSize()).platformMediaType(platformMediaType) .title(uploadSettings.getTitle()).description(uploadSettings.getDescription()) .license(uploadSettings.getLicense()) .contributors(uploadSettings.getContributors()) .creators(uploadSettings.getCreators())).build(); UploadInfo uploadInfo = coreService.createDocument(userSession, platformAttachmentCreationData, uploadSettings.getTopographicPoint(), uploadSettings.getTimeRange()); UploadProcess uploadProcess = storageService.createUploadProcess(userSession, uploadInfo, file); UploadReport uploadReport = storageService.executeUploadProcess(uploadProcess); Embedded embedded; synchronized (UploadSection.this) { embedded = ((List<Embedded>) publishedEmbeddeds.get(fileInfo)).get(0); publishedEmbeddeds.remove(fileInfo, embedded); } if (uploadReport != null) { for (String tag : uploadSettings.getTags()) { Document document = coreService .getDocument((DocumentID) uploadReport.getAttachmentID().getRootID()); document.addTag(userSession, tag); } NumberFormat numberFormat = NumberFormat.getInstance(); numberFormat.setGroupingUsed(false); System.out.println("=================================="); System.out.println("vvvvvvvvvv UploadReport vvvvvvvvvv"); System.out.println("AttachmentID: " + uploadReport.getAttachmentID().getUniqueResourceURL().toExternalForm()); System.out.println("File URL: " + uploadReport.getFileURL().toExternalForm()); System.out.println("Media Type: " + uploadReport.getPlatformMediaType().getID()); System.out.println("File Size: " + uploadReport.getFileSize() + " Bytes"); System.out.println("Upload Time: " + numberFormat.format(uploadReport.getUploadTime()) + " ms"); System.out.println("Upload Rate: " + numberFormat.format(uploadReport.getUploadRate()) + " Bytes/s"); System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); System.out.println("=================================="); synchronized (UploadSection.this) { if (embedded != null) { embedded.setSource(ResourceUtils.RUNO_ICON_32_OK_RESOURCE); requestRepaint(); } } } else { System.err.println("UploadReport: null"); synchronized (UploadSection.this) { if (embedded != null) { embedded.setSource(ResourceUtils.RUNO_ICON_32_CANCEL_RESOURCE); requestRepaint(); } } } } if (file.exists()) { file.delete(); } } }).start(); } @SuppressWarnings("unchecked") @Override public void onUploadFailed(FileInfo fileInfo, Exception exception) { Embedded uploadedEmbedded; synchronized (UploadSection.this) { uploadedEmbedded = ((List<Embedded>) uploadedEmbeddeds.get(fileInfo)).get(0); uploadedEmbeddeds.remove(fileInfo, uploadedEmbedded); if (uploadedEmbedded != null) { uploadedEmbedded.setSource(ResourceUtils.RUNO_ICON_32_CANCEL_RESOURCE); requestRepaint(); } } Embedded publishedEmbedded; synchronized (UploadSection.this) { publishedEmbedded = ((List<Embedded>) publishedEmbeddeds.get(fileInfo)).get(0); publishedEmbeddeds.remove(fileInfo, publishedEmbedded); if (publishedEmbedded != null) { publishedEmbedded.setSource(ResourceUtils.RUNO_ICON_32_CANCEL_RESOURCE); requestRepaint(); } } settings.remove(fileInfo.getName()); } }); mainLayout.addComponent(multipleUpload); mainLayout.addComponent(StyleUtils.getHorizontalLine()); }
From source file:org.eclipse.hawkbit.ui.decorators.SPUIEmbedDecorator.java
License:Open Source License
/** * Decorate.// w w w . ja v a2 s. c o m * * @param spUIEmbdValue * as DTO * @return Embedded as UI */ public static Embedded decorate(final SPUIEmbedValue spUIEmbdValue) { final Embedded spUIEmbd = new Embedded(); spUIEmbd.setImmediate(spUIEmbdValue.isImmediate()); spUIEmbd.setType(spUIEmbdValue.getType()); if (null != spUIEmbdValue.getId()) { spUIEmbd.setId(spUIEmbdValue.getId()); } if (null != spUIEmbdValue.getData()) { spUIEmbd.setData(spUIEmbdValue.getData()); } if (null != spUIEmbdValue.getStyleName()) { spUIEmbd.setStyleName(spUIEmbdValue.getStyleName()); } if (null != spUIEmbdValue.getSource()) { spUIEmbd.setSource(new ThemeResource(spUIEmbdValue.getSource())); } if (null != spUIEmbdValue.getMimeType()) { spUIEmbd.setMimeType(spUIEmbdValue.getMimeType()); } if (null != spUIEmbdValue.getDescription()) { spUIEmbd.setDescription(spUIEmbdValue.getDescription()); } return spUIEmbd; }
From source file:org.fossa.rolp.ui.leb.LebAnzeigen.java
License:Open Source License
public LebAnzeigen(FossaApplication app, SchuelerLaso schueler, KlasseLaso klasse) throws DocumentException, IOException { super(app);/*from w w w .jav a 2 s . c om*/ setCaption(" - Lernentwicklungsbericht anzeigen - "); VerticalLayout layout = new VerticalLayout(); setWidth("800px"); setContent(layout); layout.setSpacing(true); Embedded embeddedPdf = new Embedded(); embeddedPdf.setType(Embedded.TYPE_BROWSER); DateFormat dateFormat = new SimpleDateFormat("ddMMyy-HHmmss"); String dateiname = "Klasse" + klasse.getKlassenname() + "_" + schueler.getVorname() + "_" + schueler.getName() + "_" + dateFormat.format(new Date()) + ".pdf"; embeddedPdf.setSource(new LebCreator(app, schueler, klasse, dateiname).getLebResource()); embeddedPdf.setWidth(100, Sizeable.UNITS_PERCENTAGE); embeddedPdf.setHeight("580px"); windowCloseButton.setWidth(100, Sizeable.UNITS_PERCENTAGE); layout.addComponent(embeddedPdf); layout.addComponent(windowCloseButton); }
From source file:org.hip.vif.skin.dflt.Skin.java
License:Open Source License
@Override public Component getHeader(final String inAppName) { final HorizontalLayout outLayout = new HorizontalLayout(); outLayout.setStyleName("vif-head"); outLayout.setMargin(false);// w w w . j a v a 2s . co m outLayout.setWidth("100%"); outLayout.setHeight(80, Unit.PIXELS); final Embedded lImage = new Embedded(); lImage.setSource(new ThemeResource("images/vifLogo.gif")); outLayout.addComponent(lImage); outLayout.setComponentAlignment(lImage, Alignment.TOP_LEFT); outLayout.setExpandRatio(lImage, 0.42f); final Label lTitle = LabelHelper.createLabel("VIF Forum", "vif-head-title"); lTitle.setSizeUndefined(); outLayout.addComponent(lTitle); outLayout.setComponentAlignment(lTitle, Alignment.MIDDLE_LEFT); outLayout.setExpandRatio(lTitle, 0.58f); return outLayout; }