[virtualcommons-svn] SF.net SVN: virtualcommons:[297] irrigation/trunk/src/main/java/edu/asu/ commo
Status: Beta
Brought to you by:
alllee
From: <al...@us...> - 2009-10-14 22:10:34
|
Revision: 297 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=297&view=rev Author: alllee Date: 2009-10-14 22:10:26 +0000 (Wed, 14 Oct 2009) Log Message: ----------- starting to simplify/disentangle the irrigation experiment's GUI code. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanelTokenBandwidth.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/Gate.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleWindowPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/PieChart.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ScoreBoxPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/events/RoundStartedEvent.java Added Paths: ----------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationGamePanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/SummaryPanel.java Removed Paths: ------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanel.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanelNew.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClientGameState.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanel.java 2009-10-13 17:09:51 UTC (rev 296) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanel.java 2009-10-14 22:10:26 UTC (rev 297) @@ -1,132 +0,0 @@ -/** - * - */ -package edu.asu.commons.irrigation.client; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridLayout; - -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; - -import edu.asu.commons.irrigation.server.ClientData; - -/** - * @author Sanket - * - */ -public class ActivitySummaryPanel extends JPanel { - - /** - * - */ - private static final long serialVersionUID = -2400441194759984763L; - private JLabel currentBandwidthTextjLabel = null; - private JLabel filesDownloadedjLabel = null; - private JLabel filesDownloadedTextjLabel = null; - private JLabel tokensCollectedjLabel = null; - private JLabel currentBandwidthjLabel = null; - private JLabel tokensCollectedTextjLabel = null; - - private JLabel positionjLabel = null; - private JLabel positionTextjLabel = null; - - private ClientData clientData; // @jve:decl-index=0: - /** - * This method initializes - * - */ - public ActivitySummaryPanel(int i) { - super(); - initialize(i); - } - - /** - * This method initializes this - * - */ - private void initialize(int i) { - tokensCollectedTextjLabel = new JLabel(); - tokensCollectedTextjLabel.setText(""); - currentBandwidthjLabel = new JLabel(); - currentBandwidthjLabel.setText("Current Flow Capacity:"); - tokensCollectedjLabel = new JLabel(); - tokensCollectedjLabel.setText("Tokens Collected:"); - filesDownloadedTextjLabel = new JLabel(); - filesDownloadedTextjLabel.setText(""); - filesDownloadedjLabel = new JLabel(); - filesDownloadedjLabel.setText("Crops Grown:"); - currentBandwidthTextjLabel = new JLabel(); - currentBandwidthTextjLabel.setText(""); - - positionjLabel = new JLabel(); - positionjLabel.setText("Position :"); - - positionTextjLabel = new JLabel(); - positionTextjLabel.setText(""); - - GridLayout gridLayout = new GridLayout(); - gridLayout.setRows(4); - gridLayout.setColumns(2); - this.setLayout(gridLayout); - this.setSize(new Dimension(430,126)); - switch(i) - { - case 0: this.setBackground(Color.PINK); - break; - - case 1: this.setBackground(Color.GREEN); - break; - - case 2: this.setBackground(Color.WHITE); - break; - - case 3: this.setBackground(Color.CYAN); - break; - - case 4: this.setBackground(Color.YELLOW); - break; - } - this.add(positionjLabel, null); - this.add(positionTextjLabel, null); - this.add(currentBandwidthjLabel, null); - this.add(currentBandwidthTextjLabel, null); - this.add(filesDownloadedjLabel, null); - this.add(filesDownloadedTextjLabel, null); - this.add(tokensCollectedjLabel, null); - this.add(tokensCollectedTextjLabel, null); - } - - public void update(ClientData data) { - this.clientData = data; - // TODO Auto-generated method stub - //System.out.println("Client Data Prioriity"+clientData.getPriority()+"Avaiable bandwidth"+ - //clientData.getAvailableBandwidth()); - - Runnable createGuiRunnable = new Runnable(){ - public void run() { - //System.out.println("In the UPdate facilitator"); - positionTextjLabel.setText(new Integer(clientData.getPriority()).toString()); - tokensCollectedTextjLabel.setText(new Integer(clientData.getTotalTokensEarned()).toString()); - if(clientData.getAvailableFlowCapacity() > 25){ - currentBandwidthTextjLabel.setText(new Double(25).toString()); - } - else - currentBandwidthTextjLabel.setText(new Double(clientData.getAvailableFlowCapacity()).toString()); - filesDownloadedTextjLabel.setText(new Integer(clientData.getCropsGrown()).toString()); - } - }; - SwingUtilities.invokeLater(createGuiRunnable); - } - - public void endRound() { - // TODO Auto-generated method stub - currentBandwidthTextjLabel.setText(""); - filesDownloadedTextjLabel.setText(""); - tokensCollectedTextjLabel.setText(""); - - } - -} // @jve:decl-index=0:visual-constraint="10,10" Deleted: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanelNew.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanelNew.java 2009-10-13 17:09:51 UTC (rev 296) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ActivitySummaryPanelNew.java 2009-10-14 22:10:26 UTC (rev 297) @@ -1,221 +0,0 @@ -/** - * - */ -package edu.asu.commons.irrigation.client; - -import java.awt.Color; -import java.awt.Font; -import java.awt.Rectangle; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JProgressBar; - -import edu.asu.commons.irrigation.server.ClientData; - - -/** - * @author Sanket - * - */ -public class ActivitySummaryPanelNew extends JPanel { - - /** - * - */ - private static final long serialVersionUID = 2393688647176774993L; - - //create three Maps for every parameter - Map<Integer,JProgressBar>availableBandwidthMap = new LinkedHashMap<Integer, JProgressBar>(); - Map<Integer, JLabel>filesDownLoadedMap = new LinkedHashMap<Integer, JLabel>(); - Map<Integer, JLabel>tokensCollectedMap = new LinkedHashMap<Integer, JLabel>(); - - JLabel labelA; - - JLabel labelB; - - JLabel labelC; - - JLabel labelD; - - JLabel labelE; - - JLabel titleLabel[] = new JLabel[3]; - - //private int NUMBER_OF_PARTICIPANTS_PERGROUP = 2; - - private int parameterIndex; - - IrrigationClient client; // @jve:decl-index=0: - - public ActivitySummaryPanelNew(int parameterIndex, IrrigationClient client) { - // TODO Auto-generated constructor stub - super(); - initialize(parameterIndex,client); - } - - private void initialize(int parameterIndex,IrrigationClient client) { - // TODO Auto-generated method stub - this.parameterIndex = parameterIndex; - - this.client = client; - - this.setLayout(null); - /*else{ - GridLayout gridLayout = new GridLayout(); - gridLayout.setColumns(1); - gridLayout.setRows(5); - this.setLayout(gridLayout); - }*/ - //add the parameters depending on the parameter Index - //initialize Labels - - for(int i=0;i<client.getRoundConfiguration().getClientsPerGroup();i++){ - System.out.println("I reach here"); - switch(i){ - case 0 :labelA = new JLabel(); - labelA.setBounds(new Rectangle(0,30+15*(i+i),25,15)); - if(client.getClientGameState().getPriority() == i){ - labelA.setText("YOU"); - } - else - labelA.setText("A"); - this.add(labelA); - break; - - case 1: labelB = new JLabel(); - labelB.setBounds(new Rectangle(0,30+15*(i+i),25,15)); - if(client.getClientGameState().getPriority() == i){ - labelB.setText("YOU"); - } - else - labelB.setText("B"); - this.add(labelB); - break; - - case 2: labelC = new JLabel(); - labelC.setBounds(new Rectangle(0,30+15*(i+i),25,15)); - if(client.getClientGameState().getPriority() == i){ - labelC.setText("YOU"); - } - else - labelC.setText("C"); - this.add(labelC); - break; - - case 3: labelD = new JLabel(); - labelD.setBounds(new Rectangle(0,30+15*(i+i),25,15)); - if(client.getClientGameState().getPriority() == i){ - labelD.setText("YOU"); - } - else - labelD.setText("D"); - this.add(labelD); - break; - - case 4: labelE = new JLabel(); - labelE.setBounds(new Rectangle(0,30+15*(i+i),25,15)); - if(client.getClientGameState().getPriority() == i){ - labelE.setText("YOU"); - } - else - labelE.setText("E"); - this.add(labelE); - break; - } - } - switch(parameterIndex){ - - case 0 : //add the progress Bbar - this.setBackground(Color.PINK); - titleLabel[0] = new JLabel(); - titleLabel[0].setText("Available Flow Capacity"); - titleLabel[0].setBounds(new Rectangle(60,5,200,20)); - this.add(titleLabel[0],null); - for(int i=0;i<client.getRoundConfiguration().getClientsPerGroup();i++){ - JProgressBar availableBandwidthProgressBar = new JProgressBar(); - availableBandwidthProgressBar.setMaximum(25); - availableBandwidthProgressBar.setBounds(new Rectangle(40,30+15*(i+i),150,15)); - availableBandwidthProgressBar.setStringPainted(true); - if(i == client.getClientGameState().getPriority()){ - availableBandwidthProgressBar.setForeground(Color.ORANGE); - } - else - availableBandwidthProgressBar.setForeground(new Color(51, 153, 255)); - availableBandwidthProgressBar.setBackground(Color.white); - availableBandwidthProgressBar.setValue(25); - this.add(availableBandwidthProgressBar); - availableBandwidthMap.put(new Integer(i), availableBandwidthProgressBar); - } - break; - - case 1 : //add the number of files downloaded - this.setBackground(Color.WHITE); - titleLabel[1] = new JLabel(); - titleLabel[1].setText("Crops Grown"); - titleLabel[1].setBounds(new Rectangle(60,5,200,20)); - this.add(titleLabel[1],null); - for(int i=0;i<client.getRoundConfiguration().getClientsPerGroup();i++){ - JLabel filesDownLoaded = new JLabel(); - filesDownLoaded.setFont(new Font("Serif", Font.BOLD, 14)); - if(i == client.getClientGameState().getPriority()){ - filesDownLoaded.setForeground(Color.ORANGE); - } - else - filesDownLoaded.setForeground(new Color(51,153,255)); - filesDownLoaded.setBounds(new Rectangle(132,30+15*(i+i),100,15)); - this.add(filesDownLoaded); - filesDownLoaded.setText(""); - filesDownLoadedMap.put(new Integer(i),filesDownLoaded); - } - break; - - case 2: //add the number of tokens collected - this.setBackground(Color.WHITE); - titleLabel[2] = new JLabel(); - titleLabel[2].setText("Tokens Collected"); - titleLabel[2].setBounds(new Rectangle(60,5,200,20)); - this.add(titleLabel[2],null); - for(int i=0;i<client.getRoundConfiguration().getClientsPerGroup();i++){ - JLabel tokensCollected = new JLabel(); - tokensCollected.setFont(new Font("Comic Sans MS", Font.BOLD, 14)); - if(i == client.getClientGameState().getPriority()){ - tokensCollected.setForeground(Color.ORANGE); - } - else - tokensCollected.setForeground(new Color(51,153,255)); - tokensCollected.setBounds(new Rectangle(132,30+15*(i+i),100,15)); - this.add(tokensCollected); - tokensCollected.setText(""); - tokensCollectedMap.put(new Integer(i),tokensCollected); - } - break; - } - } - - public void update(ClientData clientData) { - // TODO Auto-generated method stub - switch(parameterIndex){ - case 0 : - availableBandwidthMap.get(new Integer(clientData.getPriority())).setValue((int) clientData.getAvailableFlowCapacity()); - break; - - case 1: - filesDownLoadedMap.get(new Integer(clientData.getPriority())).setText(new Integer(clientData.getCropsGrown()).toString()); - break; - - case 2: - tokensCollectedMap.get(new Integer(clientData.getPriority())).setText(new Integer(clientData.getTotalTokensEarned()).toString()); - break; - } - } - - //implement this Later on - public void endRound() { - // TODO Auto-generated method stub - //implement this later on. - } - -} Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2009-10-13 17:09:51 UTC (rev 296) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java 2009-10-14 22:10:26 UTC (rev 297) @@ -65,7 +65,7 @@ private double totalContributedBandwidth; - private IrrigationClientGameState clientGameState; + private ClientDataModel clientGameState; private int numberofGates = 6; @@ -79,7 +79,7 @@ //////////////////////////////////////////////////////////////////////////// - public CanalPanel(IrrigationClientGameState clientGameState) { + public CanalPanel(ClientDataModel clientGameState) { super(); //when totalContributed bandwidth = 1.0, you dont see the canal line this.totalContributedBandwidth = clientGameState.getGroupDataModel().getMaximumAvailableFlowCapacity(); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanelTokenBandwidth.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanelTokenBandwidth.java 2009-10-13 17:09:51 UTC (rev 296) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ChartWindowPanelTokenBandwidth.java 2009-10-14 22:10:26 UTC (rev 297) @@ -130,7 +130,7 @@ // final XYSeries actualFlowCapacitySeriesY = new XYSeries("Actual"); final XYSeries initialInfrastructureEfficiencySeries = new XYSeries("Initial"); int x,y; - GroupDataModel group = client.getClientGameState().getGroupDataModel(); + GroupDataModel group = client.getClientDataModel().getGroupDataModel(); final int infrastructureEfficiency = group.getInfrastructureEfficiency(); final int actualFlowCapacity = group.getFlowCapacity(); for(y = 0; y <= actualFlowCapacity; y++) { Copied: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java (from rev 296, irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClientGameState.java) =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java (rev 0) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java 2009-10-14 22:10:26 UTC (rev 297) @@ -0,0 +1,109 @@ +/** + * + */ +package edu.asu.commons.irrigation.client; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import edu.asu.commons.event.EventChannel; +import edu.asu.commons.experiment.DataModel; +import edu.asu.commons.irrigation.conf.RoundConfiguration; +import edu.asu.commons.irrigation.events.ClientUpdateEvent; +import edu.asu.commons.irrigation.events.RoundStartedEvent; +import edu.asu.commons.irrigation.server.ClientData; +import edu.asu.commons.irrigation.server.GroupDataModel; +import edu.asu.commons.net.Identifier; + +/** + * $Id$ + * + * The client side data model, simply wraps a GroupDataModel. + * + * @author <a href='mailto:All...@as...'>Allen Lee</a> + * @version $Rev$ + */ +public class ClientDataModel implements DataModel<RoundConfiguration> { + + private static final long serialVersionUID = -3424256672940188027L; + + private GroupDataModel groupDataModel; + + private IrrigationClient client; + + private RoundConfiguration roundConfiguration; + + private int priority = 0; + + private int timeLeft = 0; + + public ClientDataModel(EventChannel channel, IrrigationClient client) { + this.client = client; + } + + public ClientData getClientData() { + return groupDataModel.getClientData( getId() ); + } + + public Identifier getId() { + return client.getId(); + } + + public List<Identifier> getAllClientIdentifiers() { + return new ArrayList<Identifier>(groupDataModel.getClientIdentifiers()); + } + + public synchronized void initialize(RoundStartedEvent event) { + groupDataModel.clear(); + setGroupDataModel(event.getGroupDataModel()); + setTimeLeft( (int) (getRoundConfiguration().getRoundDuration().getDelta() / 1000L) ); + } + + /** + * Setting priority for this client. + */ + public void setPriority(int priority){ + this.priority = priority; + } + + public int getPriority(){ + return priority; + } + + public void update(ClientUpdateEvent clientUpdateEvent) { + setGroupDataModel(clientUpdateEvent.getGroupDataModel()); + setTimeLeft(clientUpdateEvent.getTimeLeft()); + } + + public void setTimeLeft(int timeLeft) { + this.timeLeft = timeLeft; + } + + public int getTimeLeft() { + return timeLeft; + } + + public RoundConfiguration getRoundConfiguration() { + return roundConfiguration; + } + + public void setRoundConfiguration(RoundConfiguration roundConfiguration) { + this.roundConfiguration = roundConfiguration; + } + + public void setGroupDataModel(GroupDataModel groupDataModel) { + this.groupDataModel = groupDataModel; + setRoundConfiguration(groupDataModel.getRoundConfiguration()); + } + + public GroupDataModel getGroupDataModel() { + return groupDataModel; + } + + public Map<Identifier, ClientData> getClientDataMap() { + return groupDataModel.getClientDataMap(); + } + + +} Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-13 17:09:51 UTC (rev 296) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-14 22:10:26 UTC (rev 297) @@ -1,6 +1,7 @@ package edu.asu.commons.irrigation.client; import java.awt.BorderLayout; +import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; @@ -25,7 +26,6 @@ import javax.swing.SwingUtilities; import javax.swing.Timer; -import edu.asu.commons.event.EventChannel; import edu.asu.commons.irrigation.conf.RoundConfiguration; import edu.asu.commons.irrigation.conf.ServerConfiguration; import edu.asu.commons.irrigation.events.EndRoundEvent; @@ -39,6 +39,7 @@ /** * $Id$ * + * The root experiment window placed in the client's JFrame. * * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ @@ -47,16 +48,12 @@ private static final long serialVersionUID = -5636795631355367711L; - private IrrigationClientGameState state; + private ClientDataModel clientDataModel; - private Component currentCenterComponent; - private JScrollPane instructionsScrollPane; private HtmlEditorPane instructionsEditorPane; - private JPanel subjectWindow; - private JPanel tokenScreenPanel = null; private JPanel graphPanel; @@ -69,9 +66,9 @@ private IrrigationClient client; - private MainIrrigationGameWindow mainIrrigationWindow; + private IrrigationGamePanel irrigationGamePanel; - private StringBuilder instructionsBuilder = new StringBuilder(); // @jve:decl-index=0: + private StringBuilder instructionsBuilder = new StringBuilder(); private int totalContributedTokensPerGroup; @@ -79,104 +76,98 @@ private JButton nextButton; - private JPanel navigationPane; + private JPanel instructionsNavigationPanel; private JButton previousButton; - private JPanel welcomeInstructionsPane; + private JPanel instructionsPanel; private int instructionNumber = 1; private JPanel submitTokenPanel; - private EventChannel channel; + private HtmlEditorPane tokenInstructionsEditorPane; - private HtmlEditorPane tokenInstructionsEditorPane; + private JScrollPane tokenInstructionsScrollPane; - private JScrollPane tokenInstructionsScrollPane; + private int NUMBER_INSTRUCTIONS = 9; - private int NUMBER_INSTRUCTIONS = 9; + private JLabel quizLabel; - private JLabel quizLabel; - - private JLabel quizAnimationLabel = new JLabel(); - - private int pagesTraversed = 0; + private JLabel quizAnimationLabel = new JLabel(); - private JPanel animationInstructionPanel; + private int pagesTraversed = 0; - private JPanel animationPanel; - - private JPanel navigationAnimationPanel; + private JPanel animationInstructionPanel; - private JButton nextAnimationButton; + private JPanel animationPanel; - private JButton previousAnimationButton; + private JPanel navigationAnimationPanel; - private HtmlEditorPane animationInstructionsEditorPane; + private JButton nextAnimationButton; - private JScrollPane animationInstructionsScrollPane; + private JButton previousAnimationButton; - private JPanel chartPanel; + private HtmlEditorPane animationInstructionsEditorPane; - private PieChart pieChart; + private JScrollPane animationInstructionsScrollPane; - public ClientData clientData; + private JPanel chartPanel; - private CanalAnimationPanel canalPanelAnimationNew; + private PieChart pieChart; + public ClientData clientData; + + private CanalAnimationPanel canalAnimationPanel; + + private CardLayout cardLayout; + + private JLabel infrastructureEfficiencyLabel = new JLabel("Current infrastructure efficiency: "); + public ExperimentGameWindow(Dimension screenSize, IrrigationClient client) { this.client = client; - this.state = client.getClientGameState(); + this.clientDataModel = client.getClientDataModel(); // FIXME: set the actual screen size dimensions after this JPanel has // been initialized... // this.screenSize = getParent().getSize(); - this.channel = client.getEventChannel(); // feed subject view the available screen size so that // it can adjust appropriately when given a board size - mainIrrigationWindow = new MainIrrigationGameWindow(screenSize, client); - initGuiComponents(); + initGuiComponents(screenSize); } - private void initGuiComponents() { - setLayout(new BorderLayout()); - instructionsEditorPane = createInstructionsEditorPane(); - instructionsScrollPane = new JScrollPane(instructionsEditorPane); + private void initGuiComponents(Dimension screenSize) { + cardLayout = new CardLayout(); + setLayout(cardLayout); + + instructionsScrollPane = new JScrollPane(getInstructionsEditorPane()); instructionsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); instructionsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - // getting the initial general instructions + // create a quiz listener and then initialize the instructions. instructionsEditorPane.setActionListener(createQuizListener(client.getServerConfiguration())); instructionsEditorPane.setCaretPosition(0); setInstructions(getGeneralInstructions(0)); - addCenterComponent(getWelcomeInstructionsPane()); - add(getWelcomeInstructionsPane(), BorderLayout.CENTER); - /*setInstructions(getGeneralInstructions(1)); - currentCenterComponent = WelcomeInstructionPane; - *///currentCenterComponent = getWelcomeInstructionPane(); - // setup the Subject Window, add the experiment view - subjectWindow = new JPanel(new BorderLayout(4, 4)); - subjectWindow.setBackground(Color.WHITE); - subjectWindow.setForeground(Color.BLACK); - subjectWindow.add(mainIrrigationWindow, BorderLayout.CENTER); - // setup the SubmitToken View, add the Submit token View - setBackground(Color.WHITE); + + add(getInstructionsPanel(), getInstructionsPanel().getName()); + irrigationGamePanel = new IrrigationGamePanel(screenSize, client); + add(irrigationGamePanel, irrigationGamePanel.getName()); + // add any other panels that need to be switched out. + // FIXME: see if we can simplify the number of instructions panes that Sanket has created. + add(getInstructionsEditorPane()); } - private JLabel infrastructureEfficiencyLabel = new JLabel("Current infrastructure efficiency: "); - - private JPanel getTokenScreenPanel() { + private JPanel getTokenScreenPanel() { if (tokenScreenPanel == null) { - tokenScreenPanel = new JPanel(); + tokenScreenPanel = new JPanel(); tokenScreenPanel.setLayout(new BorderLayout()); tokenInstructionsEditorPane = createInstructionsEditorPane(); tokenInstructionsScrollPane = new JScrollPane(tokenInstructionsEditorPane); tokenScreenPanel.add(tokenInstructionsScrollPane, BorderLayout.CENTER); //setInstructions(getGeneralInstructions(11)); -// StringBuilder tokenSubmissionInstructionsBuilder = new StringBuilder("<h3>The current infrastructure efficiency is: "); -// -// tokenSubmissionInstructionsBuilder.append("% </h3>"); -// tokenSubmissionInstructionsBuilder.append( + // StringBuilder tokenSubmissionInstructionsBuilder = new StringBuilder("<h3>The current infrastructure efficiency is: "); + // + // tokenSubmissionInstructionsBuilder.append("% </h3>"); + // tokenSubmissionInstructionsBuilder.append( StringBuilder tokenSubmissionInstructionsBuilder = new StringBuilder(getGeneralInstructions(11, pagesTraversed)); tokenInstructionsEditorPane.setText(tokenSubmissionInstructionsBuilder.toString()); tokenInstructionsEditorPane.setCaretPosition(0); @@ -188,22 +179,22 @@ updateInfrastructureEfficiencyLabel(); return tokenScreenPanel; } - - public void updateInfrastructureEfficiencyLabel() { - GroupDataModel group = client.getClientGameState().getGroupDataModel(); - RoundConfiguration roundConfiguration = client.getRoundConfiguration(); - int infrastructureEfficiency = 0; - if (roundConfiguration.isPracticeRound() || roundConfiguration.isFirstRound()) { - infrastructureEfficiency = roundConfiguration.getInitialInfrastructureEfficiency(); - } - else { - System.err.println("group was not null, efficiency is: " + group.getInfrastructureEfficiency() + " degrading by " + client.getRoundConfiguration().getInfrastructureDegradationFactor()); - infrastructureEfficiency = group.getInfrastructureEfficiency() - roundConfiguration.getInfrastructureDegradationFactor(); - } - infrastructureEfficiencyLabel.setText("Current infrastructure efficiency: " + infrastructureEfficiency); - infrastructureEfficiencyLabel.repaint(); - } + public void updateInfrastructureEfficiencyLabel() { + GroupDataModel group = client.getClientDataModel().getGroupDataModel(); + RoundConfiguration roundConfiguration = client.getRoundConfiguration(); + int infrastructureEfficiency = 0; + if (roundConfiguration.isPracticeRound() || roundConfiguration.isFirstRound()) { + infrastructureEfficiency = roundConfiguration.getInitialInfrastructureEfficiency(); + } + else { + System.err.println("group was not null, efficiency is: " + group.getInfrastructureEfficiency() + " degrading by " + client.getRoundConfiguration().getInfrastructureDegradationFactor()); + infrastructureEfficiency = group.getInfrastructureEfficiency() - roundConfiguration.getInfrastructureDegradationFactor(); + } + infrastructureEfficiencyLabel.setText("Current infrastructure efficiency: " + infrastructureEfficiency); + infrastructureEfficiencyLabel.repaint(); + } + private JPanel getSubmitTokenPanel() { if (submitTokenPanel == null) { submitTokenPanel = new JPanel(); @@ -215,27 +206,29 @@ return submitTokenPanel; } - private JPanel getWelcomeInstructionsPane() { - if (welcomeInstructionsPane == null) { - welcomeInstructionsPane = new JPanel(); - welcomeInstructionsPane.setLayout(new BorderLayout()); - welcomeInstructionsPane.add(instructionsScrollPane, BorderLayout.CENTER); - welcomeInstructionsPane.add(getNavigationButtonPane(), BorderLayout.SOUTH); - } - return welcomeInstructionsPane; + private JPanel getInstructionsPanel() { + if (instructionsPanel == null) { + instructionsPanel = new JPanel(); + instructionsPanel.setName("General instructions panel"); + instructionsPanel.setLayout(new BorderLayout()); + instructionsPanel.add(instructionsScrollPane, BorderLayout.CENTER); + instructionsPanel.add(getInstructionsNavigationPanel(), BorderLayout.PAGE_END); + } + return instructionsPanel; } - private JPanel getNavigationButtonPane() { - if (navigationPane == null) { - navigationPane = new JPanel(); - navigationPane.setLayout(new BorderLayout()); - navigationPane.add(getNextButton(), BorderLayout.EAST); - navigationPane.add(getPreviousButton(), BorderLayout.WEST); + private JPanel getInstructionsNavigationPanel() { + if (instructionsNavigationPanel == null) { + instructionsNavigationPanel = new JPanel(); + instructionsNavigationPanel.setLayout(new BorderLayout()); + instructionsNavigationPanel.add(getNextButton(), BorderLayout.LINE_START); + instructionsNavigationPanel.add(getPreviousButton(), BorderLayout.LINE_END); + // this is just to add spacing I think. quizLabel = new JLabel(); - navigationPane.add(quizLabel, BorderLayout.CENTER); + instructionsNavigationPanel.add(quizLabel, BorderLayout.CENTER); } - return navigationPane; + return instructionsNavigationPanel; } private JButton getNextButton() { @@ -244,15 +237,15 @@ nextButton.setText("Next"); nextButton.setEnabled(false); nextButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - quizLabel.setText(""); - - previousButton.setEnabled(true); - if(instructionNumber >= pagesTraversed){ - nextButton.setEnabled(false); - } - - // getting the next instruction Number + public void actionPerformed(java.awt.event.ActionEvent e) { + quizLabel.setText(""); + + previousButton.setEnabled(true); + if(instructionNumber >= pagesTraversed){ + nextButton.setEnabled(false); + } + + // getting the next instruction Number if (instructionNumber == NUMBER_INSTRUCTIONS) { } @@ -261,122 +254,123 @@ System.out.println("instruction number : "+instructionNumber+" pages traversed"+pagesTraversed); setInstructions(getGeneralInstructions(instructionNumber,pagesTraversed)); if(instructionNumber == 5){ - quizAnimationLabel.setText(""); - addCenterComponent(getAnimationInstructionPane()); - //addCenterComponent(getTokenScreenPanel()); + quizAnimationLabel.setText(""); + addCenterComponent(getAnimationInstructionPane()); + //addCenterComponent(getTokenScreenPanel()); } else { - addCenterComponent(getWelcomeInstructionsPane()); + addCenterComponent(getInstructionsPanel()); } } - + }); } return nextButton; } - private JPanel getAnimationInstructionPane() { + private JPanel getAnimationInstructionPane() { if (animationInstructionPanel == null) { - animationInstructionPanel = new JPanel(); + animationInstructionPanel = new JPanel(); + animationInstructionPanel.setName("Animated instruction panel"); animationInstructionPanel.setLayout(new BorderLayout()); - animationInstructionPanel.add(getAnimationPane(), BorderLayout.CENTER); - + animationInstructionPanel.add(getAnimationPane(), BorderLayout.CENTER); + animationInstructionPanel.add(getNavigationAnimationPanel(), BorderLayout.SOUTH); animationInstructionPanel.setBackground(Color.WHITE); return animationInstructionPanel; } //System.out.println("instruction number : "+instructionNumber+" pages traversed"+pagesTraversed); animationInstructionsEditorPane.setText(getGeneralInstructions(instructionNumber,pagesTraversed)); - return animationInstructionPanel; - } - - + return animationInstructionPanel; + } + + private JPanel getNavigationAnimationPanel() { if (navigationAnimationPanel == null) { - + navigationAnimationPanel = new JPanel(); navigationAnimationPanel.setLayout(new BorderLayout()); navigationAnimationPanel.add(getNextAnimationButton(), BorderLayout.EAST); navigationAnimationPanel.add(getPreviousAnimationButton(), BorderLayout.WEST); - + quizAnimationLabel.setText(""); navigationAnimationPanel.add(quizAnimationLabel, BorderLayout.CENTER); } return navigationAnimationPanel; - } + } - private JButton getPreviousAnimationButton() { - if (previousAnimationButton == null) { - previousAnimationButton = new JButton(); - previousAnimationButton.setText("Previous"); - previousAnimationButton.setEnabled(true); - previousAnimationButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - quizLabel.setText(""); - // getting the next instruction Number - nextButton.setEnabled(true); - if (instructionNumber == 1) { - - } else - instructionNumber--; - if(instructionNumber > 1) - previousButton.setEnabled(true); - else - previousButton.setEnabled(false); - System.out.println("instruction number : "+instructionNumber+" pages traversed"+pagesTraversed); - setInstructions(getGeneralInstructions(instructionNumber,pagesTraversed)); - addCenterComponent(getWelcomeInstructionsPane()); - } - }); - return previousAnimationButton; + private JButton getPreviousAnimationButton() { + if (previousAnimationButton == null) { + previousAnimationButton = new JButton(); + previousAnimationButton.setText("Previous"); + previousAnimationButton.setEnabled(true); + previousAnimationButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + quizLabel.setText(""); + // getting the next instruction Number + nextButton.setEnabled(true); + if (instructionNumber == 1) { - } - return previousAnimationButton; - } + } else + instructionNumber--; + if(instructionNumber > 1) + previousButton.setEnabled(true); + else + previousButton.setEnabled(false); + System.out.println("instruction number : "+instructionNumber+" pages traversed"+pagesTraversed); + setInstructions(getGeneralInstructions(instructionNumber,pagesTraversed)); + addCenterComponent(getInstructionsPanel()); + } + }); + return previousAnimationButton; - private JButton getNextAnimationButton() { - if (nextAnimationButton == null) { - nextAnimationButton = new JButton(); - nextAnimationButton.setText("Next"); - nextAnimationButton.setEnabled(false); - nextAnimationButton.addActionListener(new java.awt.event.ActionListener() { - + } + return previousAnimationButton; + } - public void actionPerformed(java.awt.event.ActionEvent e) { - quizLabel.setText(""); - previousButton.setEnabled(true); - if(instructionNumber >= pagesTraversed) - nextButton.setEnabled(false); - // getting the next instruction Number - if (instructionNumber != NUMBER_INSTRUCTIONS) { - instructionNumber++; - } - System.out.println("instruction number : "+instructionNumber+" pages traversed"+pagesTraversed); - setInstructions(getGeneralInstructions(instructionNumber,pagesTraversed)); - if(instructionNumber == 5){ - addCenterComponent(getAnimationInstructionPane()); - //addCenterComponent(getTokenScreenPanel()); - } - else - addCenterComponent(getWelcomeInstructionsPane()); - } - - }); + private JButton getNextAnimationButton() { + if (nextAnimationButton == null) { + nextAnimationButton = new JButton(); + nextAnimationButton.setText("Next"); + nextAnimationButton.setEnabled(false); + nextAnimationButton.addActionListener(new java.awt.event.ActionListener() { - } - return nextAnimationButton; - - } - private JPanel getAnimationPane() { + public void actionPerformed(java.awt.event.ActionEvent e) { + quizLabel.setText(""); + previousButton.setEnabled(true); + if(instructionNumber >= pagesTraversed) + nextButton.setEnabled(false); + // getting the next instruction Number + if (instructionNumber != NUMBER_INSTRUCTIONS) { + instructionNumber++; + } + System.out.println("instruction number : "+instructionNumber+" pages traversed"+pagesTraversed); + setInstructions(getGeneralInstructions(instructionNumber,pagesTraversed)); + if(instructionNumber == 5){ + addCenterComponent(getAnimationInstructionPane()); + //addCenterComponent(getTokenScreenPanel()); + } + else + addCenterComponent(getInstructionsPanel()); + } + + }); + + } + return nextAnimationButton; + + } + + private JPanel getAnimationPane() { if (animationPanel == null) { - animationPanel = new JPanel(); - animationPanel.setLayout(new BorderLayout()); - //FIXME: Here the animation panel needs to be decided on fly - //canalPanelAnimation = new CanalPanelAnimation(40); - canalPanelAnimationNew = new CanalAnimationPanel(40); - animationPanel.add(canalPanelAnimationNew,BorderLayout.CENTER); + animationPanel = new JPanel(); + animationPanel.setLayout(new BorderLayout()); + //FIXME: Here the animation panel needs to be decided on fly + //canalPanelAnimation = new CanalPanelAnimation(40); + canalAnimationPanel = new CanalAnimationPanel(40); + animationPanel.add(canalAnimationPanel,BorderLayout.CENTER); animationInstructionsEditorPane = createInstructionsEditorPane(); animationInstructionsScrollPane = new JScrollPane(animationInstructionsEditorPane); animationInstructionsEditorPane.setActionListener(createQuizListener(client.getServerConfiguration())); @@ -390,38 +384,38 @@ animationPanel.setBackground(Color.WHITE); return animationPanel; } - + return animationPanel; - } + } - private JButton getPreviousButton() { + private JButton getPreviousButton() { if (previousButton == null) { previousButton = new JButton(); previousButton.setText("Previous"); previousButton.setEnabled(false); previousButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { - quizLabel.setText(""); + quizLabel.setText(""); // getting the next instruction Number - nextButton.setEnabled(true); + nextButton.setEnabled(true); if (instructionNumber == 1) { - + } else instructionNumber--; if(instructionNumber > 1) - previousButton.setEnabled(true); + previousButton.setEnabled(true); else - previousButton.setEnabled(false); + previousButton.setEnabled(false); System.out.println("instruction number : "+instructionNumber+" pages traversed"+pagesTraversed); setInstructions(getGeneralInstructions(instructionNumber,pagesTraversed)); if(instructionNumber == 5){ - quizAnimationLabel.setText(""); - nextAnimationButton.setEnabled(true); - addCenterComponent(getAnimationInstructionPane()); - //addCenterComponent(getTokenScreenPanel()); + quizAnimationLabel.setText(""); + nextAnimationButton.setEnabled(true); + addCenterComponent(getAnimationInstructionPane()); + //addCenterComponent(getTokenScreenPanel()); } else - addCenterComponent(getWelcomeInstructionsPane()); + addCenterComponent(getInstructionsPanel()); } }); return previousButton; @@ -438,31 +432,31 @@ * @return */ private String getGeneralInstructions(int pageNumber, int pagesTraversed) { - /*if(pageNumber == 2){ + /*if(pageNumber == 2){ if(client.getClientGameState().getPriority()== 0) return client.getServerConfiguration().getGeneralInstructions(20); else return client.getServerConfiguration().getGeneralInstructions(21); }*/ - + return client.getServerConfiguration().getGeneralInstructions(pageNumber,pagesTraversed, - client.getClientGameState().getPriority()); + client.getClientDataModel().getPriority()); } - + private String getGeneralInstructions(int pageNumber) { - return client.getServerConfiguration().getGeneralInstructions(pageNumber); - } + return client.getServerConfiguration().getGeneralInstructions(pageNumber); + } private JTextField getEnterTokens() { if (enterTokens == null) { enterTokens = new JTextField(); enterTokens.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - submitInvestedTokens(); - } + public void actionPerformed(ActionEvent event) { + submitInvestedTokens(); + } }); } - + return enterTokens; } @@ -473,15 +467,15 @@ submitTokensButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { try{ - submitInvestedTokens(); + submitInvestedTokens(); } - catch(NumberFormatException e1){ - enterTokens.setText(""); + catch(NumberFormatException e1){ + enterTokens.setText(""); instructionsBuilder.delete(0, instructionsBuilder.length()); instructionsBuilder.append("\nPlease Enter your tokens within the range 0 -10"); instructionsBuilder.append(getGeneralInstructions(11,pagesTraversed)); tokenInstructionsEditorPane.setText(instructionsBuilder.toString()); - } + } } @@ -490,18 +484,14 @@ } return submitTokensButton; } - + private void submitInvestedTokens() throws NumberFormatException { - int token = Integer.parseInt(enterTokens.getText()); - // validating token range + int token = Integer.parseInt(enterTokens.getText()); + // validating token range if (token >= 0 && token <= 10) { - client.transmitTokenContributed(token); + client.transmitTokenContributed(token); updateInstructions("Please wait while the server computes your total flow capacity based on your group's total token contribution investment."); - addCenterComponent(instructionsEditorPane); - - /* setInstructions(getGeneralInstructions(instructionNumber,pagesTraversed)); - addCenterComponent(getWelcomeInstructionPane());*/ - + addCenterComponent(getInstructionsEditorPane()); } else { enterTokens.setText(""); @@ -514,30 +504,39 @@ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// - private HtmlEditorPane createInstructionsEditorPane() { + private HtmlEditorPane getInstructionsEditorPane() { // JEditorPane pane = new JEditorPane("text/html", // "Costly Sanctioning Experiment"); - final HtmlEditorPane htmlPane = new HtmlEditorPane(); - htmlPane.setPreferredSize(new Dimension(400, 400)); - htmlPane.setEditable(false); - htmlPane.setFont(new Font("serif", Font.PLAIN, 12)); - return htmlPane; + if (instructionsEditorPane == null) { + instructionsEditorPane = createInstructionsEditorPane(); + } + return instructionsEditorPane; } - + private HtmlEditorPane createInstructionsEditorPane() { + HtmlEditorPane htmlEditorPane = new HtmlEditorPane(); + htmlEditorPane.setPreferredSize(new Dimension(400, 400)); + htmlEditorPane.setEditable(false); + htmlEditorPane.setFont(new Font("serif", Font.PLAIN, 12)); + return htmlEditorPane; + } + + + private void addCenterComponent(Component newCenterComponent) { - if (currentCenterComponent != null) { - currentCenterComponent.setVisible(false); - remove(currentCenterComponent); - add(newCenterComponent, BorderLayout.CENTER); - newCenterComponent.setVisible(true); - invalidate(); - validate(); - newCenterComponent.repaint(); - repaint(); - } - currentCenterComponent = newCenterComponent; + cardLayout.show(this, newCenterComponent.getName()); + // if (currentCenterComponent != null) { + // currentCenterComponent.setVisible(false); + // remove(currentCenterComponent); + // add(newCenterComponent, BorderLayout.CENTER); + // newCenterComponent.setVisible(true); + // invalidate(); + // validate(); + // newCenterComponent.repaint(); + // repaint(); + // } + // currentCenterComponent = newCenterComponent; } public void startRound(final RoundConfiguration configuration) { @@ -545,9 +544,9 @@ // currentExperimentConfiguration = configuration; Runnable runnable = new Runnable() { public void run() { - addCenterComponent(subjectWindow); +// addCenterComponent(subjectWindow); requestFocusInWindow(); - + } }; SwingUtilities.invokeLater(runnable); @@ -558,11 +557,11 @@ * rid of the sendContributionStatus then */ public void updateContributions() { - mainIrrigationWindow.updateContributions(state); + irrigationGamePanel.updateContributions(clientDataModel); } public void update() { - mainIrrigationWindow.updateClientStatus(state); + irrigationGamePanel.updateClientStatus(clientDataModel); } /* @@ -570,8 +569,7 @@ * instructionsScrollPane with the debreifing information */ public void updateEndRoundEvent(final EndRoundEvent event) { - // TODO Auto-generated method stub - mainIrrigationWindow.updateEndRoundEvent(); + irrigationGamePanel.endRound(); Runnable runnable = new Runnable() { public void run() { enterTokens.setText(""); @@ -598,58 +596,58 @@ private void addDebriefingText(EndRoundEvent event) { instructionsBuilder.delete(0, instructionsBuilder.length()); - + Map<Identifier,ClientData>clientDataMap = event.getClientDataMap(); - + //create a map of clientData based on priority as the index structure Map<Integer,ClientData>clientDataMapIndexInteger = new LinkedHashMap<Integer,ClientData>(); - - String position = "Your Position is :"; - position = position+mapClientPosition(client.getClientGameState().getPriority()); + + String position = "Your position is :"; + position = position+mapClientPosition(client.getClientDataModel().getPriority()); for(ClientData clientData : clientDataMap.values()){ - clientDataMapIndexInteger.put(new Integer(clientData.getPriority()), clientData); + clientDataMapIndexInteger.put(new Integer(clientData.getPriority()), clientData); } // FIXME: this is horrendous instructionsBuilder.append(String.format( - position+ - "<table><thead><th></th><th></th><th>A</th><th></th><th>B</th><th></th><th>C</th><th></th><th>D</th><th></th><th>E</th></thead><tbody>"+ - "<tr><td>A Initial endowment</td><td></td><td>10</td><td></td><td>10</td><td></td><td>10</td><td></td><td>10</td><td></td><td>10</td></tr>"+ - "<tr><td>B Infrastructure investment</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td></tr>"+ - "<tr><td>C Kept endowment (A - B)</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td></tr>"+ - "<tr><td>D Return from growing crops</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td></tr>"+ - "<tr><td>E Total tokens earned in last round(D+C)</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td></tr>"+ - "<tr><td>F Total dollars earned in this round (E*0.1$)</td><td></td><td>%3.2f</td><td></td><td>%3.2f</td><td></td><td>%3.2f</td><td></td><td>%3.2f</td><td></td><td>%3.2f</td></tr>", - clientDataMapIndexInteger.get(new Integer(0)).getContributedTokens(), - clientDataMapIndexInteger.get(new Integer(1)).getContributedTokens(), - clientDataMapIndexInteger.get(new Integer(2)).getContributedTokens(), - clientDataMapIndexInteger.get(new Integer(3)).getContributedTokens(), - clientDataMapIndexInteger.get(new Integer(4)).getContributedTokens(), - - 10 - clientDataMapIndexInteger.get(new Integer(0)).getContributedTokens(), - 10 - clientDataMapIndexInteger.get(new Integer(1)).getContributedTokens(), - 10 - clientDataMapIndexInteger.get(new Integer(2)).getContributedTokens(), - 10 - clientDataMapIndexInteger.get(new Integer(3)).getContributedTokens(), - 10 - clientDataMapIndexInteger.get(new Integer(4)).getContributedTokens(), - - clientDataMapIndexInteger.get(new Integer(0)).getTotalTokensEarned() - (10 - clientDataMapIndexInteger.get(new Integer(0)).getContributedTokens()), - clientDataMapIndexInteger.get(new Integer(1)).getTotalTokensEarned() - (10 - clientDataMapIndexInteger.get(new Integer(1)).getContributedTokens()), - clientDataMapIndexInteger.get(new Integer(2)).getTotalTokensEarned() - (10 - clientDataMapIndexInteger.get(new Integer(2)).getContributedTokens()), - clientDataMapIndexInteger.get(new Integer(3)).getTotalTokensEarned() - (10 - clientDataMapIndexInteger.get(new Integer(3)).getContributedTokens()), - clientDataMapIndexInteger.get(new Integer(4)).getTotalTokensEarned() - (10 - clientDataMapIndexInteger.get(new Integer(4)).getContributedTokens()), - - clientDataMapIndexInteger.get(new Integer(0)).getTotalTokensEarned(), - clientDataMapIndexInteger.get(new Integer(1)).getTotalTokensEarned(), - clientDataMapIndexInteger.get(new Integer(2)).getTotalTokensEarned(), - clientDataMapIndexInteger.get(new Integer(3)).getTotalTokensEarned(), - clientDataMapIndexInteger.get(new Integer(4)).getTotalTokensEarned(), - - (float)clientDataMapIndexInteger.get(new Integer(0)).getRoundConfiguration().getDollarsPerToken()*clientDataMapIndexInteger.get(new Integer(0)).getTotalTokensEarned(), - (float)clientDataMapIndexInteger.get(new Integer(1)).getRoundConfiguration().getDollarsPerToken()*clientDataMapIndexInteger.get(new Integer(1)).getTotalTokensEarned(), - (float)clientDataMapIndexInteger.get(new Integer(2)).getRoundConfiguration().getDollarsPerToken()*clientDataMapIndexInteger.get(new Integer(2)).getTotalTokensEarned(), - (float)clientDataMapIndexInteger.get(new Integer(3)).getRoundConfiguration().getDollarsPerToken()*clientDataMapIndexInteger.get(new Integer(3)).getTotalTokensEarned(), - (float)clientDataMapIndexInteger.get(new Integer(4)).getRoundConfiguration().getDollarsPerToken()*clientDataMapIndexInteger.get(new Integer(4)).getTotalTokensEarned() - - /* + position+ + "<table><thead><th></th><th></th><th>A</th><th></th><th>B</th><th></th><th>C</th><th></th><th>D</th><th></th><th>E</th></thead><tbody>"+ + "<tr><td>A Initial endowment</td><td></td><td>10</td><td></td><td>10</td><td></td><td>10</td><td></td><td>10</td><td></td><td>10</td></tr>"+ + "<tr><td>B Infrastructure investment</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td></tr>"+ + "<tr><td>C Kept endowment (A - B)</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td></tr>"+ + "<tr><td>D Return from growing crops</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td></tr>"+ + "<tr><td>E Total tokens earned in last round(D+C)</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td><td></td><td>%d</td></tr>"+ + "<tr><td>F Total dollars earned in this round (E*0.1$)</td><td></td><td>%3.2f</td><td></td><td>%3.2f</td><td></td><td>%3.2f</td><td></td><td>%3.2f</td><td></td><td>%3.2f</td></tr>", + clientDataMapIndexInteger.get(new Integer(0)).getContributedTokens(), + clientDataMapIndexInteger.get(new Integer(1)).getContributedTokens(), + clientDataMapIndexInteger.get(new Integer(2)).getContributedTokens(), + clientDataMapIndexInteger.get(new Integer(3)).getContributedTokens(), + clientDataMapIndexInteger.get(new Integer(4)).getContributedTokens(), + + 10 - clientDataMapIndexInteger.get(new Integer(0)).getContributedTokens(), + 10 - clientDataMapIndexInteger.get(new Integer(1)).getContributedTokens(), + 10 - clientDataMapIndexInteger.get(new Integer(2)).getContributedTokens(), + 10 - clientDataMapIndexInteger.get(new Integer(3)).getContributedTokens(), + 10 - clientDataMapIndexInteger.get(new Integer(4)).getContributedTokens(), + + clientDataMapIndexInteger.get(new Integer(0)).getTotalTokensEarned() - (10 - clientDataMapIndexInteger.get(new Integer(0)).getContributedTokens()), + clientDataMapIndexInteger.get(new Integer(1)).getTotalTokensEarned() - (10 - clientDataMapIndexInteger.get(new Integer(1)).getContributedTokens()), + clientDataMapIndexInteger.get(new Integer(2)).getTotalTokensEarned() - (10 - clientDataMapIndexInteger.get(new Integer(2)).getContributedTokens()), + clientDataMapIndexInteger.get(new Integer(3)).getTotalTokensEarned() - (10 - clientDataMapIndexInteger.get(new Integer(3)).getContributedTokens()), + clientDataMapIndexInteger.get(new Integer(4)).getTotalTokensEarned() - (10 - clientDataMapIndexInteger.get(new Integer(4)).getContributedTokens()), + + clientDataMapIndexInteger.get(new Integer(0)).getTotalTokensEarned(), + clientDataMapIndexInteger.get(new Integer(1)).getTotalTokensEarned(), + clientDataMapIndexInteger.get(new Integer(2)).getTotalTokensEarned(), + clientDataMapIndexInteger.get(new Integer(3)).getTotalTokensEarned(), + clientDataMapIndexInteger.get(new Integer(4)).getTotalTokensEarned(), + + (float)clientDataMapIndexInteger.g... [truncated message content] |