[virtualcommons-svn] SF.net SVN: virtualcommons:[317] irrigation/trunk/src/main/java/edu/asu/ commo
Status: Beta
Brought to you by:
alllee
From: <al...@us...> - 2009-10-22 07:00:45
|
Revision: 317 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=317&view=rev Author: alllee Date: 2009-10-22 07:00:32 +0000 (Thu, 22 Oct 2009) Log Message: ----------- client interface is pretty much finalized, next up is testing round configurations and server interaction / persistence. Modified Paths: -------------- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.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/conf/RoundConfiguration.java irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 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-22 06:25:19 UTC (rev 316) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java 2009-10-22 07:00:32 UTC (rev 317) @@ -555,7 +555,7 @@ graphPanel.setName("Graph panel"); graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS)); graphPanel.add(getPieChartPanel()); - graphPanel.add(Box.createVerticalStrut(10)); + graphPanel.add(Box.createVerticalStrut(15)); contributionInformationTextArea = new JTextArea(); contributionInformationTextArea.setEditable(false); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-10-22 06:25:19 UTC (rev 316) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/IrrigationClient.java 2009-10-22 07:00:32 UTC (rev 317) @@ -109,7 +109,7 @@ IrrigationClient client = new IrrigationClient(); client.initialize(); frame.setTitle("Virtual Commons Experiment Client: " + client.id); - frame.setPreferredSize(new Dimension(1024, 768)); + frame.setPreferredSize(new Dimension(1100, 800)); // frame.setResizable(false); frame.getContentPane().add(client.getExperimentGameWindow()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-22 06:25:19 UTC (rev 316) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MainIrrigationGameWindow.java 2009-10-22 07:00:32 UTC (rev 317) @@ -231,15 +231,17 @@ } return jPanelUpStreamWindow; } - + private final static String OPEN_GATE_LABEL = "Click here to open your gate"; + private final static String CLOSE_GATE_LABEL = "Click here to close your gate"; private JButton getGateSwitchButton() { if (gateSwitchButton == null) { - gateSwitchButton = new JButton("Open gate"); + gateSwitchButton = new JButton(OPEN_GATE_LABEL); + gateSwitchButton.setFont(new Font("sansserif", Font.TRUETYPE_FONT, 18)); // gateSwitchButton.setPreferredSize(new Dimension(100, 100)); gateSwitchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { open = !open; - gateSwitchButton.setText( open ? "Close gate" : "Open gate"); + gateSwitchButton.setText( open ? CLOSE_GATE_LABEL : OPEN_GATE_LABEL ); if (open) { client.openGate(); } @@ -499,7 +501,7 @@ // controlPanel.endRound(); centerPanel.removeAll(); canalPanel.endRound(); - gateSwitchButton.setText("Open gate"); + gateSwitchButton.setText(OPEN_GATE_LABEL); } }); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java 2009-10-22 06:25:19 UTC (rev 316) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleScorePanel.java 2009-10-22 07:00:32 UTC (rev 317) @@ -23,11 +23,14 @@ private JLabel positionText; - private JLabel availableFlowCapacityLabel; + private JLabel availableWaterLabel; private JLabel waterCollectedLabel; - private JLabel tokensCollectedLabel; + private JLabel tokensEarnedLabel; + + private JLabel tokensNotInvestedLabel; + private JLabel totalTokensEarnedLabel; private int priority; @@ -46,34 +49,48 @@ this.setPreferredSize(new Dimension(60,200)); this.add(getPositionLabel(),null); this.add(getWaterCollectedLabel(),null); - this.add(getAvailableFlowCapacityLabel(),null); - this.add(getTokensCollectedLabel(),null); - - + this.add(getAvailableWaterLabel(),null); + this.add(getTokensEarnedLabel(),null); +// this.add(getTokensNotInvestedLabel(),null); +// this.add(getTotalTokensEarnedLabel(),null); } + + private JLabel getTotalTokensEarnedLabel() { + if (totalTokensEarnedLabel == null) { + totalTokensEarnedLabel = new JLabel(); + totalTokensEarnedLabel.setBounds(new Rectangle(5,10+32+10+20+10+20+10+20+10+30+30,30,20)); + } + return totalTokensEarnedLabel; + } + + private JLabel getTokensNotInvestedLabel() { + if (tokensNotInvestedLabel == null) { + tokensNotInvestedLabel = new JLabel(String.valueOf(clientData.getUninvestedTokens())); + tokensNotInvestedLabel.setBounds(new Rectangle(5,10+32+10+20+10+20+10+20+10+30,30,20)); + } + return tokensNotInvestedLabel; + } - private JLabel getTokensCollectedLabel() { - if(tokensCollectedLabel == null){ - tokensCollectedLabel = new JLabel(); - tokensCollectedLabel.setBounds(new Rectangle(5,50+32+10+20+10+20+10+20+10,30,20)); - tokensCollectedLabel.setText(""); + private JLabel getTokensEarnedLabel() { + if(tokensEarnedLabel == null){ + tokensEarnedLabel = new JLabel(); + tokensEarnedLabel.setBounds(new Rectangle(5,10+32+10+20+10+20+10+20+10,30,20)); } - return tokensCollectedLabel; + return tokensEarnedLabel; } - private JLabel getAvailableFlowCapacityLabel() { - if(availableFlowCapacityLabel == null){ - availableFlowCapacityLabel = new JLabel(); - availableFlowCapacityLabel.setBounds(new Rectangle(5,50+32+10+20+10,30,20)); - availableFlowCapacityLabel.setText(""); + private JLabel getAvailableWaterLabel() { + if(availableWaterLabel == null){ + availableWaterLabel = new JLabel(); + availableWaterLabel.setBounds(new Rectangle(5,10+32+10+20+10,30,20)); } - return availableFlowCapacityLabel; + return availableWaterLabel; } private JLabel getPositionLabel() { if (positionText == null){ positionText = new JLabel(clientData.getPriorityString()); - positionText.setBounds(new Rectangle(5,50+32+10,30,20)); + positionText.setBounds(new Rectangle(5,10+32+10,30,20)); } return positionText; } @@ -82,16 +99,16 @@ private JLabel getWaterCollectedLabel() { if(waterCollectedLabel == null){ waterCollectedLabel = new JLabel("0"); - waterCollectedLabel.setBounds(new Rectangle(5,50+32+10+20+10+20+10,30,20)); + waterCollectedLabel.setBounds(new Rectangle(5,10+32+10+20+10+20+10,30,20)); } return waterCollectedLabel; } public void update(ClientData clientData) { this.clientData = clientData; - availableFlowCapacityLabel.setText("" + clientData.getAvailableFlowCapacity()); + availableWaterLabel.setText("" + clientData.getAvailableFlowCapacity()); waterCollectedLabel.setText("" + clientData.getWaterCollected()); - tokensCollectedLabel.setText("" + clientData.getAllTokensEarnedThisRound()); + tokensEarnedLabel.setText("" + clientData.getTokensEarnedFromWaterCollected()); if(clientData.isGateOpen() && clientData.getAvailableFlowCapacity() > 0) { // show that client is actively irrigating Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleWindowPanel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleWindowPanel.java 2009-10-22 06:25:19 UTC (rev 316) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/client/MiddleWindowPanel.java 2009-10-22 07:00:32 UTC (rev 317) @@ -36,21 +36,21 @@ this.setBounds(new Rectangle(13,100 + 100 - 50,1093,100+50+50)); this.setSize(new Dimension(1093,200)); - positionLabel = new JLabel(); - positionLabel.setBounds(new Rectangle(30,50+32+10,150,20)); + positionLabel = new JLabel("Position"); + positionLabel.setBounds(new Rectangle(30,10+32+10,200,20)); positionLabel.setText("Position"); - availableWaterLabel = new JLabel(); - availableWaterLabel.setBounds(new Rectangle(30,50+32+10+20+10,200,20)); - availableWaterLabel.setText("Available water per second"); + availableWaterLabel = new JLabel("Available water per second"); + availableWaterLabel.setBounds(new Rectangle(30,10+32+10+20+10,200,20)); - waterCollectedLabel = new JLabel(); - waterCollectedLabel.setBounds(new Rectangle(30,50+32+10+20+10+20+10, 150,20)); - waterCollectedLabel.setText("Water collected"); + waterCollectedLabel = new JLabel("Water collected"); + waterCollectedLabel.setBounds(new Rectangle(30,10+32+10+20+10+20+10, 150,20)); - tokensEarnedLabel = new JLabel(); - tokensEarnedLabel.setBounds(new Rectangle(30,50+32+10+20+10+20+10+20+10, 200,20)); - tokensEarnedLabel.setText("Tokens earned "); + tokensEarnedLabel = new JLabel("Tokens earned"); + tokensEarnedLabel.setBounds(new Rectangle(30,10+32+10+20+10+20+10+20+10, 200,20)); + + totalTokensEarnedLabel = new JLabel("Total tokens earned"); + totalTokensEarnedLabel.setBounds(new Rectangle(30,10+32+10+20+10+20+10+20+10+30, 200,20)); this.add(positionLabel, null); this.add(availableWaterLabel, null); Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-10-22 06:25:19 UTC (rev 316) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/conf/RoundConfiguration.java 2009-10-22 07:00:32 UTC (rev 317) @@ -99,6 +99,10 @@ public void report() { getProperties().list(System.err); } + + public boolean shouldResetInfrastructureEfficiency() { + return getBooleanProperty("reset-infrastructure-efficiency", false); + } public String getInstructions() { return getStringProperty("instructions", Modified: irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java =================================================================== --- irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-22 06:25:19 UTC (rev 316) +++ irrigation/trunk/src/main/java/edu/asu/commons/irrigation/server/GroupDataModel.java 2009-10-22 07:00:32 UTC (rev 317) @@ -128,7 +128,7 @@ // initialize infrastructure efficiency System.err.println("current round number: " + currentRoundNumber); System.err.println("initial infrastructure efficiency: " + infrastructureEfficiency); - if (roundConfiguration.isPracticeRound() || roundConfiguration.isFirstRound()) { + if ( roundConfiguration.shouldResetInfrastructureEfficiency() ) { System.err.println("initializing infrastructure efficiency to default initial value: " + roundConfiguration.getInitialInfrastructureEfficiency()); infrastructureEfficiency = roundConfiguration.getInitialInfrastructureEfficiency(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |