|
From: Hirzel P. <ph...@us...> - 2007-06-13 20:17:35
|
Update of /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/report In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv28516/src/org/tcotool/standard/report Modified Files: ReportComplete.java ReportTool.java ReportStaff.java Log Message: Release V1.4.4 Index: ReportComplete.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/report/ReportComplete.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReportComplete.java 13 Jan 2006 17:43:28 -0000 1.3 --- ReportComplete.java 13 Jun 2007 20:17:33 -0000 1.4 *************** *** 24,28 **** import ch.softenvironment.jomm.mvc.model.DbCodeType; import ch.softenvironment.util.NlsUtils; - import ch.softenvironment.util.Tracer; import ch.softenvironment.client.ResourceManager; --- 24,27 ---- *************** *** 166,170 **** if (!ch.softenvironment.util.StringUtils.isNullOrEmpty(object.getDocumentation())) { startTableRow(); ! tableData(ResourceManager.getResource(ServiceDetailView.class, "PnlNote_text", true), abstractCell); tableData(object.getDocumentation()); endTableRow(); --- 165,169 ---- if (!ch.softenvironment.util.StringUtils.isNullOrEmpty(object.getDocumentation())) { startTableRow(); ! tableData(ResourceManager.getResourceAsLabel(ServiceDetailView.class, "PnlNote_text"), abstractCell); tableData(object.getDocumentation()); endTableRow(); *************** *** 178,194 **** startTableRow(); // print header ! tableHeader(ResourceManager.getResource(ServiceDetailView.class, "LblName_text", false)); tableHeader(ResourceManager.getResource(CostDriverDetailView.class, "TbcCosttype_text")); ! tableHeader(ResourceManager.getResource(ServiceDetailView.class, "LblMultitude_text", false)); tableHeader(ResourceManager.getResource(ServiceDetailView.class, "PnlCost_text")); ! tableHeader(ResourceManager.getResource(FactCostDetailView.class, "LblCurrency_text", false)); if (costClass.equals(PersonalCost.class)) { tableHeader(ResourceManager.getResource(PersonalCostDetailView.class, "ChxInternal_text")); tableHeader(ResourceManager.getResource(RoleDetailView.class, "FrmWindow_text")); tableHeader("h"); // [hours] ! tableHeader(ResourceManager.getResource(RoleDetailView.class, "LblHourlyRate_text", false)); ! tableHeader(ResourceManager.getResource(PersonalCostDetailView.class, "LblActivity_text", false)); } else if (costClass.equals(FactCost.class)) { ! tableHeader(ResourceManager.getResource(CatalogueDetailView.class, "FrmWindow_text", false)); } tableHeader(ResourceManager.getResource(ServiceDetailView.class, "PnlNote_text")); --- 177,193 ---- startTableRow(); // print header ! tableHeader(ResourceManager.getResourceAsNonLabeled(ServiceDetailView.class, "LblName_text")); tableHeader(ResourceManager.getResource(CostDriverDetailView.class, "TbcCosttype_text")); ! tableHeader(ResourceManager.getResourceAsNonLabeled(ServiceDetailView.class, "LblMultitude_text")); tableHeader(ResourceManager.getResource(ServiceDetailView.class, "PnlCost_text")); ! tableHeader(ResourceManager.getResourceAsNonLabeled(FactCostDetailView.class, "LblCurrency_text")); if (costClass.equals(PersonalCost.class)) { tableHeader(ResourceManager.getResource(PersonalCostDetailView.class, "ChxInternal_text")); tableHeader(ResourceManager.getResource(RoleDetailView.class, "FrmWindow_text")); tableHeader("h"); // [hours] ! tableHeader(ResourceManager.getResourceAsNonLabeled(RoleDetailView.class, "LblHourlyRate_text")); ! tableHeader(ResourceManager.getResourceAsNonLabeled(PersonalCostDetailView.class, "LblActivity_text")); } else if (costClass.equals(FactCost.class)) { ! tableHeader(ResourceManager.getResourceAsNonLabeled(CatalogueDetailView.class, "FrmWindow_text")); } tableHeader(ResourceManager.getResource(ServiceDetailView.class, "PnlNote_text")); *************** *** 209,213 **** tableData(((PersonalCost)cost).getRole() == null ? "" : ((PersonalCost)cost).getRole().getNameString()); tableData(((PersonalCost)cost).getHours() == null ? "" : ((PersonalCost)cost).getHours().toString()); ! tableData(((PersonalCost)cost).getHourlyRate() == null ? "" : ch.softenvironment.util.AmountFormat.toString(((PersonalCost)cost).getHourlyRate())); tableData(((PersonalCost)cost).getActivity() == null ? "" : ((PersonalCost)cost).getActivity().getNameString()); } else if (costClass.equals(FactCost.class)) { --- 208,212 ---- tableData(((PersonalCost)cost).getRole() == null ? "" : ((PersonalCost)cost).getRole().getNameString()); tableData(((PersonalCost)cost).getHours() == null ? "" : ((PersonalCost)cost).getHours().toString()); ! tableData(((PersonalCost)cost).getHourlyRate() == null ? "" : af.format(((PersonalCost)cost).getHourlyRate().doubleValue())); tableData(((PersonalCost)cost).getActivity() == null ? "" : ((PersonalCost)cost).getActivity().getNameString()); } else if (costClass.equals(FactCost.class)) { Index: ReportTool.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/report/ReportTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ReportTool.java 29 Jun 2006 22:50:05 -0000 1.7 --- ReportTool.java 13 Jun 2007 20:17:33 -0000 1.8 *************** *** 27,34 **** --- 27,36 ---- import ch.softenvironment.jomm.DbObjectServer; import ch.softenvironment.jomm.mvc.model.DbCodeType; + import ch.softenvironment.jomm.mvc.model.DbEnumeration; import ch.softenvironment.jomm.mvc.model.DbObject; import ch.softenvironment.jomm.serialize.AttributeList; import ch.softenvironment.jomm.serialize.CsvSerializer; import ch.softenvironment.jomm.serialize.HtmlSerializer; + import ch.softenvironment.util.AmountFormat; import ch.softenvironment.util.StringUtils; import ch.softenvironment.util.Tracer; *************** *** 48,52 **** private static final long DEFAULT_DURATION = 48; protected Calculator calculator = null; ! protected String title = ""; // CSV-support --- 50,54 ---- private static final long DEFAULT_DURATION = 48; protected Calculator calculator = null; ! protected String title = ""; // CSV-support *************** *** 56,60 **** // formatting ! protected java.text.NumberFormat amountFormat = null; protected java.text.NumberFormat hourFormat = null; // private AttributeList alignRight = null; --- 58,62 ---- // formatting ! protected java.text.NumberFormat af = AmountFormat.getAmountInstance(LauncherView.getInstance().getSettings().getPlattformLocale()); protected java.text.NumberFormat hourFormat = null; // private AttributeList alignRight = null; *************** *** 73,77 **** this.title = title; - amountFormat = ch.softenvironment.util.AmountFormat.getAmountInstance(); hourFormat = java.text.NumberFormat.getNumberInstance(); hourFormat.setMinimumFractionDigits(1); --- 75,78 ---- *************** *** 89,95 **** try { SystemParameter sysParams = LauncherView.getInstance().getUtility().getSystemParameter(); ! if (sysParams.getReportCostExponent().getIliCode().equals(CostExponent.INTHOUSAND)) { exponent = 1; ! } else if (sysParams.getReportCostExponent().getIliCode().equals(CostExponent.INMILLION)) { exponent = 2; } --- 90,96 ---- try { SystemParameter sysParams = LauncherView.getInstance().getUtility().getSystemParameter(); ! if (DbEnumeration.isIliCode(sysParams.getReportCostExponent(), CostExponent.INTHOUSAND)) { exponent = 1; ! } else if (DbEnumeration.isIliCode(sysParams.getReportCostExponent(), CostExponent.INMILLION)) { exponent = 2; } *************** *** 99,109 **** switch (exponent) { case 1: { ! return amountFormat.format(value/1000.0); } case 2: { ! return amountFormat.format(value/1000000.0); } default: { ! return amountFormat.format(value); } } --- 100,110 ---- switch (exponent) { case 1: { ! return af.format(value/1000.0); } case 2: { ! return af.format(value/1000000.0); } default: { ! return af.format(value); } } *************** *** 146,173 **** } /** ! * Encode the costs sorted <b>by CostCause</b> in a Block (HTML-Table) ! * for TCO or Depreciation. * If (printDetails==true) then all Service's (either the given * root itself or the owned services of a group represented by object) * will be printed separately in an own such block. * @param root TcoPackage or Service ! * @deprecated (redesign generic approach, cause to much overhead with CostCause-list) */ protected void encodeCostBlock(TcoObject root, List codes, final String codeUndefined, String title) throws IOException { } /** * @see #getCostUnit() */ ! protected void encodeCostUnit(String currency) throws java.io.IOException { String tmp = getRsc("CICostExponent") + " ["; ! italic(tmp + getCostUnit() + "]" + currency); try { ! // in csv costs are always as is ! getCsvWriter().cell(tmp + LauncherView.getInstance().getUtility().getSystemParameter().getDefaultCurrency() + "]" + currency); } catch(Throwable e) { ch.softenvironment.util.Tracer.getInstance().runtimeWarning("INGORED: SystemParameters FAILURE: " + e.getLocalizedMessage()); ! getCsvWriter().cell(tmp + UNKNOWN + "]" + currency); } } --- 147,178 ---- } /** ! * Generic method to encode a block of costs related to given codes. ! * * If (printDetails==true) then all Service's (either the given * root itself or the owned services of a group represented by object) * will be printed separately in an own such block. * @param root TcoPackage or Service ! * @deprecated (redesign evtl. not really useful in a generic way) */ protected void encodeCostBlock(TcoObject root, List codes, final String codeUndefined, String title) throws IOException { } + /** + * Write a text in what unit and currency the listed costs are represented, for e.g. + * "All costs in [kCHF]; %5.3" * @see #getCostUnit() + * @param suffix (for e.g. "; %5.3") */ ! protected void encodeCostUnit(final String suffix) throws java.io.IOException { String tmp = getRsc("CICostExponent") + " ["; ! italic(tmp + getCostUnit() + "]" + suffix); try { ! // in csv costs are always as is (without unit!) ! getCsvWriter().cell(tmp + LauncherView.getInstance().getUtility().getSystemParameter().getDefaultCurrency().getNameString() + "]" + suffix); } catch(Throwable e) { ch.softenvironment.util.Tracer.getInstance().runtimeWarning("INGORED: SystemParameters FAILURE: " + e.getLocalizedMessage()); ! getCsvWriter().cell(tmp + UNKNOWN + "]" + suffix); } } *************** *** 308,314 **** try { SystemParameter sysParams = LauncherView.getInstance().getUtility().getSystemParameter(); ! if (sysParams.getReportCostExponent().getIliCode().equals(CostExponent.INTHOUSAND)) { unit = getRsc("CIInKilo") + " "; ! } else if (sysParams.getReportCostExponent().getIliCode().equals(CostExponent.INMILLION)) { unit = getRsc("CIInMillion") + " "; } --- 313,319 ---- try { SystemParameter sysParams = LauncherView.getInstance().getUtility().getSystemParameter(); ! if (DbEnumeration.isIliCode(sysParams.getReportCostExponent(), CostExponent.INTHOUSAND)) { unit = getRsc("CIInKilo") + " "; ! } else if (DbEnumeration.isIliCode(sysParams.getReportCostExponent(), CostExponent.INMILLION)) { unit = getRsc("CIInMillion") + " "; } *************** *** 463,467 **** nativeContent("<td>" + (bold ? "<b>" : "") + "<a href=\"" + ((DbObject)object).getId() + "\">" + encodeString(object.getNameString()) + (bold ? "</b>" : "") + "</td>"); ! getCsvWriter().cell(object.getName()); } /** --- 468,472 ---- nativeContent("<td>" + (bold ? "<b>" : "") + "<a href=\"" + ((DbObject)object).getId() + "\">" + encodeString(object.getNameString()) + (bold ? "</b>" : "") + "</td>"); ! getCsvWriter().cell(object.getNameString()); } /** *************** *** 513,517 **** * Overwrites. */ ! public void tableData(String text, AttributeList attrs) throws IOException { super.tableData(text, attrs); --- 518,522 ---- * Overwrites. */ ! public void tableData(final String text, AttributeList attrs) throws IOException { super.tableData(text, attrs); *************** *** 540,544 **** nativeContent("</td>"); ! getCsvWriter().cell(new Double(value)); } /** --- 545,549 ---- nativeContent("</td>"); ! getCsvWriter().cell(af.format(value)); } /** *************** *** 558,562 **** * */ ! protected void tableDataBold(String text) throws IOException { nativeContent("<td><b>" + encodeString(text) + "</b></td>"); --- 563,567 ---- * */ ! protected void tableDataBold(final String text) throws IOException { nativeContent("<td><b>" + encodeString(text) + "</b></td>"); *************** *** 594,598 **** * Overwrites. */ ! public void tableHeader(String text, AttributeList attrs) throws IOException { super.tableHeader(text, attrs); --- 599,603 ---- * Overwrites. */ ! public void tableHeader(final String text, AttributeList attrs) throws IOException { super.tableHeader(text, attrs); *************** *** 671,675 **** */ protected String getRsc(String property) { ! return ResourceManager.getResource(ReportTool.class, property, false); } /** --- 676,680 ---- */ protected String getRsc(String property) { ! return ResourceManager.getResourceAsNonLabeled(ReportTool.class, property); } /** Index: ReportStaff.java =================================================================== RCS file: /cvsroot/tcotool/TCO-Tool/src/org/tcotool/standard/report/ReportStaff.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ReportStaff.java 29 Jun 2006 22:50:05 -0000 1.4 --- ReportStaff.java 13 Jun 2007 20:17:33 -0000 1.5 *************** *** 47,51 **** */ public static ReportTool createPersonalCosts(TcoPackage root) throws java.lang.Throwable { ! ReportStaff tool = new ReportStaff(ResourceManager.getResource(PersonalCostDetailView.class, "FrmWindow_text", true) + root.getName()); tool.calculator = new Calculator(LauncherView.getInstance().getUtility(), root, 0 /*irrelevant*/); tool.costPersonalEffort(root); --- 47,51 ---- */ public static ReportTool createPersonalCosts(TcoPackage root) throws java.lang.Throwable { ! ReportStaff tool = new ReportStaff(ResourceManager.getResourceAsLabel(PersonalCostDetailView.class, "FrmWindow_text") + root.getName()); tool.calculator = new Calculator(LauncherView.getInstance().getUtility(), root, 0 /*irrelevant*/); tool.costPersonalEffort(root); *************** *** 80,84 **** tableHeader(ResourceManager.getResource(PersonalCostDetailView.class, "ChxInternal_text")); tableHeader("[h]"); ! tableHeader(ResourceManager.getResource(RoleDetailView.class, "LblYearlyHours_text", false) + " ~"); endTableRow(); startTableRow(); --- 80,84 ---- tableHeader(ResourceManager.getResource(PersonalCostDetailView.class, "ChxInternal_text")); tableHeader("[h]"); ! tableHeader(ResourceManager.getResourceAsNonLabeled(RoleDetailView.class, "LblYearlyHours_text") + " ~"); endTableRow(); startTableRow(); *************** *** 132,136 **** endParagraph(); startParagraph(); ! encodeCostBlock(null, element.getObjectServer().retrieveCodes(Activity.class), Calculator.ACTIVITY_UNDEFINED, ResourceManager.getResource(PersonalCostDetailView.class, "LblActivity_text", false)); endParagraph(); } --- 132,136 ---- endParagraph(); startParagraph(); ! encodeCostBlock(null, element.getObjectServer().retrieveCodes(Activity.class), Calculator.ACTIVITY_UNDEFINED, ResourceManager.getResourceAsNonLabeled(PersonalCostDetailView.class, "LblActivity_text")); endParagraph(); } *************** *** 171,175 **** // ch.softenvironment.jomm.serialize.AttributeList attrs = getAlignRight(); ! String cellName = ResourceManager.getResource(ServiceDetailView.class, "TbcTotal_text", false); // the final summarization without Dependencies --- 171,175 ---- // ch.softenvironment.jomm.serialize.AttributeList attrs = getAlignRight(); ! String cellName = ResourceManager.getResourceAsNonLabeled(ServiceDetailView.class, "TbcTotal_text"); // the final summarization without Dependencies |