virtualcommons-svn Mailing List for Virtual Commons Experiment Software (Page 16)
Status: Beta
Brought to you by:
alllee
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(21) |
Aug
(31) |
Sep
(6) |
Oct
(15) |
Nov
(2) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(4) |
Feb
(6) |
Mar
(12) |
Apr
(52) |
May
(14) |
Jun
(19) |
Jul
(81) |
Aug
(115) |
Sep
(36) |
Oct
(88) |
Nov
(46) |
Dec
(58) |
2010 |
Jan
(52) |
Feb
(55) |
Mar
(48) |
Apr
(15) |
May
(5) |
Jun
(38) |
Jul
(27) |
Aug
(24) |
Sep
(28) |
Oct
(1) |
Nov
(2) |
Dec
(29) |
2011 |
Jan
(87) |
Feb
(39) |
Mar
(63) |
Apr
(42) |
May
(26) |
Jun
(53) |
Jul
(23) |
Aug
(43) |
Sep
(37) |
Oct
(25) |
Nov
(4) |
Dec
(7) |
2012 |
Jan
(73) |
Feb
(79) |
Mar
(62) |
Apr
(28) |
May
(12) |
Jun
(2) |
Jul
(9) |
Aug
(1) |
Sep
(8) |
Oct
|
Nov
(3) |
Dec
(3) |
2013 |
Jan
(8) |
Feb
(16) |
Mar
(38) |
Apr
(74) |
May
(62) |
Jun
(15) |
Jul
(49) |
Aug
(19) |
Sep
(9) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(25) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Bitbucket <com...@bi...> - 2012-04-09 19:27:34
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/ccdf6a26a534/ changeset: ccdf6a26a534 user: all...@libai-vb-w7.la.asu.edu date: 2012-04-09 21:27:05 summary: updating crude windows deploy script to jdk 1.6.0_31 affected #: 1 file diff -r 79a7d47a525699cc3e37d0f9a3e038acf3a20a17 -r ccdf6a26a534cfc24e1d66a91d26fa2b0fc1f0d0 deploy.bat --- a/deploy.bat +++ b/deploy.bat @@ -5,6 +5,6 @@ REM This script will not work unless you make sure that ANT_HOME, M2_HOME, and JAVA_HOME are pointing at the correct location. set ANT_HOME=C:\tools\ant set M2_HOME=C:\tools\maven -set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_26 +set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_31 set PATH=%M2_HOME%\bin;%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH% ant clean deploy server Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-04-09 19:17:41
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/79a7d47a5256/ changeset: 79a7d47a5256 user: alllee date: 2012-04-09 21:17:36 summary: bah, committed in wrong branch. affected #: 8 files diff -r 8d4ab27b89996b3419df205057452039823eaf49 -r 79a7d47a525699cc3e37d0f9a3e038acf3a20a17 src/main/resources/configuration/asu/2011/sk/t1/round0.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round0.xml @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="resource-width">13</entry> +<entry key="resource-depth">13</entry> +<entry key="practice-round">true</entry> +<entry key="private-property">true</entry> +<entry key="duration">240</entry> + +<entry key="quiz">true</entry> +<entry key="q1">C</entry> +<entry key="q2">B</entry> + +<entry key='instructions'> +<![CDATA[ +<h2>Inšrukcie pre skúšobné kolo</h2> +<hr> +<p> + Ked každý ukončil kvíz, potom začenme skúšobné kolo. + </p> +<p> +Počas skúšobného kola budete mať čas oboznámiť sa a +skúsiť si experimentálne prostredie po dobu {duration}. +Rozhodnutia, ktoré urobíte v skúšobnom kole NEBUDE mať vplyv na Vaše zárobky. +Na začiatku skúšobného kola počiatočné množstvo {initialDistribution} +buniek je obsadené so zelenými žetónmi. + Prostredie je tvorené mriežkou buniek o celkovom počte + {self.resourceWidth} x {self.resourceDepth} . +</p> +<p> +<b>Len počas</b> tohto skúšobného kola ste schopný resetnuť +zobrazené žetóny na obrazovke stlačením klávesy <b>R</b>. +Ked stlačíte klávesu <b>R</b>, +potom resetujete rozdelenie žetónov na hracej ploche + na iné náhodné rozdelenie žetónov, ktoré obsadia nový počet + {initialDistribution} buniek žetónmi. +</p> +<p><b> + Máte nejaké otázky?</b> + Ked máte otázky, zdvihnite ruku a niekto príde k +Vášmu počítaču a odpovie Vám na danú otázku. +</p> +]]> +</entry> + +<entry key="quiz-instructions"> +<![CDATA[ +<h2>Kvíz +</h2> +<hr> +<p> + Pred tým ako začneme skúšobné kolo, prosím odpovedzte na nasledujúce kvízove otázky, +aby sme sa uistili, že rozumiete inštrukciám experimentu. + Za každú správnu odpoved na kvízovú otázku zarobíte {quizCorrectAnswerReward} . +</p> +<br> +<form> +<span class='q1'>Q1. Ktorý z nasledujúcich výrokov NIE je správny ? </span><br> +<input type="radio" name="q1" value="A">A. Vaše rozhodnutie o mieste + zbierania žetónov vplýva na regeneráciu žetónov. <br> +<input type="radio" name="q1" value="B">B. Ked ste pozbierali + všetky žetóny z hracej plochy na obrazovke, potom žiadne nové žetóny sa neobjavia. <br> +<input type="radio" name="q1" value="C">C. Žetóny rastú zo +stredu hracej plochy na obrazovke. <br> + <input type="radio" name="q1" value="D">D. Aby ste zbierali +žetóny, musíte stlačiť klávesu medzerovníka pokial Váš "pacman" +<img src="@CODEBASE_URL@/images/gem-self.gif"></img> je zobrazený na bunke so žetónom. <br> +<br><br> +<span class='q2'>Q2. Ktorá postupnosť udalostí nie je možná z nasledujúcich?</span><br> +<img src="@CODEBASE_URL@/images/question2.jpg"></img><br> +<input type="radio" name="q2" value="A">A<br> +<input type="radio" name="q2" value="B">B<br> +<input type="radio" name="q2" value="C">C<br> +<input type="submit" name="submit" value="Submit"><br> +</form> +]]> +</entry> +<entry key='quiz-results'> + <![CDATA[ + <h2>Výsledky Kvízu.</h2> + <hr> + <p> + {if (allCorrect)} + Zodpovedali ste na všetky kvízové otázky správne a +zarobili ste <b>{totalQuizEarnings}</b>. + {else} + Odpovedali ste {numberCorrect} otázok správne z +celkového počtu {totalQuestions} otázok a zarobili ste <b>{totalQuizEarnings}</b>. + Otázky, ktoré ste zodpovedali nesprávne +sú vysvietené na červeno. Prosím vydte viac detailov nižšie. + {endif} + </p> + <br><hr> +<form> +<span class='q1'>Q1. Ktorý z nasledujúcich výrokov NIE je správny ? </span><br> + <b>{incorrect_q1} + V tejto otázke, "A", "B", a "D" sú správne odpovede. "C" je nesprávna odpoved. + Žetóny sa regenerujú len, keď sa nachádzajú iné žetóny v prilahlých +susediacich bunkách. + Žetóny nie sú spontánne generované zo stredu hracej plochy na obrazovke. + + </b> +<br> +A. Vaše rozhodnutie o mieste zbierania žetónov vplýva na regeneráciu žetónov. <br> +B. Ked ste pozbierali vsetky žetóny z hracej plochy na obrazovke, +potom žiadne nové žetóny sa neobjavia.<br> +C. Žetóny rastú zo stredu hracej plochy na obrazovke.<br> +D. Aby ste zbierali žetóny, musíte stlačiť +klávesu medzerovníka pokial Vaš "pacman" +<img src="@CODEBASE_URL@/images/gem-self.gif"></img> je zobrazený na bunke so žetónom.<br> +<br> +<span class='q2'>Q2. Ktorá postupnosť udalostí nie je možna? </span><br> + <b> + {incorrect_q2} + V tejto otázke, postupnosť udalostí "B" nie je možná. + Žetóny sa nedokážu regenerovať na prázdnej hracej ploche + ako je znázornené v postupnosti udalosti B. + </b> + <br> +<img src="@CODEBASE_URL@/images/question2.jpg"></img><br> +</form> + ]]> +</entry> +</properties> diff -r 8d4ab27b89996b3419df205057452039823eaf49 -r 79a7d47a525699cc3e37d0f9a3e038acf3a20a17 src/main/resources/configuration/asu/2011/sk/t1/round1.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round1.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key='trust-game'>true</entry> +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +<entry key="instructions"> +<![CDATA[ +<h1> Inštrukcie Kola {self.roundNumber} +</h1> +<hr> +<p> + Toto je prvé skutočné kolo tohto experimnetu. + Dlžka kola je {duration}. + Takisto ako v skúšobnom kole zbierate zelené žetóny s tým rozdielom, + že zarobíte <b>{dollarsPerToken}</b> Eúr za každý zozbieraný žetón. + <b>Nedokážete</b> v tomto kole resetnúť distribúcie zelených žetónov na hracej ploche. + +</p> +<h3>Skupiny +</h3> +<hr> +<p> +V tomto kole sa obnovitelné zdroje stanú päť krát väčšie. +Budete sa deliť o toto väčšie prostredie s dalšími štyrmi hráčmi v miestnosti. +Každému účastníkovi experimentu v miestnosti je náhodne pridelené +číslo skupiny z {self.clientsPerGroup} rovnako početných skupín, +a každému účastníkovi v rámci jeho skupiny je náhodne pridelené číslo +od 1 do {self.clientsPerGroup}. +Zostanete v rovnakej skupine počas celého experimentu, +a každé účastníkové číslo od 1 do {self.clientsPerGroup} zostane nezmené + tiež počas celého experimentu. + Ostatní členovia Vašej skupiny sa objavia na obrazovke +ako modré bodky <img src="@CODEBASE_URL@/images/gem-other.gif"> s + bielym číslom vo vnútri bodky. +</p> +<p> + V každom kole úlohy, v pravom hornom rohu obrazovky môžete vidieť +kolko žetónov každý hráč nazbieral. + V lavom hornom rohu obrazovky vidíte zvyšný čas do ukončenia kola. +</p> +<h3>Anonymita +</h3> +<hr> +<p> + Z dôvodu náhodného pridelovania počítačom hráčov do skupín + a náhodného výberu prideleného čísla v rámci skupiny, ani Vy a ani experimentátor + nie je sú schopní identifikovať, ktorí hráči v miestnosti boli pridelení do +príslušnej skupiny a ako ani ich čísla v rámci danej skupiny. + Vaša anonymita je garantovaná. +</p> +<h3> + Žetóny +</h3> +<hr> + <p> + Každá skupina má svoju vlastnú množinu žetónových zdrojov. + </p> +<p><b>Máte nejaké otázky?</b> + Ked máte otázky, zdvihnite ruku a + niekto príde k Vášmu počítaču a odpovie Vám na danú otázku. +</p> +]]> +</entry> +</properties> diff -r 8d4ab27b89996b3419df205057452039823eaf49 -r 79a7d47a525699cc3e37d0f9a3e038acf3a20a17 src/main/resources/configuration/asu/2011/sk/t1/round2.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round2.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key='initial-distribution'>.25</entry> +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +</properties> diff -r 8d4ab27b89996b3419df205057452039823eaf49 -r 79a7d47a525699cc3e37d0f9a3e038acf3a20a17 src/main/resources/configuration/asu/2011/sk/t1/round3.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round3.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- resource regrowth parameters --> +<entry key="initial-distribution">.25</entry> + + +</properties> diff -r 8d4ab27b89996b3419df205057452039823eaf49 -r 79a7d47a525699cc3e37d0f9a3e038acf3a20a17 src/main/resources/configuration/asu/2011/sk/t1/round4.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round4.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<!-- have a trust game before this round begins --> +<entry key='trust-game'>true</entry> +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key='in-round-chat-enabled'>true</entry> +<entry key="initial-distribution">.25</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Inštrukcie {roundNumber} kola +</h3> +<hr> +<p> + Toto kolo je rovnaké ako ostatné kolá pred tým len s jednou výnimkou. + Ste schopný komunikovať s ostatnými hráčmi vo Vašej skupine <b>počas</b> + kola. Aby ste mohli komunikovať, stlačte enter klávesu a napíšte Váš odkaz, + a následne potom + znova stlačte enter klávesu. Klávesa enter musí byť +vždy stlačená predtým ako napíšete odkaz, inak + control klávesou sa môžete vrátiť späť do hry, +kde používate klávesy šípiek, aby ste sa dokázali pohybovať +v rámci hracej plochy na obrazovke. +</p> + +<p> + Trvanie tohto kola je {duration}. +</p> + <p><b>Máte nejaké otázky?</b> + Ked máte otázky, zdvihnite ruku a niekto príde k +Vášmu počítaču a odpovie Vám na danú otázku. +</p> +]]> +</entry> +</properties> diff -r 8d4ab27b89996b3419df205057452039823eaf49 -r 79a7d47a525699cc3e37d0f9a3e038acf3a20a17 src/main/resources/configuration/asu/2011/sk/t1/round5.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round5.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +<entry key="in-round-chat-enabled">true</entry> + +</properties> diff -r 8d4ab27b89996b3419df205057452039823eaf49 -r 79a7d47a525699cc3e37d0f9a3e038acf3a20a17 src/main/resources/configuration/asu/2011/sk/t1/round6.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round6.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> +<!-- in round chat enabled --> +<entry key="in-round-chat-enabled">true</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +<entry key='trust-game'>true</entry> +</properties> diff -r 8d4ab27b89996b3419df205057452039823eaf49 -r 79a7d47a525699cc3e37d0f9a3e038acf3a20a17 src/main/resources/configuration/asu/2011/sk/t1/server.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/server.xml @@ -0,0 +1,313 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Costly Sanctioning XML-ized experiment round configuration</comment> +<entry key="hostname">@SERVER_ADDRESS@</entry> +<entry key="port">@PORT_NUMBER@</entry> +<entry key="round0">round0.xml</entry> +<entry key="round1">round1.xml</entry> +<entry key="round2">round2.xml</entry> +<entry key="round3">round3.xml</entry> +<entry key="round4">round4.xml</entry> +<entry key="round5">round5.xml</entry> +<entry key="round6">round6.xml</entry> +<entry key="wait-for-participants">true</entry> +<entry key="number-of-rounds">7</entry> +<entry key="facilitator-instructions"> +<![CDATA[ +<p> + Prostredie "facilitator" ti dovolí kontrolovať priebeh experimentu. + Vo všeobecnosti experiment pozostáva z nasledujúcej postupnosti krokov podobnej k týmto: + <ol> + <li> Ukáž inštrukcie experimentu </li> + <li> Spusti kolo</li> + <li>Po kole je koniec + + <ol> + <li> Ukáž hru dôvery ak je to nutné </li> + <li> Spusti samostatné komunikačné kolo ak je to nutné </li> + </ol> + </li> + <li>Chod na 1.</li> + </ol> +</p> +]]> +</entry> + +<entry key='field-of-vision-instructions'> +<![CDATA[ + Váš pohlad je limitovaný v tomto experimente. + Viditelná oblasť Vami bude vytieňovaná. +]]> +</entry> + +<entry key="welcome-instructions"> +<![CDATA[ +<h1>Vítame Vás pri hraní tohto experimentu. </h1> +<hr> +<p> +Vítame Vás na experimente. Experiment sa začne okamžite ako každý sa +prihlási a zaregistruje k svojmu počítaču. +<br><br> +Prosím <b> čakajte v tichosti</b> a + nezatvárajte otvorené hracie okno, alebo iné otovarené aplikácie, a + nekomunikujte s druhými účastníkmi experimentu.</b>. +</p> +]]> +</entry> + +<entry key="general-instructions"> +<![CDATA[ +<h1> Všeobecné inštrukcie k experimentu </h1> +<hr> +<p><b>Vítame Vás.</b> + Zarobili ste už {showUpPayment} Eur za to, + že ste boli ochotný prísť hrať tento experiment. +</p> +<p> +Máte možnosť zarobiť aj viac, a to maximálne do výšky okolo 40 Eur, a to zúčastnením +sa na celom priebehu experimentu, + ktorý potrvá okolo hodinu a pol. Sumu, ktorú zarobíte závisí od Vašich rozhodnutí + A na rozhodnutiach urobenými inými účastníkmi v miestnosti počas trvania experimentu. +</p> +<h2> Ako sa zúčastniť na experimente</h2> +<hr> +<p> +Na obrazovke budete znyornený ako žltý plný kruh s vykrojenými ústami (dalej "pacman" a +pre tých, ktorí poznajú hru pacman tento symbol je určite známy) +<img src="@CODEBASE_URL@/images/gem-self.gif"></img>. +Vášho "pacmana" po obrazovke môžete pohybovať stláčaním 4och +šípkových kláves na Vašej klávesnici. +</p> +<p> + Možete sa pohybovať smerom nahor, dole, doľava a doprava. + Musíte stláčať klávesu pre každý pohyb Vašej žltej bodky. + Ked sa pohybujete po hracej ploche tak je Vám umožnené zbierať + zelené žetóny v tvare diamantu + <img src="@CODEBASE_URL@/images/gem-token.gif"></img> + a zarobiť 2 centy za každý˝ zozbieraný žetón. + Zobrať žetón možete nasledujúcim spôsobom. + Pohnite Vášho zltého "pacmana" na zelený žetón a + <b>stlačte klávesu medzerovníka</b>. + Jednoduchý pohyb Vášho "pacmana" cez zelený žetón <b>nezoberie</b> daný žetón. +</p> + +<h2>Žetóny +</h2> +<hr> +<p> +Žetóny, ktoré zbierate majú schopnosť sa regenerovať. + Potom ako ste zobrali zelený žetón, nový žetón sa môže znova objaviť + na prázdnej hracej bunke. + Miera s ktorou sa nové žetóny objavujú je závislá na počte priľahlých + bunkiek so žetónmi. + Ak je viac žetónov na priľahlých susediacich bunkách s prázdnou bunkou + potom je aj rýchlejšia miera generovania a objavenia + sa nového žetónu na prázdnej bunke. + Inými slovami, <b> existujúce žetóny môžu generovať novšie žetóny</b>. + Názorná ukážka regenerácie nových žetónov na práydnych bunkách + je ukázaná na Obrázku č.1 a Obrázku č.2. + Stredná bunka na Obrázku č.1 označená veľkým písmenom X má + väčšiu pravdepodobnosť regenerácie + nového žetónu ako stredná bunka na Obrázku č.2. + Ak sú všetky susediace bunky prázdne, potom + <b>nie je žiadna šanca na regeneráciu nového žetónu</b>. + </p> +<table width="100%"> +<tr> +<td align="center"><b>Image 1</b></td> +<td align="center"><b>Image 2</b></td> +</tr> +<tr> +<td align="center"> + <img src="@CODEBASE_URL@/images/8neighbors.jpg" alt="image 1"> +</td> +<td align="center"> + <img src="@CODEBASE_URL@/images/5neighbors.jpg" alt="image 2"> +</td> +</tr> +</table> + +<h2>Najlepšia stratégia +</h2> +<hr> +<p> + Pravdepodobnosť, že žetóny sa znova objavia na prázdnej bunke +rastie ak je viac okolo susediacich žetónov. + Teda potom, sa snažíte mať čo najviac + susediacich žetónov okolo prázdnej bunky len ak je to možné. + Avšak, tiež potrebujete prázdne bunky, + aby ste získavali z tohto nárastu nové žetóny. + Najlepšie rozmiestnenie žetónov, + ktoré maximalizuje celkový nárast nových žetónov, je znázornený + nižšie na obrázku hracej plochy. +<br> +<img src="@CODEBASE_URL@/images/foraging-checkerboard.png" alt="Checkerboard Resource"> +</p> +]]> +</entry> + +<entry key='trust-game-instructions'> +<![CDATA[ +<h1>Inštrukcie +</h1> +<hr> +<p> + Teraz sa zúčastníte cvičenia, kde budete núhodne spárovaný + s náhodným iným účastníkom experimentu vo Vašej skupine. + V tomto cvičení sú dvaja hráči Hráč 1 a Hráč 2. + Vaša úloha je rozhodnúť o stratégiách pre oboch hráčov Hráča 1 aj Hráča 2. + Keď ste náhodne spárovaný s iným členom Vašej skupiny, + môžete byť vybraný ako Hráč 1 <b>alebo</b> ako Hráč 2. + Výsledky z náhodne spárovaných Vašich stratégií + s inými členmi Vašej skupiny budú Vám ukázané <b>na konci experimentu</b>. +</p> + +<h2>Ako sa zúčastniť +</h2> +<hr> +<ol> + <li> + Hráč 1 najprv dostane dotáciu 1 Euro a musí + sa rozhodnúť,<b> že akú sumu z 1 Eura si ponechá.</b> + Zvyšná suma je <b>poslaná Hráčovi 2</b>. + <li> + Suma, ktorú Hráč 1 posiela Hráčovi 2, je strojnásobená a daná Hráčovi 2. + Hráč 2 sa potom musí rozhodnúť <b>koľko si ponechá</b> a <b> +koľko pošle späť Hráčovi 1</b>. + +</ol> +<p> + Napríklad, Ak Hráč 1 pošle 0 centov Hráčovi 2, + potom Hráč 1 zarobí 1 Euro a Hráč 2 zarobí 0 Eur. + Avšak, Ak Hráč 1 pošle 1 Euro Hráčovi 2, potom 3 Eurá budú poslané Hráčovi 2. + Hráč 2 sa rozhodne vrátiť 1,75 Eura späť Hráčovi 2. + V tomto prípade Hráč 1 zarobí 1,75 Eura a Hráč 2 1,25 Eura. + +</p> +<p> + Prosímm vyplňte nasledujúci formulár obsahujúci Vaše stratégie + ako Hráč 1 alebo ako Hráč 2. +<br> +<b> + Ak máte nejaké otázky. +Prosím zdvihnite Vašu ruku a niekto Vám odpovie na Vaše otázky? +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> + Môžete komunikovať s ostatnými účastníkmi vo Vašej skupine +počas tohto kola. Môžete diskutovať o rôznych aspektoch +experimentu s ostatnými účastníkmi, ale s dvoma výnimkami: + <ol> + <li> + <b> Nesmiete žiadnemu účastníkovi experimentu + slúbiť vyplatenie bočných platieb po skončení + experimentu a ani sa vyhrážať niekomu s rôznymi následkami, + potom ako sa experiment ukončí</b>. + + <li><b>Nesmiete odhaliť svoju identitu.</b></li> +</ol> +<p> + Moniturujeme komunikáciu pokial komunikujete medzi sebou. +Ak odhalíme lubovolné porušenie pravidiel, +potom sme nútení zastaviť experiment a odstrániť +problémovú skupinu z miestnosti a experimentu. + </p> +<p> + Ostatných účastníkov vidíte označených velkými písmenami + abecedy začínajúc od A až po {self.lastChatHandle} v komunikačnom okne. + Môžete poslať odkaz jednoducho vpísaním + obsahu odkazu do textového poľa a stlačením klávesy enter. + </p> +]]> +</entry> +<entry key="same-as-previous-round-instructions"> +<![CDATA[ +<h3>Inštrukcie {self.roundNumber} kola +s</h3> +<hr> +<p> {self.roundNumber} kolo je rovnaké ako predchádzajúce kolo.</p> +<p> Dĺžka tohto kola je {duration}.</p> +<p><b>Máte nejaké otázky? Ak máte nejaké otázky teraz, +prosím zodvihnite ruku a niekto príde k Vášmu počítaču a odpovie Vám.</p> +]]> +</entry> +<entry key='facilitator-debriefing'> +<![CDATA[ +<h3>Inštrukcie {self.roundNumber} kola + </h3> +<hr> +<table border=1 cellspacing=3 cellpadding=3> +<tr> +<th>Účastník + </th><th>Aktuálny stav žetónov</th><th> Aktuálny stav príjmu</th><th>Kvízový zárobok +</th><th>Zárobok z Hry Dôvery</th><th> Celkový príjem</th> +</tr> +{clientDataList: {data | +<tr align="RIGHT"><td>{data.id}</td><td>{data.currentTokens}</td> +<td>{data.currentIncome}</td><td>{data.quizEarnings}</td> +<td>{data.trustGameEarnings}</td><td>{data.grandTotalIncome}</td></tr> +}} +</table> +]]> +</entry> +<entry key='client-debriefing'> +<![CDATA[ +<h1> {if (self.practiceRound)}Skúšobné kolo {else} Kolo {self.roundNumber}{endif} Výsledky + </h1> +<hr> +<ul> + <li> Žetóny zozbierané v tomto kole: {clientData.currentTokens} + </li> + <li>Príjmy zo zozbieraných žetónov: {clientData.currentIncome} + </li> + <li>Zárobok z kvízu: {clientData.quizEarnings} + </li> + <li>Platba za príchod na experiment:{showUpPayment} + </li> +</ul> +{if (showExitInstructions && !clientData.trustGameLog.empty) } +<h2> Zárobky z hry Dôvery + </h2> +<hr> +<ul> +{clientData.trustGameLog: {trustGameLog| +<li>Hra Dôvery #{i}: {trustGameLog}</li> +}} +</ul> + Vaše celkové príjmy z hry Dôvery:<b>{clientData.trustGameEarnings}</b>. +{endif} +<h2> Celkový príjem +</h2> +<hr> +<p> + Váš <b>celkový príjem</b je <b>{clientData.grandTotalIncome}</b>. +</p> +{if (showExitInstructions)} +<h2> Odhlásit sa z prehladu +</h2> +<hr> +<p> +Toto bolo posledné kolo, ale nie koniec experimentu. + Chceli by sme Vás požiadať, aby ste vyplnili krátky dotazník a zatial + pripravíme Vaše nahrané príjmy. +</p> +<h2>Platby +</h2> +<hr> +<p> + Keď budú Vaše platby pripravené, budeme Vás volať po jednom. +Prosím počkajte dokým nieje číslo Vášho počítača +<b>{clientData.id}</b> zavolané, aby ste odvzdali Váš dotazník a + dostali výplatu za hru. + Prosíme Vás odpovedzte na dotazník + pozorne a ďakuejme Vám za účasť na experimente. +</p> +{endif} +]]> +</entry> +</properties> Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-04-09 19:02:30
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/bcf54014af55/ changeset: bcf54014af55 branch: stable user: alllee date: 2012-04-09 21:02:22 summary: first draft of slovak translations for asu 2011 experiments affected #: 8 files diff -r 78057caab3b65da359093d97d27c9c9b2fcdbe99 -r bcf54014af556889e9d7983ac48d6098cbd50705 src/main/resources/configuration/asu/2011/sk/t1/round0.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round0.xml @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="resource-width">13</entry> +<entry key="resource-depth">13</entry> +<entry key="practice-round">true</entry> +<entry key="private-property">true</entry> +<entry key="duration">240</entry> + +<entry key="quiz">true</entry> +<entry key="q1">C</entry> +<entry key="q2">B</entry> + +<entry key='instructions'> +<![CDATA[ +<h2>Inšrukcie pre skúšobné kolo</h2> +<hr> +<p> + Ked každý ukončil kvíz, potom začenme skúšobné kolo. + </p> +<p> +Počas skúšobného kola budete mať čas oboznámiť sa a +skúsiť si experimentálne prostredie po dobu {duration}. +Rozhodnutia, ktoré urobíte v skúšobnom kole NEBUDE mať vplyv na Vaše zárobky. +Na začiatku skúšobného kola počiatočné množstvo {initialDistribution} +buniek je obsadené so zelenými žetónmi. + Prostredie je tvorené mriežkou buniek o celkovom počte + {self.resourceWidth} x {self.resourceDepth} . +</p> +<p> +<b>Len počas</b> tohto skúšobného kola ste schopný resetnuť +zobrazené žetóny na obrazovke stlačením klávesy <b>R</b>. +Ked stlačíte klávesu <b>R</b>, +potom resetujete rozdelenie žetónov na hracej ploche + na iné náhodné rozdelenie žetónov, ktoré obsadia nový počet + {initialDistribution} buniek žetónmi. +</p> +<p><b> + Máte nejaké otázky?</b> + Ked máte otázky, zdvihnite ruku a niekto príde k +Vášmu počítaču a odpovie Vám na danú otázku. +</p> +]]> +</entry> + +<entry key="quiz-instructions"> +<![CDATA[ +<h2>Kvíz +</h2> +<hr> +<p> + Pred tým ako začneme skúšobné kolo, prosím odpovedzte na nasledujúce kvízove otázky, +aby sme sa uistili, že rozumiete inštrukciám experimentu. + Za každú správnu odpoved na kvízovú otázku zarobíte {quizCorrectAnswerReward} . +</p> +<br> +<form> +<span class='q1'>Q1. Ktorý z nasledujúcich výrokov NIE je správny ? </span><br> +<input type="radio" name="q1" value="A">A. Vaše rozhodnutie o mieste + zbierania žetónov vplýva na regeneráciu žetónov. <br> +<input type="radio" name="q1" value="B">B. Ked ste pozbierali + všetky žetóny z hracej plochy na obrazovke, potom žiadne nové žetóny sa neobjavia. <br> +<input type="radio" name="q1" value="C">C. Žetóny rastú zo +stredu hracej plochy na obrazovke. <br> + <input type="radio" name="q1" value="D">D. Aby ste zbierali +žetóny, musíte stlačiť klávesu medzerovníka pokial Váš "pacman" +<img src="@CODEBASE_URL@/images/gem-self.gif"></img> je zobrazený na bunke so žetónom. <br> +<br><br> +<span class='q2'>Q2. Ktorá postupnosť udalostí nie je možná z nasledujúcich?</span><br> +<img src="@CODEBASE_URL@/images/question2.jpg"></img><br> +<input type="radio" name="q2" value="A">A<br> +<input type="radio" name="q2" value="B">B<br> +<input type="radio" name="q2" value="C">C<br> +<input type="submit" name="submit" value="Submit"><br> +</form> +]]> +</entry> +<entry key='quiz-results'> + <![CDATA[ + <h2>Výsledky Kvízu.</h2> + <hr> + <p> + {if (allCorrect)} + Zodpovedali ste na všetky kvízové otázky správne a +zarobili ste <b>{totalQuizEarnings}</b>. + {else} + Odpovedali ste {numberCorrect} otázok správne z +celkového počtu {totalQuestions} otázok a zarobili ste <b>{totalQuizEarnings}</b>. + Otázky, ktoré ste zodpovedali nesprávne +sú vysvietené na červeno. Prosím vydte viac detailov nižšie. + {endif} + </p> + <br><hr> +<form> +<span class='q1'>Q1. Ktorý z nasledujúcich výrokov NIE je správny ? </span><br> + <b>{incorrect_q1} + V tejto otázke, "A", "B", a "D" sú správne odpovede. "C" je nesprávna odpoved. + Žetóny sa regenerujú len, keď sa nachádzajú iné žetóny v prilahlých +susediacich bunkách. + Žetóny nie sú spontánne generované zo stredu hracej plochy na obrazovke. + + </b> +<br> +A. Vaše rozhodnutie o mieste zbierania žetónov vplýva na regeneráciu žetónov. <br> +B. Ked ste pozbierali vsetky žetóny z hracej plochy na obrazovke, +potom žiadne nové žetóny sa neobjavia.<br> +C. Žetóny rastú zo stredu hracej plochy na obrazovke.<br> +D. Aby ste zbierali žetóny, musíte stlačiť +klávesu medzerovníka pokial Vaš "pacman" +<img src="@CODEBASE_URL@/images/gem-self.gif"></img> je zobrazený na bunke so žetónom.<br> +<br> +<span class='q2'>Q2. Ktorá postupnosť udalostí nie je možna? </span><br> + <b> + {incorrect_q2} + V tejto otázke, postupnosť udalostí "B" nie je možná. + Žetóny sa nedokážu regenerovať na prázdnej hracej ploche + ako je znázornené v postupnosti udalosti B. + </b> + <br> +<img src="@CODEBASE_URL@/images/question2.jpg"></img><br> +</form> + ]]> +</entry> +</properties> diff -r 78057caab3b65da359093d97d27c9c9b2fcdbe99 -r bcf54014af556889e9d7983ac48d6098cbd50705 src/main/resources/configuration/asu/2011/sk/t1/round1.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round1.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key='trust-game'>true</entry> +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +<entry key="instructions"> +<![CDATA[ +<h1> Inštrukcie Kola {self.roundNumber} +</h1> +<hr> +<p> + Toto je prvé skutočné kolo tohto experimnetu. + Dlžka kola je {duration}. + Takisto ako v skúšobnom kole zbierate zelené žetóny s tým rozdielom, + že zarobíte <b>{dollarsPerToken}</b> Eúr za každý zozbieraný žetón. + <b>Nedokážete</b> v tomto kole resetnúť distribúcie zelených žetónov na hracej ploche. + +</p> +<h3>Skupiny +</h3> +<hr> +<p> +V tomto kole sa obnovitelné zdroje stanú päť krát väčšie. +Budete sa deliť o toto väčšie prostredie s dalšími štyrmi hráčmi v miestnosti. +Každému účastníkovi experimentu v miestnosti je náhodne pridelené +číslo skupiny z {self.clientsPerGroup} rovnako početných skupín, +a každému účastníkovi v rámci jeho skupiny je náhodne pridelené číslo +od 1 do {self.clientsPerGroup}. +Zostanete v rovnakej skupine počas celého experimentu, +a každé účastníkové číslo od 1 do {self.clientsPerGroup} zostane nezmené + tiež počas celého experimentu. + Ostatní členovia Vašej skupiny sa objavia na obrazovke +ako modré bodky <img src="@CODEBASE_URL@/images/gem-other.gif"> s + bielym číslom vo vnútri bodky. +</p> +<p> + V každom kole úlohy, v pravom hornom rohu obrazovky môžete vidieť +kolko žetónov každý hráč nazbieral. + V lavom hornom rohu obrazovky vidíte zvyšný čas do ukončenia kola. +</p> +<h3>Anonymita +</h3> +<hr> +<p> + Z dôvodu náhodného pridelovania počítačom hráčov do skupín + a náhodného výberu prideleného čísla v rámci skupiny, ani Vy a ani experimentátor + nie je sú schopní identifikovať, ktorí hráči v miestnosti boli pridelení do +príslušnej skupiny a ako ani ich čísla v rámci danej skupiny. + Vaša anonymita je garantovaná. +</p> +<h3> + Žetóny +</h3> +<hr> + <p> + Každá skupina má svoju vlastnú množinu žetónových zdrojov. + </p> +<p><b>Máte nejaké otázky?</b> + Ked máte otázky, zdvihnite ruku a + niekto príde k Vášmu počítaču a odpovie Vám na danú otázku. +</p> +]]> +</entry> +</properties> diff -r 78057caab3b65da359093d97d27c9c9b2fcdbe99 -r bcf54014af556889e9d7983ac48d6098cbd50705 src/main/resources/configuration/asu/2011/sk/t1/round2.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round2.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key='initial-distribution'>.25</entry> +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +</properties> diff -r 78057caab3b65da359093d97d27c9c9b2fcdbe99 -r bcf54014af556889e9d7983ac48d6098cbd50705 src/main/resources/configuration/asu/2011/sk/t1/round3.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round3.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- resource regrowth parameters --> +<entry key="initial-distribution">.25</entry> + + +</properties> diff -r 78057caab3b65da359093d97d27c9c9b2fcdbe99 -r bcf54014af556889e9d7983ac48d6098cbd50705 src/main/resources/configuration/asu/2011/sk/t1/round4.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round4.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<!-- have a trust game before this round begins --> +<entry key='trust-game'>true</entry> +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key='in-round-chat-enabled'>true</entry> +<entry key="initial-distribution">.25</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Inštrukcie {roundNumber} kola +</h3> +<hr> +<p> + Toto kolo je rovnaké ako ostatné kolá pred tým len s jednou výnimkou. + Ste schopný komunikovať s ostatnými hráčmi vo Vašej skupine <b>počas</b> + kola. Aby ste mohli komunikovať, stlačte enter klávesu a napíšte Váš odkaz, + a následne potom + znova stlačte enter klávesu. Klávesa enter musí byť +vždy stlačená predtým ako napíšete odkaz, inak + control klávesou sa môžete vrátiť späť do hry, +kde používate klávesy šípiek, aby ste sa dokázali pohybovať +v rámci hracej plochy na obrazovke. +</p> + +<p> + Trvanie tohto kola je {duration}. +</p> + <p><b>Máte nejaké otázky?</b> + Ked máte otázky, zdvihnite ruku a niekto príde k +Vášmu počítaču a odpovie Vám na danú otázku. +</p> +]]> +</entry> +</properties> diff -r 78057caab3b65da359093d97d27c9c9b2fcdbe99 -r bcf54014af556889e9d7983ac48d6098cbd50705 src/main/resources/configuration/asu/2011/sk/t1/round5.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round5.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +<entry key="in-round-chat-enabled">true</entry> + +</properties> diff -r 78057caab3b65da359093d97d27c9c9b2fcdbe99 -r bcf54014af556889e9d7983ac48d6098cbd50705 src/main/resources/configuration/asu/2011/sk/t1/round6.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/round6.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<entry key="initial-distribution">.25</entry> +<!-- in round chat enabled --> +<entry key="in-round-chat-enabled">true</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> +<entry key='trust-game'>true</entry> +</properties> diff -r 78057caab3b65da359093d97d27c9c9b2fcdbe99 -r bcf54014af556889e9d7983ac48d6098cbd50705 src/main/resources/configuration/asu/2011/sk/t1/server.xml --- /dev/null +++ b/src/main/resources/configuration/asu/2011/sk/t1/server.xml @@ -0,0 +1,313 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Costly Sanctioning XML-ized experiment round configuration</comment> +<entry key="hostname">@SERVER_ADDRESS@</entry> +<entry key="port">@PORT_NUMBER@</entry> +<entry key="round0">round0.xml</entry> +<entry key="round1">round1.xml</entry> +<entry key="round2">round2.xml</entry> +<entry key="round3">round3.xml</entry> +<entry key="round4">round4.xml</entry> +<entry key="round5">round5.xml</entry> +<entry key="round6">round6.xml</entry> +<entry key="wait-for-participants">true</entry> +<entry key="number-of-rounds">7</entry> +<entry key="facilitator-instructions"> +<![CDATA[ +<p> + Prostredie "facilitator" ti dovolí kontrolovať priebeh experimentu. + Vo všeobecnosti experiment pozostáva z nasledujúcej postupnosti krokov podobnej k týmto: + <ol> + <li> Ukáž inštrukcie experimentu </li> + <li> Spusti kolo</li> + <li>Po kole je koniec + + <ol> + <li> Ukáž hru dôvery ak je to nutné </li> + <li> Spusti samostatné komunikačné kolo ak je to nutné </li> + </ol> + </li> + <li>Chod na 1.</li> + </ol> +</p> +]]> +</entry> + +<entry key='field-of-vision-instructions'> +<![CDATA[ + Váš pohlad je limitovaný v tomto experimente. + Viditelná oblasť Vami bude vytieňovaná. +]]> +</entry> + +<entry key="welcome-instructions"> +<![CDATA[ +<h1>Vítame Vás pri hraní tohto experimentu. </h1> +<hr> +<p> +Vítame Vás na experimente. Experiment sa začne okamžite ako každý sa +prihlási a zaregistruje k svojmu počítaču. +<br><br> +Prosím <b> čakajte v tichosti</b> a + nezatvárajte otvorené hracie okno, alebo iné otovarené aplikácie, a + nekomunikujte s druhými účastníkmi experimentu.</b>. +</p> +]]> +</entry> + +<entry key="general-instructions"> +<![CDATA[ +<h1> Všeobecné inštrukcie k experimentu </h1> +<hr> +<p><b>Vítame Vás.</b> + Zarobili ste už {showUpPayment} Eur za to, + že ste boli ochotný prísť hrať tento experiment. +</p> +<p> +Máte možnosť zarobiť aj viac, a to maximálne do výšky okolo 40 Eur, a to zúčastnením +sa na celom priebehu experimentu, + ktorý potrvá okolo hodinu a pol. Sumu, ktorú zarobíte závisí od Vašich rozhodnutí + A na rozhodnutiach urobenými inými účastníkmi v miestnosti počas trvania experimentu. +</p> +<h2> Ako sa zúčastniť na experimente</h2> +<hr> +<p> +Na obrazovke budete znyornený ako žltý plný kruh s vykrojenými ústami (dalej "pacman" a +pre tých, ktorí poznajú hru pacman tento symbol je určite známy) +<img src="@CODEBASE_URL@/images/gem-self.gif"></img>. +Vášho "pacmana" po obrazovke môžete pohybovať stláčaním 4och +šípkových kláves na Vašej klávesnici. +</p> +<p> + Možete sa pohybovať smerom nahor, dole, doľava a doprava. + Musíte stláčať klávesu pre každý pohyb Vašej žltej bodky. + Ked sa pohybujete po hracej ploche tak je Vám umožnené zbierať + zelené žetóny v tvare diamantu + <img src="@CODEBASE_URL@/images/gem-token.gif"></img> + a zarobiť 2 centy za každý˝ zozbieraný žetón. + Zobrať žetón možete nasledujúcim spôsobom. + Pohnite Vášho zltého "pacmana" na zelený žetón a + <b>stlačte klávesu medzerovníka</b>. + Jednoduchý pohyb Vášho "pacmana" cez zelený žetón <b>nezoberie</b> daný žetón. +</p> + +<h2>Žetóny +</h2> +<hr> +<p> +Žetóny, ktoré zbierate majú schopnosť sa regenerovať. + Potom ako ste zobrali zelený žetón, nový žetón sa môže znova objaviť + na prázdnej hracej bunke. + Miera s ktorou sa nové žetóny objavujú je závislá na počte priľahlých + bunkiek so žetónmi. + Ak je viac žetónov na priľahlých susediacich bunkách s prázdnou bunkou + potom je aj rýchlejšia miera generovania a objavenia + sa nového žetónu na prázdnej bunke. + Inými slovami, <b> existujúce žetóny môžu generovať novšie žetóny</b>. + Názorná ukážka regenerácie nových žetónov na práydnych bunkách + je ukázaná na Obrázku č.1 a Obrázku č.2. + Stredná bunka na Obrázku č.1 označená veľkým písmenom X má + väčšiu pravdepodobnosť regenerácie + nového žetónu ako stredná bunka na Obrázku č.2. + Ak sú všetky susediace bunky prázdne, potom + <b>nie je žiadna šanca na regeneráciu nového žetónu</b>. + </p> +<table width="100%"> +<tr> +<td align="center"><b>Image 1</b></td> +<td align="center"><b>Image 2</b></td> +</tr> +<tr> +<td align="center"> + <img src="@CODEBASE_URL@/images/8neighbors.jpg" alt="image 1"> +</td> +<td align="center"> + <img src="@CODEBASE_URL@/images/5neighbors.jpg" alt="image 2"> +</td> +</tr> +</table> + +<h2>Najlepšia stratégia +</h2> +<hr> +<p> + Pravdepodobnosť, že žetóny sa znova objavia na prázdnej bunke +rastie ak je viac okolo susediacich žetónov. + Teda potom, sa snažíte mať čo najviac + susediacich žetónov okolo prázdnej bunky len ak je to možné. + Avšak, tiež potrebujete prázdne bunky, + aby ste získavali z tohto nárastu nové žetóny. + Najlepšie rozmiestnenie žetónov, + ktoré maximalizuje celkový nárast nových žetónov, je znázornený + nižšie na obrázku hracej plochy. +<br> +<img src="@CODEBASE_URL@/images/foraging-checkerboard.png" alt="Checkerboard Resource"> +</p> +]]> +</entry> + +<entry key='trust-game-instructions'> +<![CDATA[ +<h1>Inštrukcie +</h1> +<hr> +<p> + Teraz sa zúčastníte cvičenia, kde budete núhodne spárovaný + s náhodným iným účastníkom experimentu vo Vašej skupine. + V tomto cvičení sú dvaja hráči Hráč 1 a Hráč 2. + Vaša úloha je rozhodnúť o stratégiách pre oboch hráčov Hráča 1 aj Hráča 2. + Keď ste náhodne spárovaný s iným členom Vašej skupiny, + môžete byť vybraný ako Hráč 1 <b>alebo</b> ako Hráč 2. + Výsledky z náhodne spárovaných Vašich stratégií + s inými členmi Vašej skupiny budú Vám ukázané <b>na konci experimentu</b>. +</p> + +<h2>Ako sa zúčastniť +</h2> +<hr> +<ol> + <li> + Hráč 1 najprv dostane dotáciu 1 Euro a musí + sa rozhodnúť,<b> že akú sumu z 1 Eura si ponechá.</b> + Zvyšná suma je <b>poslaná Hráčovi 2</b>. + <li> + Suma, ktorú Hráč 1 posiela Hráčovi 2, je strojnásobená a daná Hráčovi 2. + Hráč 2 sa potom musí rozhodnúť <b>koľko si ponechá</b> a <b> +koľko pošle späť Hráčovi 1</b>. + +</ol> +<p> + Napríklad, Ak Hráč 1 pošle 0 centov Hráčovi 2, + potom Hráč 1 zarobí 1 Euro a Hráč 2 zarobí 0 Eur. + Avšak, Ak Hráč 1 pošle 1 Euro Hráčovi 2, potom 3 Eurá budú poslané Hráčovi 2. + Hráč 2 sa rozhodne vrátiť 1,75 Eura späť Hráčovi 2. + V tomto prípade Hráč 1 zarobí 1,75 Eura a Hráč 2 1,25 Eura. + +</p> +<p> + Prosímm vyplňte nasledujúci formulár obsahujúci Vaše stratégie + ako Hráč 1 alebo ako Hráč 2. +<br> +<b> + Ak máte nejaké otázky. +Prosím zdvihnite Vašu ruku a niekto Vám odpovie na Vaše otázky? +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> + Môžete komunikovať s ostatnými účastníkmi vo Vašej skupine +počas tohto kola. Môžete diskutovať o rôznych aspektoch +experimentu s ostatnými účastníkmi, ale s dvoma výnimkami: + <ol> + <li> + <b> Nesmiete žiadnemu účastníkovi experimentu + slúbiť vyplatenie bočných platieb po skončení + experimentu a ani sa vyhrážať niekomu s rôznymi následkami, + potom ako sa experiment ukončí</b>. + + <li><b>Nesmiete odhaliť svoju identitu.</b></li> +</ol> +<p> + Moniturujeme komunikáciu pokial komunikujete medzi sebou. +Ak odhalíme lubovolné porušenie pravidiel, +potom sme nútení zastaviť experiment a odstrániť +problémovú skupinu z miestnosti a experimentu. + </p> +<p> + Ostatných účastníkov vidíte označených velkými písmenami + abecedy začínajúc od A až po {self.lastChatHandle} v komunikačnom okne. + Môžete poslať odkaz jednoducho vpísaním + obsahu odkazu do textového poľa a stlačením klávesy enter. + </p> +]]> +</entry> +<entry key="same-as-previous-round-instructions"> +<![CDATA[ +<h3>Inštrukcie {self.roundNumber} kola +s</h3> +<hr> +<p> {self.roundNumber} kolo je rovnaké ako predchádzajúce kolo.</p> +<p> Dĺžka tohto kola je {duration}.</p> +<p><b>Máte nejaké otázky? Ak máte nejaké otázky teraz, +prosím zodvihnite ruku a niekto príde k Vášmu počítaču a odpovie Vám.</p> +]]> +</entry> +<entry key='facilitator-debriefing'> +<![CDATA[ +<h3>Inštrukcie {self.roundNumber} kola + </h3> +<hr> +<table border=1 cellspacing=3 cellpadding=3> +<tr> +<th>Účastník + </th><th>Aktuálny stav žetónov</th><th> Aktuálny stav príjmu</th><th>Kvízový zárobok +</th><th>Zárobok z Hry Dôvery</th><th> Celkový príjem</th> +</tr> +{clientDataList: {data | +<tr align="RIGHT"><td>{data.id}</td><td>{data.currentTokens}</td> +<td>{data.currentIncome}</td><td>{data.quizEarnings}</td> +<td>{data.trustGameEarnings}</td><td>{data.grandTotalIncome}</td></tr> +}} +</table> +]]> +</entry> +<entry key='client-debriefing'> +<![CDATA[ +<h1> {if (self.practiceRound)}Skúšobné kolo {else} Kolo {self.roundNumber}{endif} Výsledky + </h1> +<hr> +<ul> + <li> Žetóny zozbierané v tomto kole: {clientData.currentTokens} + </li> + <li>Príjmy zo zozbieraných žetónov: {clientData.currentIncome} + </li> + <li>Zárobok z kvízu: {clientData.quizEarnings} + </li> + <li>Platba za príchod na experiment:{showUpPayment} + </li> +</ul> +{if (showExitInstructions && !clientData.trustGameLog.empty) } +<h2> Zárobky z hry Dôvery + </h2> +<hr> +<ul> +{clientData.trustGameLog: {trustGameLog| +<li>Hra Dôvery #{i}: {trustGameLog}</li> +}} +</ul> + Vaše celkové príjmy z hry Dôvery:<b>{clientData.trustGameEarnings}</b>. +{endif} +<h2> Celkový príjem +</h2> +<hr> +<p> + Váš <b>celkový príjem</b je <b>{clientData.grandTotalIncome}</b>. +</p> +{if (showExitInstructions)} +<h2> Odhlásit sa z prehladu +</h2> +<hr> +<p> +Toto bolo posledné kolo, ale nie koniec experimentu. + Chceli by sme Vás požiadať, aby ste vyplnili krátky dotazník a zatial + pripravíme Vaše nahrané príjmy. +</p> +<h2>Platby +</h2> +<hr> +<p> + Keď budú Vaše platby pripravené, budeme Vás volať po jednom. +Prosím počkajte dokým nieje číslo Vášho počítača +<b>{clientData.id}</b> zavolané, aby ste odvzdali Váš dotazník a + dostali výplatu za hru. + Prosíme Vás odpovedzte na dotazník + pozorne a ďakuejme Vám za účasť na experimente. +</p> +{endif} +]]> +</entry> +</properties> Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: A L. <iss...@bi...> - 2012-04-05 06:58:37
|
--- you can reply above this line --- New issue 47: set up django caching https://bitbucket.org/virtualcommons/vcweb/issue/47/set-up-django-caching A Lee / alllee on Thu, 5 Apr 2012 08:58:31 +0200: https://docs.djangoproject.com/en/dev/topics/cache/ probably go with memcached Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: A L. <iss...@bi...> - 2012-04-05 00:14:04
|
--- you can reply above this line --- New issue 46: create js error reporting endpoint https://bitbucket.org/virtualcommons/vcweb/issue/46/create-js-error-reporting-endpoint A Lee / alllee on Thu, 5 Apr 2012 02:13:58 +0200: Provide a core API endpoint that sends client-side errors to sentry. Parameters: # participant_group_id # error payload (json data?) # anything else? See also https://bitbucket.org/virtualcommons/lighterfootprint/issue/21/client-side-error-logging Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: <ro...@so...> - 2012-04-03 22:26:19
|
A new event has been recorded in Sentry: DoesNotExist: RoundConfiguration matching query does not exist. Details ------- http://vcweb.asu.edu:9000/1/group/11/ Logger: root First Seen: April 3, 2012 Stacktrace ----------- Stacktrace (most recent call last): File "django/core/handlers/base.py", line 178, in get_response signals.got_request_exception.send(sender=self.__class__, request=request) File "django/contrib/auth/decorators.py", line 20, in _wrapped_view return view_func(request, *args, **kwargs) File "vcweb/core/views.py", line 396, in experiment_controller experimenter=experimenter, experiment_action=experiment_action, pk=pk) File "vcweb/core/models.py", line 484, in activate self.allocate_groups() File "vcweb/core/models.py", line 504, in allocate_groups current_group.add_participant(p) File "vcweb/core/models.py", line 1076, in add_participant round_joined=self.experiment.current_round, File "vcweb/core/models.py", line 340, in current_round return self.get_round_configuration(self.current_round_sequence_number) File "vcweb/core/models.py", line 511, in get_round_configuration return self.experiment_configuration.round_configuration_set.get(sequence_number=sequence_number) File "django/db/models/manager.py", line 131, in get return self.get_query_set().get(*args, **kwargs) File "django/db/models/query.py", line 366, in get % self.model._meta.object_name) Http ----------- <table><colgroup><col style="width:60px;"></colgroup><tbody><tr><th>URL:</th><td><a href="http://vcweb.asu.edu/experiment/27/activate">http://vcweb.asu.edu/experiment/27/activate</a></td></tr><tr><th>Method:</th><td>GET</td></tr><tr><th>Query:</th><td><code>''</code></td></tr></tbody></table> |
From: <ro...@so...> - 2012-04-03 22:20:19
|
A new event has been recorded in Sentry: AttributeError: 'Experiment' object has no attribute 'app' Details ------- http://dev.commons.asu.edu:9000/1/group/10/ Logger: root First Seen: April 3, 2012 Stacktrace ----------- Stacktrace (most recent call last): File "django/core/handlers/base.py", line 178, in get_response signals.got_request_exception.send(sender=self.__class__, request=request) File "django/contrib/auth/decorators.py", line 20, in _wrapped_view return view_func(request, *args, **kwargs) File "vcweb/core/views.py", line 395, in experiment_controller experimenter=experimenter, experiment_action=experiment_action, pk=pk) Http ----------- <table><colgroup><col style="width:60px;"></colgroup><tbody><tr><th>URL:</th><td><a href="http://vcweb.asu.edu/experiment/27/activate">http://vcweb.asu.edu/experiment/27/activate</a></td></tr><tr><th>Method:</th><td>GET</td></tr><tr><th>Query:</th><td><code>''</code></td></tr></tbody></table> |
From: A L. <iss...@bi...> - 2012-04-02 05:44:10
|
--- you can reply above this line --- New issue 45: fix account registration experimenter checkbox https://bitbucket.org/virtualcommons/vcweb/issue/45/fix-account-registration-experimenter A Lee / alllee on Mon, 2 Apr 2012 07:44:03 +0200: checking the checkbox should send a request, not set the user up as an experimenter by default. Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: A L. <iss...@bi...> - 2012-03-30 18:48:24
|
--- you can reply above this line --- New issue 44: lighterfootprint: remove self from get_notifications https://bitbucket.org/virtualcommons/vcweb/issue/44/lighterfootprint-remove-self-from A Lee / alllee on Fri, 30 Mar 2012 20:48:18 +0200: Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: virtualcommons <iss...@bi...> - 2012-03-30 18:35:05
|
--- you can reply above this line --- New issue 43: ParticipantExperimentRelationship admin errors https://bitbucket.org/virtualcommons/vcweb/issue/43/participantexperimentrelationship-admin virtualcommons on Fri, 30 Mar 2012 20:34:59 +0200: ParticipantExperimentRelationship.generate_identifier() is causing errors for the generic admin interface Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: A L. <iss...@bi...> - 2012-03-29 04:51:05
|
--- you can reply above this line --- New issue 42: upgrade to socket.io 0.7+ and tornadio2 https://bitbucket.org/virtualcommons/vcweb/issue/42/upgrade-to-socketio-07-and-tornadio2 A Lee / alllee on Thu, 29 Mar 2012 06:50:59 +0200: Description: http://readthedocs.org/docs/tornadio2/en/latest/ Should also check out this gevent based socket.io server- https://bitbucket.org/Jeffrey/gevent-socketio/ Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: A L. <iss...@bi...> - 2012-03-29 00:25:41
|
--- you can reply above this line --- New issue 41: experiment does not exist exception raises a 500 instead of 404 https://bitbucket.org/virtualcommons/vcweb/issue/41/experiment-does-not-exist-exception-raises A Lee / alllee on Thu, 29 Mar 2012 02:25:34 +0200: Description: For example, http://vcweb.asu.edu/experiment/58/monitor can probably fix via get_object_or_404 instead. Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: A L. <iss...@bi...> - 2012-03-28 22:15:03
|
--- you can reply above this line --- New issue 40: set up south for db migrations https://bitbucket.org/virtualcommons/vcweb/issue/40/set-up-south-for-db-migrations A Lee / alllee on Thu, 29 Mar 2012 00:14:56 +0200: Description: http://south.aeracode.org/ Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: Bitbucket <com...@bi...> - 2012-03-28 07:42:29
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/7a3f49195c80/ changeset: 7a3f49195c80 branch: stable user: alllee date: 2012-03-28 09:42:23 summary: merging default back into stable affected #: 34 files diff -r 3c3206f547823a2d2d5694c88666ce85d87cf9c6 -r 7a3f49195c80277e4021aed495010ec1b98f63e0 src/main/java/edu/asu/commons/irrigation/client/Ball.java --- a/src/main/java/edu/asu/commons/irrigation/client/Ball.java +++ b/src/main/java/edu/asu/commons/irrigation/client/Ball.java @@ -3,66 +3,67 @@ import java.util.Random; public class Ball { - - private int size = 3; - - public int x; - - public int y; - - public int moveX; - public int moveY; - - public int xUpperBound; - public int xLowerBound; - public int yUpperBound; - public int yLowerBound; - - //just one global variable speciying the ten potential positions of the balls - private int position; - - public Ball(Random generator){ - - this.x = generator.nextInt(100); - this.y = generator.nextInt(100); - this.xUpperBound = 100; - this.yUpperBound = 100; - this.xLowerBound = 0; - this.yLowerBound = 0; - this.moveX = generator.nextInt(15); - this.moveY = generator.nextInt(10); - /*this.moveX = 3; - this.moveY = 3; - */ - setPosition(0); - } - - public void setPosition(int position) { - this.position = position; - } - public int getBallSize(){ - return size; - } - - public void setX(int x){ - this.x = x; - } - - public void setY(int y){ - this.y = y; - } + private int size = 3; - public int getPosition() { - return position; - } + public int x; - public int getX() { - return x; - } + public int y; - public int getY() { - return y; - } - + public int moveX; + public int moveY; + + public int xUpperBound; + public int xLowerBound; + public int yUpperBound; + public int yLowerBound; + + // just one global variable speciying the ten potential positions of the balls + private int position; + + public Ball(Random generator) { + + this.x = generator.nextInt(100); + this.y = generator.nextInt(100); + this.xUpperBound = 100; + this.yUpperBound = 100; + this.xLowerBound = 0; + this.yLowerBound = 0; + this.moveX = generator.nextInt(15); + this.moveY = generator.nextInt(10); + /* + * this.moveX = 3; + * this.moveY = 3; + */ + setPosition(0); + } + + public void setPosition(int position) { + this.position = position; + } + + public int getBallSize() { + return size; + } + + public void setX(int x) { + this.x = x; + } + + public void setY(int y) { + this.y = y; + } + + public int getPosition() { + return position; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + } \ No newline at end of file diff -r 3c3206f547823a2d2d5694c88666ce85d87cf9c6 -r 7a3f49195c80277e4021aed495010ec1b98f63e0 src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java --- a/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java +++ b/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java @@ -138,8 +138,8 @@ || (particles[i].getPosition() == 3) || (particles[i].getPosition() == 4) || (particles[i].getPosition() == 5)) { - if (!((gates[particles[i].getPosition() - 1].isClosed()) - && particles[i].getY() >= (gates[particles[i].getPosition() - 1].getY() + gates[particles[i].getPosition() - 1].getHeight()))) + if (!((gates[particles[i].getPosition() - 1].isClosed()) + && particles[i].getY() >= (gates[particles[i].getPosition() - 1].getY() + gates[particles[i].getPosition() - 1].getHeight()))) graphics.fillOval(particles[i].x, particles[i].y, particles[i].getBallSize(), particles[i].getBallSize()); } else { @@ -180,10 +180,10 @@ * FIXME: needs major refactoring */ private void updateGates(List<ClientData> sortedClientDataList) { - ClientData thisClientData= clientDataModel.getClientData(); + ClientData thisClientData = clientDataModel.getClientData(); for (int i = 1; i < 6; i++) { if (gates[i - 1].isOpen()) { - if (restrictedVisibility && ! thisClientData.isImmediateNeighbor(sortedClientDataList.get(i-1))) { + if (restrictedVisibility && !thisClientData.isImmediateNeighbor(sortedClientDataList.get(i - 1))) { continue; } if (!(gates[i - 1].getHeight() - gateHeight < 0)) { @@ -203,7 +203,7 @@ // opening gate logic if (gates[i].isOpen()) { - if (restrictedVisibility && ! thisClientData.isImmediateNeighbor(sortedClientDataList.get(i))) { + if (restrictedVisibility && !thisClientData.isImmediateNeighbor(sortedClientDataList.get(i))) { continue; } gates[i].setx1(gates[i].getx2()); @@ -217,7 +217,7 @@ } if (gates[0].isOpen()) { - if (restrictedVisibility && ! thisClientData.isImmediateNeighbor(sortedClientDataList.get(0))) { + if (restrictedVisibility && !thisClientData.isImmediateNeighbor(sortedClientDataList.get(0))) { continue; } gates[0].setx1(gates[0].getx2()); @@ -265,12 +265,12 @@ * This will process the balls according to their position */ private void process(int i, List<ClientData> sortedClients, ClientData thisClientData) { - + switch (particles[i].getPosition()) { case 0: if ((particles[i].x >= (reservoirWidth - gateBuffer) && particles[i].x <= reservoirWidth) - && (particles[i].y >= reservoirHeight - (int) (maximumIrrigationCapacity * canalHeightMultiplier) && particles[i].y <= reservoirHeight)) + && (particles[i].y >= reservoirHeight - (int) (maximumIrrigationCapacity * canalHeightMultiplier) && particles[i].y <= reservoirHeight)) { particles[i].setPosition(1); setBounds(i); @@ -293,12 +293,13 @@ case 1: if (gates[0].isOpen() && (particles[i].x >= gates[0].getOpeningsX() && particles[i].x <= (gates[0].getOpeningsX() + gateBuffer)) - && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) + && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) { - if (restrictedVisibility && sortedClients.get(0).isImmediateNeighbor(thisClientData) || ! restrictedVisibility) + if (restrictedVisibility && sortedClients.get(0).isImmediateNeighbor(thisClientData) || !restrictedVisibility) { - // if we are in the restricted visibility condition AND gate 0 is an immediate neighbor of this client OR we are not in a restricted visibility condition at all, put this ball in the - // gate (or at least I *think* this is what Sanket's god-awful code is doing). + // if we are in the restricted visibility condition AND gate 0 is an immediate neighbor of this client OR we are not in a restricted + // visibility condition at all, put this ball in the + // gate (or at least I *think* this is what Sanket's god-awful code is doing). particles[i].setPosition(7); // directly pass in the information setBounds(i); @@ -321,7 +322,7 @@ if (gates[1].isOpen() && (particles[i].x >= gates[1].getOpeningsX() && particles[i].x <= (gates[1] .getOpeningsX() + gateBuffer)) - && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) + && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) { if (!restrictedVisibility || (restrictedVisibility && sortedClients.get(1).isImmediateNeighbor(thisClientData))) { particles[i].setPosition(8); @@ -329,7 +330,7 @@ setBounds(i); break; } - } + } setBounds(i); if (particles[i].getX() > particles[i].xUpperBound) { particles[i].setPosition(3); @@ -364,10 +365,10 @@ } break; case 4: - if (gates[3].isOpen() + if (gates[3].isOpen() && (particles[i].x >= gates[3].getOpeningsX() && particles[i].x <= (gates[3] .getOpeningsX() + gateBuffer)) - && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) + && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) { if (!restrictedVisibility || (restrictedVisibility && !sortedClients.get(3).isImmediateNeighbor(thisClientData))) { particles[i].setPosition(10); @@ -375,7 +376,7 @@ setBounds(i); break; } - } + } setBounds(i); if (particles[i].getX() > particles[i].xUpperBound) { particles[i].setPosition(5); @@ -390,7 +391,7 @@ if (gates[4].isOpen() && (particles[i].x >= gates[4].getOpeningsX() && particles[i].x <= (gates[4] .getOpeningsX() + gateBuffer)) - && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) + && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) { if (!restrictedVisibility || (restrictedVisibility && !sortedClients.get(4).isImmediateNeighbor(thisClientData))) { particles[i].setPosition(11); @@ -398,7 +399,7 @@ setBounds(i); break; } - } + } setBounds(i); if (particles[i].getX() > particles[i].xUpperBound) { particles[i].setPosition(6); diff -r 3c3206f547823a2d2d5694c88666ce85d87cf9c6 -r 7a3f49195c80277e4021aed495010ec1b98f63e0 src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java --- a/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java +++ b/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java @@ -32,7 +32,7 @@ /** * $Id$ * - * Chat panel used to communicate with other players. + * Chat panel used to communicate with other players. * * FIXME: randomize mappings from handle (e.g., A -> 1, B -> 2, C -> 3 ...) so that it's * not linear. @@ -53,7 +53,7 @@ private TextEntryPanel textEntryPanel; private JEditorPane chatInstructionsPane; - + private JTextField chatField; public ChatPanel(IrrigationClient irrigationClient) { @@ -96,16 +96,16 @@ add(timeLeftPanel, BorderLayout.PAGE_START); add(chatField, BorderLayout.CENTER); -// add(sendButton, BorderLayout.PAGE_END); + // add(sendButton, BorderLayout.PAGE_END); } private void sendMessage() { String message = chatField.getText(); - if (message != null && ! message.isEmpty() && targetIdentifier != null) { + if (message != null && !message.isEmpty() && targetIdentifier != null) { displayMessage(getChatHandle(getClientId()) + " (you): ", message); - chatField.setText(""); - irrigationClient.transmit(new ChatRequest(getClientId(), message, targetIdentifier)); - } + chatField.setText(""); + irrigationClient.transmit(new ChatRequest(getClientId(), message, targetIdentifier)); + } chatField.requestFocusInWindow(); } @@ -120,7 +120,7 @@ private final static String HANDLE_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static String[] HANDLES; - + private Map<Identifier, String> chatHandles = new HashMap<Identifier, String>(); private void addStylesToMessageWindow() { @@ -157,14 +157,14 @@ messageWindow.setEditable(false); messageWindow.setBackground(Color.WHITE); messageScrollPane = new JScrollPane(messageWindow); -// UserInterfaceUtils.addStyles(messageWindow, 16); + // UserInterfaceUtils.addStyles(messageWindow, 16); addStylesToMessageWindow(); textEntryPanel = new TextEntryPanel(); chatInstructionsPane = UserInterfaceUtils.createInstructionsEditorPane(); JScrollPane chatInstructionsScrollPane = new JScrollPane(chatInstructionsPane); add(chatInstructionsScrollPane, BorderLayout.PAGE_START); add(messageScrollPane, BorderLayout.CENTER); -// add(participantButtonPanel, BorderLayout.EAST); + // add(participantButtonPanel, BorderLayout.EAST); add(textEntryPanel, BorderLayout.PAGE_END); addFocusListener(this); messageScrollPane.addFocusListener(this); @@ -181,8 +181,7 @@ document.insertString(0, chatHandle, document.getStyle("bold")); document.insertString(chatHandle.length(), message + "\n", getDefaultStyle()); messageWindow.setCaretPosition(0); - } - catch (BadLocationException e) { + } catch (BadLocationException e) { e.printStackTrace(); } } @@ -199,14 +198,14 @@ chatHandles.put(participants.get(i), HANDLES[i]); } } - + public Identifier getClientId() { - return irrigationClient.getId(); + return irrigationClient.getId(); } - public void setFocusInChatField() { - chatField.requestFocusInWindow(); - } + public void setFocusInChatField() { + chatField.requestFocusInWindow(); + } @Override public void focusGained(FocusEvent e) { diff -r 3c3206f547823a2d2d5694c88666ce85d87cf9c6 -r 7a3f49195c80277e4021aed495010ec1b98f63e0 src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java --- a/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java +++ b/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java @@ -19,18 +19,18 @@ * $Id$ * * The client side data model, simply wraps a GroupDataModel. - * + * * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ */ -public class ClientDataModel implements DataModel<ServerConfiguration, RoundConfiguration> { +public class ClientDataModel implements DataModel<ServerConfiguration, RoundConfiguration> { private static final long serialVersionUID = -3424256672940188027L; private GroupDataModel groupDataModel; - + private IrrigationClient client; - + private ServerConfiguration serverConfiguration; private RoundConfiguration roundConfiguration; private final EventChannel eventChannel; @@ -44,31 +44,31 @@ } public ClientData getClientData() { - return groupDataModel.getClientData( getId() ); + return groupDataModel.getClientData(getId()); } - + public String getPriorityString() { - return getClientData().getPriorityString(); + return getClientData().getPriorityString(); } - + public Identifier getId() { return client.getId(); } - + public List<Identifier> getAllClientIdentifiers() { return new ArrayList<Identifier>(groupDataModel.getAllClientIdentifiers()); } - public synchronized void initialize(RoundStartedEvent event) { + public synchronized void initialize(RoundStartedEvent event) { groupDataModel.clear(); setGroupDataModel(event.getGroupDataModel()); - setTimeLeft( getRoundConfiguration().getRoundDurationInSeconds() ); + setTimeLeft(getRoundConfiguration().getRoundDurationInSeconds()); } - public int getPriority(){ + public int getPriority() { return getClientData().getPriority(); } - + public void update(ClientUpdateEvent clientUpdateEvent) { setGroupDataModel(clientUpdateEvent.getGroupDataModel()); setTimeLeft(clientUpdateEvent.getTimeLeft()); @@ -89,11 +89,11 @@ public void setRoundConfiguration(RoundConfiguration roundConfiguration) { this.roundConfiguration = roundConfiguration; } - + public ServerConfiguration getServerConfiguration() { return serverConfiguration; } - + public void setGroupDataModel(GroupDataModel groupDataModel) { this.groupDataModel = groupDataModel; } @@ -101,15 +101,15 @@ public GroupDataModel getGroupDataModel() { return groupDataModel; } - + public Map<Identifier, ClientData> getClientDataMap() { - Map<Identifier, ClientData> clientDataMap = groupDataModel.getClientDataMap(); + Map<Identifier, ClientData> clientDataMap = groupDataModel.getClientDataMap(); // used by StringTemplate to determine whether or not the ClientData it's rendering values for // is this client. - getClientData().setSelf(true); - return clientDataMap; + getClientData().setSelf(true); + return clientDataMap; } - + public List<ClientData> getClientDataSortedByPriority() { Map<Identifier, ClientData> clientDataMap = getClientDataMap(); ArrayList<ClientData> clientDataList = new ArrayList<ClientData>(clientDataMap.values()); @@ -138,29 +138,28 @@ return serverConfiguration; } - public List<ClientData> getOrderedVisibleClients() { - if (getRoundConfiguration().isRestrictedVisibility()) { - // FIXME: replace hard-coded immediate neighbor check with field of vision radius from RoundConfiguration - ArrayList<ClientData> neighbors = new ArrayList<ClientData>(); - List<ClientData> sortedClients = getClientDataSortedByPriority(); - ClientData thisClientData = getClientData(); - int thisClientIndex = sortedClients.indexOf(thisClientData); - if (thisClientIndex > 0) { - // upstream neighbor - neighbors.add(sortedClients.get(thisClientIndex - 1)); - } - // this is needed for the charts, but probably weird for general-purpose usage - neighbors.add(thisClientData); - if (thisClientIndex < sortedClients.size() - 1) { - // downstream neighbor - neighbors.add(sortedClients.get(thisClientIndex + 1)); - } - return neighbors; - } - else { - return getClientDataSortedByPriority(); - } - } - + public List<ClientData> getOrderedVisibleClients() { + if (getRoundConfiguration().isRestrictedVisibility()) { + // FIXME: replace hard-coded immediate neighbor check with field of vision radius from RoundConfiguration + ArrayList<ClientData> neighbors = new ArrayList<ClientData>(); + List<ClientData> sortedClients = getClientDataSortedByPriority(); + ClientData thisClientData = getClientData(); + int thisClientIndex = sortedClients.indexOf(thisClientData); + if (thisClientIndex > 0) { + // upstream neighbor + neighbors.add(sortedClients.get(thisClientIndex - 1)); + } + // this is needed for the charts, but probably weird for general-purpose usage + neighbors.add(thisClientData); + if (thisClientIndex < sortedClients.size() - 1) { + // downstream neighbor + neighbors.add(sortedClients.get(thisClientIndex + 1)); + } + return neighbors; + } + else { + return getClientDataSortedByPriority(); + } + } } diff -r 3c3206f547823a2d2d5694c88666ce85d87cf9c6 -r 7a3f49195c80277e4021aed495010ec1b98f63e0 src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java --- a/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java +++ b/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java @@ -41,8 +41,8 @@ /** * $Id$ * - * The root experiment window placed in the client's JFrame. - * + * The root experiment window placed in the client's JFrame. + * * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ */ @@ -51,7 +51,7 @@ private static final long serialVersionUID = -5636795631355367711L; private ClientDataModel clientDataModel; - + private ChatPanel chatPanel; private HtmlEditorPane instructionsEditorPane; @@ -64,7 +64,7 @@ private InfrastructureEfficiencyChartPanel infrastructureEfficiencyChartPanel; private IrrigationClient client; - + private GamePanel irrigationGamePanel; private StringBuilder instructionsBuilder = new StringBuilder(); @@ -79,10 +79,10 @@ private TokenContributionChartPanel tokenContributionChartPanel; -// private CanalAnimationPanel canalAnimationPanel; + // private CanalAnimationPanel canalAnimationPanel; private CardLayout cardLayout; - + private JLabel investedTokensLabel; public ExperimentGameWindow(IrrigationClient client) { @@ -90,7 +90,7 @@ this.clientDataModel = client.getClientDataModel(); initialize(); } - + private void initialize() { cardLayout = new CardLayout(); setLayout(cardLayout); @@ -102,7 +102,7 @@ addToCardLayout(getContributionInformationPanel()); setInstructions(getServerConfiguration().getWelcomeInstructions()); } - + private void addToCardLayout(Component component) { add(component, component.getName()); } @@ -149,7 +149,7 @@ instructionsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); instructionsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); instructionsPanel.add(instructionsScrollPane, BorderLayout.CENTER); -// instructionsPanel.add(getQuizNavigationPanel(), BorderLayout.PAGE_END); + // instructionsPanel.add(getQuizNavigationPanel(), BorderLayout.PAGE_END); } return instructionsPanel; } @@ -157,12 +157,12 @@ private ServerConfiguration getServerConfiguration() { return clientDataModel.getServerConfiguration(); } - + private JLabel getInvestedTokensLabel() { if (investedTokensLabel == null) { investedTokensLabel = new JLabel(); } - return investedTokensLabel; + return investedTokensLabel; } private JTextField getInvestedTokensTextField() { @@ -188,12 +188,11 @@ investedTokensLabel.setText(""); setInstructions("Please wait while the server computes your total flow capacity based on your group's total token contribution investment."); addCenterComponent(getInstructionsPanel()); - } + } else { investedTokensLabel.setText("Please enter a number between 0 and 10"); } - } - catch(NumberFormatException e){ + } catch (NumberFormatException e) { investedTokensLabel.setText("Please enter a number between 0 and 10"); } } @@ -245,17 +244,17 @@ private void info(String message) { System.err.println(message); } - + public void showDebriefing(boolean showExitInstructions) { instructionsBuilder.delete(0, instructionsBuilder.length()); instructionsBuilder.append(clientDataModel.getRoundConfiguration().generateClientDebriefing(clientDataModel, showExitInstructions)); setInstructions(instructionsBuilder.toString()); } - + private void setInstructions(String instructions) { instructionsEditorPane.setText(instructions); } - + private void displayInstructions(final String instructions) { SwingUtilities.invokeLater(new Runnable() { public void run() { @@ -264,10 +263,11 @@ } }); } - + private ActionListener createQuizListener(final ServerConfiguration configuration) { return new ActionListener() { private Map<String, String> quizAnswers = configuration.getQuizAnswers(); + public synchronized void actionPerformed(ActionEvent e) { FormActionEvent formEvent = (FormActionEvent) e; Properties actualAnswers = formEvent.getData(); @@ -283,20 +283,20 @@ String correctAnswer = entry.getValue(); String actualAnswer = actualAnswers.getProperty(questionNumber); if (actualAnswer == null || actualAnswer.trim().isEmpty()) { - missingQuestions.add(number); - continue; + missingQuestions.add(number); + continue; } - ((correctAnswer.equals(actualAnswer)) ? correctQuestionNumbers : incorrectQuestionNumbers).add(questionNumber); + ((correctAnswer.equals(actualAnswer)) ? correctQuestionNumbers : incorrectQuestionNumbers).add(questionNumber); } int numberOfMissingQuestions = missingQuestions.size(); if (numberOfMissingQuestions > 0) { - Collections.sort(missingQuestions); - JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for questions " + missingQuestions); - return; + Collections.sort(missingQuestions); + JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for questions " + missingQuestions); + return; } else if (numberOfMissingQuestions == 1) { - JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for question " + missingQuestions.get(0)); - return; + JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for question " + missingQuestions.get(0)); + return; } setQuestionColors(correctQuestionNumbers, "blue"); setQuestionColors(incorrectQuestionNumbers, "red"); @@ -309,7 +309,7 @@ }; } - + private void setQuestionColors(List<String> questionNumbers, String color) { HTMLEditorKit editorKit = (HTMLEditorKit) instructionsEditorPane.getEditorKit(); StyleSheet styleSheet = editorKit.getStyleSheet(); @@ -320,8 +320,8 @@ } public void displayContributionInformation(final ClientData clientData) { - final RoundConfiguration configuration = clientDataModel.getRoundConfiguration(); - final String contributionSummary = configuration.generateContributionSummary(clientData); + final RoundConfiguration configuration = clientDataModel.getRoundConfiguration(); + final String contributionSummary = configuration.generateContributionSummary(clientData); SwingUtilities.invokeLater(new Runnable() { public void run() { contributionInformationEditorPane.setText(contributionSummary); @@ -332,7 +332,7 @@ }); irrigationGamePanel.setClientDataModel(clientDataModel); } - + public JPanel getContributionInformationPanel() { if (contributionInformationPanel == null) { contributionInformationPanel = new JPanel(); @@ -359,7 +359,6 @@ return panel; } - public void showTokenInvestmentScreen() { Runnable runnable = new Runnable() { public void run() { @@ -374,7 +373,7 @@ public void updateRoundInstructions() { RoundConfiguration roundConfiguration = clientDataModel.getRoundConfiguration(); - if (! roundConfiguration.isFirstRound()) { + if (!roundConfiguration.isFirstRound()) { instructionsBuilder.append(roundConfiguration.generateUpdatedInstructions(clientDataModel)); displayInstructions(instructionsBuilder.toString()); } @@ -393,13 +392,14 @@ public void run() { startTimer(getServerConfiguration().getChatDuration() * 1000L); chatPanel.initialize(clientDataModel.getAllClientIdentifiers()); - addCenterComponent( chatPanel ); + addCenterComponent(chatPanel); chatPanel.setFocusInChatField(); } }); } private Timer timer; + private void startTimer(final long waitTime) { final long endTime = waitTime + System.currentTimeMillis(); if (timer == null) { @@ -407,9 +407,9 @@ public void actionPerformed(ActionEvent event) { final long timeRemaining = endTime - System.currentTimeMillis(); if (timeRemaining < 0) { - showTokenInvestmentScreen(); + showTokenInvestmentScreen(); getInvestedTokensTextField().requestFocusInWindow(); -// chatPanel.displayMessage("", "---- chat round ending ----"); + // chatPanel.displayMessage("", "---- chat round ending ----"); timer.stop(); timer = null; } @@ -421,7 +421,7 @@ timer.start(); } } - + public void showQuiz() { SwingUtilities.invokeLater(new Runnable() { public void run() { @@ -430,20 +430,20 @@ } }); } - + public void showGameScreenshot() { displayInstructions(getServerConfiguration().getGameScreenshotInstructions()); } - /** + /** * Invoked when the show instructions button is pressed. */ public void showInstructions() { - if (clientDataModel == null || clientDataModel.getRoundConfiguration().isFirstRound()) { - displayInstructions(getServerConfiguration().getInitialInstructions()); - } - else { - displayInstructions(clientDataModel.getRoundConfiguration().getInstructions()); - } + if (clientDataModel == null || clientDataModel.getRoundConfiguration().isFirstRound()) { + displayInstructions(getServerConfiguration().getInitialInstructions()); + } + else { + displayInstructions(clientDataModel.getRoundConfiguration().getInstructions()); + } } } diff -r 3c3206f547823a2d2d5694c88666ce85d87cf9c6 -r 7a3f49195c80277e4021aed495010ec1b98f63e0 src/main/java/edu/asu/commons/irrigation/client/GamePanel.java --- a/src/main/java/edu/asu/commons/irrigation/client/GamePanel.java +++ b/src/main/java/edu/asu/commons/irrigation/client/GamePanel.java @@ -27,10 +27,11 @@ import edu.asu.commons.irrigation.conf.ServerConfiguration; import edu.asu.commons.irrigation.model.ClientData; + /** * $Id$ * - * Primary in-round game interface window for the irrigation game + * Primary in-round game interface window for the irrigation game * * FIXME: refactor layout, currently a hodge podge of fixed sizes * @@ -41,335 +42,340 @@ private static final long serialVersionUID = 5900368694556557132L; - private CanalPanel canalPanel; + private CanalPanel canalPanel; - private JPanel jPanelMain = null; - //this contains the CanalPanel - private JPanel centerPanel = null; - //this contains the upstream and downstream Panel - private JPanel jPanelUpStreamWindow = null; - private JPanel jPanelDownStreamWindow = null; - private JPanel mainInterfacePanel = null; + private JPanel jPanelMain = null; + // this contains the CanalPanel + private JPanel centerPanel = null; + // this contains the upstream and downstream Panel + private JPanel jPanelUpStreamWindow = null; + private JPanel jPanelDownStreamWindow = null; + private JPanel mainInterfacePanel = null; - private IrrigationClient client; + private IrrigationClient client; - private JProgressBar timeLeftProgressBar; + private JProgressBar timeLeftProgressBar; - private ClientDataModel clientDataModel; // @jve:decl-index=0: + private ClientDataModel clientDataModel; // @jve:decl-index=0: - private MiddleWindowPanel middleWindowPanel; + private MiddleWindowPanel middleWindowPanel; - private JLabel gateSwitchLabel = null; + private JLabel gateSwitchLabel = null; - private JLabel scoreBoardLabel = null; + private JLabel scoreBoardLabel = null; - private JButton gateSwitchButton; + private JButton gateSwitchButton; - private boolean open; + private boolean open; -// private JTextField waterCollectedTextField; -// private JLabel waterCollectedLabel; -// private JTextField tokensNotInvestedTextField; -// private JLabel tokensNotInvestedLabel; -// private JTextField tokensEarnedTextField; -// private JLabel tokensEarnedLabel; -// private JTextField totalTokensEarnedTextField; -// private JLabel totalTokensEarnedLabel; - - private JLabel irrigationCapacityLabel; - private JLabel waterSupplyLabel; + // private JTextField waterCollectedTextField; + // private JLabel waterCollectedLabel; + // private JTextField tokensNotInvestedTextField; + // private JLabel tokensNotInvestedLabel; + // private JTextField tokensEarnedTextField; + // private JLabel tokensEarnedLabel; + // private JTextField totalTokensEarnedTextField; + // private JLabel totalTokensEarnedLabel; - private JTextField irrigationCapacityTextField; - private JTextField waterSupplyTextField; + private JLabel irrigationCapacityLabel; + private JLabel waterSupplyLabel; - public GamePanel(IrrigationClient client) { - super(); - this.client = client; - setName("main irrigation game window"); - initGuiComponents(); - } + private JTextField irrigationCapacityTextField; + private JTextField waterSupplyTextField; - private void initGuiComponents() { - this.setLayout(new BorderLayout(4,4)); - this.setSize(1130, 558); - this.add(getPanel(),null); + public GamePanel(IrrigationClient client) { + super(); + this.client = client; + setName("main irrigation game window"); + initGuiComponents(); + } - } + private void initGuiComponents() { + this.setLayout(new BorderLayout(4, 4)); + this.setSize(1130, 558); + this.add(getPanel(), null); - private JPanel getPanel() { - if(jPanelMain == null){ - jPanelMain = new JPanel(); - jPanelMain.setLayout(new BorderLayout(4,4)); - jPanelMain.setBackground(Color.WHITE); - jPanelMain.setForeground(Color.BLACK); - JPanel upperPanel = new JPanel(); - upperPanel.setLayout(new BoxLayout(upperPanel, BoxLayout.X_AXIS)); - upperPanel.add(getIrrigationCapacityLabel()); - upperPanel.add(Box.createHorizontalGlue()); - upperPanel.add(getWaterSupplyLabel()); - jPanelMain.add(upperPanel, BorderLayout.NORTH); - jPanelMain.add(getMainInterfacePanel(), BorderLayout.CENTER); - return jPanelMain; - } - return jPanelMain; - } + } - private JPanel getMainInterfacePanel() { - if(mainInterfacePanel == null){ - scoreBoardLabel = new JLabel(""); - scoreBoardLabel.setBounds(new Rectangle(582,225+100+35,530,20)); - scoreBoardLabel.setHorizontalAlignment(SwingConstants.CENTER); - gateSwitchLabel = new JLabel(""); - gateSwitchLabel.setBounds(new Rectangle(13,225+100+35,530,20)); - gateSwitchLabel.setHorizontalAlignment(SwingConstants.CENTER); - mainInterfacePanel = new JPanel(); - mainInterfacePanel.setLayout(null); - mainInterfacePanel.setName("Main interface panel"); - mainInterfacePanel.setBackground(Color.WHITE); - mainInterfacePanel.add(getCenterPanel(),null); - mainInterfacePanel.add(getTimeLeftProgressBar(), null); - mainInterfacePanel.add(gateSwitchLabel, null); - mainInterfacePanel.add(scoreBoardLabel, null); - } - return mainInterfacePanel; - } + private JPanel getPanel() { + if (jPanelMain == null) { + jPanelMain = new JPanel(); + jPanelMain.setLayout(new BorderLayout(4, 4)); + jPanelMain.setBackground(Color.WHITE); + jPanelMain.setForeground(Color.BLACK); + JPanel upperPanel = new JPanel(); + upperPanel.setLayout(new BoxLayout(upperPanel, BoxLayout.X_AXIS)); + upperPanel.add(getIrrigationCapacityLabel()); + upperPanel.add(Box.createHorizontalGlue()); + upperPanel.add(getWaterSupplyLabel()); + jPanelMain.add(upperPanel, BorderLayout.NORTH); + jPanelMain.add(getMainInterfacePanel(), BorderLayout.CENTER); + return jPanelMain; + } + return jPanelMain; + } - private JProgressBar getTimeLeftProgressBar() { - if (timeLeftProgressBar == null) { - timeLeftProgressBar = new JProgressBar(0, 50); - timeLeftProgressBar.setBounds(new Rectangle(360, 15, 370, 17)); - timeLeftProgressBar.setStringPainted(true); - } - return timeLeftProgressBar; - } - /** - * This method initializes jPanel - * - * @return javax.swing.JPanel - */ - private JPanel getCenterPanel() { - if (centerPanel == null) { - centerPanel = new JPanel(); - centerPanel.setLayout(null); - centerPanel.setBounds(new Rectangle(13, 64, 1098, 123)); - } - return centerPanel; - } + private JPanel getMainInterfacePanel() { + if (mainInterfacePanel == null) { + scoreBoardLabel = new JLabel(""); + scoreBoardLabel.setBounds(new Rectangle(582, 225 + 100 + 35, 530, 20)); + scoreBoardLabel.setHorizontalAlignment(SwingConstants.CENTER); + gateSwitchLabel = new JLabel(""); + gateSwitchLabel.setBounds(new Rectangle(13, 225 + 100 + 35, 530, 20)); + gateSwitchLabel.setHorizontalAlignment(SwingConstants.CENTER); + mainInterfacePanel = new JPanel(); + mainInterfacePanel.setLayout(null); + mainInterfacePanel.setName("Main interface panel"); + mainInterfacePanel.setBackground(Color.WHITE); + mainInterfacePanel.add(getCenterPanel(), null); + mainInterfacePanel.add(getTimeLeftProgressBar(), null); + mainInterfacePanel.add(gateSwitchLabel, null); + mainInterfacePanel.add(scoreBoardLabel, null); + } + return mainInterfacePanel; + } - private JPanel getCanalPanel(ClientDataModel clientDataModel) { - if (canalPanel == null) { - canalPanel = new CanalPanel(clientDataModel); - canalPanel.setSize(new Dimension(1098, 123)); - } - else { - canalPanel.setClientDataModel(clientDataModel); - } - return canalPanel; - } + private JProgressBar getTimeLeftProgressBar() { + if (timeLeftProgressBar == null) { + timeLeftProgressBar = new JProgressBar(0, 50); + timeLeftProgressBar.setBounds(new Rectangle(360, 15, 370, 17)); + timeLeftProgressBar.setStringPainted(true); + } + return timeLeftProgressBar; + } - /** - * This method initializes jPanel1 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelUpStreamWindow() { - if (jPanelUpStreamWindow == null) { - jPanelUpStreamWindow = new JPanel(); - jPanelUpStreamWindow.setLayout(new BorderLayout()); - jPanelUpStreamWindow.setBackground(new Color(186, 226, 237)); - jPanelUpStreamWindow.setBounds(new Rectangle(13, 225+100+50, 530, 326)); - jPanelUpStreamWindow.add(getGateSwitchButton(), BorderLayout.CENTER); -// jPanelUpStreamWindow.add(getControlPanel(), BorderLayout.SOUTH); - } - return jPanelUpStreamWindow; - } - private final static String OPEN_GATE_LABEL = "OPEN YOUR GATE"; - private final static String CLOSE_GATE_LABEL = "CLOSE YOUR GATE"; - private JButton getGateSwitchButton() { - if (gateSwitchButton == null) { - gateSwitchButton = new JButton(OPEN_GATE_LABEL); - gateSwitchButton.setFont(new Font("sansserif", Font.TRUETYPE_FONT, 18)); - gateSwitchButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - open = !open; - if (open) { - client.openGate(); - gateSwitchButton.setText(CLOSE_GATE_LABEL); - } - else { - client.closeGate(); - gateSwitchButton.setText(OPEN_GATE_LABEL); - } - } - }); - } - return gateSwitchButton; - } - + /** + * This method initializes jPanel + * + * @return javax.swing.JPanel + */ + private JPanel getCenterPanel() { + if (centerPanel == null) { + centerPanel = new JPanel(); + centerPanel.setLayout(null); + centerPanel.setBounds(new Rectangle(13, 64, 1098, 123)); + } + return centerPanel; + } -// private JPanel getControlPanel() { -// JPanel bottomInformationPanel = new JPanel(); -// GroupLayout layout = new GroupLayout(bottomInformationPanel); -// bottomInformationPanel.setLayout(layout); -// layout.setAutoCreateContainerGaps(true); -// layout.setAutoCreateGaps(true); -// -// GroupLayout.SequentialGroup horizontalGroup = layout.createSequentialGroup(); -// ParallelGroup labelsGroup = layout.createParallelGroup(); -// labelsGroup.addComponent(getWaterCollectedLabel()).addComponent(getTokensNotInvestedLabel()).addComponent(getTokensEarnedLabel()).addComponent(getTotalTokensEarnedLabel()); -// -// horizontalGroup.addGroup(labelsGroup); -// -// ParallelGroup textFieldGroup = layout.createParallelGroup(); -// textFieldGroup.addComponent(getWaterCollectedTextField()); -// textFieldGroup.addComponent(getTokensNotInvestedTextField()); -// textFieldGroup.addComponent(getTokensEarnedTextField()); -// textFieldGroup.addComponent(getTotalTokensEarnedTextField()); -// horizontalGroup.addGroup(textFieldGroup); -// layout.setHorizontalGroup(horizontalGroup); -// -// GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup(); -// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) -// .addComponent(getWaterCollectedLabel()).addComponent(getWaterCollectedTextField())); -// -// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) -// .addComponent(getTokensNotInvestedLabel()).addComponent(getTokensNotInvestedTextField())); -// -// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) -// .addComponent(getTokensEarnedLabel()).addComponent(getTokensEarnedTextField())); -// -// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) -// .addComponent(getTotalTokensEarnedLabel()).addComponent(getTotalTokensEarnedTextField())); -// -// layout.setVerticalGroup(verticalGroup); -// return bottomInformationPanel; -// } + private JPanel getCanalPanel(ClientDataModel clientDataModel) { + if (canalPanel == null) { + canalPanel = new CanalPanel(clientDataModel); + canalPanel.setSize(new Dimension(1098, 123)); + } + else { + canalPanel.setClientDataModel(clientDataModel); + } + return canalPanel; + } + + /** + * This method initializes jPanel1 + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelUpStreamWindow() { + if (jPanelUpStreamWindow == null) { + jPanelUpStreamWindow = new JPanel(); + jPanelUpStreamWindow.setLayout(new BorderLayout()); + jPanelUpStreamWindow.setBackground(new Color(186, 226, 237)); + jPanelUpStreamWindow.setBounds(new Rectangle(13, 225 + 100 + 50, 530, 326)); + jPanelUpStreamWindow.add(getGateSwitchButton(), BorderLayout.CENTER); + // jPanelUpStreamWindow.add(getControlPanel(), BorderLayout.SOUTH); + } + return jPanelUpStreamWindow; + } + + private final static String OPEN_GATE_LABEL = "OPEN YOUR GATE"; + private final static String CLOSE_GATE_LABEL = "CLOSE YOUR GATE"; + + private JButton getGateSwitchButton() { + if (gateSwitchButton == null) { + gateSwitchButton = new JButton(OPEN_GATE_LABEL); + gateSwitchButton.setFont(new Font("sansserif", Font.TRUETYPE_FONT, 18)); + gateSwitchButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + open = !open; + if (open) { + client.openGate(); + gateSwitchButton.setText(CLOSE_GATE_LABEL); + } + else { + client.closeGate(); + gateSwitchButton.setText(OPEN_GATE_LABEL); + } + } + }); + } + return gateSwitchButton; + } + + // private JPanel getControlPanel() { + // JPanel bottomInformationPanel = new JPanel(); + // GroupLayout layout = new GroupLayout(bottomInformationPanel); + // bottomInformationPanel.setLayout(layout); + // layout.setAutoCreateContainerGaps(true); + // layout.setAutoCreateGaps(true); + // + // GroupLayout.SequentialGroup horizontalGroup = layout.createSequentialGroup(); + // ParallelGroup labelsGroup = layout.createParallelGroup(); + // labelsGroup.addComponent(getWaterCollectedLabel()).addComponent(getTokensNotInvestedLabel()).addComponent(getTokensEarnedLabel()).addComponent(getTotalTokensEarnedLabel()); + // + // horizontalGroup.addGroup(labelsGroup); + // + // ParallelGroup textFieldGroup = layout.createParallelGroup(); + // textFieldGroup.addComponent(getWaterCollectedTextField()); + // textFieldGroup.addComponent(getTokensNotInvestedTextField()); + // textFieldGroup.addComponent(getTokensEarnedTextField()); + // textFieldGroup.addComponent(getTotalTokensEarnedTextField()); + // horizontalGroup.addGroup(textFieldGroup); + // layout.setHorizontalGroup(horizontalGroup); + // + // GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup(); + // verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) + // .addComponent(getWaterCollectedLabel()).addComponent(getWaterCollectedTextField())); + // + // verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) + // .addComponent(getTokensNotInvestedLabel()).addComponent(getTokensNotInvestedTextField())); + // + // verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) + // .addComponent(getTokensEarnedLabel()).addComponent(getTokensEarnedTextField())); + // + // verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) + // .addComponent(getTotalTokensEarnedLabel()).addComponent(getTotalTokensEarnedTextField())); + // + // layout.setVerticalGroup(verticalGroup); + // return bottomInformationPanel; + // } private JTextField createTextField() { JTextField textField = new JTextField(); textField.setEditable(false); -// textField.setBackground(Color.LIGHT_GRAY); + // textField.setBackground(Color.LIGHT_GRAY); textField.setBackground(Color.YELLOW); return textField; - } - -// private JTextField getWaterCollectedTextField() { -// if (waterCollectedTextField == null) { -// waterCollectedTextField = createTextField(); -// } -// return waterCollectedTextField; -// } -// -// -// -// private JLabel getWaterCollectedLabel() { -// if (waterCollectedLabel == null) { -// waterCollectedLabel = new JLabel("Total water applied to your field: "); -// } -// return waterCollectedLabel; -// } -// -// private JTextField getTokensNotInvestedTextField() { -// if (tokensNotInvestedTextField == null) { -// tokensNotInvestedTextField = createTextField(); -// } -// return tokensNotInvestedTextField; -// } -// private JLabel getTokensNotInvestedLabel() { -// if (tokensNotInvestedLabel == null) { -// tokensNotInvestedLabel = new JLabel("Tokens not invested: "); -// } -// return tokensNotInvestedLabel; -// } -// -// private JTextField getTokensEarnedTextField() { -// if (tokensEarnedTextField == null) { -// tokensEarnedTextField = createTextField(); -// } -// return tokensEarnedTextField; -// } -// private JLabel getTokensEarnedLabel() { -// if (tokensEarnedLabel == null) { -// tokensEarnedLabel = new JLabel("Tokens earned by crop production: "); -// } -// return tokensEarnedLabel; -// } -// -// private JTextField getTotalTokensEarnedTextField() { -// if (totalTokensEarnedTextField == null) { -// totalTokensEarnedTextField = createTextField(); -// } -// return totalTokensEarnedTextField; -// -// } -// -// private JLabel getTotalTokensEarnedLabel() { -// if (totalTokensEarnedLabel == null) { -// totalTokensEarnedLabel = new JLabel("Total tokens earned this round: "); -// } -// return totalTokensEarnedLabel; -// } - - private JLabel getIrrigationCapacityLabel() { - if (irrigationCapacityLabel == null) { - irrigationCapacityLabel = new JLabel(); - irrigationCapacityLabel.setLabelFor(getIrrigationCapacityTextField()); - irrigationCapacityLabel.setFont(new Font("sansserif", Font.BOLD, 16)); - } - return irrigationCapacityLabel; - } + } - private JTextField getIrrigationCapacityTextField() { - if (irrigationCapacityTextField == null) { - irrigationCapacityTextField = createTextField(); - } - return irrigationCapacityTextField; - } - - private JLabel getWaterSupplyLabel() { - if (waterSupplyLabel == null) { - waterSupplyLabel = new JLabel("Water supply: "); - waterSupplyLabel.setLabelFor(getWaterSupplyTextField()); - waterSupplyLabel.setFont(new Font("sansserif", Font.BOLD, 16)); - } - return waterSupplyLabel; - } - private JTextField getWaterSupplyTextField() { - if (waterSupplyTextField == null) { - waterSupplyTextField = createTextField(); - } - return waterSupplyTextField; - } - /** - * This method initializes jPanel3 - * summary scoreboard - * @return javax.swing.JPanel - */ - private JPanel getJPanelDownStreamWindow() { - if (jPanelDownStreamWindow == null) { - jPanelDownStreamWindow = new JPanel(); - jPanelDownStreamWindow.setLayout(new BorderLayout()); - jPanelDownStreamWindow.setBackground(new Color(186, 226, 237)); - jPanelDownStreamWindow.setBounds(new Rectangle(582, 225 + 100+50, 530, 326)); - jPanelDownStreamWindow.add(getWaterCollectedToTokensTable(),BorderLayout.CENTER); - } - return jPanelDownStreamWindow; - } - - private XYSeries currentWaterAppliedSeries = new XYSeries("Current water applied"); + // private JTextField getWaterCollectedTextField() { + // if (waterCollectedTextField == null) { + // waterCollectedTextField = createTextField(); + // } + // return waterCollectedTextField; + // } + // + // + // + // private JLabel getWaterCollectedLabel() { + // if (waterCollectedLabel == null) { + // waterCollectedLabel = new JLabel("Total water applied to your field: "); + // } + // return waterCollectedLabel; + // } + // + // private JTextField getTokensNotInvestedTextField() { + // if (tokensNotInvestedTextField == null) { + // tokensNotInvestedTextField = createTextField(); + // } + // return tokensNotInvestedTextField; + // } + // private JLabel getTokensNotInvestedLabel() { + // if (tokensNotInvestedLabel == null) { + // tokensNotInvestedLabel = new JLabel("Tokens not invested: "); + // } + // return tokensNotInvestedLabel; + // } + // + // private JTextField getTokensEarnedTextField() { + // if (tokensEarnedTextField == null) { + // tokensEarnedTextField = createTextField(); + // } + // return tokensEarnedTextField; + // } + // private JLabel getTokensEarnedLabel() { + // if (tokensEarnedLabel == null) { + // tokensEarnedLabel = new JLabel("Tokens earned by crop production: "); + // } + // return tokensEarnedLabel; + // } + // + // private JTextField getTotalTokensEarnedTextField() { + // if (totalTokensEarnedTextField == null) { + // totalTokensEarnedTextField = createTextField(); + // } + // return totalTokensEarnedTextField; + // + // } + // + // private JLabel getTotalTokensEarnedLabel() { + // if (totalTokensEarnedLabel == null) { + // totalTokensEarnedLabel = new JLabel("Total tokens earned this round: "); + // } + // return totalTokensEarnedLabel; + // } - private ChartPanel getWaterCollectedToTokensTable() { + private JLabel getIrrigationCapacityLabel() { + if (irrigationCapacityLabel == null) { + irrigationCapacityLabel = new JLabel(); + irrigationCapacityLabel.setLabelFor(getIrrigationCapacityTextField()); + irrigationCapacityLabel.setFont(new Font("sansserif", Font.BOLD, 16)); + } + return irrigationCapacityLabel; + } + + private JTextField getIrrigationCapacityTextField() { + if (irrigationCapacityTextField == null) { + irrigationCapacityTextField = createTextField(); + } + return irrigationCapacityTextField; + } + + private JLabel getWaterSupplyLabel() { + if (waterSupplyLabel == null) { + waterSupplyLabel = new JLabel("Water supply: "); + waterSupplyLabel.setLabelFor(getWaterSupplyTextField()); + waterSupplyLabel.setFont(new Font("sansserif", Font.BOLD, 16)); + } + return waterSupplyLabel; + } + + private JTextField getWaterSupplyTextField() { + if (waterSupplyTextField == null) { + waterSupplyTextField = createTextField(); + } + return waterSupplyTextField; + } + + /** + * This method initializes jPanel3 + * summary scoreboard + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelDownStreamWindow() { + if (jPanelDownStreamWindow == null) { + jPanelDownStreamWindow = new JPanel(); + jPanelDownStreamWindow.setLayout(new BorderLayout()); + jPanelDownStreamWindow.setBackground(new Color(186, 226, 237)); + jPanelDownStreamWindow.setBounds(new Rectangle(582, 225 + 100 + 50, 530, 326)); + jPanelDownStreamWindow.add(getWaterCollectedToTokensTable(), BorderLayout.CENTER); + } + return jPanelDownStreamWindow; + } + + private XYSeries currentWaterAppliedSeries = new XYSeries("Current water applied"); + + private ChartPanel getWaterCollectedToTokensTable() { final XYSeries tokensEarnedSeries = new XYSeries("Tokens earned from water applied"); - + for (int waterApplied = 0; waterApplied < 1000; waterApplied++) { - int tokensEarned = ServerConfiguration.getTokensEarned(waterApplied); - tokensEarnedSeries.add(waterApplied, tokensEarned); + int tokensEarned = ServerConfiguration.getTokensEarned(waterApplied); + tokensEarnedSeries.add(waterApplied, tokensEarned); } - + XYSeriesCollection data = new XYSeriesCollection(); data.addSeries(tokensEarnedSeries); data.addSeries(currentWaterAppliedSeries); - JFreeChart chart = ChartFactory.createXYLineChart( + JFreeChart chart = ChartFactory.createXYLineChart( "Water applied to tokens earned", "Cubic feet of water applied to your field", "Tokens earned", @@ -378,104 +384,104 @@ true, true, false - ); - chart.setAntiAlias(true); - return new ChartPanel(chart); - } + ); + chart.setAntiAlias(true); + return new ChartPanel(chart); + } - /** - * Should be invoked every second throughout the experiment, from a ClientUpdateEvent sent by the server. - */ - public void updateClientStatus(final ClientDataModel clientDataModel) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - int timeLeft = clientDataModel.getTimeLeft(); - String timeLeftString = String.format("%d sec", timeLeft); - timeLeftProgressBar.setValue( timeLeft ); - timeLeftProgressBar.setString(timeLeftString); - // FIXME: figure out how to reliably set the progress bar colors regardless of OS. -// setProgressBarColor(timeLeft); - // only show open gates for immediately neighboring clients. - boolean restrictedVisibility = clientDataModel.getRoundConfiguration().isRestrictedVisibility(); - final ClientData thisClientData = clientDataModel.getClientData(); + /** + * Should be invoked every second throughout the experiment, from a ClientUpdateEvent sent by the server. + */ + public void updateClientStatus(final ClientDataModel clientDataModel) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + int timeLeft = clientDataModel.getTimeLeft(); + String timeLeftString = String.format("%d sec", timeLeft); + timeLeftProgressBar.setValue(timeLeft); + timeLeftProgressBar.setString(timeLeftString); + // FIXME: figure out how to reliably set the progress bar colors regardless of OS. + // setProgressBarColor(timeLeft); + // only show open gates for immediately neighboring clients. + boolean restrictedVisibility = clientDataModel.getRoundConfiguration().isRestrictedVisibility(); + final ClientData thisClientData = clientDataModel.getClientData(); - for (final ClientData clientData : clientDataModel.getClientDataMap().values()) { - if (clientData.isGateOpen()) { - if (restrictedVisibility && ! thisClientData.isImmediateNeighbor(clientData)) { - continue; - } - canalPanel.openGate(clientData.getPriority()); - } - else { - canalPanel.closeGate(clientData.getPriority()); - } - } - ClientData clientData = clientDataModel.getClientData(); -// getWaterCollectedTextField().setText("" + clientData.getWaterCollected()); -// getTokensNotInvestedTextField().setText("" + clientData.getUninvestedTokens()); -// getTokensEarnedTextField().setText("" + clientData.getTokensEarnedFromWaterCollected()); -// getTotalTokensEarnedTextField().setText("" + clientData.getAllTokensEarnedThisRound()); - getMiddleWindowPanel().update(clientDataModel); - - currentWaterAppliedSeries.clear(); - for (int i = 0; i <= clientData.getTokensEarnedFromWaterCollected(); i++) { - currentWaterAppliedSeries.add(clientData.getWaterCollected(), i); - } - } + for (final ClientData clientData : clientDataModel.getClientDataMap().values()) { + if (clientData.isGateOpen()) { + if (restrictedVisibility && !thisClientData.isImmediateNeighbor(clientData)) { + continue; + } + canalPanel.openGate(clientData.getPriority()); + } + else { + canalPanel.closeGate(clientData.getPriority()); + } + } + ClientData clientData = clientDataModel.getClientData(); + // getWaterCollectedTextField().setText("" + clientData.getWaterCollected()); + // getTokensNotInvestedTextField().setText("" + clientData.getUninvestedTokens()); + // getTokensEarnedTextField().setText("" + clientData.getTokensEarnedFromWaterCollected()); + // getTotalTokensEarnedTextFie... [truncated message content] |
From: Bitbucket <com...@bi...> - 2012-03-28 06:54:58
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/e5ca3f6531ad/ changeset: e5ca3f6531ad user: alllee date: 2012-03-28 08:54:35 summary: organize imports + formatting affected #: 34 files diff -r 4ea2f146b01c7d00a451884fdcdeabb43627836f -r e5ca3f6531adb3c270830bc97289560c5d2af71b src/main/java/edu/asu/commons/irrigation/client/Ball.java --- a/src/main/java/edu/asu/commons/irrigation/client/Ball.java +++ b/src/main/java/edu/asu/commons/irrigation/client/Ball.java @@ -3,66 +3,67 @@ import java.util.Random; public class Ball { - - private int size = 3; - - public int x; - - public int y; - - public int moveX; - public int moveY; - - public int xUpperBound; - public int xLowerBound; - public int yUpperBound; - public int yLowerBound; - - //just one global variable speciying the ten potential positions of the balls - private int position; - - public Ball(Random generator){ - - this.x = generator.nextInt(100); - this.y = generator.nextInt(100); - this.xUpperBound = 100; - this.yUpperBound = 100; - this.xLowerBound = 0; - this.yLowerBound = 0; - this.moveX = generator.nextInt(15); - this.moveY = generator.nextInt(10); - /*this.moveX = 3; - this.moveY = 3; - */ - setPosition(0); - } - - public void setPosition(int position) { - this.position = position; - } - public int getBallSize(){ - return size; - } - - public void setX(int x){ - this.x = x; - } - - public void setY(int y){ - this.y = y; - } + private int size = 3; - public int getPosition() { - return position; - } + public int x; - public int getX() { - return x; - } + public int y; - public int getY() { - return y; - } - + public int moveX; + public int moveY; + + public int xUpperBound; + public int xLowerBound; + public int yUpperBound; + public int yLowerBound; + + // just one global variable speciying the ten potential positions of the balls + private int position; + + public Ball(Random generator) { + + this.x = generator.nextInt(100); + this.y = generator.nextInt(100); + this.xUpperBound = 100; + this.yUpperBound = 100; + this.xLowerBound = 0; + this.yLowerBound = 0; + this.moveX = generator.nextInt(15); + this.moveY = generator.nextInt(10); + /* + * this.moveX = 3; + * this.moveY = 3; + */ + setPosition(0); + } + + public void setPosition(int position) { + this.position = position; + } + + public int getBallSize() { + return size; + } + + public void setX(int x) { + this.x = x; + } + + public void setY(int y) { + this.y = y; + } + + public int getPosition() { + return position; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + } \ No newline at end of file diff -r 4ea2f146b01c7d00a451884fdcdeabb43627836f -r e5ca3f6531adb3c270830bc97289560c5d2af71b src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java --- a/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java +++ b/src/main/java/edu/asu/commons/irrigation/client/CanalPanel.java @@ -138,8 +138,8 @@ || (particles[i].getPosition() == 3) || (particles[i].getPosition() == 4) || (particles[i].getPosition() == 5)) { - if (!((gates[particles[i].getPosition() - 1].isClosed()) - && particles[i].getY() >= (gates[particles[i].getPosition() - 1].getY() + gates[particles[i].getPosition() - 1].getHeight()))) + if (!((gates[particles[i].getPosition() - 1].isClosed()) + && particles[i].getY() >= (gates[particles[i].getPosition() - 1].getY() + gates[particles[i].getPosition() - 1].getHeight()))) graphics.fillOval(particles[i].x, particles[i].y, particles[i].getBallSize(), particles[i].getBallSize()); } else { @@ -180,10 +180,10 @@ * FIXME: needs major refactoring */ private void updateGates(List<ClientData> sortedClientDataList) { - ClientData thisClientData= clientDataModel.getClientData(); + ClientData thisClientData = clientDataModel.getClientData(); for (int i = 1; i < 6; i++) { if (gates[i - 1].isOpen()) { - if (restrictedVisibility && ! thisClientData.isImmediateNeighbor(sortedClientDataList.get(i-1))) { + if (restrictedVisibility && !thisClientData.isImmediateNeighbor(sortedClientDataList.get(i - 1))) { continue; } if (!(gates[i - 1].getHeight() - gateHeight < 0)) { @@ -203,7 +203,7 @@ // opening gate logic if (gates[i].isOpen()) { - if (restrictedVisibility && ! thisClientData.isImmediateNeighbor(sortedClientDataList.get(i))) { + if (restrictedVisibility && !thisClientData.isImmediateNeighbor(sortedClientDataList.get(i))) { continue; } gates[i].setx1(gates[i].getx2()); @@ -217,7 +217,7 @@ } if (gates[0].isOpen()) { - if (restrictedVisibility && ! thisClientData.isImmediateNeighbor(sortedClientDataList.get(0))) { + if (restrictedVisibility && !thisClientData.isImmediateNeighbor(sortedClientDataList.get(0))) { continue; } gates[0].setx1(gates[0].getx2()); @@ -265,12 +265,12 @@ * This will process the balls according to their position */ private void process(int i, List<ClientData> sortedClients, ClientData thisClientData) { - + switch (particles[i].getPosition()) { case 0: if ((particles[i].x >= (reservoirWidth - gateBuffer) && particles[i].x <= reservoirWidth) - && (particles[i].y >= reservoirHeight - (int) (maximumIrrigationCapacity * canalHeightMultiplier) && particles[i].y <= reservoirHeight)) + && (particles[i].y >= reservoirHeight - (int) (maximumIrrigationCapacity * canalHeightMultiplier) && particles[i].y <= reservoirHeight)) { particles[i].setPosition(1); setBounds(i); @@ -293,12 +293,13 @@ case 1: if (gates[0].isOpen() && (particles[i].x >= gates[0].getOpeningsX() && particles[i].x <= (gates[0].getOpeningsX() + gateBuffer)) - && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) + && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) { - if (restrictedVisibility && sortedClients.get(0).isImmediateNeighbor(thisClientData) || ! restrictedVisibility) + if (restrictedVisibility && sortedClients.get(0).isImmediateNeighbor(thisClientData) || !restrictedVisibility) { - // if we are in the restricted visibility condition AND gate 0 is an immediate neighbor of this client OR we are not in a restricted visibility condition at all, put this ball in the - // gate (or at least I *think* this is what Sanket's god-awful code is doing). + // if we are in the restricted visibility condition AND gate 0 is an immediate neighbor of this client OR we are not in a restricted + // visibility condition at all, put this ball in the + // gate (or at least I *think* this is what Sanket's god-awful code is doing). particles[i].setPosition(7); // directly pass in the information setBounds(i); @@ -321,7 +322,7 @@ if (gates[1].isOpen() && (particles[i].x >= gates[1].getOpeningsX() && particles[i].x <= (gates[1] .getOpeningsX() + gateBuffer)) - && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) + && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) { if (!restrictedVisibility || (restrictedVisibility && sortedClients.get(1).isImmediateNeighbor(thisClientData))) { particles[i].setPosition(8); @@ -329,7 +330,7 @@ setBounds(i); break; } - } + } setBounds(i); if (particles[i].getX() > particles[i].xUpperBound) { particles[i].setPosition(3); @@ -364,10 +365,10 @@ } break; case 4: - if (gates[3].isOpen() + if (gates[3].isOpen() && (particles[i].x >= gates[3].getOpeningsX() && particles[i].x <= (gates[3] .getOpeningsX() + gateBuffer)) - && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) + && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) { if (!restrictedVisibility || (restrictedVisibility && !sortedClients.get(3).isImmediateNeighbor(thisClientData))) { particles[i].setPosition(10); @@ -375,7 +376,7 @@ setBounds(i); break; } - } + } setBounds(i); if (particles[i].getX() > particles[i].xUpperBound) { particles[i].setPosition(5); @@ -390,7 +391,7 @@ if (gates[4].isOpen() && (particles[i].x >= gates[4].getOpeningsX() && particles[i].x <= (gates[4] .getOpeningsX() + gateBuffer)) - && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) + && (particles[i].y >= reservoirHeight - gateBuffer && particles[i].y <= reservoirHeight)) { if (!restrictedVisibility || (restrictedVisibility && !sortedClients.get(4).isImmediateNeighbor(thisClientData))) { particles[i].setPosition(11); @@ -398,7 +399,7 @@ setBounds(i); break; } - } + } setBounds(i); if (particles[i].getX() > particles[i].xUpperBound) { particles[i].setPosition(6); diff -r 4ea2f146b01c7d00a451884fdcdeabb43627836f -r e5ca3f6531adb3c270830bc97289560c5d2af71b src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java --- a/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java +++ b/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java @@ -32,7 +32,7 @@ /** * $Id$ * - * Chat panel used to communicate with other players. + * Chat panel used to communicate with other players. * * FIXME: randomize mappings from handle (e.g., A -> 1, B -> 2, C -> 3 ...) so that it's * not linear. @@ -53,7 +53,7 @@ private TextEntryPanel textEntryPanel; private JEditorPane chatInstructionsPane; - + private JTextField chatField; public ChatPanel(IrrigationClient irrigationClient) { @@ -96,16 +96,16 @@ add(timeLeftPanel, BorderLayout.PAGE_START); add(chatField, BorderLayout.CENTER); -// add(sendButton, BorderLayout.PAGE_END); + // add(sendButton, BorderLayout.PAGE_END); } private void sendMessage() { String message = chatField.getText(); - if (message != null && ! message.isEmpty() && targetIdentifier != null) { + if (message != null && !message.isEmpty() && targetIdentifier != null) { displayMessage(getChatHandle(getClientId()) + " (you): ", message); - chatField.setText(""); - irrigationClient.transmit(new ChatRequest(getClientId(), message, targetIdentifier)); - } + chatField.setText(""); + irrigationClient.transmit(new ChatRequest(getClientId(), message, targetIdentifier)); + } chatField.requestFocusInWindow(); } @@ -120,7 +120,7 @@ private final static String HANDLE_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static String[] HANDLES; - + private Map<Identifier, String> chatHandles = new HashMap<Identifier, String>(); private void addStylesToMessageWindow() { @@ -157,14 +157,14 @@ messageWindow.setEditable(false); messageWindow.setBackground(Color.WHITE); messageScrollPane = new JScrollPane(messageWindow); -// UserInterfaceUtils.addStyles(messageWindow, 16); + // UserInterfaceUtils.addStyles(messageWindow, 16); addStylesToMessageWindow(); textEntryPanel = new TextEntryPanel(); chatInstructionsPane = UserInterfaceUtils.createInstructionsEditorPane(); JScrollPane chatInstructionsScrollPane = new JScrollPane(chatInstructionsPane); add(chatInstructionsScrollPane, BorderLayout.PAGE_START); add(messageScrollPane, BorderLayout.CENTER); -// add(participantButtonPanel, BorderLayout.EAST); + // add(participantButtonPanel, BorderLayout.EAST); add(textEntryPanel, BorderLayout.PAGE_END); addFocusListener(this); messageScrollPane.addFocusListener(this); @@ -181,8 +181,7 @@ document.insertString(0, chatHandle, document.getStyle("bold")); document.insertString(chatHandle.length(), message + "\n", getDefaultStyle()); messageWindow.setCaretPosition(0); - } - catch (BadLocationException e) { + } catch (BadLocationException e) { e.printStackTrace(); } } @@ -199,14 +198,14 @@ chatHandles.put(participants.get(i), HANDLES[i]); } } - + public Identifier getClientId() { - return irrigationClient.getId(); + return irrigationClient.getId(); } - public void setFocusInChatField() { - chatField.requestFocusInWindow(); - } + public void setFocusInChatField() { + chatField.requestFocusInWindow(); + } @Override public void focusGained(FocusEvent e) { diff -r 4ea2f146b01c7d00a451884fdcdeabb43627836f -r e5ca3f6531adb3c270830bc97289560c5d2af71b src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java --- a/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java +++ b/src/main/java/edu/asu/commons/irrigation/client/ClientDataModel.java @@ -19,18 +19,18 @@ * $Id$ * * The client side data model, simply wraps a GroupDataModel. - * + * * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ */ -public class ClientDataModel implements DataModel<ServerConfiguration, RoundConfiguration> { +public class ClientDataModel implements DataModel<ServerConfiguration, RoundConfiguration> { private static final long serialVersionUID = -3424256672940188027L; private GroupDataModel groupDataModel; - + private IrrigationClient client; - + private ServerConfiguration serverConfiguration; private RoundConfiguration roundConfiguration; private final EventChannel eventChannel; @@ -44,31 +44,31 @@ } public ClientData getClientData() { - return groupDataModel.getClientData( getId() ); + return groupDataModel.getClientData(getId()); } - + public String getPriorityString() { - return getClientData().getPriorityString(); + return getClientData().getPriorityString(); } - + public Identifier getId() { return client.getId(); } - + public List<Identifier> getAllClientIdentifiers() { return new ArrayList<Identifier>(groupDataModel.getAllClientIdentifiers()); } - public synchronized void initialize(RoundStartedEvent event) { + public synchronized void initialize(RoundStartedEvent event) { groupDataModel.clear(); setGroupDataModel(event.getGroupDataModel()); - setTimeLeft( getRoundConfiguration().getRoundDurationInSeconds() ); + setTimeLeft(getRoundConfiguration().getRoundDurationInSeconds()); } - public int getPriority(){ + public int getPriority() { return getClientData().getPriority(); } - + public void update(ClientUpdateEvent clientUpdateEvent) { setGroupDataModel(clientUpdateEvent.getGroupDataModel()); setTimeLeft(clientUpdateEvent.getTimeLeft()); @@ -89,11 +89,11 @@ public void setRoundConfiguration(RoundConfiguration roundConfiguration) { this.roundConfiguration = roundConfiguration; } - + public ServerConfiguration getServerConfiguration() { return serverConfiguration; } - + public void setGroupDataModel(GroupDataModel groupDataModel) { this.groupDataModel = groupDataModel; } @@ -101,15 +101,15 @@ public GroupDataModel getGroupDataModel() { return groupDataModel; } - + public Map<Identifier, ClientData> getClientDataMap() { - Map<Identifier, ClientData> clientDataMap = groupDataModel.getClientDataMap(); + Map<Identifier, ClientData> clientDataMap = groupDataModel.getClientDataMap(); // used by StringTemplate to determine whether or not the ClientData it's rendering values for // is this client. - getClientData().setSelf(true); - return clientDataMap; + getClientData().setSelf(true); + return clientDataMap; } - + public List<ClientData> getClientDataSortedByPriority() { Map<Identifier, ClientData> clientDataMap = getClientDataMap(); ArrayList<ClientData> clientDataList = new ArrayList<ClientData>(clientDataMap.values()); @@ -138,29 +138,28 @@ return serverConfiguration; } - public List<ClientData> getOrderedVisibleClients() { - if (getRoundConfiguration().isRestrictedVisibility()) { - // FIXME: replace hard-coded immediate neighbor check with field of vision radius from RoundConfiguration - ArrayList<ClientData> neighbors = new ArrayList<ClientData>(); - List<ClientData> sortedClients = getClientDataSortedByPriority(); - ClientData thisClientData = getClientData(); - int thisClientIndex = sortedClients.indexOf(thisClientData); - if (thisClientIndex > 0) { - // upstream neighbor - neighbors.add(sortedClients.get(thisClientIndex - 1)); - } - // this is needed for the charts, but probably weird for general-purpose usage - neighbors.add(thisClientData); - if (thisClientIndex < sortedClients.size() - 1) { - // downstream neighbor - neighbors.add(sortedClients.get(thisClientIndex + 1)); - } - return neighbors; - } - else { - return getClientDataSortedByPriority(); - } - } - + public List<ClientData> getOrderedVisibleClients() { + if (getRoundConfiguration().isRestrictedVisibility()) { + // FIXME: replace hard-coded immediate neighbor check with field of vision radius from RoundConfiguration + ArrayList<ClientData> neighbors = new ArrayList<ClientData>(); + List<ClientData> sortedClients = getClientDataSortedByPriority(); + ClientData thisClientData = getClientData(); + int thisClientIndex = sortedClients.indexOf(thisClientData); + if (thisClientIndex > 0) { + // upstream neighbor + neighbors.add(sortedClients.get(thisClientIndex - 1)); + } + // this is needed for the charts, but probably weird for general-purpose usage + neighbors.add(thisClientData); + if (thisClientIndex < sortedClients.size() - 1) { + // downstream neighbor + neighbors.add(sortedClients.get(thisClientIndex + 1)); + } + return neighbors; + } + else { + return getClientDataSortedByPriority(); + } + } } diff -r 4ea2f146b01c7d00a451884fdcdeabb43627836f -r e5ca3f6531adb3c270830bc97289560c5d2af71b src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java --- a/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java +++ b/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java @@ -41,8 +41,8 @@ /** * $Id$ * - * The root experiment window placed in the client's JFrame. - * + * The root experiment window placed in the client's JFrame. + * * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ */ @@ -51,7 +51,7 @@ private static final long serialVersionUID = -5636795631355367711L; private ClientDataModel clientDataModel; - + private ChatPanel chatPanel; private HtmlEditorPane instructionsEditorPane; @@ -64,7 +64,7 @@ private InfrastructureEfficiencyChartPanel infrastructureEfficiencyChartPanel; private IrrigationClient client; - + private GamePanel irrigationGamePanel; private StringBuilder instructionsBuilder = new StringBuilder(); @@ -79,10 +79,10 @@ private TokenContributionChartPanel tokenContributionChartPanel; -// private CanalAnimationPanel canalAnimationPanel; + // private CanalAnimationPanel canalAnimationPanel; private CardLayout cardLayout; - + private JLabel investedTokensLabel; public ExperimentGameWindow(IrrigationClient client) { @@ -90,7 +90,7 @@ this.clientDataModel = client.getClientDataModel(); initialize(); } - + private void initialize() { cardLayout = new CardLayout(); setLayout(cardLayout); @@ -102,7 +102,7 @@ addToCardLayout(getContributionInformationPanel()); setInstructions(getServerConfiguration().getWelcomeInstructions()); } - + private void addToCardLayout(Component component) { add(component, component.getName()); } @@ -149,7 +149,7 @@ instructionsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); instructionsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); instructionsPanel.add(instructionsScrollPane, BorderLayout.CENTER); -// instructionsPanel.add(getQuizNavigationPanel(), BorderLayout.PAGE_END); + // instructionsPanel.add(getQuizNavigationPanel(), BorderLayout.PAGE_END); } return instructionsPanel; } @@ -157,12 +157,12 @@ private ServerConfiguration getServerConfiguration() { return clientDataModel.getServerConfiguration(); } - + private JLabel getInvestedTokensLabel() { if (investedTokensLabel == null) { investedTokensLabel = new JLabel(); } - return investedTokensLabel; + return investedTokensLabel; } private JTextField getInvestedTokensTextField() { @@ -188,12 +188,11 @@ investedTokensLabel.setText(""); setInstructions("Please wait while the server computes your total flow capacity based on your group's total token contribution investment."); addCenterComponent(getInstructionsPanel()); - } + } else { investedTokensLabel.setText("Please enter a number between 0 and 10"); } - } - catch(NumberFormatException e){ + } catch (NumberFormatException e) { investedTokensLabel.setText("Please enter a number between 0 and 10"); } } @@ -245,17 +244,17 @@ private void info(String message) { System.err.println(message); } - + public void showDebriefing(boolean showExitInstructions) { instructionsBuilder.delete(0, instructionsBuilder.length()); instructionsBuilder.append(clientDataModel.getRoundConfiguration().generateClientDebriefing(clientDataModel, showExitInstructions)); setInstructions(instructionsBuilder.toString()); } - + private void setInstructions(String instructions) { instructionsEditorPane.setText(instructions); } - + private void displayInstructions(final String instructions) { SwingUtilities.invokeLater(new Runnable() { public void run() { @@ -264,10 +263,11 @@ } }); } - + private ActionListener createQuizListener(final ServerConfiguration configuration) { return new ActionListener() { private Map<String, String> quizAnswers = configuration.getQuizAnswers(); + public synchronized void actionPerformed(ActionEvent e) { FormActionEvent formEvent = (FormActionEvent) e; Properties actualAnswers = formEvent.getData(); @@ -283,20 +283,20 @@ String correctAnswer = entry.getValue(); String actualAnswer = actualAnswers.getProperty(questionNumber); if (actualAnswer == null || actualAnswer.trim().isEmpty()) { - missingQuestions.add(number); - continue; + missingQuestions.add(number); + continue; } - ((correctAnswer.equals(actualAnswer)) ? correctQuestionNumbers : incorrectQuestionNumbers).add(questionNumber); + ((correctAnswer.equals(actualAnswer)) ? correctQuestionNumbers : incorrectQuestionNumbers).add(questionNumber); } int numberOfMissingQuestions = missingQuestions.size(); if (numberOfMissingQuestions > 0) { - Collections.sort(missingQuestions); - JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for questions " + missingQuestions); - return; + Collections.sort(missingQuestions); + JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for questions " + missingQuestions); + return; } else if (numberOfMissingQuestions == 1) { - JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for question " + missingQuestions.get(0)); - return; + JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for question " + missingQuestions.get(0)); + return; } setQuestionColors(correctQuestionNumbers, "blue"); setQuestionColors(incorrectQuestionNumbers, "red"); @@ -309,7 +309,7 @@ }; } - + private void setQuestionColors(List<String> questionNumbers, String color) { HTMLEditorKit editorKit = (HTMLEditorKit) instructionsEditorPane.getEditorKit(); StyleSheet styleSheet = editorKit.getStyleSheet(); @@ -320,8 +320,8 @@ } public void displayContributionInformation(final ClientData clientData) { - final RoundConfiguration configuration = clientDataModel.getRoundConfiguration(); - final String contributionSummary = configuration.generateContributionSummary(clientData); + final RoundConfiguration configuration = clientDataModel.getRoundConfiguration(); + final String contributionSummary = configuration.generateContributionSummary(clientData); SwingUtilities.invokeLater(new Runnable() { public void run() { contributionInformationEditorPane.setText(contributionSummary); @@ -332,7 +332,7 @@ }); irrigationGamePanel.setClientDataModel(clientDataModel); } - + public JPanel getContributionInformationPanel() { if (contributionInformationPanel == null) { contributionInformationPanel = new JPanel(); @@ -359,7 +359,6 @@ return panel; } - public void showTokenInvestmentScreen() { Runnable runnable = new Runnable() { public void run() { @@ -374,7 +373,7 @@ public void updateRoundInstructions() { RoundConfiguration roundConfiguration = clientDataModel.getRoundConfiguration(); - if (! roundConfiguration.isFirstRound()) { + if (!roundConfiguration.isFirstRound()) { instructionsBuilder.append(roundConfiguration.generateUpdatedInstructions(clientDataModel)); displayInstructions(instructionsBuilder.toString()); } @@ -393,13 +392,14 @@ public void run() { startTimer(getServerConfiguration().getChatDuration() * 1000L); chatPanel.initialize(clientDataModel.getAllClientIdentifiers()); - addCenterComponent( chatPanel ); + addCenterComponent(chatPanel); chatPanel.setFocusInChatField(); } }); } private Timer timer; + private void startTimer(final long waitTime) { final long endTime = waitTime + System.currentTimeMillis(); if (timer == null) { @@ -407,9 +407,9 @@ public void actionPerformed(ActionEvent event) { final long timeRemaining = endTime - System.currentTimeMillis(); if (timeRemaining < 0) { - showTokenInvestmentScreen(); + showTokenInvestmentScreen(); getInvestedTokensTextField().requestFocusInWindow(); -// chatPanel.displayMessage("", "---- chat round ending ----"); + // chatPanel.displayMessage("", "---- chat round ending ----"); timer.stop(); timer = null; } @@ -421,7 +421,7 @@ timer.start(); } } - + public void showQuiz() { SwingUtilities.invokeLater(new Runnable() { public void run() { @@ -430,20 +430,20 @@ } }); } - + public void showGameScreenshot() { displayInstructions(getServerConfiguration().getGameScreenshotInstructions()); } - /** + /** * Invoked when the show instructions button is pressed. */ public void showInstructions() { - if (clientDataModel == null || clientDataModel.getRoundConfiguration().isFirstRound()) { - displayInstructions(getServerConfiguration().getInitialInstructions()); - } - else { - displayInstructions(clientDataModel.getRoundConfiguration().getInstructions()); - } + if (clientDataModel == null || clientDataModel.getRoundConfiguration().isFirstRound()) { + displayInstructions(getServerConfiguration().getInitialInstructions()); + } + else { + displayInstructions(clientDataModel.getRoundConfiguration().getInstructions()); + } } } diff -r 4ea2f146b01c7d00a451884fdcdeabb43627836f -r e5ca3f6531adb3c270830bc97289560c5d2af71b src/main/java/edu/asu/commons/irrigation/client/GamePanel.java --- a/src/main/java/edu/asu/commons/irrigation/client/GamePanel.java +++ b/src/main/java/edu/asu/commons/irrigation/client/GamePanel.java @@ -27,10 +27,11 @@ import edu.asu.commons.irrigation.conf.ServerConfiguration; import edu.asu.commons.irrigation.model.ClientData; + /** * $Id$ * - * Primary in-round game interface window for the irrigation game + * Primary in-round game interface window for the irrigation game * * FIXME: refactor layout, currently a hodge podge of fixed sizes * @@ -41,335 +42,340 @@ private static final long serialVersionUID = 5900368694556557132L; - private CanalPanel canalPanel; + private CanalPanel canalPanel; - private JPanel jPanelMain = null; - //this contains the CanalPanel - private JPanel centerPanel = null; - //this contains the upstream and downstream Panel - private JPanel jPanelUpStreamWindow = null; - private JPanel jPanelDownStreamWindow = null; - private JPanel mainInterfacePanel = null; + private JPanel jPanelMain = null; + // this contains the CanalPanel + private JPanel centerPanel = null; + // this contains the upstream and downstream Panel + private JPanel jPanelUpStreamWindow = null; + private JPanel jPanelDownStreamWindow = null; + private JPanel mainInterfacePanel = null; - private IrrigationClient client; + private IrrigationClient client; - private JProgressBar timeLeftProgressBar; + private JProgressBar timeLeftProgressBar; - private ClientDataModel clientDataModel; // @jve:decl-index=0: + private ClientDataModel clientDataModel; // @jve:decl-index=0: - private MiddleWindowPanel middleWindowPanel; + private MiddleWindowPanel middleWindowPanel; - private JLabel gateSwitchLabel = null; + private JLabel gateSwitchLabel = null; - private JLabel scoreBoardLabel = null; + private JLabel scoreBoardLabel = null; - private JButton gateSwitchButton; + private JButton gateSwitchButton; - private boolean open; + private boolean open; -// private JTextField waterCollectedTextField; -// private JLabel waterCollectedLabel; -// private JTextField tokensNotInvestedTextField; -// private JLabel tokensNotInvestedLabel; -// private JTextField tokensEarnedTextField; -// private JLabel tokensEarnedLabel; -// private JTextField totalTokensEarnedTextField; -// private JLabel totalTokensEarnedLabel; - - private JLabel irrigationCapacityLabel; - private JLabel waterSupplyLabel; + // private JTextField waterCollectedTextField; + // private JLabel waterCollectedLabel; + // private JTextField tokensNotInvestedTextField; + // private JLabel tokensNotInvestedLabel; + // private JTextField tokensEarnedTextField; + // private JLabel tokensEarnedLabel; + // private JTextField totalTokensEarnedTextField; + // private JLabel totalTokensEarnedLabel; - private JTextField irrigationCapacityTextField; - private JTextField waterSupplyTextField; + private JLabel irrigationCapacityLabel; + private JLabel waterSupplyLabel; - public GamePanel(IrrigationClient client) { - super(); - this.client = client; - setName("main irrigation game window"); - initGuiComponents(); - } + private JTextField irrigationCapacityTextField; + private JTextField waterSupplyTextField; - private void initGuiComponents() { - this.setLayout(new BorderLayout(4,4)); - this.setSize(1130, 558); - this.add(getPanel(),null); + public GamePanel(IrrigationClient client) { + super(); + this.client = client; + setName("main irrigation game window"); + initGuiComponents(); + } - } + private void initGuiComponents() { + this.setLayout(new BorderLayout(4, 4)); + this.setSize(1130, 558); + this.add(getPanel(), null); - private JPanel getPanel() { - if(jPanelMain == null){ - jPanelMain = new JPanel(); - jPanelMain.setLayout(new BorderLayout(4,4)); - jPanelMain.setBackground(Color.WHITE); - jPanelMain.setForeground(Color.BLACK); - JPanel upperPanel = new JPanel(); - upperPanel.setLayout(new BoxLayout(upperPanel, BoxLayout.X_AXIS)); - upperPanel.add(getIrrigationCapacityLabel()); - upperPanel.add(Box.createHorizontalGlue()); - upperPanel.add(getWaterSupplyLabel()); - jPanelMain.add(upperPanel, BorderLayout.NORTH); - jPanelMain.add(getMainInterfacePanel(), BorderLayout.CENTER); - return jPanelMain; - } - return jPanelMain; - } + } - private JPanel getMainInterfacePanel() { - if(mainInterfacePanel == null){ - scoreBoardLabel = new JLabel(""); - scoreBoardLabel.setBounds(new Rectangle(582,225+100+35,530,20)); - scoreBoardLabel.setHorizontalAlignment(SwingConstants.CENTER); - gateSwitchLabel = new JLabel(""); - gateSwitchLabel.setBounds(new Rectangle(13,225+100+35,530,20)); - gateSwitchLabel.setHorizontalAlignment(SwingConstants.CENTER); - mainInterfacePanel = new JPanel(); - mainInterfacePanel.setLayout(null); - mainInterfacePanel.setName("Main interface panel"); - mainInterfacePanel.setBackground(Color.WHITE); - mainInterfacePanel.add(getCenterPanel(),null); - mainInterfacePanel.add(getTimeLeftProgressBar(), null); - mainInterfacePanel.add(gateSwitchLabel, null); - mainInterfacePanel.add(scoreBoardLabel, null); - } - return mainInterfacePanel; - } + private JPanel getPanel() { + if (jPanelMain == null) { + jPanelMain = new JPanel(); + jPanelMain.setLayout(new BorderLayout(4, 4)); + jPanelMain.setBackground(Color.WHITE); + jPanelMain.setForeground(Color.BLACK); + JPanel upperPanel = new JPanel(); + upperPanel.setLayout(new BoxLayout(upperPanel, BoxLayout.X_AXIS)); + upperPanel.add(getIrrigationCapacityLabel()); + upperPanel.add(Box.createHorizontalGlue()); + upperPanel.add(getWaterSupplyLabel()); + jPanelMain.add(upperPanel, BorderLayout.NORTH); + jPanelMain.add(getMainInterfacePanel(), BorderLayout.CENTER); + return jPanelMain; + } + return jPanelMain; + } - private JProgressBar getTimeLeftProgressBar() { - if (timeLeftProgressBar == null) { - timeLeftProgressBar = new JProgressBar(0, 50); - timeLeftProgressBar.setBounds(new Rectangle(360, 15, 370, 17)); - timeLeftProgressBar.setStringPainted(true); - } - return timeLeftProgressBar; - } - /** - * This method initializes jPanel - * - * @return javax.swing.JPanel - */ - private JPanel getCenterPanel() { - if (centerPanel == null) { - centerPanel = new JPanel(); - centerPanel.setLayout(null); - centerPanel.setBounds(new Rectangle(13, 64, 1098, 123)); - } - return centerPanel; - } + private JPanel getMainInterfacePanel() { + if (mainInterfacePanel == null) { + scoreBoardLabel = new JLabel(""); + scoreBoardLabel.setBounds(new Rectangle(582, 225 + 100 + 35, 530, 20)); + scoreBoardLabel.setHorizontalAlignment(SwingConstants.CENTER); + gateSwitchLabel = new JLabel(""); + gateSwitchLabel.setBounds(new Rectangle(13, 225 + 100 + 35, 530, 20)); + gateSwitchLabel.setHorizontalAlignment(SwingConstants.CENTER); + mainInterfacePanel = new JPanel(); + mainInterfacePanel.setLayout(null); + mainInterfacePanel.setName("Main interface panel"); + mainInterfacePanel.setBackground(Color.WHITE); + mainInterfacePanel.add(getCenterPanel(), null); + mainInterfacePanel.add(getTimeLeftProgressBar(), null); + mainInterfacePanel.add(gateSwitchLabel, null); + mainInterfacePanel.add(scoreBoardLabel, null); + } + return mainInterfacePanel; + } - private JPanel getCanalPanel(ClientDataModel clientDataModel) { - if (canalPanel == null) { - canalPanel = new CanalPanel(clientDataModel); - canalPanel.setSize(new Dimension(1098, 123)); - } - else { - canalPanel.setClientDataModel(clientDataModel); - } - return canalPanel; - } + private JProgressBar getTimeLeftProgressBar() { + if (timeLeftProgressBar == null) { + timeLeftProgressBar = new JProgressBar(0, 50); + timeLeftProgressBar.setBounds(new Rectangle(360, 15, 370, 17)); + timeLeftProgressBar.setStringPainted(true); + } + return timeLeftProgressBar; + } - /** - * This method initializes jPanel1 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelUpStreamWindow() { - if (jPanelUpStreamWindow == null) { - jPanelUpStreamWindow = new JPanel(); - jPanelUpStreamWindow.setLayout(new BorderLayout()); - jPanelUpStreamWindow.setBackground(new Color(186, 226, 237)); - jPanelUpStreamWindow.setBounds(new Rectangle(13, 225+100+50, 530, 326)); - jPanelUpStreamWindow.add(getGateSwitchButton(), BorderLayout.CENTER); -// jPanelUpStreamWindow.add(getControlPanel(), BorderLayout.SOUTH); - } - return jPanelUpStreamWindow; - } - private final static String OPEN_GATE_LABEL = "OPEN YOUR GATE"; - private final static String CLOSE_GATE_LABEL = "CLOSE YOUR GATE"; - private JButton getGateSwitchButton() { - if (gateSwitchButton == null) { - gateSwitchButton = new JButton(OPEN_GATE_LABEL); - gateSwitchButton.setFont(new Font("sansserif", Font.TRUETYPE_FONT, 18)); - gateSwitchButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { - open = !open; - if (open) { - client.openGate(); - gateSwitchButton.setText(CLOSE_GATE_LABEL); - } - else { - client.closeGate(); - gateSwitchButton.setText(OPEN_GATE_LABEL); - } - } - }); - } - return gateSwitchButton; - } - + /** + * This method initializes jPanel + * + * @return javax.swing.JPanel + */ + private JPanel getCenterPanel() { + if (centerPanel == null) { + centerPanel = new JPanel(); + centerPanel.setLayout(null); + centerPanel.setBounds(new Rectangle(13, 64, 1098, 123)); + } + return centerPanel; + } -// private JPanel getControlPanel() { -// JPanel bottomInformationPanel = new JPanel(); -// GroupLayout layout = new GroupLayout(bottomInformationPanel); -// bottomInformationPanel.setLayout(layout); -// layout.setAutoCreateContainerGaps(true); -// layout.setAutoCreateGaps(true); -// -// GroupLayout.SequentialGroup horizontalGroup = layout.createSequentialGroup(); -// ParallelGroup labelsGroup = layout.createParallelGroup(); -// labelsGroup.addComponent(getWaterCollectedLabel()).addComponent(getTokensNotInvestedLabel()).addComponent(getTokensEarnedLabel()).addComponent(getTotalTokensEarnedLabel()); -// -// horizontalGroup.addGroup(labelsGroup); -// -// ParallelGroup textFieldGroup = layout.createParallelGroup(); -// textFieldGroup.addComponent(getWaterCollectedTextField()); -// textFieldGroup.addComponent(getTokensNotInvestedTextField()); -// textFieldGroup.addComponent(getTokensEarnedTextField()); -// textFieldGroup.addComponent(getTotalTokensEarnedTextField()); -// horizontalGroup.addGroup(textFieldGroup); -// layout.setHorizontalGroup(horizontalGroup); -// -// GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup(); -// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) -// .addComponent(getWaterCollectedLabel()).addComponent(getWaterCollectedTextField())); -// -// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) -// .addComponent(getTokensNotInvestedLabel()).addComponent(getTokensNotInvestedTextField())); -// -// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) -// .addComponent(getTokensEarnedLabel()).addComponent(getTokensEarnedTextField())); -// -// verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) -// .addComponent(getTotalTokensEarnedLabel()).addComponent(getTotalTokensEarnedTextField())); -// -// layout.setVerticalGroup(verticalGroup); -// return bottomInformationPanel; -// } + private JPanel getCanalPanel(ClientDataModel clientDataModel) { + if (canalPanel == null) { + canalPanel = new CanalPanel(clientDataModel); + canalPanel.setSize(new Dimension(1098, 123)); + } + else { + canalPanel.setClientDataModel(clientDataModel); + } + return canalPanel; + } + + /** + * This method initializes jPanel1 + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelUpStreamWindow() { + if (jPanelUpStreamWindow == null) { + jPanelUpStreamWindow = new JPanel(); + jPanelUpStreamWindow.setLayout(new BorderLayout()); + jPanelUpStreamWindow.setBackground(new Color(186, 226, 237)); + jPanelUpStreamWindow.setBounds(new Rectangle(13, 225 + 100 + 50, 530, 326)); + jPanelUpStreamWindow.add(getGateSwitchButton(), BorderLayout.CENTER); + // jPanelUpStreamWindow.add(getControlPanel(), BorderLayout.SOUTH); + } + return jPanelUpStreamWindow; + } + + private final static String OPEN_GATE_LABEL = "OPEN YOUR GATE"; + private final static String CLOSE_GATE_LABEL = "CLOSE YOUR GATE"; + + private JButton getGateSwitchButton() { + if (gateSwitchButton == null) { + gateSwitchButton = new JButton(OPEN_GATE_LABEL); + gateSwitchButton.setFont(new Font("sansserif", Font.TRUETYPE_FONT, 18)); + gateSwitchButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + open = !open; + if (open) { + client.openGate(); + gateSwitchButton.setText(CLOSE_GATE_LABEL); + } + else { + client.closeGate(); + gateSwitchButton.setText(OPEN_GATE_LABEL); + } + } + }); + } + return gateSwitchButton; + } + + // private JPanel getControlPanel() { + // JPanel bottomInformationPanel = new JPanel(); + // GroupLayout layout = new GroupLayout(bottomInformationPanel); + // bottomInformationPanel.setLayout(layout); + // layout.setAutoCreateContainerGaps(true); + // layout.setAutoCreateGaps(true); + // + // GroupLayout.SequentialGroup horizontalGroup = layout.createSequentialGroup(); + // ParallelGroup labelsGroup = layout.createParallelGroup(); + // labelsGroup.addComponent(getWaterCollectedLabel()).addComponent(getTokensNotInvestedLabel()).addComponent(getTokensEarnedLabel()).addComponent(getTotalTokensEarnedLabel()); + // + // horizontalGroup.addGroup(labelsGroup); + // + // ParallelGroup textFieldGroup = layout.createParallelGroup(); + // textFieldGroup.addComponent(getWaterCollectedTextField()); + // textFieldGroup.addComponent(getTokensNotInvestedTextField()); + // textFieldGroup.addComponent(getTokensEarnedTextField()); + // textFieldGroup.addComponent(getTotalTokensEarnedTextField()); + // horizontalGroup.addGroup(textFieldGroup); + // layout.setHorizontalGroup(horizontalGroup); + // + // GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup(); + // verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) + // .addComponent(getWaterCollectedLabel()).addComponent(getWaterCollectedTextField())); + // + // verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) + // .addComponent(getTokensNotInvestedLabel()).addComponent(getTokensNotInvestedTextField())); + // + // verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) + // .addComponent(getTokensEarnedLabel()).addComponent(getTokensEarnedTextField())); + // + // verticalGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE) + // .addComponent(getTotalTokensEarnedLabel()).addComponent(getTotalTokensEarnedTextField())); + // + // layout.setVerticalGroup(verticalGroup); + // return bottomInformationPanel; + // } private JTextField createTextField() { JTextField textField = new JTextField(); textField.setEditable(false); -// textField.setBackground(Color.LIGHT_GRAY); + // textField.setBackground(Color.LIGHT_GRAY); textField.setBackground(Color.YELLOW); return textField; - } - -// private JTextField getWaterCollectedTextField() { -// if (waterCollectedTextField == null) { -// waterCollectedTextField = createTextField(); -// } -// return waterCollectedTextField; -// } -// -// -// -// private JLabel getWaterCollectedLabel() { -// if (waterCollectedLabel == null) { -// waterCollectedLabel = new JLabel("Total water applied to your field: "); -// } -// return waterCollectedLabel; -// } -// -// private JTextField getTokensNotInvestedTextField() { -// if (tokensNotInvestedTextField == null) { -// tokensNotInvestedTextField = createTextField(); -// } -// return tokensNotInvestedTextField; -// } -// private JLabel getTokensNotInvestedLabel() { -// if (tokensNotInvestedLabel == null) { -// tokensNotInvestedLabel = new JLabel("Tokens not invested: "); -// } -// return tokensNotInvestedLabel; -// } -// -// private JTextField getTokensEarnedTextField() { -// if (tokensEarnedTextField == null) { -// tokensEarnedTextField = createTextField(); -// } -// return tokensEarnedTextField; -// } -// private JLabel getTokensEarnedLabel() { -// if (tokensEarnedLabel == null) { -// tokensEarnedLabel = new JLabel("Tokens earned by crop production: "); -// } -// return tokensEarnedLabel; -// } -// -// private JTextField getTotalTokensEarnedTextField() { -// if (totalTokensEarnedTextField == null) { -// totalTokensEarnedTextField = createTextField(); -// } -// return totalTokensEarnedTextField; -// -// } -// -// private JLabel getTotalTokensEarnedLabel() { -// if (totalTokensEarnedLabel == null) { -// totalTokensEarnedLabel = new JLabel("Total tokens earned this round: "); -// } -// return totalTokensEarnedLabel; -// } - - private JLabel getIrrigationCapacityLabel() { - if (irrigationCapacityLabel == null) { - irrigationCapacityLabel = new JLabel(); - irrigationCapacityLabel.setLabelFor(getIrrigationCapacityTextField()); - irrigationCapacityLabel.setFont(new Font("sansserif", Font.BOLD, 16)); - } - return irrigationCapacityLabel; - } + } - private JTextField getIrrigationCapacityTextField() { - if (irrigationCapacityTextField == null) { - irrigationCapacityTextField = createTextField(); - } - return irrigationCapacityTextField; - } - - private JLabel getWaterSupplyLabel() { - if (waterSupplyLabel == null) { - waterSupplyLabel = new JLabel("Water supply: "); - waterSupplyLabel.setLabelFor(getWaterSupplyTextField()); - waterSupplyLabel.setFont(new Font("sansserif", Font.BOLD, 16)); - } - return waterSupplyLabel; - } - private JTextField getWaterSupplyTextField() { - if (waterSupplyTextField == null) { - waterSupplyTextField = createTextField(); - } - return waterSupplyTextField; - } - /** - * This method initializes jPanel3 - * summary scoreboard - * @return javax.swing.JPanel - */ - private JPanel getJPanelDownStreamWindow() { - if (jPanelDownStreamWindow == null) { - jPanelDownStreamWindow = new JPanel(); - jPanelDownStreamWindow.setLayout(new BorderLayout()); - jPanelDownStreamWindow.setBackground(new Color(186, 226, 237)); - jPanelDownStreamWindow.setBounds(new Rectangle(582, 225 + 100+50, 530, 326)); - jPanelDownStreamWindow.add(getWaterCollectedToTokensTable(),BorderLayout.CENTER); - } - return jPanelDownStreamWindow; - } - - private XYSeries currentWaterAppliedSeries = new XYSeries("Current water applied"); + // private JTextField getWaterCollectedTextField() { + // if (waterCollectedTextField == null) { + // waterCollectedTextField = createTextField(); + // } + // return waterCollectedTextField; + // } + // + // + // + // private JLabel getWaterCollectedLabel() { + // if (waterCollectedLabel == null) { + // waterCollectedLabel = new JLabel("Total water applied to your field: "); + // } + // return waterCollectedLabel; + // } + // + // private JTextField getTokensNotInvestedTextField() { + // if (tokensNotInvestedTextField == null) { + // tokensNotInvestedTextField = createTextField(); + // } + // return tokensNotInvestedTextField; + // } + // private JLabel getTokensNotInvestedLabel() { + // if (tokensNotInvestedLabel == null) { + // tokensNotInvestedLabel = new JLabel("Tokens not invested: "); + // } + // return tokensNotInvestedLabel; + // } + // + // private JTextField getTokensEarnedTextField() { + // if (tokensEarnedTextField == null) { + // tokensEarnedTextField = createTextField(); + // } + // return tokensEarnedTextField; + // } + // private JLabel getTokensEarnedLabel() { + // if (tokensEarnedLabel == null) { + // tokensEarnedLabel = new JLabel("Tokens earned by crop production: "); + // } + // return tokensEarnedLabel; + // } + // + // private JTextField getTotalTokensEarnedTextField() { + // if (totalTokensEarnedTextField == null) { + // totalTokensEarnedTextField = createTextField(); + // } + // return totalTokensEarnedTextField; + // + // } + // + // private JLabel getTotalTokensEarnedLabel() { + // if (totalTokensEarnedLabel == null) { + // totalTokensEarnedLabel = new JLabel("Total tokens earned this round: "); + // } + // return totalTokensEarnedLabel; + // } - private ChartPanel getWaterCollectedToTokensTable() { + private JLabel getIrrigationCapacityLabel() { + if (irrigationCapacityLabel == null) { + irrigationCapacityLabel = new JLabel(); + irrigationCapacityLabel.setLabelFor(getIrrigationCapacityTextField()); + irrigationCapacityLabel.setFont(new Font("sansserif", Font.BOLD, 16)); + } + return irrigationCapacityLabel; + } + + private JTextField getIrrigationCapacityTextField() { + if (irrigationCapacityTextField == null) { + irrigationCapacityTextField = createTextField(); + } + return irrigationCapacityTextField; + } + + private JLabel getWaterSupplyLabel() { + if (waterSupplyLabel == null) { + waterSupplyLabel = new JLabel("Water supply: "); + waterSupplyLabel.setLabelFor(getWaterSupplyTextField()); + waterSupplyLabel.setFont(new Font("sansserif", Font.BOLD, 16)); + } + return waterSupplyLabel; + } + + private JTextField getWaterSupplyTextField() { + if (waterSupplyTextField == null) { + waterSupplyTextField = createTextField(); + } + return waterSupplyTextField; + } + + /** + * This method initializes jPanel3 + * summary scoreboard + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelDownStreamWindow() { + if (jPanelDownStreamWindow == null) { + jPanelDownStreamWindow = new JPanel(); + jPanelDownStreamWindow.setLayout(new BorderLayout()); + jPanelDownStreamWindow.setBackground(new Color(186, 226, 237)); + jPanelDownStreamWindow.setBounds(new Rectangle(582, 225 + 100 + 50, 530, 326)); + jPanelDownStreamWindow.add(getWaterCollectedToTokensTable(), BorderLayout.CENTER); + } + return jPanelDownStreamWindow; + } + + private XYSeries currentWaterAppliedSeries = new XYSeries("Current water applied"); + + private ChartPanel getWaterCollectedToTokensTable() { final XYSeries tokensEarnedSeries = new XYSeries("Tokens earned from water applied"); - + for (int waterApplied = 0; waterApplied < 1000; waterApplied++) { - int tokensEarned = ServerConfiguration.getTokensEarned(waterApplied); - tokensEarnedSeries.add(waterApplied, tokensEarned); + int tokensEarned = ServerConfiguration.getTokensEarned(waterApplied); + tokensEarnedSeries.add(waterApplied, tokensEarned); } - + XYSeriesCollection data = new XYSeriesCollection(); data.addSeries(tokensEarnedSeries); data.addSeries(currentWaterAppliedSeries); - JFreeChart chart = ChartFactory.createXYLineChart( + JFreeChart chart = ChartFactory.createXYLineChart( "Water applied to tokens earned", "Cubic feet of water applied to your field", "Tokens earned", @@ -378,104 +384,104 @@ true, true, false - ); - chart.setAntiAlias(true); - return new ChartPanel(chart); - } + ); + chart.setAntiAlias(true); + return new ChartPanel(chart); + } - /** - * Should be invoked every second throughout the experiment, from a ClientUpdateEvent sent by the server. - */ - public void updateClientStatus(final ClientDataModel clientDataModel) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - int timeLeft = clientDataModel.getTimeLeft(); - String timeLeftString = String.format("%d sec", timeLeft); - timeLeftProgressBar.setValue( timeLeft ); - timeLeftProgressBar.setString(timeLeftString); - // FIXME: figure out how to reliably set the progress bar colors regardless of OS. -// setProgressBarColor(timeLeft); - // only show open gates for immediately neighboring clients. - boolean restrictedVisibility = clientDataModel.getRoundConfiguration().isRestrictedVisibility(); - final ClientData thisClientData = clientDataModel.getClientData(); + /** + * Should be invoked every second throughout the experiment, from a ClientUpdateEvent sent by the server. + */ + public void updateClientStatus(final ClientDataModel clientDataModel) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + int timeLeft = clientDataModel.getTimeLeft(); + String timeLeftString = String.format("%d sec", timeLeft); + timeLeftProgressBar.setValue(timeLeft); + timeLeftProgressBar.setString(timeLeftString); + // FIXME: figure out how to reliably set the progress bar colors regardless of OS. + // setProgressBarColor(timeLeft); + // only show open gates for immediately neighboring clients. + boolean restrictedVisibility = clientDataModel.getRoundConfiguration().isRestrictedVisibility(); + final ClientData thisClientData = clientDataModel.getClientData(); - for (final ClientData clientData : clientDataModel.getClientDataMap().values()) { - if (clientData.isGateOpen()) { - if (restrictedVisibility && ! thisClientData.isImmediateNeighbor(clientData)) { - continue; - } - canalPanel.openGate(clientData.getPriority()); - } - else { - canalPanel.closeGate(clientData.getPriority()); - } - } - ClientData clientData = clientDataModel.getClientData(); -// getWaterCollectedTextField().setText("" + clientData.getWaterCollected()); -// getTokensNotInvestedTextField().setText("" + clientData.getUninvestedTokens()); -// getTokensEarnedTextField().setText("" + clientData.getTokensEarnedFromWaterCollected()); -// getTotalTokensEarnedTextField().setText("" + clientData.getAllTokensEarnedThisRound()); - getMiddleWindowPanel().update(clientDataModel); - - currentWaterAppliedSeries.clear(); - for (int i = 0; i <= clientData.getTokensEarnedFromWaterCollected(); i++) { - currentWaterAppliedSeries.add(clientData.getWaterCollected(), i); - } - } + for (final ClientData clientData : clientDataModel.getClientDataMap().values()) { + if (clientData.isGateOpen()) { + if (restrictedVisibility && !thisClientData.isImmediateNeighbor(clientData)) { + continue; + } + canalPanel.openGate(clientData.getPriority()); + } + else { + canalPanel.closeGate(clientData.getPriority()); + } + } + ClientData clientData = clientDataModel.getClientData(); + // getWaterCollectedTextField().setText("" + clientData.getWaterCollected()); + // getTokensNotInvestedTextField().setText("" + clientData.getUninvestedTokens()); + // getTokensEarnedTextField().setText("" + clientData.getTokensEarnedFromWaterCollected()); + // getTotalTokensEarnedTextField().setText("" + clien... [truncated message content] |
From: Bitbucket <com...@bi...> - 2012-03-28 06:23:51
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/4ea2f146b01c/ changeset: 4ea2f146b01c user: alllee date: 2012-03-28 08:23:21 summary: fixing log call affected #: 1 file diff -r f8790891fb256820aec54fd546c4790bef9bfac2 -r 4ea2f146b01c7d00a451884fdcdeabb43627836f src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java --- a/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java +++ b/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java @@ -52,486 +52,540 @@ * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Revision$ */ -public class IrrigationServer extends AbstractExperiment<ServerConfiguration, RoundConfiguration> { +public class IrrigationServer extends + AbstractExperiment<ServerConfiguration, RoundConfiguration> { - private final Map<Identifier, ClientData> clients = new LinkedHashMap<Identifier, ClientData>(); + private final Map<Identifier, ClientData> clients = new LinkedHashMap<Identifier, ClientData>(); - private final static int SERVER_SLEEP_INTERVAL = 100; + private final static int SERVER_SLEEP_INTERVAL = 100; - private final Object roundSignal = new Object(); + private final Object roundSignal = new Object(); - private Duration currentRoundDuration; + private Duration currentRoundDuration; - private final ServerDataModel serverDataModel; + private final ServerDataModel serverDataModel; - private int submittedClients; + private int submittedClients; - private IrrigationPersister persister; + private IrrigationPersister persister; - private IrrigationServerStateMachine stateMachine = new IrrigationServerStateMachine(); + private IrrigationServerStateMachine stateMachine = new IrrigationServerStateMachine(); - public IrrigationServer() { - this(new ServerConfiguration()); - } + public IrrigationServer() { + this(new ServerConfiguration()); + } - // FIXME: add the ability to reconfigure an already instantiated server - public IrrigationServer(ServerConfiguration configuration) { - super(configuration); - serverDataModel = new ServerDataModel(); - serverDataModel.setEventChannel(getEventChannel()); - serverDataModel.setRoundConfiguration(configuration.getCurrentParameters()); - persister = new IrrigationPersister(getEventChannel(), configuration); - initializeFacilitatorHandlers(); - initializeClientHandlers(); - } + // FIXME: add the ability to reconfigure an already instantiated server + public IrrigationServer(ServerConfiguration configuration) { + super(configuration); + serverDataModel = new ServerDataModel(); + serverDataModel.setEventChannel(getEventChannel()); + serverDataModel.setRoundConfiguration(configuration + .getCurrentParameters()); + persister = new IrrigationPersister(getEventChannel(), configuration); + initializeFacilitatorHandlers(); + initializeClientHandlers(); + } - @SuppressWarnings("rawtypes") - private void initializeFacilitatorHandlers() { - addEventProcessor(new EventTypeProcessor<FacilitatorRegistrationRequest>(FacilitatorRegistrationRequest.class) { - @Override - public void handle(FacilitatorRegistrationRequest event) { - getLogger().info("facilitator registered: " + event.getId()); - // remap the facilitator ID and remove from the clients list. - setFacilitatorId(event.getId()); - synchronized (clients) { - clients.remove(getFacilitatorId()); - serverDataModel.removeClient(getFacilitatorId()); - } - } - }); - addEventProcessor(new EventTypeProcessor<BeginExperimentRequest>(BeginExperimentRequest.class) { - @Override - public void handle(BeginExperimentRequest event) { - // sends override and immediately starts the round. - synchronized (roundSignal) { - roundSignal.notifyAll(); - } - } - }); - addEventProcessor(new EventTypeProcessor<BeginRoundRequest>(BeginRoundRequest.class) { - @Override - public void handle(BeginRoundRequest event) { - if (! event.getId().equals(getFacilitatorId())) { - sendFacilitatorMessage( - String.format("facilitator is [%s] but received begin round request from non-facilitator [%s]", - getFacilitatorId(), event.getId())); - return; - } - // ignore the request if not every group has submit their tokens. - if (isTokenInvestmentComplete()) { - sendFacilitatorMessage("Starting actual round."); - synchronized (roundSignal) { - roundSignal.notifyAll(); - } - } - else { - sendFacilitatorMessage( - String.format("Cannot start round, %d of %d clients have submitted token investments", - submittedClients, clients.size())); - } - } - }); - addEventProcessor(new EventTypeProcessor<EndRoundRequest>(EndRoundRequest.class) { - @Override - public void handleInExperimentThread(EndRoundRequest request) { - currentRoundDuration.stop(); - } + @SuppressWarnings("rawtypes") + private void initializeFacilitatorHandlers() { + addEventProcessor(new EventTypeProcessor<FacilitatorRegistrationRequest>( + FacilitatorRegistrationRequest.class) { + @Override + public void handle(FacilitatorRegistrationRequest event) { + getLogger().info("facilitator registered: " + event.getId()); + // remap the facilitator ID and remove from the clients list. + setFacilitatorId(event.getId()); + synchronized (clients) { + clients.remove(getFacilitatorId()); + serverDataModel.removeClient(getFacilitatorId()); + } + } + }); + addEventProcessor(new EventTypeProcessor<BeginExperimentRequest>( + BeginExperimentRequest.class) { + @Override + public void handle(BeginExperimentRequest event) { + // sends override and immediately starts the round. + synchronized (roundSignal) { + roundSignal.notifyAll(); + } + } + }); + addEventProcessor(new EventTypeProcessor<BeginRoundRequest>( + BeginRoundRequest.class) { + @Override + public void handle(BeginRoundRequest event) { + if (!event.getId().equals(getFacilitatorId())) { + sendFacilitatorMessage(String + .format("facilitator is [%s] but received begin round request from non-facilitator [%s]", + getFacilitatorId(), event.getId())); + return; + } + // ignore the request if not every group has submit their + // tokens. + if (isTokenInvestmentComplete()) { + sendFacilitatorMessage("Starting actual round."); + synchronized (roundSignal) { + roundSignal.notifyAll(); + } + } else { + sendFacilitatorMessage(String + .format("Cannot start round, %d of %d clients have submitted token investments", + submittedClients, clients.size())); + } + } + }); + addEventProcessor(new EventTypeProcessor<EndRoundRequest>( + EndRoundRequest.class) { + @Override + public void handleInExperimentThread(EndRoundRequest request) { + currentRoundDuration.stop(); + } - }); - addEventProcessor(new EventTypeProcessor<BeginChatRoundRequest>(BeginChatRoundRequest.class) { - @Override - public void handle(BeginChatRoundRequest request) { - // XXX: the participants have already been added to the data model at this point - // so we shuffle them around right before the first practice round's chat. - if (getRoundConfiguration().isFirstRound()) { - shuffleParticipants(); - } - else { - persister.clearChatData(); - } - // pass it on to all the clients - synchronized (clients) { - for (Identifier id: clients.keySet()) { - transmit(new BeginChatRoundRequest(id, serverDataModel.getGroupDataModel(id))); - } - } - } - }); - addEventProcessor(new EventTypeProcessor<ShowRequest>(ShowRequest.class, true) { - @Override - public void handle(ShowRequest request) { - /* - if (stateMachine.state == IrrigationServerState.ROUND_IN_PROGRESS) { - sendFacilitatorMessage("Ignoring request: " + request + " - round is currently running"); - } - */ - if (request.getId().equals(getFacilitatorId())) { - synchronized (clients) { - for (Identifier id: clients.keySet()) { - transmit(request.clone(id)); - } - } - } - else { - sendFacilitatorMessage("Received invalid show request " + request + " from " + getFacilitatorId()); - } - } - }); - } + }); + addEventProcessor(new EventTypeProcessor<BeginChatRoundRequest>( + BeginChatRoundRequest.class) { + @Override + public void handle(BeginChatRoundRequest request) { + // XXX: the participants have already been added to the data + // model at this point + // so we shuffle them around right before the first practice + // round's chat. + if (getRoundConfiguration().isFirstRound()) { + shuffleParticipants(); + } else { + persister.clearChatData(); + } + // pass it on to all the clients + synchronized (clients) { + for (Identifier id : clients.keySet()) { + transmit(new BeginChatRoundRequest(id, + serverDataModel.getGroupDataModel(id))); + } + } + } + }); + addEventProcessor(new EventTypeProcessor<ShowRequest>( + ShowRequest.class, true) { + @Override + public void handle(ShowRequest request) { + /* + * if (stateMachine.state == + * IrrigationServerState.ROUND_IN_PROGRESS) { + * sendFacilitatorMessage("Ignoring request: " + request + + * " - round is currently running"); } + */ + if (request.getId().equals(getFacilitatorId())) { + synchronized (clients) { + for (Identifier id : clients.keySet()) { + transmit(request.clone(id)); + } + } + } else { + sendFacilitatorMessage("Received invalid show request " + + request + " from " + getFacilitatorId()); + } + } + }); + } - /** - * Registers client handling EventTypeProcessors. - * Each EventTypeProcessor encapsulates the handling of a specific kind of message event. - */ - private void initializeClientHandlers() { - addEventProcessor(new EventTypeProcessor<SocketIdentifierUpdateRequest>(SocketIdentifierUpdateRequest.class) { - @Override - public void handle(SocketIdentifierUpdateRequest request) { - SocketIdentifier socketId = request.getSocketIdentifier(); - ClientData clientData = clients.get(socketId); - if (clientData == null) { - sendFacilitatorMessage("No client data available for socket: " + socketId); - return; - } - SocketIdentifier clientSocketId = (SocketIdentifier) clientData.getId(); - clientSocketId.setStationNumber(request.getStationNumber()); - } - }); - addEventProcessor(new EventTypeProcessor<ConnectionEvent>(ConnectionEvent.class) { - @Override - public void handle(ConnectionEvent event) { - sendFacilitatorMessage("incoming connection: " + event); - // handle incoming connections - Identifier identifier = event.getId(); - ClientData clientData = new ClientData(identifier); - synchronized (clients) { - clients.put(identifier, clientData); - serverDataModel.addClient(clientData); - } - transmit(new RegistrationEvent(clientData, getRoundConfiguration())); - } - }); - addEventProcessor(new EventTypeProcessor<DisconnectionRequest>(DisconnectionRequest.class) { - @Override - public void handle(DisconnectionRequest request) { - sendFacilitatorMessage("irrigation server handling disconnection request: " + request); - Identifier disconnectedClientId = request.getId(); - if (disconnectedClientId.equals(getFacilitatorId())) { - getLogger().warning("Disconnecting facilitator."); - setFacilitatorId(null); - return; - } - synchronized (clients) { - clients.remove(disconnectedClientId); - serverDataModel.removeClient(disconnectedClientId); - } - } - }); - addEventProcessor(new EventTypeProcessor<ChatRequest>(ChatRequest.class) { - @Override - public void handle(ChatRequest request) { - Identifier source = request.getSource(); - Identifier target = request.getTarget(); - ClientData sendingClient = clients.get(source); - ArrayList<ClientData> allTargets = new ArrayList<ClientData>(); - if (Identifier.ALL.equals(target)) { - // relay to all clients in this client's group. - boolean restrictedVisibility = getRoundConfiguration().isRestrictedVisibility(); - for (ClientData clientData: clients.get(source).getGroupDataModel().getClientDataMap().values()) { - Identifier targetId = clientData.getId(); - if (targetId.equals(source) || (restrictedVisibility && ! sendingClient.isImmediateNeighbor(clientData))) { - // don't send the message if the target is the source or we're in a restricted visibility - // condition and the client isn't an immediate neighbor. - continue; - } - allTargets.add(clientData); - ChatEvent chatEvent = new ChatEvent(targetId, request.getMessage(), source, true); - transmit(chatEvent); - } - } - else { - allTargets.add(clients.get(target)); - ChatEvent chatEvent = new ChatEvent(target, request.getMessage(), source); - transmit(chatEvent); - } - sendFacilitatorMessage(String.format("%s->%s: %s", sendingClient, allTargets, request.toString())); - persister.store(request); - } - }); - addEventProcessor(new EventTypeProcessor<InvestedTokensEvent>(InvestedTokensEvent.class) { - @Override - public void handle(InvestedTokensEvent event) { - if (isTokenInvestmentComplete()) { - sendFacilitatorMessage("Trying to invest more tokens but token investment is already complete:" + event); - return; - } - clients.get(event.getId()).setInvestedTokens(event.getInvestedTokens()); - submittedClients++; - if (isTokenInvestmentComplete()) { - // everyone's submitted their tokens so we can calculate the available bandwidth and - // notify each client - initializeInfrastructureEfficiency(); - sendFacilitatorMessage("Token investment is complete, ready to start the round."); - } - } - }); - addEventProcessor(new EventTypeProcessor<QuizResponseEvent>(QuizResponseEvent.class) { - private volatile int numberOfCompletedQuizzes = 0; - @Override - public void handle(QuizResponseEvent quizResponseEvent) { - clients.get(quizResponseEvent.getId()).addCorrectQuizAnswers(quizResponseEvent.getNumberOfCorrectQuizAnswers()); - numberOfCompletedQuizzes++; - sendFacilitatorMessage(String.format("%d/%d quiz response: %s", numberOfCompletedQuizzes, clients.size(), quizResponseEvent)); - if (numberOfCompletedQuizzes >= clients.size()) { - sendFacilitatorMessage("All quizzes completed: " + numberOfCompletedQuizzes); - numberOfCompletedQuizzes = 0; - } - persister.store(quizResponseEvent); - } - }); - addEventProcessor(new EventTypeProcessor<OpenGateEvent>(OpenGateEvent.class) { - public void handle(OpenGateEvent event) { - clients.get(event.getId()).openGate(); - } - }); - addEventProcessor(new EventTypeProcessor<CloseGateEvent>(CloseGateEvent.class) { - public void handle(CloseGateEvent event) { - clients.get(event.getId()).closeGate(); - } - }); - } + /** + * Registers client handling EventTypeProcessors. Each EventTypeProcessor + * encapsulates the handling of a specific kind of message event. + */ + private void initializeClientHandlers() { + addEventProcessor(new EventTypeProcessor<SocketIdentifierUpdateRequest>( + SocketIdentifierUpdateRequest.class) { + @Override + public void handle(SocketIdentifierUpdateRequest request) { + SocketIdentifier socketId = request.getSocketIdentifier(); + ClientData clientData = clients.get(socketId); + if (clientData == null) { + sendFacilitatorMessage("No client data available for socket: " + + socketId); + return; + } + SocketIdentifier clientSocketId = (SocketIdentifier) clientData + .getId(); + clientSocketId.setStationNumber(request.getStationNumber()); + } + }); + addEventProcessor(new EventTypeProcessor<ConnectionEvent>( + ConnectionEvent.class) { + @Override + public void handle(ConnectionEvent event) { + sendFacilitatorMessage("incoming connection: " + event); + // handle incoming connections + Identifier identifier = event.getId(); + ClientData clientData = new ClientData(identifier); + synchronized (clients) { + clients.put(identifier, clientData); + serverDataModel.addClient(clientData); + } + transmit(new RegistrationEvent(clientData, + getRoundConfiguration())); + } + }); + addEventProcessor(new EventTypeProcessor<DisconnectionRequest>( + DisconnectionRequest.class) { + @Override + public void handle(DisconnectionRequest request) { + sendFacilitatorMessage("irrigation server handling disconnection request: " + + request); + Identifier disconnectedClientId = request.getId(); + if (disconnectedClientId.equals(getFacilitatorId())) { + getLogger().warning("Disconnecting facilitator."); + setFacilitatorId(null); + return; + } + synchronized (clients) { + clients.remove(disconnectedClientId); + serverDataModel.removeClient(disconnectedClientId); + } + } + }); + addEventProcessor(new EventTypeProcessor<ChatRequest>(ChatRequest.class) { + @Override + public void handle(ChatRequest request) { + Identifier source = request.getSource(); + Identifier target = request.getTarget(); + ClientData sendingClient = clients.get(source); + ArrayList<ClientData> allTargets = new ArrayList<ClientData>(); + if (Identifier.ALL.equals(target)) { + // relay to all clients in this client's group. + boolean restrictedVisibility = getRoundConfiguration() + .isRestrictedVisibility(); + for (ClientData clientData : clients.get(source) + .getGroupDataModel().getClientDataMap().values()) { + Identifier targetId = clientData.getId(); + if (targetId.equals(source) + || (restrictedVisibility && !sendingClient + .isImmediateNeighbor(clientData))) { + // don't send the message if the target is the + // source or we're in a restricted visibility + // condition and the client isn't an immediate + // neighbor. + continue; + } + allTargets.add(clientData); + ChatEvent chatEvent = new ChatEvent(targetId, + request.getMessage(), source, true); + transmit(chatEvent); + } + } else { + allTargets.add(clients.get(target)); + ChatEvent chatEvent = new ChatEvent(target, + request.getMessage(), source); + transmit(chatEvent); + } + sendFacilitatorMessage(String.format("%s->%s: %s", + sendingClient, allTargets, request.toString())); + persister.store(request); + } + }); + addEventProcessor(new EventTypeProcessor<InvestedTokensEvent>( + InvestedTokensEvent.class) { + @Override + public void handle(InvestedTokensEvent event) { + if (isTokenInvestmentComplete()) { + sendFacilitatorMessage("Trying to invest more tokens but token investment is already complete:" + + event); + return; + } + clients.get(event.getId()).setInvestedTokens( + event.getInvestedTokens()); + submittedClients++; + if (isTokenInvestmentComplete()) { + // everyone's submitted their tokens so we can calculate the + // available bandwidth and + // notify each client + initializeInfrastructureEfficiency(); + sendFacilitatorMessage("Token investment is complete, ready to start the round."); + } + } + }); + addEventProcessor(new EventTypeProcessor<QuizResponseEvent>( + QuizResponseEvent.class) { + private volatile int numberOfCompletedQuizzes = 0; - private boolean isTokenInvestmentComplete() { - return submittedClients >= clients.size(); - } + @Override + public void handle(QuizResponseEvent quizResponseEvent) { + clients.get(quizResponseEvent.getId()).addCorrectQuizAnswers( + quizResponseEvent.getNumberOfCorrectQuizAnswers()); + numberOfCompletedQuizzes++; + sendFacilitatorMessage(String.format("%d/%d quiz response: %s", + numberOfCompletedQuizzes, clients.size(), + quizResponseEvent)); + if (numberOfCompletedQuizzes >= clients.size()) { + sendFacilitatorMessage("All quizzes completed: " + + numberOfCompletedQuizzes); + numberOfCompletedQuizzes = 0; + } + persister.store(quizResponseEvent); + } + }); + addEventProcessor(new EventTypeProcessor<OpenGateEvent>( + OpenGateEvent.class) { + public void handle(OpenGateEvent event) { + clients.get(event.getId()).openGate(); + } + }); + addEventProcessor(new EventTypeProcessor<CloseGateEvent>( + CloseGateEvent.class) { + public void handle(CloseGateEvent event) { + clients.get(event.getId()).closeGate(); + } + }); + } - /** - * Invoked after every client has submit their tokens - * - */ - public void initializeInfrastructureEfficiency() { - // clients are added to the ServerDataModel as they register and then reallocated if necessary in - // post round cleanup - ///////////////////////////////////////////////////////////////////////////////// - for(GroupDataModel group : serverDataModel.getAllGroupDataModels()){ - group.initializeInfrastructure(); - // iterate through all groups and send back their contribution status - for (Identifier id : group.getClientDataMap().keySet()) { - InfrastructureUpdateEvent infrastructureUpdateEvent = new InfrastructureUpdateEvent(id, group); - transmit(infrastructureUpdateEvent); - } - } - } + private boolean isTokenInvestmentComplete() { + return submittedClients >= clients.size(); + } - private RoundConfiguration getRoundConfiguration() { - return getConfiguration().getCurrentParameters(); - } + /** + * Invoked after every client has submit their tokens + * + */ + public void initializeInfrastructureEfficiency() { + // clients are added to the ServerDataModel as they register and then + // reallocated if necessary in + // post round cleanup + // /////////////////////////////////////////////////////////////////////////////// + for (GroupDataModel group : serverDataModel.getAllGroupDataModels()) { + group.initializeInfrastructure(); + // iterate through all groups and send back their contribution + // status + for (Identifier id : group.getClientDataMap().keySet()) { + InfrastructureUpdateEvent infrastructureUpdateEvent = new InfrastructureUpdateEvent( + id, group); + transmit(infrastructureUpdateEvent); + } + } + } + private RoundConfiguration getRoundConfiguration() { + return getConfiguration().getCurrentParameters(); + } - /** - * Processes the given GroupDataModel and re-allocates water to each participant in the group - * based on each participants gate open/closed status. - * - * @param group - */ - private void process(GroupDataModel group) { - // reset group's available flow and re-allocate water to each participant in this group - group.resetCurrentlyAvailableFlowCapacity(); - int timeLeft = (int) (currentRoundDuration.getTimeLeft() / 1000); - // allocate flow to each participant - this works because GroupDataModel uses a LinkedHashMap that preserves - // iteration order (initial order of participants added to the group), otherwise we'd have to sort by priority - // string - for (ClientData clientData : group.getClientDataMap().values()) { - // for undisrupted flow extensions, disabled for the time being. -// if (clientData.getAvailableFlowCapacity() <= 0 && getConfiguration().isUndisruptedFlowRequired()){ -// clientData.init(group.getCurrentlyAvailableFlowCapacity()); -// } - group.allocateWater(clientData); - } - for (Identifier id: group.getAllClientIdentifiers()) { - ClientUpdateEvent clientUpdateEvent = new ClientUpdateEvent(id, group, timeLeft); - transmit(clientUpdateEvent); - } - } + /** + * Processes the given GroupDataModel and re-allocates water to each + * participant in the group based on each participants gate open/closed + * status. + * + * @param group + */ + private void process(GroupDataModel group) { + // reset group's available flow and re-allocate water to each + // participant in this group + group.resetCurrentlyAvailableFlowCapacity(); + int timeLeft = (int) (currentRoundDuration.getTimeLeft() / 1000); + // allocate flow to each participant - this works because GroupDataModel + // uses a LinkedHashMap that preserves + // iteration order (initial order of participants added to the group), + // otherwise we'd have to sort by priority + // string + for (ClientData clientData : group.getClientDataMap().values()) { + // for undisrupted flow extensions, disabled for the time being. + // if (clientData.getAvailableFlowCapacity() <= 0 && + // getConfiguration().isUndisruptedFlowRequired()){ + // clientData.init(group.getCurrentlyAvailableFlowCapacity()); + // } + group.allocateWater(clientData); + } + for (Identifier id : group.getAllClientIdentifiers()) { + ClientUpdateEvent clientUpdateEvent = new ClientUpdateEvent(id, + group, timeLeft); + transmit(clientUpdateEvent); + } + } - public static void main(String[] args) { - IrrigationServer server = new IrrigationServer(new ServerConfiguration()); - server.start(); - server.repl(); - } + public static void main(String[] args) { + IrrigationServer server = new IrrigationServer( + new ServerConfiguration()); + server.start(); + server.repl(); + } - private void shuffleParticipants() { - serverDataModel.clear(); - List<ClientData> clientDataList = new ArrayList<ClientData>(clients.values()); - // randomize the client data list - Collections.shuffle(clientDataList); - // re-add each the clients to the server data model - for (ClientData data: clientDataList) { - serverDataModel.addClient(data); - } - } - + private void shuffleParticipants() { + serverDataModel.clear(); + List<ClientData> clientDataList = new ArrayList<ClientData>( + clients.values()); + // randomize the client data list + Collections.shuffle(clientDataList); + // re-add each the clients to the server data model + for (ClientData data : clientDataList) { + serverDataModel.addClient(data); + } + } - enum IrrigationServerState { WAITING, ROUND_IN_PROGRESS }; + enum IrrigationServerState { + WAITING, ROUND_IN_PROGRESS + }; - private class IrrigationServerStateMachine implements StateMachine { + private class IrrigationServerStateMachine implements StateMachine { - private IrrigationServerState state; - -// private long lastTime; - - private Duration secondTick = Duration.create(1000L); + private IrrigationServerState state; - public void initialize() { - // FIXME: may want to change this as we add more states. - state = IrrigationServerState.WAITING; - persister.initialize(getRoundConfiguration()); - } + // private long lastTime; - private void initializeRound() { - // send RoundStartedEvents to all connected clients - for (Map.Entry<Identifier, ClientData> entry : clients.entrySet()) { - Identifier id = entry.getKey(); - ClientData data = entry.getValue(); - transmit(new RoundStartedEvent(id, data.getGroupDataModel())); - } - // start timers - currentRoundDuration = getRoundConfiguration().getRoundDuration(); - currentRoundDuration.start(); - state = IrrigationServerState.ROUND_IN_PROGRESS; - secondTick.start(); - persister.store(new RoundStartedMarkerEvent()); -// lastTime = System.currentTimeMillis(); - } + private Duration secondTick = Duration.create(1000L); - private void processRound() { -// if ((System.currentTimeMillis() - lastTime) / 1000 > 1) { - if (secondTick.hasExpired()) { - for (GroupDataModel group: serverDataModel.getAllGroupDataModels()) { - // reset available bandwidth for this group to calculate new allocations for the group - // perform bandwidth calculations - try{ - process(group); - } - catch (RuntimeException exception) { - sendFacilitatorMessage("Couldn't process group: " + exception.getMessage(), exception); - } - } -// lastTime = System.currentTimeMillis(); - secondTick.restart(); - } - } + public void initialize() { + // FIXME: may want to change this as we add more states. + state = IrrigationServerState.WAITING; + persister.initialize(getRoundConfiguration()); + } - private void stopRound() { - sendEndRoundEvents(); - persistRound(); - cleanupRound(); - advanceToNextRound(); - state = IrrigationServerState.WAITING; - } + private void initializeRound() { + // send RoundStartedEvents to all connected clients + for (Map.Entry<Identifier, ClientData> entry : clients.entrySet()) { + Identifier id = entry.getKey(); + ClientData data = entry.getValue(); + transmit(new RoundStartedEvent(id, data.getGroupDataModel())); + } + // start timers + currentRoundDuration = getRoundConfiguration().getRoundDuration(); + currentRoundDuration.start(); + state = IrrigationServerState.ROUND_IN_PROGRESS; + secondTick.start(); + persister.store(new RoundStartedMarkerEvent()); + // lastTime = System.currentTimeMillis(); + } - private void sendEndRoundEvents() { - // need to send instructions - //Send the end round event to the facilitator - //Send the end round event to all the clients - synchronized (clients) { - // add collected tokens to total if this isn't a practice round. - if (! getRoundConfiguration().isPracticeRound()) { - // first add tokens - for (ClientData data : clients.values()) { - data.addTokensEarnedThisRoundToTotal(); - } - } - for (ClientData data : clients.values()) { - transmit(new EndRoundEvent(data.getId(), - data.getGroupDataModel(), - getConfiguration().isLastRound())); - } - } - sendFacilitatorMessage("Round ended, ready to begin chat again"); - transmit(new FacilitatorEndRoundEvent(getFacilitatorId(), serverDataModel)); + private void processRound() { + // if ((System.currentTimeMillis() - lastTime) / 1000 > 1) { + if (secondTick.hasExpired()) { + for (GroupDataModel group : serverDataModel + .getAllGroupDataModels()) { + // reset available bandwidth for this group to calculate new + // allocations for the group + // perform bandwidth calculations + try { + process(group); + } catch (RuntimeException exception) { + sendFacilitatorMessage("Couldn't process group: " + + exception.getMessage(), exception); + } + } + // lastTime = System.currentTimeMillis(); + secondTick.restart(); + } + } - } + private void stopRound() { + sendEndRoundEvents(); + persistRound(); + cleanupRound(); + advanceToNextRound(); + state = IrrigationServerState.WAITING; + } - private void persistRound() { - logger.debug("Saving round data"); - persister.persist(serverDataModel); - } + private void sendEndRoundEvents() { + // need to send instructions + // Send the end round event to the facilitator + // Send the end round event to all the clients + synchronized (clients) { + // add collected tokens to total if this isn't a practice round. + if (!getRoundConfiguration().isPracticeRound()) { + // first add tokens + for (ClientData data : clients.values()) { + data.addTokensEarnedThisRoundToTotal(); + } + } + for (ClientData data : clients.values()) { + transmit(new EndRoundEvent(data.getId(), + data.getGroupDataModel(), + getConfiguration().isLastRound())); + } + } + sendFacilitatorMessage("Round ended, ready to begin chat again"); + transmit(new FacilitatorEndRoundEvent(getFacilitatorId(), + serverDataModel)); - private void cleanupRound() { - // reset client data values - synchronized (clients) { - for (ClientData clientData: clients.values()) { - clientData.resetEndRound(); - } - } - submittedClients = 0; - persister.clear(); - } - + } - private void advanceToNextRound() { - if (getConfiguration().isLastRound()) { - state = IrrigationServerState.WAITING; - return; - } - RoundConfiguration nextRoundConfiguration = getConfiguration().nextRound(); - serverDataModel.setRoundConfiguration(nextRoundConfiguration); - // set up the next round - synchronized (clients) { - if (nextRoundConfiguration.shouldRandomizeGroup()) { - shuffleParticipants(); + private void persistRound() { + getLogger().info("Saving round data"); + persister.persist(serverDataModel); + } - } - // send registration events to all participants. - for (ClientData data: clients.values()) { - transmit(new RegistrationEvent(data, nextRoundConfiguration)); - } - } - // send new round configuration to the facilitator - transmit(new RegistrationEvent(getFacilitatorId(), nextRoundConfiguration)); - persister.initialize(nextRoundConfiguration); - } + private void cleanupRound() { + // reset client data values + synchronized (clients) { + for (ClientData clientData : clients.values()) { + clientData.resetEndRound(); + } + } + submittedClients = 0; + persister.clear(); + } - public void execute(Dispatcher dispatcher) { - switch (state) { - case ROUND_IN_PROGRESS: - // process incoming information - synchronized (serverDataModel) { - if (currentRoundDuration.hasExpired()) { - // end round - stopRound(); - } - else { - processRound(); - } - } - Utils.sleep(SERVER_SLEEP_INTERVAL); - break; - case WAITING: - getLogger().info("Waiting for facilitator signal to start next round."); - Utils.waitOn(roundSignal); - initializeRound(); - break; - default: - throw new RuntimeException("Should never get here."); - } - } - } + private void advanceToNextRound() { + if (getConfiguration().isLastRound()) { + state = IrrigationServerState.WAITING; + return; + } + RoundConfiguration nextRoundConfiguration = getConfiguration() + .nextRound(); + serverDataModel.setRoundConfiguration(nextRoundConfiguration); + // set up the next round + synchronized (clients) { + if (nextRoundConfiguration.shouldRandomizeGroup()) { + shuffleParticipants(); - @Override - protected StateMachine getStateMachine() { - return stateMachine; - } - @Override - public void processReplInput(String input, BufferedReader reader) { - if ("clients".equals(input)) { - System.err.println("clients: " + clients); - } - } + } + // send registration events to all participants. + for (ClientData data : clients.values()) { + transmit(new RegistrationEvent(data, nextRoundConfiguration)); + } + } + // send new round configuration to the facilitator + transmit(new RegistrationEvent(getFacilitatorId(), + nextRoundConfiguration)); + persister.initialize(nextRoundConfiguration); + } - @Override - public IPersister<ServerConfiguration, RoundConfiguration> getPersister() { - return persister; - } + public void execute(Dispatcher dispatcher) { + switch (state) { + case ROUND_IN_PROGRESS: + // process incoming information + synchronized (serverDataModel) { + if (currentRoundDuration.hasExpired()) { + // end round + stopRound(); + } else { + processRound(); + } + } + Utils.sleep(SERVER_SLEEP_INTERVAL); + break; + case WAITING: + getLogger().info( + "Waiting for facilitator signal to start next round."); + Utils.waitOn(roundSignal); + initializeRound(); + break; + default: + throw new RuntimeException("Should never get here."); + } + } + } + + @Override + protected StateMachine getStateMachine() { + return stateMachine; + } + + @Override + public void processReplInput(String input, BufferedReader reader) { + if ("clients".equals(input)) { + System.err.println("clients: " + clients); + } + } + + @Override + public IPersister<ServerConfiguration, RoundConfiguration> getPersister() { + return persister; + } } Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-03-28 06:19:54
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/f8790891fb25/ changeset: f8790891fb25 user: alllee date: 2012-03-28 08:19:55 summary: merging from stable affected #: 1 file diff -r be826810ad073d790e64021161c9432e5879d89a -r f8790891fb256820aec54fd546c4790bef9bfac2 src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java --- a/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java +++ b/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java @@ -160,6 +160,11 @@ addEventProcessor(new EventTypeProcessor<ShowRequest>(ShowRequest.class, true) { @Override public void handle(ShowRequest request) { + /* + if (stateMachine.state == IrrigationServerState.ROUND_IN_PROGRESS) { + sendFacilitatorMessage("Ignoring request: " + request + " - round is currently running"); + } + */ if (request.getId().equals(getFacilitatorId())) { synchronized (clients) { for (Identifier id: clients.keySet()) { @@ -333,7 +338,9 @@ // reset group's available flow and re-allocate water to each participant in this group group.resetCurrentlyAvailableFlowCapacity(); int timeLeft = (int) (currentRoundDuration.getTimeLeft() / 1000); - // allocate flow to each participant + // allocate flow to each participant - this works because GroupDataModel uses a LinkedHashMap that preserves + // iteration order (initial order of participants added to the group), otherwise we'd have to sort by priority + // string for (ClientData clientData : group.getClientDataMap().values()) { // for undisrupted flow extensions, disabled for the time being. // if (clientData.getAvailableFlowCapacity() <= 0 && getConfiguration().isUndisruptedFlowRequired()){ @@ -416,13 +423,11 @@ } private void stopRound() { - state = IrrigationServerState.WAITING; sendEndRoundEvents(); persistRound(); cleanupRound(); - // FIXME: have to wait for .... some reason? - Utils.sleep(2000); advanceToNextRound(); + state = IrrigationServerState.WAITING; } private void sendEndRoundEvents() { @@ -449,6 +454,7 @@ } private void persistRound() { + logger.debug("Saving round data"); persister.persist(serverDataModel); } Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-03-28 06:19:34
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/3c3206f54782/ changeset: 3c3206f54782 branch: stable user: alllee date: 2012-03-28 08:19:33 summary: adding more debug statements affected #: 1 file diff -r 944a7083d27e8214d72084f705f6eeb32e04cbc0 -r 3c3206f547823a2d2d5694c88666ce85d87cf9c6 src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java --- a/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java +++ b/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java @@ -160,6 +160,11 @@ addEventProcessor(new EventTypeProcessor<ShowRequest>(ShowRequest.class, true) { @Override public void handle(ShowRequest request) { + /* + if (stateMachine.state == IrrigationServerState.ROUND_IN_PROGRESS) { + sendFacilitatorMessage("Ignoring request: " + request + " - round is currently running"); + } + */ if (request.getId().equals(getFacilitatorId())) { synchronized (clients) { for (Identifier id: clients.keySet()) { @@ -333,7 +338,9 @@ // reset group's available flow and re-allocate water to each participant in this group group.resetCurrentlyAvailableFlowCapacity(); int timeLeft = (int) (currentRoundDuration.getTimeLeft() / 1000); - // allocate flow to each participant + // allocate flow to each participant - this works because GroupDataModel uses a LinkedHashMap that preserves + // iteration order (initial order of participants added to the group), otherwise we'd have to sort by priority + // string for (ClientData clientData : group.getClientDataMap().values()) { // for undisrupted flow extensions, disabled for the time being. // if (clientData.getAvailableFlowCapacity() <= 0 && getConfiguration().isUndisruptedFlowRequired()){ @@ -416,13 +423,11 @@ } private void stopRound() { - state = IrrigationServerState.WAITING; sendEndRoundEvents(); persistRound(); cleanupRound(); - // FIXME: have to wait for .... some reason? - Utils.sleep(2000); advanceToNextRound(); + state = IrrigationServerState.WAITING; } private void sendEndRoundEvents() { @@ -449,6 +454,7 @@ } private void persistRound() { + logger.debug("Saving round data"); persister.persist(serverDataModel); } Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-03-28 05:55:07
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/944a7083d27e/ changeset: 944a7083d27e branch: stable user: alllee date: 2012-03-28 07:55:06 summary: merging improvements to facilitator and instructions back into stable branch affected #: 9 files diff -r 4e044b944d4a03c4b0089891fa10b18b76fe69d0 -r 944a7083d27e8214d72084f705f6eeb32e04cbc0 ivy.xml --- a/ivy.xml +++ b/ivy.xml @@ -7,5 +7,6 @@ <dependencies><dependency org="edu.asu.commons" name="csidex" rev="0.5-SNAPSHOT"/><dependency org="org.jfree" name="jfreechart" rev="1.0.14"/> + <dependency org="javax.jnlp" name="javaws" rev="1.6.0_30"/></dependencies></ivy-module> diff -r 4e044b944d4a03c4b0089891fa10b18b76fe69d0 -r 944a7083d27e8214d72084f705f6eeb32e04cbc0 pom.xml --- a/pom.xml +++ b/pom.xml @@ -54,6 +54,12 @@ <artifactId>forms</artifactId><version>1.1.0</version></dependency> + <dependency> + <groupId>javax.jnlp</groupId> + <artifactId>javaws</artifactId> + <version>1.6.0_30</version> + <scope>provided</scope> + </dependency></dependencies><build><finalName>irrigation</finalName> diff -r 4e044b944d4a03c4b0089891fa10b18b76fe69d0 -r 944a7083d27e8214d72084f705f6eeb32e04cbc0 src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java @@ -9,6 +9,7 @@ import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JLabel; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; @@ -21,6 +22,7 @@ import edu.asu.commons.irrigation.events.ShowGameScreenshotRequest; import edu.asu.commons.irrigation.events.ShowQuizRequest; import edu.asu.commons.ui.HtmlEditorPane; +import edu.asu.commons.ui.HtmlSelection; import edu.asu.commons.ui.UserInterfaceUtils; /** @@ -59,6 +61,8 @@ private JButton stopRoundButton; + private JButton copyToClipboardButton; + /** * This is the default constructor */ @@ -81,6 +85,7 @@ addToBoxLayout(buttonPanel, getShowQuizButton()); addToBoxLayout(buttonPanel, getStartRoundOverrideButton()); addToBoxLayout(buttonPanel, getStopRoundButton()); + addToBoxLayout(buttonPanel, getCopyToClipboardButton()); add(buttonPanel, BorderLayout.NORTH); informationEditorPane = UserInterfaceUtils.createInstructionsEditorPane(); informationScrollPane = new JScrollPane(informationEditorPane); @@ -104,6 +109,36 @@ splitPane.setResizeWeight(proportion); } + private JButton getCopyToClipboardButton() { + // create copy to clipboard menu item + if (copyToClipboardButton == null) { + copyToClipboardButton = new JButton("Copy to clipboard"); + copyToClipboardButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String text = informationEditorPane.getSelectedText(); + if (text == null || text.trim().isEmpty()) { + addMessage("No text selected, copying all text in the editor pane to the clipboard."); + text = informationEditorPane.getText(); + if (text == null || text.trim().isEmpty()) { + // if text is still empty, give up + JOptionPane.showMessageDialog(FacilitatorWindow.this, "Unable to find any text to copy to the clipboard."); + return; + } + } + if (UserInterfaceUtils.getClipboardService() != null) { + HtmlSelection selection = new HtmlSelection(text); + UserInterfaceUtils.getClipboardService().setContents(selection); + } + else { + addMessage("Clipboard service is not available."); + } + } + }); + } + return copyToClipboardButton; + } + private void addToBoxLayout(JPanel buttonPanel, JButton button) { buttonPanel.add(button); buttonPanel.add(Box.createHorizontalStrut(5)); diff -r 4e044b944d4a03c4b0089891fa10b18b76fe69d0 -r 944a7083d27e8214d72084f705f6eeb32e04cbc0 src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java --- a/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java +++ b/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java @@ -119,7 +119,7 @@ } // ignore the request if not every group has submit their tokens. if (isTokenInvestmentComplete()) { - sendFacilitatorMessage("Starting round."); + sendFacilitatorMessage("Starting actual round."); synchronized (roundSignal) { roundSignal.notifyAll(); } @@ -274,9 +274,9 @@ private volatile int numberOfCompletedQuizzes = 0; @Override public void handle(QuizResponseEvent quizResponseEvent) { - sendFacilitatorMessage("Received quiz response: " + quizResponseEvent); clients.get(quizResponseEvent.getId()).addCorrectQuizAnswers(quizResponseEvent.getNumberOfCorrectQuizAnswers()); numberOfCompletedQuizzes++; + sendFacilitatorMessage(String.format("%d/%d quiz response: %s", numberOfCompletedQuizzes, clients.size(), quizResponseEvent)); if (numberOfCompletedQuizzes >= clients.size()) { sendFacilitatorMessage("All quizzes completed: " + numberOfCompletedQuizzes); numberOfCompletedQuizzes = 0; @@ -443,6 +443,7 @@ getConfiguration().isLastRound())); } } + sendFacilitatorMessage("Round ended, ready to begin chat again"); transmit(new FacilitatorEndRoundEvent(getFacilitatorId(), serverDataModel)); } diff -r 4e044b944d4a03c4b0089891fa10b18b76fe69d0 -r 944a7083d27e8214d72084f705f6eeb32e04cbc0 src/main/resources/configuration/asu/2011/pretest/irrigation.xml --- a/src/main/resources/configuration/asu/2011/pretest/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/pretest/irrigation.xml @@ -4,6 +4,8 @@ <comment>Irrigation experiment server configuration</comment><entry key="hostname">@SERVER_ADDRESS@</entry><entry key="port">@PORT_NUMBER@</entry> + +<entry key="number-of-rounds">22</entry><entry key="round0">round0.xml</entry><entry key="round1">round1.xml</entry><entry key="round2">round2.xml</entry> @@ -30,7 +32,8 @@ <entry key='token-endowment'>10</entry><entry key='field-of-vision'>1</entry><entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> + +<entry key='chat-duration'>60</entry><entry key='round-duration'>50</entry><entry key="q1">49</entry> @@ -408,13 +411,14 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment</h2> + <h2>Payment: You Are Computer Number {clientData.id.stationNumber}</h2><hr><p> + <b>Please note the computer number listed above and write it on your survey.</b> When payments are ready we will call you up one by one. Please wait until - your computer number, <b>{clientData.id}</b>, is called to turn in your + your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. - NOTE: Please <b>answer the survey completely (there may be a back side)</b> + <b>NOTE: Please answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive your payment to help us speed up the payment process. </p> @@ -485,7 +489,7 @@ <table border=1 cellspacing=3 cellpadding=3><tr><th>Participant</th><th>Current tokens</th><th>Current income</th><th>Quiz earnings</th><th>Total income</th></tr> {clientDataList: {data | -<tr align="RIGHT"><td>{data.id}</td><td>{data.allTokensEarnedThisRound}</td><td>{data.totalDollarsEarnedThisRound}</td><td>{data.quizEarnings}</td><td>{data.grandTotalIncome}</td></tr> +<tr align="RIGHT"><td>{data}</td><td>{data.allTokensEarnedThisRound}</td><td>{data.totalDollarsEarnedThisRound}</td><td>{data.quizEarnings}</td><td>{data.grandTotalIncome}</td></tr> }} </table> {if (self.lastRound)} diff -r 4e044b944d4a03c4b0089891fa10b18b76fe69d0 -r 944a7083d27e8214d72084f705f6eeb32e04cbc0 src/main/resources/configuration/asu/2011/t1/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t1/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t1/irrigation.xml @@ -4,6 +4,8 @@ <comment>Irrigation experiment server configuration</comment><entry key="hostname">@SERVER_ADDRESS@</entry><entry key="port">@PORT_NUMBER@</entry> + +<entry key="number-of-rounds">22</entry><entry key="round0">round0.xml</entry><entry key="round1">round1.xml</entry><entry key="round2">round2.xml</entry> @@ -30,7 +32,8 @@ <entry key='token-endowment'>10</entry><entry key='field-of-vision'>1</entry><entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> + +<entry key='chat-duration'>60</entry><entry key='round-duration'>50</entry><entry key="q1">49</entry> @@ -408,13 +411,14 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment</h2> + <h2>Payment: You Are Computer Number {clientData.id.stationNumber}</h2><hr><p> + <b>Please note the computer number listed above and write it on your survey.</b> When payments are ready we will call you up one by one. Please wait until - your computer number, <b>{clientData.id}</b>, is called to turn in your + your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. - NOTE: Please <b>answer the survey completely (there may be a back side)</b> + <b>NOTE: Please answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive your payment to help us speed up the payment process. </p> @@ -485,7 +489,7 @@ <table border=1 cellspacing=3 cellpadding=3><tr><th>Participant</th><th>Current tokens</th><th>Current income</th><th>Quiz earnings</th><th>Total income</th></tr> {clientDataList: {data | -<tr align="RIGHT"><td>{data.id}</td><td>{data.allTokensEarnedThisRound}</td><td>{data.totalDollarsEarnedThisRound}</td><td>{data.quizEarnings}</td><td>{data.grandTotalIncome}</td></tr> +<tr align="RIGHT"><td>{data}</td><td>{data.allTokensEarnedThisRound}</td><td>{data.totalDollarsEarnedThisRound}</td><td>{data.quizEarnings}</td><td>{data.grandTotalIncome}</td></tr> }} </table> {if (self.lastRound)} diff -r 4e044b944d4a03c4b0089891fa10b18b76fe69d0 -r 944a7083d27e8214d72084f705f6eeb32e04cbc0 src/main/resources/configuration/asu/2011/t2/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t2/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t2/irrigation.xml @@ -4,6 +4,8 @@ <comment>Irrigation experiment server configuration</comment><entry key="hostname">@SERVER_ADDRESS@</entry><entry key="port">@PORT_NUMBER@</entry> + +<entry key="number-of-rounds">22</entry><entry key="round0">round0.xml</entry><entry key="round1">round1.xml</entry><entry key="round2">round2.xml</entry> @@ -30,7 +32,8 @@ <entry key='token-endowment'>10</entry><entry key='field-of-vision'>1</entry><entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> + +<entry key='chat-duration'>60</entry><entry key='round-duration'>50</entry><entry key="q1">49</entry> @@ -408,13 +411,14 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment</h2> + <h2>Payment: You Are Computer Number {clientData.id.stationNumber}</h2><hr><p> + <b>Please note the computer number listed above and write it on your survey.</b> When payments are ready we will call you up one by one. Please wait until - your computer number, <b>{clientData.id}</b>, is called to turn in your + your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. - NOTE: Please <b>answer the survey completely (there may be a back side)</b> + <b>NOTE: Please answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive your payment to help us speed up the payment process. </p> @@ -485,7 +489,7 @@ <table border=1 cellspacing=3 cellpadding=3><tr><th>Participant</th><th>Current tokens</th><th>Current income</th><th>Quiz earnings</th><th>Total income</th></tr> {clientDataList: {data | -<tr align="RIGHT"><td>{data.id}</td><td>{data.allTokensEarnedThisRound}</td><td>{data.totalDollarsEarnedThisRound}</td><td>{data.quizEarnings}</td><td>{data.grandTotalIncome}</td></tr> +<tr align="RIGHT"><td>{data}</td><td>{data.allTokensEarnedThisRound}</td><td>{data.totalDollarsEarnedThisRound}</td><td>{data.quizEarnings}</td><td>{data.grandTotalIncome}</td></tr> }} </table> {if (self.lastRound)} diff -r 4e044b944d4a03c4b0089891fa10b18b76fe69d0 -r 944a7083d27e8214d72084f705f6eeb32e04cbc0 src/main/resources/configuration/asu/2011/t3/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t3/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t3/irrigation.xml @@ -4,6 +4,8 @@ <comment>Irrigation experiment server configuration</comment><entry key="hostname">@SERVER_ADDRESS@</entry><entry key="port">@PORT_NUMBER@</entry> + +<entry key="number-of-rounds">22</entry><entry key="round0">round0.xml</entry><entry key="round1">round1.xml</entry><entry key="round2">round2.xml</entry> @@ -30,7 +32,8 @@ <entry key='token-endowment'>10</entry><entry key='field-of-vision'>1</entry><entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> + +<entry key='chat-duration'>60</entry><entry key='round-duration'>50</entry><entry key="q1">49</entry> @@ -408,13 +411,14 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment</h2> + <h2>Payment: You Are Computer Number {clientData.id.stationNumber}</h2><hr><p> + <b>Please note the computer number listed above and write it on your survey.</b> When payments are ready we will call you up one by one. Please wait until - your computer number, <b>{clientData.id}</b>, is called to turn in your + your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. - NOTE: Please <b>answer the survey completely (there may be a back side)</b> + <b>NOTE: Please answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive your payment to help us speed up the payment process. </p> @@ -485,7 +489,7 @@ <table border=1 cellspacing=3 cellpadding=3><tr><th>Participant</th><th>Current tokens</th><th>Current income</th><th>Quiz earnings</th><th>Total income</th></tr> {clientDataList: {data | -<tr align="RIGHT"><td>{data.id}</td><td>{data.allTokensEarnedThisRound}</td><td>{data.totalDollarsEarnedThisRound}</td><td>{data.quizEarnings}</td><td>{data.grandTotalIncome}</td></tr> +<tr align="RIGHT"><td>{data}</td><td>{data.allTokensEarnedThisRound}</td><td>{data.totalDollarsEarnedThisRound}</td><td>{data.quizEarnings}</td><td>{data.grandTotalIncome}</td></tr> }} </table> {if (self.lastRound)} diff -r 4e044b944d4a03c4b0089891fa10b18b76fe69d0 -r 944a7083d27e8214d72084f705f6eeb32e04cbc0 src/main/resources/configuration/asu/2011/t4/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t4/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t4/irrigation.xml @@ -4,6 +4,8 @@ <comment>Irrigation experiment server configuration</comment><entry key="hostname">@SERVER_ADDRESS@</entry><entry key="port">@PORT_NUMBER@</entry> + +<entry key="number-of-rounds">22</entry><entry key="round0">round0.xml</entry><entry key="round1">round1.xml</entry><entry key="round2">round2.xml</entry> @@ -30,7 +32,8 @@ <entry key='token-endowment'>10</entry><entry key='field-of-vision'>1</entry><entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> + +<entry key='chat-duration'>60</entry><entry key='round-duration'>50</entry><entry key="q1">49</entry> @@ -408,13 +411,14 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment</h2> + <h2>Payment: You Are Computer Number {clientData.id.stationNumber}</h2><hr><p> + <b>Please note the computer number listed above and write it on your survey.</b> When payments are ready we will call you up one by one. Please wait until - your computer number, <b>{clientData.id}</b>, is called to turn in your + your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. - NOTE: Please <b>answer the survey completely (there may be a back side)</b> + <b>NOTE: Please answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive your payment to help us speed up the payment process. </p> @@ -485,7 +489,7 @@ <table border=1 cellspacing=3 cellpadding=3><tr><th>Participant</th><th>Current tokens</th><th>Current income</th><th>Quiz earnings</th><th>Total income</th></tr> {clientDataList: {data | -<tr align="RIGHT"><td>{data.id}</td><td>{data.allTokensEarnedThisRound}</td><td>{data.totalDollarsEarnedThisRound}</td><td>{data.quizEarnings}</td><td>{data.grandTotalIncome}</td></tr> +<tr align="RIGHT"><td>{data}</td><td>{data.allTokensEarnedThisRound}</td><td>{data.totalDollarsEarnedThisRound}</td><td>{data.quizEarnings}</td><td>{data.grandTotalIncome}</td></tr> }} </table> {if (self.lastRound)} Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-03-28 05:53:32
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/be826810ad07/ changeset: be826810ad07 user: alllee date: 2012-03-28 07:53:33 summary: making chat-duration explicit affected #: 5 files diff -r f878c46d71d8c5c563ea7761b77f796f665993a4 -r be826810ad073d790e64021161c9432e5879d89a src/main/resources/configuration/asu/2011/pretest/irrigation.xml --- a/src/main/resources/configuration/asu/2011/pretest/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/pretest/irrigation.xml @@ -4,6 +4,8 @@ <comment>Irrigation experiment server configuration</comment><entry key="hostname">@SERVER_ADDRESS@</entry><entry key="port">@PORT_NUMBER@</entry> + +<entry key="number-of-rounds">22</entry><entry key="round0">round0.xml</entry><entry key="round1">round1.xml</entry><entry key="round2">round2.xml</entry> @@ -30,7 +32,8 @@ <entry key='token-endowment'>10</entry><entry key='field-of-vision'>1</entry><entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> + +<entry key='chat-duration'>60</entry><entry key='round-duration'>50</entry><entry key="q1">49</entry> diff -r f878c46d71d8c5c563ea7761b77f796f665993a4 -r be826810ad073d790e64021161c9432e5879d89a src/main/resources/configuration/asu/2011/t1/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t1/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t1/irrigation.xml @@ -4,6 +4,8 @@ <comment>Irrigation experiment server configuration</comment><entry key="hostname">@SERVER_ADDRESS@</entry><entry key="port">@PORT_NUMBER@</entry> + +<entry key="number-of-rounds">22</entry><entry key="round0">round0.xml</entry><entry key="round1">round1.xml</entry><entry key="round2">round2.xml</entry> @@ -30,7 +32,8 @@ <entry key='token-endowment'>10</entry><entry key='field-of-vision'>1</entry><entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> + +<entry key='chat-duration'>60</entry><entry key='round-duration'>50</entry><entry key="q1">49</entry> diff -r f878c46d71d8c5c563ea7761b77f796f665993a4 -r be826810ad073d790e64021161c9432e5879d89a src/main/resources/configuration/asu/2011/t2/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t2/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t2/irrigation.xml @@ -4,6 +4,8 @@ <comment>Irrigation experiment server configuration</comment><entry key="hostname">@SERVER_ADDRESS@</entry><entry key="port">@PORT_NUMBER@</entry> + +<entry key="number-of-rounds">22</entry><entry key="round0">round0.xml</entry><entry key="round1">round1.xml</entry><entry key="round2">round2.xml</entry> @@ -30,7 +32,8 @@ <entry key='token-endowment'>10</entry><entry key='field-of-vision'>1</entry><entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> + +<entry key='chat-duration'>60</entry><entry key='round-duration'>50</entry><entry key="q1">49</entry> diff -r f878c46d71d8c5c563ea7761b77f796f665993a4 -r be826810ad073d790e64021161c9432e5879d89a src/main/resources/configuration/asu/2011/t3/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t3/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t3/irrigation.xml @@ -4,6 +4,8 @@ <comment>Irrigation experiment server configuration</comment><entry key="hostname">@SERVER_ADDRESS@</entry><entry key="port">@PORT_NUMBER@</entry> + +<entry key="number-of-rounds">22</entry><entry key="round0">round0.xml</entry><entry key="round1">round1.xml</entry><entry key="round2">round2.xml</entry> @@ -30,7 +32,8 @@ <entry key='token-endowment'>10</entry><entry key='field-of-vision'>1</entry><entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> + +<entry key='chat-duration'>60</entry><entry key='round-duration'>50</entry><entry key="q1">49</entry> diff -r f878c46d71d8c5c563ea7761b77f796f665993a4 -r be826810ad073d790e64021161c9432e5879d89a src/main/resources/configuration/asu/2011/t4/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t4/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t4/irrigation.xml @@ -4,6 +4,8 @@ <comment>Irrigation experiment server configuration</comment><entry key="hostname">@SERVER_ADDRESS@</entry><entry key="port">@PORT_NUMBER@</entry> + +<entry key="number-of-rounds">22</entry><entry key="round0">round0.xml</entry><entry key="round1">round1.xml</entry><entry key="round2">round2.xml</entry> @@ -30,7 +32,8 @@ <entry key='token-endowment'>10</entry><entry key='field-of-vision'>1</entry><entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">22</entry> + +<entry key='chat-duration'>60</entry><entry key='round-duration'>50</entry><entry key="q1">49</entry> Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-03-28 05:49:12
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/f878c46d71d8/ changeset: f878c46d71d8 user: alllee date: 2012-03-28 07:49:12 summary: refining exit instructions a bit more affected #: 5 files diff -r 232eb03ce7ae0e3e4e4cb74a3c00893c7fcbb382 -r f878c46d71d8c5c563ea7761b77f796f665993a4 src/main/resources/configuration/asu/2011/pretest/irrigation.xml --- a/src/main/resources/configuration/asu/2011/pretest/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/pretest/irrigation.xml @@ -408,13 +408,14 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment for Computer Number {clientData.id.stationNumber}</h2> + <h2>Payment: You Are Computer Number {clientData.id.stationNumber}</h2><hr><p> + <b>Please note the computer number listed above and write it on your survey.</b> When payments are ready we will call you up one by one. Please wait until your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. - NOTE: Please <b>answer the survey completely (there may be a back side)</b> + <b>NOTE: Please answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive your payment to help us speed up the payment process. </p> diff -r 232eb03ce7ae0e3e4e4cb74a3c00893c7fcbb382 -r f878c46d71d8c5c563ea7761b77f796f665993a4 src/main/resources/configuration/asu/2011/t1/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t1/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t1/irrigation.xml @@ -408,13 +408,14 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment for Computer Number {clientData.id.stationNumber}</h2> + <h2>Payment: You Are Computer Number {clientData.id.stationNumber}</h2><hr><p> + <b>Please note the computer number listed above and write it on your survey.</b> When payments are ready we will call you up one by one. Please wait until your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. - NOTE: Please <b>answer the survey completely (there may be a back side)</b> + <b>NOTE: Please answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive your payment to help us speed up the payment process. </p> diff -r 232eb03ce7ae0e3e4e4cb74a3c00893c7fcbb382 -r f878c46d71d8c5c563ea7761b77f796f665993a4 src/main/resources/configuration/asu/2011/t2/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t2/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t2/irrigation.xml @@ -408,13 +408,14 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment for Computer Number {clientData.id.stationNumber}</h2> + <h2>Payment: You Are Computer Number {clientData.id.stationNumber}</h2><hr><p> + <b>Please note the computer number listed above and write it on your survey.</b> When payments are ready we will call you up one by one. Please wait until your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. - NOTE: Please <b>answer the survey completely (there may be a back side)</b> + <b>NOTE: Please answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive your payment to help us speed up the payment process. </p> diff -r 232eb03ce7ae0e3e4e4cb74a3c00893c7fcbb382 -r f878c46d71d8c5c563ea7761b77f796f665993a4 src/main/resources/configuration/asu/2011/t3/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t3/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t3/irrigation.xml @@ -408,13 +408,14 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment for Computer Number {clientData.id.stationNumber}</h2> + <h2>Payment: You Are Computer Number {clientData.id.stationNumber}</h2><hr><p> + <b>Please note the computer number listed above and write it on your survey.</b> When payments are ready we will call you up one by one. Please wait until your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. - NOTE: Please <b>answer the survey completely (there may be a back side)</b> + <b>NOTE: Please answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive your payment to help us speed up the payment process. </p> diff -r 232eb03ce7ae0e3e4e4cb74a3c00893c7fcbb382 -r f878c46d71d8c5c563ea7761b77f796f665993a4 src/main/resources/configuration/asu/2011/t4/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t4/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t4/irrigation.xml @@ -408,13 +408,14 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment for Computer Number {clientData.id.stationNumber}</h2> + <h2>Payment: You Are Computer Number {clientData.id.stationNumber}</h2><hr><p> + <b>Please note the computer number listed above and write it on your survey.</b> When payments are ready we will call you up one by one. Please wait until your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. - NOTE: Please <b>answer the survey completely (there may be a back side)</b> + <b>NOTE: Please answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive your payment to help us speed up the payment process. </p> Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-03-28 05:37:11
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/232eb03ce7ae/ changeset: 232eb03ce7ae user: alllee date: 2012-03-28 07:37:09 summary: correcting facilitator message for submitted quizzes affected #: 1 file diff -r 19e743b0b18033dfabd62b5debaa0889ac47d546 -r 232eb03ce7ae0e3e4e4cb74a3c00893c7fcbb382 src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java --- a/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java +++ b/src/main/java/edu/asu/commons/irrigation/server/IrrigationServer.java @@ -274,9 +274,9 @@ private volatile int numberOfCompletedQuizzes = 0; @Override public void handle(QuizResponseEvent quizResponseEvent) { - sendFacilitatorMessage(String.format("%d/%d quiz response: %s", numberOfCompletedQuizzes, clients.size(), quizResponseEvent)); clients.get(quizResponseEvent.getId()).addCorrectQuizAnswers(quizResponseEvent.getNumberOfCorrectQuizAnswers()); numberOfCompletedQuizzes++; + sendFacilitatorMessage(String.format("%d/%d quiz response: %s", numberOfCompletedQuizzes, clients.size(), quizResponseEvent)); if (numberOfCompletedQuizzes >= clients.size()) { sendFacilitatorMessage("All quizzes completed: " + numberOfCompletedQuizzes); numberOfCompletedQuizzes = 0; Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-03-28 05:30:25
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/19e743b0b180/ changeset: 19e743b0b180 user: alllee date: 2012-03-28 07:30:20 summary: replacing station id (e.g., "Station <station-number>") with <station-number> affected #: 5 files diff -r c5d95b9aeb85b2b3129952e1b4acb4d643c09801 -r 19e743b0b18033dfabd62b5debaa0889ac47d546 src/main/resources/configuration/asu/2011/pretest/irrigation.xml --- a/src/main/resources/configuration/asu/2011/pretest/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/pretest/irrigation.xml @@ -408,11 +408,11 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment for Computer Number {clientData.id.stationId}</h2> + <h2>Payment for Computer Number {clientData.id.stationNumber}</h2><hr><p> When payments are ready we will call you up one by one. Please wait until - your computer number, <b>{clientData.id.stationId}</b>, is called to turn in your + your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. NOTE: Please <b>answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive diff -r c5d95b9aeb85b2b3129952e1b4acb4d643c09801 -r 19e743b0b18033dfabd62b5debaa0889ac47d546 src/main/resources/configuration/asu/2011/t1/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t1/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t1/irrigation.xml @@ -408,11 +408,11 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment for Computer Number {clientData.id.stationId}</h2> + <h2>Payment for Computer Number {clientData.id.stationNumber}</h2><hr><p> When payments are ready we will call you up one by one. Please wait until - your computer number, <b>{clientData.id.stationId}</b>, is called to turn in your + your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. NOTE: Please <b>answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive diff -r c5d95b9aeb85b2b3129952e1b4acb4d643c09801 -r 19e743b0b18033dfabd62b5debaa0889ac47d546 src/main/resources/configuration/asu/2011/t2/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t2/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t2/irrigation.xml @@ -408,11 +408,11 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment for Computer Number {clientData.id.stationId}</h2> + <h2>Payment for Computer Number {clientData.id.stationNumber}</h2><hr><p> When payments are ready we will call you up one by one. Please wait until - your computer number, <b>{clientData.id.stationId}</b>, is called to turn in your + your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. NOTE: Please <b>answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive diff -r c5d95b9aeb85b2b3129952e1b4acb4d643c09801 -r 19e743b0b18033dfabd62b5debaa0889ac47d546 src/main/resources/configuration/asu/2011/t3/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t3/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t3/irrigation.xml @@ -408,11 +408,11 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment for Computer Number {clientData.id.stationId}</h2> + <h2>Payment for Computer Number {clientData.id.stationNumber}</h2><hr><p> When payments are ready we will call you up one by one. Please wait until - your computer number, <b>{clientData.id.stationId}</b>, is called to turn in your + your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. NOTE: Please <b>answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive diff -r c5d95b9aeb85b2b3129952e1b4acb4d643c09801 -r 19e743b0b18033dfabd62b5debaa0889ac47d546 src/main/resources/configuration/asu/2011/t4/irrigation.xml --- a/src/main/resources/configuration/asu/2011/t4/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/t4/irrigation.xml @@ -408,11 +408,11 @@ <p> This was the last round, but not the end of the experiment. We ask that you please carefully fill out a brief survey as we prepare your payments. </p> - <h2>Payment for Computer Number {clientData.id.stationId}</h2> + <h2>Payment for Computer Number {clientData.id.stationNumber}</h2><hr><p> When payments are ready we will call you up one by one. Please wait until - your computer number, <b>{clientData.id.stationId}</b>, is called to turn in your + your computer number, <b>{clientData.id.stationNumber}</b>, is called to turn in your survey and receive payment. NOTE: Please <b>answer the survey completely (there may be a back side)</b> and <b>bring all your belongings with you</b> when you come up to receive Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: Bitbucket <com...@bi...> - 2012-03-28 04:41:33
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/8d4ab27b8999/ changeset: 8d4ab27b8999 user: alllee date: 2012-03-28 06:41:33 summary: moving ClipboardService and HtmlSelection to csidex affected #: 1 file diff -r b56c65df661e7cfe14c92ee81016c18236aeb658 -r 8d4ab27b89996b3419df205057452039823eaf49 src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java @@ -2,24 +2,13 @@ import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; -import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.util.Arrays; import java.util.HashMap; import java.util.Map; import javax.jnlp.ClipboardService; -import javax.jnlp.ServiceManager; -import javax.jnlp.UnavailableServiceException; import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JMenu; @@ -41,6 +30,7 @@ import edu.asu.commons.foraging.rules.Strategy; import edu.asu.commons.foraging.rules.iu.ForagingStrategy; import edu.asu.commons.ui.HtmlEditorPane; +import edu.asu.commons.ui.HtmlSelection; import edu.asu.commons.ui.UserInterfaceUtils; /** @@ -270,11 +260,14 @@ return; } } - ClipboardService service = getClipboardService(); + ClipboardService service = UserInterfaceUtils.getClipboardService(); if (service != null) { HtmlSelection selection = new HtmlSelection(text); service.setContents(selection); } + else { + addMessage("Clipboard service is only available when run as a WebStart application."); + } } }); @@ -418,60 +411,4 @@ } } - public ClipboardService getClipboardService() { - if (clipboardService == null) { - try { - clipboardService = (ClipboardService) ServiceManager.lookup(JAVAX_JNLP_CLIPBOARD_SERVICE); - } catch (UnavailableServiceException e) { - e.printStackTrace(); - addMessage("Unable to load the ClipboardService for all your clipboard needs. Sorry!"); - } - } - return clipboardService; - } - - private static class HtmlSelection implements Transferable { - - private static DataFlavor[] htmlFlavors = new DataFlavor[3]; - private final String html; - static { - try { - htmlFlavors[0] = new DataFlavor("text/html;class=java.lang.String"); - htmlFlavors[1] = new DataFlavor("text/html;class=java.io.Reader"); - htmlFlavors[2] = new DataFlavor("text/html;charset=unicode;class=java.io.InputStream"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - - public HtmlSelection(String html) { - this.html = html; - } - - @Override - public DataFlavor[] getTransferDataFlavors() { - return htmlFlavors; - } - - @Override - public boolean isDataFlavorSupported(DataFlavor flavor) { - return Arrays.asList(htmlFlavors).contains(flavor); - } - - @Override - public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { - if (String.class.equals(flavor.getRepresentationClass())) { - return html; - } - else if (Reader.class.equals(flavor.getRepresentationClass())) { - return new StringReader(html); - } - else if (InputStream.class.equals(flavor.getRepresentationClass())) { - return new ByteArrayInputStream(html.getBytes()); - } - throw new UnsupportedFlavorException(flavor); - } - - } - } Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |
From: A L. <iss...@bi...> - 2012-03-28 00:22:58
|
--- you can reply above this line --- New issue 39: Django 1.4 migration https://bitbucket.org/virtualcommons/vcweb/issue/39/django-14-migration A Lee / alllee on Wed, 28 Mar 2012 02:22:52 +0200: Description: Several changes need to be added: # fix datetime time zones in fixtures and in data https://docs.djangoproject.com/en/dev/topics/i18n/timezones/#time-zones-migration-guide # fixtures no longer support auto_now_add and auto_now empty fields in initial_data.json # update WSGI script as needed Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |