List of usage examples for com.vaadin.ui Window setCaption
@Override public void setCaption(String caption)
From source file:com.snowy.UsersList.java
public UsersList(data d) { this.d = d;//w ww . j a v a2 s.c om c.addContainerProperty("id", Integer.class, ""); retrieveActiveUsers(); //this.addItem("Chase"); //this.addItem("Cole"); //ll.addComponent(ll); //PopupView pop = new PopupView(null,ll); //pop.s //pop.addPopupVisibilityListener(e->{ // ll.addComponent(hl); //}); //TODO add the select listener ls.addValueChangeListener(e -> { if (e.getProperty().getValue() != null) { Window w = new Window("Confirm Challenge"); int id = Integer.parseInt(c.getItem(e.getProperty().getValue().toString()).getItemProperty("id") .getValue().toString()); String Username = e.getProperty().getValue().toString(); //Logger.getLogger(UsersList.class.getName()).info(Username); //Logger.getLogger(UsersList.class.getName()).info(id+""); VerticalLayout ll = new VerticalLayout(); VerticalLayout bb = new VerticalLayout(); HorizontalLayout hl = new HorizontalLayout(); Label la = new Label("Send challenge to " + Username + "?"); bb.addComponent(la); ll.addComponent(bb); ll.setSizeUndefined(); bb.setComponentAlignment(la, Alignment.MIDDLE_CENTER); ll.addComponent(hl); ll.setSpacing(true); ll.setMargin(new MarginInfo(true, true, false, true)); hl.setMargin(new MarginInfo(false, true, true, true)); hl.setSpacing(true); Button cancle = new Button("Cancel", b -> { w.close(); }); Button send = new Button("Send", c -> { if (d.sendChallenge(id)) { ll.removeAllComponents(); ll.addComponent(new Label("Challenge Sent Succesfully!")); ll.addComponent(new Button("Close", dd -> { w.close(); })); w.setCaption("Success"); ll.setSpacing(true); ll.setMargin(true); } else { ll.removeAllComponents(); ll.addComponent(new Label("Challenge Dend Failed")); ll.addComponent(new Button("Close", dd -> { w.close(); })); w.setCaption("Failure"); ll.setSpacing(true); ll.setMargin(true); } }); hl.addComponents(cancle, send); // this.addComponent(pop); // ll.addComponent(la); // pop.setPopupVisible(true); //w.setPosition(null, null); w.center(); w.setModal(true); w.setClosable(false); w.setResizable(false); w.setContent(ll); this.getUI().addWindow(w); } }); this.setSizeFull(); this.addStyleName("mine"); this.addComponent(ls); ls.setContainerDataSource(c); //ls.setContainerDataSource((Container) hm.keySet()); ls.setSizeFull(); ls.setImmediate(true); }
From source file:com.yoncabt.ebr.ui.ReportWindow.java
private void showFields(ReportDefinition definition, final Window w, final FormLayout fl) throws AssertionError, JSONException { fl.removeAllComponents();//ww w. jav a2 s. c o m w.setCaption(definition.getCaption()); for (ReportParam param : definition.getReportParams()) { AbstractField comp = null; if (param.getInputType() == InputType.COMBO) { ComboBox f = new ComboBox(param.getLabel()); param.getLovData().forEach((k, v) -> { f.addItem(k); f.setItemCaption(k, (String) v); }); comp = f; } else { switch (param.getFieldType()) { case STRING: { TextField f = new TextField(param.getLabel()); comp = f; break; } case INTEGER: { TextField f = new TextField(param.getLabel()); f.addValidator(new IntegerRangeValidator("Say kontrol", (Integer) param.getMin(), (Integer) param.getMax())); comp = f; break; } case LONG: { TextField f = new TextField(param.getLabel()); f.addValidator(new LongRangeValidator("Say kontrol", (Long) param.getMin(), (Long) param.getMax())); comp = f; break; } case DOUBLE: { TextField f = new TextField(param.getLabel()); f.addValidator(new DoubleRangeValidator("Say kontrol", (Double) param.getMin(), (Double) param.getMax())); comp = f; break; } case DATE: { DateField f = new DateField(param.getLabel()); f.setDateFormat(param.getFormat()); comp = f; break; } default: { throw new AssertionError(param.getName() + " in tipi tannmyor :" + param.getJavaType()); } } } if (param.getDefaultValue() != null) { comp.setValue(param.getDefaultValue()); } comp.setImmediate(true); comp.setValidationVisible(false); comp.setId(param.getName()); fl.addComponent(comp); } if (report instanceof SQLReport) { reportType.addItem(ReportOutputFormat.xls); reportType.setItemCaption(ReportOutputFormat.xls, ReportOutputFormat.xls.getTypeName()); } else { for (ReportOutputFormat value : ReportOutputFormat.values()) { reportType.addItem(value); reportType.setItemCaption(value, value.getTypeName()); } } reportType.setValue(ReportOutputFormat.xls); fl.addComponent(reportType); fl.addComponent(reportLocale); fl.addComponent(email); }
From source file:de.metas.ui.web.vaadin.report.VaadinJRViewerProvider.java
License:Open Source License
@Override public void openViewer(final byte[] data, final OutputType type, final String title, final ProcessInfo pi) throws JRException { final StreamResource pdfResource = new StreamResource(() -> new ByteArrayInputStream(data), "report.pdf"); final Window window = new Window(); window.setCaption(title); window.setStyleName(STYLE);//w w w . j ava 2s . c o m window.center(); window.setWidth(800, Unit.PIXELS); window.setHeight(600, Unit.PIXELS); final BrowserFrame pdfComp = new BrowserFrame(); pdfComp.setPrimaryStyleName(STYLE + "-content"); pdfComp.setSizeFull(); pdfComp.setSource(pdfResource); window.setContent(pdfComp); UI.getCurrent().addWindow(window); }
From source file:de.symeda.sormas.ui.caze.CaseController.java
License:Open Source License
public void transferCase(CaseDataDto caze) { CaseFacilityChangeForm facilityChangeForm = new CaseFacilityChangeForm(UserRight.CASE_TRANSFER); facilityChangeForm.setValue(caze);// w ww. jav a 2s . c om CommitDiscardWrapperComponent<CaseFacilityChangeForm> facilityChangeView = new CommitDiscardWrapperComponent<CaseFacilityChangeForm>( facilityChangeForm, facilityChangeForm.getFieldGroup()); facilityChangeView.getCommitButton().setCaption(I18nProperties.getCaption(Captions.caseTransferCase)); facilityChangeView.setMargin(true); Window popupWindow = VaadinUiUtil.showPopupWindow(facilityChangeView); popupWindow.setCaption(I18nProperties.getString(Strings.headingTransferCase)); facilityChangeView.addCommitListener(new CommitListener() { @Override public void onCommit() { if (!facilityChangeForm.getFieldGroup().isModified()) { CaseDataDto dto = facilityChangeForm.getValue(); FacadeProvider.getCaseFacade().saveAndTransferCase(dto); popupWindow.close(); Notification.show(I18nProperties.getString(Strings.messageCaseTransfered), Type.WARNING_MESSAGE); SormasUI.refreshView(); } } }); Button cancelButton = new Button(I18nProperties.getCaption(Captions.actionCancel)); cancelButton.setStyleName(ValoTheme.BUTTON_LINK); cancelButton.addClickListener(e -> { popupWindow.close(); }); facilityChangeView.getButtonsPanel().replaceComponent(facilityChangeView.getDiscardButton(), cancelButton); }
From source file:de.symeda.sormas.ui.caze.CaseController.java
License:Open Source License
public void referFromPointOfEntry(CaseDataDto caze) { CaseFacilityChangeForm form = new CaseFacilityChangeForm(UserRight.CASE_REFER_FROM_POE); form.setValue(caze);/* ww w.j av a 2s. c o m*/ CommitDiscardWrapperComponent<CaseFacilityChangeForm> view = new CommitDiscardWrapperComponent<CaseFacilityChangeForm>( form, form.getFieldGroup()); view.getCommitButton().setCaption(I18nProperties.getCaption(Captions.caseReferToFacility)); Window window = VaadinUiUtil.showPopupWindow(view); window.setCaption(I18nProperties.getString(Strings.headingReferCaseFromPointOfEntry)); view.addCommitListener(() -> { if (!form.getFieldGroup().isModified()) { CaseDataDto dto = form.getValue(); dto.getHospitalization().setAdmissionDate(new Date()); FacadeProvider.getCaseFacade().saveCase(dto); window.close(); Notification.show(I18nProperties.getString(Strings.messageCaseReferredFromPoe), Type.ASSISTIVE_NOTIFICATION); SormasUI.refreshView(); } }); Button btnCancel = new Button(I18nProperties.getCaption(Captions.actionCancel)); btnCancel.addClickListener(e -> { window.close(); }); view.getButtonsPanel().replaceComponent(view.getDiscardButton(), btnCancel); }
From source file:de.symeda.sormas.ui.caze.CaseController.java
License:Open Source License
public void openClassificationRulesPopup(CaseDataDto caze) { VerticalLayout classificationRulesLayout = new VerticalLayout(); classificationRulesLayout.setMargin(true); DiseaseClassificationCriteriaDto diseaseCriteria = FacadeProvider.getCaseClassificationFacade() .getByDisease(caze.getDisease()); if (diseaseCriteria != null) { Label suspectContent = new Label(); suspectContent.setContentMode(ContentMode.HTML); suspectContent.setWidth(100, Unit.PERCENTAGE); suspectContent.setValue(ClassificationHtmlRenderer.createSuspectHtmlString(diseaseCriteria)); classificationRulesLayout.addComponent(suspectContent); Label probableContent = new Label(); probableContent.setContentMode(ContentMode.HTML); probableContent.setWidth(100, Unit.PERCENTAGE); probableContent.setValue(ClassificationHtmlRenderer.createProbableHtmlString(diseaseCriteria)); classificationRulesLayout.addComponent(probableContent); Label confirmedContent = new Label(); confirmedContent.setContentMode(ContentMode.HTML); confirmedContent.setWidth(100, Unit.PERCENTAGE); confirmedContent.setValue(ClassificationHtmlRenderer.createConfirmedHtmlString(diseaseCriteria)); classificationRulesLayout.addComponent(confirmedContent); }/*from ww w .j a va2 s.co m*/ Window popupWindow = VaadinUiUtil.showPopupWindow(classificationRulesLayout); popupWindow.addCloseListener(e -> { popupWindow.close(); }); popupWindow.setWidth(860, Unit.PIXELS); popupWindow.setHeight(80, Unit.PERCENTAGE); popupWindow.setCaption( I18nProperties.getString(Strings.classificationRulesFor) + " " + caze.getDisease().toString()); }
From source file:de.symeda.sormas.ui.caze.CasesView.java
License:Open Source License
public CasesView() { super(VIEW_NAME); originalViewTitle = getViewTitleLabel().getValue(); criteria = ViewModelProviders.of(CasesView.class).get(CaseCriteria.class); if (criteria.getArchived() == null) { criteria.archived(false);/*from w ww. j a va 2s . c om*/ } grid = new CaseGrid(); grid.setCriteria(criteria); gridLayout = new VerticalLayout(); gridLayout.addComponent(createFilterBar()); gridLayout.addComponent(createStatusFilterBar()); gridLayout.addComponent(grid); gridLayout.setMargin(true); gridLayout.setSpacing(false); gridLayout.setSizeFull(); gridLayout.setExpandRatio(grid, 1); gridLayout.setStyleName("crud-main-layout"); grid.getDataProvider().addDataProviderListener(e -> updateStatusButtons()); if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_IMPORT)) { Button importButton = new Button(I18nProperties.getCaption(Captions.actionImport)); importButton.addStyleName(ValoTheme.BUTTON_PRIMARY); importButton.setIcon(VaadinIcons.UPLOAD); importButton.addClickListener(e -> { Window popupWindow = VaadinUiUtil.showPopupWindow(new CaseImportLayout()); popupWindow.setCaption(I18nProperties.getString(Strings.headingImportCases)); popupWindow.addCloseListener(c -> { grid.reload(); }); }); addHeaderComponent(importButton); } if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_EXPORT)) { PopupButton exportButton = new PopupButton(I18nProperties.getCaption(Captions.export)); exportButton.setId("export"); exportButton.setIcon(VaadinIcons.DOWNLOAD); VerticalLayout exportLayout = new VerticalLayout(); exportLayout.setSpacing(true); exportLayout.setMargin(true); exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL); exportLayout.setWidth(200, Unit.PIXELS); exportButton.setContent(exportLayout); addHeaderComponent(exportButton); Button basicExportButton = new Button(I18nProperties.getCaption(Captions.exportBasic)); basicExportButton.setId("basicExport"); basicExportButton.setDescription(I18nProperties.getString(Strings.infoBasicExport)); basicExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); basicExportButton.setIcon(VaadinIcons.TABLE); basicExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(basicExportButton); StreamResource streamResource = new GridExportStreamResource(grid, "sormas_cases", "sormas_cases_" + DateHelper.formatDateForExport(new Date()) + ".csv"); FileDownloader fileDownloader = new FileDownloader(streamResource); fileDownloader.extend(basicExportButton); Button extendedExportButton = new Button(I18nProperties.getCaption(Captions.exportDetailed)); extendedExportButton.setId("extendedExport"); extendedExportButton.setDescription(I18nProperties.getString(Strings.infoDetailedExport)); extendedExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); extendedExportButton.setIcon(VaadinIcons.FILE_TEXT); extendedExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(extendedExportButton); StreamResource extendedExportStreamResource = DownloadUtil.createCsvExportStreamResource( CaseExportDto.class, (Integer start, Integer max) -> FacadeProvider.getCaseFacade() .getExportList(UserProvider.getCurrent().getUuid(), grid.getCriteria(), start, max), (propertyId, type) -> { String caption = I18nProperties.getPrefixCaption(CaseExportDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(SymptomsDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(EpiDataDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption( HospitalizationDto.I18N_PREFIX, propertyId)))))); if (Date.class.isAssignableFrom(type)) { caption += " (" + DateHelper.getLocalShortDatePattern() + ")"; } return caption; }, "sormas_cases_" + DateHelper.formatDateForExport(new Date()) + ".csv"); new FileDownloader(extendedExportStreamResource).extend(extendedExportButton); Button sampleExportButton = new Button(I18nProperties.getCaption(Captions.exportSamples)); sampleExportButton.setId("sampleExport"); sampleExportButton.setDescription(I18nProperties.getString(Strings.infoSampleExport)); sampleExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); sampleExportButton.setIcon(VaadinIcons.FILE_TEXT); sampleExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(sampleExportButton); StreamResource sampleExportStreamResource = DownloadUtil.createCsvExportStreamResource( SampleExportDto.class, (Integer start, Integer max) -> FacadeProvider.getSampleFacade() .getExportList(UserProvider.getCurrent().getUuid(), grid.getCriteria(), start, max), (propertyId, type) -> { String caption = I18nProperties.getPrefixCaption(SampleExportDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(SampleDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption( AdditionalTestDto.I18N_PREFIX, propertyId))))); if (Date.class.isAssignableFrom(type)) { caption += " (" + DateHelper.getLocalShortDatePattern() + ")"; } return caption; }, "sormas_samples_" + DateHelper.formatDateForExport(new Date()) + ".csv"); new FileDownloader(sampleExportStreamResource).extend(sampleExportButton); // Warning if no filters have been selected Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters), ContentMode.HTML); warningLabel.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(warningLabel); warningLabel.setVisible(false); exportButton.addClickListener(e -> { warningLabel.setVisible(!criteria.hasAnyFilterActive()); }); } if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_MERGE)) { Button mergeDuplicatesButton = new Button(I18nProperties.getCaption(Captions.caseMergeDuplicates)); mergeDuplicatesButton.setId("mergeDuplicates"); mergeDuplicatesButton.setIcon(VaadinIcons.COMPRESS_SQUARE); mergeDuplicatesButton .addClickListener(e -> ControllerProvider.getCaseController().navigateToMergeCasesView()); addHeaderComponent(mergeDuplicatesButton); } if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_CREATE)) { createButton = new Button(I18nProperties.getCaption(Captions.caseNewCase)); createButton.setId("create"); createButton.addStyleName(ValoTheme.BUTTON_PRIMARY); createButton.setIcon(VaadinIcons.PLUS_CIRCLE); createButton.addClickListener(e -> ControllerProvider.getCaseController().create()); addHeaderComponent(createButton); } addComponent(gridLayout); }
From source file:de.symeda.sormas.ui.dashboard.map.DashboardMapComponent.java
License:Open Source License
private void onMarkerClicked(String groupId, int markerIndex) { switch (groupId) { case CASES_GROUP_ID: if (markerIndex < markerCaseFacilities.size()) { FacilityReferenceDto facility = markerCaseFacilities.get(markerIndex); VerticalLayout layout = new VerticalLayout(); Window window = VaadinUiUtil.showPopupWindow(layout); CasePopupGrid caseGrid = new CasePopupGrid(window, facility, DashboardMapComponent.this); caseGrid.setHeightMode(HeightMode.ROW); layout.addComponent(caseGrid); layout.setMargin(true);/*from w w w . j a v a 2s. c om*/ FacilityDto facilityDto = FacadeProvider.getFacilityFacade().getByUuid(facility.getUuid()); window.setCaption( I18nProperties.getCaption(Captions.dashboardCasesIn) + " " + facilityDto.toString()); } else { markerIndex -= markerCaseFacilities.size(); MapCaseDto caze = mapCaseDtos.get(markerIndex); ControllerProvider.getCaseController().navigateToCase(caze.getUuid(), true); } break; case CONTACTS_GROUP_ID: { MapContactDto contact = markerContacts.get(markerIndex); ControllerProvider.getContactController().navigateToData(contact.getUuid(), true); } break; case EVENTS_GROUP_ID: { DashboardEventDto event = markerEvents.get(markerIndex); ControllerProvider.getEventController().navigateToData(event.getUuid(), true); } break; } }
From source file:de.symeda.sormas.ui.reports.WeeklyReportOfficersGrid.java
License:Open Source License
@Override public void itemClick(ItemClickEvent event) { if (event.getPropertyId().equals(VIEW_DETAILS_BTN_ID)) { WeeklyReportOfficerSummaryDto summaryDto = (WeeklyReportOfficerSummaryDto) event.getItemId(); if (summaryDto.getInformants() > 0) { VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined();//from ww w . j a v a 2 s . c o m layout.setMargin(true); Window window = VaadinUiUtil.showPopupWindow(layout); WeeklyReportInformantsGrid grid = new WeeklyReportInformantsGrid(summaryDto.getOfficer(), new EpiWeek(year, week)); grid.setWidth(960, Unit.PIXELS); grid.setHeightMode(HeightMode.ROW); grid.setHeightUndefined(); layout.addComponent(grid); window.setCaption(String.format(I18nProperties.getCaption(Captions.weeklyReportsInDistrict), summaryDto.getDistrict().toString()) + " - " + I18nProperties.getString(Strings.epiWeek) + " " + week + "/" + year); } } }
From source file:de.symeda.sormas.ui.reports.WeeklyReportRegionsGrid.java
License:Open Source License
@Override public void itemClick(ItemClickEvent event) { if (event.getPropertyId().equals(VIEW_DETAILS_BTN_ID)) { WeeklyReportRegionSummaryDto summaryDto = (WeeklyReportRegionSummaryDto) event.getItemId(); VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined();// w w w .j a v a 2s .c o m layout.setMargin(true); Window window = VaadinUiUtil.showPopupWindow(layout); WeeklyReportOfficersGrid grid = new WeeklyReportOfficersGrid(); grid.reload(summaryDto.getRegion(), year, week); grid.setWidth(1600, Unit.PIXELS); grid.setHeightMode(HeightMode.ROW); grid.setHeightUndefined(); layout.addComponent(grid); window.setCaption(String.format(I18nProperties.getCaption(Captions.weeklyReportsInDistrict), summaryDto.getRegion().toString()) + " - " + I18nProperties.getString(Strings.epiWeek) + " " + week + "/" + year); } }