@Override protected void onFormOpen(Object[] args) throws PresentationLogicException { if(args == null || args.length == 0) throw new PresentationLogicException("No template was assigned to this form !"); TemplateBoRefVo templateRef = (TemplateBoRefVo) args[0]; //templateRef.setID_TemplateBo(new Integer(2)); ReportVo report = domain.getReport(templateRef); form.getLocalContext().setTemplateRef(templateRef); //wdev-16393 if(report == null) { form.htmReport().setHTML("<br><br><br><br><center><b>I could not get report for template id = " + templateRef.getID_TemplateBo() + "</b></center>"); return; } form.getLocalContext().setCurrentReport(report); //form.getLocalContext().setTemplateRef(templateRef); createSeedColumns(); populateDynamicGrid(report.getReportXml()); populateSeedsFromContext(); }
protected void onBtnBuildClick() throws ims.framework.exceptions.PresentationLogicException { TreeNode node = form.treTemplate().getSelectedNode(); if (node == null || node.getParent() == null) { engine.showMessage("Please select at template !"); return; } form.getGlobalContext().Core.setCurrentFormName(engine.getPreviousNonDialogFormName()); form.getGlobalContext().Core.setReportID(((ReportVo) node.getParent().getValue()).getID_ReportBo()); form.getGlobalContext().Core.setTemplateID(((ReportTemplateVo) node.getValue()).getID_TemplateBo()); if (form.getGlobalContext().Core.getAutoOpenViewReportIsNotNull() && form.getGlobalContext().Core.getAutoOpenViewReport().equals(Boolean.TRUE)) engine.open(form.getForms().Core.ViewReport); engine.close(DialogResult.OK); }
private grdReportsToPrintRow getParentRowById(ReportVo report) { if (report == null) return null; for (int i = 0; i < form.grdReportsToPrint().getRows().size(); i++) { ReportVo rep = (ReportVo) form.grdReportsToPrint().getRows().get(i).getValue(); if (form.grdReportsToPrint().getRows().get(i).getValue() instanceof ReportVo) { if (rep.getID_ReportBo().equals(report.getID_ReportBo())) return form.grdReportsToPrint().getRows().get(i); } } return null; }
private ReportVo getJobReport(Integer id) { if(form.getLocalContext().getReportsAvailableIsNotNull()) { for(int i=0; i<form.getLocalContext().getReportsAvailable().size(); i++) { ReportVo currentReport = form.getLocalContext().getReportsAvailable().get(i); if(id.equals(currentReport.getImsId())) { return currentReport; } } } return null; }
private ReportVoCollection getValidReps(Integer formId) { ReportVoCollection coll = new ReportVoCollection(); ReportVoCollection fullColl = form.getLocalContext().getRepColl(); if(fullColl != null) { for (int i = 0; i < fullColl.size(); i++) { ReportVo repVo = fullColl.get(i); IReportSeed[] iSeeds = getIseeds(repVo); if (engine.canFormProvideData(getFormNameFromId(formId.intValue()), iSeeds)) { coll.add(repVo); } } } return coll; }
@Override protected void onBtnAssignAllClick() throws PresentationLogicException { for(int i = 0; i < form.grdAvailableReports().getRows().size(); i++) { ReportVo value = form.grdAvailableReports().getRows().get(i).getValue(); if(!hasValue(value)) { grdReportListRow row = form.grdReportList().getRows().newRow(); row.setReportName(value.getReportName()); row.setValue(value); } } }
@Override protected void onBtnAssignClick() throws PresentationLogicException { ReportVo value = form.grdAvailableReports().getValue(); if(value == null) { engine.showMessage("Please select a report to assign !"); return; } if(!hasValue(value)) { grdReportListRow row = form.grdReportList().getRows().newRow(); row.setReportName(value.getReportName()); row.setValue(value); } else { engine.showMessage("The selected report is already assigned to '" + form.qmbFormName().getEditedText() + "' form !"); return; } }
private ReportVo getReportByImsId(String imsId) { StringBuffer hql = new StringBuffer(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Integer> values = new ArrayList<Integer>(); hql.append("from ReportBo as report where report.ImsId =:imsId"); markers.add("imsId"); values.add(new Integer(imsId).intValue()); DomainFactory factory = getDomainFactory(); List list = factory.find(hql.toString(), markers, values); ReportVoCollection result = ReportVoAssembler.createReportVoCollectionFromReportBo(list); return result != null ? result.get(0) : null; }
@Override protected void onFormOpen(Object[] args) throws PresentationLogicException { if(args == null || args.length == 0) throw new PresentationLogicException("This form should not be added to navigation as a standalone form. The report that needs to be displayed should be added to navigation."); TemplateBoRefVo templateRef = (TemplateBoRefVo) args[0]; //templateRef.setID_TemplateBo(new Integer(2)); ReportVo report = domain.getReport(templateRef); form.getLocalContext().setTemplateRef(templateRef); //wdev-16393 if(report == null) { form.htmReport().setHTML("<br><br><br><br><center><b>I couldn't get report for template with id " + templateRef.getID_TemplateBo() + "</b></center>"); return; } form.getLocalContext().setCurrentReport(report); //form.getLocalContext().setTemplateRef(templateRef); createSeedColumns(); populateDynamicGrid(report.getReportXml()); populateSeedsFromContext(); }
private boolean canBeSeeded(ReportVo report) { //reports without seeds can always be printed if(!report.getSeedsIsNotNull()) return true; if(report.getSeeds().size() == 0) return true; ReportSeedVo voReportSeed = new ReportSeedVo(); return engine.formHasData(engine.getPreviousNonDialogFormName(), voReportSeed.getIseeds(report.getSeeds())); }
private void open() { ReportVoCollection coll = domain.listReports(new Integer(engine.getPreviousNonDialogFormName().getID())); for(int i = 0; i < coll.size(); i++) { ReportVo report = coll.get(i); if(canBeSeeded(report) && report.getTemplatesIsNotNull() && report.getTemplates().size() > 0) { grdReportsRow row = form.grdReports().getRows().newRow(); row.setBackColor(Color.Beige); row.setcolName(report.getReportName()); row.setcolDescription(report.getReportDescription()); row.setValue(report); for (int j = 0; j < report.getTemplates().size(); j++) { ReportTemplateVo template = report.getTemplates().get(j); grdReportsRow templateRow = row.getRows().newRow(); templateRow.setcolName(template.getName()); templateRow.setcolDescription(template.getDescription()); templateRow.setValue(template); } row.setExpanded(true); } } if(form.grdReports().getRows().size() == 1 && form.grdReports().getRows().get(0).getRows().size() == 1) form.grdReports().setValue(form.grdReports().getRows().get(0).getRows().get(0).getValue()); }
private void displayAvailableReports(ReportVoCollection coll, PrintAgentVo printAgentVo) { form.grdReportsAvailable().getRows().clear(); for (int i = 0; i < coll.size(); i++) { ReportVo rep = coll.get(i); if (rep.getTemplatesIsNotNull() && bHasActiveTemplates(rep)) { grdReportsAvailableRow row = form.grdReportsAvailable().getRows().newRow(); row.setColumnReport(rep.getReportName()); row.setTooltip(rep.getReportDescription()); row.setBold(true); row.setBackColor(Color.Beige); row.setValue(rep); for (int j = 0; j < rep.getTemplates().size(); j++) { if (rep.getTemplates().get(j).getIsActiveIsNotNull() && rep.getTemplates().get(j).getIsActive().equals(Boolean.TRUE) && isTemplateAlreadySelected(rep.getTemplates().get(j), printAgentVo) == false) { grdReportsAvailableRow child = row.getRows().newRow(); child.setColumnReport(rep.getTemplates().get(j).getName()); child.setTooltip(rep.getTemplates().get(j).getDescription()); child.setValue(rep.getTemplates().get(j)); } } row.setExpanded(true); if (row.getRows().size() == 0) { form.grdReportsAvailable().setValue(row.getValue()); form.grdReportsAvailable().removeSelectedRow(); } } } }
private boolean bHasActiveTemplates(ReportVo rep) { if (!rep.getTemplatesIsNotNull()) return false; boolean bHasActiveTemplate = false; for (int j = 0; j < rep.getTemplates().size(); j++) { if (rep.getTemplates().get(j).getIsActiveIsNotNull() && rep.getTemplates().get(j).getIsActive().equals(Boolean.TRUE)) return true; } return bHasActiveTemplate; }
private void displaySelectedTemplates(PrintAgentVo agent) { form.grdReportsToPrint().getRows().clear(); if (agent == null || agent.getTemplatesToPrintIsNotNull() == false) return; for (int i = 0; i < agent.getTemplatesToPrint().size(); i++) { TemplatePrinterVo tp = agent.getTemplatesToPrint().get(i); grdReportsToPrintRow parentRow = getParentRowById(tp.getTemplate().getReport()); if (parentRow == null) { ReportVo rep = tp.getTemplate().getReport(); parentRow = form.grdReportsToPrint().getRows().newRow(); parentRow.setColumnReport(rep.getReportName()); parentRow.setTooltip(rep.getReportDescription()); parentRow.setBold(true); parentRow.setBackColor(Color.Beige); parentRow.setValue(rep); parentRow.setExpanded(true); } grdReportsToPrintRow child = parentRow.getRows().newRow(); child.setColumnReport(tp.getTemplate().getName()); child.setColumnPrintTo(tp.getPrinterName()); child.setColumnPrintToReadOnly(false); child.setTooltip(tp.getTemplate().getDescription()); child.setValue(tp); } }
private void populateReports(ReportVoCollection repColl) { for (int i = 0; i < repColl.size(); i++) { ReportVo rep = repColl.get(i); GenForm.grdReportListRow row = form.grdReportList().getRows().newRow(); row.setReportName(rep.getReportName()); //row.setRepAssign(false); row.setValue(rep); } }
private void populateReportsGridAssignment(ReportVoCollection coll) { form.grdReportList().getRows().clear(); for (int i = 0; i < coll.size(); i++) { ReportVo rep = coll.get(i); GenForm.grdReportListRow row = form.grdReportList().getRows().newRow(); row.setReportName(rep.getReportName()); row.setValue(rep); } }