[virtualcommons-svn] commit/irrigation: alllee: replacing contribution information with StringTempl
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2012-02-07 00:08:58
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/1a9b96f825b5/ changeset: 1a9b96f825b5 user: alllee date: 2012-02-07 01:08:53 summary: replacing contribution information with StringTemplate version and fixing template affected #: 2 files diff -r 41a912f9af5cedbc37a7b5574bacd2b78fa8889a -r 1a9b96f825b53d32e52d87c251e384611ea7f88a src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java --- a/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java +++ b/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java @@ -472,30 +472,11 @@ } - // FIXME: replace with StringTemplate public void displayContributionInformation(final ClientData clientData) { - GroupDataModel groupDataModel = clientData.getGroupDataModel(); - int totalContributedTokens = groupDataModel.getTotalContributedTokens(); - final StringBuilder builder = new StringBuilder(); - builder.append("<ul><li>Infrastructure efficiency before investment: ") - .append(groupDataModel.getInfrastructureEfficiencyBeforeInvestment()) - .append("%</li>"); - builder.append("<li>Water delivery capacity before investment: ").append(groupDataModel.getIrrigationCapacityBeforeInvestment()).append(" cubic feet per second</li>"); - builder.append( - String.format( - "<li>Total group investment: %d tokens, increasing the infrastructure efficiency to %d%%</li>", - totalContributedTokens, groupDataModel.getInfrastructureEfficiency())); - if (groupDataModel.getIrrigationCapacity() > groupDataModel.getIrrigationCapacityBeforeInvestment()) { - builder.append("<li><b>Your group's investment has increased the water delivery capacity to "); - } - else { - builder.append("<li>Your group's investment was not enough to increase the water delivery capacity. Your group's water delivery capacity is still "); - } - builder.append(groupDataModel.getIrrigationCapacity()).append(" cubic feet of water per second.</li><li>The amount of water available to pass through your irrigation canal is ") - .append(groupDataModel.getActualWaterDeliveryCapacity()).append(" cubic feet per second</li>"); + final String contributionSummary = clientDataModel.getRoundConfiguration().generateContributionSummary(clientData); SwingUtilities.invokeLater(new Runnable() { public void run() { - contributionInformationEditorPane.setText(builder.toString()); + contributionInformationEditorPane.setText(contributionSummary); infrastructureEfficiencyChartPanel.initialize(); pieChart.initialize(clientData); addCenterComponent(getContributionInformationPanel()); diff -r 41a912f9af5cedbc37a7b5574bacd2b78fa8889a -r 1a9b96f825b53d32e52d87c251e384611ea7f88a src/main/resources/configuration/asu/2011/pretest/irrigation.xml --- a/src/main/resources/configuration/asu/2011/pretest/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/pretest/irrigation.xml @@ -430,7 +430,7 @@ <hr><p> Your group invested a total of <b>{groupDataModel.totalContributedTokens} tokens</b> this round, resulting in an infrastructure efficiency of <b>{groupDataModel.infrastructureEfficiency}%</b> and a water delivery capacity of <b>{groupDataModel.irrigationCapacity} cubic feet per second</b>. -The amount of water available to pass through your canal is {groupDataModel.actualWaterDeliveryCapacity cubic feet per second}. +The amount of water available to pass through your canal is <b>{groupDataModel.actualWaterDeliveryCapacity} cubic feet per second</b>. </p><table border=2 cellspacing=2 cellpadding=3><tr> Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |