List of usage examples for org.apache.poi.xwpf.usermodel ParagraphAlignment LEFT
ParagraphAlignment LEFT
To view the source code for org.apache.poi.xwpf.usermodel ParagraphAlignment LEFT.
Click Source Link
From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java
License:Open Source License
private void createTableH() { List<List<POIField>> headers = new ArrayList<>(); POIField[] sHeader = {//from ww w . jav a 2 s. c o m new POIField(this.getText("summaries.annualReport.tableG.crpName"), ParagraphAlignment.LEFT), new POIField(this.getText("summaries.annualReport.tableG.description"), ParagraphAlignment.LEFT), new POIField(this.getText("summaries.annualReport.tableG.relevantFP"), ParagraphAlignment.LEFT) }; List<POIField> header = Arrays.asList(sHeader); headers.add(header); List<List<POIField>> datas = new ArrayList<>(); List<POIField> data; List<ReportSynthesisCrossCgiarCollaboration> reportSynthesisCrossCgiarCollaborationList = reportSynthesisCrossCgiarCollaborationManager .getFlagshipCollaborations(flagshipLiaisonInstitutions, this.getSelectedPhase().getId()); if (reportSynthesisCrossCgiarCollaborationList != null && !reportSynthesisCrossCgiarCollaborationList.isEmpty()) { for (ReportSynthesisCrossCgiarCollaboration reportSynthesisCrossCgiarCollaboration : reportSynthesisCrossCgiarCollaborationList) { String crpPlatform = " ", descriptionCollaboration = " ", relevantFP = " "; if (reportSynthesisCrossCgiarCollaboration.getGlobalUnit().getAcronym() != null) { crpPlatform = reportSynthesisCrossCgiarCollaboration.getGlobalUnit().getAcronym(); } if (reportSynthesisCrossCgiarCollaboration.getDescription() != null) { descriptionCollaboration = reportSynthesisCrossCgiarCollaboration.getDescription(); } if (reportSynthesisCrossCgiarCollaboration.getFlagship() != null) { relevantFP = reportSynthesisCrossCgiarCollaboration.getFlagship(); } POIField[] sData = { new POIField(crpPlatform, ParagraphAlignment.CENTER), new POIField(descriptionCollaboration, ParagraphAlignment.LEFT), new POIField(relevantFP, ParagraphAlignment.LEFT) }; data = Arrays.asList(sData); datas.add(data); } } poiSummary.textTable(document, headers, datas, false, "tableAAnnualReport"); }
From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java
License:Open Source License
private void createTableI1() { List<List<POIField>> headers = new ArrayList<>(); List<List<POIField>> datas = new ArrayList<>(); List<POIField> data;/*from w w w . j a v a 2 s .co m*/ POIField[] sHeader = { new POIField( this.getText("annualReport.melia.tableI.studies", new String[] { String.valueOf(this.getSelectedYear()) }), ParagraphAlignment.CENTER), new POIField(this.getText("annualReport.melia.tableI.status"), ParagraphAlignment.CENTER), new POIField(this.getText("annualReport.melia.tableI.comments"), ParagraphAlignment.CENTER) }; List<POIField> header = Arrays.asList(sHeader); headers.add(header); List<LiaisonInstitution> liaisonInstitutionsList = new ArrayList<>(this.getLoggedCrp() .getLiaisonInstitutions().stream() .filter(c -> c.getCrpProgram() != null && c.isActive() && c.getCrpProgram().getProgramType() == ProgramType.FLAGSHIP_PROGRAM_TYPE.getValue()) .collect(Collectors.toList())); liaisonInstitutionsList.sort(Comparator.comparing(LiaisonInstitution::getAcronym)); flagshipPlannedList = reportSynthesisMeliaManager.getMeliaPlannedList(liaisonInstitutionsList, this.getSelectedPhase().getId(), this.getLoggedCrp(), pmuInstitution); if (flagshipPlannedList != null && !flagshipPlannedList.isEmpty()) { for (int i = 0; i < flagshipPlannedList.size(); i++) { String studies = "", status = "", comments = ""; studies = flagshipPlannedList.get(i).getProjectExpectedStudy() .getProjectExpectedStudyInfo(this.getSelectedPhase()).getTitle(); status = flagshipPlannedList.get(i).getProjectExpectedStudy() .getProjectExpectedStudyInfo(this.getSelectedPhase()).getStatusName(); if (flagshipPlannedList.get(i).getProjectExpectedStudy() .getProjectExpectedStudyInfo(this.getSelectedPhase()).getTopLevelComments() != null) { comments = flagshipPlannedList.get(i).getProjectExpectedStudy() .getProjectExpectedStudyInfo(this.getSelectedPhase()).getTopLevelComments(); } POIField[] sData = { new POIField(studies, ParagraphAlignment.LEFT), new POIField(status, ParagraphAlignment.CENTER), new POIField(comments, ParagraphAlignment.LEFT) }; data = Arrays.asList(sData); datas.add(data); } } poiSummary.textTable(document, headers, datas, false, "tableIAnnualReport"); }
From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java
License:Open Source License
private void createTableI2() { List<List<POIField>> headers = new ArrayList<>(); POIField[] sHeader = {/*from w ww . ja va 2s .co m*/ new POIField(this.getText("annualReport.melia.evaluation.name"), ParagraphAlignment.CENTER), new POIField(this.getText("annualReport.melia.evaluation.recommendation"), ParagraphAlignment.CENTER), new POIField(this.getText("annualReport.melia.evaluation.managementResponse") + " - Action Plan", ParagraphAlignment.CENTER), new POIField(this.getText("annualReport.melia.evaluation.whom"), ParagraphAlignment.CENTER), new POIField(this.getText("annualReport.melia.evaluation.when"), ParagraphAlignment.CENTER), new POIField(this.getText("summaries.annualReport.tableI2.field6"), ParagraphAlignment.CENTER) }; List<POIField> header = Arrays.asList(sHeader); headers.add(header); List<List<POIField>> datas = new ArrayList<>(); List<POIField> data; if (reportSynthesisPMU.getReportSynthesisMelia().getReportSynthesisMeliaEvaluations() != null && !reportSynthesisPMU.getReportSynthesisMelia().getReportSynthesisMeliaEvaluations().isEmpty()) { List<ReportSynthesisMeliaEvaluation> reportSynthesisMeliaEvaluationList = reportSynthesisPMU .getReportSynthesisMelia().getReportSynthesisMeliaEvaluations().stream() .filter(e -> e.isActive()).collect(Collectors.toList()); for (ReportSynthesisMeliaEvaluation reportSynthesisMeliaEvaluation : reportSynthesisMeliaEvaluationList) { String nameEvaluation = "", recommendation = "", response = "", whom = "", when = "", status = ""; if (reportSynthesisMeliaEvaluation.getNameEvaluation() != null) { nameEvaluation = reportSynthesisMeliaEvaluation.getNameEvaluation(); } if (reportSynthesisMeliaEvaluation.getRecommendation() != null) { recommendation = reportSynthesisMeliaEvaluation.getRecommendation(); } if (reportSynthesisMeliaEvaluation.getManagementResponse() != null) { response = reportSynthesisMeliaEvaluation.getManagementResponse(); } if (reportSynthesisMeliaEvaluation.getTextWhom() != null) { whom = reportSynthesisMeliaEvaluation.getTextWhom(); } if (reportSynthesisMeliaEvaluation.getTextWhen() != null) { when = reportSynthesisMeliaEvaluation.getTextWhen(); } if (reportSynthesisMeliaEvaluation.getStatus() != null && reportSynthesisMeliaEvaluation.getStatus() != -1) { int temp = Integer.parseInt(reportSynthesisMeliaEvaluation.getStatus().toString()); status = ProjectStatusEnum.getValue(temp).getStatus(); } POIField[] sData = { new POIField(nameEvaluation, ParagraphAlignment.CENTER), new POIField(recommendation, ParagraphAlignment.LEFT), new POIField(response, ParagraphAlignment.LEFT), new POIField(whom, ParagraphAlignment.LEFT), new POIField(when, ParagraphAlignment.LEFT), new POIField(status, ParagraphAlignment.LEFT) }; data = Arrays.asList(sData); datas.add(data); } } poiSummary.textTable(document, headers, datas, false, "tableIAnnualReport"); }
From source file:org.cgiar.ccafs.marlo.action.summaries.POWBPOISummaryAction.java
License:Open Source License
public void createTableA1() { List<List<POIField>> headers = new ArrayList<>(); POIField[] sHeader = { new POIField(this.getText("expectedProgress.tableA.fp"), ParagraphAlignment.CENTER), new POIField(this.getText("expectedProgress.tableA.subIDO"), ParagraphAlignment.CENTER), new POIField(this.getText("summaries.powb.tableA1.outcomes"), ParagraphAlignment.CENTER), new POIField(this.getSelectedYear() + " Budget " + this.getText("expectedProgress.tableA.w1w2"), ParagraphAlignment.CENTER), new POIField( this.getSelectedYear() + " Budget " + this.getText("expectedProgress.tableA.w3bilateral"), ParagraphAlignment.CENTER) }; List<POIField> header = Arrays.asList(sHeader); headers.add(header);// w w w.ja va 2 s .c o m String FP, subIDO = "", outcomes; List<List<POIField>> datas = new ArrayList<>(); List<POIField> data; for (CrpProgram flagship : flagships) { int flagshipIndex = 0; data = new ArrayList<>(); for (CrpProgramOutcome outcome : flagship.getOutcomes()) { subIDO = ""; for (CrpOutcomeSubIdo subIdo : outcome.getSubIdos()) { if (subIdo.getSrfSubIdo() != null) { if (subIDO.isEmpty()) { if (subIdo.getSrfSubIdo().getSrfIdo().isIsCrossCutting()) { subIDO = " CC " + subIdo.getSrfSubIdo().getDescription(); } else { subIDO = " " + subIdo.getSrfSubIdo().getDescription(); } } else { if (subIdo.getSrfSubIdo().getSrfIdo().isIsCrossCutting()) { subIDO += "\n CC " + subIdo.getSrfSubIdo().getDescription(); } else { subIDO += "\n " + subIdo.getSrfSubIdo().getDescription(); } } } } outcomes = outcome.getComposedName(); if (flagshipIndex == 0) { FP = flagship.getAcronym(); } else { FP = " "; } Boolean bold = false; String blackColor = "000000"; String redColor = "c00000"; POIField[] sData = { new POIField(FP, ParagraphAlignment.CENTER, bold, blackColor), new POIField(subIDO, ParagraphAlignment.LEFT, bold, blackColor), new POIField(outcomes, ParagraphAlignment.LEFT, bold, blackColor), new POIField("To be completed", ParagraphAlignment.CENTER, bold, redColor), new POIField("To be completed", ParagraphAlignment.CENTER, bold, redColor) }; data = Arrays.asList(sData); datas.add(data); flagshipIndex++; } } poiSummary.textTable(document, headers, datas, false, "tableA"); }
From source file:org.cgiar.ccafs.marlo.action.summaries.POWBPOISummaryAction.java
License:Open Source License
private void createTableA2() { List<List<POIField>> headers = new ArrayList<>(); POIField[] sHeader = { new POIField(this.getText("expectedProgress.tableA.fp"), ParagraphAlignment.CENTER), new POIField(this.getText("summaries.powb.tableA1.outcomes"), ParagraphAlignment.CENTER), new POIField(this.getText("expectedProgress.tableA.milestone") + "*", ParagraphAlignment.CENTER), new POIField(this.getText("expectedProgress.tableA.meansVerification"), ParagraphAlignment.CENTER), new POIField(this.getText("expectedProgress.tableA.assessment"), ParagraphAlignment.CENTER) }; List<POIField> header = Arrays.asList(sHeader); headers.add(header);//w w w .j ava2 s . c o m String FP, outcomes, milestone, assessment, meansVerifications; List<List<POIField>> datas = new ArrayList<>(); List<POIField> data; for (CrpProgram flagship : flagships) { data = new ArrayList<>(); int outcome_index = 0; for (CrpProgramOutcome outcome : flagship.getOutcomes()) { int milestone_index = 0; for (CrpMilestone crpMilestone : outcome.getMilestones()) { Boolean isFlagshipRow = (outcome_index == 0) && (milestone_index == 0); Boolean isOutcomeRow = (milestone_index == 0); if (isFlagshipRow) { FP = flagship.getAcronym(); } else { FP = " "; } if (isOutcomeRow) { outcomes = outcome.getComposedName(); } else { outcomes = " "; } milestone = crpMilestone.getComposedName(); PowbExpectedCrpProgress milestoneProgress = this .getPowbExpectedCrpProgressProgram(crpMilestone.getId(), flagship.getId()); assessment = milestoneProgress.getAssesmentName() != null && !milestoneProgress.getAssesmentName().trim().isEmpty() ? milestoneProgress.getAssesmentName() : " "; meansVerifications = milestoneProgress.getMeans() != null && !milestoneProgress.getMeans().trim().isEmpty() ? milestoneProgress.getMeans() : " "; POIField[] sData = { new POIField(FP, ParagraphAlignment.CENTER), new POIField(outcomes, ParagraphAlignment.LEFT), new POIField(milestone, ParagraphAlignment.LEFT), new POIField(meansVerifications, ParagraphAlignment.LEFT), new POIField(assessment, ParagraphAlignment.CENTER) }; data = Arrays.asList(sData); datas.add(data); milestone_index++; } outcome_index++; } } poiSummary.textTable(document, headers, datas, false, "tableA"); }
From source file:org.cgiar.ccafs.marlo.action.summaries.POWBPOISummaryAction.java
License:Open Source License
private void createTableB() { List<List<POIField>> headers = new ArrayList<>(); POIField[] sHeader = {/*from w w w . j a v a 2s. co m*/ new POIField(this.getText("evidenceRelevant.table.plannedTopic"), ParagraphAlignment.CENTER), new POIField(this.getText("evidenceRelevant.tablePlannedStudies.geographicScope"), ParagraphAlignment.CENTER), new POIField(this.getText("evidenceRelevant.tablePlannedStudies.relevant"), ParagraphAlignment.CENTER), new POIField(this.getText("evidenceRelevant.tablePlannedStudies.comments"), ParagraphAlignment.CENTER) }; List<POIField> header = Arrays.asList(sHeader); headers.add(header); List<List<POIField>> datas = new ArrayList<>(); List<POIField> data; this.getFpPlannedList(this.getFlagships(), this.getSelectedPhase().getId()); for (PowbEvidencePlannedStudyDTO powbEvidencePlannedStudyDTO : flagshipPlannedList.stream().filter(p -> p .getProjectExpectedStudy() != null && p.getProjectExpectedStudy().getType() != null && (p.getProjectExpectedStudy().getType() == TypeExpectedStudiesEnum.OUTCOMECASESTUDY.getId() || p.getProjectExpectedStudy().getType() == TypeExpectedStudiesEnum.IMPACTASSESMENT.getId() || p.getProjectExpectedStudy().getType() == TypeExpectedStudiesEnum.ADOPTIONSTUDY.getId())) .collect(Collectors.toList())) { String plannedStudy = "", geographicScope = "", revelantSubIDO = "", comments = ""; plannedStudy = powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getTopicStudy() != null && !powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getTopicStudy().trim().isEmpty() ? powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getTopicStudy() : " "; geographicScope = powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getScopeName() != null && !powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getScopeName().trim().isEmpty() ? powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getScopeName() : " "; if (powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getSrfSubIdo() != null && powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getSrfSubIdo().getDescription() != null && !powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getSrfSubIdo().getDescription().trim() .isEmpty()) { revelantSubIDO += " " + powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getSrfSubIdo().getDescription(); } if (powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getSrfSloIndicator() != null && powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getSrfSloIndicator().getTitle() != null && !powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getSrfSloIndicator().getTitle().trim() .isEmpty()) { if (revelantSubIDO.isEmpty()) { revelantSubIDO += " " + powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getSrfSloIndicator().getTitle(); } else { revelantSubIDO += "\n " + powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getSrfSloIndicator().getTitle(); } } if (revelantSubIDO.isEmpty()) { revelantSubIDO = " "; } comments = powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getComments() != null && !powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getComments().trim().isEmpty() ? powbEvidencePlannedStudyDTO.getProjectExpectedStudy().getComments() : " "; POIField[] sData = { new POIField(plannedStudy, ParagraphAlignment.CENTER), new POIField(geographicScope, ParagraphAlignment.CENTER), new POIField(revelantSubIDO, ParagraphAlignment.LEFT), new POIField(comments, ParagraphAlignment.LEFT) }; data = Arrays.asList(sData); datas.add(data); } poiSummary.textTable(document, headers, datas, false, "tableB"); }
From source file:org.cgiar.ccafs.marlo.action.summaries.POWBPOISummaryAction.java
License:Open Source License
private void createTableD() { List<List<POIField>> headers = new ArrayList<>(); POIField[] sHeader = { new POIField(this.getText("crpStaffing.tableD.category"), ParagraphAlignment.CENTER), new POIField(this.getText("crpStaffing.tableD.female"), ParagraphAlignment.CENTER), new POIField(this.getText("crpStaffing.tableD.male"), ParagraphAlignment.CENTER), new POIField(this.getText("crpStaffing.tableD.total"), ParagraphAlignment.CENTER), new POIField(this.getText("crpStaffing.tableD.percFemale"), ParagraphAlignment.CENTER) }; List<POIField> header = Arrays.asList(sHeader); headers.add(header);// w w w. j a v a 2 s .co m List<List<POIField>> datas = new ArrayList<>(); List<POIField> data; Double totalFemale = 0.0, totalMale = 0.0, totalFemaleNoCg = 0.0, totalMaleNoCg = 0.0; for (PowbCrpStaffingCategories crpStaffingCategory : powbCrpStaffingCategoriesManager.findAll().stream() .filter(c -> c.isActive()).collect(Collectors.toList())) { String category = ""; Double female = 0.0, femaleNoCg = 0.0, totalFTE = 0.0, femalePercentaje = 0.0, male = 0.0, maleNoCg = 0.0; category = crpStaffingCategory.getCategory(); if (powbSynthesisPMU != null) { List<PowbSynthesisCrpStaffingCategory> powbSynthesisCrpStaffingCategoryList = crpStaffingCategory .getPowbSynthesisCrpStaffingCategory().stream() .sorted((c1, c2) -> c1.getId().compareTo(c2.getId())).filter(pc -> pc.isActive() && pc.getPowbSynthesis() != null && pc.getPowbSynthesis().equals(powbSynthesisPMU)) .collect(Collectors.toList()); if (powbSynthesisCrpStaffingCategoryList != null && powbSynthesisCrpStaffingCategoryList.size() > 0) { PowbSynthesisCrpStaffingCategory powbSynthesisCrpStaffingCategory = powbSynthesisCrpStaffingCategoryList .get(0); female = powbSynthesisCrpStaffingCategory.getFemale() != null ? powbSynthesisCrpStaffingCategory.getFemale() : 0.0; femaleNoCg = powbSynthesisCrpStaffingCategory.getFemaleNoCgiar() != null ? powbSynthesisCrpStaffingCategory.getFemaleNoCgiar() : 0.0; femalePercentaje = powbSynthesisCrpStaffingCategory.getFemalePercentage() / 100.0; male = powbSynthesisCrpStaffingCategory.getMale() != null ? powbSynthesisCrpStaffingCategory.getMale() : 0.0; maleNoCg = powbSynthesisCrpStaffingCategory.getMaleNoCgiar() != null ? powbSynthesisCrpStaffingCategory.getMaleNoCgiar() : 0.0; totalFemale += female; totalFemaleNoCg += femaleNoCg; totalMale += male; totalMaleNoCg += maleNoCg; totalFTE = powbSynthesisCrpStaffingCategory.getTotalFTE(); } } POIField[] sData = { new POIField(category, ParagraphAlignment.LEFT), new POIField(String.valueOf(round(female, 2)) + " (" + round(femaleNoCg, 2) + ")", ParagraphAlignment.CENTER), new POIField(String.valueOf(round(male, 2)) + " (" + round(maleNoCg, 2) + ")", ParagraphAlignment.CENTER), new POIField(String.valueOf(round(totalFTE, 2)), ParagraphAlignment.CENTER), new POIField(percentageFormat.format(round(femalePercentaje, 4)), ParagraphAlignment.CENTER) }; data = Arrays.asList(sData); datas.add(data); } PowbSynthesisCrpStaffingCategory powbSynthesisCrpStaffingCategory = new PowbSynthesisCrpStaffingCategory(); powbSynthesisCrpStaffingCategory.setMale(totalMale); powbSynthesisCrpStaffingCategory.setMaleNoCgiar(totalMaleNoCg); powbSynthesisCrpStaffingCategory.setFemale(totalFemale); powbSynthesisCrpStaffingCategory.setFemaleNoCgiar(totalFemaleNoCg); Boolean bold = true; String blackColor = "000000"; POIField[] sData = { new POIField("Total CRP", ParagraphAlignment.LEFT, bold, blackColor), new POIField( String.valueOf(round(powbSynthesisCrpStaffingCategory.getFemale(), 2)) + " (" + round(powbSynthesisCrpStaffingCategory.getFemaleNoCgiar(), 2) + ")", ParagraphAlignment.CENTER, bold, blackColor), new POIField( String.valueOf(round(powbSynthesisCrpStaffingCategory.getMale(), 2)) + " (" + round(powbSynthesisCrpStaffingCategory.getMaleNoCgiar(), 2) + ")", ParagraphAlignment.CENTER, bold, blackColor), new POIField(String.valueOf(round(powbSynthesisCrpStaffingCategory.getTotalFTE(), 2)), ParagraphAlignment.CENTER, bold, blackColor), new POIField( percentageFormat .format(round(powbSynthesisCrpStaffingCategory.getFemalePercentage() / 100.0, 4)), ParagraphAlignment.CENTER, bold, blackColor) }; data = Arrays.asList(sData); datas.add(data); poiSummary.textTable(document, headers, datas, false, "tableD"); }
From source file:org.cgiar.ccafs.marlo.action.summaries.POWBPOISummaryAction.java
License:Open Source License
private void createTableE() { List<List<POIField>> headers = new ArrayList<>(); POIField[] sHeader = { new POIField("", ParagraphAlignment.CENTER), new POIField( this.getText("financialPlan.tableE.plannedBudget", new String[] { String.valueOf(this.getSelectedYear()) }), ParagraphAlignment.CENTER), new POIField("", ParagraphAlignment.CENTER), new POIField("", ParagraphAlignment.CENTER), new POIField("", ParagraphAlignment.CENTER), new POIField("", ParagraphAlignment.CENTER), new POIField(this.getText("financialPlan.tableE.comments"), ParagraphAlignment.CENTER) }; POIField[] sHeader2 = { new POIField(" ", ParagraphAlignment.CENTER), new POIField( this.getText("financialPlan.tableE.carryOver", new String[] { String.valueOf(this.getSelectedYear() - 1) }), ParagraphAlignment.CENTER), new POIField(this.getText("financialPlan.tableE.w1w2"), ParagraphAlignment.CENTER), new POIField(this.getText("financialPlan.tableE.w3bilateral"), ParagraphAlignment.CENTER), new POIField(this.getText("financialPlan.tableE.centerFunds"), ParagraphAlignment.CENTER), new POIField(this.getText("financialPlan.tableE.total"), ParagraphAlignment.CENTER), new POIField(" ", ParagraphAlignment.CENTER) }; List<POIField> header = Arrays.asList(sHeader); List<POIField> header2 = Arrays.asList(sHeader2); headers.add(header);/*from www . j a v a 2 s .co m*/ headers.add(header2); List<List<POIField>> datas = new ArrayList<>(); List<POIField> data; powbSynthesisPMU.setPowbFinancialPlannedBudgetList(powbSynthesisPMU.getPowbFinancialPlannedBudget().stream() .filter(fp -> fp.isActive()).collect(Collectors.toList())); // Flagships List<LiaisonInstitution> flagships = this.getFlagships(); if (flagships != null && !flagships.isEmpty()) { for (LiaisonInstitution flagship : flagships) { Double carry = 0.0, w1w2 = 0.0, w3Bilateral = 0.0, center = 0.0, total = 0.0; String category = "", comments = ""; category = flagship.getAcronym(); PowbFinancialPlannedBudget powbFinancialPlannedBudget = this .getPowbFinancialPlanBudget(flagship.getId(), true); if (powbFinancialPlannedBudget != null) { w1w2 = powbFinancialPlannedBudget.getW1w2() != null ? powbFinancialPlannedBudget.getW1w2() : 0.0; carry = powbFinancialPlannedBudget.getCarry() != null ? powbFinancialPlannedBudget.getCarry() : 0.0; w3Bilateral = powbFinancialPlannedBudget.getW3Bilateral() != null ? powbFinancialPlannedBudget.getW3Bilateral() : 0.0; center = powbFinancialPlannedBudget.getCenterFunds() != null ? powbFinancialPlannedBudget.getCenterFunds() : 0.0; total = powbFinancialPlannedBudget.getTotalPlannedBudget() != null ? powbFinancialPlannedBudget.getTotalPlannedBudget() : 0.0; comments = powbFinancialPlannedBudget.getComments() == null || powbFinancialPlannedBudget.getComments().trim().isEmpty() ? " " : powbFinancialPlannedBudget.getComments(); } totalCarry += carry; totalw1w2 += w1w2; totalw3Bilateral += w3Bilateral; totalCenter += center; grandTotal += total; POIField[] sData = { new POIField(category, ParagraphAlignment.CENTER), new POIField(currencyFormat.format(round(carry, 2)), ParagraphAlignment.CENTER), new POIField(currencyFormat.format(round(w1w2, 2)), ParagraphAlignment.CENTER), new POIField(currencyFormat.format(round(w3Bilateral, 2)), ParagraphAlignment.CENTER), new POIField(currencyFormat.format(round(center, 2)), ParagraphAlignment.CENTER), new POIField(currencyFormat.format(round(total, 2)), ParagraphAlignment.CENTER), new POIField(comments, ParagraphAlignment.LEFT) }; data = Arrays.asList(sData); datas.add(data); } } // Expenditure areas List<PowbExpenditureAreas> powbExpenditureAreas = this.getPlannedBudgetAreas(); if (powbExpenditureAreas != null && !powbExpenditureAreas.isEmpty()) { for (PowbExpenditureAreas powbExpenditureArea : powbExpenditureAreas) { Double carry = 0.0, w1w2 = 0.0, w3Bilateral = 0.0, center = 0.0, total = 0.0; String category = "", comments = ""; category = powbExpenditureArea.getExpenditureArea(); PowbFinancialPlannedBudget powbFinancialPlannedBudget = this .getPowbFinancialPlanBudget(powbExpenditureArea.getId(), false); if (powbFinancialPlannedBudget != null) { w1w2 = powbFinancialPlannedBudget.getW1w2() != null ? powbFinancialPlannedBudget.getW1w2() : 0.0; carry = powbFinancialPlannedBudget.getCarry() != null ? powbFinancialPlannedBudget.getCarry() : 0.0; w3Bilateral = powbFinancialPlannedBudget.getW3Bilateral() != null ? powbFinancialPlannedBudget.getW3Bilateral() : 0.0; center = powbFinancialPlannedBudget.getCenterFunds() != null ? powbFinancialPlannedBudget.getCenterFunds() : 0.0; total = powbFinancialPlannedBudget.getTotalPlannedBudget() != null ? powbFinancialPlannedBudget.getTotalPlannedBudget() : 0.0; comments = powbFinancialPlannedBudget.getComments() == null || powbFinancialPlannedBudget.getComments().trim().isEmpty() ? " " : powbFinancialPlannedBudget.getComments(); } totalCarry += carry; totalw1w2 += w1w2; totalw3Bilateral += w3Bilateral; totalCenter += center; grandTotal += total; POIField[] sData = { new POIField(category, ParagraphAlignment.CENTER), new POIField(currencyFormat.format(round(carry, 2)), ParagraphAlignment.CENTER), new POIField(currencyFormat.format(round(w1w2, 2)), ParagraphAlignment.CENTER), new POIField(currencyFormat.format(round(w3Bilateral, 2)), ParagraphAlignment.CENTER), new POIField(currencyFormat.format(round(center, 2)), ParagraphAlignment.CENTER), new POIField(currencyFormat.format(round(total, 2)), ParagraphAlignment.CENTER), new POIField(comments, ParagraphAlignment.LEFT) }; data = Arrays.asList(sData); datas.add(data); } } Boolean bold = true; String blackColor = "000000"; POIField[] sData = { new POIField("CRP Total", ParagraphAlignment.CENTER, bold, blackColor), new POIField(currencyFormat.format(round(totalCarry, 2)), ParagraphAlignment.CENTER, bold, blackColor), new POIField(currencyFormat.format(round(totalw1w2, 2)), ParagraphAlignment.CENTER, bold, blackColor), new POIField(currencyFormat.format(round(totalw3Bilateral, 2)), ParagraphAlignment.CENTER, bold, blackColor), new POIField(currencyFormat.format(round(totalCenter, 2)), ParagraphAlignment.CENTER, bold, blackColor), new POIField(currencyFormat.format(round(grandTotal, 2)), ParagraphAlignment.CENTER, bold, blackColor), new POIField(" ", ParagraphAlignment.LEFT, bold, blackColor) }; data = Arrays.asList(sData); datas.add(data); poiSummary.textTable(document, headers, datas, false, "tableE"); }
From source file:org.cgiar.ccafs.marlo.action.summaries.POWBPOISummaryAction.java
License:Open Source License
private void createTableF() { List<List<POIField>> headers = new ArrayList<>(); POIField[] sHeader = {// w ww. jav a2s. c o m new POIField(this.getText("financialPlan.tableF.expenditureArea") + "*", ParagraphAlignment.CENTER), new POIField( this.getText("financialPlan.tableF.estimatedPercentage", new String[] { String.valueOf(this.getSelectedYear()) }) + "**", ParagraphAlignment.CENTER), new POIField(this.getText("financialPlan.tableF.comments"), ParagraphAlignment.CENTER) }; List<POIField> header = Arrays.asList(sHeader); headers.add(header); List<List<POIField>> datas = new ArrayList<>(); List<POIField> data; Double totalEstimatedPercentajeFS = 0.0; // Expenditure areas for (PowbExpenditureAreas powbExpenditureArea : powbExpenditureAreasManager.findAll().stream() .filter(a -> a.isActive() && a.getIsExpenditure()).collect(Collectors.toList())) { Double estimatedPercentajeFS = 0.0; String expenditureArea = "", commentsSpace = ""; expenditureArea = powbExpenditureArea.getExpenditureArea(); if (powbSynthesisPMU != null) { List<PowbFinancialExpenditure> powbFinancialExpenditureList = powbExpenditureArea .getPowbFinancialExpenditures().stream() .filter(f -> f.isActive() && f.getPowbSynthesis().equals(powbSynthesisPMU)) .collect(Collectors.toList()); if (powbFinancialExpenditureList != null && !powbFinancialExpenditureList.isEmpty()) { PowbFinancialExpenditure powbFinancialExpenditure = powbFinancialExpenditureList.get(0); estimatedPercentajeFS = powbFinancialExpenditure.getW1w2Percentage(); commentsSpace = powbFinancialExpenditure.getComments() == null || powbFinancialExpenditure.getComments().trim().isEmpty() ? " " : powbFinancialExpenditure.getComments(); totalEstimatedPercentajeFS += estimatedPercentajeFS; } } POIField[] sData = { new POIField(expenditureArea, ParagraphAlignment.LEFT), new POIField(percentageFormat.format(round(estimatedPercentajeFS / 100, 4)), ParagraphAlignment.CENTER), new POIField(commentsSpace, ParagraphAlignment.LEFT) }; data = Arrays.asList(sData); datas.add(data); } Boolean bold = true; String blackColor = "000000"; POIField[] sData = { new POIField("Total Funding (Amount)", ParagraphAlignment.LEFT, bold, blackColor), new POIField(currencyFormat.format(round((totalw1w2 * totalEstimatedPercentajeFS) / 100, 2)), ParagraphAlignment.CENTER, bold, blackColor), new POIField(" ", ParagraphAlignment.LEFT, bold, blackColor) }; data = Arrays.asList(sData); datas.add(data); poiSummary.textTable(document, headers, datas, true, "tableF"); }
From source file:org.cgiar.ccafs.marlo.action.summaries.POWBPOISummaryAction.java
License:Open Source License
private void createTableG() { List<List<POIField>> headers = new ArrayList<>(); POIField[] sHeader = {//from w w w . j av a2 s . co m new POIField(this.getText("summaries.powb.tableG.crpName"), ParagraphAlignment.CENTER), new POIField(this.getText("summaries.powb.tableG.description"), ParagraphAlignment.CENTER), new POIField(this.getText("summaries.powb.tableG.relevantFP"), ParagraphAlignment.CENTER) }; List<POIField> header = Arrays.asList(sHeader); headers.add(header); List<List<POIField>> datas = new ArrayList<>(); List<POIField> data; for (PowbSynthesis powbSynthesis : powbSynthesisList) { List<PowbCollaborationGlobalUnit> powbCollaborationGlobalUnitList = powbSynthesis .getPowbCollaborationGlobalUnits().stream().filter(c -> c.isActive()) .collect(Collectors.toList()); if (powbCollaborationGlobalUnitList != null && !powbCollaborationGlobalUnitList.isEmpty()) { for (PowbCollaborationGlobalUnit powbCollaborationGlobalUnit : powbCollaborationGlobalUnitList) { String crpPlatform = " ", descriptionCollaboration = " ", relevantFP = " "; if (powbCollaborationGlobalUnit.getGlobalUnit() != null) { crpPlatform = powbCollaborationGlobalUnit.getGlobalUnit().getAcronym() != null && !powbCollaborationGlobalUnit.getGlobalUnit().getAcronym().isEmpty() ? powbCollaborationGlobalUnit.getGlobalUnit().getAcronym() : powbCollaborationGlobalUnit.getGlobalUnit().getName(); } descriptionCollaboration = powbCollaborationGlobalUnit.getBrief() != null && !powbCollaborationGlobalUnit.getBrief().isEmpty() ? powbCollaborationGlobalUnit.getBrief() : " "; relevantFP = powbCollaborationGlobalUnit.getFlagship() != null && !powbCollaborationGlobalUnit.getFlagship().isEmpty() ? powbCollaborationGlobalUnit.getFlagship() : " "; POIField[] sData = { new POIField(crpPlatform, ParagraphAlignment.CENTER), new POIField(descriptionCollaboration, ParagraphAlignment.LEFT), new POIField(relevantFP, ParagraphAlignment.LEFT) }; data = Arrays.asList(sData); datas.add(data); } } } poiSummary.textTable(document, headers, datas, false, "tableG"); }