gee-cvs Mailing List for Group Experiments Environment
Status: Alpha
Brought to you by:
alllee
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(53) |
Jun
(167) |
Jul
(304) |
Aug
(73) |
Sep
(97) |
Oct
(126) |
Nov
(157) |
Dec
(61) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(56) |
Feb
(30) |
Mar
(51) |
Apr
(34) |
May
(26) |
Jun
(61) |
Jul
(16) |
Aug
(15) |
Sep
(107) |
Oct
(1) |
Nov
(52) |
Dec
(144) |
2006 |
Jan
(151) |
Feb
(110) |
Mar
(6) |
Apr
(1) |
May
|
Jun
(58) |
Jul
(3) |
Aug
(12) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Allen L. <al...@us...> - 2006-08-18 18:22:56
|
Update of /cvsroot/gabel/gabel/website/jsp In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv3780/website/jsp Modified Files: applet.jsp Log Message: tweaking dimensions to make the game board a wee bit smaller Index: applet.jsp =================================================================== RCS file: /cvsroot/gabel/gabel/website/jsp/applet.jsp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** applet.jsp 14 Aug 2006 18:30:05 -0000 1.4 --- applet.jsp 18 Aug 2006 18:22:46 -0000 1.5 *************** *** 79,83 **** %> <center> ! <applet code='net.sf.gabel.forager.client.ForagerApplet' width=911 height=922 archive='forager-client.jar'> <param name='experiment-hostname' value='groups.psych.indiana.edu'/> <param name='experiment-port' value='4101'/> --- 79,83 ---- %> <center> ! <applet code='net.sf.gabel.forager.client.ForagerApplet' width=761 height=772 archive='forager-client.jar'> <param name='experiment-hostname' value='groups.psych.indiana.edu'/> <param name='experiment-port' value='4101'/> |
From: Allen L. <al...@us...> - 2006-08-18 18:22:56
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv3780/src/net/sf/gabel/forager/client Modified Files: ForagerApplet.java ForagerGameWindow.java SubjectView.java Log Message: tweaking dimensions to make the game board a wee bit smaller Index: ForagerGameWindow.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client/ForagerGameWindow.java,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** ForagerGameWindow.java 14 Aug 2006 20:35:21 -0000 1.92 --- ForagerGameWindow.java 18 Aug 2006 18:22:46 -0000 1.93 *************** *** 205,210 **** while ((nextRoundOn - System.currentTimeMillis()) > 1000) { long millisToNextRound = nextRoundOn - System.currentTimeMillis(); ! timeLeftLabel.setText("Next Round will begin in " + ! (millisToNextRound / 1000L) + " seconds."); repaint(); try { --- 205,210 ---- while ((nextRoundOn - System.currentTimeMillis()) > 1000) { long millisToNextRound = nextRoundOn - System.currentTimeMillis(); ! timeLeftLabel.setText("Next round in " + ! (millisToNextRound / 1000L) + " s"); repaint(); try { *************** *** 511,514 **** --- 511,517 ---- /* * $Log$ + * Revision 1.93 2006/08/18 18:22:46 alllee + * tweaking dimensions to make the game board a wee bit smaller + * * Revision 1.92 2006/08/14 20:35:21 alllee * adding directions to legacy bunnified forager experiment Index: ForagerApplet.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client/ForagerApplet.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ForagerApplet.java 14 Aug 2006 18:30:02 -0000 1.33 --- ForagerApplet.java 18 Aug 2006 18:22:46 -0000 1.34 *************** *** 53,56 **** --- 53,58 ---- public void start() { foragerClient.connect(); + requestFocus(); + requestFocusInWindow(); foragerClient.getForagerGameWindow().requestFocusInWindow(); validate(); *************** *** 76,79 **** --- 78,84 ---- /* * $Log$ + * Revision 1.34 2006/08/18 18:22:46 alllee + * tweaking dimensions to make the game board a wee bit smaller + * * Revision 1.33 2006/08/14 18:30:02 alllee * * Fixing SubjectView size issues in bunnified forager Index: SubjectView.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client/SubjectView.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** SubjectView.java 14 Aug 2006 20:35:21 -0000 1.29 --- SubjectView.java 18 Aug 2006 18:22:46 -0000 1.30 *************** *** 188,201 **** } else if (id.equals(clientId)) { ! if (direction == Direction.DOWN) { return scaledSelfDownImage; } ! else if (direction == Direction.UP) { return scaledSelfUpImage; } ! else if (direction == Direction.LEFT) { return scaledSelfLeftImage; } ! else if (direction == Direction.RIGHT) { return scaledSelfRightImage; } --- 188,202 ---- } else if (id.equals(clientId)) { ! System.err.println("Direction: " + direction); ! if (direction.equals( Direction.DOWN )){ return scaledSelfDownImage; } ! else if (direction.equals( Direction.UP )) { return scaledSelfUpImage; } ! else if (direction.equals( Direction.LEFT )) { return scaledSelfLeftImage; } ! else if (direction.equals( Direction.RIGHT )) { return scaledSelfRightImage; } *************** *** 210,214 **** public void setDirection(Direction direction) { ! this.direction = direction; } } --- 211,217 ---- public void setDirection(Direction direction) { ! if (direction != null) { ! this.direction = direction; ! } } } |
From: Allen L. <al...@us...> - 2006-08-14 20:35:24
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv12520/src/net/sf/gabel/forager/client Modified Files: ForagerClientGameState.java ForagerGameWindow.java SubjectView.java Log Message: adding directions to legacy bunnified forager experiment Index: ForagerGameWindow.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client/ForagerGameWindow.java,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** ForagerGameWindow.java 14 Aug 2006 18:30:03 -0000 1.91 --- ForagerGameWindow.java 14 Aug 2006 20:35:21 -0000 1.92 *************** *** 127,135 **** * then repaints. */ ! public void update() { // FIXME: optimization hotspot. final long roundTimeLeft = roundEndsOn - System.currentTimeMillis(); timeLeftLabel.setText(getTimeLeftLabelText(roundTimeLeft)); foodEatenLabel.setText( String.valueOf(state.getFoodEatenFor(subjectView.getClientId())) ); // String latency = String.valueOf(bytesPerSecond); // if (latency.length() > 4) { --- 127,136 ---- * then repaints. */ ! public void update(Direction direction) { // FIXME: optimization hotspot. final long roundTimeLeft = roundEndsOn - System.currentTimeMillis(); timeLeftLabel.setText(getTimeLeftLabelText(roundTimeLeft)); foodEatenLabel.setText( String.valueOf(state.getFoodEatenFor(subjectView.getClientId())) ); + subjectView.setDirection(direction); // String latency = String.valueOf(bytesPerSecond); // if (latency.length() > 4) { *************** *** 471,475 **** // has begun. roundEndsOn = ( configuration.getRoundTime() * 1000L) + System.currentTimeMillis(); ! update(); switchCenterComponent(instructionsPane, subjectWindow); remove(readyToJoinPanel); --- 472,476 ---- // has begun. roundEndsOn = ( configuration.getRoundTime() * 1000L) + System.currentTimeMillis(); ! update(Direction.DOWN); switchCenterComponent(instructionsPane, subjectWindow); remove(readyToJoinPanel); *************** *** 506,512 **** --- 507,517 ---- System.err.println(message); } + } /* * $Log$ + * Revision 1.92 2006/08/14 20:35:21 alllee + * adding directions to legacy bunnified forager experiment + * * Revision 1.91 2006/08/14 18:30:03 alllee * * Fixing SubjectView size issues in bunnified forager Index: ForagerClientGameState.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client/ForagerClientGameState.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ForagerClientGameState.java 19 Jun 2006 23:53:05 -0000 1.7 --- ForagerClientGameState.java 14 Aug 2006 20:35:21 -0000 1.8 *************** *** 84,88 **** } // double bytesPerSecond = getBytesPerSecond(event.getNumberOfBytes(), event.getCreationTime()); ! window.update(); } --- 84,88 ---- } // double bytesPerSecond = getBytesPerSecond(event.getNumberOfBytes(), event.getCreationTime()); ! window.update(event.getDirection()); } *************** *** 102,105 **** --- 102,108 ---- /* * $Log$ + * Revision 1.8 2006/08/14 20:35:21 alllee + * adding directions to legacy bunnified forager experiment + * * Revision 1.7 2006/06/19 23:53:05 alllee * forager client no longer uses EventChannel singleton instance but instead has an EventChannel per client. This way the EventChannel won't be shared across a single browser's VM running multiple applets. Index: SubjectView.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client/SubjectView.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** SubjectView.java 19 Jun 2006 06:37:59 -0000 1.28 --- SubjectView.java 14 Aug 2006 20:35:21 -0000 1.29 *************** *** 13,16 **** --- 13,17 ---- import java.util.Map; + import net.sf.gabel.forager.Direction; import net.sf.gabel.forager.ExperimentRoundParameters; import net.sf.gabel.forager.GridView; *************** *** 36,39 **** --- 37,41 ---- private Identifier clientId; + private Direction direction; // Map<Point, Duration> *************** *** 186,190 **** } else if (id.equals(clientId)) { ! return scaledSelfDownImage; } else { --- 188,206 ---- } else if (id.equals(clientId)) { ! if (direction == Direction.DOWN) { ! return scaledSelfDownImage; ! } ! else if (direction == Direction.UP) { ! return scaledSelfUpImage; ! } ! else if (direction == Direction.LEFT) { ! return scaledSelfLeftImage; ! } ! else if (direction == Direction.RIGHT) { ! return scaledSelfRightImage; ! } ! else { ! return scaledSelfDownImage; ! } } else { *************** *** 192,194 **** --- 208,214 ---- } } + + public void setDirection(Direction direction) { + this.direction = direction; + } } |
From: Allen L. <al...@us...> - 2006-08-14 20:35:24
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/forager/events In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv12520/src/net/sf/gabel/forager/events Modified Files: ClientPositionUpdateEvent.java Log Message: adding directions to legacy bunnified forager experiment Index: ClientPositionUpdateEvent.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/events/ClientPositionUpdateEvent.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ClientPositionUpdateEvent.java 19 Jun 2006 23:53:06 -0000 1.18 --- ClientPositionUpdateEvent.java 14 Aug 2006 20:35:22 -0000 1.19 *************** *** 6,9 **** --- 6,10 ---- import java.util.Set; + import net.sf.gabel.forager.Direction; import net.sf.gabel.util.Identifier; *************** *** 31,48 **** private final Set<Point> foodPositions; private final boolean foodEaten; ! // private int numberOfBytes; public ClientPositionUpdateEvent(Identifier clientId, Map<Identifier, Point> positions) { ! this(clientId, false, positions); ! } ! ! public ClientPositionUpdateEvent(Identifier clientId, boolean foodEaten, Map<Identifier, Point> positions) { ! this(clientId, foodEaten, positions, null); } ! public ClientPositionUpdateEvent(Identifier clientId, boolean foodEaten, Map<Identifier, Point> positions, Set<Point> foodPositions) { super(clientId); this.foodEaten = foodEaten; this.clientPositions = positions; --- 32,47 ---- private final Set<Point> foodPositions; private final boolean foodEaten; ! ! private final Direction direction; // private int numberOfBytes; public ClientPositionUpdateEvent(Identifier clientId, Map<Identifier, Point> positions) { ! this(clientId, null, false, positions, null); } ! public ClientPositionUpdateEvent(Identifier clientId, Direction direction, boolean foodEaten, Map<Identifier, Point> positions, Set<Point> foodPositions) { super(clientId); + this.direction = direction; this.foodEaten = foodEaten; this.clientPositions = positions; *************** *** 79,82 **** --- 78,85 ---- return clientPositions.get(id); } + + public Direction getDirection() { + return direction; + } *************** *** 88,91 **** --- 91,97 ---- /** * $Log$ + * Revision 1.19 2006/08/14 20:35:22 alllee + * adding directions to legacy bunnified forager experiment + * * Revision 1.18 2006/06/19 23:53:06 alllee * forager client no longer uses EventChannel singleton instance but instead has an EventChannel per client. This way the EventChannel won't be shared across a single browser's VM running multiple applets. |
From: Allen L. <al...@us...> - 2006-08-14 20:35:24
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/forager/server In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv12520/src/net/sf/gabel/forager/server Modified Files: ForagerServer.java Log Message: adding directions to legacy bunnified forager experiment Index: ForagerServer.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/server/ForagerServer.java,v retrieving revision 1.146 retrieving revision 1.147 diff -C2 -d -r1.146 -r1.147 *** ForagerServer.java 19 Jun 2006 06:37:58 -0000 1.146 --- ForagerServer.java 14 Aug 2006 20:35:22 -0000 1.147 *************** *** 569,576 **** } foragerGameState.moveClient(id, direction); ! // friction model - erase their last move. ! // consider a velocity model instead? gives slightly smoother ! // motion.. ! clients.put(id, null); } Set botParticipants = agents.keySet(); --- 569,573 ---- } foragerGameState.moveClient(id, direction); ! } Set botParticipants = agents.keySet(); *************** *** 592,595 **** --- 589,593 ---- ClientPositionUpdateEvent event = new ClientPositionUpdateEvent(id, + (Direction) clients.get(id), foragerGameState.hasClientEaten(id), foragerGameState.getClientPositions(), *************** *** 603,606 **** --- 601,608 ---- iter.remove(); } + // friction model - erase their last move. + // consider a velocity model instead? gives slightly smoother + // motion.. + clients.put(id, null); } catch (IOException e) { *************** *** 616,619 **** --- 618,622 ---- Agent agent = (Agent) agents.get(id); agent.update(new ClientPositionUpdateEvent(id, + null, foragerGameState.hasClientEaten(id), foragerGameState.getClientPositions(), *************** *** 957,960 **** --- 960,966 ---- /* * $Log$ + * Revision 1.147 2006/08/14 20:35:22 alllee + * adding directions to legacy bunnified forager experiment + * * Revision 1.146 2006/06/19 06:37:58 alllee * preparing to set up newer cuter forager interface in old cvs codebase as gee still isn't ready for deploying (going to can database configuration in gee for a while in favor of file-based configuration, then fold these changes back in as well). |
From: Allen L. <al...@us...> - 2006-08-14 20:35:24
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/server/datagram In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv12520/src/net/sf/gabel/server/datagram Removed Files: Dispatcher.java Log Message: adding directions to legacy bunnified forager experiment --- Dispatcher.java DELETED --- |
From: Allen L. <al...@us...> - 2006-08-14 18:30:41
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/forager/conf In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv27365/src/net/sf/gabel/forager/conf Modified Files: experiment1.ini experiment2.ini experiment3.ini experiment4.ini experiment5.ini experiment6.ini experiment7.ini experiment8.ini forager.ini Log Message: * Fixing SubjectView size issues in bunnified forager * special instructions are now looked up via http URL instead of in the classpath. * minor hygiene Index: experiment3.ini =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/conf/experiment3.ini,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** experiment3.ini 25 Nov 2005 22:20:21 -0000 1.7 --- experiment3.ini 14 Aug 2006 18:30:03 -0000 1.8 *************** *** 28,32 **** food-region2-probability 0.3 ! number-of-bots 0 humans-for-save 1 --- 28,32 ---- food-region2-probability 0.3 ! number-of-bots 5 humans-for-save 1 Index: experiment2.ini =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/conf/experiment2.ini,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** experiment2.ini 25 Nov 2005 22:20:21 -0000 1.7 --- experiment2.ini 14 Aug 2006 18:30:03 -0000 1.8 *************** *** 13,21 **** variable-speed false ! food-rate 0.06 show-other-subjects true show-food true ! agent-movement-rate 0.33 minimum-separation 25 --- 13,21 ---- variable-speed false ! food-rate 0.25 show-other-subjects true show-food true ! agent-movement-rate 0.25 minimum-separation 25 *************** *** 28,32 **** food-region2-probability 0.3 ! number-of-bots 0 humans-for-save 1 --- 28,32 ---- food-region2-probability 0.3 ! number-of-bots 5 humans-for-save 1 Index: experiment5.ini =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/conf/experiment5.ini,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** experiment5.ini 25 Nov 2005 22:20:21 -0000 1.1 --- experiment5.ini 14 Aug 2006 18:30:04 -0000 1.2 *************** *** 28,32 **** food-region2-probability 0.3 ! number-of-bots 0 humans-for-save 1 --- 28,32 ---- food-region2-probability 0.3 ! number-of-bots 5 humans-for-save 1 Index: experiment7.ini =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/conf/experiment7.ini,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** experiment7.ini 25 Nov 2005 22:20:21 -0000 1.1 --- experiment7.ini 14 Aug 2006 18:30:04 -0000 1.2 *************** *** 28,32 **** food-region2-probability 0.3 ! number-of-bots 0 humans-for-save 1 --- 28,32 ---- food-region2-probability 0.3 ! number-of-bots 5 humans-for-save 1 Index: experiment8.ini =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/conf/experiment8.ini,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** experiment8.ini 25 Nov 2005 22:20:21 -0000 1.1 --- experiment8.ini 14 Aug 2006 18:30:04 -0000 1.2 *************** *** 28,32 **** food-region2-probability 0.3 ! number-of-bots 0 humans-for-save 1 --- 28,32 ---- food-region2-probability 0.3 ! number-of-bots 5 humans-for-save 1 Index: experiment1.ini =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/conf/experiment1.ini,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** experiment1.ini 25 Nov 2005 22:20:21 -0000 1.17 --- experiment1.ini 14 Aug 2006 18:30:03 -0000 1.18 *************** *** 13,21 **** variable-speed false ! food-rate 0.3 show-other-subjects true show-food true ! agent-movement-rate 0.33 minimum-separation 25 --- 13,21 ---- variable-speed false ! food-rate 0.25 show-other-subjects true show-food true ! agent-movement-rate 0.25 minimum-separation 25 *************** *** 28,32 **** food-region2-probability 0.3 ! number-of-bots 0 humans-for-save 1 --- 28,32 ---- food-region2-probability 0.3 ! number-of-bots 5 humans-for-save 1 Index: forager.ini =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/conf/forager.ini,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** forager.ini 26 Nov 2005 00:32:05 -0000 1.28 --- forager.ini 14 Aug 2006 18:30:05 -0000 1.29 *************** *** 1,14 **** ! number-experiments 8 loop-forever true wait-time 25 experiment1 experiment1.ini ! experiment2 experiment5.ini ! experiment3 experiment2.ini ! experiment4 experiment6.ini ! experiment5 experiment3.ini ! experiment6 experiment7.ini ! experiment7 experiment4.ini ! experiment8 experiment8.ini # used for KNS connection --- 1,8 ---- ! number-experiments 2 loop-forever true wait-time 25 experiment1 experiment1.ini ! experiment2 experiment2.ini # used for KNS connection Index: experiment4.ini =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/conf/experiment4.ini,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** experiment4.ini 25 Nov 2005 22:20:21 -0000 1.1 --- experiment4.ini 14 Aug 2006 18:30:03 -0000 1.2 *************** *** 28,32 **** food-region2-probability 0.3 ! number-of-bots 0 humans-for-save 1 --- 28,32 ---- food-region2-probability 0.3 ! number-of-bots 5 humans-for-save 1 Index: experiment6.ini =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/conf/experiment6.ini,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** experiment6.ini 25 Nov 2005 22:20:21 -0000 1.1 --- experiment6.ini 14 Aug 2006 18:30:04 -0000 1.2 *************** *** 28,32 **** food-region2-probability 0.3 ! number-of-bots 0 humans-for-save 1 --- 28,32 ---- food-region2-probability 0.3 ! number-of-bots 5 humans-for-save 1 |
From: Allen L. <al...@us...> - 2006-08-14 18:30:38
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/util In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv27365/src/net/sf/gabel/util Modified Files: Utils.java Log Message: * Fixing SubjectView size issues in bunnified forager * special instructions are now looked up via http URL instead of in the classpath. * minor hygiene Index: Utils.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/util/Utils.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Utils.java 19 Jun 2006 06:37:59 -0000 1.5 --- Utils.java 14 Aug 2006 18:30:05 -0000 1.6 *************** *** 8,11 **** --- 8,12 ---- import java.io.InputStreamReader; import java.io.ObjectOutputStream; + import java.net.URL; import java.util.logging.Logger; *************** *** 42,45 **** --- 43,61 ---- return numberOfBytes; } + + public static StringBuffer getURLResource(String resource) { + try { + URL url = new URL("http", "groups.psych.indiana.edu", resource); + InputStream stream = url.openStream(); + if (stream == null) { + throw new IllegalArgumentException("Couldn't find resource: " + resource); + } + return getTextResource(stream); + } + catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } public static StringBuffer getTextResource(String resource) { *************** *** 78,81 **** --- 94,103 ---- /* * $Log$ + * Revision 1.6 2006/08/14 18:30:05 alllee + * * Fixing SubjectView size issues in bunnified forager + * * special instructions are now looked up via http URL instead of in the + * classpath. + * * minor hygiene + * * Revision 1.5 2006/06/19 06:37:59 alllee * preparing to set up newer cuter forager interface in old cvs codebase as gee still isn't ready for deploying (going to can database configuration in gee for a while in favor of file-based configuration, then fold these changes back in as well). |
From: Allen L. <al...@us...> - 2006-08-14 18:30:36
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv27365/src/net/sf/gabel/forager/client Modified Files: ForagerApplet.java ForagerGameWindow.java Log Message: * Fixing SubjectView size issues in bunnified forager * special instructions are now looked up via http URL instead of in the classpath. * minor hygiene Index: ForagerGameWindow.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client/ForagerGameWindow.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** ForagerGameWindow.java 19 Jun 2006 23:53:05 -0000 1.90 --- ForagerGameWindow.java 14 Aug 2006 18:30:03 -0000 1.91 *************** *** 116,122 **** // it can adjust appropriately when given a board size // FIXME: should scale proportionally instead of by a static offset. ! Dimension viewSize = new Dimension((int) (screenSize.width * .75), (int) (screenSize.height * .75)); ! subjectView = new SubjectView(viewSize, state); ! debriefingView = new DebriefingView(viewSize); initGuiComponents(); } --- 116,122 ---- // it can adjust appropriately when given a board size // FIXME: should scale proportionally instead of by a static offset. ! // Dimension viewSize = new Dimension((int) (screenSize.width * .75), (int) (screenSize.height * .75)); ! subjectView = new SubjectView(screenSize, state); ! debriefingView = new DebriefingView(screenSize); initGuiComponents(); } *************** *** 263,267 **** private void initGuiComponents() { ! setLayout(new BorderLayout(4, 4)); instructionsEditorPane = new JEditorPane("text/html", "Welcome to Forager"); instructionsEditorPane.setFont(new Font("Arial", Font.BOLD, 12)); --- 263,268 ---- private void initGuiComponents() { ! setBackground(Color.WHITE); ! setLayout(new BorderLayout()); instructionsEditorPane = new JEditorPane("text/html", "Welcome to Forager"); instructionsEditorPane.setFont(new Font("Arial", Font.BOLD, 12)); *************** *** 292,300 **** add(instructionsPane, BorderLayout.CENTER); // 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(subjectView, BorderLayout.CENTER); - setBackground(Color.WHITE); JLabel logoLabel = new JLabel(new ImageIcon(subjectView.getForagerLogo())); --- 293,300 ---- add(instructionsPane, BorderLayout.CENTER); // setup the Subject Window, add the experiment view ! subjectWindow = new JPanel(new BorderLayout()); subjectWindow.setBackground(Color.WHITE); subjectWindow.setForeground(Color.BLACK); subjectWindow.add(subjectView, BorderLayout.CENTER); JLabel logoLabel = new JLabel(new ImageIcon(subjectView.getForagerLogo())); *************** *** 429,434 **** // FIXME: hard coded height of forager-logo.gif size.height -= 122; - // FIXME: hard coded width of side gif. size.width -= 111; subjectView.setScreenSize(size); subjectView.repaint(); --- 429,434 ---- // FIXME: hard coded height of forager-logo.gif size.height -= 122; size.width -= 111; + System.err.println("XXX: resizing to: " + size); subjectView.setScreenSize(size); subjectView.repaint(); *************** *** 509,512 **** --- 509,518 ---- /* * $Log$ + * Revision 1.91 2006/08/14 18:30:03 alllee + * * Fixing SubjectView size issues in bunnified forager + * * special instructions are now looked up via http URL instead of in the + * classpath. + * * minor hygiene + * * Revision 1.90 2006/06/19 23:53:05 alllee * forager client no longer uses EventChannel singleton instance but instead has an EventChannel per client. This way the EventChannel won't be shared across a single browser's VM running multiple applets. Index: ForagerApplet.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/client/ForagerApplet.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ForagerApplet.java 19 Jun 2006 23:53:06 -0000 1.32 --- ForagerApplet.java 14 Aug 2006 18:30:02 -0000 1.33 *************** *** 3,6 **** --- 3,7 ---- import java.awt.BorderLayout; import java.awt.Color; + import java.awt.Dimension; import java.net.MalformedURLException; import java.util.Properties; *************** *** 75,78 **** --- 76,85 ---- /* * $Log$ + * Revision 1.33 2006/08/14 18:30:02 alllee + * * Fixing SubjectView size issues in bunnified forager + * * special instructions are now looked up via http URL instead of in the + * classpath. + * * minor hygiene + * * Revision 1.32 2006/06/19 23:53:06 alllee * forager client no longer uses EventChannel singleton instance but instead has an EventChannel per client. This way the EventChannel won't be shared across a single browser's VM running multiple applets. |
From: Allen L. <al...@us...> - 2006-08-14 18:30:35
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/forager In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv27365/src/net/sf/gabel/forager Modified Files: ExperimentRoundParameters.java GridView.java Log Message: * Fixing SubjectView size issues in bunnified forager * special instructions are now looked up via http URL instead of in the classpath. * minor hygiene Index: GridView.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/GridView.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** GridView.java 4 Jul 2006 22:37:50 -0000 1.38 --- GridView.java 14 Aug 2006 18:30:02 -0000 1.39 *************** *** 133,144 **** public void setScreenSize(Dimension screenSize) { this.screenSize = screenSize; int availableWidth = (int) screenSize.getWidth(); int availableHeight = (int) screenSize.getHeight(); if (boardSize == null) { ! setBoardSize( new Dimension((int) (availableWidth * .8), (int) (availableHeight * .8)) ); } - - // stretch board to the max dw = (availableWidth / boardSize.getWidth()); dh = (availableHeight / boardSize.getHeight()); --- 133,145 ---- public void setScreenSize(Dimension screenSize) { + System.err.println("setting screen size: " + screenSize); + System.err.println("board size: " + boardSize); this.screenSize = screenSize; int availableWidth = (int) screenSize.getWidth(); int availableHeight = (int) screenSize.getHeight(); + // stretch board to the max if (boardSize == null) { ! boardSize = screenSize; } dw = (availableWidth / boardSize.getWidth()); dh = (availableHeight / boardSize.getHeight()); Index: ExperimentRoundParameters.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/ExperimentRoundParameters.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExperimentRoundParameters.java 19 Jun 2006 06:37:57 -0000 1.1 --- ExperimentRoundParameters.java 14 Aug 2006 18:30:02 -0000 1.2 *************** *** 398,403 **** resource = "food-invisible-agents-invisible.html"; } ! StringBuffer buffer = Utils.getTextResource( ! ForagerConfiguration.getDefaultConfigurationDirectory() + resource); return (buffer == null) ? "Couldn't find special instructions: " + resource : buffer.toString(); --- 398,403 ---- resource = "food-invisible-agents-invisible.html"; } ! ! StringBuffer buffer = Utils.getURLResource("/instructions/forager/" + resource); return (buffer == null) ? "Couldn't find special instructions: " + resource : buffer.toString(); |
From: Allen L. <al...@us...> - 2006-08-14 18:30:35
|
Update of /cvsroot/gabel/gabel In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv27365 Modified Files: build.xml manifest.mf Log Message: * Fixing SubjectView size issues in bunnified forager * special instructions are now looked up via http URL instead of in the classpath. * minor hygiene Index: manifest.mf =================================================================== RCS file: /cvsroot/gabel/gabel/manifest.mf,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** manifest.mf 24 Jun 2006 23:45:34 -0000 1.8 --- manifest.mf 14 Aug 2006 18:30:02 -0000 1.9 *************** *** 1,5 **** Manifest-Version: 1.0 Ant-Version: Apache Ant 1.6.5 ! Created-By: 1.5.0_06-56 ("Apple Computer, Inc.") ! Main-Class: net.sf.gabel.social.client.SocialClient --- 1,5 ---- Manifest-Version: 1.0 Ant-Version: Apache Ant 1.6.5 ! Created-By: 1.5.0_07-b03 (Sun Microsystems Inc.) ! Main-Class: net.sf.gabel.forager.client.ForagerApplet Index: build.xml =================================================================== RCS file: /cvsroot/gabel/gabel/build.xml,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** build.xml 24 Jun 2006 23:45:34 -0000 1.58 --- build.xml 14 Aug 2006 18:30:01 -0000 1.59 *************** *** 484,487 **** --- 484,489 ---- <delete dir="${test.results.home}"/> <mkdir dir="${test.results.home}"/> + <!-- FIXME: not running tests right now since Gentoo's ant + junit is + fubared <junit fork="yes" haltonfailure="yes" printsummary="yes"> <jvmarg value="-Dforager.configuration=${forager.configuration}"/> *************** *** 495,498 **** --- 497,501 ---- </batchtest> </junit> + --> </target> *************** *** 513,516 **** --- 516,525 ---- <!-- $Log$ + Revision 1.59 2006/08/14 18:30:01 alllee + * Fixing SubjectView size issues in bunnified forager + * special instructions are now looked up via http URL instead of in the + classpath. + * minor hygiene + Revision 1.58 2006/06/24 23:45:34 wayward_bruce Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. |
From: Allen L. <al...@us...> - 2006-08-14 18:30:15
|
Update of /cvsroot/gabel/gabel/website/jsp In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv27365/website/jsp Modified Files: applet.jsp Log Message: * Fixing SubjectView size issues in bunnified forager * special instructions are now looked up via http URL instead of in the classpath. * minor hygiene Index: applet.jsp =================================================================== RCS file: /cvsroot/gabel/gabel/website/jsp/applet.jsp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** applet.jsp 4 Jul 2006 22:37:50 -0000 1.3 --- applet.jsp 14 Aug 2006 18:30:05 -0000 1.4 *************** *** 11,14 **** --- 11,20 ---- <%@ page import='java.rmi.Naming' %> + <%! + final String DEFAULT_HOST_NAME = "groups.psych.indiana.edu"; + String experimentServer = DEFAULT_HOST_NAME; + String experimentPort = "4301"; + %> + <% // 1. process incoming form input and save it to a file (name, age). Verify *************** *** 49,58 **** // Connect to the KNS server, find the first available forager server, and // connect them to it! ! final String HOST_NAME = "groups.psych.indiana.edu"; ! // final String HOST_NAME = "localhost"; final String KNS_PORT = "4100"; ! final String KNS_SERVER = "rmi://" + HOST_NAME + ":" + KNS_PORT + "/kns"; ! String experimentServer = HOST_NAME; ! String experimentPort = "4301"; try { RmiServer server = (RmiServer) Naming.lookup(KNS_SERVER); --- 55,61 ---- // Connect to the KNS server, find the first available forager server, and // connect them to it! ! // final String DEFAULT_HOST_NAME = "localhost"; final String KNS_PORT = "4100"; ! final String KNS_SERVER = "rmi://" + DEFAULT_HOST_NAME + ":" + KNS_PORT + "/kns"; try { RmiServer server = (RmiServer) Naming.lookup(KNS_SERVER); *************** *** 73,83 **** out.println("<pre><font color='red'>" + exception + "</font></pre>"); } - out.println("<center>"); - out.println("<applet code='net.sf.gabel.forager.client.ForagerApplet' width=900 height=700 archive='forager-client.jar'>"); - out.println("<param name='experiment-hostname' value='" + experimentServer +" ' />"); - out.println("<param name='experiment-port' value='" + experimentPort + "'/>"); - out.println("</applet>"); - out.println("</center>"); - out.println("</body></html>"); } %> --- 76,87 ---- out.println("<pre><font color='red'>" + exception + "</font></pre>"); } } %> + <center> + <applet code='net.sf.gabel.forager.client.ForagerApplet' width=911 height=922 archive='forager-client.jar'> + <param name='experiment-hostname' value='groups.psych.indiana.edu'/> + <param name='experiment-port' value='4101'/> + </applet> + </center> + </body> + </html> |
From: Zoran R. <way...@us...> - 2006-07-10 15:04:18
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/social/problems In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv7583/src/net/sf/gabel/social/problems Modified Files: SumProblem.java Log Message: Removed extraneous initializers. Index: SumProblem.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/problems/SumProblem.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SumProblem.java 24 Jun 2006 23:45:33 -0000 1.3 --- SumProblem.java 10 Jul 2006 15:04:11 -0000 1.4 *************** *** 20,28 **** public class SumProblem extends Problem { // GLOBALS ! private int correctSum = 0; ! private int current_groupsum = 0; ! private int num_feedback = 0; ! private boolean foundanswer; ! private Random rand = new Random(); public SumProblem(Map parameters) { --- 20,28 ---- public class SumProblem extends Problem { // GLOBALS ! private int correctSum; ! private int current_groupsum; ! private int num_feedback; ! private boolean foundanswer; ! private Random rand = new Random(); public SumProblem(Map parameters) { |
From: Allen L. <al...@us...> - 2006-07-04 22:37:53
|
Update of /cvsroot/gabel/gabel/website/jsp In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv19206/website/jsp Modified Files: applet.jsp consent.jsp Log Message: hackfixing NPE in GridView and tweaking applet parameters in applet/consent Index: consent.jsp =================================================================== RCS file: /cvsroot/gabel/gabel/website/jsp/consent.jsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** consent.jsp 19 Jun 2006 19:44:51 -0000 1.1 --- consent.jsp 4 Jul 2006 22:37:50 -0000 1.2 *************** *** 171,175 **** </TABLE> ! <form action='applet.jsp' name='consent' onsubmit='return validate();'> <table> <tr> --- 171,175 ---- </TABLE> ! <form method="post" action='applet.jsp' name='consent' onsubmit='return validate();'> <table> <tr> Index: applet.jsp =================================================================== RCS file: /cvsroot/gabel/gabel/website/jsp/applet.jsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** applet.jsp 19 Jun 2006 23:12:21 -0000 1.2 --- applet.jsp 4 Jul 2006 22:37:50 -0000 1.3 *************** *** 23,31 **** if (name == null || "".equals(name)) { // error page. ! response.sendRedirect(request.getContextPath() + "/forager-consent.jsp"); } else if (ageString == null || "".equals(ageString)) { // error page. ! response.sendRedirect(request.getContextPath() + "/forager-consent.jsp"); } else { --- 23,31 ---- if (name == null || "".equals(name)) { // error page. ! response.sendRedirect(request.getContextPath() + "/consent.jsp"); } else if (ageString == null || "".equals(ageString)) { // error page. ! response.sendRedirect(request.getContextPath() + "/consent.jsp"); } else { *************** *** 33,37 **** if (age < 18) { // send em to the error page. ! response.sendRedirect("forager-consent.jsp"); } --- 33,37 ---- if (age < 18) { // send em to the error page. ! response.sendRedirect("consent.jsp"); } *************** *** 74,78 **** } out.println("<center>"); ! out.println("<applet code='net.sf.gabel.forager.client.ForagerApplet' width=800 height=600 archive='forager-client.jar'>"); out.println("<param name='experiment-hostname' value='" + experimentServer +" ' />"); out.println("<param name='experiment-port' value='" + experimentPort + "'/>"); --- 74,78 ---- } out.println("<center>"); ! out.println("<applet code='net.sf.gabel.forager.client.ForagerApplet' width=900 height=700 archive='forager-client.jar'>"); out.println("<param name='experiment-hostname' value='" + experimentServer +" ' />"); out.println("<param name='experiment-port' value='" + experimentPort + "'/>"); |
From: Allen L. <al...@us...> - 2006-07-04 22:37:53
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/forager In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv19206/src/net/sf/gabel/forager Modified Files: GridView.java Log Message: hackfixing NPE in GridView and tweaking applet parameters in applet/consent Index: GridView.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/forager/GridView.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** GridView.java 19 Jun 2006 23:12:05 -0000 1.37 --- GridView.java 4 Jul 2006 22:37:50 -0000 1.38 *************** *** 136,139 **** --- 136,142 ---- int availableWidth = (int) screenSize.getWidth(); int availableHeight = (int) screenSize.getHeight(); + if (boardSize == null) { + setBoardSize( new Dimension((int) (availableWidth * .8), (int) (availableHeight * .8)) ); + } // stretch board to the max |
From: Zoran R. <way...@us...> - 2006-06-24 23:46:08
|
Update of /cvsroot/gabel/gabel/website/html/social In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083/website/html/social Modified Files: lagrange-example3.gif lagrange-example2.gif lagrange-example1.gif Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. Index: lagrange-example1.gif =================================================================== RCS file: /cvsroot/gabel/gabel/website/html/social/lagrange-example1.gif,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsTANoKK and /tmp/cvscc5Zid differ Index: lagrange-example3.gif =================================================================== RCS file: /cvsroot/gabel/gabel/website/html/social/lagrange-example3.gif,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsGbjoNM and /tmp/cvs7QpoQf differ Index: lagrange-example2.gif =================================================================== RCS file: /cvsroot/gabel/gabel/website/html/social/lagrange-example2.gif,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsyVpZ8R and /tmp/cvs9Jpknl differ |
From: Zoran R. <way...@us...> - 2006-06-24 23:46:06
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/social/problems In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083/src/net/sf/gabel/social/problems Modified Files: SumProblem.java SumAnswer.java SumGuess.java Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. Index: SumProblem.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/problems/SumProblem.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SumProblem.java 2 Nov 2005 01:03:13 -0000 1.2 --- SumProblem.java 24 Jun 2006 23:45:33 -0000 1.3 *************** *** 1,4 **** --- 1,5 ---- package net.sf.gabel.social.problems; + import java.awt.Graphics; import java.awt.Dimension; *************** *** 10,13 **** --- 11,15 ---- import net.sf.gabel.util.Identifier; + /** * @author robertsm *************** *** 17,117 **** public class SumProblem extends Problem { ! // GLOBALS ! private int correctSum = 0; ! private int current_groupsum = 0; ! private int num_feedback = 0; ! private int foundanswer = 0; ! private Random rand = new Random(); ! ! ! public SumProblem(Map parameters) { ! super(parameters); ! ! correctSum = rand.nextInt((Integer.parseInt((String) parameters.get("max_num")) / 2)); ! correctSum += (Integer.parseInt((String) parameters.get("max_num")) / 2); ! num_feedback = Integer.parseInt((String) parameters.get("num_feedback")); ! current_groupsum = 0; ! foundanswer = 0; ! } ! ! public Answer makeGuess(Identifier id, Guess g) { ! if (g instanceof SumGuess) return this.makeGuess((SumGuess) g); ! return (Answer) null; ! } ! /** ! * Takes a guess, adds to groupsum, returns null as answer for now ! * ! */ ! public Answer makeGuess(SumGuess g) { ! ! current_groupsum += Integer.parseInt(g.toString()); ! return (Answer) null; ! } ! public Answer getAnswer() { ! //This function is called by SocialServer to finally get the answer for everyone ! int temp = current_groupsum; ! int groupDiff = temp - correctSum; ! String groupanswer = null; ! ! //reset current_groupsum for the next round after this is called by SocialServer ! current_groupsum = 0; ! if (groupDiff > 0) ! { ! if (num_feedback==1) {//then numeric feedback ! groupanswer = new String("TOO HIGH by " + groupDiff); ! } ! else { ! groupanswer = new String("TOO HIGH"); ! } ! } ! else if (groupDiff < 0) ! { ! if (num_feedback==1) { ! groupanswer = new String("TOO LOW by " + Math.abs(groupDiff)); ! } ! else { ! groupanswer = new String("TOO LOW"); ! } ! } ! else if (groupDiff == 0) ! { ! groupanswer = new String("Correct answer: " + correctSum); ! foundanswer = 1; ! } ! else ! { ! groupanswer = new String("There was an error in calculating the group sum."); ! } ! ! SumAnswer sum = new SumAnswer(groupanswer); ! return (Answer) sum; } ! //Socialserver needs to know whether to stop the experiment early ! public boolean foundanswer() { ! if (foundanswer==1) return (true); ! else return (false); } - - //there is no individual best guess, so return null - public Guess getBestGuess() { - return (Guess) null; - } ! public Answer getBestAnswer() { ! //SocialServer prints this to data file instead of "getBestGuess" ! SumAnswer sum = new SumAnswer("" + correctSum); ! return (Answer) sum; ! } ! public String toString() { ! return ""; ! } } - --- 19,102 ---- public class SumProblem extends Problem { ! // GLOBALS ! private int correctSum = 0; ! private int current_groupsum = 0; ! private int num_feedback = 0; ! private boolean foundanswer; ! private Random rand = new Random(); ! public SumProblem(Map parameters) { ! super(parameters); ! correctSum = rand.nextInt((Integer.parseInt((String) parameters.get("max_num")) / 2)); ! correctSum += (Integer.parseInt((String) parameters.get("max_num")) / 2); ! num_feedback = Integer.parseInt((String) parameters.get("num_feedback")); ! current_groupsum = 0; ! } ! public Answer makeGuess (Identifier id, Guess g) { ! if (g instanceof SumGuess) ! return this.makeGuess((SumGuess) g); ! return (Answer) null; ! } ! /** ! * Takes a guess, adds to groupsum, returns null as answer for now ! * ! */ ! public Answer makeGuess (SumGuess g) { ! current_groupsum += g.getGuess(); ! return (Answer) null; ! } ! public Answer getAnswer () { ! //This function is called by SocialServer to finally get the answer for everyone ! int temp = current_groupsum; ! int groupDiff = temp - correctSum; ! SumAnswer answer; ! ! //reset current_groupsum for the next round after this is called by SocialServer ! current_groupsum = 0; ! if (groupDiff > 0) { ! if (num_feedback == 1) { //then numeric feedback ! answer = new SumAnswer("Too high by " + groupDiff, false); ! } else { ! answer = new SumAnswer("Too high", false); ! } ! answer.setPaintingHint(1); // positive: "greater than" hint ! } else if (groupDiff < 0) { ! if (num_feedback == 1) { ! answer = new SumAnswer("Too low by " + (-groupDiff), false); ! } else { ! answer = new SumAnswer("Too low", false); ! } ! answer.setPaintingHint(-1); // negative: "less than" hint ! } else { ! answer = new SumAnswer("*** Correct answer: " + correctSum + " ***", true); ! foundanswer = true; ! answer.setPaintingHint(0); // zero: "correct guess" hint ! } ! ! return answer; } ! //Socialserver needs to know whether to stop the experiment early ! public boolean foundanswer () { ! return foundanswer; } ! //there is no individual best guess, so return null ! public Guess getBestGuess () { ! return (Guess) null; ! } ! public Answer getBestAnswer () { ! //SocialServer prints this to data file instead of "getBestGuess" ! SumAnswer sum = new SumAnswer("" + correctSum, true); ! return (Answer)sum; ! } ! public String toString () { ! return ""; ! } } Index: SumAnswer.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/problems/SumAnswer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SumAnswer.java 17 Sep 2005 01:52:09 -0000 1.1 --- SumAnswer.java 24 Jun 2006 23:45:33 -0000 1.2 *************** *** 1,4 **** --- 1,5 ---- package net.sf.gabel.social.problems; + /** * $Id$ *************** *** 7,34 **** */ public class SumAnswer extends Answer { - private String answer; ! public SumAnswer() { ! answer = new String("No answer calculated"); ! } ! public SumAnswer(String sum) { ! answer = new String(sum); ! } - public String toString() { - return new String(answer); - } ! public int compareTo(Object o) { ! if (o instanceof SumAnswer) return compareTo((SumAnswer) o); ! return 0; ! } ! /** ! * Doesn't seem applicable to this task, return 0 ! */ ! public int compareTo(SumAnswer a) { ! return 0; ! } } --- 8,55 ---- */ public class SumAnswer extends Answer { ! private String answer; ! private boolean correct; ! private int hint; ! public SumAnswer(String answer, boolean correct) { ! this.answer = answer; ! this.correct = correct; ! } ! public boolean isCorrect() { ! return correct; ! } ! /** ! * Sets the hint for components rendering this answer. ! * ! * @param hint ! */ ! public void setPaintingHint(int hint) { ! this.hint = hint; ! } ! ! public int getPaintingHint() { ! return hint; ! } ! ! public String toString() { ! return answer; ! } ! ! public int compareTo(Object o) { ! if (o instanceof SumAnswer) ! return compareTo((SumAnswer) o); ! ! return 0; ! } ! ! /** ! * Doesn't seem applicable to this task, return 0 ! */ ! public int compareTo(SumAnswer a) { ! return 0; ! } } Index: SumGuess.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/problems/SumGuess.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SumGuess.java 17 Sep 2005 01:52:09 -0000 1.1 --- SumGuess.java 24 Jun 2006 23:45:33 -0000 1.2 *************** *** 26,29 **** --- 26,33 ---- } + public int getGuess() { + return one_guess; + } + public String toString() { return new Integer(one_guess).toString(); |
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/social/events In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083/src/net/sf/gabel/social/events Modified Files: GameStartEvent.java EnterEvent.java GameEndEvent.java Added Files: ExperimentStateEvent.java URIEvent.java Removed Files: GameEndEvent2.java Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. --- NEW FILE: ExperimentStateEvent.java --- package net.sf.gabel.social.events; import net.sf.gabel.event.AbstractEvent; import net.sf.gabel.util.Identifier; public class ExperimentStateEvent extends AbstractEvent { /** * */ private static final long serialVersionUID = -2406649664421495663L; private int queued; private int ready; private int gameNumber; private int totalGames; public int getGameNumber () { return gameNumber; } public void setGameNumber (int gameNumber) { this.gameNumber = gameNumber; } public int getTotalGames () { return totalGames; } public void setTotalGames (int totalGames) { this.totalGames = totalGames; } public ExperimentStateEvent(Identifier id) { super(id); } public int getQueued () { return queued; } public void setQueued (int queued) { this.queued = queued; } public int getReady () { return ready; } public void setReady (int ready) { this.ready = ready; } } --- GameEndEvent2.java DELETED --- Index: EnterEvent.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/events/EnterEvent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EnterEvent.java 27 Dec 2005 01:38:06 -0000 1.2 --- EnterEvent.java 24 Jun 2006 23:45:33 -0000 1.3 *************** *** 19,33 **** private static final long serialVersionUID = 3625679040116622549L; ! /* ! * Whether the client wants to be a monitor or not ! */ private boolean isMonitor; ! public EnterEvent(Identifier id, boolean asMonitor) { super(id); ! // TODO perform some authorisation ! isMonitor = asMonitor; } public boolean isMonitor() { return isMonitor; --- 19,41 ---- private static final long serialVersionUID = 3625679040116622549L; ! private String name; ! private int age; private boolean isMonitor; ! public EnterEvent(Identifier id, String name, int age, boolean isMonitor) { super(id); ! this.name = name; ! this.age = age; ! this.isMonitor = isMonitor; ! } ! ! public String getName() { ! return name; } + public int getAge() { + return age; + } + public boolean isMonitor() { return isMonitor; --- NEW FILE: URIEvent.java --- package net.sf.gabel.social.events; import java.net.URI; import net.sf.gabel.event.AbstractEvent; import net.sf.gabel.util.Identifier; public class URIEvent extends AbstractEvent { private URI uri; public URIEvent(Identifier id, URI uri) { super(id); this.uri = uri; } public URI getURI() { return uri; } } Index: GameEndEvent.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/events/GameEndEvent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GameEndEvent.java 27 Feb 2006 04:54:51 -0000 1.2 --- GameEndEvent.java 24 Jun 2006 23:45:33 -0000 1.3 *************** *** 18,31 **** */ public class GameEndEvent extends AbstractEvent { - /** - * - */ private static final long serialVersionUID = 7789265661409021876L; private Guess bestGuess; private Answer bestAnswer; public GameEndEvent(Identifier id, Guess bestGuess, Answer bestAnswer) { super(id); - this.bestGuess = bestGuess; this.bestAnswer = bestAnswer; --- 18,32 ---- */ public class GameEndEvent extends AbstractEvent { private static final long serialVersionUID = 7789265661409021876L; + + public static final int ACTION_DEBRIEF = 0; + public static final int ACTION_REVIEW = 1; + private Guess bestGuess; private Answer bestAnswer; + private int action = ACTION_DEBRIEF; public GameEndEvent(Identifier id, Guess bestGuess, Answer bestAnswer) { super(id); this.bestGuess = bestGuess; this.bestAnswer = bestAnswer; *************** *** 39,41 **** --- 40,50 ---- return this.bestAnswer; } + + public void setAction(int action) { + this.action = action; + } + + public int getAction() { + return action; + } } Index: GameStartEvent.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/events/GameStartEvent.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GameStartEvent.java 27 Feb 2006 04:54:51 -0000 1.3 --- GameStartEvent.java 24 Jun 2006 23:45:33 -0000 1.4 *************** *** 21,31 **** private static final long serialVersionUID = 4977962323718855965L; ! private int roundLength = 0; ! public boolean isMonitored; public GameStartEvent(Identifier id) { super(id); } public void setRoundLength (int i) { roundLength = i; --- 21,41 ---- private static final long serialVersionUID = 4977962323718855965L; ! private int roundLength; ! private int totalParticipants; ! private boolean monitored; + public GameStartEvent(Identifier id) { super(id); } + public void setMonitored(boolean monitored) { + this.monitored = monitored; + } + + public boolean isMonitored() { + return monitored; + } + public void setRoundLength (int i) { roundLength = i; *************** *** 36,38 **** --- 46,56 ---- } + public void setTotalParticipants(int total) { + totalParticipants = total; + } + + public int getTotalParticipants() { + return totalParticipants; + } + } |
From: Zoran R. <way...@us...> - 2006-06-24 23:46:05
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/util In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083/src/net/sf/gabel/util Modified Files: KeyAliasFactory.java Removed Files: LikertScale.java Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. Index: KeyAliasFactory.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/util/KeyAliasFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeyAliasFactory.java 2 Nov 2005 01:03:13 -0000 1.2 --- KeyAliasFactory.java 24 Jun 2006 23:45:32 -0000 1.3 *************** *** 27,31 **** * A key must be an Object with a string representation (i.e. must implement toString() method).</br> * Since the set of all possible keys (<i>K</i>) is <i>K</i> â <i>N</i>, we create the ! * set of human-readable aliases (<i>A</i>) in such a way to ensure</br> * </br> * <i>A</i> = { "<i>a'</i>", "<i>a'_x</i>" | <i>a'</i> â <i>A'</i> â <i>x</i> â <i>N</i> U {0} }</br> --- 27,31 ---- * A key must be an Object with a string representation (i.e. must implement toString() method).</br> * Since the set of all possible keys (<i>K</i>) is <i>K</i> â <i>N</i>, we create the ! * set of human-readable aliases (<i>A</i>) in such a way to ensure that</br> * </br> * <i>A</i> = { "<i>a'</i>", "<i>a'_x</i>" | <i>a'</i> â <i>A'</i> â <i>x</i> â <i>N</i> U {0} }</br> *************** *** 78,82 **** totalKeys = keys.size(); Arrays.sort(sortedKeys, comparator); - System.err.println("** net.sf.gabel.util.ClientAliasFactory: cached " + totalKeys + " keys"); } --- 78,81 ---- --- LikertScale.java DELETED --- |
From: Zoran R. <way...@us...> - 2006-06-24 23:45:41
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/social In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083/src/net/sf/gabel/social Modified Files: ColorTheme.java Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. Index: ColorTheme.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/ColorTheme.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ColorTheme.java 27 Feb 2006 04:59:17 -0000 1.1 --- ColorTheme.java 24 Jun 2006 23:45:35 -0000 1.2 *************** *** 10,13 **** --- 10,18 ---- public static final Color INACTIVE_COLOR = Color.GRAY; // color for inactive elements of interaction + public static final Color SUM_TOO_HIGH_COLOR = new Color(0xCC6600); // dark orange + public static final Color SUM_TOO_LOW_COLOR = new Color(0x008811); // green + public static final Color SUM_CORRECT_COLOR = TEXT_COLOR; + + public static Color colorByActivity(boolean active) { if (active) *************** *** 16,18 **** --- 21,42 ---- return INACTIVE_COLOR; } + + public static String colorToHtml(Color color) { + // we can't use String.format(...) from Java 1.5 + // NOTE: this only works for single-byte component values (i.e. up to 24bpp color depths) + final char[] hex = { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' + }; + return new StringBuffer(7). + append('#'). + append(hex[color.getRed() >> 4]). + append(hex[color.getRed() & 0xf]). + append(hex[color.getGreen() >> 4]). + append(hex[color.getGreen() & 0xf]). + append(hex[color.getBlue() >> 4]). + append(hex[color.getBlue() & 0xf]). + toString(); + } + } |
From: Zoran R. <way...@us...> - 2006-06-24 23:45:41
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/social/conf In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083/src/net/sf/gabel/social/conf Modified Files: experiment1.conf welcome.html experiment2.conf Added Files: picture-problem.html picture-debrief.html Removed Files: lagrange-debrief.html lagrange-problem.html Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. Index: experiment1.conf =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/conf/experiment1.conf,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** experiment1.conf 30 Dec 2005 05:10:18 -0000 1.13 --- experiment1.conf 24 Jun 2006 23:45:33 -0000 1.14 *************** *** 6,10 **** <experiment name="first experiment" numberRounds="12" guessTime="20" humansForSave="5" fillBotsTo="20"> <graph type="null" randomEdges="0"/> ! <function type="lagrange"> <parameter name="width" value="7"/> <parameter name="height" value="7"/> --- 6,10 ---- <experiment name="first experiment" numberRounds="12" guessTime="20" humansForSave="5" fillBotsTo="20"> <graph type="null" randomEdges="0"/> ! <function type="picture"> <parameter name="width" value="7"/> <parameter name="height" value="7"/> --- lagrange-problem.html DELETED --- Index: welcome.html =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/conf/welcome.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** welcome.html 22 Mar 2005 06:41:40 -0000 1.2 --- welcome.html 24 Jun 2006 23:45:33 -0000 1.3 *************** *** 7,11 **** Welcome to the Social Choice. Please feel free to share this experiment ! with others who may be interested. Click the "Let's Get Started" button below to start. --- 7,11 ---- Welcome to the Social Choice. Please feel free to share this experiment ! with others who may be interested. Click the "Let's Start" button below to start. --- lagrange-debrief.html DELETED --- --- NEW FILE: picture-problem.html --- <HTML> <HEAD> <TITLE>Picture Game Experiment</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H3>Instructions</H3> This is an experiment on collective problem solving. At the beginning of each experiment, the computer will create a randomly generated secret picture made up of 3 curves. Here are some examples of possible pictures: <P> <TABLE CELLPADDING="4" CELLSPACING="2" BORDER="0"> <TR> <TD> <IMG SRC="http://groups.psych.indiana.edu/social/example1.gif" ALT="example 1"> </TD><TD> <IMG SRC="http://groups.psych.indiana.edu/social/example2.gif" ALT="example 2"> </TD><TD> <IMG SRC="http://groups.psych.indiana.edu/social/example3.gif" ALT="example 3"> </TD> </TR> </TABLE> <P> Your task is to try to draw pictures that are as similar as possible to the computer's secret picture. You draw your picture by using the mouse. Clicking on a square that is off will turn the square on, and vice versa. At the end of each round you will be told what percentage of your picture's squares match the computer's picture. For example, the two pictures <P> <TABLE CELLPADDING="4" CELLSPACING="2" BORDER="0"> <TR> <TD> <IMG SRC="http://groups.psych.indiana.edu/social/example4.gif" ALT="example 4"> </TD><TD> <IMG SRC="http://groups.psych.indiana.edu/social/example5.gif" ALT="example 5"> </TD> </TR> </TABLE> <P> match on 80% or 20 out 25 of their squares. <P> After every round of guessing pictures, you will be shown your picture and its square-by-square similarity to the secret picture. In some experiments, you will also be shown the pictures drawn by other participants on the last round, and the similarity of those pictures to the secret picture. You can use this information as hints to figure out what the hidden picture is. </BODY> </HTML> Index: experiment2.conf =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/conf/experiment2.conf,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** experiment2.conf 30 Dec 2005 05:10:18 -0000 1.4 --- experiment2.conf 24 Jun 2006 23:45:33 -0000 1.5 *************** *** 6,10 **** <experiment name="second experiment" numberRounds="12" guessTime="20" humansForSave="5" fillBotsTo="20"> <graph type="lattice" randomEdges="0"/> ! <function type="lagrange"> <parameter name="width" value="7"/> <parameter name="height" value="7"/> --- 6,10 ---- <experiment name="second experiment" numberRounds="12" guessTime="20" humansForSave="5" fillBotsTo="20"> <graph type="lattice" randomEdges="0"/> ! <function type="picture"> <parameter name="width" value="7"/> <parameter name="height" value="7"/> --- NEW FILE: picture-debrief.html --- <HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H3>Debriefing</H3> The experiment that you just completed explores how innovations and ideas spread in a group of people. One of the most well-known results in social psychology is that people often conform to the opinion of the group to which they belong. Typically this conformity is interpreted negatively, as indicating people's spinelessness or manipulability. However, this is a negative construal of behavior that is sometimes positive. Often, it is smart to borrow from the good ideas of other people. Other people have experiences that you have not had, and you can take advantage of their experiences by following their example if they have been successful. <P> In this experiment, you were trying to find good solutions to a problem, and you could take advantage of the solutions that other people previously discovered. You were able to see the choices made by some of your neighbors, and the resulting outcomes of those choices. At the same time, your neighbors could see the choices that you made. <P> <I>We are interested in the following questions:</I><BR> <OL> <LI> how quickly do good solutions travel in a group, <LI> how does the transmission of ideas depend on how people are connected to each other, and <LI> under what circumstances does the entire group get stuck in a solution that is suboptimal. </OL> <P> We are using the results from this experiment to better understand how knowledge disseminates in a group of people, how ideas are changed as they move from person to person, and how to make people in a group communicate effectively. <P> If you would like a further debriefing, contact Professor Robert Goldstone at <A HREF="mailto:rgo...@in...">rgo...@in...</A>. Visit <A HREF="http://cognitrn.psych.indiana.edu/">http://cognitrn.psych.indiana.edu/</A> for more information on our laboratory. Thank you for your participation in this experiment! <P> <B>Some relevant references to work on social problem solving:</B> <UL> <LI>Abrams, D., Wetherell, M., Cochrane, S., Hogg, M. A., & Turner, J. C. (1990). Knowing what to think by knowing who you are: Self-categorization and the nature of norm formation, conformity, and group polarization. British Journal of Social Psychology, 29, 97-119. <LI>Axelrod, R. (1997). The dissemination of culture: A model with local convergence and global polarization. Journal of Confllict Resolution, 41, 203-226. <LI>Arrow, H., McGrath, J. E.,& Berdahl, J. L. (2000). Small groups as complex systems: Formation, coordination, development, and adaptation. Newbury Park, CA: Sage. <LI>Bandura, A. (1962). Vicarious processes: A case of no-trial learning. In L. Berkowitz (Ed.), Advances in Experimental Social Psychology, 2, 1-155. <LI>Blackmore, S. (1999). The meme machine. Oxford, England: Oxford University Press. <LI>Bourgeois, M. J., & Bowen, A. M. (2001). Self-organization of alcohol-related attitudes and beliefs in a campus housing complex. Health Psychology, 20, 434-437. <LI>Boyd, R., & Richerson, P. J. (1985). Culture and the evolutionary process. Chicago: University of Chicgago Press. <LI>Bullnheimer B., Dawid H., Zeller R. (1998). Learning from own and foreign experience: technological adaptation by imitating firms. Computational and Mathematical Organizational Theory, 4, 267-282. <LI>Cialdini, R. B. (1995). A full-cycle approach to social psychology. In G. C. Brannigan & M. R. Merrens (Eds.), The social psychologists: Research adventures (pp. 52. New York: McGraw-Hill. <LI>Cialdini, R. B., & Goldstein, N. J. (2004). Social influence: Compliance and conformity. Annual Review of Psychology, 55, 591-621. <LI>Cialdini, R. B., Wosinska, W., Barret, D.W., Butner, J., & Gornik-Durose, M. (1999). Compliance with a request in two cultures: The differential influence of social proof and commitment/consistency on collectivists and individualists. Personality & Social Psychology Bulletin, 25, 1242-1253. <LI>Chwe, MS-Y. (1999). Structure and strategy in collective action. American Journal of Sociology, 105, 128-156. <LI>Conway, L. G. III, & Schaller, M. (1998). Methods for the measurement of consensual beliefs within groups. Group Dynamics, 2, 241-252. <LI>Davis, J. H. (1973). Group decision and social interaction: A theory of social decision schemes. Psychological Review, 80, 97-125. <LI>Davis, J. H., Au, W., Hulbert, L., Chen, X., & Zarnoth, P. (1997). Effect of group size and procedural influence on consensual judgment of quantity: The example of damage awards on mock civil juries. Journal of Personality and Social Psychology, 57, 1000-1012. <LI>Deutsch, M., & Gerard, H. B. (1955). A study of normative and informative social influences upon individual judgment. Journal of Abnormal Social Psychology, 51, 629-636. <LI>Gladwell, M. (2000). The tipping point. New York: Little, Brown, and Company. <LI>Epstein, J. M., & Axtell, R. (1996). Growing artificial societies: Social science from the bottom up. Washington, DC: Brookings Institution and Cambridge, MA: MIT Press. <LI>Harvey, N., Harries, C., & Fischer, I. (2000). Using advice and assessing its quality. Organization Behavior and Human Decision Processes, 81, 252-273. <LI>Helbing, D., Keltsch, J., & Molnar, P. (1997). Modeling the evolution of human trail systems. Nature, 388, 47-50. <LI>Kendal, R. L., Coolen, I., Laland, K. N. (2004). The role of conformity in foraging when personal and social information conflict. Behavioral Ecology, 15, 269-277. <LI>Kennedy, J., & Eberhart, R. C. (2001). Swarm intelligence. San Francisco, CA: Morgan Kaufmann. <LI>Kenrick, D. T.,Norman, P. L, & Butner, J. (2003). Dynamical evolutionary psychology: Individual decision rules and emergent social norms. Psychological Review, 110, 3-28. <LI>Latane, B. (1996). Dynamic social impact: The creation of culture by communication. Journal of Communication, 46, 13-25. <LI>Latane, B., & Bourgeois, M. J. (1996). Experimental evidence for dynamic social impact: The formations of subcultures in electronic groups. Journal of Communication, 46, 35-47. <LI>Latane, B.,&Bourgeois, M. J. (2000). Dynamic social impact and the Helbing, D., Keltsch, J., & Moln <LI>In R. S. Tindale & M. Hogg (Eds.), Handbook of social psychology: Vol. 4. Group processes. London: Blackwell. <LI>Latane, B., & L'Herrou, T. (1996). Spatial clustering in the conformity game: Dynamic social impact in electronic group. Journal of Personality and Social Psychology, 70, 1218-1230. <LI>Levine, J. M., Resnick, L. B., & Higgins, E. T. (1993). Social foundations of cognition. Annual Review of Psychology, 44, 585-612. <LI>Macy, M. W., & Willer, R. (2002). From factors to actors: Computational sociology and agent-based modeling. Annual Review of Sociology, 28, 143-166. <LI>Martin, R., & Hewstone, M. (2001). Conformity and independence in groups: Majorities and minorities. In M. A. Hogg, & S. Tindale (Eds.) Blackwell handbook of social psychology: Group processes. Malden, MA: Blackwell. (pp. 209-234). <LI>Nowak, A., Szamrej, J., & Latane, B. (1990). From private attitude to public opinion: A dynamic theory of social impact. Psychological Review, 97, 362-376. <LI>Rogers, E.M. (1995). Diffusion of Innovations. New York: The Free Press. Rosenkopf, L., & Abrahamson, E. (1999). Modeling reputational and information influences in threshold models of bandwagon innovation diffusion. Journal of Computational and Mathematical Organizational Theory, 5, 361-384. <LI>Stamps, J. A. (1988). Conspecific attraction and aggregation in territorial species. American Naturalist, 131, 329-347. <LI>Sterman, J. D. (1989). Modeling managerial behavior: Misperceptions of feedback in a dynamic decision making experiment. Management science, 35, 321-339. <LI>Strang, D., & Macy, M. (2001). In search of excellence: Fads, success stories, and adaptive emulation. American Journal of Sociology, 107, 147-182. <LI>Vallacher, R. R., Nowak, A. and Kaufman, J. (1994) Intrinsic dynamics of social judgment. Journal of Personality and Social Psychology, 67, 20-34. </UL> </BODY> </HTML> |
From: Zoran R. <way...@us...> - 2006-06-24 23:45:40
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/server/dispatcher In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083/src/net/sf/gabel/server/dispatcher Modified Files: SocialDispatcher.java Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. Index: SocialDispatcher.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/server/dispatcher/SocialDispatcher.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SocialDispatcher.java 27 Feb 2006 03:56:27 -0000 1.9 --- SocialDispatcher.java 24 Jun 2006 23:45:35 -0000 1.10 *************** *** 28,32 **** import net.sf.gabel.event.Event; import net.sf.gabel.event.EventChannel; - import net.sf.gabel.event.StreamEvent; import net.sf.gabel.util.SymmetryMap; --- 28,31 ---- *************** *** 45,54 **** public class SocialDispatcher implements Runnable { - private static final int MODE_COOKED = 0; // it's irresistible :) - private static final int MODE_RAW = 1; - private int mode = MODE_COOKED; - private final static int INT_SIZE = 4; - private final static int READ_BUFFER_SIZE = 6000; //private final static int WRITE_BUFFER_SIZE = 6000; --- 44,48 ---- *************** *** 76,88 **** private Thread dispatcherThread; public SocialDispatcher() { ! ; } - /** - * package private to enforce access via the DispatcherFactory. - */ public SocialDispatcher(int workerPoolSize) { this.workerPoolSize = workerPoolSize; } --- 70,81 ---- private Thread dispatcherThread; + public SocialDispatcher() { ! this(8); } public SocialDispatcher(int workerPoolSize) { this.workerPoolSize = workerPoolSize; + initWorkerPool(workerPoolSize); } *************** *** 166,170 **** */ public Identifier connect (String host, int port) { - start(); return connect(new InetSocketAddress(host, port)); } --- 159,162 ---- *************** *** 217,236 **** /** - * Sends raw data read from a stream to the remote end. - * - * @param to receiver - * @param streamEvent container Event - */ - public void write (Identifier id, StreamEvent streamEvent) throws IllegalArgumentException, IOException { - SocketChannel channel = getChannel(id); - write(id, (Event) Event.class.cast(streamEvent)); - write(channel, streamEvent.getStream(), streamEvent.getLength()); - // how we do this actually depends on how data is received; - // best to have a thread (already there?) that reads data as it comes - // and feeds it into PipedOutputStream stream. Also possible to do it - // inside dispatcher's own thread, but not advisable. - } - - /** * Writes the given Event to the appropriate channel. * Hopefully the receiving end knows what type it's getting. --- 209,212 ---- *************** *** 385,399 **** Event e = (Event) ois.readObject(); ! // handle mode change request ! if (e instanceof StreamEvent) { ! StreamEvent streamEvent = (StreamEvent) e; ! // prepare to read raw data ! mode = MODE_RAW; ! rawLength = streamEvent.getLength(); ! stream = new PipedOutputStream(); ! // send StreamEvent down to handler(s) ! return new StreamEvent(streamEvent.id(), new PipedInputStream(stream), rawLength); ! } else ! return e; } catch (IOException e) { e.printStackTrace(); --- 361,365 ---- Event e = (Event) ois.readObject(); ! return e; } catch (IOException e) { e.printStackTrace(); *************** *** 461,468 **** if (incoming != null) { incoming.configureBlocking(false); - Identifier id = new SocketIdentifier(incoming.socket()); - connectionMap.put(id, incoming); worker.process(incoming); - eventChannel.handle(new ClientConnectEvent(id)); } } --- 427,431 ---- *************** *** 585,588 **** --- 548,554 ---- incoming.configureBlocking(false); incoming.register(selector, SelectionKey.OP_READ); + Identifier id = new SocketIdentifier(incoming.socket()); + connectionMap.put(id, incoming); + eventChannel.handle(new ClientConnectEvent(id)); } catch (IOException e) { e.printStackTrace(); *************** *** 615,618 **** --- 581,587 ---- /** * $Log$ + * Revision 1.10 2006/06/24 23:45:35 wayward_bruce + * Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. + * * Revision 1.9 2006/02/27 03:56:27 wayward_bruce * A plethora of changes: - added StreamEvent handling, RAW and COOKED modes (internal states only) - fixed SocialDispatcherWorker.compareTo(Object) so that it orders properly in sorted sets - removed some unneccessary threads - cleaned up SocialDispatcher.write() - and a few bugfixes left over by Andy |
From: Zoran R. <way...@us...> - 2006-06-24 23:45:38
|
Update of /cvsroot/gabel/gabel In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083 Modified Files: build.xml .project Added Files: manifest.mf Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. --- NEW FILE: manifest.mf --- Manifest-Version: 1.0 Ant-Version: Apache Ant 1.6.5 Created-By: 1.5.0_06-56 ("Apple Computer, Inc.") Main-Class: net.sf.gabel.social.client.SocialClient Index: build.xml =================================================================== RCS file: /cvsroot/gabel/gabel/build.xml,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** build.xml 19 Jun 2006 07:46:16 -0000 1.57 --- build.xml 24 Jun 2006 23:45:34 -0000 1.58 *************** *** 47,51 **** <property name="javadoc.private.home" value="docs/private"/> <property name="client.dist.jarfile" value="forager-client.jar"/> - <property name="social.jarfile" value="social-client.jar"/> <!-- Set up the CLASSPATH, includes all jars in the lib --- 47,50 ---- *************** *** 145,149 **** </target> ! <target name='social-client-jar' depends='compile-social'> <chmod dir='${build.home}' perm='a+rx' type='dir' includes='**'/> <chmod dir='${build.home}' perm='a+r' type='file' includes='**'/> --- 144,148 ---- </target> ! <target name='picture-client-jar' depends='compile-social'> <chmod dir='${build.home}' perm='a+rx' type='dir' includes='**'/> <chmod dir='${build.home}' perm='a+r' type='file' includes='**'/> *************** *** 152,156 **** </manifest> ! <jar destfile='social-client.jar' manifest='manifest.mf'> <fileset dir='${build.home}'> <include name='net/sf/gabel/server/**' /> --- 151,155 ---- </manifest> ! <jar destfile='picture-client.jar' manifest='manifest.mf'> <fileset dir='${build.home}'> <include name='net/sf/gabel/server/**' /> *************** *** 163,167 **** </target> ! <target name='social-server-jar' depends='compile-social'> <chmod dir='${build.home}' perm='a+rx' type='dir' includes='**'/> <chmod dir='${build.home}' perm='a+r' type='file' includes='**'/> --- 162,166 ---- </target> ! <target name='picture-server-jar' depends='compile-social'> <chmod dir='${build.home}' perm='a+rx' type='dir' includes='**'/> <chmod dir='${build.home}' perm='a+r' type='file' includes='**'/> *************** *** 170,174 **** </manifest> ! <jar destfile='social-server.jar' manifest='manifest.mf'> <fileset dir='${build.home}'> <include name='net/sf/gabel/server/**' /> --- 169,173 ---- </manifest> ! <jar destfile='picture-server.jar' manifest='manifest.mf'> <fileset dir='${build.home}'> <include name='net/sf/gabel/server/**' /> *************** *** 181,187 **** </target> ! <target name='social-release' depends='social-server-jar,social-client-jar'> <copy todir='${build.release}/jars' file='social-server.jar' overwrite='true'/> ! <copy todir='${build.release}/htdocs/social' file='social-client.jar' overwrite='true'/> </target> --- 180,186 ---- </target> ! <target name='picture-release' depends='picture-server-jar,picture-client-jar'> <copy todir='${build.release}/jars' file='social-server.jar' overwrite='true'/> ! <copy todir='${build.release}/htdocs/social' file='picture-client.jar' overwrite='true'/> </target> *************** *** 514,517 **** --- 513,519 ---- <!-- $Log$ + Revision 1.58 2006/06/24 23:45:34 wayward_bruce + Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. + Revision 1.57 2006/06/19 07:46:16 alllee adding forager.configuration sysproperty to standalone client target Index: .project =================================================================== RCS file: /cvsroot/gabel/gabel/.project,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** .project 25 Nov 2005 20:28:52 -0000 1.3 --- .project 24 Jun 2006 23:45:34 -0000 1.4 *************** *** 11,14 **** --- 11,24 ---- </arguments> </buildCommand> + <buildCommand> + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> + <triggers>full,incremental,</triggers> + <arguments> + <dictionary> + <key>LaunchConfigHandle</key> + <value><project>/.externalToolBuilders/ant build.launch</value> + </dictionary> + </arguments> + </buildCommand> </buildSpec> <natures> |
From: Zoran R. <way...@us...> - 2006-06-24 23:45:38
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/social/conf/musical In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083/src/net/sf/gabel/social/conf/musical Modified Files: problem.html Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. Index: problem.html =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/conf/musical/problem.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** problem.html 1 Mar 2006 20:06:23 -0000 1.6 --- problem.html 24 Jun 2006 23:45:35 -0000 1.7 *************** *** 5,9 **** <body> <h3>Instructions</h3> - <p>This experiment explores how opinions form in a group. You will participate as a member of a group in a series of experiments. --- 5,8 ---- *************** *** 16,23 **** ("Excellent"). In addition to giving a simple rating, you will need to write a short explanation of why you chose to rank it that way.</p> <p>Here is what an experiment window looks like: <img src="http://groups.psych.indiana.edu/social/musical-screenshot.gif" alt="screenshot with explanations of key areas"></p> ! <p>To submit your opinion for the round simply click on the circle beside the desired rating, then type your explanation in the box below, and finally click "Submit your opinion" at the bottom of the window.</p> --- 15,28 ---- ("Excellent"). In addition to giving a simple rating, you will need to write a short explanation of why you chose to rank it that way.</p> + <p>You will be asked to make several rounds of ratings because you may change + your mind about the song as it goes on, and also because if there are other + people evaluating the song, they may make good points that you want to take + into account. However, throughout the experiment, we would like you to give + your own honest evaluation of the song as best as you can. Do not change + your ratings unless you feel differently about the song.</p> <p>Here is what an experiment window looks like: <img src="http://groups.psych.indiana.edu/social/musical-screenshot.gif" alt="screenshot with explanations of key areas"></p> ! <p>To submit your opinion for the round click on the circle beside the desired rating, then type your explanation in the box below, and finally click "Submit your opinion" at the bottom of the window.</p> |
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/social/client In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083/src/net/sf/gabel/social/client Modified Files: SumGamePanel.java DebriefingPanel.java SocialApplet.java InstructionPanel.java PuzzleGamePanel.java MusicalGamePanel.java LaGrangeGamePanel.java LaGrangeDebriefingPanel.java GamePanel.java SocialClient.java MusicalDebriefingPanel.java SumDebriefingPanel.java Added Files: SumGuessEditor.java SumGuessEventListener.java SumTable.java SumTableModel.java Removed Files: SumExperiment.java ExperimentFactory.java Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. Index: MusicalGamePanel.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/client/MusicalGamePanel.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** MusicalGamePanel.java 27 Feb 2006 04:20:18 -0000 1.14 --- MusicalGamePanel.java 24 Jun 2006 23:45:34 -0000 1.15 *************** *** 2,7 **** - import java.awt.Graphics; import java.awt.Color; import java.awt.Label; import java.awt.GridLayout; --- 2,7 ---- import java.awt.Color; + import java.awt.Graphics; import java.awt.Label; import java.awt.GridLayout; *************** *** 10,14 **** import java.awt.event.ActionListener; import java.awt.event.ActionEvent; - import java.io.ByteArrayInputStream; import javax.swing.BorderFactory; --- 10,13 ---- *************** *** 23,27 **** --- 22,32 ---- import javax.swing.JScrollPane; import javax.swing.JTextField; + import javax.swing.border.LineBorder; + import java.io.IOException; + import java.io.InputStream; + import java.net.URI; + import java.net.URL; + import java.net.URLConnection; import java.util.Enumeration; import java.util.Iterator; *************** *** 29,32 **** --- 34,39 ---- import net.sf.gabel.event.EventChannel; + import net.sf.gabel.social.ColorTheme; + import net.sf.gabel.social.events.GameStartEvent; import net.sf.gabel.social.events.GuessEvent; import net.sf.gabel.social.problems.Answer; *************** *** 55,61 **** private final static Dimension PANEL_SIZE = new Dimension(700, 500); private MusicPlayer player; private MusicalPiece piece; - private ByteArrayInputStream sample; private InfoPanel infoPanel = new InfoPanel(); private Box centerPanel = Box.createVerticalBox(); --- 62,68 ---- private final static Dimension PANEL_SIZE = new Dimension(700, 500); + private static final MusicPlayer mutePlayer = new MuteMusicPlayer(); private MusicPlayer player; private MusicalPiece piece; private InfoPanel infoPanel = new InfoPanel(); private Box centerPanel = Box.createVerticalBox(); *************** *** 64,69 **** private RatingTable ratingTable = new RatingTable(MusicalGuess.ratings); private JEditorPane opinionsPane = new JEditorPane("text/html; charset=UTF-8", ""); ! public boolean isSilent; ! int currentRound; // would you believe it, game graphics doesn't have read-access to game status variables StringBuffer opinionAccumulator = new StringBuffer(); --- 71,75 ---- private RatingTable ratingTable = new RatingTable(MusicalGuess.ratings); private JEditorPane opinionsPane = new JEditorPane("text/html; charset=UTF-8", ""); ! int currentRound; // would you believe it, game graphics do not have access to game status variables StringBuffer opinionAccumulator = new StringBuffer(); *************** *** 80,89 **** setLayout(new GridLayout(1, totalButtons)); setMaximumSize(MusicalGamePanel.H_STRETCH_V_COMPRESS); ! setBackground(Color.WHITE); radioButtons = new JRadioButton[totalButtons]; for (int i=0; i < totalButtons; i++) { JRadioButton rb = new JRadioButton("<html><i>" + ratings[i] + "</i></html>"); ! rb.setBackground(Color.WHITE); group.add(rb); add(rb); --- 86,95 ---- setLayout(new GridLayout(1, totalButtons)); setMaximumSize(MusicalGamePanel.H_STRETCH_V_COMPRESS); ! setBackground(ColorTheme.MAIN_COLOR); radioButtons = new JRadioButton[totalButtons]; for (int i=0; i < totalButtons; i++) { JRadioButton rb = new JRadioButton("<html><i>" + ratings[i] + "</i></html>"); ! rb.setBackground(ColorTheme.MAIN_COLOR); group.add(rb); add(rb); *************** *** 114,118 **** this.label = label; setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); ! setBackground(Color.WHITE); setMaximumSize(MusicalGamePanel.H_COMPRESS_V_STRETCH); removeAllClients(); --- 120,124 ---- this.label = label; setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); ! setBackground(ColorTheme.MAIN_COLOR); setMaximumSize(MusicalGamePanel.H_COMPRESS_V_STRETCH); removeAllClients(); *************** *** 132,136 **** label.setAlignmentX(JComponent.CENTER_ALIGNMENT); label.setHorizontalAlignment(JLabel.CENTER); ! label.setBackground(Color.WHITE); add(label); } --- 138,143 ---- label.setAlignmentX(JComponent.CENTER_ALIGNMENT); label.setHorizontalAlignment(JLabel.CENTER); ! label.setBackground(ColorTheme.MAIN_COLOR); ! label.setForeground(ColorTheme.TEXT_COLOR); add(label); } *************** *** 146,150 **** totalRatings = ratings.length; setLayout(new GridLayout(1, totalRatings)); ! setBackground(Color.WHITE); columnBoxes = new RatingColumn[totalRatings]; --- 153,157 ---- totalRatings = ratings.length; setLayout(new GridLayout(1, totalRatings)); ! setBackground(ColorTheme.MAIN_COLOR); columnBoxes = new RatingColumn[totalRatings]; *************** *** 174,182 **** InfoPanel() { super(BoxLayout.PAGE_AXIS); ! setBackground(Color.WHITE); // info table ! textPane.setBackground(Color.LIGHT_GRAY); ! textPane.setBorder(BorderFactory.createEmptyBorder()); add(textPane); } --- 181,189 ---- InfoPanel() { super(BoxLayout.PAGE_AXIS); ! setBackground(ColorTheme.MAIN_COLOR); // info table ! textPane.setBackground(ColorTheme.ACCENT_COLOR); ! textPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, ColorTheme.TEXT_COLOR)); add(textPane); } *************** *** 236,248 **** } ! public MusicalGamePanel(Identifier id, Map parameters, boolean asMonitor, MusicalPiece piece, ByteArrayInputStream sample) { ! super(id, parameters, asMonitor); JLabel l; - // render information and prepare piece for playback - this.sample = sample; setPiece(piece); ! // prepare and pack containers opinionsPane.setEditable(false); --- 243,254 ---- } ! public MusicalGamePanel(Identifier id, Map parameters, boolean asMonitor, GameStartEvent startEvent, MusicalPiece piece) { ! super(id, parameters, asMonitor, startEvent); JLabel l; setPiece(piece); ! player = mutePlayer; // by default, unless SocialClient calls setPiece() on us ! // prepare and pack containers opinionsPane.setEditable(false); *************** *** 253,262 **** remove(drawArea); drawArea = new JPanel(new BorderLayout()); ! drawArea.setBackground(Color.WHITE); drawArea.add(infoPanel, BorderLayout.NORTH); if (!isMonitor()) { centerPanel.add(Box.createVerticalStrut(12)); ! l = new JLabel("<html><b>How do you rate this piece?</b></html>"); l.setAlignmentX(JComponent.CENTER_ALIGNMENT); centerPanel.add(l); --- 259,268 ---- remove(drawArea); drawArea = new JPanel(new BorderLayout()); ! drawArea.setBackground(ColorTheme.MAIN_COLOR); drawArea.add(infoPanel, BorderLayout.NORTH); if (!isMonitor()) { centerPanel.add(Box.createVerticalStrut(12)); ! l = new JLabel("<html><u>How do you rate this piece?</u></html>"); l.setAlignmentX(JComponent.CENTER_ALIGNMENT); centerPanel.add(l); *************** *** 265,269 **** centerPanel.add(Box.createVerticalStrut(6)); opinionField.setMaximumSize(H_STRETCH_V_COMPRESS); ! l = new JLabel("<html><b>Why?</html></b>"); l.setAlignmentX(JComponent.CENTER_ALIGNMENT); centerPanel.add(l); --- 271,275 ---- centerPanel.add(Box.createVerticalStrut(6)); opinionField.setMaximumSize(H_STRETCH_V_COMPRESS); ! l = new JLabel("<html><u>Why?</u></html>"); l.setAlignmentX(JComponent.CENTER_ALIGNMENT); centerPanel.add(l); *************** *** 271,281 **** centerPanel.add(Box.createVerticalStrut(12)); ! l = new JLabel("<html><b>What others think:</b></html>"); l.setAlignmentX(JComponent.CENTER_ALIGNMENT); centerPanel.add(l); centerPanel.add(ratingTable); ! ! scrollPane.setPreferredSize(new Dimension(INFINITY, 200)); drawArea.add(centerPanel, BorderLayout.CENTER); drawArea.add(scrollPane, BorderLayout.SOUTH); --- 277,287 ---- centerPanel.add(Box.createVerticalStrut(12)); ! l = new JLabel("<html><u>What others think:</u></html>"); l.setAlignmentX(JComponent.CENTER_ALIGNMENT); centerPanel.add(l); centerPanel.add(ratingTable); ! //! ! scrollPane.setPreferredSize(new Dimension(INFINITY, 100)); drawArea.add(centerPanel, BorderLayout.CENTER); drawArea.add(scrollPane, BorderLayout.SOUTH); *************** *** 285,289 **** setPreferredSize(PANEL_SIZE); ! setBackground(Color.WHITE); add(drawArea, BorderLayout.CENTER); --- 291,295 ---- setPreferredSize(PANEL_SIZE); ! setBackground(ColorTheme.MAIN_COLOR); add(drawArea, BorderLayout.CENTER); *************** *** 292,297 **** l = new JLabel("<html><i>You are monitoring the experiment.</i></html>", JLabel.CENTER); l.setOpaque(true); ! l.setBackground(Color.BLACK); ! l.setForeground(Color.WHITE); add(l, BorderLayout.SOUTH); } else --- 298,303 ---- l = new JLabel("<html><i>You are monitoring the experiment.</i></html>", JLabel.CENTER); l.setOpaque(true); ! l.setBackground(ColorTheme.TEXT_COLOR); ! l.setForeground(ColorTheme.MAIN_COLOR); add(l, BorderLayout.SOUTH); } else *************** *** 309,312 **** --- 315,319 ---- guess.setRating(ratingButtonsPanel.getRating()); EventChannel.getInstance().handle(new GuessEvent(id, (Guess)guess)); + opinionField.setText(""); } *************** *** 321,325 **** if (isMonitor()) { text = new StringBuffer(opinionAccumulator.toString()); ! text.append("<h5><i>*** Round " + ++currentRound + " results are in. ***</i></h5>"); } --- 328,332 ---- if (isMonitor()) { text = new StringBuffer(opinionAccumulator.toString()); ! text.append("<u>Round " + ++currentRound + " results</u><br>"); } *************** *** 353,356 **** --- 360,364 ---- for (int i = 0; i < opinions.length; i++) text.append((i>0? "<br>":"") + opinions[i]); // prepend a "<br>" to 2nd, 3rd, ... line (i.e. "<br>".join(opinions) in Python) + text.append("<br>"); if (isMonitor()) *************** *** 373,400 **** Label l = new Label(message); l.setAlignment(Label.CENTER); ! l.setBackground(Color.BLACK); ! l.setForeground(Color.WHITE); add(l); } ! public void start() { super.start(); ! if (!isSilent) { ! try { ! player.play(); ! } catch (MusicPlayerException mpE) { ! signalError("Playback failed! See Java console for details."); ! mpE.printStackTrace(); ! } } } public void stop() { ! if (!isSilent) { ! try { ! player.stop(); ! } catch (MusicPlayerException mpE) { ! mpE.printStackTrace(); ! } } super.stop(); --- 381,404 ---- Label l = new Label(message); l.setAlignment(Label.CENTER); ! l.setBackground(ColorTheme.TEXT_COLOR); ! l.setForeground(ColorTheme.MAIN_COLOR); add(l); } ! public void start() { super.start(); ! try { ! player.play(); ! } catch (MusicPlayerException mpE) { ! signalError("Playback failed! See Java console for details."); ! mpE.printStackTrace(); } } public void stop() { ! try { ! player.stop(); ! } catch (MusicPlayerException mpE) { ! mpE.printStackTrace(); } super.stop(); *************** *** 407,415 **** public void setPiece(MusicalPiece piece) { this.piece = piece; ! String fmt = piece.getFormat(); try { ! if (isSilent) ! player = new MuteMusicPlayer(); ! else if (fmt.equals("mid") || fmt.equals("midi")) player = new MidiMusicPlayer(); else if (fmt.equals("mp3")) --- 411,427 ---- public void setPiece(MusicalPiece piece) { this.piece = piece; ! if (piece.getGenre() != null) infoPanel.render(piece); ! repaint(); ! } ! ! public void setSample(URI uri) { try { ! // make an URL (this forces the appropriate stream handler to be instantiated) ! URL url = uri.toURL(); ! System.out.println("URL: " + url); ! InputStream stream = url.openStream(); ! ! String fmt = piece.getFormat(); ! if (fmt.equals("mid") || fmt.equals("midi")) player = new MidiMusicPlayer(); else if (fmt.equals("mp3")) *************** *** 418,427 **** player = new VorbisStreamPlayer(); else ! throw new MusicPlayerException("wrong format"); ! if (piece.getGenre() != null) infoPanel.render(piece); ! player.setSource(sample); } catch (MusicPlayerException muE) { signalError("Error initializing playback. See Java console for details."); muE.printStackTrace(); } repaint(); --- 430,445 ---- player = new VorbisStreamPlayer(); else ! throw new MusicPlayerException("Unrecognized format: " + fmt); ! ! player.setSource(stream); ! } catch (IOException e) { ! signalError("We could not load the music due to a network problem. Sorry!"); ! System.err.println("Error loading music from " + uri); ! e.printStackTrace(); ! player = mutePlayer; } catch (MusicPlayerException muE) { signalError("Error initializing playback. See Java console for details."); muE.printStackTrace(); + player = mutePlayer; } repaint(); Index: SocialClient.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/client/SocialClient.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** SocialClient.java 27 Feb 2006 04:27:32 -0000 1.35 --- SocialClient.java 24 Jun 2006 23:45:34 -0000 1.36 *************** *** 8,11 **** --- 8,12 ---- import java.io.IOException; import java.io.ObjectInputStream; + import java.net.URI; import java.util.Map; import java.util.logging.Level; *************** *** 44,49 **** import net.sf.gabel.social.events.ClientConfigurationEvent; import net.sf.gabel.social.events.EnterEvent; import net.sf.gabel.social.events.GameEndEvent; - import net.sf.gabel.social.events.GameEndEvent2; import net.sf.gabel.social.events.GameStartEvent; import net.sf.gabel.social.events.GuessEvent; --- 45,50 ---- import net.sf.gabel.social.events.ClientConfigurationEvent; import net.sf.gabel.social.events.EnterEvent; + import net.sf.gabel.social.events.ExperimentStateEvent; import net.sf.gabel.social.events.GameEndEvent; import net.sf.gabel.social.events.GameStartEvent; import net.sf.gabel.social.events.GuessEvent; *************** *** 54,57 **** --- 55,59 ---- import net.sf.gabel.social.events.RoundEndingEvent; import net.sf.gabel.social.events.RoundStartEvent; + import net.sf.gabel.social.events.URIEvent; import net.sf.gabel.social.problems.Answer; import net.sf.gabel.social.problems.Guess; *************** *** 76,85 **** private static final Logger log = Logger.getLogger(SocialClient.class.getName()); - private final static String welcomeFile = "net/sf/gabel/social/conf/welcome.html"; private final static String errorFile = "net/sf/gabel/social/conf/error.html"; // FIXME throw away all this junk and use some naming/placing convention instead ! private final static String INSTRUCTIONS_LAGRANGE = "net/sf/gabel/social/conf/lagrange-problem.html"; ! private final static String DEBRIEFING_LAGRANGE = "net/sf/gabel/social/conf/lagrange-debrief.html"; private final static String INSTRUCTIONS_PUZZLE = "net/sf/gabel/social/conf/puzzle-problem.html"; private final static String DEBRIEFING_PUZZLE = "net/sf/gabel/social/conf/puzzle-debrief.html"; --- 78,86 ---- private static final Logger log = Logger.getLogger(SocialClient.class.getName()); private final static String errorFile = "net/sf/gabel/social/conf/error.html"; // FIXME throw away all this junk and use some naming/placing convention instead ! private final static String INSTRUCTIONS_PICTURE = "net/sf/gabel/social/conf/picture-problem.html"; ! private final static String DEBRIEFING_PICTURE = "net/sf/gabel/social/conf/picture-debrief.html"; private final static String INSTRUCTIONS_PUZZLE = "net/sf/gabel/social/conf/puzzle-problem.html"; private final static String DEBRIEFING_PUZZLE = "net/sf/gabel/social/conf/puzzle-debrief.html"; *************** *** 97,120 **** public String serverHost = "localhost"; // hardcoded defaults; public int serverPort = 4300; // override with command line or applet params ! public int clientWidth = 500; // ! public int clientHeight = 500; // ! public boolean isMonitor = false; // private SocialDispatcher dispatcher = new SocialDispatcher(); private GamePanel graphicsPanel; private InstructionPanel errorPanel; private InstructionPanel instructionPanel; - private InstructionPanel welcomePanel; private InstructionPanel debriefingPanel; private DebriefingPanel reviewPanel; ! private JLabel infoLeft; ! private JLabel infoRight; - private JButton welcomeOkay; private JButton startOkay; private JButton nextGame; private JButton gameReview; /* --- 98,125 ---- public String serverHost = "localhost"; // hardcoded defaults; public int serverPort = 4300; // override with command line or applet params ! public int clientWidth = 500; ! public int clientHeight = 500; ! public String name = "anonymous"; ! public int age = 18; ! public boolean isMonitor = false; private SocialDispatcher dispatcher = new SocialDispatcher(); + private URI uri; private GamePanel graphicsPanel; private InstructionPanel errorPanel; private InstructionPanel instructionPanel; private InstructionPanel debriefingPanel; private DebriefingPanel reviewPanel; ! private JLabel infoLeft = new JLabel(); ! private JLabel infoRight = new JLabel(); private JButton startOkay; private JButton nextGame; private JButton gameReview; + + private int gameNumber, totalGames; + /* *************** *** 138,142 **** * This guy updates GUI to display time left until the beginning of the experiment, * end of the round, or whatever the programmer may want it to represent. ! * Class TimerDisplay goes hand-in-hand with interface DisplayUpdater. */ private TimerDisplay timerDisplay = new TimerDisplay(500); --- 143,147 ---- * This guy updates GUI to display time left until the beginning of the experiment, * end of the round, or whatever the programmer may want it to represent. ! * Class TimerDisplay goes hand-in-hand with DisplayUpdater interface. */ private TimerDisplay timerDisplay = new TimerDisplay(500); *************** *** 162,166 **** // extra sanity check, can't hurt if (event.id() == null) { ! log.log(Level.WARNING, "got an event with null identifier -- ignoring!"); return false; } --- 167,171 ---- // extra sanity check, can't hurt if (event.id() == null) { ! log.log(Level.WARNING, "got an event with null Identifier -- ignoring!"); return false; } *************** *** 174,178 **** return true; } ! // are we waiting for an InitEvent (our id is null) and is this an InitEvent? if ((id == null) && (event instanceof InitEvent)) { synchronized (event) { --- 179,183 ---- return true; } ! // are we waiting for an InitEvent (our id is null) and is this an InitEvent? if ((id == null) && (event instanceof InitEvent)) { synchronized (event) { *************** *** 195,225 **** setLayout(new BorderLayout()); JPanel tempPanel = new JPanel(new BorderLayout()); ! tempPanel.setBackground(ColorTheme.ACCENT_COLOR); ! infoLeft = new JLabel(" Connecting..."); ! infoLeft.setBackground(ColorTheme.ACCENT_COLOR); ! infoLeft.setForeground(ColorTheme.TEXT_COLOR); ! tempPanel.add(infoLeft, BorderLayout.WEST); ! infoRight = new JLabel(" "); ! infoRight.setBackground(ColorTheme.ACCENT_COLOR); ! infoRight.setForeground(ColorTheme.TEXT_COLOR); tempPanel.add(infoRight, BorderLayout.EAST); this.add(tempPanel, BorderLayout.NORTH); - welcomePanel = new InstructionPanel(); - welcomePanel.setBackground(ColorTheme.MAIN_COLOR); - try { - welcomePanel.setContent(getClass().getClassLoader().getResourceAsStream(welcomeFile)); - } catch (Exception e) { - System.out.println(e.toString()); - welcomePanel.setContent("Default welcome text... problem loading the real welcome text\n " + e.toString()); - } - - welcomeOkay = new JButton("Let's Start..."); - welcomeOkay.addActionListener(this); - welcomeOkay.setBackground(ColorTheme.ACCENT_COLOR); - welcomePanel.add(welcomeOkay, BorderLayout.SOUTH); - errorPanel = new InstructionPanel(); errorPanel.setBackground(ColorTheme.MAIN_COLOR); --- 200,216 ---- setLayout(new BorderLayout()); + setFocusable(true); JPanel tempPanel = new JPanel(new BorderLayout()); ! tempPanel.setBackground(ColorTheme.TEXT_COLOR); ! infoLeft.setBackground(ColorTheme.TEXT_COLOR); ! infoLeft.setForeground(ColorTheme.MAIN_COLOR); ! setInfoLeft("Connecting..."); ! tempPanel.add(infoLeft, BorderLayout.CENTER); ! infoRight.setBackground(ColorTheme.TEXT_COLOR); ! infoRight.setForeground(ColorTheme.MAIN_COLOR); tempPanel.add(infoRight, BorderLayout.EAST); this.add(tempPanel, BorderLayout.NORTH); errorPanel = new InstructionPanel(); errorPanel.setBackground(ColorTheme.MAIN_COLOR); *************** *** 233,250 **** instructionPanel = new InstructionPanel(); instructionPanel.setBackground(ColorTheme.ACCENT_COLOR); ! instructionPanel.setContent("It appears that we're having problems connecting to the server..."); ! ! if (!isMonitor) { ! startOkay = new JButton("Join the next experiment!"); ! startOkay.addActionListener(this); ! startOkay.setBackground(ColorTheme.ACCENT_COLOR); ! startOkay.setEnabled(false); // ClientConfiguration enables it ! instructionPanel.add(startOkay, BorderLayout.SOUTH); ! } ! ! initDebriefing(); ! ! // initial content panel... ! this.add(welcomePanel, BorderLayout.CENTER); } --- 224,228 ---- instructionPanel = new InstructionPanel(); instructionPanel.setBackground(ColorTheme.ACCENT_COLOR); ! instructionPanel.setContent("Connecting..."); } *************** *** 271,274 **** --- 249,262 ---- Thread.currentThread().setName("Social Client"); connect(); + + if (! isMonitor) { + startOkay = new JButton("Join the next experiment!"); + startOkay.addActionListener(this); + startOkay.setBackground(ColorTheme.ACCENT_COLOR); + startOkay.setEnabled(false); // ClientConfiguration enables it + instructionPanel.add(startOkay, BorderLayout.SOUTH); + } + initDebriefing(); + this.add(instructionPanel, BorderLayout.CENTER); } *************** *** 279,282 **** --- 267,288 ---- } + private void setInfoLeft(String str) { + StringBuffer s = new StringBuffer("<html> "); + s.append(str); + s.append(" </html>"); + infoLeft.setText(s.toString()); + infoLeft.repaint(); + } + + private void setInfoRight(String str) { + StringBuffer s = new StringBuffer("<html> "); + if (isMonitor) + s.append("<font color=gray>Exp ").append(gameNumber).append('/').append(totalGames).append("</font> "); + s.append(str); + s.append(" </html>"); + infoRight.setText(s.toString()); + infoRight.repaint(); + } + /* * Sends an event to the server. *************** *** 294,305 **** // consequently, handlers for those will be installed for monitor clients only. if (isMonitor) { ! getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(ABORT_GAME_KEY_SEQUENCE), "abort"); ! getActionMap().put("abort", new AbstractAction() { public void actionPerformed (ActionEvent e) { dispatch(new AbortExperimentEvent(id)); } }); ! getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(BEGIN_GAME_KEY_SEQUENCE), "begin"); ! getActionMap().put("begin", new AbstractAction() { public void actionPerformed (ActionEvent e) { dispatch(new BeginGameEvent(id)); --- 300,313 ---- // consequently, handlers for those will be installed for monitor clients only. if (isMonitor) { ! getRootPane().getInputMap(WHEN_IN_FOCUSED_WINDOW).put( ! KeyStroke.getKeyStroke(ABORT_GAME_KEY_SEQUENCE), "abort"); ! getRootPane().getActionMap().put("abort", new AbstractAction() { public void actionPerformed (ActionEvent e) { dispatch(new AbortExperimentEvent(id)); } }); ! getRootPane().getInputMap(WHEN_IN_FOCUSED_WINDOW).put( ! KeyStroke.getKeyStroke(BEGIN_GAME_KEY_SEQUENCE), "begin"); ! getRootPane().getActionMap().put("begin", new AbstractAction() { public void actionPerformed (ActionEvent e) { dispatch(new BeginGameEvent(id)); *************** *** 336,342 **** } ! if (e.getSource() == welcomeOkay || e.getSource() == nextGame) { ! // remove(graphicsPanel); ! remove(welcomePanel); remove(errorPanel); remove(debriefingPanel); --- 344,348 ---- } ! if (e.getSource() == nextGame) { remove(errorPanel); remove(debriefingPanel); *************** *** 362,380 **** else text = " Last round in this experiment "; ! ! log.info("starting round #" + currentRound); ! infoRight.setText(text); timerDisplay.start(timer, new DisplayUpdater() { public void updateDisplay(int secs) { ! infoLeft.setText( ! " " + secs + ! " second" + (secs==1? "":"s") + ! " left in this round "); ! infoLeft.repaint(); } public void finalDisplay() { ! infoLeft.setText(" Ending round..."); ! infoLeft.repaint(); } }); --- 368,379 ---- else text = " Last round in this experiment "; ! setInfoRight(text); timerDisplay.start(timer, new DisplayUpdater() { public void updateDisplay(int secs) { ! setInfoLeft("" + secs + " second" + (secs==1? "":"s") + " left in this round"); } public void finalDisplay() { ! setInfoLeft("Ending round..."); } }); *************** *** 389,393 **** remove(graphicsPanel); remove(instructionPanel); - remove(welcomePanel); remove(debriefingPanel); add(errorPanel, BorderLayout.CENTER); --- 388,391 ---- *************** *** 407,420 **** connectLock.wait(); } catch (InterruptedException e) { ! // we're stopped while waitin to sync with dispatcher.connect() log.info("Event-handling thread interrupted while waiting to connect"); } } } ! // we got our Identifier so can start the state machine (if we had one) id = event.id(); log.fine("assigned ID " + id); // let's use it right away to tell the server we are ready to be queued ! dispatch(new EnterEvent(id, isMonitor)); // ...ideally, the server would be the one who decides whether we are a monitor or not } --- 405,418 ---- connectLock.wait(); } catch (InterruptedException e) { ! // we're stopped while waiting to sync with dispatcher.connect() log.info("Event-handling thread interrupted while waiting to connect"); } } } ! // we got our Identifier id = event.id(); log.fine("assigned ID " + id); // let's use it right away to tell the server we are ready to be queued ! dispatch(new EnterEvent(id, name, age, isMonitor)); // ...ideally, the server would be the one who decides whether we are a monitor or not } *************** *** 447,450 **** --- 445,449 ---- if (event instanceof RoundEndingEvent) { if (graphicsPanel.guessesEnabled()) { + // force panel to submit a guess graphicsPanel.makeGuess(); graphicsPanel.disableGuesses(); *************** *** 481,584 **** GameEndEvent gee = (GameEndEvent) event; - Guess bestGuess = gee.getBestGuess(); - Answer bestAnswer = gee.getBestAnswer(); ! debriefingToggle = false; ! try { ! initDebriefing(); ! if (currentConfiguration.getFunctionType().equals("lagrange")) { ! reviewPanel = new LaGrangeDebriefingPanel(currentConfiguration.getFunctionParameters()); ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_LAGRANGE)); ! } ! if (currentConfiguration.getFunctionType().equals("puzzle")) { ! reviewPanel = new PuzzleDebriefingPanel(currentConfiguration.getFunctionParameters()); ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_PUZZLE)); ! } ! if (currentConfiguration.getFunctionType().equals("musical")) { ! reviewPanel = new MusicalDebriefingPanel(currentConfiguration.getFunctionParameters()); ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_MUSICAL)); ! } ! if (currentConfiguration.getFunctionType().equals("sum")) { ! reviewPanel = new SumDebriefingPanel(currentConfiguration.getFunctionParameters()); ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_SUM)); ! } ! } catch (Exception E) { ! System.out.println(E.toString()); ! instructionPanel.setContent("problem loading the debriefing: " + E); } - - reviewPanel.setData(guesses, answers); - reviewPanel.setBest(bestGuess, bestAnswer); - graphicsPanel.stop(); - remove(graphicsPanel); remove(instructionPanel); - remove(welcomePanel); remove(errorPanel); ! add(debriefingPanel, BorderLayout.CENTER); invalidate(); ! validate(); ! repaint(); ! infoRight.setText(" Thanks! "); ! infoRight.repaint(); ! } ! if (event instanceof GameEndEvent2) { ! currentRound = 0; ! // stop round timer updates ! timerDisplay.stop(); ! ! GameEndEvent2 eee = (GameEndEvent2) event; ! Guess bestGuess = eee.getBestGuess(); ! Answer bestAnswer = eee.getBestAnswer(); ! ! debriefingToggle = false; ! try { ! initDebriefing(); ! if (currentConfiguration.getFunctionType().equals("lagrange")) { ! reviewPanel = new LaGrangeDebriefingPanel(currentConfiguration.getFunctionParameters()); ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_LAGRANGE)); ! } ! if (currentConfiguration.getFunctionType().equals("puzzle")) { ! reviewPanel = new PuzzleDebriefingPanel(currentConfiguration.getFunctionParameters()); ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_PUZZLE)); ! } ! if (currentConfiguration.getFunctionType().equals("musical")) { ! reviewPanel = new MusicalDebriefingPanel(currentConfiguration.getFunctionParameters()); ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_MUSICAL)); ! } ! if (currentConfiguration.getFunctionType().equals("sum")) { ! reviewPanel = new SumDebriefingPanel(currentConfiguration.getFunctionParameters()); ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_SUM)); } ! } catch (Exception E) { ! System.out.println(E.toString()); ! instructionPanel.setContent("problem loading the debriefing: " + E); } - - reviewPanel.setData(guesses, answers); - reviewPanel.setBest(bestGuess, bestAnswer); - graphicsPanel.stop(); - remove(graphicsPanel); - remove(instructionPanel); - remove(welcomePanel); - remove(errorPanel); - add(debriefingPanel, BorderLayout.CENTER); - invalidate(); validate(); repaint(); ! ! infoRight.setText(" Thanks! "); ! infoRight.repaint(); } if (event instanceof GameStartEvent) { ! GameStartEvent ese = (GameStartEvent) event; // ask the viewers for a little bit of patience ! infoLeft.setText(" Starting..."); ! remove(instructionPanel); ! remove(welcomePanel); ! remove(errorPanel); ! remove(debriefingPanel); currentRound = 0; --- 480,554 ---- GameEndEvent gee = (GameEndEvent) event; ! // stop panel activity ! System.out.println("stop panel"); ! if (graphicsPanel != null) { ! graphicsPanel.stop(); ! remove(graphicsPanel); } remove(instructionPanel); remove(errorPanel); ! ! // populate panels ! System.out.println("populate replacement panels"); invalidate(); ! int action = gee.getAction(); ! // populate review panel ! if (currentConfiguration.getFunctionType().equals("picture")) ! reviewPanel = new LaGrangeDebriefingPanel(currentConfiguration.getFunctionParameters()); ! if (currentConfiguration.getFunctionType().equals("puzzle")) ! reviewPanel = new PuzzleDebriefingPanel(currentConfiguration.getFunctionParameters()); ! if (currentConfiguration.getFunctionType().equals("musical")) ! reviewPanel = new MusicalDebriefingPanel(currentConfiguration.getFunctionParameters()); ! if (currentConfiguration.getFunctionType().equals("sum")) ! reviewPanel = new SumDebriefingPanel(currentConfiguration.getFunctionParameters()); ! reviewPanel.setData(guesses, answers); ! reviewPanel.setBest(gee.getBestGuess(), gee.getBestAnswer()); ! reviewPanel.repaint(); ! ! // display debriefing or review panel as requested by the Action field in gameEndEvent ! switch(action) { ! case GameEndEvent.ACTION_REVIEW: ! // in this condition we display review panel inside the instructions container, ! // to expose the "Join the next experiment" button right away ! instructionPanel.setContent(reviewPanel); ! add(instructionPanel, BorderLayout.CENTER); ! break; ! case GameEndEvent.ACTION_DEBRIEF: ! // same as 'default' ! default: ! debriefingToggle = false; ! // populate debriefing panel ! try { ! initDebriefing(); ! if (currentConfiguration.getFunctionType().equals("picture")) ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_PICTURE)); ! if (currentConfiguration.getFunctionType().equals("puzzle")) ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_PUZZLE)); ! if (currentConfiguration.getFunctionType().equals("musical")) ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_MUSICAL)); ! if (currentConfiguration.getFunctionType().equals("sum")) ! debriefingPanel.setContent(getClass().getClassLoader().getResourceAsStream(DEBRIEFING_SUM)); ! } catch (Exception E) { ! System.out.println(E.toString()); ! instructionPanel.setContent("problem loading the debriefing: " + E); } ! add(debriefingPanel, BorderLayout.CENTER); } validate(); repaint(); ! ! if (isMonitor) ! setInfoRight(""); ! else ! setInfoRight("Thanks!"); } if (event instanceof GameStartEvent) { ! GameStartEvent startEvent = (GameStartEvent) event; // ask the viewers for a little bit of patience ! setInfoLeft("Starting..."); currentRound = 0; *************** *** 586,603 **** answers = new Answer[numberRounds]; ! if (currentConfiguration.getFunctionType().equals("lagrange")) ! graphicsPanel = new LaGrangeGamePanel(id, currentConfiguration.getFunctionParameters(), isMonitor); ! if (currentConfiguration.getFunctionType().equals("puzzle")) ! graphicsPanel = new PuzzleGamePanel(id, currentConfiguration.getFunctionParameters(), isMonitor); ! if (currentConfiguration.getFunctionType().equals("sum")) ! graphicsPanel = new SumGamePanel(id, currentConfiguration.getFunctionParameters(), isMonitor, ! currentConfiguration.getNumberRounds()); ! if (currentConfiguration.getFunctionType().equals("musical")) { ! graphicsPanel = new MusicalGamePanel(id, currentConfiguration.getFunctionParameters(), isMonitor, ! (MusicalPiece)(currentConfiguration.getBlob()), sample); ! if (ese.isMonitored && !isMonitor) ! ((MusicalGamePanel)graphicsPanel).isSilent = true; } add(graphicsPanel, BorderLayout.CENTER); graphicsPanel.requestFocus(); --- 556,581 ---- answers = new Answer[numberRounds]; ! String type = currentConfiguration.getFunctionType(); ! if (type.equals("picture")) ! graphicsPanel = new LaGrangeGamePanel(id, currentConfiguration.getFunctionParameters(), isMonitor, startEvent); ! else if (type.equals("puzzle")) ! graphicsPanel = new PuzzleGamePanel(id, currentConfiguration.getFunctionParameters(), isMonitor, startEvent); ! else if (type.equals("sum")) ! graphicsPanel = new SumGamePanel(id, currentConfiguration.getFunctionParameters(), isMonitor, startEvent); ! else if (type.equals("musical")) { ! graphicsPanel = new MusicalGamePanel(id, currentConfiguration.getFunctionParameters(), isMonitor, startEvent, ! (MusicalPiece)(currentConfiguration.getBlob())); ! if (uri != null) ! ((MusicalGamePanel)graphicsPanel).setSample(uri); ! } else { ! // scream bloody murder ! instructionPanel.setContent("Error: can't instantiate '" + type + "' game panel"); ! return; // ho-ho-ho, what will this lead to? :D } + remove(instructionPanel); + remove(errorPanel); + remove(debriefingPanel); + add(graphicsPanel, BorderLayout.CENTER); graphicsPanel.requestFocus(); *************** *** 615,618 **** --- 593,610 ---- } + if (event instanceof URIEvent) { + if (currentConfiguration.getFunctionType().equals("musical")) + uri = ((URIEvent)event).getURI(); + } + + if ((event instanceof ExperimentStateEvent) && isMonitor) { + ExperimentStateEvent e = (ExperimentStateEvent)event; + StringBuffer s = new StringBuffer(); + s.append(e.getReady()).append(" ready, ").append(e.getQueued()).append(" reading instructions"); + setInfoLeft(s.toString()); + gameNumber = e.getGameNumber(); + totalGames = e.getTotalGames(); + setInfoRight(""); + } } *************** *** 624,646 **** // set the global current configuration... currentConfiguration = cc; - final Timer timer = new Timer(cc.getMsecsToNextGame()); numberRounds = cc.getNumberRounds(); ! ! ! timerDisplay.start(timer, new DisplayUpdater() { ! public void updateDisplay(int secs) { ! infoLeft.setText(" " + secs + " second" + (secs == 1 ? "" : "s") + " until the next experiment starts"); ! infoLeft.repaint(); ! } ! public void finalDisplay() { ! startOkay.setEnabled(false); ! infoLeft.setText("Loading..."); // Douglas Hofstader: Tue&Thu 2:30-3:45 @ CRCC ! } ! }); // load the appropriate instructions into the appropriate panel... try { ! if (cc.getFunctionType().equals("lagrange")) ! instructionPanel.setContent(getClass().getClassLoader().getResourceAsStream(INSTRUCTIONS_LAGRANGE)); if (cc.getFunctionType().equals("puzzle")) instructionPanel.setContent(getClass().getClassLoader().getResourceAsStream(INSTRUCTIONS_PUZZLE)); --- 616,644 ---- // set the global current configuration... currentConfiguration = cc; numberRounds = cc.getNumberRounds(); ! ! // is this a facilitated experiment? ! System.out.println("cc.MsecsToNextGame = " + cc.getMsecsToNextGame()); ! if (cc.getMsecsToNextGame() == 0) ! setInfoLeft(isMonitor? "(awaiting game status)" : "Waiting for the facilitator's signal..."); ! else { ! final Timer timer = new Timer(cc.getMsecsToNextGame()); ! timerDisplay.start(timer, new DisplayUpdater() { ! public void updateDisplay(int secs) { ! setInfoLeft("" + secs + " second" + (secs == 1 ? "" : "s") + " until the next experiment starts"); ! } ! public void finalDisplay() { ! if (isMonitor) ! return; ! startOkay.setEnabled(false); ! setInfoLeft("Loading..."); ! } ! }); ! } // load the appropriate instructions into the appropriate panel... try { ! if (cc.getFunctionType().equals("picture")) ! instructionPanel.setContent(getClass().getClassLoader().getResourceAsStream(INSTRUCTIONS_PICTURE)); if (cc.getFunctionType().equals("puzzle")) instructionPanel.setContent(getClass().getClassLoader().getResourceAsStream(INSTRUCTIONS_PUZZLE)); *************** *** 653,659 **** } ! // it's OK to press "Join" now ! startOkay.setEnabled(true); ! startOkay.repaint(); } --- 651,659 ---- } ! if (! isMonitor) { ! // it's OK to press "Join" now ! startOkay.setEnabled(true); ! startOkay.repaint(); ! } } *************** *** 670,678 **** gameReview.addActionListener(this); gameReview.setBackground(ColorTheme.ACCENT_COLOR); } tempPanel.add(nextGame, BorderLayout.EAST); - tempPanel.add(gameReview, BorderLayout.WEST); debriefingPanel.add(tempPanel, BorderLayout.SOUTH); ! debriefingPanel.setContent("Default debriefing, replace me..."); } --- 670,678 ---- gameReview.addActionListener(this); gameReview.setBackground(ColorTheme.ACCENT_COLOR); + tempPanel.add(gameReview, BorderLayout.WEST); } tempPanel.add(nextGame, BorderLayout.EAST); debriefingPanel.add(tempPanel, BorderLayout.SOUTH); ! debriefingPanel.setContent(""); } --- NEW FILE: SumTable.java --- package net.sf.gabel.social.client; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Rectangle; import javax.swing.*; import javax.swing.table.*; import net.sf.gabel.social.ColorTheme; class SumTable extends JTable { private SumTableModel data; private TableColumnModel columns; private boolean editable = true; public SumTable(final int minGuess, final int maxGuess, final SumGuessEventListener listener) { super(); // create data model data = new SumTableModel("<html><font color=gray><i>enter a number between " + minGuess + " to " + maxGuess + " and press Enter</i></font></html>"); // initialize first guess with minGuess data.setGuess(minGuess); // set this as table's model setModel(data); // FIXME This is a workaround for the problem of not being able to // programatically edit and focus a cell in the first row of a table. data.setAnswer("<html><font color=darkgray>â Double-click this number to start entering guesses</font></html>"); // create guess editor and register it for Integer column (SumTableModel.GUESS_COL) setDefaultEditor(Integer.class, new SumGuessEditor(minGuess, maxGuess, new SumGuessEventListener() { public void guessEntered(int guess) { try { editable = false; repaint(); // store result in data model, mark table non-editable and push guess upwards data.setGuess(guess); listener.guessEntered(guess); } catch (Exception E) { ; // pretend nothing has happened } } public void invalidValueEntered() { // highlight the mini-instruction text setAnswer("<html><b><i>You must enter a number from " + minGuess + " to " + maxGuess + "</i></b></html>"); } })); // create columns model columns = new DefaultTableColumnModel(); TableColumn col; // round # column: using ROUND_COL as index into data model, width 80 col = new TableColumn(SumTableModel.ROUND_COL, 80); col.setMaxWidth(80); // why doesn't JTable respect preferred width alone? columns.addColumn(col); // guesses column: using GUESS_COL as index into data model, width 50 col = new TableColumn(SumTableModel.GUESS_COL, 50); col.setMaxWidth(50); // why doesn't JTable respect preferred width alone? columns.addColumn(col); // buffer column: no index into data model (separates right-aligned guesses from left-aligned answers), width 8 col = new TableColumn(SumTableModel.NULL_COL, 8); col.setMaxWidth(8); // why doesn't JTable respect preferred width alone? columns.addColumn(col); // answers column: using ANSWER_COL as index into model, max width col = new TableColumn(SumTableModel.ANSWER_COL, 0); columns.addColumn(col); // init table setForeground(ColorTheme.TEXT_COLOR); setBackground(ColorTheme.MAIN_COLOR); setSelectionForeground(ColorTheme.TEXT_COLOR); setSelectionBackground(ColorTheme.ACCENT_COLOR); setGridColor(getSelectionBackground()); setShowHorizontalLines(false); setShowVerticalLines(false); setColumnModel(columns); setTableHeader(null); setSurrendersFocusOnKeystroke(true); // go straight to cell editor on keystroke setRowHeight(24); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); super.changeSelection(0, SumTableModel.GUESS_COL, false, false); // select the first row and start editing default first guess (equals lower bound) super.changeSelection(data.getRowCount()-1, SumTableModel.GUESS_COL, false, false); editable = true; System.err.println(editCellAt(0, SumTableModel.GUESS_COL)); JTextField field = (JTextField)editorComp; requestFocusInWindow(); field.requestFocusInWindow(); field.selectAll(); } public boolean isCellEditable(int row, int col) { return (editable && row == data.getRowCount()-1 && col == SumTableModel.GUESS_COL); } // overriden to change default behavior public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) { ; // no selection changes allowed -- last row is always selected } /** * Sets the current row's guess. * @param guess */ public void setGuess(int guess) { data.setGuess(guess); editable = false; repaint(); } /** * Gets the value from the data model associated with the last row * (default or previously entered guess if nothing entered) * @return current guess */ public int getGuess() { return data.getGuess(); } /** * Sets the current row's answer. * @param answer text to display in the answer cell */ public void setAnswer(String answer) { // add answer to the "answers" column data.setAnswer(answer); repaint(); } /** * Adds a row to the table, canceling any current edit; sets the answer cell value to the * mini-instructions string ("enter a number from x to y and press Enter") and fills the * guess cell with the last number succesfully entered. */ public void addRow() { // cancel any current edits; data model has already filled the guess cell with its previous value, // which doesn't change unless the participant enters a valid guess removeEditor(); // increase table by one row and fill in the supplied default guess data.addRow(data.getGuess()); // make sure the new row is currently selected super.changeSelection(data.getRowCount()-1, SumTableModel.GUESS_COL, false, false); // open editor for the new guess editable = true; editCellAt(data.getRowCount()-1, SumTableModel.GUESS_COL); JTextField field = (JTextField)editorComp; field.requestFocusInWindow(); field.selectAll(); } /** * Overridden to paint vertical gridlines in selected row */ protected void paintComponent(Graphics g) { super.paintComponent(g); // Note: this is made to work only for the first selected row. // Extending it to work for multiple selected rows is possible // by iterating over rows as well as over columns. int row = getSelectedRow(); if (row == -1) return; // bail out if no rows are selected g.setColor(getSelectionBackground()); // cover gridlines with the selection background color for (int col = 1; col <= getColumnCount(); col++) { // skip first cell as we will be only drawing left-side grid lines Rectangle r = getCellRect(row, col, true); g.drawLine(r.x-1, r.y, r.x-1, r.y+r.height-2); // move out one pixel to the left draw over grid space } } /** * A fix to make sure JTable uses up the entire parent JViewport. * * @see http://www.chka.de/swing/table/faq.html **/ public boolean getScrollableTracksViewportHeight() { Component parent = getParent(); if (parent instanceof JViewport) return parent.getHeight() > getPreferredSize().height; return false; } public static void main(String[] args) { JFrame frame = new JFrame(); SumGuessEventListener listener = new SumGuessEventListener() { public void guessEntered (int guess) { System.out.println("Guess: " + guess); } public void invalidValueEntered () { System.out.println(" -- invalid"); } }; SumTable table = new SumTable(0, 100, listener); table.setGuess(50); table.setAnswer("Almost"); table.addRow(); table.setGuess(60); table.setAnswer("Not quite"); table.addRow(); table.setGuess(30); table.setAnswer("I was just kidding"); table.addRow(); frame.getContentPane().add(table); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } } --- NEW FILE: SumTableModel.java --- package net.sf.gabel.social.client; import java.util.Vector; import javax.swing.table.AbstractTableModel; class SumTableModel extends AbstractTableModel { public static final int ROUND_COL = 0; public static final int GUESS_COL = 1; public static final int ANSWER_COL = 2; public static final int NULL_COL = 999; // value available to JTable for columns that need no representation in the data model private int rows; // row 0 is the 1st row private Vector guesses = new Vector(); private Vector answers = new Vector(); private String defaultAnswer; public SumTableModel(String defaultAnswer) { this.defaultAnswer = defaultAnswer; guesses.add(new Integer(0)); answers.add(defaultAnswer); } public int getColumnCount() { return 3; } public int getRowCount() { return rows + 1; } public Class getColumnClass(int c) { if (c == GUESS_COL) return Integer.class; return String.class; } public Object getValueAt(int row, int col) { if (row > rows) throw new RuntimeException("Undefined range: " + row + ',' + col + " -- table ends at " + rows + ",2"); switch (col) { case ROUND_COL: // round # == its row if (row < rows) return null; return "Round " + (row + 1); case GUESS_COL: return guesses.get(row); case ANSWER_COL: return answers.get(row); case NULL_COL: return null; default: throw new RuntimeException("Undefined range for SumTableModel: " + row + ',' + col); } } public void setGuess(int guess) { guesses.set(rows, new Integer(guess)); } public int getGuess() { Integer lastGuess = (Integer)guesses.lastElement(); return lastGuess.intValue(); } public void setAnswer(String answer) { answers.set(rows, answer); } public void addRow(int guess) { guesses.add(new Integer(guess)); // add default answer answers.add(defaultAnswer); // bump rows rows++; } public boolean isCellEditable(int row, int col) { // only allow editing of current round's guess return (row == rows && col == GUESS_COL); } } Index: DebriefingPanel.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/client/DebriefingPanel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DebriefingPanel.java 13 Dec 2005 22:40:27 -0000 1.6 --- DebriefingPanel.java 24 Jun 2006 23:45:33 -0000 1.7 *************** *** 1,4 **** --- 1,5 ---- package net.sf.gabel.social.client; + import javax.swing.JPanel; import java.awt.Graphics; *************** *** 9,12 **** --- 10,14 ---- import net.sf.gabel.social.problems.Answer; + /** * Super class of all debriefing panels *************** *** 19,53 **** public class DebriefingPanel extends JPanel { private static final long serialVersionUID = -260805377490024320L; ! ! protected Guess[] guesses; ! protected Answer[] answers; ! protected Guess bestGuess; ! protected Answer bestAnswer; ! ! public DebriefingPanel() { ! super(); ! ! this.setBackground(Color.WHITE); ! this.guesses = new Guess[0]; ! this.answers = new Answer[0]; ! } ! ! public void setData(Guess[] g, Answer[] a) { ! this.guesses = g; ! this.answers = a; ! ! repaint(); ! } ! ! public DebriefingPanel(Map parameters) { ! this(); ! } ! public void setBest(Guess g, Answer a) { ! this.bestGuess = g; ! this.bestAnswer = a; ! ! repaint(); ! } ! ! public void paint(Graphics g) { } } --- 21,53 ---- public class DebriefingPanel extends JPanel { private static final long serialVersionUID = -260805377490024320L; ! ! protected Guess[] guesses; ! protected Answer[] answers; ! protected Guess bestGuess; ! protected Answer bestAnswer; ! ! public DebriefingPanel() { ! super(); ! this.setBackground(Color.WHITE); ! this.guesses = new Guess[0]; ! this.answers = new Answer[0]; ! } ! ! public void setData(Guess[] g, Answer[] a) { ! this.guesses = g; ! this.answers = a; ! } ! ! public DebriefingPanel(Map parameters) { ! this(); ! } ! ! public void setBest(Guess g, Answer a) { ! this.bestGuess = g; ! this.bestAnswer = a; ! } ! ! public void paint(Graphics g) { ! super.paint(g); ! } } Index: LaGrangeDebriefingPanel.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/client/LaGrangeDebriefingPanel.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** LaGrangeDebriefingPanel.java 27 Feb 2006 04:09:55 -0000 1.7 --- LaGrangeDebriefingPanel.java 24 Jun 2006 23:45:34 -0000 1.8 *************** *** 27,31 **** public LaGrangeDebriefingPanel(Map parameters) { super(); ! this.width = Integer.parseInt((String) parameters.get("width")); this.height = Integer.parseInt((String) parameters.get("height")); --- 27,31 ---- public LaGrangeDebriefingPanel(Map parameters) { super(); ! this.width = Integer.parseInt((String) parameters.get("width")); this.height = Integer.parseInt((String) parameters.get("height")); *************** *** 54,62 **** if (lga != null) score = lga.getNumberCorrect() + "/" + lga.getTotalSquares(); - if (lgg != null) { - System.out.println("painting: " + x + " = " + lgg.toString()); - } else { - System.out.println("painting: " + x + " = null"); - } String s = (x + 1) + ": " + score; --- 54,57 ---- *************** *** 82,85 **** --- 77,83 ---- /** * $Log$ + * Revision 1.8 2006/06/24 23:45:34 wayward_bruce + * Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. + * * Revision 1.7 2006/02/27 04:09:55 wayward_bruce * - changed to use net.sf.gabel.social.ColorTheme instead of hardcoded colors - reindented with tabs *************** *** 88,92 **** * Serializables are given a serialVersionUID - identifiers across Social * server/client renamed to reflect the new experiment scheme: experiment is a ! * set of games are sets of rounds - moset debugging println()s removed from * Social server/client - fixed a bug causing double submission of last round's * guess - debriefing pane added to MusicalChoice - Mike's save() code for Sum --- 86,90 ---- * Serializables are given a serialVersionUID - identifiers across Social * server/client renamed to reflect the new experiment scheme: experiment is a ! * set of games are sets of rounds - most debugging println()s removed from * Social server/client - fixed a bug causing double submission of last round's * guess - debriefing pane added to MusicalChoice - Mike's save() code for Sum --- ExperimentFactory.java DELETED --- --- SumExperiment.java DELETED --- Index: SumDebriefingPanel.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/client/SumDebriefingPanel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SumDebriefingPanel.java 10 Nov 2005 18:25:41 -0000 1.3 --- SumDebriefingPanel.java 24 Jun 2006 23:45:34 -0000 1.4 *************** *** 1,11 **** --- 1,23 ---- package net.sf.gabel.social.client; + + import java.awt.BorderLayout; import java.awt.Graphics; import java.util.Map; + import javax.swing.JEditorPane; + import javax.swing.JScrollPane; + + import net.sf.gabel.social.problems.Answer; + import net.sf.gabel.social.problems.Guess; + import net.sf.gabel.social.problems.SumAnswer; + import net.sf.gabel.social.problems.SumGuess; + + /** * Knows how to draw a good debriefing for Sum problem type * * $Id$ + * * @author Michael Roberts * @version $Revision$ *************** *** 14,27 **** private static final long serialVersionUID = 2287830549535340584L; ! private int width = 0; ! private int height = 0; ! ! public SumDebriefingPanel(Map parameters) { ! super(); ! } ! public void paint(Graphics g) { ! } } - --- 26,57 ---- private static final long serialVersionUID = 2287830549535340584L; ! protected JEditorPane debriefingPane = new JEditorPane("text/html; charset=UTF-8", ""); ! public SumDebriefingPanel(Map parameters) { ! super(); ! setLayout(new BorderLayout()); ! debriefingPane.setEditable(false); ! JScrollPane scrollPane = new JScrollPane(debriefingPane, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, ! JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); ! add(scrollPane, BorderLayout.CENTER); ! } ! public void paint(Graphics g) { ! StringBuffer s = new StringBuffer("<html>"); ! s.append("<h3>Your input</h3>"); ! for (int i = 0; i < guesses.length; i++) { ! SumGuess sg = (SumGuess) guesses[i]; ! SumAnswer sa = (SumAnswer) answers[i]; ! if (sg == null || sa == null) ! continue; // skip unsubmitted/trailing guesses ! s.append("Round ").append(i+1).append(": "); ! s.append("<b>").append(sg.getGuess()).append("</b>: "); ! s.append(sa); ! s.append("<br>"); ! } ! s.append("</html>"); ! debriefingPane.setText(s.toString()); ! System.err.println("setting text: " + s.toString()); ! super.paint(g); ! } } Index: GamePanel.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/client/GamePanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GamePanel.java 27 Feb 2006 04:06:33 -0000 1.2 --- GamePanel.java 24 Jun 2006 23:45:34 -0000 1.3 *************** *** 15,18 **** --- 15,19 ---- import net.sf.gabel.util.Identifier; import net.sf.gabel.social.ColorTheme; + import net.sf.gabel.social.events.GameStartEvent; import net.sf.gabel.social.problems.Answer; *************** *** 37,48 **** protected JPanel drawArea; ! private boolean monitor; ! public GamePanel(Identifier id, Map parameters, boolean isMonitor) { super(new BorderLayout()); - monitor = isMonitor; this.id = id; this.functionParameters = parameters; ! drawArea = new JPanel() { public void paint(Graphics g) { --- 38,51 ---- protected JPanel drawArea; ! protected boolean asMonitor; ! protected GameStartEvent startEvent; ! ! public GamePanel(Identifier id, Map parameters, boolean asMonitor, GameStartEvent startEvent) { super(new BorderLayout()); this.id = id; this.functionParameters = parameters; ! this.asMonitor = asMonitor; ! drawArea = new JPanel() { public void paint(Graphics g) { *************** *** ... [truncated message content] |