List of usage examples for com.vaadin.ui Embedded TYPE_BROWSER
int TYPE_BROWSER
To view the source code for com.vaadin.ui Embedded TYPE_BROWSER.
Click Source Link
From source file:com.openhris.payroll.reports.PayrollRegisterReport.java
public PayrollRegisterReport(int branchId, String payrollDate, Application payrollApplication) { this.branchId = branchId; this.payrollDate = payrollDate; this.payrollApplication = payrollApplication; setCaption("Payroll Register Report"); setSizeFull();// ww w. ja v a 2 s.c o m center(); Connection conn = getConnection.connection(); // URL url = this.getClass().getResource("/com/openhris/reports/payrollRegisterReport.jasper"); File reportFile = new File("C:/reportsJasper/payrollRegisterReport.jasper"); // File reportFile = new File(jasperUrl.getPath()); final HashMap hm = new HashMap(); hm.put("BRANCH_ID", getBranchId()); hm.put("PAYROLL_DATE", getPayrollDate()); try { JasperPrint jpReport = JasperFillManager.fillReport(reportFile.getPath(), hm, conn); SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String timestamp = df.format(new Date()); // file = File.createTempFile("payrollRegisterReport_"+timestamp, ".pdf"); file = "C:/reportsPdf/payrollRegisterReport_" + timestamp + ".pdf"; JasperExportManager.exportReportToPdfFile(jpReport, file); } catch (JRException ex) { Logger.getLogger(PayrollRegisterReport.class.getName()).log(Level.SEVERE, null, ex); } finally { try { if (conn != null || !conn.isClosed()) { conn.close(); } } catch (SQLException ex) { Logger.getLogger(PayrollRegisterReport.class.getName()).log(Level.SEVERE, null, ex); } } StreamResource.StreamSource source = new StreamResource.StreamSource() { @Override public InputStream getStream() { try { File f = new File(file); FileInputStream fis = new FileInputStream(f); return fis; } catch (Exception e) { e.getMessage(); return null; } } }; StreamResource resource = new StreamResource(source, file, getPayrollApplication()); resource.setMIMEType("application/pdf"); VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull(); Embedded e = new Embedded("", new FileResource(new File(resource.getFilename()), getPayrollApplication())); // e.setMimeType("application/pdf"); // e.setType(Embedded.TYPE_OBJECT); e.setSizeFull(); e.setType(Embedded.TYPE_BROWSER); // e.setSource(resource); // e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename()); vlayout.addComponent(e); addComponent(vlayout); // getPayrollApplication().getMainWindow().addWindow(this); getPayrollApplication().getMainWindow().open(resource, "_blank"); }
From source file:com.ribas.andrei.vaadin.OpenWindowApplication.java
License:Open Source License
private void createSubWindow(String subWindowMessage, boolean modal) { if (subWindow == null) { Embedded iframe = new Embedded(null, OpenWindowApplication.this.getStreamSource()); iframe.setType(Embedded.TYPE_BROWSER); iframe.setWidth("100%"); iframe.setHeight("100%"); createSubWindow(subWindowMessage, modal, iframe); } else if (subWindow.getParent() != null) { mainWindow.showNotification("SubWindow is already open"); }// w w w . j ava 2 s. c om }
From source file:com.save.reports.PromoDealAcknowledgementReport.java
public PromoDealAcknowledgementReport(int promoId) { this.promoId = promoId; setCaption("Acknowledgement Report"); setWidth("800px"); setHeight("600px"); center();/* w w w . j a v a2 s . c o m*/ Connection conn = DBConnection.connect(); HashMap hm = new HashMap(); hm.put("PROMO_ID", getPromoId()); InputStream template = this.getClass() .getResourceAsStream("/reports/PromoDealAcknowledgementFormReport.jasper"); try { JasperPrint print = JasperFillManager.fillReport(template, hm, conn); file = File.createTempFile("output", ".pdf"); JasperExportManager.exportReportToPdfFile(print, file.getPath()); } catch (JRException | IOException ex) { Logger.getLogger(PromoDealAcknowledgementReport.class.getName()).log(Level.SEVERE, null, ex); } StreamResource.StreamSource source = () -> { try { FileInputStream fis = new FileInputStream(file); return fis; } catch (Exception e) { e.getMessage(); return null; } }; StreamResource resource = new StreamResource(source, "PromoDealAcknowledgementForm.pdf"); resource.setMIMEType("application/pdf"); VerticalLayout v = new VerticalLayout(); v.setSizeFull(); Embedded e = new Embedded(); e.setSource(resource); e.setSizeFull(); e.setType(Embedded.TYPE_BROWSER); v.addComponent(e); setContent(v); }
From source file:com.shopwiki.vaadin.StringFrame.java
License:Apache License
public StringFrame(Application app) { this.app = app; setType(Embedded.TYPE_BROWSER); // FIXME: Put the content inside of HTML/BODY !!! }
From source file:eu.lod2.CKAN.java
License:Apache License
public CKAN(LOD2DemoState st) { // The internal state state = st;/*from w w w . j ava 2 s . c o m*/ Embedded browser = new Embedded(); try { URL url = new URL("http://ckan.net"); browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(browser); }
From source file:eu.lod2.D2RCordis.java
License:Apache License
public D2RCordis(LOD2DemoState st) { // The internal state state = st;/*from w w w . ja va2 s . co m*/ Embedded browser = new Embedded(); try { LOD2DemoInitApp urlD2r = new LOD2DemoInitApp(st, "http://localhost/d2r-cordis"); System.err.println(urlD2r.service); URL url = new URL(urlD2r.service); browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(browser); }
From source file:eu.lod2.DBpedia.java
License:Apache License
public DBpedia(LOD2DemoState st) { // The internal state state = st;/*from ww w . j a va2s. c o m*/ Embedded browser = new Embedded(); try { URL url = new URL("http://live.dbpedia.org"); browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(browser); }
From source file:eu.lod2.ELoadRDFFile.java
License:Apache License
public ELoadRDFFile(LOD2DemoState st) { // The internal state and state = st;/*from ww w . j a va 2s . com*/ initVirtuoso(); Embedded browser = new Embedded(); try { URL url; if (virtuoso_username.equals("") || virtuoso_password.equals("")) { url = new URL( "http://localhost:8890/conductor/rdf_import.vspx?username=dba&t_login_pwd=dba&password=dba"); } else if (virtuoso_service.equals("")) { url = new URL(state.getHostName() + "/conductor/rdf_import.vspx?username=" + virtuoso_username + "&t_login_pwd=" + virtuoso_password + "&password=" + virtuoso_password); } else { url = new URL(virtuoso_service + "/rdf_import.vspx?username=" + virtuoso_username + "&t_login_pwd=" + virtuoso_password + "&password=" + virtuoso_password); } ; browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; browser.setSizeUndefined(); setSizeUndefined(); // The composition root MUST be set setCompositionRoot(browser); }
From source file:eu.lod2.GeoSpatial.java
License:Apache License
public GeoSpatial(LOD2DemoState st) { // The internal state and state = st;/*from www . ja va 2s .co m*/ initLogin(); HorizontalLayout geospatiallayout = new HorizontalLayout(); // Configuration form start // Set all properties at once for the moment. Form t2f = new Form(); t2f.setDebugId(this.getClass().getSimpleName() + "_t2f"); t2f.setCaption("Configuration"); exportGraph = new ExportSelector3(state, true, "Select graph with geo data:"); exportGraph.setDebugId(this.getClass().getSimpleName() + "_exportGraph"); t2f.getLayout().addComponent(exportGraph); // initialize the footer area of the form HorizontalLayout t2ffooterlayout = new HorizontalLayout(); t2f.setFooter(t2ffooterlayout); Button commitButton = new Button("Set configuration", new ClickListener() { public void buttonClick(ClickEvent event) { storeConfiguration(event); } }); commitButton.setDebugId(this.getClass().getSimpleName() + "_commitButton"); commitButton.setDescription("Commit the new configuration settings."); t2f.getFooter().addComponent(commitButton); geospatiallayout.addComponent(t2f); // Configuration form end geobrowser = new Embedded(); try { URL url = new URL(service); geobrowser = new Embedded("", new ExternalResource(url)); geobrowser.setType(Embedded.TYPE_BROWSER); geospatiallayout.addComponent(geobrowser); //geobrowser.setHeight(-1, Sizeable.UNITS_PERCENTAGE); geobrowser.setSizeFull(); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(geospatiallayout); geospatiallayout.setSizeFull(); }
From source file:eu.lod2.IframedUrl.java
License:Apache License
public IframedUrl(LOD2DemoState st, String urlref) { // The internal state state = st;//from www. j a v a 2 s . c om Embedded browser = new Embedded(); try { URL url = new URL(urlref); browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setSizeFull(); //panel.addComponent(browser); } catch (MalformedURLException e) { e.printStackTrace(); } ; // The composition root MUST be set setCompositionRoot(browser); }