List of usage examples for com.vaadin.ui Embedded setType
public void setType(int type)
From source file:annis.gui.AboutWindow.java
License:Apache License
public AboutWindow() { setSizeFull();//from ww w . j a va 2 s. com layout = new VerticalLayout(); setContent(layout); layout.setSizeFull(); layout.setMargin(true); HorizontalLayout hLayout = new HorizontalLayout(); Embedded logoAnnis = new Embedded(); logoAnnis.setSource(new ThemeResource("images/annis-logo-128.png")); logoAnnis.setType(Embedded.TYPE_IMAGE); hLayout.addComponent(logoAnnis); Embedded logoSfb = new Embedded(); logoSfb.setSource(new ThemeResource("images/sfb-logo.jpg")); logoSfb.setType(Embedded.TYPE_IMAGE); hLayout.addComponent(logoSfb); Link lnkFork = new Link(); lnkFork.setResource(new ExternalResource("https://github.com/korpling/ANNIS")); lnkFork.setIcon( new ExternalResource("https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png")); lnkFork.setTargetName("_blank"); hLayout.addComponent(lnkFork); hLayout.setComponentAlignment(logoAnnis, Alignment.MIDDLE_LEFT); hLayout.setComponentAlignment(logoSfb, Alignment.MIDDLE_RIGHT); hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT); layout.addComponent(hLayout); layout.addComponent(new Label( "ANNIS is a project of the " + "<a href=\"http://www.sfb632.uni-potsdam.de/\">SFB632</a>.", Label.CONTENT_XHTML)); layout.addComponent(new Label("Homepage: " + "<a href=\"http://corpus-tools.org/annis/\">" + "http://corpus-tools.org/annis/</a>.", Label.CONTENT_XHTML)); layout.addComponent(new Label("Version: " + VersionInfo.getVersion())); layout.addComponent(new Label("Vaadin-Version: " + Version.getFullVersion())); TextArea txtThirdParty = new TextArea(); txtThirdParty.setSizeFull(); StringBuilder sb = new StringBuilder(); sb.append("The ANNIS team wants to thank these third party software that " + "made the ANNIS GUI possible:\n"); File thirdPartyFolder = new File(VaadinService.getCurrent().getBaseDirectory(), "THIRD-PARTY"); if (thirdPartyFolder.isDirectory()) { for (File c : thirdPartyFolder.listFiles((FileFilter) new WildcardFileFilter("*.txt"))) { if (c.isFile()) { try { sb.append(FileUtils.readFileToString(c)).append("\n"); } catch (IOException ex) { log.error("Could not read file", ex); } } } } txtThirdParty.setValue(sb.toString()); txtThirdParty.setReadOnly(true); txtThirdParty.addStyleName("shared-text"); txtThirdParty.setWordwrap(false); layout.addComponent(txtThirdParty); btClose = new Button("Close"); final AboutWindow finalThis = this; btClose.addClickListener(new OkClickListener(finalThis)); layout.addComponent(btClose); layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER); layout.setExpandRatio(txtThirdParty, 1.0f); }
From source file:com.etest.pdfgenerator.TQViewer.java
public TQViewer(int tqCoverageId) { this.tqCoverageId = tqCoverageId; // setSizeFull(); setWidth("900px"); setHeight("600px"); center();// w ww.j av a 2s.c om StreamResource resource = new StreamResource(new TQCoveragePDF(getTQCoverageId()), "TQ.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.etest.pdfviewer.ItemAnalysisOfSubjectReportViewer.java
public ItemAnalysisOfSubjectReportViewer(int tqCoverageId) { this.tqCoverageId = tqCoverageId; setWidth("900px"); setHeight("600px"); center();/*from ww w. ja v a 2 s . c o m*/ StreamResource resource = new StreamResource(new ItemAnalysisOfSubjectReportPDF(getTQCoverageId()), "ItemAnalysis.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.etest.pdfviewer.ItemAnalysisReportViewer.java
public ItemAnalysisReportViewer(int tqCoverageId) { this.tqCoverageId = tqCoverageId; setWidth("900px"); setHeight("600px"); center();/*from w ww . j a v a2s . c om*/ StreamResource resource = new StreamResource(new ItemAnalysisReportPDF(getTqCoverageId()), "ItemAnalysis.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.etest.pdfviewer.SummaryReportViewer.java
public SummaryReportViewer(String summaryType) { setCaption(summaryType);//from w w w. j av a2 s . c o m setWidth("900px"); setHeight("600px"); center(); StreamResource resource; //= new StreamResource(new InventoryCasesReportPDF(), "InventoryOfCases.pdf"); if (summaryType.equals("Summary: Case vs Items")) { resource = new StreamResource(new InventoryCasesReportPDF(), "InventoryOfCases.pdf"); } else { resource = new StreamResource(new InventoryItemsReportPDF(), "InventoryOfItems.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.etest.pdfviewer.TQCriticalIndexReportViewer.java
public TQCriticalIndexReportViewer(int tqCoverageId) { this.tqCoverageId = tqCoverageId; setWidth("900px"); setHeight("600px"); center();/*from w w w .ja v a 2s . com*/ StreamResource resource = new StreamResource(new TQCriticalIndexValuesReportPDF(getTQCoverageId()), "TQCriticalIndexValues.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.expressui.core.util.UrlUtil.java
License:Open Source License
/** * Only used by sample application to track usage statistics * * @param container container for adding the embedded iframe to *//* w w w . j av a2 s . co m*/ public static void addTrackingUrl(AbstractComponentContainer container, String tag) { try { URL url = new URL(EXPRESSUI_TEST_PAGE + tag); Embedded browser = new Embedded(null, new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setWidth(0, Sizeable.UNITS_PIXELS); browser.setHeight(0, Sizeable.UNITS_PIXELS); container.addComponent(browser); } catch (MalformedURLException e) { throw new RuntimeException(e); } }
From source file:com.expressui.core.view.util.CodePopup.java
License:Open Source License
private Embedded getEmbeddedDoc(String u) { try {// www . ja va 2 s . com URL url = new URL(u); Embedded browser = new Embedded("", new ExternalResource(url)); browser.setHeight(15000, Sizeable.UNITS_PIXELS); browser.setType(Embedded.TYPE_BROWSER); return browser; } catch (MalformedURLException e) { throw new RuntimeException(e); } }
From source file:com.expressui.sample.view.HomePage.java
License:Open Source License
@Override public void onDisplay() { try {/*from w w w . jav a2s . c om*/ URL url = new URL("http://www.expressui.com/"); Embedded browser = new Embedded("", new ExternalResource(url)); browser.setType(Embedded.TYPE_BROWSER); browser.setWidth(100, Sizeable.UNITS_PERCENTAGE); browser.setHeight(15000, Sizeable.UNITS_PIXELS); setCompositionRoot(browser); } catch (MalformedURLException e) { throw new RuntimeException(e); } getMainApplication().showTrayMessage("<h3>Feature Tip:</h3>" + "<ul>" + "<li>This illustrates how to embed any external page into ExpressUI" + "</ul>"); }
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();/*from ww w. j a v a 2 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); }