List of usage examples for com.vaadin.ui Window getContent
@Override
public Component getContent()
From source file:com.lizardtech.expresszip.ui.SetupMapPresenter.java
License:Apache License
@Override public void shapeFileUploadedEvent(final String filename, final ByteArrayInputStream input) { final Window modal = new Window("Wait"); final Window mainWindow = (ExpressZipWindow) setupMapView.getApplication().getMainWindow(); final SetupMapPresenter presenter = this; Thread spinner = new Thread(new Runnable() { public void run() { ProgressIndicator pi = new ProgressIndicator(); pi.setCaption("Processing Shapefile..."); modal.setModal(true);//from w w w .ja va 2 s . com modal.setClosable(false); modal.setResizable(false); modal.getContent().setSizeUndefined(); // trick to size around content modal.getContent().addComponent(pi); modal.setWidth(modal.getWidth(), modal.getWidthUnits()); mainWindow.addWindow(modal); VectorLayer uploadedShapeFile = setupMapModel.shapeFileUploaded(filename, input); if (uploadedShapeFile != null) { shapeFileLayer = uploadedShapeFile; mapModel.addVectorLayer(shapeFileLayer); setupMapView.updateShapeLayer(shapeFileLayer); mapModel.updateOpenLayersMap(); Bounds shpFileBounds = shapeFileLayer.getBoundsForLayer(mapModel.getCurrentProjection()); resetExtentLayer(shpFileBounds, presenter); map.addLayer(boundingBoxLayer); } mainWindow.removeWindow(modal); } }); spinner.start(); }
From source file:com.lizardtech.expresszip.vaadin.FindLayersViewComponent.java
License:Apache License
public FindLayersViewComponent() { treeTable = new ExpressZipTreeTable(); popupTable = new ExpressZipTreeTable(); configureTable(treeTable);/*from w w w. j ava 2 s . co m*/ popupSelectionListener = new Property.ValueChangeListener() { private static final long serialVersionUID = 625365970493526725L; @Override public void valueChange(ValueChangeEvent event) { // the current popup selection Set<ExpressZipLayer> popupSelection = (Set<ExpressZipLayer>) event.getProperty().getValue(); // get the tree's current selection HashSet<ExpressZipLayer> treeSelection = new HashSet<ExpressZipLayer>( (Set<ExpressZipLayer>) treeTable.getValue()); // remove all items in common with popup treeSelection.removeAll(popupTable.getItemIds()); // set the treeTable selection to the union Set<ExpressZipLayer> unionSelection = new HashSet<ExpressZipLayer>(); unionSelection.addAll(popupSelection); unionSelection.addAll(treeSelection); treeTable.setValue(unionSelection); } }; popupTable.addListener(popupSelectionListener); treeTable.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 6236114836521221107L; @Override public void valueChange(ValueChangeEvent event) { Set<ExpressZipLayer> highlightedLayers = (Set<ExpressZipLayer>) event.getProperty().getValue(); for (FindLayersViewListener listener : listeners) { listener.layerHighlightedEvent(highlightedLayers); } // reset selection of popup table popupTable.removeListener(popupSelectionListener); // intersection of treeTable's selection and popupTable items Set<ExpressZipLayer> popupSelection = new HashSet<ExpressZipLayer>(); popupSelection.addAll(highlightedLayers); popupSelection.retainAll(popupTable.getItemIds()); popupTable.setValue(popupSelection); popupTable.addListener(popupSelectionListener); } }); configureTable(popupTable); filter = new Filter(this); filterButtonListener = new FilterListeners(); axisSelectedListener = new AxisSelected(); listeners = new ArrayList<FindLayersViewListener>(); btnNext = new ExpressZipButton("Next", Style.STEP); btnBack = new ExpressZipButton("Back", Style.STEP); btnAddFilter = new ExpressZipButton("Add Filter", Style.ACTION); btnAddFilter.addStyleName("filter-flow"); hshFilterButtons = new HashMap<Button, FilterObject>(); cssLayers = new CssLayout(); basemapSelector = new ComboBox(); basemapSelector.setWidth(100.0f, UNITS_PERCENTAGE); basemapSelector.setTextInputAllowed(false); basemapSelector.setImmediate(true); basemapSelector.setNullSelectionAllowed(false); basemapSelector.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -7358667131762099215L; @Override public void valueChange(ValueChangeEvent event) { ProjectedLayer l = (ProjectedLayer) basemapSelector.getValue(); boolean enableCheckbox = false; if (l instanceof WebMapServiceLayer) { for (ExpressZipLayer local : mapModel.getLocalBaseLayers()) { if (l.toString().equals(local.getName())) { enableCheckbox = true; break; } } } includeBasemap.setEnabled(enableCheckbox); if (!enableCheckbox) { includeBasemap.setValue(false); } if (mapModel.getBaseLayerTerms(l) != null && !mapModel.getBaseLayerTermsAccepted(l)) { final Window modal = new Window("Terms of Use"); modal.setModal(true); modal.setClosable(false); modal.setResizable(false); modal.getContent().setSizeUndefined(); // trick to size around content Button bOK = new ExpressZipButton("OK", Style.ACTION, new ClickListener() { private static final long serialVersionUID = -2872178665349848542L; @Override public void buttonClick(ClickEvent event) { ProjectedLayer l = (ProjectedLayer) basemapSelector.getValue(); mapModel.setBaseLayerTermsAccepted(l); for (FindLayersViewListener listener : listeners) listener.baseMapChanged(l); ((ExpressZipWindow) getApplication().getMainWindow()).removeWindow(modal); } }); Button bCancel = new ExpressZipButton("Cancel", Style.ACTION, new ClickListener() { private static final long serialVersionUID = -3044064554876422836L; @Override public void buttonClick(ClickEvent event) { basemapSelector.select(mapModel.getBaseLayers().get(0)); ((ExpressZipWindow) getApplication().getMainWindow()).removeWindow(modal); } }); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(bOK); buttons.addComponent(bCancel); Label termsText = new Label(mapModel.getBaseLayerTerms(l)); termsText.setContentMode(Label.CONTENT_XHTML); VerticalLayout vlay = new VerticalLayout(); vlay.addComponent(termsText); vlay.addComponent(buttons); vlay.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); vlay.setWidth(400, UNITS_PIXELS); modal.getContent().addComponent(vlay); ((ExpressZipWindow) getApplication().getMainWindow()).addWindow(modal); } else { for (FindLayersViewListener listener : listeners) listener.baseMapChanged(l); } } }); includeBasemap = new CheckBox(); includeBasemap.setDescription("Include this basemap in the exported image."); includeBasemap.setWidth(64f, UNITS_PIXELS); HorizontalLayout basemapLayout = new HorizontalLayout(); basemapLayout.setWidth(100f, UNITS_PERCENTAGE); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); setSizeFull(); Label step = new Label("Step 1: Select Layers"); step.addStyleName("step"); layout.addComponent(step); layout.addComponent(treeTable); layout.setSpacing(true); treeTable.setSizeFull(); layout.setExpandRatio(treeTable, 1f); layout.addComponent(new Panel(BASEMAP, basemapLayout)); basemapLayout.addComponent(basemapSelector); basemapLayout.setExpandRatio(basemapSelector, 1f); basemapLayout.addComponent(includeBasemap); layout.addComponent(cssLayers); cssLayers.addComponent(btnAddFilter); HorizontalLayout backSubmitLayout = new HorizontalLayout(); backSubmitLayout.setWidth("100%"); backSubmitLayout.addComponent(btnBack); backSubmitLayout.addComponent(btnNext); backSubmitLayout.setComponentAlignment(btnBack, Alignment.BOTTOM_LEFT); backSubmitLayout.setComponentAlignment(btnNext, Alignment.BOTTOM_RIGHT); VerticalLayout navLayout = new VerticalLayout(); navLayout.addComponent(backSubmitLayout); navLayout.setSpacing(true); ThemeResource banner = new ThemeResource("img/ProgressBar1.png"); navLayout.addComponent(new Embedded(null, banner)); layout.addComponent(navLayout); layout.setComponentAlignment(navLayout, Alignment.BOTTOM_CENTER); btnNext.addListener(this); btnNext.setEnabled(false); btnBack.setEnabled(false); // always disabled btnAddFilter.addListener(this); layout.addStyleName("findlayers"); setCompositionRoot(layout); }
From source file:com.lizardtech.expresszip.vaadin.FindLayersViewComponent.java
License:Apache License
private void setupAddFilterWindow(Window window) { // General variables // Layouts//from w ww .j ava 2s . co m GridLayout mainLayout = new GridLayout(1, 3); HorizontalLayout axisLayout = new HorizontalLayout(); HorizontalLayout criteriaLayout = new HorizontalLayout(); HorizontalLayout buttonLayout = new HorizontalLayout(); hznCriteria = criteriaLayout; // Buttons ExpressZipButton btnAdd = new ExpressZipButton("Add", Style.ACTION); btnAdd.setClickShortcut(KeyCode.ENTER); btnAdd.addStyleName("primary"); ExpressZipButton btnCancel = new ExpressZipButton("Cancel", Style.ACTION); // Fields ComboBox cmbAxis = new ComboBox(); cmbAxis.setTextInputAllowed(false); cmbAxis.setNullSelectionAllowed(false); // Labels Label lblAxis = new Label("Axis"); btnAdd.addListener(filterButtonListener); btnCancel.addListener(filterButtonListener); for (Filter.AxisFilters f : Filter.axisArray) { cmbAxis.addItem(filter.getNameOfFilter(f)); } cmbAxis.setImmediate(true); cmbAxis.addListener(axisSelectedListener); cmbAxis.setValue(filter.getNameOfFilter(Filter.axisArray[0])); mainLayout.addComponent(axisLayout, 0, 0); mainLayout.addComponent(criteriaLayout, 0, 1); mainLayout.addComponent(buttonLayout, 0, 2); mainLayout.setSpacing(true); axisLayout.setSpacing(true); axisLayout.addComponent(lblAxis); axisLayout.addComponent(cmbAxis); axisLayout.setExpandRatio(lblAxis, .2f); axisLayout.setExpandRatio(cmbAxis, .8f); axisLayout.setComponentAlignment(lblAxis, Alignment.MIDDLE_LEFT); axisLayout.setComponentAlignment(cmbAxis, Alignment.MIDDLE_LEFT); axisLayout.setSizeFull(); criteriaLayout.setSizeFull(); buttonLayout.setSpacing(true); buttonLayout.addComponent(btnAdd); buttonLayout.addComponent(btnCancel); buttonLayout.setComponentAlignment(btnAdd, Alignment.BOTTOM_RIGHT); buttonLayout.setComponentAlignment(btnCancel, Alignment.BOTTOM_RIGHT); buttonLayout.setExpandRatio(btnAdd, 1f); buttonLayout.setExpandRatio(btnCancel, 0f); buttonLayout.setSizeFull(); mainLayout.setRowExpandRatio(0, 1f); mainLayout.setRowExpandRatio(1, 1f); mainLayout.setRowExpandRatio(2, 1f); mainLayout.setSizeFull(); window.addComponent(mainLayout); window.getContent().setSizeFull(); }
From source file:com.openhris.commons.reports.AdvancesReport.java
public void openAdvancesReport() { Connection conn = getConnection.connection(); File reportFile = new File("C:/reportsJasper/AdvancesReport.jasper"); final HashMap hm = new HashMap(); hm.put("CORPORATE", getCorporate()); hm.put("PAYROLL_DATE", getPayrollDate()); Window subWindow = new Window("Advances Report"); ((VerticalLayout) subWindow.getContent()).setSizeFull(); subWindow.setWidth("800px"); subWindow.setHeight("600px"); subWindow.center();/*from w w w .j ava 2s. c om*/ try { JasperPrint jpReport = JasperFillManager.fillReport(reportFile.getAbsolutePath(), hm, conn); SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS"); String timestamp = df.format(new Date()); final String filePath = "C:/reportsPdf/AdvancesReport_" + timestamp + ".pdf"; JasperExportManager.exportReportToPdfFile(jpReport, filePath); StreamResource.StreamSource source = new StreamResource.StreamSource() { @Override public InputStream getStream() { try { File f = new File(filePath); FileInputStream fis = new FileInputStream(f); return fis; } catch (Exception e) { e.getMessage(); return null; } } }; StreamResource resource = new StreamResource(source, filePath, getApplication()); resource.setMIMEType("application/pdf"); Embedded e = new Embedded(); e.setMimeType("application/pdf"); e.setType(Embedded.TYPE_OBJECT); e.setSizeFull(); e.setSource(resource); e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename()); subWindow.addComponent(e); getApplication().getMainWindow().open(resource, "_blank"); } catch (Exception e) { e.getMessage(); } }
From source file:com.purebred.core.MainApplication.java
License:Open Source License
@Override public void init() { setInstance(this); setTheme(mainEntryPoints.getTheme()); customizeConfirmDialogStyle();/*from w w w . ja va2s .c om*/ Window mainWindow = new Window(messageSource.getMessage("mainApplication.caption")); mainWindow.addStyleName("p-main-window"); mainWindow.getContent().setSizeUndefined(); setMainWindow(mainWindow); mainEntryPoints.addStyleName("p-main-entry-points"); mainWindow.addComponent(mainEntryPoints); mainEntryPoints.postWire(); }
From source file:com.purebred.core.MainApplication.java
License:Open Source License
/** * Open separate error Window, useful for showing stacktraces. * * @param message/*from w ww . j av a 2s . c om*/ */ public void openErrorWindow(String message) { Window errorWindow = new Window("Error"); errorWindow.addStyleName("opaque"); VerticalLayout layout = (VerticalLayout) errorWindow.getContent(); layout.setSpacing(true); layout.setWidth("100%"); errorWindow.setWidth("100%"); errorWindow.setModal(true); Label label = new Label(message); label.setContentMode(Label.CONTENT_PREFORMATTED); layout.addComponent(label); errorWindow.setClosable(true); errorWindow.setScrollable(true); MainApplication.getInstance().getMainWindow().addWindow(errorWindow); }
From source file:com.rdonasco.config.web.ConfigApplication.java
License:Apache License
@Override public void init() { Window mainWindow = new Window("rdonasco Config"); setMainWindow(mainWindow);//w ww. j av a 2 s . c om final ConfigDataView controlledView = getConfigDataViewController().getControlledView(); // controlledView.setSizeFull(); final VerticalLayout mainWindowLayout = (VerticalLayout) mainWindow.getContent(); Button logoutButton = new Button("Refresh"); logoutButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { try { getConfigDataViewController().refreshView(); } catch (WidgetException ex) { LOG.log(Level.WARNING, ex.getMessage(), ex); } } }); setTheme("config"); mainWindowLayout.setMargin(true); mainWindowLayout.setSpacing(true); mainWindowLayout.addStyleName("mainWindow"); mainWindowLayout.setSizeFull(); mainWindowLayout.addComponent(logoutButton); mainWindowLayout.addComponent(controlledView); mainWindowLayout.setExpandRatio(controlledView, 1); }
From source file:com.save.employee.maintenance.MRDataGridProperties.java
Window deletConfirmationWindow(int mrId, Object itemId) { Window sub = new Window(); sub.setCaption("CONFIRM DELETE"); sub.setWidth("250px"); sub.setModal(true);/* w ww. ja v a2 s.com*/ VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button deleteBtn = new Button("DELETE?"); deleteBtn.setWidth("100%"); deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); deleteBtn.addClickListener((Button.ClickEvent event) -> { boolean result = mrs.removeMaintenanceReimbursement(mrId); if (result) { getContainerDataSource().removeItem(itemId); sub.close(); } }); v.addComponent(deleteBtn); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.save.employee.request.RequestFormWindow.java
Window deleteRequestForm() { Window sub = new Window("DELETE REQUEST"); sub.setWidth("280px"); sub.setModal(true);//from www .j a va 2 s . c o m sub.center(); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button delete = new Button(); delete.setCaption("CONFIRM DELETE REQUEST?"); delete.setWidth("100%"); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener((Button.ClickEvent event) -> { boolean result = rls.deleteRequestById(getRequestId()); if (result) { sub.close(); close(); } }); v.addComponent(delete); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.save.employee.request.RLDataGridProperties.java
Window deletConfirmationWindow(int rlId, Object itemId) { Window sub = new Window(); sub.setCaption("CONFIRM DELETE"); sub.setWidth("250px"); sub.setModal(true);//w w w. ja v a2 s. c o m VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button deleteBtn = new Button("DELETE?"); deleteBtn.setWidth("100%"); deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); deleteBtn.addClickListener((Button.ClickEvent event) -> { boolean result = rls.deleteRequestById(rlId); if (result) { getContainerDataSource().removeItem(itemId); sub.close(); } }); v.addComponent(deleteBtn); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }