Thread: [virtualcommons-svn] SF.net SVN: virtualcommons:[119] mentalmodels/trunk (Page 2)
Status: Beta
Brought to you by:
alllee
From: <see...@us...> - 2009-04-23 01:08:09
|
Revision: 119 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=119&view=rev Author: seematalele Date: 2009-04-23 01:07:59 +0000 (Thu, 23 Apr 2009) Log Message: ----------- created module, block and item tables for storing the timing information. Changed the FisherExperiment.mxml so that it can communicate to the Spring. (Plz Note in the previous revision this file is not updated. But webapp/FisheryExperiment.swf is up to date according to the revision. This is because I forgot to copy the FisheryExperiment.mxml in the previous revisions.) Made the changes in the init-db.sql- Put new target drop-prev-schema. It drops the mme and create it also. Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperiment.mxml mentalmodels/trunk/flex/src/Socio_Demographic_Information.mxml mentalmodels/trunk/flex/src/Socio_demographic.mxml mentalmodels/trunk/flex/src/TableTest.mxml mentalmodels/trunk/flex/src/customComponents/InstructionPage.mxml mentalmodels/trunk/flex/src/customComponents/SocioDemographicPage.mxml mentalmodels/trunk/init-db.ant.xml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/Feed.java mentalmodels/trunk/src/main/webapp/FisheryExperiment.swf mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml mentalmodels/trunk/src/main/webapp/startfeed.jsp Added Paths: ----------- mentalmodels/trunk/src/main/db/drop-mme.sql Modified: mentalmodels/trunk/flex/src/FisheryExperiment.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperiment.mxml 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/flex/src/FisheryExperiment.mxml 2009-04-23 01:07:59 UTC (rev 119) @@ -26,24 +26,73 @@ <mx:State name="none"/> </mx:states> + + <mx:Canvas id="content" x="5" y="5" width="750" height="470"/> <mx:Canvas id="expiredContent" x="-100" y="-100" width="1" height="1" visible="false"/> <mx:Button id="btnBack" label="« Back" click="back()" left="8" bottom="8"/> <mx:Button id="btnAccept" label="Accept" click="accept()" left="375" bottom="10"/> <mx:Button id="btnForward" label="Forward »" click="forward()" right="8" bottom="8"/> - + <mx:RemoteObject id="ss" destination="studentService" fault="faultHandler(event)" result="resultHandler(event)"/> + <mx:Producer id="producer" destination="DataPush" acknowledge="ack(event)"/> + <mx:Consumer id="consumer" destination="DataPush" message="messageHandler(event.message)" /> <mx:Script> <![CDATA[ + import flash.sampler.getInvocationCount; import mx.controls.Label; import customComponents.*; + import mx.controls.Alert; + import mx.rpc.events.ResultEvent; + import mx.rpc.events.FaultEvent; + import mx.messaging.messages.IMessage; + import mx.messaging.events.MessageAckEvent; + import mx.messaging.events.MessageFaultEvent; + import mx.messaging.FlexClient; + import mx.messaging.messages.AsyncMessage; + private var shared:SharedObject; private var flushMessage:String; + [Bindable] + public var Id : uint; + [Bindable] + public var randomNumbers:String; + private function ack(event:MessageAckEvent):void + { + //chart.setVisible(true); + randomNumbers = event.message.body as String; + //Alert.show("in ack method" + randomNumbers); + } + private function resultHandler(event:ResultEvent):void + { + Id = event.result as uint; + + Alert.show("Student id is " + Id ); + consumer.disconnect(); + } + + private function faultHandler(event:FaultEvent):void + { + Alert.show("event fault is " + event.fault.faultDetail); + } + + private function handleFault(event:MessageFaultEvent):void + { + Alert.show("Message event fault is " + event.faultString); + } + + + private function messageHandler(message:IMessage):void + { + randomNumbers = message.body as String; + Alert.show( ""+randomNumbers); + } + public function init():void { - var sharedObjTest:Boolean = false; + /*var sharedObjTest:Boolean = false; if(sharedObjTest) { var got:Boolean = getLocal(); @@ -64,8 +113,21 @@ else getData().exists = true; this.addChild(getData().testLabel); + } - } + }*/ + + var msg:AsyncMessage = new AsyncMessage(); + var client:FlexClient = FlexClient.getInstance(); + //creating new msg with “New” to get current state. + msg.body = "New"; + + //producer.send(msg); + //Alert.show("message send is " + msg.body); + + + consumer.subscribe(); + } public function getData():Object { @@ -129,16 +191,26 @@ obj.visible = false; expiredContent.addChild(obj); currentState = "socioDemographic"; + //consumer.subscribe(); return true; } } if(obj is SocioDemographicPage) { + var Id:uint = 0; if( (SocioDemographicPage)(obj).accept() ) { obj.visible = false; expiredContent.addChild(obj); currentState = "planner"; + var info:SocioDemographicPage = SocioDemographicPage(obj); + + /* Alert.show(info.getGender()); + Alert.show(info.getMajor()); + Alert.show(info.getSemester()); + Alert.show(info.getYear());*/ + Id=ss.createStudent(info.getYear(), info.getSemester(), info.getGender(),info.getMajor()); + Alert.show("Before invoking createstudent()"); return true; } } @@ -149,6 +221,7 @@ obj.visible = false; expiredContent.addChild(obj); currentState = "none"; + return true; } } @@ -156,6 +229,8 @@ return false; } + + ]]> </mx:Script> Modified: mentalmodels/trunk/flex/src/Socio_Demographic_Information.mxml =================================================================== --- mentalmodels/trunk/flex/src/Socio_Demographic_Information.mxml 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/flex/src/Socio_Demographic_Information.mxml 2009-04-23 01:07:59 UTC (rev 119) @@ -32,10 +32,10 @@ </mx:FormItem> <mx:FormItem label="Gender" id="frmitemGender" horizontalAlign="left" fontSize="14" required="true"> <mx:RadioButtonGroup id="gender"/> - <mx:RadioButton id="male" groupName="gender"> + <mx:RadioButton id="male" groupName="{gender}"> <mx:label>Male</mx:label> </mx:RadioButton> - <mx:RadioButton id="female" groupName="gender"> + <mx:RadioButton id="female" groupName="{gender}"> <mx:label>Female</mx:label> </mx:RadioButton> Modified: mentalmodels/trunk/flex/src/Socio_demographic.mxml =================================================================== --- mentalmodels/trunk/flex/src/Socio_demographic.mxml 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/flex/src/Socio_demographic.mxml 2009-04-23 01:07:59 UTC (rev 119) @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="80%"> - - - <mx:VBox height="100%" id="vboxGatherInfo" width="100%"> <mx:HBox horizontalAlign="center" verticalAlign="middle" id="hboxSocio_demographic_info"> <mx:Label text="Socio-demographic Information" id="lblHeading" enabled="true" fontSize="16" color="#230869" textAlign="center" fontWeight="bold"/> Modified: mentalmodels/trunk/flex/src/TableTest.mxml =================================================================== --- mentalmodels/trunk/flex/src/TableTest.mxml 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/flex/src/TableTest.mxml 2009-04-23 01:07:59 UTC (rev 119) @@ -2,7 +2,6 @@ <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="customComponents.*" layout="absolute"> <mx:VBox> - <comp:InstructionPage id="instructionPage"/> <mx:HBox id="cast"> <!--<comp:Forecast id="legacy" numColumns="10"/>--> <comp:Forecast1 id="forecastPeople" numColumns="15" minValue="0" maxValue="30" initialize="init()"/> @@ -19,8 +18,7 @@ public function init():void { -instructionPage.txt.htmlText = "this is a test <img src=\"http://www.google.com/intl/en_ALL/images/logo.gif\"><br>asdfghjkl;"; -//for(var x:Number=0;x<4;x++)for(var y:Number=0;y<15;y++)forecastPeople.setItem(x,y,7.5); + for(var x:Number=0;x<4;x++)for(var y:Number=0;y<15;y++)forecastPeople.setItem(x,y,7.5); } public function testNext(evt:Event=null):void Modified: mentalmodels/trunk/flex/src/customComponents/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/InstructionPage.mxml 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/flex/src/customComponents/InstructionPage.mxml 2009-04-23 01:07:59 UTC (rev 119) @@ -1,10 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="customComponents.*" initialize="init()"> - <mx:Text width="800" height="300" id="html"> - <mx:htmlText/> - </mx:Text> - <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; Modified: mentalmodels/trunk/flex/src/customComponents/SocioDemographicPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/SocioDemographicPage.mxml 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/flex/src/customComponents/SocioDemographicPage.mxml 2009-04-23 01:07:59 UTC (rev 119) @@ -80,8 +80,9 @@ <mx:HBox> <mx:Label text="Gender:" fontWeight="bold" width="100" textAlign="right"/> <mx:HBox id="boxGender"> - <mx:RadioButton groupName="gender" label="M" id="radioMale"/> - <mx:RadioButton groupName="gender" label="F" id="radioFemale"/> + <mx:RadioButtonGroup id="gender"/> + <mx:RadioButton groupName="{gender}" label="M" id="radioMale"/> + <mx:RadioButton groupName="{gender}" label="F" id="radioFemale"/> </mx:HBox> </mx:HBox> Modified: mentalmodels/trunk/init-db.ant.xml =================================================================== --- mentalmodels/trunk/init-db.ant.xml 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/init-db.ant.xml 2009-04-23 01:07:59 UTC (rev 119) @@ -35,8 +35,9 @@ <echo message='compile classpath: ${compile.classpath}'/> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${compile.classpath}"/> - <target name="init-db" depends="create-db-schema"/> - <target name='create-db-schema'> + <target name="help"/> + <target name="init-db" depends="create-db-tables"/> + <target name='create-db-tables' depends="drop-prev-schema"> <mkdir dir='${db.generated.dir}'/> <echo message="You must have valid database connection information within hibernate.properties for this task to succeed."/> <hibernatetool destdir='${db.generated.dir}'> @@ -47,6 +48,16 @@ </hibernatetool> </target> + + <target name="drop-prev-schema"> + <sql driver="${hibernate.connection.driver_class}" + url="${hibernate.connection.url}" + userid="${hibernate.connection.username}" + password="${hibernate.connection.password}" + classpath="${compile.classpath}" + + src="${db.dir}/drop-mme.sql"/> + </target> <target name='create-indexes'> <sql onerror='continue' autocommit='true' driver="${hibernate.connection.driver_class}" url="${hibernate.connection.url}" userid="${hibernate.connection.username}" password="${hibernate.connection.password}" classpath="${compile.classpath}"> <transaction src="${db.dir}/create-indexes.sql"/> Added: mentalmodels/trunk/src/main/db/drop-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/drop-mme.sql (rev 0) +++ mentalmodels/trunk/src/main/db/drop-mme.sql 2009-04-23 01:07:59 UTC (rev 119) @@ -0,0 +1,2 @@ +drop schema mme; +create schema mme; \ No newline at end of file Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java 2009-04-23 01:07:59 UTC (rev 119) @@ -47,7 +47,7 @@ private String img_address; @OneToMany - private List<RoundConfig> roundconfig= new ArrayList<RoundConfig>(); + private List<RoundConfig> roundConfig; public void setId(Long id) { @@ -106,10 +106,10 @@ return img_address; } public void setRoundconfig(List<RoundConfig> roundconfig) { - this.roundconfig = roundconfig; + this.roundConfig = roundconfig; } public List<RoundConfig> getRoundconfig() { - return roundconfig; + return roundConfig; } public void setTimestamp(Timestamp timestamp) { this.timestamp = timestamp; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/Feed.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/Feed.java 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/Feed.java 2009-04-23 01:07:59 UTC (rev 119) @@ -46,21 +46,23 @@ while (running) { + try { + Thread.sleep(50000); + running = false; + } catch (InterruptedException e) { + } AsyncMessage msg = new AsyncMessage(); msg.setDestination("DataPush"); //msg.setHeader("DSSubtopic", "hello"); msg.setClientId(clientID); msg.setMessageId(UUIDUtils.createUUID()); msg.setTimestamp(System.currentTimeMillis()); - msg.setBody("this is a server push message"); + msg.setBody("Sorry time is expired!!! You can not Login."); System.out.println("Message broker is: "+ msgBroker); System.out.println("Message is: "+ msg); msgBroker.routeMessageToService(msg, null); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - } + } } Modified: mentalmodels/trunk/src/main/webapp/FisheryExperiment.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml 2009-04-23 01:07:59 UTC (rev 119) @@ -49,7 +49,7 @@ </channel-definition> <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> - <endpoint url="http://{server.name}:{server.port}/{context.root}/msgbroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> </channel-definition> <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel"> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-04-23 01:07:59 UTC (rev 119) @@ -24,9 +24,13 @@ - <mapping class='edu.asu.commons.mme.entity.Categorical'/> + <mapping class='edu.asu.commons.mme.entity.Categorical'/> <mapping class='edu.asu.commons.mme.entity.Psychometric'/> <mapping class='edu.asu.commons.mme.entity.StudentResponse'/> + + <mapping class='edu.asu.commons.mme.entity.Module'/> + <mapping class='edu.asu.commons.mme.entity.Block'/> + <mapping class='edu.asu.commons.mme.entity.Item'/> Modified: mentalmodels/trunk/src/main/webapp/startfeed.jsp =================================================================== --- mentalmodels/trunk/src/main/webapp/startfeed.jsp 2009-04-21 23:59:22 UTC (rev 118) +++ mentalmodels/trunk/src/main/webapp/startfeed.jsp 2009-04-23 01:07:59 UTC (rev 119) @@ -3,8 +3,8 @@ try { Feed feed = new Feed(); feed.start(); - out.println("Feed Started"); + out.println("Server started to accept the students."); } catch (Exception e) { - out.println("A problem occured while starting the feed: "+e.getMessage()); + out.println("A problem occured while starting the server: "+e.getMessage()); } %> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-04-28 19:36:26
|
Revision: 121 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=121&view=rev Author: seematalele Date: 2009-04-28 19:36:09 +0000 (Tue, 28 Apr 2009) Log Message: ----------- Changed the ModuleService class. Added actionscript classes - Module.as, QuestionGroup.as, RoundConfig.as, Block.as. Chnaged the variable name from maxtime to duration in module and block enetities. Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperiment.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Categorical.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Forecasting.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/LocationConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Question.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentResponse.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentRoundConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java mentalmodels/trunk/src/main/webapp/FisheryExperiment.swf Modified: mentalmodels/trunk/flex/src/FisheryExperiment.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperiment.mxml 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/flex/src/FisheryExperiment.mxml 2009-04-28 19:36:09 UTC (rev 121) @@ -35,10 +35,12 @@ <mx:Button id="btnAccept" label="Accept" click="accept()" left="375" bottom="10"/> <mx:Button id="btnForward" label="Forward »" click="forward()" right="8" bottom="8"/> <mx:RemoteObject id="ss" destination="studentService" fault="faultHandler(event)" result="resultHandler(event)"/> + <mx:RemoteObject id="mod" destination="moduleService" fault="faultHandler(event)" result="resultHandlerModule(event)"/> <mx:Producer id="producer" destination="DataPush" acknowledge="ack(event)"/> <mx:Consumer id="consumer" destination="DataPush" message="messageHandler(event.message)" /> <mx:Script> <![CDATA[ + import actionscript.Module; import flash.sampler.getInvocationCount; import mx.controls.Label; import customComponents.*; @@ -58,7 +60,12 @@ public var Id : uint; [Bindable] + public var module:Module; + + [Bindable] public var randomNumbers:String; + + private function ack(event:MessageAckEvent):void { //chart.setVisible(true); @@ -70,9 +77,15 @@ Id = event.result as uint; Alert.show("Student id is " + Id ); - consumer.disconnect(); + //consumer.disconnect(); } - + private function resultHandlerModule(event:ResultEvent):void + { + module = Module(event.result); + + Alert.show("duration is " + module.duration ); + + } private function faultHandler(event:FaultEvent):void { Alert.show("event fault is " + event.fault.faultDetail); @@ -117,17 +130,19 @@ } }*/ - var msg:AsyncMessage = new AsyncMessage(); - var client:FlexClient = FlexClient.getInstance(); + // var msg:AsyncMessage = new AsyncMessage(); + //var client:FlexClient = FlexClient.getInstance(); //creating new msg with “New” to get current state. - msg.body = "New"; + //msg.body = "New"; //producer.send(msg); //Alert.show("message send is " + msg.body); - consumer.subscribe(); + //consumer.subscribe(); + module = mod.getFirstPage(); + } public function getData():Object { @@ -211,6 +226,7 @@ Alert.show(info.getYear());*/ Id=ss.createStudent(info.getYear(), info.getSemester(), info.getGender(),info.getMajor()); Alert.show("Before invoking createstudent()"); + return true; } } Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-04-28 19:36:09 UTC (rev 121) @@ -22,26 +22,26 @@ insert into round_config_location_config(roundconfig_id,locationconfig_id) values(2,4); -insert into module(description, sequence_no, maxtime) values("Pre-Experiment",1,18); -insert into module(description, sequence_no, maxtime) values("Game Round 1",2,57.0); -insert into module(description, sequence_no, maxtime) values("Communication Round",3,14); -insert into module(description, sequence_no, maxtime) values("Game Round 2",4,29); -insert into module(description, sequence_no, maxtime) values("Post-Experiment",5,4); +insert into module(description, sequence_no, duration) values("Pre-Experiment",1,18); +insert into module(description, sequence_no, duration) values("Game Round 1",2,57.0); +insert into module(description, sequence_no, duration) values("Communication Round",3,14); +insert into module(description, sequence_no, duration) values("Game Round 2",4,29); +insert into module(description, sequence_no, duration) values("Post-Experiment",5,4); -insert into block(description, sequence_no, maxtime,module_id) values("Introduction",1,18,1); -insert into block(description, sequence_no, maxtime,module_id) values("Design Strategy",1,18,2); -insert into block(description, sequence_no, maxtime,module_id) values("Characterizing own strategy",2,17,2); -insert into block(description, sequence_no, maxtime,module_id) values("Editing strategy",3,5,2); -insert into block(description, sequence_no, maxtime,module_id) values("Day-by-day decisions game",4,6,2); -insert into block(description, sequence_no, maxtime,module_id) values("Evaluation of Outcomes",5,11,2); -insert into block(description, sequence_no, maxtime,module_id) values("Communication",1,14,3); -insert into block(description, sequence_no, maxtime,module_id) values("Design Strategy",1,5,4); -insert into block(description, sequence_no, maxtime,module_id) values("Characterizing own strategy",2,9,4); -insert into block(description, sequence_no, maxtime,module_id) values("Editing strategy",3,3,4); -insert into block(description, sequence_no, maxtime,module_id) values("Day-by-day decisions game",4,6,4); -insert into block(description, sequence_no, maxtime,module_id) values("Evaluation of Outcomes",5,6,4); -insert into block(description, sequence_no, maxtime,module_id) values("Final data gathering",1,2,4); -insert into block(description, sequence_no, maxtime,module_id) values("Debriefing",2,2,4); +insert into block(description, sequence_no, duration,module_id) values("Introduction",1,18,1); +insert into block(description, sequence_no, duration,module_id) values("Design Strategy",1,18,2); +insert into block(description, sequence_no, duration,module_id) values("Characterizing own strategy",2,17,2); +insert into block(description, sequence_no, duration,module_id) values("Editing strategy",3,5,2); +insert into block(description, sequence_no, duration,module_id) values("Day-by-day decisions game",4,6,2); +insert into block(description, sequence_no, duration,module_id) values("Evaluation of Outcomes",5,11,2); +insert into block(description, sequence_no, duration,module_id) values("Communication",1,14,3); +insert into block(description, sequence_no, duration,module_id) values("Design Strategy",1,5,4); +insert into block(description, sequence_no, duration,module_id) values("Characterizing own strategy",2,9,4); +insert into block(description, sequence_no, duration,module_id) values("Editing strategy",3,3,4); +insert into block(description, sequence_no, duration,module_id) values("Day-by-day decisions game",4,6,4); +insert into block(description, sequence_no, duration,module_id) values("Evaluation of Outcomes",5,6,4); +insert into block(description, sequence_no, duration,module_id) values("Final data gathering",1,2,4); +insert into block(description, sequence_no, duration,module_id) values("Debriefing",2,2,4); insert into question_group(block_id,sequence_no,header,description)values(1,1,"Welcome to the E-Fishery Experiment", "In this experiment you will design a strategy to fish an abstract fishing ground together with three other persons. As we are mainly interested in the reasons why you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no \x91correct\x92 or \x91wrong\x92 strategies and no \x91correct\x92 or \x91wrong\x92 answers. However, since for each pound of fish you get during the experiment you will receive #.### US$, you might be interested in finding a strategy that fits your goals well. For this, you have to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group."); Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,9 +1,11 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; @@ -14,8 +16,13 @@ @Entity @Table(name="block") -public class Block { +public class Block implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + @Id @GeneratedValue private Long id; @@ -27,7 +34,7 @@ private String description; @Column(nullable=false) - private Float maxtime; + private Integer duration; @ManyToOne @@ -62,14 +69,8 @@ return description; } - public void setTime(Float maxtime) { - this.maxtime = maxtime; - } + - public Float getTime() { - return maxtime; - } - public void setModule(Module module) { this.module = module; } @@ -86,4 +87,12 @@ return questionGroup; } + public void setDuration(Integer duration) { + this.duration = duration; + } + + public Integer getDuration() { + return duration; + } + } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Categorical.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Categorical.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Categorical.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,6 +1,7 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; import java.util.List; import java.util.Map; @@ -13,9 +14,13 @@ @Entity @Table(name="categorical") -public class Categorical extends Question { +public class Categorical extends Question implements Serializable{ +/** + * + */ + private static final long serialVersionUID = 1L; /* @CollectionOfElements @IndexColumn(name = "choices", base=1, nullable=false) */ Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Communication.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,6 +1,7 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; import java.sql.Timestamp; import java.util.Date; import javax.persistence.Column; @@ -18,8 +19,13 @@ @Entity @Table(name="communication") -public class Communication { +public class Communication implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + @Id @GeneratedValue private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DayOutput.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,6 +1,8 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -11,8 +13,13 @@ @Entity @Table(name="student_day_output") -public class DayOutput { +public class DayOutput implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + @Id @GeneratedValue private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Forecasting.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Forecasting.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Forecasting.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,6 +1,8 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; + import javax.persistence.Entity; import javax.persistence.Table; import javax.persistence.Column; @@ -8,7 +10,11 @@ @Entity @Table(name="forecasting") -public class Forecasting extends Question { +public class Forecasting extends Question implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; @Column(name="day_no",nullable=false) private Integer dayNo; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameConfig.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,11 +1,13 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Lob; @@ -14,8 +16,13 @@ @Entity @Table(name="game") -public class GameConfig { +public class GameConfig implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + @Id @GeneratedValue private Long id; @@ -46,7 +53,7 @@ private Float money; private String img_address; - @OneToMany + @OneToMany(fetch=FetchType.EAGER) private List<RoundConfig> roundConfig; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,6 +1,8 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -17,8 +19,13 @@ */ @Entity @Table(name="grp") -public class Group { +public class Group implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + @Id @GeneratedValue private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/LocationConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/LocationConfig.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/LocationConfig.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,5 +1,6 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; import java.util.Set; import javax.persistence.Column; @@ -12,8 +13,13 @@ @Entity @Table(name = "location_config") -public class LocationConfig { +public class LocationConfig implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + @Id @GeneratedValue private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,10 +1,12 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; @@ -14,8 +16,13 @@ @Entity @Table(name="module") -public class Module { +public class Module implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + @Id @GeneratedValue private Long id; @@ -27,7 +34,7 @@ private String description; @Column(nullable=false) - private Float maxtime; + private Integer duration; @OneToMany private List<Block> block= new ArrayList<Block>(); @@ -56,14 +63,8 @@ return description; } - public void setTime(Float time) { - this.maxtime = time; - } + - public Float getTime() { - return maxtime; - } - public void setBlock(List<Block> block) { this.block = block; } @@ -71,6 +72,14 @@ public List<Block> getBlock() { return block; } + + public void setDuration(Integer duration) { + this.duration = duration; + } + + public Integer getDuration() { + return duration; + } } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java 2009-04-28 19:36:09 UTC (rev 121) @@ -2,6 +2,7 @@ +import java.io.Serializable; import java.util.List; import javax.persistence.Column; @@ -12,9 +13,14 @@ @Entity @Table(name="psychometric") -public class Psychometric extends Question { +public class Psychometric extends Question implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + @Column(nullable=false) private String scale; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Question.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Question.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Question.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,6 +1,7 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; import java.util.Set; import javax.persistence.Column; @@ -18,7 +19,12 @@ @Entity @Table(name="question") @Inheritance(strategy = InheritanceType.JOINED) -public class Question { +public class Question implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + @Id @GeneratedValue private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,6 +1,7 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; import java.util.Set; import javax.persistence.Column; @@ -19,7 +20,13 @@ */ @Entity @Table(name="question_group") -public class QuestionGroup { +public class QuestionGroup implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id @GeneratedValue private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,6 +1,7 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; import java.util.Set; import javax.persistence.CascadeType; @@ -20,7 +21,12 @@ @Entity @Table(name="round_config") -public class RoundConfig { +public class RoundConfig implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,5 +1,7 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -13,9 +15,14 @@ @Entity @Table(name="student") -public class Student { +public class Student implements Serializable{ - @Id + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id @GeneratedValue private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentResponse.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentResponse.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentResponse.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,6 +1,8 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; + import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -11,8 +13,13 @@ @Entity @Table(name="student_response") -public class StudentResponse { +public class StudentResponse implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + @Id @GeneratedValue private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentRoundConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentRoundConfig.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentRoundConfig.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,5 +1,7 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -13,10 +15,15 @@ @Entity @Table(name="student_round_config") -public class StudentRoundConfig { +public class StudentRoundConfig implements Serializable { - @Id + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id @GeneratedValue private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,10 +1,12 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; @@ -17,8 +19,14 @@ @Entity @Table(name="student_strategy") -public class StudentStrategy { +public class StudentStrategy implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id @GeneratedValue private Long id; @@ -45,7 +53,7 @@ private boolean repeatedDecisions; - @OneToMany + @OneToMany(fetch=FetchType.EAGER) @JoinColumn(nullable=false) private List<DayOutput> dayOutput; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/SuspendRepetition.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,6 +1,8 @@ package edu.asu.commons.mme.entity; +import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -11,8 +13,14 @@ @Entity @Table(name="suspend_repetition") -public class SuspendRepetition { +public class SuspendRepetition implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id @GeneratedValue private Long id; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-04-24 17:05:53 UTC (rev 120) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-04-28 19:36:09 UTC (rev 121) @@ -1,21 +1,47 @@ package edu.asu.commons.mme.service; +import java.util.Iterator; +import java.util.List; + +import org.hibernate.Hibernate; import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateModuleDao; +import edu.asu.commons.mme.entity.Block; import edu.asu.commons.mme.entity.Module; +import edu.asu.commons.mme.entity.QuestionGroup; @Transactional public class ModuleService extends Service.Base<Module, HibernateModuleDao>{ - public String getFirstPage() + public Module getFirstPage() { - Module module = getDao().findByProperty("sequenceNo", "1"); + // System.out.println("test is " + test); + Module module = getDao().findByProperty("sequenceNo", new Integer(1)); + Hibernate.initialize(module); + System.out.println("Module object is " + module.getDescription()); - System.out.println(module.getDescription()); + List<Block> listBlock = module.getBlock(); + Iterator<Block> iterateBlock = listBlock.iterator(); + while(iterateBlock.hasNext()) + { + Block block = iterateBlock.next(); + Hibernate.initialize(block); + List<QuestionGroup> questionGroup = block.getQuestionGroup(); + Iterator<QuestionGroup> iteratorquestion = questionGroup.iterator(); + { + while(iteratorquestion.hasNext()) + { + Hibernate.initialize(iteratorquestion.next()); + } + } + + } - return module.getDescription(); + System.out.println("Block description iss " + module.getBlock().get(0).getDescription()); + + return module; } Modified: mentalmodels/trunk/src/main/webapp/FisheryExperiment.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-04-28 21:31:09
|
Revision: 124 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=124&view=rev Author: seematalele Date: 2009-04-28 21:30:58 +0000 (Tue, 28 Apr 2009) Log Message: ----------- Chnaged the Module.as, Block.as , FisheryExperiment.mxml Testing- tested if module object is tranfered from java to actionscript. mapping in java for list and in actionscript as a arraycollection fro block object is working correctly. Need to do testing - if you can retrive QuestionGroup from Module.Block Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperiment.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java Added Paths: ----------- mentalmodels/trunk/flex/src/FisheryExperimentKalin.mxml mentalmodels/trunk/flex/src/Student.as mentalmodels/trunk/flex/src/actionscript/Block.as mentalmodels/trunk/flex/src/actionscript/Module.as mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as Modified: mentalmodels/trunk/flex/src/FisheryExperiment.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperiment.mxml 2009-04-28 20:39:01 UTC (rev 123) +++ mentalmodels/trunk/flex/src/FisheryExperiment.mxml 2009-04-28 21:30:58 UTC (rev 124) @@ -40,6 +40,8 @@ <mx:Consumer id="consumer" destination="DataPush" message="messageHandler(event.message)" /> <mx:Script> <![CDATA[ + import actionscript.Block; + import mx.collections.ArrayCollection; import actionscript.Module; import flash.sampler.getInvocationCount; import mx.controls.Label; @@ -83,7 +85,8 @@ { module = Module(event.result); - Alert.show("duration is " + module.duration ); + var block:Block = module.block.getItemAt(0) as Block + Alert.show("block is " + block.description); } private function faultHandler(event:FaultEvent):void @@ -226,7 +229,7 @@ Alert.show(info.getYear());*/ Id=ss.createStudent(info.getYear(), info.getSemester(), info.getGender(),info.getMajor()); Alert.show("Before invoking createstudent()"); - + // module = mod.getFirstPage(); return true; } } Added: mentalmodels/trunk/flex/src/FisheryExperimentKalin.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentKalin.mxml (rev 0) +++ mentalmodels/trunk/flex/src/FisheryExperimentKalin.mxml 2009-04-28 21:30:58 UTC (rev 124) @@ -0,0 +1,237 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.*" + backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #80FFAA]" + width="760" height="510" clipContent="false" layout="absolute" + currentState="instructions" initialize="init()"> + + <mx:states> + <mx:State name="instructions"> + <mx:AddChild relativeTo="{content}"> + <comp:InstructionPage id="instructions"/> + </mx:AddChild> + </mx:State> + + <mx:State name="socioDemographic"> + <mx:AddChild relativeTo="{content}"> + <comp:SocioDemographicPage id="socioDemographic" x="265" y="100"/> + </mx:AddChild> + </mx:State> + + <mx:State name="planner"> + <mx:AddChild relativeTo="{content}"> + <comp:PlannerPage id="planner"/> + </mx:AddChild> + </mx:State> + + <mx:State name="none"/> + </mx:states> + + + + <mx:Canvas id="content" x="5" y="5" width="750" height="470"/> + <mx:Canvas id="expiredContent" x="-100" y="-100" width="1" height="1" visible="false"/> + + <mx:Button id="btnBack" label="« Back" click="back()" left="8" bottom="8"/> + <mx:Button id="btnAccept" label="Accept" click="accept()" left="375" bottom="10"/> + <mx:Button id="btnForward" label="Forward »" click="forward()" right="8" bottom="8"/> + <mx:RemoteObject id="ss" destination="studentService" fault="faultHandler(event)" result="resultHandler(event)"/> + <mx:Producer id="producer" destination="DataPush" acknowledge="ack(event)"/> + <mx:Consumer id="consumer" destination="DataPush" message="messageHandler(event.message)" /> + <mx:Script> + <![CDATA[ + import flash.sampler.getInvocationCount; + import mx.controls.Label; + import customComponents.*; + import mx.controls.Alert; + import mx.rpc.events.ResultEvent; + import mx.rpc.events.FaultEvent; + import mx.messaging.messages.IMessage; + import mx.messaging.events.MessageAckEvent; + import mx.messaging.events.MessageFaultEvent; + import mx.messaging.FlexClient; + import mx.messaging.messages.AsyncMessage; + + + private var shared:SharedObject; + private var flushMessage:String; + [Bindable] + public var Id : uint; + + [Bindable] + public var randomNumbers:String; + private function ack(event:MessageAckEvent):void + { + //chart.setVisible(true); + randomNumbers = event.message.body as String; + //Alert.show("in ack method" + randomNumbers); + } + private function resultHandler(event:ResultEvent):void + { + Id = event.result as uint; + + Alert.show("Student id is " + Id ); + consumer.disconnect(); + } + + private function faultHandler(event:FaultEvent):void + { + Alert.show("event fault is " + event.fault.faultDetail); + } + + private function handleFault(event:MessageFaultEvent):void + { + Alert.show("Message event fault is " + event.faultString); + } + + + private function messageHandler(message:IMessage):void + { + randomNumbers = message.body as String; + Alert.show( ""+randomNumbers); + } + + public function init():void + { + /*var sharedObjTest:Boolean = false; + if(sharedObjTest) + { + var got:Boolean = getLocal(); + if(got) + { + getData().saved1 = "Hello, World!"; + getData().thisIsATest = 283; + + var testLabel:Label = new Label(); + testLabel.text = "This is a test"; + testLabel.x = getData().thisIsATest; + testLabel.y = getData().thisIsATest; + + testLabel.text += ", " +flushMessage+"x"+shared.toString()+"x"; + getData().testLabel = testLabel; + + if(getData().exists) testLabel.text += "SharedObject existed before initialization"; + else getData().exists = true; + + this.addChild(getData().testLabel); + + } + }*/ + + // var msg:AsyncMessage = new AsyncMessage(); + //var client:FlexClient = FlexClient.getInstance(); + //creating new msg with “New” to get current state. + //msg.body = "New"; + + //producer.send(msg); + //Alert.show("message send is " + msg.body); + + + //consumer.subscribe(); + + } + public function getData():Object + { + return shared.data; + } + public function getLocal():Boolean + { + try{ + shared = SharedObject.getLocal("thisIsForWork"); + }catch(err:Error){ + return false; + } + return true; + } + public function flush():Boolean + { + try{ + flushMessage = shared.flush(10000); + }catch(err:Error){ + return false; + } + return true; + } + + public function back():Boolean + { + if(content.numChildren == 0) + { return false; } + var obj:DisplayObject = content.getChildAt(0); + + if(obj is InstructionPage) + { + (InstructionPage)(obj).back(); + } + return false; + } + + public function forward():Boolean + { + if(content.numChildren == 0) + { return false; } + var obj:DisplayObject = content.getChildAt(0); + + if(obj is InstructionPage) + { + (InstructionPage)(obj).forward(); + } + return false; + } + + public function accept():Boolean + { + if(content.numChildren == 0) + { return false; } + var obj:DisplayObject = content.getChildAt(0); + + if(obj is InstructionPage) + { + if( (InstructionPage)(obj).accept() ) + { + obj.visible = false; + expiredContent.addChild(obj); + currentState = "socioDemographic"; + //consumer.subscribe(); + return true; + } + } + if(obj is SocioDemographicPage) + { + var Id:uint = 0; + if( (SocioDemographicPage)(obj).accept() ) + { + obj.visible = false; + expiredContent.addChild(obj); + currentState = "planner"; + var info:SocioDemographicPage = SocioDemographicPage(obj); + + /* Alert.show(info.getGender()); + Alert.show(info.getMajor()); + Alert.show(info.getSemester()); + Alert.show(info.getYear());*/ + Id=ss.createStudent(info.getYear(), info.getSemester(), info.getGender(),info.getMajor()); + Alert.show("Before invoking createstudent()"); + return true; + } + } + if(obj is PlannerPage) + { + if( (PlannerPage)(obj).accept() ) + { + obj.visible = false; + expiredContent.addChild(obj); + currentState = "none"; + + return true; + } + } + + return false; + } + + + + ]]> + </mx:Script> + +</mx:Application> Added: mentalmodels/trunk/flex/src/Student.as =================================================================== --- mentalmodels/trunk/flex/src/Student.as (rev 0) +++ mentalmodels/trunk/flex/src/Student.as 2009-04-28 21:30:58 UTC (rev 124) @@ -0,0 +1,11 @@ +package +{ + [Bindable] + [RemoteClass(alias="student.Student")] + public class Student + { + public var fname:String; + public var lname:String; + + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Block.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Block.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Block.as 2009-04-28 21:30:58 UTC (rev 124) @@ -0,0 +1,24 @@ +package actionscript +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Block")] + public class Block + { + public var id:int; + + + public var sequenceNo:int; + + + public var description:String; + + + public var duration:int; + + + public var questionGroup:ArrayCollection; + + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Module.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Module.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Module.as 2009-04-28 21:30:58 UTC (rev 124) @@ -0,0 +1,18 @@ +package actionscript +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Module")] + public class Module + { + public var id:int; + public var sequenceNo:int; + public var description:String; + public var duration:int; + public var block:ArrayCollection; //if arraycollection didnt work try list + + + + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as 2009-04-28 21:30:58 UTC (rev 124) @@ -0,0 +1,36 @@ +package actionscript +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.QuestionGroup")] + + public class QuestionGroup + { + public var id:int; + + + private var roundConfig:ArrayCollection; + + + public var sequenceNo:int; + + //header can be question or just a label + + public var header:String; + + public var description:String; + + /*Since we have timings for module, + * we don't need to save timings for each item or question group + * + */ + /*@Column(nullable=false) + public var Float maxtime;*/ + + + public var block:Block; + + + } +} \ No newline at end of file Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-04-28 20:39:01 UTC (rev 123) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-04-28 21:30:58 UTC (rev 124) @@ -43,6 +43,8 @@ insert into block(description, sequence_no, duration,module_id) values("Final data gathering",1,2,4); insert into block(description, sequence_no, duration,module_id) values("Debriefing",2,2,4); + + insert into question_group(block_id,sequence_no,header,description)values(1,1,"Welcome to the E-Fishery Experiment", "In this experiment you will design a strategy to fish an abstract fishing ground together with three other persons. As we are mainly interested in the reasons why you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no \x91correct\x92 or \x91wrong\x92 strategies and no \x91correct\x92 or \x91wrong\x92 answers. However, since for each pound of fish you get during the experiment you will receive #.### US$, you might be interested in finding a strategy that fits your goals well. For this, you have to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group."); Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java 2009-04-28 20:39:01 UTC (rev 123) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java 2009-04-28 21:30:58 UTC (rev 124) @@ -37,7 +37,7 @@ @JoinColumn(nullable=false) private Module module; - @OneToMany + @OneToMany(mappedBy ="block") @OrderBy("sequenceNo") private List<QuestionGroup> questionGroup; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java 2009-04-28 20:39:01 UTC (rev 123) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java 2009-04-28 21:30:58 UTC (rev 124) @@ -32,10 +32,12 @@ @Column(nullable=false) private Integer duration; + @OneToMany(mappedBy="module") @OrderBy("sequenceNo") private List<Block> blocks; + public void setId(Long id) { this.id = id; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-04-28 20:39:01 UTC (rev 123) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-04-28 21:30:58 UTC (rev 124) @@ -32,7 +32,7 @@ @GeneratedValue private Long id; - @OneToMany + @OneToMany(mappedBy ="questionGroup") @OrderBy("sequenceNo") private List<Question> questions; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-04-28 20:39:01 UTC (rev 123) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-04-28 21:30:58 UTC (rev 124) @@ -53,7 +53,7 @@ private boolean repeatedDecisions; - @OneToMany(fetch=FetchType.EAGER) + @OneToMany(mappedBy = "strategy") @JoinColumn(nullable=false) private List<DayOutput> dayOutput; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-04-28 20:39:01 UTC (rev 123) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-04-28 21:30:58 UTC (rev 124) @@ -17,7 +17,7 @@ public Module getFirstPage() { // System.out.println("test is " + test); - Module module = getDao().findByProperty("sequenceNo", new Integer(1)); + Module module = getDao().findByProperty("sequenceNo", new Integer(2)); Hibernate.initialize(module); System.out.println("Module object is " + module.getDescription()); @@ -39,7 +39,8 @@ } - System.out.println("Block description iss " + module.getBlocks().get(0).getDescription()); + + System.out.println("Module block is " + module.getBlocks().size()); return module; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-04-28 21:45:07
|
Revision: 126 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=126&view=rev Author: kjonas Date: 2009-04-28 21:44:53 +0000 (Tue, 28 Apr 2009) Log Message: ----------- Synchronizing Modified Paths: -------------- mentalmodels/trunk/flex/src/customComponents/Slider.mxml Added Paths: ----------- mentalmodels/trunk/.classpath mentalmodels/trunk/.project mentalmodels/trunk/flex/.actionScriptProperties mentalmodels/trunk/flex/.flexProperties mentalmodels/trunk/flex/.project mentalmodels/trunk/flex/src/actionscript/PageDisplay.as mentalmodels/trunk/flex/src/images/ mentalmodels/trunk/flex/src/images/SliderImage.png mentalmodels/trunk/src/main/db/generated/ mentalmodels/trunk/src/main/db/generated/mme.sql mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties mentalmodels/trunk/target/ Added: mentalmodels/trunk/.classpath =================================================================== --- mentalmodels/trunk/.classpath (rev 0) +++ mentalmodels/trunk/.classpath 2009-04-28 21:44:53 UTC (rev 126) @@ -0,0 +1,31 @@ +<classpath> + <classpathentry kind="src" path="src/main/webapp" output="target/test-classes" excluding="**/*.java"/> + <classpathentry kind="src" path="src/main/java" including="**/*.java"/> + <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/> + <classpathentry kind="output" path="target/classes"/> + <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.1/jta-1.1.jar"/> + <classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"/> + <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/> + <classpathentry kind="var" path="M2_REPO/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/> + <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/> + <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/> + <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/> + <classpathentry kind="var" path="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.2.GA/ejb3-persistence-1.0.2.GA.jar"/> + <classpathentry kind="var" path="M2_REPO/freemarker/freemarker/2.3.8/freemarker-2.3.8.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.4.0.GA/hibernate-annotations-3.4.0.GA.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.1.0.GA/hibernate-commons-annotations-3.1.0.GA.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-core/3.3.0.SP1/hibernate-core-3.3.0.SP1.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-ehcache/3.3.1.GA/hibernate-ehcache-3.3.1.GA.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-tools/3.2.3.GA/hibernate-tools-3.2.3.GA.jar"/> + <classpathentry kind="var" path="M2_REPO/org/hibernate/jtidy/r8-20060801/jtidy-r8-20060801.jar"/> + <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar"/> + <classpathentry kind="var" path="M2_REPO/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar"/> + <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.4.2/slf4j-api-1.4.2.jar"/> + <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.5.2/slf4j-log4j12-1.5.2.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring/2.5.5/spring-2.5.5.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-flex/1.0.0.M2/spring-flex-1.0.0.M2.jar"/> + <classpathentry kind="var" path="M2_REPO/org/springframework/spring-hibernate3/2.0-m3/spring-hibernate3-2.0-m3.jar"/> + <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> +</classpath> \ No newline at end of file Added: mentalmodels/trunk/.project =================================================================== --- mentalmodels/trunk/.project (rev 0) +++ mentalmodels/trunk/.project 2009-04-28 21:44:53 UTC (rev 126) @@ -0,0 +1,13 @@ +<projectDescription> + <name>mme</name> + <comment/> + <projects/> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> \ No newline at end of file Added: mentalmodels/trunk/flex/.actionScriptProperties =================================================================== --- mentalmodels/trunk/flex/.actionScriptProperties (rev 0) +++ mentalmodels/trunk/flex/.actionScriptProperties 2009-04-28 21:44:53 UTC (rev 126) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<actionScriptProperties mainApplicationPath="FisheryExperiment.mxml" version="3"> + <compiler additionalCompilerArguments="-locale en_US" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="src" strict="true" useApolloConfig="false" verifyDigests="true" warn="true"> + <compilerSourcePath/> + <libraryPath defaultLinkType="1"> + <libraryPathEntry kind="4" path=""/> + <libraryPathEntry kind="1" linkType="1" path="libs"/> + </libraryPath> + <sourceAttachmentPath/> + </compiler> + <applications> + <application path="Socio_demographic.mxml"/> + <application path="TestApp.mxml"/> + <application path="display.mxml"/> + <application path="TableTest.mxml"/> + <application path="MME.mxml"/> + <application path="Mental.mxml"/> + <application path="FisheryExperiment.mxml"/> + </applications> + <modules/> + <buildCSSFiles/> +</actionScriptProperties> Added: mentalmodels/trunk/flex/.flexProperties =================================================================== --- mentalmodels/trunk/flex/.flexProperties (rev 0) +++ mentalmodels/trunk/flex/.flexProperties 2009-04-28 21:44:53 UTC (rev 126) @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<flexProperties flexServerType="0" toolCompile="true" useServerFlexSDK="false" version="1"/> Added: mentalmodels/trunk/flex/.project =================================================================== --- mentalmodels/trunk/flex/.project (rev 0) +++ mentalmodels/trunk/flex/.project 2009-04-28 21:44:53 UTC (rev 126) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Fishery</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>com.adobe.flexbuilder.project.flexbuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>com.adobe.flexbuilder.project.flexnature</nature> + <nature>com.adobe.flexbuilder.project.actionscriptnature</nature> + </natures> +</projectDescription> Added: mentalmodels/trunk/flex/src/actionscript/PageDisplay.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-04-28 21:44:53 UTC (rev 126) @@ -0,0 +1,104 @@ +// ActionScript file +package actionscript +{ + import mx.collections.ArrayCollection; + import flash.display.DisplayObject; + + [Bindable] + public class PageDisplay + { + private var _pages:ArrayCollection; + private var _minPagesRead:Number; + private var _currentPage; + private var _highestPageReached; + + public function PageDisplay(pages:ArrayCollection, minPagesRead:Number=1) + { + if(pages == null) this.pages = new ArrayCollection(); + _minPagesRead = minPagesRead; + } + + public function get pages():ArrayCollection + { return _pages; } + public function set pages(newValue:ArrayCollection):void + { + setPages(newValue); + } + public function setPages(newValue:ArrayCollection, adding:Boolean=false):void + { + if(adding) + { + // concatenate the newValue ArrayCollection onto the end of _pages + for(var index:Number = 0; index < newValue.length; index++) + { + addPage( newValue.getItemAt(index) ); + } + + } + else + { + // replace _pages with newValue + _pages = newValue; + + // totally new list, reset to 0 + currentPageNumber = 0; + highestPageReached = currentPageNumber + 1; + } + } + public function addPage(newValue):void + { + if(newValue != null) + { + _pages.addItem(newValue); + } + } + + public function get currentPageNumber():Number + { return _currentPage; } + public function set currentPageNumber(newValue:Number):void + { _currentPage = newValue; } + + public function get minPagesRead():Number + { return _minPagesRead; } + public function set minPagesRead(newValue:Number):void + { _minPagesRead = newValue; } + + public function get highestPageReached():Number + { return _highestPageReached; } + public function set highestPageReached(newValue:Number):void + { _highestPageReached = newValue; } + + public function finished():Boolean + { return highestPageReached <= minPagesRead; } + public function get length():Number + { return _pages.length; } + + public function get currentPage():DisplayObject + { + if(_pages != null && _pages.length > 0) // pages? + { + if(_currentPage >= 0) // how low? + { + if(_currentPage < _pages.length) // how high? + { + return (DisplayObject)(_pages.getItemAt(_currentPage)); // VALID_RESULT + } + return (DisplayObject)(_pages.getItemAt(pages.length - 1)); // too high + } + return (DisplayObject)(_pages.getItemAt(0)); // too low + } + + return null; // no pages + } + public function nextPage():void + { + currentPageNumber++; + if( currentPageNumber > highestPageReached ) + { + highestPageReached = currentPageNumber + 1; + } + } + public function prevPage():void + { currentPageNumber--; } + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/customComponents/Slider.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/Slider.mxml 2009-04-28 21:40:22 UTC (rev 125) +++ mentalmodels/trunk/flex/src/customComponents/Slider.mxml 2009-04-28 21:44:53 UTC (rev 126) @@ -4,7 +4,12 @@ <mx:Script> <![CDATA[ import mx.controls.Label; - + + [Bindable] + [Embed(source="../images/SliderImage.png")] + private var sliderImage:Class; + + // Psychometric Variables - (Left = Positive, Right = Negative) public var maxValue:Number = 10; // Leftmost value public static var abstainValue:Number = -999; // Refusal to answer @@ -83,6 +88,10 @@ var index:Number = Math.round((mouseX-imageWidth/2) / separation); // snap to nearest valid position value = maxValue - index; // flips scale so positive numbers on left + if(value > maxValue) value = maxValue; + if(value < minValue) value = minValue; + index = maxValue - value; + getValue(); // updates the bindable "getVal" variable var xPos:Number = index * separation; @@ -105,9 +114,6 @@ borderStyle="solid" borderColor="#F0F0F0" borderThickness="2" /> - <mx:Image id="sliderButton" - x="0" y="0" - source="../libs/SliderImage.png" - /> + <mx:Image id="sliderButton" x="0" y="0" source="{sliderImage}"/> </mx:Canvas> Added: mentalmodels/trunk/flex/src/images/SliderImage.png =================================================================== (Binary files differ) Property changes on: mentalmodels/trunk/flex/src/images/SliderImage.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Added: mentalmodels/trunk/src/main/db/generated/mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/generated/mme.sql (rev 0) +++ mentalmodels/trunk/src/main/db/generated/mme.sql 2009-04-28 21:44:53 UTC (rev 126) @@ -0,0 +1,92 @@ +alter table categorical drop foreign key FK5BA174204A96BF7A; +alter table categorical_choices drop foreign key FK6ED951D3427248A1; +alter table communication drop foreign key FKC24ACFD63A5846C1; +alter table communication drop foreign key FKC24ACFD6992B5A41; +alter table game_round_config drop foreign key FKA0C2A40DAFC8295; +alter table game_round_config drop foreign key FKA0C2A403A5846C1; +alter table grp drop foreign key FK190E5DAFC8295; +alter table psychometric drop foreign key FKF0B5ECC44A96BF7A; +alter table psychometric_choices drop foreign key FKBFCCE6779F159D33; +alter table question drop foreign key FKBA823BE6CA626674; +alter table round_config drop foreign key FK3BE29313DAFC8295; +alter table round_config_location_config drop foreign key FK59AD1DE03A5846C1; +alter table round_config_location_config drop foreign key FK59AD1DE0E64BF633; +alter table round_config_question_group drop foreign key FKAC05839279C46421; +alter table round_config_question_group drop foreign key FKAC0583923A5846C1; +alter table student drop foreign key FK8FFE823B65663181; +alter table student_day_output drop foreign key FK7B993B8846861732; +alter table student_day_output drop foreign key FK7B993B888374539C; +alter table student_response drop foreign key FK173D15C5992B5A41; +alter table student_response drop foreign key FK173D15C584109673; +alter table student_round_config drop foreign key FK49C432973A5846C1; +alter table student_round_config drop foreign key FK49C43297992B5A41; +alter table student_strategy drop foreign key FK9615A4F73A5846C1; +alter table student_strategy drop foreign key FK9615A4F74A6A64F5; +alter table suspend_repetition drop foreign key FKFBDC4543A5846C1; +alter table suspend_repetition drop foreign key FKFBDC454992B5A41; +drop table if exists categorical; +drop table if exists categorical_choices; +drop table if exists communication; +drop table if exists game; +drop table if exists game_round_config; +drop table if exists grp; +drop table if exists location_config; +drop table if exists psychometric; +drop table if exists psychometric_choices; +drop table if exists question; +drop table if exists question_group; +drop table if exists round_config; +drop table if exists round_config_location_config; +drop table if exists round_config_question_group; +drop table if exists student; +drop table if exists student_day_output; +drop table if exists student_response; +drop table if exists student_round_config; +drop table if exists student_strategy; +drop table if exists suspend_repetition; +create table categorical (id bigint not null, primary key (id)) type=InnoDB; +create table categorical_choices (categorical_id bigint not null, element tinyblob, mapkey varchar(255), primary key (categorical_id, mapkey)) type=InnoDB; +create table communication (id bigint not null auto_increment, message longtext, timestamp datetime, roundconfig_id bigint not null, student_id bigint not null, primary key (id)) type=InnoDB; +create table game (id bigint not null auto_increment, description longtext, img_address varchar(255), max_days integer not null, max_fish_harvest integer not null, money float, no_of_location integer not null, no_of_rounds integer not null, timestamp datetime not null, title varchar(255) not null, primary key (id)) type=InnoDB; +create table game_round_config (game_id bigint not null, roundconfig_id bigint not null, unique (roundconfig_id)) type=InnoDB; +create table grp (id bigint not null auto_increment, grp_no integer not null, game_id bigint not null, primary key (id)) type=InnoDB; +create table location_config (id bigint not null auto_increment, growth_Rate float not null, location_name varchar(255) not null, max_capacity integer not null, start_population integer not null, primary key (id)) type=InnoDB; +create table psychometric (no_of_intervals varchar(255) not null, scale varchar(255) not null, id bigint not null, primary key (id)) type=InnoDB; +create table psychometric_choices (psychometric_id bigint not null, element varchar(255)) type=InnoDB; +create table question (id bigint not null auto_increment, misc_location Boolean not null, multi_location Boolean not null, question longtext not null, sequence_no integer not null, single_location Boolean not null, question_group_id bigint not null, primary key (id)) type=InnoDB; +create table question_group (id bigint not null auto_increment, header_question longtext, sequence_no integer not null, primary key (id)) type=InnoDB; +create table round_config (id bigint not null auto_increment, communication_flag Boolean not null, round_no integer not null, game_id bigint not null, primary key (id)) type=InnoDB; +create table round_config_location_config (roundconfig_id bigint not null, locationconfig_id bigint not null, primary key (roundconfig_id, locationconfig_id)) type=InnoDB; +create table round_config_question_group (roundConfig_id bigint not null, questionGroup_id bigint not null, primary key (roundConfig_id, questionGroup_id)) type=InnoDB; +create table student (id bigint not null auto_increment, year_birth integer, ethnicity varchar(255), gender varchar(255), major varchar(255), student_no integer not null, group_id bigint not null, primary key (id)) type=InnoDB; +create table student_day_output (id bigint not null auto_increment, day integer not null, earnings float not null, strategy_id bigint not null, dayOutput_id bigint not null, primary key (id)) type=InnoDB; +create table student_response (id bigint not null auto_increment, response longtext, question_id bigint not null, student_id bigint not null, primary key (id)) type=InnoDB; +create table student_round_config (id bigint not null auto_increment, current_allocation_no integer not null, current_day_no integer not null, roundconfig_id bigint not null, student_id bigint not null, primary key (id)) type=InnoDB; +create table student_strategy (id bigint not null auto_increment, allocation_sequence_no integer not null, days integer not null, repeated_decisions Boolean not null, threshold float not null, location_id bigint not null, roundconfig_id bigint not null, primary key (id)) type=InnoDB; +create table suspend_repetition (id bigint not null auto_increment, fishing_threshold float not null, harbor_days integer not null, roundconfig_id bigint not null, student_id bigint not null, primary key (id)) type=InnoDB; +alter table categorical add index FK5BA174204A96BF7A (id), add constraint FK5BA174204A96BF7A foreign key (id) references question (id); +alter table categorical_choices add index FK6ED951D3427248A1 (categorical_id), add constraint FK6ED951D3427248A1 foreign key (categorical_id) references categorical (id); +alter table communication add index FKC24ACFD63A5846C1 (roundconfig_id), add constraint FKC24ACFD63A5846C1 foreign key (roundconfig_id) references round_config (id); +alter table communication add index FKC24ACFD6992B5A41 (student_id), add constraint FKC24ACFD6992B5A41 foreign key (student_id) references student (id); +alter table game_round_config add index FKA0C2A40DAFC8295 (game_id), add constraint FKA0C2A40DAFC8295 foreign key (game_id) references game (id); +alter table game_round_config add index FKA0C2A403A5846C1 (roundconfig_id), add constraint FKA0C2A403A5846C1 foreign key (roundconfig_id) references round_config (id); +alter table grp add index FK190E5DAFC8295 (game_id), add constraint FK190E5DAFC8295 foreign key (game_id) references game (id); +alter table psychometric add index FKF0B5ECC44A96BF7A (id), add constraint FKF0B5ECC44A96BF7A foreign key (id) references question (id); +alter table psychometric_choices add index FKBFCCE6779F159D33 (psychometric_id), add constraint FKBFCCE6779F159D33 foreign key (psychometric_id) references psychometric (id); +alter table question add index FKBA823BE6CA626674 (question_group_id), add constraint FKBA823BE6CA626674 foreign key (question_group_id) references question_group (id); +alter table round_config add index FK3BE29313DAFC8295 (game_id), add constraint FK3BE29313DAFC8295 foreign key (game_id) references game (id); +alter table round_config_location_config add index FK59AD1DE03A5846C1 (roundconfig_id), add constraint FK59AD1DE03A5846C1 foreign key (roundconfig_id) references round_config (id); +alter table round_config_location_config add index FK59AD1DE0E64BF633 (locationconfig_id), add constraint FK59AD1DE0E64BF633 foreign key (locationconfig_id) references location_config (id); +alter table round_config_question_group add index FKAC05839279C46421 (questionGroup_id), add constraint FKAC05839279C46421 foreign key (questionGroup_id) references question_group (id); +alter table round_config_question_group add index FKAC0583923A5846C1 (roundConfig_id), add constraint FKAC0583923A5846C1 foreign key (roundConfig_id) references round_config (id); +alter table student add index FK8FFE823B65663181 (group_id), add constraint FK8FFE823B65663181 foreign key (group_id) references grp (id); +alter table student_day_output add index FK7B993B8846861732 (dayOutput_id), add constraint FK7B993B8846861732 foreign key (dayOutput_id) references student_strategy (id); +alter table student_day_output add index FK7B993B888374539C (strategy_id), add constraint FK7B993B888374539C foreign key (strategy_id) references student_strategy (id); +alter table student_response add index FK173D15C5992B5A41 (student_id), add constraint FK173D15C5992B5A41 foreign key (student_id) references student (id); +alter table student_response add index FK173D15C584109673 (question_id), add constraint FK173D15C584109673 foreign key (question_id) references question (id); +alter table student_round_config add index FK49C432973A5846C1 (roundconfig_id), add constraint FK49C432973A5846C1 foreign key (roundconfig_id) references round_config (id); +alter table student_round_config add index FK49C43297992B5A41 (student_id), add constraint FK49C43297992B5A41 foreign key (student_id) references student (id); +alter table student_strategy add index FK9615A4F73A5846C1 (roundconfig_id), add constraint FK9615A4F73A5846C1 foreign key (roundconfig_id) references round_config (id); +alter table student_strategy add index FK9615A4F74A6A64F5 (location_id), add constraint FK9615A4F74A6A64F5 foreign key (location_id) references location_config (id); +alter table suspend_repetition add index FKFBDC4543A5846C1 (roundconfig_id), add constraint FKFBDC4543A5846C1 foreign key (roundconfig_id) references round_config (id); +alter table suspend_repetition add index FKFBDC454992B5A41 (student_id), add constraint FKFBDC454992B5A41 foreign key (student_id) references student (id); Added: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties 2009-04-28 21:44:53 UTC (rev 126) @@ -0,0 +1,5 @@ +hibernate.connection.user=mme +hibernate.connection.password=mmepassword +hibernate.connection.url=jdbc:mysql://localhost/MME +hibernate.connection.driver_class=com.mysql.jdbc.Driver +hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2009-04-28 21:48:10
|
Revision: 127 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=127&view=rev Author: alllee Date: 2009-04-28 21:48:04 +0000 (Tue, 28 Apr 2009) Log Message: ----------- getting rid of generated files from SVN (should add to svn ignore later) Removed Paths: ------------- mentalmodels/trunk/.classpath mentalmodels/trunk/.project mentalmodels/trunk/src/main/db/generated/ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties mentalmodels/trunk/target/ Deleted: mentalmodels/trunk/.classpath =================================================================== --- mentalmodels/trunk/.classpath 2009-04-28 21:44:53 UTC (rev 126) +++ mentalmodels/trunk/.classpath 2009-04-28 21:48:04 UTC (rev 127) @@ -1,31 +0,0 @@ -<classpath> - <classpathentry kind="src" path="src/main/webapp" output="target/test-classes" excluding="**/*.java"/> - <classpathentry kind="src" path="src/main/java" including="**/*.java"/> - <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/> - <classpathentry kind="output" path="target/classes"/> - <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.1/jta-1.1.jar"/> - <classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"/> - <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/> - <classpathentry kind="var" path="M2_REPO/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/> - <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/> - <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/> - <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/> - <classpathentry kind="var" path="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar"/> - <classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.2.GA/ejb3-persistence-1.0.2.GA.jar"/> - <classpathentry kind="var" path="M2_REPO/freemarker/freemarker/2.3.8/freemarker-2.3.8.jar"/> - <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.4.0.GA/hibernate-annotations-3.4.0.GA.jar"/> - <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.1.0.GA/hibernate-commons-annotations-3.1.0.GA.jar"/> - <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-core/3.3.0.SP1/hibernate-core-3.3.0.SP1.jar"/> - <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-ehcache/3.3.1.GA/hibernate-ehcache-3.3.1.GA.jar"/> - <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-tools/3.2.3.GA/hibernate-tools-3.2.3.GA.jar"/> - <classpathentry kind="var" path="M2_REPO/org/hibernate/jtidy/r8-20060801/jtidy-r8-20060801.jar"/> - <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar"/> - <classpathentry kind="var" path="M2_REPO/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar"/> - <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.4.2/slf4j-api-1.4.2.jar"/> - <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.5.2/slf4j-log4j12-1.5.2.jar"/> - <classpathentry kind="var" path="M2_REPO/org/springframework/spring/2.5.5/spring-2.5.5.jar"/> - <classpathentry kind="var" path="M2_REPO/org/springframework/spring-flex/1.0.0.M2/spring-flex-1.0.0.M2.jar"/> - <classpathentry kind="var" path="M2_REPO/org/springframework/spring-hibernate3/2.0-m3/spring-hibernate3-2.0-m3.jar"/> - <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> -</classpath> \ No newline at end of file Deleted: mentalmodels/trunk/.project =================================================================== --- mentalmodels/trunk/.project 2009-04-28 21:44:53 UTC (rev 126) +++ mentalmodels/trunk/.project 2009-04-28 21:48:04 UTC (rev 127) @@ -1,13 +0,0 @@ -<projectDescription> - <name>mme</name> - <comment/> - <projects/> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> \ No newline at end of file Deleted: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties 2009-04-28 21:44:53 UTC (rev 126) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.properties 2009-04-28 21:48:04 UTC (rev 127) @@ -1,5 +0,0 @@ -hibernate.connection.user=mme -hibernate.connection.password=mmepassword -hibernate.connection.url=jdbc:mysql://localhost/MME -hibernate.connection.driver_class=com.mysql.jdbc.Driver -hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-04-28 23:04:10
|
Revision: 129 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=129&view=rev Author: kjonas Date: 2009-04-28 23:04:00 +0000 (Tue, 28 Apr 2009) Log Message: ----------- Created *.as mirrors for the following *.java files: Block Categorical Forecasting Location Module Psychometric QuestionGroup Question Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/Block.as mentalmodels/trunk/flex/src/actionscript/Module.as mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/Categorical.as mentalmodels/trunk/flex/src/actionscript/Forecasting.as mentalmodels/trunk/flex/src/actionscript/Location.as mentalmodels/trunk/flex/src/actionscript/Psychometric.as mentalmodels/trunk/flex/src/actionscript/Question.as Modified: mentalmodels/trunk/flex/src/actionscript/Block.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Block.as 2009-04-28 23:01:55 UTC (rev 128) +++ mentalmodels/trunk/flex/src/actionscript/Block.as 2009-04-28 23:04:00 UTC (rev 129) @@ -6,19 +6,10 @@ [RemoteClass(alias="edu.asu.commons.mme.entity.Block")] public class Block { - public var id:int; - - - public var sequenceNo:int; - - - public var description:String; - - - public var duration:int; - - - public var questionGroup:ArrayCollection; - + public var id:int; + public var sequenceNo:int; + public var description:String; + public var duration:int; + public var questionGroup:ArrayCollection; } } \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Categorical.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Categorical.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Categorical.as 2009-04-28 23:04:00 UTC (rev 129) @@ -0,0 +1,11 @@ +package actionscript +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Categorical")] + public class Categorical + { + public var choices:Object; + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Forecasting.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Forecasting.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Forecasting.as 2009-04-28 23:04:00 UTC (rev 129) @@ -0,0 +1,11 @@ +package actionscript +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Forecasting")] + public class Forecasting + { + public var dayNo:int; + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Location.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Location.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Location.as 2009-04-28 23:04:00 UTC (rev 129) @@ -0,0 +1,15 @@ +package actionscript +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Location")] + public class Location + { + public var id:Number; + public var locationName:String; + public var maxCapacity:int; + public var growthRate:Number; + public var initialPopulation:int; + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/Module.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Module.as 2009-04-28 23:01:55 UTC (rev 128) +++ mentalmodels/trunk/flex/src/actionscript/Module.as 2009-04-28 23:04:00 UTC (rev 129) @@ -6,11 +6,11 @@ [RemoteClass(alias="edu.asu.commons.mme.entity.Module")] public class Module { - public var id:int; + public var id:Number; public var sequenceNo:int; public var description:String; public var duration:int; - public var block:ArrayCollection; //if arraycollection didnt work try list + public var blocks:ArrayCollection; //if arraycollection didnt work try list Added: mentalmodels/trunk/flex/src/actionscript/Psychometric.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Psychometric.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Psychometric.as 2009-04-28 23:04:00 UTC (rev 129) @@ -0,0 +1,13 @@ +package actionscript +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Psychometric")] + public class Psychometric + { + public var scale:String; + public var numberOfIntervals:int; + public var choices:ArrayCollection; + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Question.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Question.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Question.as 2009-04-28 23:04:00 UTC (rev 129) @@ -0,0 +1,16 @@ +package actionscript +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Question")] + public class Question + { + public var id:Number; + public var question:String; + public var singleLocation:Boolean; + public var multiLocation:Boolean; + public var miscLocation:Boolean; + public var sequenceNo:int; + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as 2009-04-28 23:01:55 UTC (rev 128) +++ mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as 2009-04-28 23:04:00 UTC (rev 129) @@ -7,30 +7,12 @@ public class QuestionGroup { - public var id:int; - - - private var roundConfig:ArrayCollection; - - - public var sequenceNo:int; - - //header can be question or just a label - - public var header:String; - - public var description:String; - - /*Since we have timings for module, - * we don't need to save timings for each item or question group - * - */ - /*@Column(nullable=false) - public var Float maxtime;*/ - - - public var block:Block; - - + public var id:Number; + public var questions:ArrayCollection; + public var sequenceNo:int; + public var header:String; + public var description:String; + + private var roundConfig:ArrayCollection; // fix me? } } \ No newline at end of file Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java 2009-04-28 23:01:55 UTC (rev 128) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Psychometric.java 2009-04-28 23:04:00 UTC (rev 129) @@ -25,7 +25,7 @@ private String scale; @Column(name="no_of_intervals",nullable=false) - private String intervals; + private Integer numberOfIntervals; @CollectionOfElements private List<String> choices; @@ -38,12 +38,12 @@ return choices; } - public void setIntervals(String intervals) { - this.intervals = intervals; + public Integer getNumberOfIntervals() { + return numberOfIntervals; } - public String getIntervals() { - return intervals; + public void setNumberOfIntervals(Integer numberOfIntervals) { + this.numberOfIntervals = numberOfIntervals; } public void setScale(String scale) { Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-04-28 23:01:55 UTC (rev 128) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-04-28 23:04:00 UTC (rev 129) @@ -43,7 +43,7 @@ @Column(name = "sequence_no",nullable=false) private Integer sequenceNo; - //header can be question or just a label + //header can be question or just a Text @Lob private String header; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-07-10 21:39:07
|
Revision: 176 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=176&view=rev Author: seematalele Date: 2009-07-10 21:39:00 +0000 (Fri, 10 Jul 2009) Log Message: ----------- Was Getting errors in some files. So Corrected errors like class name changed but did not reflected everywhere in flex. Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/flex/src/actionscript/Block.as mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as mentalmodels/trunk/flex/src/actionscript/questions/Categorical.as mentalmodels/trunk/flex/src/actionscript/questions/Question.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/questions/CategoricalOption.as mentalmodels/trunk/flex/src/actionscript/questions/Psychometric.as Removed Paths: ------------- mentalmodels/trunk/flex/src/actionscript/Categorical.as mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as mentalmodels/trunk/flex/src/actionscript/Psychometric.as Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-10 21:02:20 UTC (rev 175) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-10 21:39:00 UTC (rev 176) @@ -14,8 +14,9 @@ import actionscript.Module; import actionscript.Question; import actionscript.QuestionGroup; - import actionscript.Categorical; - import actionscript.CategoricalOption; + import actionscript.questions.Categorical; + import actionscript.questions.CategoricalOption; + import actionscript.questions.Psychometric; import mx.collections.ArrayCollection; Modified: mentalmodels/trunk/flex/src/actionscript/Block.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Block.as 2009-07-10 21:02:20 UTC (rev 175) +++ mentalmodels/trunk/flex/src/actionscript/Block.as 2009-07-10 21:39:00 UTC (rev 176) @@ -13,7 +13,7 @@ public var sequenceNo:int; public var description:String; public var duration:int; - public var module:ASModule; + public var module:Module; public var questionGroups:ArrayCollection; public var informationWindows:ArrayCollection; Deleted: mentalmodels/trunk/flex/src/actionscript/Categorical.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Categorical.as 2009-07-10 21:02:20 UTC (rev 175) +++ mentalmodels/trunk/flex/src/actionscript/Categorical.as 2009-07-10 21:39:00 UTC (rev 176) @@ -1,12 +0,0 @@ -package actionscript -{ - import mx.collections.ArrayCollection; - - [Bindable] - [RemoteClass(alias="edu.asu.commons.mme.entity.CategoricalQuestion")] - public class Categorical extends Question - { - - public var categoricalOptions:ArrayCollection = new ArrayCollection(); - } -} \ No newline at end of file Deleted: mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as 2009-07-10 21:02:20 UTC (rev 175) +++ mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as 2009-07-10 21:39:00 UTC (rev 176) @@ -1,14 +0,0 @@ -package actionscript.initDB.ASquestions -{ - import mx.collections.ArrayCollection; - - [Bindable] - [RemoteClass(alias="edu.asu.commons.mme.entity.CategoricalOption")] - public class CategoricalOption - { - public var optionKey:String; - - public var choices:ArrayCollection = new ArrayCollection(); - - } -} \ No newline at end of file Deleted: mentalmodels/trunk/flex/src/actionscript/Psychometric.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Psychometric.as 2009-07-10 21:02:20 UTC (rev 175) +++ mentalmodels/trunk/flex/src/actionscript/Psychometric.as 2009-07-10 21:39:00 UTC (rev 176) @@ -1,19 +0,0 @@ -package actionscript -{ - - - import mx.collections.ArrayCollection; - - [Bindable] - [RemoteClass(alias="edu.asu.commons.mme.entity.PsychometricQuestion")] - public class Psychometric extends Question - { - - public var scale:String; - - public var choices:ArrayCollection; - - public var maxSliderValue:int; - - } -} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as 2009-07-10 21:02:20 UTC (rev 175) +++ mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as 2009-07-10 21:39:00 UTC (rev 176) @@ -4,13 +4,13 @@ [Bindable] [RemoteClass(alias="edu.asu.commons.mme.entity.QuestionGroup")] - public class ASQuestionGroup + public class QuestionGroup { public var id:Number; public var questions:ArrayCollection; public var sequenceNo:int; public var header:String; public var description:String; - public var block:ASBlock; + public var block:Block; } } \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/questions/Categorical.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/questions/Categorical.as 2009-07-10 21:02:20 UTC (rev 175) +++ mentalmodels/trunk/flex/src/actionscript/questions/Categorical.as 2009-07-10 21:39:00 UTC (rev 176) @@ -1,14 +1,12 @@ -package actionscript.questions -{ - import mx.collections.ArrayCollection; - - [Bindable] - [RemoteClass(alias="edu.asu.commons.mme.entity.CategoricalQuestion")] - public class Categorical extends Question - { - public var choices:Object; - - public var topics:ArrayCollection; - public var specifics:ArrayCollection; - } +package actionscript.questions +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.CategoricalQuestion")] + public class Categorical extends Question + { + + public var categoricalOptions:ArrayCollection = new ArrayCollection(); + } } \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/questions/CategoricalOption.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/questions/CategoricalOption.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/questions/CategoricalOption.as 2009-07-10 21:39:00 UTC (rev 176) @@ -0,0 +1,14 @@ +package actionscript.questions +{ + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.CategoricalOption")] + public class CategoricalOption + { + public var optionKey:String; + + public var choices:ArrayCollection = new ArrayCollection(); + + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/questions/Psychometric.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/questions/Psychometric.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/questions/Psychometric.as 2009-07-10 21:39:00 UTC (rev 176) @@ -0,0 +1,19 @@ +package actionscript.questions +{ + + + import mx.collections.ArrayCollection; + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.PsychometricQuestion")] + public class Psychometric extends Question + { + + public var scale:String; + + public var choices:ArrayCollection; + + public var maxSliderValue:int; + + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/questions/Question.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/questions/Question.as 2009-07-10 21:02:20 UTC (rev 175) +++ mentalmodels/trunk/flex/src/actionscript/questions/Question.as 2009-07-10 21:39:00 UTC (rev 176) @@ -1,17 +1,14 @@ -package actionscript.questions -{ - import mx.collections.ArrayCollection; - - [Bindable] - [RemoteClass(alias="edu.asu.commons.mme.entity.Question")] - public class Question - { - public var id:Number; - public var question:String; - public var type:String; - public var singleLocation:Boolean; - public var multiLocation:Boolean; - public var miscLocation:Boolean; - public var sequenceNo:int; - } +package actionscript +{ + + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Question")] + public class Question + { + public var id:int; + public var question:String; + public var type:String; + public var sequenceNo:int; + + } } \ No newline at end of file Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java 2009-07-10 21:02:20 UTC (rev 175) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java 2009-07-10 21:39:00 UTC (rev 176) @@ -49,6 +49,7 @@ @OrderBy("sequenceNo") private List<QuestionGroup> questionGroups; + public void setId(Long id) { this.id = id; } @@ -99,4 +100,12 @@ return duration; } + public void setInformationWindows(List<Integer> informationWindows) { + this.informationWindows = informationWindows; + } + + public List<Integer> getInformationWindows() { + return informationWindows; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-07-20 01:13:41
|
Revision: 188 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=188&view=rev Author: seematalele Date: 2009-07-20 01:13:36 +0000 (Mon, 20 Jul 2009) Log Message: ----------- Created HibernateCategoricalQuestionDao.java and HibernatePsychometricQuestionDao.java. Changed the code of InitialiseDatabase.mxml - Adding Module,Block,QuestionGroup and Question is working fine. - Updating Module,Block,QuestionGroup is working fine. Need to test updating Questions in InitialiseDatabase.mxml. (But I am not going to test it until it really needs because it is taking some time) The init-mme file contains the database which initialized till Module 2A - Block 2-4 Commented the createQuestions in QuestionCreatorService.java and StartupService.java Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/flex/src/actionscript/Block.as mentalmodels/trunk/flex/src/actionscript/Module.as mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as mentalmodels/trunk/flex/src/actionscript/questions/Question.as mentalmodels/trunk/flex/src/custom/db/Block.mxml mentalmodels/trunk/flex/src/custom/db/Module.mxml mentalmodels/trunk/flex/src/custom/db/Question.mxml mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml mentalmodels/trunk/flex/src/custom/db/questions/CategoricalRelative.mxml mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Added Paths: ----------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateCategoricalQuestionDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernatePsychometricQuestionDao.java Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-17 23:21:35 UTC (rev 187) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-20 01:13:36 UTC (rev 188) @@ -5,11 +5,7 @@ <mx:Script> <![CDATA[ import mx.binding.utils.BindingUtils; - /*import custom.db.questions.Psychometric; - import custom.db.questions.CategoricalSimple; - import custom.db.questions.CategoricalRelative; - import custom.db.questions.Categorical; - import custom.db.Block; */ + import actionscript.Block; import actionscript.Module; @@ -28,31 +24,24 @@ import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; - - -/* id field of module, block and questiongroup and questions should come from database, -so when module info is transfered to the server, it should return the id for that module */ - //public static var Qid:int = 2; - - [Bindable] - private var survey:XML = - <list> - <module title="Preexperiment" sequenceNo="1" hours="0" min="3" sec="0" id="1"> + /**** + * Sample exmaple of Survey Questions structure + * <module title="Preexperiment" sequenceNo="1" hours="0" min="3" sec="0" id="1"> <block name="Introduction" sequenceNo="1" hours="0" min="3" sec="0" id="1"> - <questiongroup header="Welcome to E-Fishery Experiment" description="In this experiment you will design..." sequenceNo="1" id="1"/> + <questiongroup header="Welcome to E-Fishery Experiment" + description="In this experiment you will design..." sequenceNo="1" + hours="0" min="3" sec="0" id="1" /> </block> </module> <module title ="Game Round" sequenceNo="2" hours="1" min="30" sec="0" id="2"> <block name="Characterizing Own Strategy" sequenceNo="1" hours="0" min="30" sec="0" id="2"> - <questiongroup header="What goals did you follow when designing your strategy" description="Please specify three goals..." sequenceNo="1" id="2"> + <questiongroup header="What goals did you follow when designing your strategy" description="Please specify three goals..." hours="0" min="3" sec="0" sequenceNo="1" id="2"> <question title="Most important goal" type="categorical" sequenceNo="1" id="1" > </question> - - <question title="second important goal" type="psychometric" sequenceNo="2" id="2" > - </question> + </question> </questiongroup> @@ -60,56 +49,53 @@ </block> </module> - </list>; - /*[Bindable] + + * + */ + +/* id field of module, block and questiongroup and questions should come from database, +so when module info is transfered to the server, it should return the id for that module */ + + + [Bindable] private var survey:XML = <list> - <module title="Survey Questions" /> - </list>;*/ + <module title="Survey Questions" id="0" sequenceNo="0" hours="0" min="0" sec="0"/> + + </list>; - - /*[Bindable] - private var questions:XML = - <list> - <categorical id="1" type="relative"> - <optionKey name="fish" > - - </optionKey> + /** + * Sample example of categorical question structure + * + * <categorical type="relative" id="2"> + <option name="focus on earning" choices="less,more,most" /> + <option name="focus on fish" choices="123,more than 123,none" /> </categorical> - <categorical id="2" type="simple"> - <optionKey name="poeple" > - - </optionKey> + <categorical type="simple" id="1"> + <option name="less"/> + <option name="more"/> + <option name="most" /> + </categorical> - <psychometric id="1" scale="bipolar" numberOfIntervals="21"> - - </psychometric> - - </list>; */ - - - [Bindable] + * + * ***/ + + [Bindable] private var categoricalQuestions:XML = <list> <categorical type="Categorical Questions" id="0"/> - <categorical type="relative" id="2"> - <option name="focus on earning" choice1="less" choice2="more" choice3="most" /> - <option name="focus on fish" choice1="123" choice2="more than 123" choice3="none" /> - </categorical> - <categorical type="simple" id="1"> - <option choice1="less" choice2="more" choice3="most" /> - - </categorical> </list>; + /** + * Sample example of psychometric question structure + * <psychometric scale="bipolar" id="2" choices="good,better,best" maxSliderValue="21" /> + **/ + [Bindable] private var psychometricQuestions:XML = <list> - <psychometric scale="Psychometric Questions" id="0"/> - <psychometric scale="bipolar" id="2" choice1="good" choice2="better" choice3="best" interval="21" /> - - + <psychometric scale="Psychometric Questions" id="0" choices="none" maxSliderValue="0"/> </list>; @@ -122,6 +108,8 @@ public var tempQuestion:ArrayCollection = new ArrayCollection(); + + private function init():void { roQuestionCreator.initializeData(); @@ -148,7 +136,7 @@ survey.appendChild(newModuleNode); //if any blocks, add into the module - if(module.blocks != null) + if(module.blocks != null) { for(var blockCounter:int = 0; blockCounter < module.blocks.length; blockCounter++) { @@ -181,9 +169,9 @@ } } - } + } + } } - } } } @@ -230,7 +218,10 @@ newNode.@header = questionGroup.header; newNode.@description = questionGroup.description; newNode.@sequenceNo = questionGroup.sequenceNo; - newNode.@id = questionGroup.id; + newNode.@hours = questionGroup.getHours(); + newNode.@min = questionGroup.getMinutes(); + newNode.@sec = questionGroup.getSeconds(); + newNode.@id = questionGroup.id; return newNode; @@ -240,33 +231,40 @@ { var newQNode:XML = <question/>; newQNode.setLocalName("question"); + var choices:String=""; if(question.type.toLowerCase() == "psychometric") { var psychometricResult:actionscript.questions.Psychometric = actionscript.questions.Psychometric(question); - Alert.show("Id is: " + psychometricResult.id); + /*Alert.show("Id is: " + psychometricResult.id); Alert.show("Question is: " + psychometricResult.question); Alert.show("Type is: " + psychometricResult.type); - Alert.show("SeQNo is: " + psychometricResult.sequenceNo); + Alert.show("SeQNo is: " + psychometricResult.sequenceNo);*/ var newPNode:XML = <psychometric/>; newPNode.setLocalName("psychometric"); newPNode.@id = psychometricResult.id; newPNode.@scale = psychometricResult.scale; - newPNode.@noOfInterval = psychometricResult.maxSliderValue; + newPNode.@maxSliderValue = psychometricResult.maxSliderValue; newQNode.@sequenceNo = psychometricResult.sequenceNo; newQNode.@title = psychometricResult.question; newQNode.@type = psychometricResult.type; newQNode.@id = psychometricResult.id; - - for(var j:int = 0; j < psychometricResult.choices.length; j++) - { - var str:String = "choice"; - str = str + j; - newPNode.@str = psychometricResult.choices[j]; - } - + choices = ""; + if(psychometricResult.choices != null) + { + + for(var k:int = 0; k < psychometricResult.choices.length; k++) + { + choices = choices + psychometricResult.choices[k]; + choices = choices + "," + + } + //Alert.show("choices are: " + choices); + + newPNode.@choices = choices; + } psychometricQuestions.appendChild(newPNode); } @@ -286,44 +284,60 @@ currentState = "none"; btnsaveQuestion.enabled = false; }*/ + //false means it is simple type, otherwise it is relative type + var flagType:Boolean = false; var newCNode:XML = <categorical/>; newCNode.setLocalName("categorical"); newCNode.@id = categoricalResult.id; categoricalQuestions.appendChild(newCNode); - - for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++) - { - var options:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); - options = actionscript.questions.CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); - var newOptionNode:XML = <option/>; - newOptionNode.setLocalName("option"); - newOptionNode.@name = options.optionKey; - if(options.choices.length <= 0) - { - newCNode.@type = "simple"; - - } - else - { - newCNode.@type = "relative"; - for(var k:int = 0; k < options.choices.length; k++) + + if(categoricalResult.categoricalOptions != null) + { + + for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++) + { + var options:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); + options = actionscript.questions.CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); + var newOptionNode:XML = <option/>; + newOptionNode.setLocalName("option"); + newOptionNode.@name = options.optionKey; + if(options.choices.length == 0) { - var choice:String = "choice"; - choice = choice + k; - newOptionNode.@choice = options.choices[k]; + flagType = false } - } - - /*var module:XMLList = survey.module.(@id == tempmodule.id); - if( module.length() > 0 ) - { - module[0].appendChild(newBlockNode); - }*/ - newCNode.appendChild(newOptionNode); - } - - + else + { + flagType = true; + choices=""; + + for(k = 0; k < options.choices.length; k++) + { + choices = choices + options.choices[k]; + choices = choices + "," + + } + //Alert.show("choices are: " + choices); + + newOptionNode.@choices = choices; + } + if(flagType) + newCNode.@type = "relative"; + else + newCNode.@type = "simple"; + newCNode.appendChild(newOptionNode); + } + } + + } + //if question type is strategy, day by day decision, forecasting fish, forecasting fishermen + else + { + newQNode.@sequenceNo = question.sequenceNo; + newQNode.@title = question.question; + newQNode.@type = question.type; + newQNode.@id = question.id; + } return newQNode; @@ -348,7 +362,7 @@ return node.@header; else if( node.localName() == "question" ) - return node.@title; + return node.@type; else return null; @@ -419,16 +433,43 @@ { var title:String = moduleInfo.getName(); var seqNo:int = int(moduleInfo.getSequenceNo()); - if(moduleInfo.getId() == 0) - { - roQuestionCreator.saveModule(seqNo, title, getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds())); + + /* check first Id if the module exists, + if no, then check if sequence number already exists for other module, + if no then create module otherwise throw error */ + + var checkSeqNoModule:XMLList = survey.module.(@sequenceNo == moduleInfo.getSequenceNo()); + + /* check if new module needs to be created, if yes, check if the sequence number is already exists + if "No" then only save into the database */ + + if(moduleInfo.getId() == 0) + { + if(checkSeqNoModule.length() > 0) + { + Alert.show("Sequence number : " + seqNo + " already exists!"); + } + else + roQuestionCreator.saveModule(seqNo, title, getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds())); + } + + else + { + //Alert.show("length : " + checkSeqNoModule.length().toString()); + //check if the sequence number exists, do not update the module + + if(checkSeqNoModule.length() > 1) + { + Alert.show("Sequence number : " + seqNo + " already exists!"); + } + else + roQuestionCreator.updateModule(moduleInfo.getId(),seqNo, title, getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds())); + } - else - roQuestionCreator.updateModule(moduleInfo.getId(),seqNo, title, getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds())); - currentState = "none"; + + currentState = "none"; btnsaveModule.enabled = false; - //pnlComponent.removeChildAt(1); - } + } } else @@ -447,35 +488,35 @@ public function resultSaveModuleHandler(event:ResultEvent):void { var module:actionscript.Module = actionscript.Module(event.result as Object); - Alert.show("Id is: " + module.id); - var newModuleNode:XML = <module/>; - newModuleNode.setLocalName("module"); - newModuleNode.@title= module.description; - newModuleNode.@sequenceNo = module.sequenceNo; - newModuleNode.@hours = module.getHours(); - newModuleNode.@min = module.getMinutes(); - newModuleNode.@sec = module.getSeconds(); - newModuleNode.@id = module.id; - survey.appendChild(newModuleNode); - if(surveyData == null) + + if(module == null) { - surveyData= new XMLListCollection(survey.module); + Alert.show("Error in creating module!"); } + else + { + //Alert.show("Id is: " + module.id); + var newModuleNode:XML = createModuleNode(module); + survey.appendChild(newModuleNode); + } - - } //when module is updated, the result will come to resultUpdateModuleHandler public function resultUpdateModuleHandler(event:ResultEvent):void { var module:actionscript.Module = actionscript.Module(event.result as Object); - var moduleXML:XMLList = survey.module.(@id == module.id); - moduleXML.@title = module.description; - moduleXML.@sequenceNo = module.sequenceNo; - moduleXML.@hours = module.getHours(); - moduleXML.@min = module.getMinutes(); - moduleXML.@sec = module.getSeconds(); + if(module != null) + { + var moduleXML:XMLList = survey.module.(@id == module.id); + moduleXML.@title = module.description; + moduleXML.@sequenceNo = module.sequenceNo; + moduleXML.@hours = module.getHours(); + moduleXML.@min = module.getMinutes(); + moduleXML.@sec = module.getSeconds(); + } + else + Alert.show("Error in updating module!"); } @@ -535,25 +576,42 @@ var parentNode:XML = tree.getParentItem(tree.selectedItem) as XML; node = parentNode; } - var module:XMLList = survey.module.(@title == node.@title); - //Alert.show("Module length is : " + module.length()); + var module:XMLList = survey.module.(@id == node.@id); + if( module.length() > 0 ) { - // Alert.show("Block id is : " + blockInfo.getId()); - if(blockInfo.getId() == 0) - { - roQuestionCreator.saveBlock(int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id)); - } - else - { - roQuestionCreator.updateBlock(blockInfo.getId(), int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id)); + + //check the sequence number first, if sequence number already exists throw an error, otherwise create block + var checkSeqNoBlock:XMLList = module.block.(@sequenceNo == blockInfo.getSequenceNo()); + if(blockInfo.getId() == 0) + { + if(checkSeqNoBlock.length() > 0) + { + Alert.show("Sequence number " + blockInfo.getSequenceNo() + " already exists!"); + } + else + { + roQuestionCreator.saveBlock(int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id)); + } + } + else + { + //Alert.show("length : " + checkSeqNoBlock.length().toString()); + //check if the sequence number exists, do not update the module + if(checkSeqNoBlock.length() > 1) + { + Alert.show("Sequence number : " + blockInfo.getSequenceNo() + " already exists!"); + } + else + roQuestionCreator.updateBlock(blockInfo.getId(), int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id)); + } + + currentState = "none"; + btnsaveBlock.enabled = false; } - currentState = "none"; - btnsaveBlock.enabled = false; - // pnlComponent.removeChildAt(1); - } + } } - } + else { Alert.show("Please fill the form correctly"); @@ -570,14 +628,7 @@ if(block != null) { - var newBlockNode:XML = <block/>; - newBlockNode.setLocalName("block"); - newBlockNode.@name = block.description; - newBlockNode.@sequenceNo = block.sequenceNo; - newBlockNode.@hours = block.getHours(); - newBlockNode.@min = block.getMinutes(); - newBlockNode.@sec = block.getSeconds(); - newBlockNode.@id = block.id; + var newBlockNode:XML = createBlockNode(block); var tempmodule:actionscript.Module = block.module; var module:XMLList = survey.module.(@id == tempmodule.id); @@ -585,7 +636,9 @@ { module[0].appendChild(newBlockNode); } - } + } + else + Alert.show("Error in creating Block!"); } @@ -593,19 +646,24 @@ public function resultUpdateBlockHandler(event:ResultEvent):void { var block:actionscript.Block = actionscript.Block(event.result as Object); - - var tempmodule:actionscript.Module = block.module; - - var blockXML:XMLList = survey.module.block.(@id == block.id); - - blockXML.@name = block.description; - blockXML.@sequenceNo = block.sequenceNo; - blockXML.@hours = block.getHours(); - blockXML.@min = block.getMinutes(); - blockXML.@sec = block.getSeconds(); + if(block != null) + { + var tempmodule:actionscript.Module = block.module; + var blockXML:XMLList = survey.module.block.(@id == block.id); + if(blockXML.length() > 0) + { + blockXML[0].@name = block.description; + blockXML[0].@sequenceNo = block.sequenceNo; + blockXML[0].@hours = block.getHours(); + blockXML[0].@min = block.getMinutes(); + blockXML[0].@sec = block.getSeconds(); + } + } + else + Alert.show("Error in creating Block!"); } - //Block functioanlity Stop + //Block functioanlity End //QuestionGroup functionality Start @@ -629,7 +687,7 @@ var selectedNode:XML = tree.selectedItem as XML; var obj:DisplayObject = pnlComponent.getChildAt(1); var questionGroupInfo:custom.db.QuestionGroup = custom.db.QuestionGroup(obj); - Alert.show("Question Group Id is: " + questionGroupInfo.getId()); + if(tree.selectedItem == null) { Alert.show("Please select the block from tree to which Question Group should be added."); @@ -656,12 +714,18 @@ { //find out the parent module var parentModule:XML = tree.getParentItem(tree.selectedItem) as XML; - - + var isQuestionGroupFormValid:Boolean = questionGroupInfo.validateForm(event); if(isQuestionGroupFormValid) { + var durationflag:Boolean = this.isDurationValid(questionGroupInfo.getHours(),questionGroupInfo.getMinutes(),questionGroupInfo.getSeconds()); + if(durationflag) + { + Alert.show("Please enter the valid duration for the given module."); + } + else + { var node:XML; /** * Check if the selected node is block, if it is new Question Group needs to be created. @@ -677,22 +741,46 @@ node = parentNode; } var block:XMLList = survey.module.block.(@id == node.@id); - //Alert.show("block id is : " + block[0].@id + "length is: " + block.length()); + //Alert.show("block id is : " + block.@id + "length is: " + block.length().toString()); if( block.length() > 0 ) { - if(questionGroupInfo.getId() == 0) - { - roQuestionCreator.saveQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),int(block[0].@id)); - } - else - { - roQuestionCreator.updateQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),int(block[0].@id),questionGroup.getId()); + //check the sequence number first, if sequence number already exists throw an error, otherwise create module + var checkSeqNoQuestionGroup:XMLList = block.questiongroup.(@sequenceNo == questionGroupInfo.getSequenceNo()); + //Alert.show("length : " + checkSeqNoQuestionGroup.length().toString()); + if(questionGroupInfo.getId() == 0) + { + if(checkSeqNoQuestionGroup.length() > 0) + { + Alert.show("Sequence number " + questionGroupInfo.getSequenceNo() + " already exists!"); + } + else + { + roQuestionCreator.saveQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),getDuration(questionGroupInfo.getHours(),questionGroupInfo.getMinutes(),questionGroupInfo.getSeconds()),int(block[0].@id)); + } + } + else + { + //Alert.show("length : " + checkSeqNoQuestionGroup.length().toString()); + //check if the sequence number exists, do not update the module + if(checkSeqNoQuestionGroup.length() > 1) + { + Alert.show("Sequence number : " + questionGroupInfo.getSequenceNo() + " already exists!"); + } + else + roQuestionCreator.updateQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),getDuration(questionGroupInfo.getHours(),questionGroupInfo.getMinutes(),questionGroupInfo.getSeconds()),int(block[0].@id),questionGroup.getId()); + } - currentState = "none"; - btnsaveQuestionGroup.enabled = false; - //pnlComponent.removeChildAt(1); - } - } + currentState = "none"; + btnsaveQuestionGroup.enabled = false; + } + + } + } + else + { + Alert.show("Please fill the form correctly"); + return; + } } } } @@ -702,23 +790,23 @@ public function resultSaveQuestionGroupHandler(event:ResultEvent):void { var questionGroup:actionscript.QuestionGroup = actionscript.QuestionGroup(event.result as Object); - Alert.show("Id is: " + questionGroup.id); - var newNode:XML = <questiongroup/>; - newNode.setLocalName("questiongroup"); - newNode.@header = questionGroup.header; - newNode.@description = questionGroup.description; - newNode.@sequenceNo = questionGroup.sequenceNo; - newNode.@id = questionGroup.id; - - var block:actionscript.Block = questionGroup.block; + + if(questionGroup != null) + { + var newQuestionGroupNode:XML = createQuestionGroupNode(questionGroup); + + var block:actionscript.Block = questionGroup.block; - var blockXML:XMLList =survey.module.block.(@id == block.id); + var blockXML:XMLList =survey.module.block.(@id == block.id); - if( blockXML.length() > 0 ) - { - blockXML[0].appendChild(newNode); + if( blockXML.length() > 0 ) + { + blockXML[0].appendChild(newQuestionGroupNode); - } + } + } + else + Alert.show("Error in creating QuestionGroup!"); } @@ -726,17 +814,34 @@ public function resultUpdateQuestionGroupHandler(event:ResultEvent):void { var questionGroup:actionscript.QuestionGroup = actionscript.QuestionGroup(event.result as Object); - Alert.show("Id is: " + questionGroup.id); - var newNode:XML = <questiongroup/>; - newNode.setLocalName("questiongroup"); - newNode.@header = questionGroup.header; - newNode.@description = questionGroup.description; - newNode.@sequenceNo = questionGroup.sequenceNo; - var block:actionscript.Block = questionGroup.block; - - } + + //Alert.show("Id is: " + questionGroup.id); + if(questionGroup != null) + { + var newNode:XML = <questiongroup/>; + newNode.setLocalName("questiongroup"); + var questionGroupXML:XMLList = survey.module.block.questiongroup.(@id == questionGroup.id); + //Alert.show("Length is: " + questionGroupXML.length()); + if(questionGroupXML.length() > 0) + { + // Alert.show("header is :" + questionGroup.header); + // Alert.show("questionGroup description is :" + questionGroup.description); + //Alert.show("questionGroup.sequenceNo is :" + questionGroup.sequenceNo); + + questionGroupXML[0].@header = questionGroup.header; + questionGroupXML[0].@description = questionGroup.description; + questionGroupXML[0].@sequenceNo = questionGroup.sequenceNo; + questionGroupXML[0].@hours = questionGroup.getHours(); + questionGroupXML[0].@min = questionGroup.getMinutes(); + questionGroupXML[0].@sec = questionGroup.getSeconds(); + + } + } + else + Alert.show("Error in updating QuestionGroup!"); + } - //QuestionGroup functionality Stop + //QuestionGroup functionality End //Question functionality Start @@ -755,26 +860,43 @@ private function QuestionHandler(event:Event):void { - if(question.cmbType.selectedItem.toString().toLowerCase() == "psychometric") + if(question.cmbType.selectedItem.data.toString().toLowerCase() == "psychometric") + { currentState = "psychometric"; - else if(question.cmbType.selectedItem.toString().toLowerCase() == "categorical") + psychometric.reset(); + } + else if(question.cmbType.selectedItem.data.toString().toLowerCase() == "categorical") + { currentState = "categorical"; + categorical.reset(); + } + else + { + currentState = "question"; + + } } private function CategoricalTypeHandler(event:Event):void { if(categorical.cmbType.selectedItem.toString().toLowerCase() == "relative") + { currentState = "relative"; + categoricalRelative.reset(); + } else if(categorical.cmbType.selectedItem.toString().toLowerCase() == "simple") + { currentState = "simple"; + categoricalSimple.reset(); + } + } - - private function saveQuestion(event:Event):void { - var node:XML = tree.selectedItem as XML; + var selectedNode:XML = tree.selectedItem as XML; + var node:XML; if(tree.selectedItem == null) { @@ -783,109 +905,207 @@ } else { - - //if(tree.getParentItem(tree.selectedItem) == null) - if(node.localName() != "questiongroup") + if(selectedNode.localName().toString().toLowerCase() == "module" || selectedNode.localName().toString().toLowerCase() == "block") { - Alert.show("You can add Question to QuestionGroup only."); + Alert.show("You can not add Question to Module or Block."); return; } else { - //find out the parent module - var parentModule:XML = tree.getParentItem(tree.selectedItem) as XML; + if(selectedNode.localName().toString().toLowerCase() == "questiongroup") + { + node = selectedNode; + } + else if(selectedNode.localName().toString().toLowerCase() == "question") + { + var parentNode:XML = tree.getParentItem(tree.selectedItem) as XML; + node = parentNode; + } + + var obj:DisplayObject = pnlComponent.getChildAt(1); var questionInfo:custom.db.Question = custom.db.Question(obj); - var isQuestionGroupFormValid:Boolean = questionInfo.validateForm(event); + var isQuestionFormValid:Boolean = questionInfo.validateForm(event); - if(isQuestionGroupFormValid) + if(isQuestionFormValid) { - - if(currentState == "psychometric") - { - var psychobj:DisplayObject = pnlComponent.getChildAt(2); - - var compPsychometric:custom.db.questions.Psychometric = custom.db.questions.Psychometric(psychobj); - - var asPsychometric:actionscript.questions.Psychometric = new actionscript.questions.Psychometric(); - asPsychometric.scale = compPsychometric.getScale(); - asPsychometric.maxSliderValue = int(compPsychometric.getNumberofIntervals()); - asPsychometric.choices = compPsychometric.getChoices(); - asPsychometric.question = questionInfo.getQuestion(); - asPsychometric.sequenceNo = int(questionInfo.getSequenceNo()); - asPsychometric.type = questionInfo.getType(); - - Alert.show("Psychometric Object :"); - Alert.show("Question: " + asPsychometric.question); - Alert.show("SeQ No: " + asPsychometric.sequenceNo); - Alert.show("Type : " + asPsychometric.type); - roQuestionCreator.saveQuestion(asPsychometric,1); - } - else if(currentState == "relative") - { - var catobj:DisplayObject = pnlComponent.getChildAt(3); - var compCategorical:CategoricalRelative = CategoricalRelative(catobj); - var categoricalQuestion:actionscript.questions.Categorical = new actionscript.questions.Categorical(); - - var dict:Dictionary = new Dictionary(); - dict = compCategorical.getDictionary(); - for (var key:Object in dict) - { - var Options:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); - Options.optionKey = key.toString(); - Options.choices = dict[key]; - categoricalQuestion.categoricalOptions.addItem(Options); - } - categoricalQuestion.type = questionInfo.getType(); - categoricalQuestion.question = questionInfo.getQuestion(); - categoricalQuestion.sequenceNo = int(questionInfo.getSequenceNo()); - for(var i:int = 0; i < categoricalQuestion.categoricalOptions.length ; i++) - { - var testoption:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); - testoption = actionscript.questions.CategoricalOption(categoricalQuestion.categoricalOptions.getItemAt(i)); - trace(testoption.optionKey); - trace(testoption.choices); - } - roQuestionCreator.saveQuestion(categoricalQuestion,1); - - } - else if(currentState == "simple") - { - Alert.show("simple state"); - var catSimpleobj:DisplayObject = pnlComponent.getChildAt(3); - var compCategoricalSimple:custom.db.questions.CategoricalSimple = custom.db.questions.CategoricalSimple(catSimpleobj); - var categoricalSimpleQuestion:actionscript.questions.Categorical = new actionscript.questions.Categorical(); - + Alert.show("Parent id: " + node.@id); + //check the sequence number first, if sequence number already exists throw an error, otherwise create Question + + var questionGroup:XMLList = survey.module.block.questiongroup.(@id == node.@id); + Alert.show("Parent children length: " + questionGroup.children().length()); + if(questionGroup.length() > 0 ) + { + var checkSeqNoQuestion:XMLList = questionGroup.question.(@sequenceNo == questionInfo.getSequenceNo()); + Alert.show("checkSeqNoQuestion length: " + checkSeqNoQuestion.length()); + if(currentState == "psychometric") + { + var psychobj:DisplayObject = pnlComponent.getChildAt(2); + + var compPsychometric:custom.db.questions.Psychometric = custom.db.questions.Psychometric(psychobj); + + var asPsychometric:actionscript.questions.Psychometric = new actionscript.questions.Psychometric(); + asPsychometric.scale = compPsychometric.getScale(); + asPsychometric.maxSliderValue = int(compPsychometric.getNumberofIntervals()); + asPsychometric.choices = compPsychometric.getChoices(); + asPsychometric.question = questionInfo.getQuestion(); + asPsychometric.sequenceNo = int(questionInfo.getSequenceNo()); + asPsychometric.type = questionInfo.getType(); + + //Alert.show("Psychometric Object :"); + //Alert.show("Question: " + asPsychometric.question); + //Alert.show("SeQ No: " + asPsychometric.sequenceNo); + //Alert.show("Type : " + asPsychometric.type); + + if(questionInfo.getId() == 0) + { + if(checkSeqNoQuestion.length() > 0) + { + Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already exists!"); + } + else + roQuestionCreator.saveQuestion(asPsychometric,int(node.@id)); + } + else + { + if(checkSeqNoQuestion.length() > 1) + { + Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already exists!"); + } + else + roQuestionCreator.updateQuestion(asPsychometric,int(node.@id), questionInfo.getId()); + } + + } + + else if(currentState == "relative") + { + var catobj:DisplayObject = pnlComponent.getChildAt(3); + var compCategorical:CategoricalRelative = CategoricalRelative(catobj); + var categoricalQuestion:actionscript.questions.Categorical = new actionscript.questions.Categorical(); + + var dict:Dictionary = new Dictionary(); + dict = compCategorical.getDictionary(); + for (var key:Object in dict) + { + var Options:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); + Options.optionKey = key.toString(); + Options.choices = dict[key]; + categoricalQuestion.categoricalOptions.addItem(Options); + } + categoricalQuestion.type = questionInfo.getType(); + categoricalQuestion.question = questionInfo.getQuestion(); + categoricalQuestion.sequenceNo = int(questionInfo.getSequenceNo()); + /*for(var i:int = 0; i < categoricalQuestion.categoricalOptions.length ; i++) + { + var testoption:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); + testoption = actionscript.questions.CategoricalOption(categoricalQuestion.categoricalOptions.getItemAt(i)); + trace(testoption.optionKey); + trace(testoption.choices); + }*/ + if(questionInfo.getId() == 0) + { + if(checkSeqNoQuestion.length() > 0) + { + Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already exists!"); + } + else + roQuestionCreator.saveQuestion(categoricalQuestion,int(node.@id)); + } + else + { + if(checkSeqNoQuestion.length() > 1) + { + Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already exists!"); + } + else + roQuestionCreator.updateQuestion(categoricalQuestion,int(node.@id), questionInfo.getId()); + } + + } + else if(currentState == "simple") + { + //Alert.show("simple state"); + var catSimpleobj:DisplayObject = pnlComponent.getChildAt(3); + var compCategoricalSimple:custom.db.questions.CategoricalSimple = custom.db.questions.CategoricalSimple(catSimpleobj); + var categoricalSimpleQuestion:actionscript.questions.Categorical = new actionscript.questions.Categorical(); - var Simpledict:Dictionary = new Dictionary(); - Simpledict = compCategoricalSimple.getDictionary(); - for (var option:Object in Simpledict) - { - var OptionsSimple:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); - OptionsSimple.optionKey = option.toString(); - Alert.show("Key : " + option.toString()); - OptionsSimple.choices = Simpledict[key]; - categoricalSimpleQuestion.categoricalOptions.addItem(OptionsSimple); - } - categoricalSimpleQuestion.type = questionInfo.getType(); - categoricalSimpleQuestion.question = questionInfo.getQuestion(); - categoricalSimpleQuestion.sequenceNo = int(questionInfo.getSequenceNo()); - /*for(var j:int = 0; j < categoricalSimpleQuestion.categoricalOptions.length ; j++) - { - var testoption:ASCategoricalOption = new ASCategoricalOption(); - testoption = ASCategoricalOption(categoricalSimpleQuestion.categoricalOptions.getItemAt(i)); - trace(testoption.optionKey); - trace(testoption.choices); - }*/ - Alert.show("Question: " + categoricalSimpleQuestion.question); - Alert.show("SeQ No: " + categoricalSimpleQuestion.sequenceNo); - Alert.show("Type : " + categoricalSimpleQuestion.type); - - roQuestionCreator.saveQuestion(categoricalSimpleQuestion,1); - - } - //roQuestionCreator.saveQuestion(int(questionInfo.getSequenceNo()),questionInfo.getQuestion(),questionInfo.getType(),int(parentModule.@id)); + var Simpledict:Dictionary = new Dictionary(); + Simpledict = compCategoricalSimple.getDictionary(); + for (var option:Object in Simpledict) + { + var OptionsSimple:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); + OptionsSimple.optionKey = option.toString(); + //Alert.show("Key : " + option.toString()); + OptionsSimple.choices = Simpledict[key]; + categoricalSimpleQuestion.categoricalOptions.addItem(OptionsSimple); + } + categoricalSimpleQuestion.type = questionInfo.getType(); + categoricalSimpleQuestion.question = questionInfo.getQuestion(); + categoricalSimpleQuestion.sequenceNo = int(questionInfo.getSequenceNo()); + /*for(var j:int = 0; j < categoricalSimpleQuestion.categoricalOptions.length ; j++) + { + var testoption:ASCategoricalOption = new ASCategoricalOption(); + testoption = ASCategoricalOption(categoricalSimpleQuestion.categoricalOptions.getItemAt(i)); + trace(testoption.optionKey); + trace(testoption.choices); + }*/ + /*Alert.show("Question: " + categoricalSimpleQuestion.question); + Alert.show("SeQ No: " + categoricalSimpleQuestion.sequenceNo); + Alert.show("Type : " + categoricalSimpleQuestion.type);*/ + + + if(questionInfo.getId() == 0) + { + if(checkSeqNoQuestion.length() > 0) + { + Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already exists!"); + } + else + roQuestionCreator.saveQuestion(categoricalSimpleQuestion,int(node.@id)); + } + else + { + if(checkSeqNoQuestion.length() > 1) + { + Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already exists!"); + } + else + roQuestionCreator.updateQuestion(categoricalSimpleQuestion,int(node.@id), questionInfo.getId()); + } + + } + else if(currentState == "question") + { + + var question:actionscript.questions.Question = new actionscript.questions.Question(); + + question.question = questionInfo.getQuestion(); + question.sequenceNo = int(questionInfo.getSequenceNo()); + question.type = questionInfo.getType(); + //Alert.show("Type : " + question.type); + if(questionInfo.getId() == 0) + { + if(checkSeqNoQuestion.length() > 0) + { + Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already exists!"); + } + else + roQuestionCreator.saveQuestion(question,int(node.@id)); + } + else + { + if(checkSeqNoQuestion.length() > 1) + { + Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already exists!"); + } + else + roQuestionCreator.updateQuestion(question,int(node.@id), questionInfo.getId()); + } + + } + } } @@ -896,96 +1116,142 @@ public function resultSaveQuestionHandler(event:ResultEvent):void { - var test_object:Object = event.result as Object; - Alert.show("Type came from server is: " + test_object.type); - if(test_object.type == "psychometric") + var question_Object:actionscript.questions.Question = actionscript.questions.Question(event.result as Object); + if(question_Object != null) { - var questionResult:actionscript.questions.Psychometric = actionscript.questions.Psychometric(event.result as Object); - Alert.show("Id is: " + questionResult.id); - Alert.show("Question is: " + questionResult.question); - Alert.show("Type is: " + questionResult.type); - Alert.show("SeQNo is: " + questionResult.sequenceNo); + var newQuestionNode:XML = createQuestionNode(question_Object); + Alert.show("question_Object.questionGroup.id " + question_Object.questionGroup.id); + var questionGroup:XMLList = survey.module.block.questiongroup.(@id == question_Object.questionGroup.id); + Alert.show("question_Object.questionGroup.length " + questionGroup.length()); + if( questionGroup.length() > 0 ) + { + questionGroup[0].appendChild(newQuestionNode); + currentState = "none"; + btnsaveQuestion.enabled = false; + } + } + else + Alert.show("Error in creating Question!"); + + + } + + public function resultUpdateQuestionHandler(event:ResultEvent):void + { + var question:actionscript.questions.Question = actionscript.questions.Question(event.result as Object); + if(question == null) + { + Alert.show("Error in creating Question!"); + } + else + { + var newNode:XML = <question/>; + newNode.setLocalName("question"); + var newQNode:XML = <question/>; + newQNode.setLocalName("question"); + var choices:String=""; + if(question.type.toLowerCase() == "psychometric") + { + var psychometricResult:actionscript.questions.Psychometric = actionscript.questions.Psychometric(question); + /*Alert.show("Id is: " + psychometricResult.id); + Alert.show("Question is: " + psychometricResult.question); + Alert.show("Type is: " + psychometricResult.type); + Alert.show("SeQNo is: " + psychometricResult.sequenceNo);*/ + var newPNode:XML = <psychometric/>; newPNode.setLocalName("psychometric"); - newPNode.@id = questionResult.id; - newPNode.@scale = questionResult.scale; - newPNode.@noOfInterval = questionResult.maxSliderValue; - for(var j:int = 0; j < questionResult.choices.length; j++) + var psychometricList:XMLList = psychometricQuestions.psychometric.(@id == psychometricResult.id); + + if( psychometricList.length() > 0 ) { - var str:String = "choice"; - str = str + j; - newPNode.@str = questionResult.choices[j]; + newPNode.@scale = psychometricResult.scale; + newPNode.@maxSliderValue = psychometricResult.maxSliderValue; + + newQNode.@sequenceNo = psychometricResult.sequenceNo; + newQNode.@title = psychometricResult.question; + newQNode.@type = psychometricResult.type; + choices = ""; + if(psychometricResult.choices != null) + { + + for(var k:int = 0; k < psychometricResult.choices.length; k++) + { + choices = choices + psychometricResult.choices[k]; + choices = choices + "," + + } + + newPNode.@choices = choices; + } + } - - psychometricQuestions.appendChild(newPNode); - + } - else if(test_object.type.toLowerCase() == "categorical") + else if(question.type.toLowerCase() == "categorical") { - var categoricalResult:actionscript.questions.Categorical = actionscript.questions.Categorical(test_object); - var newQNode:XML = <question/>; - newQNode.setLocalName("question"); + var categoricalResult:actionscript.questions.Categorical = actionscript.questions.Categorical(question); + newQNode.@sequenceNo = categoricalResult.sequenceNo; newQNode.@title = categoricalResult.question; newQNode.@type = categoricalResult.type; newQNode.@id = categoricalResult.id; - var questionGroup:XMLList =survey.module.block.questiongroup.(@header == node.@header); - - if( questionGroup.length() > 0 ) - { - questionGroup[0].appendChild(newQNode); - currentState = "none"; - btnsaveQuestion.enabled = false; - } + + //flagType false means it is simple type, otherwise it is relative type + var flagType:Boolean = false; var newCNode:XML = <categorical/>; newCNode.setLocalName("categorical"); - newCNode.@id = categoricalResult.id; - categoricalQuestions.appendChild(newCNode); - - for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++) - { - var options:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); - options = actionscript.questions.CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); - var newOptionNode:XML = <option/>; - newOptionNode.setLocalName("option"); - newOptionNode.@name = options.optionKey; - if(options.choices.length <= 0) - { - newCNode.@type = "simple"; - - } - else - { - newCNode.@type = "relative"; - for(var k:int = 0; k < options.choices.length; k++) - { - var choice:String = "choice"; - choice = choice + k; - newOptionNode.@choice = options.choices[k]; - } - } - - /*var module:XMLList = survey.module.(@id == tempmodule.id); - if( module.length() > 0 ) - { - module[0].appendChild(newBlockNode); - }*/ - newCNode.appendChild(newOptionNode); - } + var categoricalList:XMLList = categoricalQuestions.categorical.(@id == categoricalResult.id); - } - - currentState = "none"; - btnsaveQuestion.enabled = false; - - - } - - public function resultUpdateQuestionHandler(event:Event):void - { + if( categoricalList.length() > 0 ) + { + //remove all the <option> tags and then add those rather than modifying those. It is simple. + var children:XMLList = categoricalList.children(); + + for(var l:Number=0; l < children.length(); l++) + { + delete children[i]; + } + + + if(categoricalResult.categoricalOptions != null) + { + + for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++) + { + var options:actionscript.questions.CategoricalOption = new actionscript.questions.CategoricalOption(); + options = actionscript.questions.CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); + var newOptionNode:XML = <option/>; + newOptionNode.setLocalName("option"); + newOptionNode.@name = options.optionKey; + if(options.choices.length == 0) + { + flagType = false + } + else + { + flagType = true; + choices=""; + + for(k = 0; k < options.choices.length; k++) + { + choices = choices + options.choices[k]; + choices = choices + "," + } + newOptionNode.@choices = choices; + } + if(flagType) + newCNode.@type = "relative"; + else + newCNode.@type = "simple"; + newCNode.appendChild(newOptionNode); + } + } + } + } + } } //Question functionality Stop @@ -1024,6 +1290,7 @@ var selectedNode:int; var node:XML = XML(tree.selectedItem); + lbltest.text = node.@id; if(node.localName() == "module") { currentState = "module"; @@ -1076,10 +1343,15 @@ btnsaveQuestion.enabled = false; //set all fields + questionGroupInfo.setHeader(node.@header); questionGroupInfo.setDescription(node.@description); questionGroupInfo.setSequenceNo(node.@sequenceNo); questionGroupInfo.setId(node.@id); + questionGroupInfo.setHours(node.@hours); + questionGroupInfo.setMinutes(node.@min); + questionGroupInfo.setSeconds(node.@sec); + //Alert.show("Question group id assigned is: " + node.@id); } @@ -1100,9 +1372,12 @@ questionInfo.setQuestion(node.@title); questionInfo.setSequenceNo(node.@sequenceNo); questionInfo.setId(node.@id); + var str:String = node.@type; + /*Alert.show("q type is: " + node.@type); + questionInfo.cmbType.selectedItem = str.toLowerCase();*/ + questionInfo.setQuestionType(node.@type); - if(node.@type == "categorical") { currentState = "categorical"; @@ -1110,9 +1385,9 @@ var compCate... [truncated message content] |
From: seema t. <see...@gm...> - 2009-07-20 01:41:28
|
forgot to mention one more change and that is- Before enetring or updating the database, sequence number is checked, if sequence number exists, then error message is thrown. On Sun, Jul 19, 2009 at 6:13 PM, <see...@us...> wrote: > Revision: 188 > http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=188&view=revAuthor: seematalele Date: 2009-07-20 01:13:36 +0000 (Mon, 20 Jul 2009) Log > Message: ----------- Created HibernateCategoricalQuestionDao.java and > HibernatePsychometricQuestionDao.java. Changed the code of > InitialiseDatabase.mxml - Adding Module,Block,QuestionGroup and Question is > working fine. - Updating Module,Block,QuestionGroup is working fine. Need to > test updating Questions in InitialiseDatabase.mxml. (But I am not going to > test it until it really needs because it is taking some time) The init-mme > file contains the database which initialized till Module 2A - Block 2-4 > Commented the createQuestions in QuestionCreatorService.java and > StartupService.java Modified Paths: -------------- > mentalmodels/trunk/flex/src/InitialiseDatabase.mxml > mentalmodels/trunk/flex/src/actionscript/Block.as > mentalmodels/trunk/flex/src/actionscript/Module.as > mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as > mentalmodels/trunk/flex/src/actionscript/questions/Question.as > mentalmodels/trunk/flex/src/custom/db/Block.mxml > mentalmodels/trunk/flex/src/custom/db/Module.mxml > mentalmodels/trunk/flex/src/custom/db/Question.mxml > mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml > mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml > mentalmodels/trunk/flex/src/custom/db/questions/CategoricalRelative.mxml > mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml > mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml > mentalmodels/trunk/src/main/db/init-mme.sql > mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java > mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java > mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java > mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java > mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Added > Paths: ----------- > mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateCategoricalQuestionDao.java > mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernatePsychometricQuestionDao.java > Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml > =================================================================== --- > mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-17 23:21:35 UTC > (rev 187) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-20 > 01:13:36 UTC (rev 188) @@ -5,11 +5,7 @@ - + /**** + * Sample exmaple of > Survey Questions structure + * - + - + - - - + @@ -60,56 +49,53 @@ - ; - > /*[Bindable] + + * + */ + +/* id field of module, block and questiongroup > and questions should come from database, +so when module info is transfered > to the server, it should return the id for that module */ + + + [Bindable] > private var survey:XML = - - ;*/ + + + ; - - /*[Bindable] - private var > questions:XML = - - - - - + /** + * Sample example of categorical question > structure + * + * + + - - - - + + + + + - - - - - ; */ - - - [Bindable] + * > + * ***/ + + [Bindable] private var categoricalQuestions:XML = - - - - - - - > - ; + /** + * Sample example of psychometric question structure + * + **/ + > [Bindable] private var psychometricQuestions:XML = - - - - + ; @@ -122,6 > +108,8 @@ public var tempQuestion:ArrayCollection = new ArrayCollection(); + > + private function init():void { roQuestionCreator.initializeData(); @@ > -148,7 +136,7 @@ survey.appendChild(newModuleNode); //if any blocks, add > into the module - if(module.blocks != null) + if(module.blocks != null) { > for(var blockCounter:int = 0; blockCounter < module.blocks.length; > blockCounter++) { @@ -181,9 +169,9 @@ } } - } + } + } } - } } } @@ -230,7 > +218,10 @@ newNode.@header = questionGroup.header; newNode.@description = > questionGroup.description; newNode.@sequenceNo = questionGroup.sequenceNo; > - newNode.@id = questionGroup.id; + newNode.@hours = > questionGroup.getHours(); + newNode.@min = questionGroup.getMinutes(); + > newNode.@sec = questionGroup.getSeconds(); + newNode.@id = > questionGroup.id; return newNode; @@ -240,33 +231,40 @@ { var newQNode:XML = > ; newQNode.setLocalName("question"); + var choices:String=""; > if(question.type.toLowerCase() == "psychometric") { var > psychometricResult:actionscript.questions.Psychometric = > actionscript.questions.Psychometric(question); - Alert.show("Id is: " + > psychometricResult.id); + /*Alert.show("Id is: " + psychometricResult.id); > Alert.show("Question is: " + psychometricResult.question); Alert.show("Type > is: " + psychometricResult.type); - Alert.show("SeQNo is: " + > psychometricResult.sequenceNo); + Alert.show("SeQNo is: " + > psychometricResult.sequenceNo);*/ var newPNode:XML = ; > newPNode.setLocalName("psychometric"); newPNode.@id = > psychometricResult.id; newPNode.@scale = psychometricResult.scale; - > newPNode.@noOfInterval = psychometricResult.maxSliderValue; + > newPNode.@maxSliderValue = psychometricResult.maxSliderValue; > newQNode.@sequenceNo = psychometricResult.sequenceNo; newQNode.@title = > psychometricResult.question; newQNode.@type = psychometricResult.type; > newQNode.@id = psychometricResult.id; - - for(var j:int = 0; j < > psychometricResult.choices.length; j++) - { - var str:String = "choice"; - > str = str + j; - newPNode.@str = psychometricResult.choices[j]; - } - + > choices = ""; + if(psychometricResult.choices != null) + { + + for(var k:int > = 0; k < psychometricResult.choices.length; k++) + { + choices = choices + > psychometricResult.choices[k]; + choices = choices + "," + + } + > //Alert.show("choices are: " + choices); + + newPNode.@choices = choices; > + } psychometricQuestions.appendChild(newPNode); } @@ -286,44 +284,60 @@ > currentState = "none"; btnsaveQuestion.enabled = false; }*/ + //false means > it is simple type, otherwise it is relative type + var flagType:Boolean = > false; var newCNode:XML = ; newCNode.setLocalName("categorical"); > newCNode.@id = categoricalResult.id; > categoricalQuestions.appendChild(newCNode); - - for(var i:int = 0; i < > categoricalResult.categoricalOptions.length ; i++) - { - var > options:actionscript.questions.CategoricalOption = new > actionscript.questions.CategoricalOption(); - options = > actionscript.questions.CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); > - var newOptionNode:XML = ; - newOptionNode.setLocalName("option"); - > newOptionNode.@name = options.optionKey; - if(options.choices.length <= 0) > - { - newCNode.@type = "simple"; - - } - else - { - newCNode.@type = > "relative"; - for(var k:int = 0; k < options.choices.length; k++) + + > if(categoricalResult.categoricalOptions != null) + { + + for(var i:int = 0; > i < categoricalResult.categoricalOptions.length ; i++) + { + var > options:actionscript.questions.CategoricalOption = new > actionscript.questions.CategoricalOption(); + options = > actionscript.questions.CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); > + var newOptionNode:XML = ; + newOptionNode.setLocalName("option"); + > newOptionNode.@name = options.optionKey; + if(options.choices.length == 0) > { - var choice:String = "choice"; - choice = choice + k; - > newOptionNode.@choice = options.choices[k]; + flagType = false } - } - - > /*var module:XMLList = survey.module.(@id == tempmodule.id); - if( > module.length() > 0 ) - { - module[0].appendChild(newBlockNode); - }*/ - > newCNode.appendChild(newOptionNode); - } - - + else + { + flagType = true; + > choices=""; + + for(k = 0; k < options.choices.length; k++) + { + choices = > choices + options.choices[k]; + choices = choices + "," + + } + > //Alert.show("choices are: " + choices); + + newOptionNode.@choices = > choices; + } + if(flagType) + newCNode.@type = "relative"; + else + > newCNode.@type = "simple"; + newCNode.appendChild(newOptionNode); + } + } > + + } + //if question type is strategy, day by day decision, forecasting > fish, forecasting fishermen + else + { + newQNode.@sequenceNo = > question.sequenceNo; + newQNode.@title = question.question; + > newQNode.@type = question.type; + newQNode.@id = question.id; + } return > newQNode; @@ -348,7 +362,7 @@ return node.@header; else if( > node.localName() == "question" ) - return node.@title; + return node.@type; > else return null; @@ -419,16 +433,43 @@ { var title:String = > moduleInfo.getName(); var seqNo:int = int(moduleInfo.getSequenceNo()); - > if(moduleInfo.getId() == 0) - { - roQuestionCreator.saveModule(seqNo, title, > getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds())); > + + /* check first Id if the module exists, + if no, then check if sequence > number already exists for other module, + if no then create module otherwise > throw error */ + + var checkSeqNoModule:XMLList = survey.module.(@sequenceNo > == moduleInfo.getSequenceNo()); + + /* check if new module needs to be > created, if yes, check if the sequence number is already exists + if "No" > then only save into the database */ + + if(moduleInfo.getId() == 0) + { + > if(checkSeqNoModule.length() > 0) + { + Alert.show("Sequence number : " + > seqNo + " already exists!"); + } + else + > roQuestionCreator.saveModule(seqNo, title, > getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds())); > + } + + else + { + //Alert.show("length : " + > checkSeqNoModule.length().toString()); + //check if the sequence number > exists, do not update the module + + if(checkSeqNoModule.length() > 1) + { + > Alert.show("Sequence number : " + seqNo + " already exists!"); + } + else + > roQuestionCreator.updateModule(moduleInfo.getId(),seqNo, title, > getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds())); > + } - else - roQuestionCreator.updateModule(moduleInfo.getId(),seqNo, title, > getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds())); > - currentState = "none"; + + currentState = "none"; btnsaveModule.enabled = > false; - //pnlComponent.removeChildAt(1); - } + } } else @@ -447,35 +488,35 > @@ public function resultSaveModuleHandler(event:ResultEvent):void { var > module:actionscript.Module = actionscript.Module(event.result as Object); - > Alert.show("Id is: " + module.id); - var newModuleNode:XML = ; - > newModuleNode.setLocalName("module"); - newModuleNode.@title= > module.description; - newModuleNode.@sequenceNo = module.sequenceNo; - > newModuleNode.@hours = module.getHours(); - newModuleNode.@min = > module.getMinutes(); - newModuleNode.@sec = module.getSeconds(); - > newModuleNode.@id = module.id; - survey.appendChild(newModuleNode); - > if(surveyData == null) + + if(module == null) { - surveyData= new > XMLListCollection(survey.module); + Alert.show("Error in creating module!"); > } + else + { + //Alert.show("Id is: " + module.id); + var > newModuleNode:XML = createModuleNode(module); + > survey.appendChild(newModuleNode); + } - - } //when module is updated, the > result will come to resultUpdateModuleHandler public function > resultUpdateModuleHandler(event:ResultEvent):void { var > module:actionscript.Module = actionscript.Module(event.result as Object); - > var moduleXML:XMLList = survey.module.(@id == module.id); - > moduleXML.@title = module.description; - moduleXML.@sequenceNo = > module.sequenceNo; - moduleXML.@hours = module.getHours(); - > moduleXML.@min = module.getMinutes(); - moduleXML.@sec = > module.getSeconds(); + if(module != null) + { + var moduleXML:XMLList = > survey.module.(@id == module.id); + moduleXML.@title = module.description; > + moduleXML.@sequenceNo = module.sequenceNo; + moduleXML.@hours = > module.getHours(); + moduleXML.@min = module.getMinutes(); + > moduleXML.@sec = module.getSeconds(); + } + else + Alert.show("Error in > updating module!"); } @@ -535,25 +576,42 @@ var parentNode:XML = > tree.getParentItem(tree.selectedItem) as XML; node = parentNode; } - var > module:XMLList = survey.module.(@title == node.@title); - > //Alert.show("Module length is : " + module.length()); + var module:XMLList > = survey.module.(@id == node.@id); + if( module.length() > 0 ) { - // > Alert.show("Block id is : " + blockInfo.getId()); - if(blockInfo.getId() == > 0) - { - > roQuestionCreator.saveBlock(int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id)); > - } - else - { - roQuestionCreator.updateBlock(blockInfo.getId(), > int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id)); > + + //check the sequence number first, if sequence number already exists > throw an error, otherwise create block + var checkSeqNoBlock:XMLList = > module.block.(@sequenceNo == blockInfo.getSequenceNo()); + > if(blockInfo.getId() == 0) + { + if(checkSeqNoBlock.length() > 0) + { + > Alert.show("Sequence number " + blockInfo.getSequenceNo() + " already > exists!"); + } + else + { + > roQuestionCreator.saveBlock(int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id)); > + } + } + else + { + //Alert.show("length : " + > checkSeqNoBlock.length().toString()); + //check if the sequence number > exists, do not update the module + if(checkSeqNoBlock.length() > 1) + { + > Alert.show("Sequence number : " + blockInfo.getSequenceNo() + " already > exists!"); + } + else + roQuestionCreator.updateBlock(blockInfo.getId(), > int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id)); > + } + + currentState = "none"; + btnsaveBlock.enabled = false; } - > currentState = "none"; - btnsaveBlock.enabled = false; - // > pnlComponent.removeChildAt(1); - } + } } - } + else { Alert.show("Please > fill the form correctly"); @@ -570,14 +628,7 @@ if(block != null) { - var > newBlockNode:XML = ; - newBlockNode.setLocalName("block"); - > newBlockNode.@name = block.description; - newBlockNode.@sequenceNo = > block.sequenceNo; - newBlockNode.@hours = block.getHours(); - > newBlockNode.@min = block.getMinutes(); - newBlockNode.@sec = > block.getSeconds(); - newBlockNode.@id = block.id; + var newBlockNode:XML > = createBlockNode(block); var tempmodule:actionscript.Module = block.module; > var module:XMLList = survey.module.(@id == tempmodule.id); @@ -585,7 > +636,9 @@ { module[0].appendChild(newBlockNode); } - } + } + else + > Alert.show("Error in creating Block!"); } @@ -593,19 +646,24 @@ public > function resultUpdateBlockHandler(event:ResultEvent):void { var > block:actionscript.Block = actionscript.Block(event.result as Object); - - > var tempmodule:actionscript.Module = block.module; - - var blockXML:XMLList > = survey.module.block.(@id == block.id); - - blockXML.@name = > block.description; - blockXML.@sequenceNo = block.sequenceNo; - > blockXML.@hours = block.getHours(); - blockXML.@min = block.getMinutes(); > - blockXML.@sec = block.getSeconds(); + if(block != null) + { + var > tempmodule:actionscript.Module = block.module; + var blockXML:XMLList = > survey.module.block.(@id == block.id); + if(blockXML.length() > 0) + { + > blockXML[0].@name = block.description; + blockXML[0].@sequenceNo = > block.sequenceNo; + blockXML[0].@hours = block.getHours(); + > blockXML[0].@min = block.getMinutes(); + blockXML[0].@sec = > block.getSeconds(); + } + } + else + Alert.show("Error in creating Block!"); > } - //Block functioanlity Stop + //Block functioanlity End //QuestionGroup > functionality Start @@ -629,7 +687,7 @@ var selectedNode:XML = > tree.selectedItem as XML; var obj:DisplayObject = > pnlComponent.getChildAt(1); var questionGroupInfo:custom.db.QuestionGroup = > custom.db.QuestionGroup(obj); - Alert.show("Question Group Id is: " + > questionGroupInfo.getId()); + if(tree.selectedItem == null) { > Alert.show("Please select the block from tree to which Question Group should > be added."); @@ -656,12 +714,18 @@ { //find out the parent module var > parentModule:XML = tree.getParentItem(tree.selectedItem) as XML; - - + var > isQuestionGroupFormValid:Boolean = questionGroupInfo.validateForm(event); > if(isQuestionGroupFormValid) { + var durationflag:Boolean = > this.isDurationValid(questionGroupInfo.getHours(),questionGroupInfo.getMinutes(),questionGroupInfo.getSeconds()); > + if(durationflag) + { + Alert.show("Please enter the valid duration for the > given module."); + } + else + { var node:XML; /** * Check if the selected > node is block, if it is new Question Group needs to be created. @@ -677,22 > +741,46 @@ node = parentNode; } var block:XMLList = survey.module.block.(@id > == node.@id); - //Alert.show("block id is : " + block[0].@id + "length is: > " + block.length()); + //Alert.show("block id is : " + block.@id + "length > is: " + block.length().toString()); if( block.length() > 0 ) { - > if(questionGroupInfo.getId() == 0) - { - > roQuestionCreator.saveQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),int(block[0].@id)); > - } - else - { - > roQuestionCreator.updateQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),int(block[0].@id),questionGroup.getId()); > + //check the sequence number first, if sequence number already exists throw > an error, otherwise create module + var checkSeqNoQuestionGroup:XMLList = > block.questiongroup.(@sequenceNo == questionGroupInfo.getSequenceNo()); + > //Alert.show("length : " + checkSeqNoQuestionGroup.length().toString()); + > if(questionGroupInfo.getId() == 0) + { + if(checkSeqNoQuestionGroup.length() > > 0) + { + Alert.show("Sequence number " + questionGroupInfo.getSequenceNo() > + " already exists!"); + } + else + { + > roQuestionCreator.saveQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),getDuration(questionGroupInfo.getHours(),questionGroupInfo.getMinutes(),questionGroupInfo.getSeconds()),int(block[0].@id)); > + } + } + else + { + //Alert.show("length : " + > checkSeqNoQuestionGroup.length().toString()); + //check if the sequence > number exists, do not update the module + > if(checkSeqNoQuestionGroup.length() > 1) + { + Alert.show("Sequence number : > " + questionGroupInfo.getSequenceNo() + " already exists!"); + } + else + > roQuestionCreator.updateQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),getDuration(questionGroupInfo.getHours(),questionGroupInfo.getMinutes(),questionGroupInfo.getSeconds()),int(block[0].@id),questionGroup.getId()); > + } - currentState = "none"; - btnsaveQuestionGroup.enabled = false; - > //pnlComponent.removeChildAt(1); - } - } + currentState = "none"; + > btnsaveQuestionGroup.enabled = false; + } + + } + } + else + { + > Alert.show("Please fill the form correctly"); + return; + } } } } @@ -702,23 > +790,23 @@ public function > resultSaveQuestionGroupHandler(event:ResultEvent):void { var > questionGroup:actionscript.QuestionGroup = > actionscript.QuestionGroup(event.result as Object); - Alert.show("Id is: " + > questionGroup.id); - var newNode:XML = ; - > newNode.setLocalName("questiongroup"); - newNode.@header = > questionGroup.header; - newNode.@description = questionGroup.description; > - newNode.@sequenceNo = questionGroup.sequenceNo; - newNode.@id = > questionGroup.id; - - var block:actionscript.Block = questionGroup.block; + > + if(questionGroup != null) + { + var newQuestionGroupNode:XML = > createQuestionGroupNode(questionGroup); + + var block:actionscript.Block = > questionGroup.block; - var blockXML:XMLList =survey.module.block.(@id == > block.id); + var blockXML:XMLList =survey.module.block.(@id == block.id); > - if( blockXML.length() > 0 ) - { - blockXML[0].appendChild(newNode); + if( > blockXML.length() > 0 ) + { + blockXML[0].appendChild(newQuestionGroupNode); > - } + } + } + else + Alert.show("Error in creating QuestionGroup!"); } @@ > -726,17 +814,34 @@ public function > resultUpdateQuestionGroupHandler(event:ResultEvent):void { var > questionGroup:actionscript.QuestionGroup = > actionscript.QuestionGroup(event.result as Object); - Alert.show("Id is: " + > questionGroup.id); - var newNode:XML = ; - > newNode.setLocalName("questiongroup"); - newNode.@header = > questionGroup.header; - newNode.@description = questionGroup.description; > - newNode.@sequenceNo = questionGroup.sequenceNo; - var > block:actionscript.Block = questionGroup.block; - - } + + //Alert.show("Id > is: " + questionGroup.id); + if(questionGroup != null) + { + var newNode:XML > = ; + newNode.setLocalName("questiongroup"); + var questionGroupXML:XMLList > = survey.module.block.questiongroup.(@id == questionGroup.id); + > //Alert.show("Length is: " + questionGroupXML.length()); + > if(questionGroupXML.length() > 0) + { + // Alert.show("header is :" + > questionGroup.header); + // Alert.show("questionGroup description is :" + > questionGroup.description); + //Alert.show("questionGroup.sequenceNo is :" + > questionGroup.sequenceNo); + + questionGroupXML[0].@header = > questionGroup.header; + questionGroupXML[0].@description = > questionGroup.description; + questionGroupXML[0].@sequenceNo = > questionGroup.sequenceNo; + questionGroupXML[0].@hours = > questionGroup.getHours(); + questionGroupXML[0].@min = > questionGroup.getMinutes(); + questionGroupXML[0].@sec = > questionGroup.getSeconds(); + + } + } + else + Alert.show("Error in updating > QuestionGroup!"); + } - //QuestionGroup functionality Stop + //QuestionGroup > functionality End //Question functionality Start @@ -755,26 +860,43 @@ > private function QuestionHandler(event:Event):void { - > if(question.cmbType.selectedItem.toString().toLowerCase() == "psychometric") > + if(question.cmbType.selectedItem.data.toString().toLowerCase() == > "psychometric") + { currentState = "psychometric"; - else > if(question.cmbType.selectedItem.toString().toLowerCase() == "categorical") > + psychometric.reset(); + } + else > if(question.cmbType.selectedItem.data.toString().toLowerCase() == > "categorical") + { currentState = "categorical"; + categorical.reset(); + } > + else + { + currentState = "question"; + + } } private function > CategoricalTypeHandler(event:Event):void { > if(categorical.cmbType.selectedItem.toString().toLowerCase() == "relative") > + { currentState = "relative"; + categoricalRelative.reset(); + } else > if(categorical.cmbType.selectedItem.toString().toLowerCase() == "simple") + > { currentState = "simple"; + categoricalSimple.reset(); + } + } - - private > function saveQuestion(event:Event):void { - var node:XML = tree.selectedItem > as XML; + var selectedNode:XML = tree.selectedItem as XML; + var node:XML; > if(tree.selectedItem == null) { @@ -783,109 +905,207 @@ } else { - - > //if(tree.getParentItem(tree.selectedItem) == null) - if(node.localName() != > "questiongroup") + if(selectedNode.localName().toString().toLowerCase() == > "module" || selectedNode.localName().toString().toLowerCase() == "block") { > - Alert.show("You can add Question to QuestionGroup only."); + > Alert.show("You can not add Question to Module or Block."); return; } else { > - //find out the parent module - var parentModule:XML = > tree.getParentItem(tree.selectedItem) as XML; + > if(selectedNode.localName().toString().toLowerCase() == "questiongroup") + { > + node = selectedNode; + } + else > if(selectedNode.localName().toString().toLowerCase() == "question") + { + > var parentNode:XML = tree.getParentItem(tree.selectedItem) as XML; + node = > parentNode; + } + + var obj:DisplayObject = pnlComponent.getChildAt(1); var > questionInfo:custom.db.Question = custom.db.Question(obj); - var > isQuestionGroupFormValid:Boolean = questionInfo.validateForm(event); + var > isQuestionFormValid:Boolean = questionInfo.validateForm(event); - > if(isQuestionGroupFormValid) + if(isQuestionFormValid) { - - if(currentState > == "psychometric") - { - var psychobj:DisplayObject = > pnlComponent.getChildAt(2); - - var > compPsychometric:custom.db.questions.Psychometric = > custom.db.questions.Psychometric(psychobj); - - var > asPsychometric:actionscript.questions.Psychometric = new > actionscript.questions.Psychometric(); - asPsychometric.scale = > compPsychometric.getScale(); - asPsychometric.maxSliderValue = > int(compPsychometric.getNumberofIntervals()); - asPsychometric.choices = > compPsychometric.getChoices(); - asPsychometric.question = > questionInfo.getQuestion(); - asPsychometric.sequenceNo = > int(questionInfo.getSequenceNo()); - asPsychometric.type = > questionInfo.getType(); - - Alert.show("Psychometric Object :"); - > Alert.show("Question: " + asPsychometric.question); - Alert.show("SeQ No: " > + asPsychometric.sequenceNo); - Alert.show("Type : " + asPsychometric.type); > - roQuestionCreator.saveQuestion(asPsychometric,1); - } - else > if(currentState == "relative") - { - var catobj:DisplayObject = > pnlComponent.getChildAt(3); - var compCategorical:CategoricalRelative = > CategoricalRelative(catobj); - var > categoricalQuestion:actionscript.questions.Categorical = new > actionscript.questions.Categorical(); - - var dict:Dictionary = new > Dictionary(); - dict = compCategorical.getDictionary(); - for (var > key:Object in dict) - { - var > Options:actionscript.questions.CategoricalOption = new > actionscript.questions.CategoricalOption(); - Options.optionKey = > key.toString(); - Options.choices = dict[key]; - > categoricalQuestion.categoricalOptions.addItem(Options); - } - > categoricalQuestion.type = questionInfo.getType(); - > categoricalQuestion.question = questionInfo.getQuestion(); - > categoricalQuestion.sequenceNo = int(questionInfo.getSequenceNo()); - > for(var i:int = 0; i < categoricalQuestion.categoricalOptions.length ; i++) > - { - var testoption:actionscript.questions.CategoricalOption = new > actionscript.questions.CategoricalOption(); - testoption = > actionscript.questions.CategoricalOption(categoricalQuestion.categoricalOptions.getItemAt(i)); > - trace(testoption.optionKey); - trace(testoption.choices); - } - > roQuestionCreator.saveQuestion(categoricalQuestion,1); - - } - else > if(currentState == "simple") - { - Alert.show("simple state"); - var > catSimpleobj:DisplayObject = pnlComponent.getChildAt(3); - var > compCategoricalSimple:custom.db.questions.CategoricalSimple = > custom.db.questions.CategoricalSimple(catSimpleobj); - var > categoricalSimpleQuestion:actionscript.questions.Categorical = new > actionscript.questions.Categorical(); - + Alert.show("Parent id: " + > node.@id); + //check the sequence number first, if sequence number already > exists throw an error, otherwise create Question + + var > questionGroup:XMLList = survey.module.block.questiongroup.(@id == node.@id); > + Alert.show("Parent children length: " + > questionGroup.children().length()); + if(questionGroup.length() > 0 ) + { + > var checkSeqNoQuestion:XMLList = questionGroup.question.(@sequenceNo == > questionInfo.getSequenceNo()); + Alert.show("checkSeqNoQuestion length: " + > checkSeqNoQuestion.length()); + if(currentState == "psychometric") + { + var > psychobj:DisplayObject = pnlComponent.getChildAt(2); + + var > compPsychometric:custom.db.questions.Psychometric = > custom.db.questions.Psychometric(psychobj); + + var > asPsychometric:actionscript.questions.Psychometric = new > actionscript.questions.Psychometric(); + asPsychometric.scale = > compPsychometric.getScale(); + asPsychometric.maxSliderValue = > int(compPsychometric.getNumberofIntervals()); + asPsychometric.choices = > compPsychometric.getChoices(); + asPsychometric.question = > questionInfo.getQuestion(); + asPsychometric.sequenceNo = > int(questionInfo.getSequenceNo()); + asPsychometric.type = > questionInfo.getType(); + + //Alert.show("Psychometric Object :"); + > //Alert.show("Question: " + asPsychometric.question); + //Alert.show("SeQ > No: " + asPsychometric.sequenceNo); + //Alert.show("Type : " + > asPsychometric.type); + + if(questionInfo.getId() == 0) + { + > if(checkSeqNoQuestion.length() > 0) + { + Alert.show("Sequence number " + > questionInfo.getSequenceNo() + " already exists!"); + } + else + > roQuestionCreator.saveQuestion(asPsychometric,int(node.@id)); + } + else + > { + if(checkSeqNoQuestion.length() > 1) + { + Alert.show("Sequence number " > + questionInfo.getSequenceNo() + " already exists!"); + } + else + > roQuestionCreator.updateQuestion(asPsychometric,int(node.@id), > questionInfo.getId()); + } + + } + + else if(currentState == "relative") + { > + var catobj:DisplayObject = pnlComponent.getChildAt(3); + var > compCategorical:CategoricalRelative = CategoricalRelative(catobj); + var > categoricalQuestion:actionscript.questions.Categorical = new > actionscript.questions.Categorical(); + + var dict:Dictionary = new > Dictionary(); + dict = compCategorical.getDictionary(); + for (var > key:Object in dict) + { + var > Options:actionscript.questions.CategoricalOption = new > actionscript.questions.CategoricalOption(); + Options.optionKey = > key.toString(); + Options.choices = dict[key]; + > categoricalQuestion.categoricalOptions.addItem(Options); + } + > categoricalQuestion.type = questionInfo.getType(); + > categoricalQuestion.question = questionInfo.getQuestion(); + > categoricalQuestion.sequenceNo = int(questionInfo.getSequenceNo()); + > /*for(var i:int = 0; i < categoricalQuestion.categoricalOptions.length ; > i++) + { + var testoption:actionscript.questions.CategoricalOption = new > actionscript.questions.CategoricalOption(); + testoption = > actionscript.questions.CategoricalOption(categoricalQuestion.categoricalOptions.getItemAt(i)); > + trace(testoption.optionKey); + trace(testoption.choices); + }*/ + > if(questionInfo.getId() == 0) + { + if(checkSeqNoQuestion.length() > 0) + { > + Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already > exists!"); + } + else + > roQuestionCreator.saveQuestion(categoricalQuestion,int(node.@id)); + } + > else + { + if(checkSeqNoQuestion.length() > 1) + { + Alert.show("Sequence > number " + questionInfo.getSequenceNo() + " already exists!"); + } + else + > roQuestionCreator.updateQuestion(categoricalQuestion,int(node.@id), > questionInfo.getId()); + } + + } + else if(currentState == "simple") + { + > //Alert.show("simple state"); + var catSimpleobj:DisplayObject = > pnlComponent.getChildAt(3); + var > compCategoricalSimple:custom.db.questions.CategoricalSimple = > custom.db.questions.CategoricalSimple(catSimpleobj); + var > categoricalSimpleQuestion:actionscript.questions.Categorical = new > actionscript.questions.Categorical(); - var Simpledict:Dictionary = new > Dictionary(); - Simpledict = compCategoricalSimple.getDictionary(); - for > (var option:Object in Simpledict) - { - var > OptionsSimple:actionscript.questions.CategoricalOption = new > actionscript.questions.CategoricalOption(); - OptionsSimple.optionKey = > option.toString(); - Alert.show("Key : " + option.toString()); - > OptionsSimple.choices = Simpledict[key]; - > categoricalSimpleQuestion.categoricalOptions.addItem(OptionsSimple); - } - > categoricalSimpleQuestion.type = questionInfo.getType(); - > categoricalSimpleQuestion.question = questionInfo.getQuestion(); - > categoricalSimpleQuestion.sequenceNo = int(questionInfo.getSequenceNo()); - > /*for(var j:int = 0; j < categoricalSimpleQuestion.categoricalOptions.length > ; j++) - { - var testoption:ASCategoricalOption = new ASCategoricalOption(); > - testoption = > ASCategoricalOption(categoricalSimpleQuestion.categoricalOptions.getItemAt(i)); > - trace(testoption.optionKey); - trace(testoption.choices); - }*/ - > Alert.show("Question: " + categoricalSimpleQuestion.question); - > Alert.show("SeQ No: " + categoricalSimpleQuestion.sequenceNo); - > Alert.show("Type : " + categoricalSimpleQuestion.type); - - > roQuestionCreator.saveQuestion(categoricalSimpleQuestion,1); - - } - > //roQuestionCreator.saveQuestion(int(questionInfo.getSequenceNo()),questionInfo.getQuestion(),questionInfo.getType(),int(parentModule.@id)); > + var Simpledict:Dictionary = new Dictionary(); + Simpledict = > compCategoricalSimple.getDictionary(); + for (var option:Object in > Simpledict) + { + var OptionsSimple:actionscript.questions.CategoricalOption > = new actionscript.questions.CategoricalOption(); + OptionsSimple.optionKey > = option.toString(); + //Alert.show("Key : " + option.toString()); + > OptionsSimple.choices = Simpledict[key]; + > categoricalSimpleQuestion.categoricalOptions.addItem(OptionsSimple); + } + > categoricalSimpleQuestion.type = questionInfo.getType(); + > categoricalSimpleQuestion.question = questionInfo.getQuestion(); + > categoricalSimpleQuestion.sequenceNo = int(questionInfo.getSequenceNo()); + > /*for(var j:int = 0; j < categoricalSimpleQuestion.categoricalOptions.length > ; j++) + { + var testoption:ASCategoricalOption = new ASCategoricalOption(); > + testoption = > ASCategoricalOption(categoricalSimpleQuestion.categoricalOptions.getItemAt(i)); > + trace(testoption.optionKey); + trace(testoption.choices); + }*/ + > /*Alert.show("Question: " + categoricalSimpleQuestion.question); + > Alert.show("SeQ No: " + categoricalSimpleQuestion.sequenceNo); + > Alert.show("Type : " + categoricalSimpleQuestion.type);*/ + + + > if(questionInfo.getId() == 0) + { + if(checkSeqNoQuestion.length() > 0) + { > + Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already > exists!"); + } + else + > roQuestionCreator.saveQuestion(categoricalSimpleQuestion,int(node.@id)); + > } + else + { + if(checkSeqNoQuestion.length() > 1) + { + > Alert.show("Sequence number " + questionInfo.getSequenceNo() + " already > exists!"); + } + else + > roQuestionCreator.updateQuestion(categoricalSimpleQuestion,int(node.@id), > questionInfo.getId()); + } + + } + else if(currentState == "question") + { + > + var question:actionscript.questions.Question = new > actionscript.questions.Question(); + + question.question = > questionInfo.getQuestion(); + question.sequenceNo = > int(questionInfo.getSequenceNo()); + question.type = questionInfo.getType(); > + //Alert.show("Type : " + question.type); + if(questionInfo.getId() == 0) + > { + if(checkSeqNoQuestion.length() > 0) + { + Alert.show("Sequence number " > + questionInfo.getSequenceNo() + " already exists!"); + } + else + > roQuestionCreator.saveQuestion(question,int(node.@id)); + } + else + { + > if(checkSeqNoQuestion.length() > 1) + { + Alert.show("Sequence number " + > questionInfo.getSequenceNo() + " already exists!"); + } + else + > roQuestionCreator.updateQuestion(question,int(node.@id), > questionInfo.getId()); + } + + } + } } @@ -896,96 +1116,142 @@ public > function resultSaveQuestionHandler(event:ResultEvent):void { - var > test_object:Object = event.result as Object; - Alert.show("Type came from > server is: " + test_object.type); - if(test_object.type == "psychometric") + > var question_Object:actionscript.questions.Question = > actionscript.questions.Question(event.result as Object); + > if(question_Object != null) { - var > questionResult:actionscript.questions.Psychometric = > actionscript.questions.Psychometric(event.result as Object); - > Alert.show("Id is: " + questionResult.id); - Alert.show("Question is: " + > questionResult.question); - Alert.show("Type is: " + questionResult.type); - > Alert.show("SeQNo is: " + questionResult.sequenceNo); + var > newQuestionNode:XML = createQuestionNode(question_Object); + Alert.show(" > question_Object.questionGroup.id " + question_Object.questionGroup.id); + > var questionGroup:XMLList = survey.module.block.questiongroup.(@id == > question_Object.questionGroup.id); + > Alert.show("question_Object.questionGroup.length " + > questionGroup.length()); + if( questionGroup.length() > 0 ) + { + > questionGroup[0].appendChild(newQuestionNode); + currentState = "none"; + > btnsaveQuestion.enabled = false; + } + } + else + Alert.show("Error in > creating Question!"); + + + } + + public function > resultUpdateQuestionHandler(event:ResultEvent):void + { + var > question:actionscript.questions.Question = > actionscript.questions.Question(event.result as Object); + if(question == > null) + { + Alert.show("Error in creating Question!"); + } + else + { + var > newNode:XML = ; + newNode.setLocalName("question"); + var newQNode:XML = ; + > newQNode.setLocalName("question"); + var choices:String=""; + > if(question.type.toLowerCase() == "psychometric") + { + var > psychometricResult:actionscript.questions.Psychometric = > actionscript.questions.Psychometric(question); + /*Alert.show("Id is: " + > psychometricResult.id); + Alert.show("Question is: " + > psychometricResult.question); + Alert.show("Type is: " + > psychometricResult.type); + Alert.show("SeQNo is: " + > psychometricResult.sequenceNo);*/ + var newPNode:XML = ; > newPNode.setLocalName("psychometric"); - newPNode.@id = questionResult.id; > - newPNode.@scale = questionResult.scale; - newPNode.@noOfInterval = > questionResult.maxSliderValue; - for(var j:int = 0; j < > questionResult.choices.length; j++) + var psychometricList:XMLList = > psychometricQuestions.psychometric.(@id == psychometricResult.id); + + if( > psychometricList.length() > 0 ) { - var str:String = "choice"; - str = str + > j; - newPNode.@str = questionResult.choices[j]; + newPNode.@scale = > psychometricResult.scale; + newPNode.@maxSliderValue = > psychometricResult.maxSliderValue; + + newQNode.@sequenceNo = > psychometricResult.sequenceNo; + newQNode.@title = > psychometricResult.question; + newQNode.@type = psychometricResult.type; + > choices = ""; + if(psychometricResult.choices != null) + { + + for(var k:int > = 0; k < psychometricResult.choices.length; k++) + { + choices = choices + > psychometricResult.choices[k]; + choices = choices + "," + + } + + > newPNode.@choices = choices; + } + } - - > psychometricQuestions.appendChild(newPNode); - + } - else > if(test_object.type.toLowerCase() == "categorical") + else > if(question.type.toLowerCase() == "categorical") { - var > categoricalResult:actionscript.questions.Categorical = > actionscript.questions.Categorical(test_object); - var newQNode:XML = ; - > newQNode.setLocalName("question"); + var > categoricalResult:actionscript.questions.Categorical = > actionscript.questions.Categorical(question); + newQNode.@sequenceNo = > categoricalResult.sequenceNo; newQNode.@title = > categoricalResult.question; newQNode.@type = categoricalResult.type; > newQNode.@id = categoricalResult.id; - var questionGroup:XMLList > =survey.module.block.questiongroup.(@header == node.@header); - - if( > questionGroup.length() > 0 ) - { - questionGroup[0].appendChild(newQNode); - > currentState = "none"; - btnsaveQuestion.enabled = false; - } + + //flagType > false means it is simple type, otherwise it is relative type + var > flagType:Boolean = false; var newCNode:XML = ; > newCNode.setLocalName("categorical"); - newCNode.@id = > categoricalResult.id; - categoricalQuestions.appendChild(newCNode); - - > for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++) - > { - var options:actionscript.questions.CategoricalOption = new > actionscript.questions.CategoricalOption(); - options = > actionscript.questions.CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); > - var newOptionNode:XML = ; - newOptionNode.setLocalName("option"); - > newOptionNode.@name = options.optionKey; - if(options.choices.length <= 0) > - { - newCNode.@type = "simple"; - - } - else - { - newCNode.@type = > "relative"; - for(var k:int = 0; k < options.choices.length; k++) - { - var > choice:String = "choice"; - choice = choice + k; - newOptionNode.@choice = > options.choices[k]; - } - } - - /*var module:XMLList = survey.module.(@id == > tempmodule.id); - if( module.length() > 0 ) - { - > module[0].appendChild(newBlockNode); - }*/ - > newCNode.appendChild(newOptionNode); - } + var categoricalList:XMLList = > categoricalQuestions.categorical.(@id == categoricalResult.id); - } - - > currentState = "none"; - btnsaveQuestion.enabled = false; - - - } - - public > function resultUpdateQuestionHandler(event:Event):void - { + if( > categoricalList.length() > 0 ) + { + //remove all the tags and then add > those rather than modifying those. It is simple. + var children:XMLList = > categoricalList.children(); + + for(var l:Number=0; l < children.length(); > l++) + { + delete children[i]; + } + + + > if(categoricalResult.categoricalOptions != null) + { + + for(var i:int = 0; > i < categoricalResult.categoricalOptions.length ; i++) + { + var > options:actionscript.questions.CategoricalOption = new > actionscript.questions.CategoricalOption(); + options = > actionscript.questions.CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i)); > + var newOptionNode:XML = ; + newOptionNode.setLocalName("option"); + > newOptionNode.@name = options.optionKey; + if(options.choices.length == 0) > + { + flagType = false + } + else + { + flagType = true; + choices=""; + + > for(k = 0; k < options.choices.length; k++) + { + choices = choices + > options.choices[k]; + choices = choices + "," + } + newOptionNode.@choices= choices; + } + if(flagType) + newCNode.@type= "relative"; + else + newCNode.@type= "simple"; + newCNode.appendChild(newOptionNode); + } + } + } + } + } } > //Question functionality Stop @@ -1024,6 +1290,7 @@ var selectedNode:int; > var node:XML = XML(tree.selectedItem); + lbltest.text = node.@id; > if(node.localName() == "module") { currentState = "module"; @@ -1076,10 > +1343,15 @@ btnsaveQuestion.enabled = false; //set all fields + > questionGroupInfo.setHeader(node.@header); > questionGroupInfo.setDescription(node.@description); > questionGroupInfo.setSequenceNo(node.@sequenceNo); > questionGroupInfo.setId(node.@id); + > questionGroupInfo.setHours(node.@hours); + > questionGroupInfo.setMinutes(node.@min); + > questionGroupInfo.setSeconds(node.@sec); + //Alert.show("Question group id > assigned is: " + node.@id); } @@ -1100,9 +1372,12 @@ > questionInfo.setQuestion(node.@title); > questionInfo.setSequenceNo(node.@sequenceNo); questionInfo.setId(node.@id); > + var str:String = node.@type; + /*Alert.show("q type is: " + node.@type); > + questionInfo.cmbType.selectedItem = str.toLowerCase();*/ + > questionInfo.setQuestionType(node.@type); - if(node.@type == > "categorical") { currentState = "categorical"; @@ -1110,9 +1385,9 @@ var > compCategorical:custom.db.questions.Categorical = > custom.db.questions.Categorical(catobj); compCategorical.reset(); - > questionInfo.cmbType.selectedItem = "Categorical"; + > //questionInfo.cmbType.selectedItem = "Categorical"; var > categoricalQ:XMLList = categoricalQuestions.categorical.(@id == node.@id); > - + //Alert.show("categoricalQ type: " + categoricalQ[0].@type); > if(categoricalQ.length() > 0) { if(categoricalQ[0].@type == "relative") @@ > -1123,30 +1398,37 @@ var cat1obj:DisplayObject = pnlComponent.getChildAt(3); > var compRelative:CategoricalRelative = CategoricalRelative(cat1obj); - + > compRelative.reset(); var dict:Dictionary = new Dictionary(); + var > optionList:XMLList = categoricalQ[0].option.@name; - //Alert.show("option > key: " + optionList.length()); - for(var j:int = 0; j< optionList.length(); > j++) { - var str:String = optionList[j]; + str = optionList[j]; > compRelative.header1List.addItem(str); dict[str] = new ArrayCollection(); - > var attributeList:XMLList = categoricalQ[0].option[j].attributes(); - - > for(var i:int = 0; i < attributeList.length(); i++) + choiceStr=""; + > choiceStr = categoricalQ[0].option[j].@choices; + + + outputchoices = null; > + outputchoices = choiceStr.split(","); + + + for(var i:int = 0; i < > outputchoices.length; i++) { - if(attributeList[i] != optionList[j]) - { - > dict[str].addItem(attributeList[i]); - } + + > dict[str].addItem(outputchoices[i]); } - } + + } + > compRelative.setDictionary(dict); - compRelative.setDictionary(dict); - } > else if(categoricalQ[0].@type == "simple") { @@ -1154,7 +1436,7 @@ > currentState = "simple"; var cat2obj:DisplayObject = > pnlComponent.getChildAt(3); var > compSimple:custom.db.questions.CategoricalSimple = > custom.db.questions.CategoricalSimple(cat2obj); - + compSimple.reset(); var > dictionary:Dictionary = new Dictionary(); var attributeSimpleList:XMLList = > categoricalQ[0].option.attributes(); @@ -1167,9 +1449,9 @@ dictionary[str1] > = new ArrayCollection(); dictionary[str1].addItem(null); } - + > compSimple.setDictionary(dictionary); } - > compSimple.setDictionary(dictionary); + } } @@ -1180,27 +1462,34 @@ var > psychobj:DisplayObject = pnlComponent.getChildAt(2); var > compPsychometric:custom.db.questions.Psychometric = > custom.db.questions.Psychometric(psychobj); compPsychometric.reset(); - > questionInfo.cmbType.selectedItem = "Psychometric"; + > //questionInfo.cmbType.selectedItem = "Psychometric"; var > psychometricQ:XMLList = psychometricQuestions.psychometric.(@id == node.@id); > if(psychometricQ.length() > 0) { - > compPsychometric.setScale(psychometricQ[0].@scale); - > compPsychometric.setNumberofIntervals(psychometricQ[0].@interval); - var > psychometricAttributes:XMLList = psychometricQ[0].attributes(); - + var > scale:String = psychometricQ[0].@scale; + compPsychometric.setScale(scale); > + compPsychometric.setNumberofIntervals(psychometricQ[0].@maxSliderValue); > compPsychometric.vboxChoices.visible = true; - for(var l:int =0; l < > psychometricAttributes.length(); l++) - { - Alert.show("Attribute is : " > +psychometricAttributes[l]); - if((psychometricAttributes[l] != > psychometricQ[0].@id) && (psychometricAttributes[l] != > psychometricQ[0].@scale) && (psychometricAttributes[l] != > psychometricQ[0].@interval)) - { - > compPsychometric.choice.addItem(psychometricAttributes[l]); - } - } + + > choiceStr = ""; + outputchoices = null; + choiceStr = > psychometricQ[0].@choices; + outputchoices = choiceStr.split(","); + + for(i > = 0; i < outputchoices.length; i++) + { + > compPsychometric.choice.addItem(outputchoices[i]); + + } + } } else - > currentState = "none"; + { + currentState = "question"; + + } + } } @@ > -1232,7 +1521,9 @@ - + + + @@ -1245,6 +1536,7 @@ + @@ -1303,7 +1595,7 @@ - + > @@ -1313,14 +1605,12 @@ + showRoot="true" height="50%" width="80%" > textAlign="center"/> + showRoot="true" height="50%" width="80%" > textAlign="center"/> Modified: > mentalmodels/trunk/flex/src/actionscript/Block.as > =================================================================== --- > mentalmodels/trunk/flex/src/actionscript/Block.as 2009-07-17 23:21:35 UTC > (rev 187) +++ mentalmodels/trunk/flex/src/actionscript/Block.as 2009-07-20 > 01:13:36 UTC (rev 188) @@ -13,6 +13,7 @@ public var duration:int; public var > module:Module; public var questionGroups:ArrayCollection; + public var > informationWindows:ArrayCollection; public function getHours():int @@ -29,7 > +30,7 @@ public function getSeconds():int { - return (duration - > (getMinutes() * 60)); + return (duration - (getHours() * 3600) - > (getMinutes() * 60)); } } } \ No newline at end of file Modified: > mentalmodels/trunk/flex/src/actionscript/Module.as > =================================================================== --- > mentalmodels/trunk/flex/src/actionscript/Module.as 2009-07-17 23:21:35 UTC > (rev 187) +++ mentalmodels/trunk/flex/src/actionscript/Module.as 2009-07-20 > 01:13:36 UTC (rev 188) @@ -33,7 +33,7 @@ public function getSeconds():int { > - return (duration - (getMinutes() * 60)); + return (duration - (getHours() > * 3600) - (getMinutes() * 60)); } } } \ No newline at end of file Modified: > mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as > =================================================================== --- > mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as 2009-07-17 > 23:21:35 UTC (rev 187) +++ > mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as 2009-07-20 > 01:13:36 UTC (rev 188) @@ -12,5 +12,24 @@ public var header:String; public > var description:String; public var block:Block; + public var duration:int; + > + public function getHours():int + { + return > int(Math.floor(duration/3600)); + } + + public function getMinutes():int + { > + var tempDuration:int; + tempDuration = duration - (getHours() * 3600); + > return int(Math.floor(tempDuration/60)); + } + + public function > getSeconds():int + { + return (duration - (getHours() * 3600) - > (getMinutes() * 60)); + } + } } \ No newline at end of file Modified: > mentalmodels/trunk/flex/src/actionscript/questions/Question.as > =================================================================== --- > mentalmodels/trunk/flex/src/actionscript/questions/Question.as 2009-07-17 > 23:21:35 UTC (rev 187) +++ > mentalmodels/trunk/flex/src/actionscript/questions/Question.as 2009-07-20 > 01:13:36 UTC (rev 188) @@ -1,6 +1,8 @@ package actionscript.questions { + > import actionscript.QuestionGroup; + [Bindable] > [RemoteClass(alias="edu.asu.commons.mme.entity.Question")] public class > Question @@ -9,5 +11,7 @@ public var question:String; public var > type:String; public var sequenceNo:int; + public var > questionGroup:QuestionGroup; + } } \ No newline at end of file Modified: > mentalmodels/trunk/flex/src/custom/db/Block.mxml > =================================================================== --- > mentalmodels/trunk/flex/src/custom/db/Block.mxml 2009-07-17 23:21:35 UTC > (rev 187) +++ mentalmodels/trunk/flex/src/custom/db/Block.mxml 2009-07-20 > 01:13:36 UTC (rev 188) @@ -34,7 +34,7 @@ } public function getName():String > { - return txtName.text; + return rchtxtDescription.text; } /*public > function getDuration():String { @@ -63,7 +63,7 @@ } public function > setName(name:String):void { - txtName.text = name; + rchtxtDescription.text > = name; } @@ -97,7 +97,7 @@ formIsValid = true; // Check if form is empty - > formIsEmpty = (txtSeqNo.text == "" && txtName.text == ""); + formIsEmpty = > (txtSeqNo.text == "" && rchtxtDescription.text == ""); // Run each validator > in turn, using the isValid() // helper method and update the value of > formIsValid @@ -136,12 +136,12 @@ public function reset():void { > txtSeqNo.text =""; - txtName.text = ""; + rchtxtDescription.text = ""; > hours.value =0; minutes.value =0; seconds.value =0; txtSeqNo.errorString > =""; - txtName.errorString =""; + rchtxtDescription.errorString =""; Id = 0; > } @@ -154,10 +154,12 @@ + - + + - + Modified: > mentalmodels/trunk/flex/src/custom/db/Module.mxml > =================================================================== --- > mentalmodels/trunk/flex/src/custom/db/Module.mxml 2009-07-17 23:21:35 UTC > (rev 187) +++ mentalmodels/trunk/flex/src/custom/db/Module.mxml 2009-07-20 > 01:13:36 UTC (rev 188) @@ -45,6 +45,14 @@ { //return txtMajor.text; }*/ + > public function setSequenceNo(seqNo:String):void + { + txtSeqNo.text = > seqNo; + } + public function setName(name:String):void + { + txtName.text = > name; + } public function getHours():Number { @@ -62,16 +70,6 @@ } - public > function setSequenceNo(seqNo:String):void - { - txtSeqNo.text = seqNo; - } - > public function setName(name:String):void - { - txtName.text = name; - } - - > public function setHours(hour:Number):void { hours.value = hour; @@ -148,16 > +146,7 @@ txtName.errorString =""; Id = 0; } - - public function > saveModule():void - { - - - - } - - ]]> @@ -177,10 +166,7 @@ - - - Modified: > mentalmodels/trunk/flex/src/custom/db/Question.mxml > =================================================================== --- > mentalmodels/trunk/flex/src/custom/db/Question.mxml 2009-07-17 23:21:35 UTC > (rev 187) +++ mentalmodels/trunk/flex/src/custom/db/Question.mxml 2009-07-20 > 01:13:36 UTC (rev 188) @@ -36,12 +36,12 @@ } public function > getQuestion():String { - return txtQuestion.text; + return > rchtxtQuestion.text; } public function getType():String { - return > String(cmbType.selectedItem); + return cmbType.selectedItem.data; } public > function setSequenceNo(seqNo:String):void @@ -50,7 +50,7 @@ } public > function setQuestion(question:String):void { - txtQuestion.text = question; > + rchtxtQuestion.text = question; } @@ -62,31 +62,17 @@ - public function > setQuestionInfo(type:String):void + public function > setQuestionType(type:String):void { - cmbType.selectedItem = type; - > if(cmbType.selectedItem == "Categorical") - { - currentState = > "categorical"; - var catobj:DisplayObject = > canvasQuestionType.getChildAt(0); - questionInfo = Categorical(catobj); - > questionInfo.reset(); - - } - if(cmbType.selectedItem == "Psychometric") - { > - currentState = "psychometric"; - var psychobj:DisplayObject = > canvasQuestionType.getChildAt(0); - questionInfo = Psychometric(psychobj); - > questionInfo.reset(); - - } - /*if(cmbType.selectedItem == "Text") - { - > currentState = "none"; - } */ - - + for (var i: int = 0; i < > cmbType.dataProvider.length; i++) + { + if ( type == > cmbType.dataProvider[i].data) + { + cmbType.selectedIndex = i; + break; + } > + } + } @@ -103,7 +89,7 @@ formIsValid = true; // Check if form is empty - > formIsEmpty = (txtSeqNo.text == "" && txtQuestion.text == "" && > cmbType.selectedItem == "-Select-"); + formIsEmpty = (txtSeqNo.text == "" && > rchtxtQuestion.text == "" && cmbType.selectedItem == "-Select-"); // Run > each validator in turn, using the isValid() // helper method and update the > value of formIsValid @@ -117,7 +103,7 @@ private function > showQuestionType():void { - if(cmbType.selectedItem == "Categorical") + > if(cmbType.selectedItem.toString().toLowerCase() == "categorical") { > currentState = "categorical"; var catobj:DisplayObject = > canvasQuestionType.getChildAt(0); @@ -125,7 +111,7 @@ questionInfo.reset(); > } - if(cmbType.selectedItem == "Psychometric") + > if(cmbType.selectedItem.toString().toLowerCase() == "psychometric") { > currentState = "psychometric12"; var psychobj:DisplayObject = > canvasQuestionType.getChildAt(0); @@ -133,7 +119,7 @@ questionInfo.reset(); > } - if(cmbType.selectedItem == "Text") + > if(cmbType.selectedItem.toString().toLowerCase() == "Text") { currentState = > "text"; } @@ -171,11 +157,11 @@ { currentState = "text"; txtSeqNo.text =""; > - txtQuestion.text = ""; - + rchtxtQuestion.text = ""; + this.Id = 0; > txtSeqNo.errorString =""; - txtQuestion.errorString =""; - > cmbType.selectedIndex = 0; + rchtxtQuestion.errorString =""; + > cmbType.selectedIndex = -1; } @@ -204,17 +190,23 @@ + - + + + - + - -Select- > - Categorical - Psychometric - Text - + + + + + + + + Modified: > mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml > =================================================================== --- > mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml 2009-07-17 23:21:35 > UTC (rev 187) +++ mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml > 2009-07-20 01:13:36 UTC (rev 188) @@ -35,11 +35,11 @@ } public function > getHeader():String { - return txtHeader.text; + return rchtxtHeader.text; } > public function getDescription():String { - return txtDescription.text; + > return rchtxtDescription.text; } public function > setSequenceNo(seqNo:String):void @@ -48,18 +48,50 @@ } public function > setHeader(header:String):void { - txtHeader.text = header; + > rchtxtHeader.text = header; } public function > setDescription(description:String):void { - txtDescription.text = > description; + rchtxtDescription.text = description; } + public function > getHours():Number + { + return hours.value; + + } + public function > getMinutes():Number + { + return minutes.value; + + } + public function > getSeconds():Number + { + return seconds.value; + + } - public function > validateForm(event:Event):Boolean + public function > setHours(hour:Number):void + { + hours.value = hour; + + } + public function > setMinutes(min:Number):void + { + minutes.value = min; + + } + public > function setSeconds(sec:Number):void + { + seconds.value = sec; + + } + + + > public function validateForm(event:Event):Boolean { // Save a reference to > the currently focussed form control // so that the isValid() helper method > can notify only @@ -71,7 +103,7 @@ formIsValid = true; // Check if form is > empty - formIsEmpty = (txtSeqNo.text == "" && txtHeader.text == "" && > txtDescription.text == ""); + formIsEmpty = (txtSeqNo.text == "" && > rchtxtHeader.text == "" && rchtxtDescription.text == ""); // Run each > validator in turn, using the isValid() // helper method and update the value > of formIsValid @@ -110,12 +142,15 @@ public function reset():void { > txtSeqNo.text =""; - txtHeader.text = ""; - txtDescription.text =""; + > rchtxtHeader.text = ""; + rchtxtDescription.text =""; txtSeqNo.errorString > =""; - txtHeader.errorString =""; - txtDescription.errorString =""; + > rchtxtHeader.errorString =""; + rchtxtDescription.errorString =""; setId(0); > + hours.value =0; + minutes.value =0; + seconds.value =0; } @@ -126,14 > +161,35 @@ + + + + + + + + + + + + + - + + + + + - + + + + Modified: > mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml > =================================================================== --- > mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml 2009-07-17 > 23:21:35 UTC (rev 187) +++ > mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml 2009-07-20 > 01:13:36 UTC (rev 188) @@ -79,17 +79,17 @@ // currentState = "none"; - > cmbType.selectedIndex = 0; + cmbType.selectedItem = "-Select-"; } public > function setType(qType:String):void { - if(qType == "relative") + > if(qType.toLowerCase() == "relative") { cmbType.selectedItem = "Relative"; } > - else if(qType == "simple") + else if(qType.toLowerCase() == "simple") { > cmbType.selectedItem = "Simple"; Modified: > mentalmodels/trunk/flex/src/custom/db/questions/CategoricalRelative.mxml > =================================================================== --- > mentalmodels/trunk/flex/src/custom/db/questions/CategoricalRelative.mxml > 2009-07-17 23:21:35 UTC (rev 187) +++ > mentalmodels/trunk/flex/src/custom/db/questions/CategoricalRelative.mxml > 2009-07-20 01:13:36 UTC (rev 188) @@ -123,11 +123,11 @@ { for(var key:Object > in dict) { - // dict[key].removeAll(); - // delete dict[key]; + > dict[key].removeAll(); + delete dict[key]; } } - vboxSecondHeader.visible = > false; + vboxSecondHeader.visible = true; } Modified: > mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml > =================================================================== --- > mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml > 2009-07-17 23:21:35 UTC (rev 187) +++ > mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml > 2009-07-20 01:13:36 UTC (rev 188) @@ -94,8 +94,15 @@ txtChoice.text = ""; > lblHeader.text = ""; header.removeAll(); - frmitmAddChoice.label="Choice for > " + lblHeader.text + ":"; + if(dict != null) + { + for(var key:Object in > dict) + { + dict[key].removeAll(); + delete dict[key]; + } + } } public > function setSimpleForm():void Modified: > mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml > =================================================================== --- > mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml 2009-07-17 > 23:21:35 UTC (rev 187) +++ > mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml 2009-07-20 > 01:13:36 UTC (rev 188) @@ -31,12 +31,13 @@ public function > setScale(scale:String):void { this.scale = scale; - if(scale == "bipolar") + > //Alert.show("Scale is :" +scale); + if(scale.toLowerCase() == "bipolar") { > cmbType.selectedItem = "Bipolar"; } - else if(scale == "unipolar") + else > if(scale.toLowerCase() == "unipolar") { cmbType.selectedItem = "Unipolar"; > @@ -225,11 +226,11 @@ --> - + -Select- Bipolar - Scalar + Unipolar Modified: > mentalmodels/trunk/src/main/db/init-mme.sql > =================================================================== --- > mentalmodels/trunk/src/main/db/init-mme.sql 2009-07-17 23:21:35 UTC (rev > 187) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-07-20 01:13:36 UTC > (rev 188) @@ -1,260 +1,730 @@ -insert into game > (description,image_location,max_days,max_fish_harvest,money,no_of_locations,no_of_rounds,timestamp,title) > -values("First game","island.jpg",30,5,0.0,4,3,NOW(),"Mental Model > Experiment"); - -insert into round_config > (communication_flag,round_no,game_i... [truncated message content] |
From: <see...@us...> - 2009-07-20 19:34:35
|
Revision: 189 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=189&view=rev Author: seematalele Date: 2009-07-20 19:34:32 +0000 (Mon, 20 Jul 2009) Log Message: ----------- Made following changes * Strategy design has no "Edit" button, should say "Design your strategy by clicking on 'New' and 'Delete'." * Strategy: delete the paragraph "When you are done, click on 'Next'. Your strategy will then be checked for some common or logical errors.", the design used should not allow the user to create errors in the first place. * "Explain the strategy in your own words" I'm not sure what html you are using, but it is very spaced out. if you are doing an unordered list, the code is <ul><li>item</li><li>item</li></ul> (do not use any additional tags like <p> unless you are trying to add paragraph separation within a single item of the list.) * A psychometric question on page "What else influenced your strategy design?" is missing the option "not at all" which causes it to have no labels. Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/src/main/db/init-mme.sql Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-20 01:13:36 UTC (rev 188) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-20 19:34:32 UTC (rev 189) @@ -257,9 +257,16 @@ for(var k:int = 0; k < psychometricResult.choices.length; k++) { - choices = choices + psychometricResult.choices[k]; - choices = choices + "," - + if(choices == "") + { + Alert.show("choices is eqaul to : " + choices); + choices = psychometricResult.choices[k]; + } + else + { + choices = choices + psychometricResult.choices[k]; + } + choices = choices + "," } //Alert.show("choices are: " + choices); @@ -313,9 +320,17 @@ for(k = 0; k < options.choices.length; k++) { - choices = choices + options.choices[k]; - choices = choices + "," - + + if(choices == "") + { + choices = options.choices[k]; + } + else + { + choices = choices + options.choices[k]; + } + choices = choices + "," + } //Alert.show("choices are: " + choices); @@ -1177,8 +1192,13 @@ for(var k:int = 0; k < psychometricResult.choices.length; k++) { - choices = choices + psychometricResult.choices[k]; - choices = choices + "," + if(choices == "") + choices = psychometricResult.choices[k]; + + else + choices = choices + psychometricResult.choices[k]; + + choices = choices + "," } @@ -1237,8 +1257,13 @@ for(k = 0; k < options.choices.length; k++) { - choices = choices + options.choices[k]; - choices = choices + "," + if(choices == "") + choices = options.choices[k]; + + else + choices = choices + options.choices[k]; + + choices = choices + "," } newOptionNode.@choices = choices; } Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-07-20 01:13:36 UTC (rev 188) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-07-20 19:34:32 UTC (rev 189) @@ -161,8 +161,8 @@ PRIMARY KEY (`id`), KEY `FKC24ACFD63A5846C1` (`roundConfig_id`), KEY `FKC24ACFD6992B5A41` (`student_id`), - CONSTRAINT `FKC24ACFD6992B5A41` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`), - CONSTRAINT `FKC24ACFD63A5846C1` FOREIGN KEY (`roundConfig_id`) REFERENCES `round_config` (`id`) + CONSTRAINT `FKC24ACFD63A5846C1` FOREIGN KEY (`roundConfig_id`) REFERENCES `round_config` (`id`), + CONSTRAINT `FKC24ACFD6992B5A41` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -387,7 +387,7 @@ LOCK TABLES `psychometric_question_choices` WRITE; /*!40000 ALTER TABLE `psychometric_question_choices` DISABLE KEYS */; -INSERT INTO `psychometric_question_choices` VALUES (4,'nearly as important'),(4,'not important at all'),(7,'very important'),(7,'not important at all'),(9,'nearly as important'),(9,'not important at all'),(12,'nearly as important'),(12,'not important at all'),(14,'nearly as important'),(14,'not important at all'),(15,'I like my group very much'),(15,'neutral'),(15,'I do not like my group at all'),(16,'very important'),(16,'not important at all'),(17,'very important'),(17,'not important at all'),(18,'very important'),(18,'not important at all'),(19,'completely as a team'),(19,'neutral'),(19,'completely as competing players'),(20,'very much'),(20,'not at all'),(21,'very important'),(21,'not important at all'),(22,'very much'),(22,'not at all'),(23,'very much'),(23,'not at all'),(24,'very much'),(24,'not at all'),(25,'very much'),(25,'not at all'),(26,'very much'),(27,'very much'),(27,'not at all'),(28,'very much'),(28,'not at all'),(29,'very much'),(29,'not at all'),(30,'perfectly'),(30,'not at all'),(31,'much better'),(31,'same as me'),(31,'much worse'),(32,'very confident'),(32,'not at all confident'),(33,'totally'),(33,'not at all'),(34,'completely \x91safe\x92'),(34,'balancing risk and outcomes'),(34,'completely \x91risky\x92'); +INSERT INTO `psychometric_question_choices` VALUES (4,'nearly as important'),(4,'not important at all'),(7,'very important'),(7,'not important at all'),(9,'nearly as important'),(9,'not important at all'),(12,'nearly as important'),(12,'not important at all'),(14,'nearly as important'),(14,'not important at all'),(15,'I like my group very much'),(15,'neutral'),(15,'I do not like my group at all'),(16,'very important'),(16,'not important at all'),(17,'very important'),(17,'not important at all'),(18,'very important'),(18,'not important at all'),(19,'completely as a team'),(19,'neutral'),(19,'completely as competing players'),(20,'very much'),(20,'not at all'),(21,'very important'),(21,'not important at all'),(22,'very much'),(22,'not at all'),(23,'very much'),(23,'not at all'),(24,'very much'),(24,'not at all'),(25,'very much'),(25,'not at all'),(26,'very much'),(27,'very much'),(27,'not at all'),(28,'very much'),(28,'not at all'),(29,'very much'),(29,'not at all'),(30,'perfectly'),(30,'not at all'),(31,'much better'),(31,'same as me'),(31,'much worse'),(32,'very confident'),(32,'not at all confident'),(33,'totally'),(33,'not at all'),(34,'completely ‘safe’'),(34,'balancing risk and outcomes'),(34,'completely ‘risky’'),(26,'not at all'); /*!40000 ALTER TABLE `psychometric_question_choices` ENABLE KEYS */; UNLOCK TABLES; @@ -416,7 +416,7 @@ LOCK TABLES `question` WRITE; /*!40000 ALTER TABLE `question` DISABLE KEYS */; -INSERT INTO `question` VALUES (1,'Most important goal:',1,'categorical',10),(2,'Second most important goal:',2,'categorical',10),(3,'Third most important goal:',4,'categorical',10),(4,'Compared to the most important goal, this goal is',3,'psychometric',10),(6,'',1,'daybydaydecisions',6),(7,'An example of a scale would be',1,'psychometric',11),(8,'<p>\r<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r</p>',1,'text',12),(9,'Compared to the most important goal, this goal is',5,'psychometric',10),(10,'<b>Most important goal:</b>',1,'categorical',13),(11,'<b>Second most important goal:</b>',2,'categorical',13),(12,'Compared to the most important goal, this goal is',3,'psychometric',13),(13,'<b>Third most important goal:</b>',4,'categorical',13),(14,'Compared to the most important goal, this goal is',5,'psychometric',13),(15,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',14),(16,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',14),(17,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',14),(18,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',14),(19,'Do you perceive the group as a team or as competing players?',5,'psychometric',14),(20,'How much do you trust the others in your group?',1,'psychometric',15),(21,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',15),(22,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',15),(23,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',15),(24,'How much do you think the others are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',15),(25,'Do you feel a sense of \x91commitment\x92 to act in the way you specified in your strategy?',1,'psychometric',16),(26,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',16),(27,'Do you feel any sort of \x91social pressure\x92 to act in the way you specified in your strategy?',3,'psychometric',16),(28,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',16),(29,'Are you afraid of some sort of \x91punishment\x92 if you had acted differently as specified in your strategy?',5,'psychometric',16),(30,'How well did you understand the dynamics of the fish population?',1,'psychometric',17),(31,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',17),(32,'How confident are you in having developed a strategy that leads to \x91good\x92 outcomes regarding your goals?',3,'psychometric',17),(33,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',17),(34,'Would you classify your strategy as \x91safe\x92 in the sense of having acceptable but suboptimal results for sure, or rather as \x91risky\x92 in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',17),(35,'',1,'forecastingfishermen',18),(36,'',1,'forecastingfish',19),(37,'',1,'strategydesign',9),(38,'',1,'strategydesign',22),(39,'',1,'daybydaydecisions',24); +INSERT INTO `question` VALUES (1,'Most important goal:',1,'categorical',10),(2,'Second most important goal:',2,'categorical',10),(3,'Third most important goal:',4,'categorical',10),(4,'Compared to the most important goal, this goal is',3,'psychometric',10),(6,'',1,'daybydaydecisions',6),(7,'An example of a scale would be',1,'psychometric',11),(8,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',12),(9,'Compared to the most important goal, this goal is',5,'psychometric',10),(10,'<b>Most important goal:</b>',1,'categorical',13),(11,'<b>Second most important goal:</b>',2,'categorical',13),(12,'Compared to the most important goal, this goal is',3,'psychometric',13),(13,'<b>Third most important goal:</b>',4,'categorical',13),(14,'Compared to the most important goal, this goal is',5,'psychometric',13),(15,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',14),(16,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',14),(17,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',14),(18,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',14),(19,'Do you perceive the group as a team or as competing players?',5,'psychometric',14),(20,'How much do you trust the others in your group?',1,'psychometric',15),(21,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',15),(22,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',15),(23,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',15),(24,'How much do you think the others are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',15),(25,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',16),(26,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',16),(27,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',16),(28,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',16),(29,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',16),(30,'How well did you understand the dynamics of the fish population?',1,'psychometric',17),(31,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',17),(32,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',17),(33,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',17),(34,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',17),(35,'',1,'forecastingfishermen',18),(36,'',1,'forecastingfish',19),(37,'',1,'strategydesign',9),(38,'',1,'strategydesign',22),(39,'',1,'daybydaydecisions',24); /*!40000 ALTER TABLE `question` ENABLE KEYS */; UNLOCK TABLES; @@ -446,7 +446,7 @@ LOCK TABLES `question_group` WRITE; /*!40000 ALTER TABLE `question_group` DISABLE KEYS */; -INSERT INTO `question_group` VALUES (1,'In this experiment you will design a strategy to fish in an abstract fishing ground together with three other persons. As we are mainly interested in the reasons <i>why</i> you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no correct or wrong strategies and no correct or wrong answers. However, since for each pound of fish you get during the experiment you will receive $1.00 US, you might be interested in finding a strategy that fits your goals well. For this, you will need to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group.',30,'<b>Welcome to the E-Fishery Experiment</b>',1,1),(2,'<p>The experiment will run as follows:</p> <ul> <li><b>Introduction</b>: We will explain the interface and how the dynamics of the fish population are modeled. We will also ask you some questions about you and you will have the opportunity to make your decisions on how to fish on a (simulated) day-by-day basis to get a feeling for the dynamics of the fish population. </li> <li><b>Strategy design 1</b>: You will design a fishing strategy that will be simulated together with the strategies of the other persons in your group, and we ask you a larger amount of questions to understand your decisions and to help you reflect on those decisions. </li> <li><b>Fishing and evaluation 1</b>: Besides simulating the strategies you will decide on how to fish on a (simulated) day-by-day basis. Then, we will ask you some questions on your evaluation of the results. </li> <li><b>Communication</b>:You will have the opportunity to chat with the other persons in your group. After the chat we will ask some questions to asses your evaluation of the communication. </li> <li><b>Strategy design, fishing and evaluation 2</b>: The strategy design, fishing and evaluation are repeated as described above. </li> <li><b>Finishing the experiment</b>: The experiment closes with some final questions and more information on the experiment, and you will have the opportunity to give a feedback if you wish to do so. </li> </ul> <p> In the <b>information bar above the main window</b> you can see which part of the experiment you are in, your progress and how you are doing with the time. </p>',30,'<b>Experimental procedure</b>',2,1),(3,'<p>The <b>information window "Fishing Ground"</b> gives you an overview that will be explained here.</p> <p> Imagine you are living on an island and your only income is from a species of fish that only survives in the shallow bays formed by the island. The fish can leave crowed bays and move to less crowded bays, but they cannot survive in the ocean. Nor can new fish arrive from the ocean. </p> <p> The fish population grows at a constant rate. Thus, the more fish are in a bay the faster the population grows. However, the population a bay can sustain is limited and fish leave crowed bays to find less crowded bays. The more crowded a bay, the more fish leave and the less fish enter the bay (the movement is directly proportional to the percentage to which a bay is filled up). The number of fish leaving the bay is proportional to the rate of growth, and the number of fish entering the bay is also proportional to the amount of fish leaving the three bays (i.e. fish in the ocean). </p> <p> The equations of these dynamics are given in the information windows. It is, however, not necessary to know them for designing a strategy. For this, you only have to <b>understand the following five principles</b>: </p> <ul> <li>If all bays are <b>filled up</b> with fish, then the total growth is highest, but all additional lbs of fish are lost to the ocean and the amount of fish in the bays stops growing.</li> <li>If the bays are <b>half filled</b>, then the amount of fish in the bays grows fastest.</li> <li>If the bays are <b>nearly empty</b>, the population grows very slowly.</li> <li>If there is <b>no fish</b> in any of the bays, there will be never any fish again.</li> <li>If there are both <b>crowded and empty</b> bays, a lot of fish move from the crowded to the empty bays.</li> </ul> ',120,'<b>How the dynamics of the fish population are modeled</b>',3,1),(4,'<p>The three bays are different in size and characteristics leading to different growth rates and capacities (i.e. the maximal amount of fish the bay can sustain). At the start of the simulation each bay is half filled.</p> <table> <thead> <th></th><th>Bay 1</th><th>Bay 2</th><th>Bay 3</th> </thead> <tbody> <tr> <td>Capacity:</td><td>10 lb</td><td>20 lb</td><td>30 lb</td> </tr> <tr> <td>Starts with:</td><td>5 lb</td><td>10 lb</td><td>15 lb</td> </tr> <tr> <td>Growth rate:</td><td>50% per day</td><td>15% per day</td><td>5% per day</td> </tr> </tbody> </table> <p> <b>How much fish</b> you take out in a day is <b>directly proportional with the extent that the bay is filled up with fish</b>. Your fishing gear allows you to harvest a maximum of 5 lbs. Thus, if the bay is completely filled up you get 5 lb of fish. If the bay is half filled, you get 2.5 lb of fish. If the bay is filled up only to 20 % you will get 1 lb, etc. The fish population is diminished by the same amount. If several persons fish the same bay and together would get more fish than the bay holds, then all the fish in the bay are distributed equally among these fishermen. </p> <p>However, you can <b>stay in the harbor</b> instead of fishing. This way, you do not get anything and the fish population is not diminished. </p> <p> Your task is to design a strategy of how to fish this fishing ground for 30 days together with three other persons (thus, with you the group compromises 4 persons). You will define the number of days that you stay in each bay or in the harbor. Please note that this is not an exam! We do not expect you to find the mathematically optimal solution to this problem. We want to know how you come up with a solution that sufficiently fulfills your goals. As long as we can understand why you choose a certain strategy you can come up with whatever you like. </p> ',120,'<b>Differences of bays and effects of fishing</b>',4,1),(5,'<p>Before designing the strategy, you have the opportunity to make your decisions on a day-by-day basis for the simulation. You will interact with the actual model of the fishing ground together with the other persons of your group. Thus, the problems and possibilities you will experience in this warm-up are relevant for the design of your strategy. </p> <p> The <b>interface</b> you will encounter on the next page has the following elements: <ul> <li>Information on the day of the simulation</li> <li>Buttons for your decision. If you want to fish in Bay 1, for example, click on Button "Bay 1". </li> <li>Time remaining. You have 10 seconds for each decision. If you do not press any button within these 10 seconds then you will stay in the harbor for this day. However, you can change your decision within these 10 seconds (i.e. if you clicked on "Bay 1" after 4 seconds and after another 4 seconds on "Bay 3", you will go to Bay 3). </li> <li>Table of past results. Your previous locations from past days are highlighted. The table shows you how much you fished and who else was in the same location as you. You do not have any information of locations where you not have been. </li> ',60,'<b>A warm-up</b>',5,1),(6,'',345,'<b>Day-by-day-decisions</b>',6,1),(7,'<p>In what we refer to as a \'strategy\' you predefine your decisions of where to go each day of the simulation.\r Al-though only 30 days will be simulated, your strategy should represent your decisions for an indefinite period. Therefore you define a <b>set of decisions that will be repeated</b> until the end of the simulation. The set can contain as many decisions as you want but try to use as few as possible. Remember: Often simple strategies are more effective!</p> <p>It might be that you want to base your set of repeated decisions on another state of the fish population. In this case you can define a set of not repeated decisions that are applied at the beginning of the simulation. For example, you might first stay in the harbor to let the fish population increase or first fish all the bays to reduce the fish population before you start the repeated sequence of decisions.</p> <p>In this strategy you define how many days you stay at a certain location and to which other location you will move on.\r If, for example, you define to repeat the sequence \"2 days in harbor - 3 days in Bay 1 - 2 days in Bay 2\" you will not fish for two days, then fish in Bay 1 for three days, then fish in Bay 2 for two days, then not fish for two days, then fish in Bay 1 for three days, etc.</p> ',480,'<b>Designing your Strategy</b>',1,2),(8,'<p>Your strategy is mainly based on the number of days you stay at a certain location. However, things might run differently than you expected and you might wish to leave a bay earlier than the days you specified because you get too few fish out of that bay. For doing so you can specify a threshold of income. If you fish less then this threshold, the next day you will not fish this bay anymore but move on to the next location specified in your strategy.</p> <p>Note: Thresholds refer to the quantity of fish you get during one day fishing in a bay and not, for example, to the quantity of fish in the bay, fish fished by others, sum of fish already fished, etc.</p> <p>The final option you have is to stop repeating your strategy and stay in the harbor for some days. This op-tion can be used to prevent the total destruction of the fish population. For this you define a threshold and a number of days. If during one repetition of your decision set you never fished the amount defined by the threshold, then you stay in the harbor for the specified number of days before you start the next repetition.</p> <p>Note: Intentionally we do not allow designing \'intelligent\' strategies that search for solutions during the game. You have to think about what would be the best solution for you and express it with the options explained above.</p> ',90,'<b>Some special features of the strategy design</b>',2,2),(9,'<p>Design your strategy by clicking on <b>\'New\'</b>, <b>\'Edit\'</b>, and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'.</p>\r<p>When you are done, click on <b>\'Next\'</b>. Your strategy will then be checked for some common or logical errors. </p>',480,'<b>Design your strategy</b>',3,2),(10,'<p>Please specify three goals that most influenced the design of your strategy. You can select from 18 different goals grouped in three categories (foci). </p><p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal.</p><p> The information you write into these fields will be available the next time you edit your strategy.</p>',30,'<b>What goals did you follow when designing your strategy?</b>',3,3),(11,'<p>We will ask you a number of questions on the strategy you just designed. This will help us to better understand how you came up with your strategy and it might help you reflect on certain aspects to improve your strategy.</p>\r<p>Besides <b>large fields</b> to write text and <b>small fields</b> to write numbers, you will encounter drop-down lists for selecting predefined values and scales. </p>\r<p>To give an answer on a scale, click on the location between the labels that comes closest to your opinion. By clicking on the scale, a slider appears that marks the value you selected. You can change the value by clicking on another position on the scale. By clicking on the reset button, the sliders of all scales on a page are removed and you can start selecting values again.</p>\r<p>Please try to answer all questions even if you are not sure. We are not testing your abilities but rather want to understand how you came up with your strategy.</p>\r',30,'<b>Introduction to questionnaire</b>',1,3),(12,'<p>Please explain your strategy with a few sentences. Particularly consider the following aspects:</p>',300,'<b>Explain the strategy in your own words</b>',2,3),(13,'<p>Specify the three goals that you think most influenced the design of the strategy of the other fishermen in your group. You can select from 18 different goals grouped in three categories (foci).</p>\r<p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal</p>\r',30,'<b>What goals do you think the others follow?</b>',4,3),(14,'',30,'<b>How do you perceive your group?</b>',5,3),(15,'',30,'<b>How much do you count on others and how much can they count on you?</b>',6,3),(16,'',30,'<b>What else influenced your strategy design?</b>',7,3),(17,'',60,'<b>How confident are you in reaching the outcomes you are expecting?</b>',8,3),(18,'<p>Fill in the following table your expectations of the others\x92 actions (i.e. the number of fishermen in each bay) for the first 15 days. Please note that we ask only for the expectations of where the others will go. </p>',180,'<b>What are you expecting the others will do?</b>',9,3),(19,'<p>Please enter in the table below your expectations of how the fish population develops within the first six days. Note that by clicking on \x93Update\x94 the earnings and fish remaining in the bays is calculated, using your expecta-tions of the other\x92s actions and your strategy. Thus, you only have to think about how the fish population changes from one day to the next due to growth and movement of the fish. These estimations can be really rough. We do not expect you do perform detailed calculations.</p>\r<b>Note: You can only change the entries of one day at a time. To calculate the values and activate the next day for entries click on \x93Update\x94. You cannot return to previous days!</b>\r',180,'<b>What are you expecting how the fish population will develop?</b>',10,3),(20,'By clicking on \x93Accept\x94 you will leave this part of the questionnaire and return to the strategy design. <b>You can-not return to this or previous pages!</b> However, important information for the design of your strategy will be available in information windows.',30,'<b>Leaving questionnaire on your strategy</b>',11,3),(21,'<p>The previous questions may have lead to some reflections on your strategy and you may wish to change some elements of it. Among the information windows you will find your previous strategy, your goals and your fore-cast.</p>\r<p>The time for editing your strategy depends on how fast you finished the questionnaire. For the next simulation we have to synchronize the group again. If you have been rather fast, you can think now more deeply about your strategy. If you are rather behind the time suggestion, you have to make your changes quickly.</p>\r<p>The interface for designing your strategy will not be explained again. If you are not sure about some elements, please refer to the information window \x93Help on strategy design\x94.</p>\r',30,'<b>Edit your strategy</b>',1,4),(22,'<p>Design your strategy by clicking on <b>\'New\'</b>, <b>\'Edit\'</b>, and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'.</p>\r<p>When you are done, click on <b>\'Next\'</b>. Your strategy will then be checked for some common or logical errors. </p>',240,'<b>Design your strategy</b>',2,4),(23,'<p>Before we present the results of your strategy, we would like to see again how you make your decisions day-by-day. On the next page you will find the same interface as you already used to decide on how to fish the modeled fishing grounds.</p>',15,'<b>Applying your strategy in day-by-day decisions</b>',1,5),(24,'',345,'<b>Day-by-day-decisions</b>',2,5),(25,'<p>We will now present you the results of your strategy. By clicking on \x93Accept\x94 you cannot return to this or any previous page, but the results of your day-by-day decisions (and also of your strategy) will be available in an information window.</p>',15,'<b>Leaving day-bay-day decisions</b>',3,5); +INSERT INTO `question_group` VALUES (1,'In this experiment you will design a strategy to fish in an abstract fishing ground together with three other persons. As we are mainly interested in the reasons <i>why</i> you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no correct or wrong strategies and no correct or wrong answers. However, since for each pound of fish you get during the experiment you will receive $1.00 US, you might be interested in finding a strategy that fits your goals well. For this, you will need to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group.',30,'<b>Welcome to the E-Fishery Experiment</b>',1,1),(2,'<p>The experiment will run as follows:</p> <ul> <li><b>Introduction</b>: We will explain the interface and how the dynamics of the fish population are modeled. We will also ask you some questions about you and you will have the opportunity to make your decisions on how to fish on a (simulated) day-by-day basis to get a feeling for the dynamics of the fish population. </li> <li><b>Strategy design 1</b>: You will design a fishing strategy that will be simulated together with the strategies of the other persons in your group, and we ask you a larger amount of questions to understand your decisions and to help you reflect on those decisions. </li> <li><b>Fishing and evaluation 1</b>: Besides simulating the strategies you will decide on how to fish on a (simulated) day-by-day basis. Then, we will ask you some questions on your evaluation of the results. </li> <li><b>Communication</b>:You will have the opportunity to chat with the other persons in your group. After the chat we will ask some questions to asses your evaluation of the communication. </li> <li><b>Strategy design, fishing and evaluation 2</b>: The strategy design, fishing and evaluation are repeated as described above. </li> <li><b>Finishing the experiment</b>: The experiment closes with some final questions and more information on the experiment, and you will have the opportunity to give a feedback if you wish to do so. </li> </ul> <p> In the <b>information bar above the main window</b> you can see which part of the experiment you are in, your progress and how you are doing with the time. </p>',30,'<b>Experimental procedure</b>',2,1),(3,'<p>The <b>information window "Fishing Ground"</b> gives you an overview that will be explained here.</p> <p> Imagine you are living on an island and your only income is from a species of fish that only survives in the shallow bays formed by the island. The fish can leave crowed bays and move to less crowded bays, but they cannot survive in the ocean. Nor can new fish arrive from the ocean. </p> <p> The fish population grows at a constant rate. Thus, the more fish are in a bay the faster the population grows. However, the population a bay can sustain is limited and fish leave crowed bays to find less crowded bays. The more crowded a bay, the more fish leave and the less fish enter the bay (the movement is directly proportional to the percentage to which a bay is filled up). The number of fish leaving the bay is proportional to the rate of growth, and the number of fish entering the bay is also proportional to the amount of fish leaving the three bays (i.e. fish in the ocean). </p> <p> The equations of these dynamics are given in the information windows. It is, however, not necessary to know them for designing a strategy. For this, you only have to <b>understand the following five principles</b>: </p> <ul> <li>If all bays are <b>filled up</b> with fish, then the total growth is highest, but all additional lbs of fish are lost to the ocean and the amount of fish in the bays stops growing.</li> <li>If the bays are <b>half filled</b>, then the amount of fish in the bays grows fastest.</li> <li>If the bays are <b>nearly empty</b>, the population grows very slowly.</li> <li>If there is <b>no fish</b> in any of the bays, there will be never any fish again.</li> <li>If there are both <b>crowded and empty</b> bays, a lot of fish move from the crowded to the empty bays.</li> </ul> ',120,'<b>How the dynamics of the fish population are modeled</b>',3,1),(4,'<p>The three bays are different in size and characteristics leading to different growth rates and capacities (i.e. the maximal amount of fish the bay can sustain). At the start of the simulation each bay is half filled.</p> <table> <thead> <th></th><th>Bay 1</th><th>Bay 2</th><th>Bay 3</th> </thead> <tbody> <tr> <td>Capacity:</td><td>10 lb</td><td>20 lb</td><td>30 lb</td> </tr> <tr> <td>Starts with:</td><td>5 lb</td><td>10 lb</td><td>15 lb</td> </tr> <tr> <td>Growth rate:</td><td>50% per day</td><td>15% per day</td><td>5% per day</td> </tr> </tbody> </table> <p> <b>How much fish</b> you take out in a day is <b>directly proportional with the extent that the bay is filled up with fish</b>. Your fishing gear allows you to harvest a maximum of 5 lbs. Thus, if the bay is completely filled up you get 5 lb of fish. If the bay is half filled, you get 2.5 lb of fish. If the bay is filled up only to 20 % you will get 1 lb, etc. The fish population is diminished by the same amount. If several persons fish the same bay and together would get more fish than the bay holds, then all the fish in the bay are distributed equally among these fishermen. </p> <p>However, you can <b>stay in the harbor</b> instead of fishing. This way, you do not get anything and the fish population is not diminished. </p> <p> Your task is to design a strategy of how to fish this fishing ground for 30 days together with three other persons (thus, with you the group compromises 4 persons). You will define the number of days that you stay in each bay or in the harbor. Please note that this is not an exam! We do not expect you to find the mathematically optimal solution to this problem. We want to know how you come up with a solution that sufficiently fulfills your goals. As long as we can understand why you choose a certain strategy you can come up with whatever you like. </p> ',120,'<b>Differences of bays and effects of fishing</b>',4,1),(5,'<p>Before designing the strategy, you have the opportunity to make your decisions on a day-by-day basis for the simulation. You will interact with the actual model of the fishing ground together with the other persons of your group. Thus, the problems and possibilities you will experience in this warm-up are relevant for the design of your strategy. </p> <p> The <b>interface</b> you will encounter on the next page has the following elements: <ul> <li>Information on the day of the simulation</li> <li>Buttons for your decision. If you want to fish in Bay 1, for example, click on Button "Bay 1". </li> <li>Time remaining. You have 10 seconds for each decision. If you do not press any button within these 10 seconds then you will stay in the harbor for this day. However, you can change your decision within these 10 seconds (i.e. if you clicked on "Bay 1" after 4 seconds and after another 4 seconds on "Bay 3", you will go to Bay 3). </li> <li>Table of past results. Your previous locations from past days are highlighted. The table shows you how much you fished and who else was in the same location as you. You do not have any information of locations where you not have been. </li> ',60,'<b>A warm-up</b>',5,1),(6,'',345,'<b>Day-by-day-decisions</b>',6,1),(7,'<p>In what we refer to as a \'strategy\' you predefine your decisions of where to go each day of the simulation.\r Al-though only 30 days will be simulated, your strategy should represent your decisions for an indefinite period. Therefore you define a <b>set of decisions that will be repeated</b> until the end of the simulation. The set can contain as many decisions as you want but try to use as few as possible. Remember: Often simple strategies are more effective!</p> <p>It might be that you want to base your set of repeated decisions on another state of the fish population. In this case you can define a set of not repeated decisions that are applied at the beginning of the simulation. For example, you might first stay in the harbor to let the fish population increase or first fish all the bays to reduce the fish population before you start the repeated sequence of decisions.</p> <p>In this strategy you define how many days you stay at a certain location and to which other location you will move on.\r If, for example, you define to repeat the sequence \"2 days in harbor - 3 days in Bay 1 - 2 days in Bay 2\" you will not fish for two days, then fish in Bay 1 for three days, then fish in Bay 2 for two days, then not fish for two days, then fish in Bay 1 for three days, etc.</p> ',480,'<b>Designing your Strategy</b>',1,2),(8,'<p>Your strategy is mainly based on the number of days you stay at a certain location. However, things might run differently than you expected and you might wish to leave a bay earlier than the days you specified because you get too few fish out of that bay. For doing so you can specify a threshold of income. If you fish less then this threshold, the next day you will not fish this bay anymore but move on to the next location specified in your strategy.</p> <p>Note: Thresholds refer to the quantity of fish you get during one day fishing in a bay and not, for example, to the quantity of fish in the bay, fish fished by others, sum of fish already fished, etc.</p> <p>The final option you have is to stop repeating your strategy and stay in the harbor for some days. This op-tion can be used to prevent the total destruction of the fish population. For this you define a threshold and a number of days. If during one repetition of your decision set you never fished the amount defined by the threshold, then you stay in the harbor for the specified number of days before you start the next repetition.</p> <p>Note: Intentionally we do not allow designing \'intelligent\' strategies that search for solutions during the game. You have to think about what would be the best solution for you and express it with the options explained above.</p> ',90,'<b>Some special features of the strategy design</b>',2,2),(9,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',480,'<b>Design your strategy</b>',3,2),(10,'<p>Please specify three goals that most influenced the design of your strategy. You can select from 18 different goals grouped in three categories (foci). </p><p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal.</p><p> The information you write into these fields will be available the next time you edit your strategy.</p>',30,'<b>What goals did you follow when designing your strategy?</b>',3,3),(11,'<p>We will ask you a number of questions on the strategy you just designed. This will help us to better understand how you came up with your strategy and it might help you reflect on certain aspects to improve your strategy.</p>\r<p>Besides <b>large fields</b> to write text and <b>small fields</b> to write numbers, you will encounter drop-down lists for selecting predefined values and scales. </p>\r<p>To give an answer on a scale, click on the location between the labels that comes closest to your opinion. By clicking on the scale, a slider appears that marks the value you selected. You can change the value by clicking on another position on the scale. By clicking on the reset button, the sliders of all scales on a page are removed and you can start selecting values again.</p>\r<p>Please try to answer all questions even if you are not sure. We are not testing your abilities but rather want to understand how you came up with your strategy.</p>\r',30,'<b>Introduction to questionnaire</b>',1,3),(12,'<p>Please explain your strategy with a few sentences. Particularly consider the following aspects:</p>',300,'<b>Explain the strategy in your own words</b>',2,3),(13,'<p>Specify the three goals that you think most influenced the design of the strategy of the other fishermen in your group. You can select from 18 different goals grouped in three categories (foci).</p>\r<p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal</p>\r',30,'<b>What goals do you think the others follow?</b>',4,3),(14,'',30,'<b>How do you perceive your group?</b>',5,3),(15,'',30,'<b>How much do you count on others and how much can they count on you?</b>',6,3),(16,'',30,'<b>What else influenced your strategy design?</b>',7,3),(17,'',60,'<b>How confident are you in reaching the outcomes you are expecting?</b>',8,3),(18,'<p>Fill in the following table your expectations of the others’ actions (i.e. the number of fishermen in each bay) for the first 15 days. Please note that we ask only for the expectations of where the others will go. </p>',180,'<b>What are you expecting the others will do?</b>',9,3),(19,'<p>Please enter in the table below your expectations of how the fish population develops within the first six days. Note that by clicking on “Update” the earnings and fish remaining in the bays is calculated, using your expecta-tions of the other’s actions and your strategy. Thus, you only have to think about how the fish population changes from one day to the next due to growth and movement of the fish. These estimations can be really rough. We do not expect you do perform detailed calculations.</p>\r<b>Note: You can only change the entries of one day at a time. To calculate the values and activate the next day for entries click on “Update”. You cannot return to previous days!</b>\r',180,'<b>What are you expecting how the fish population will develop?</b>',10,3),(20,'By clicking on “Accept” you will leave this part of the questionnaire and return to the strategy design. <b>You can-not return to this or previous pages!</b> However, important information for the design of your strategy will be available in information windows.',30,'<b>Leaving questionnaire on your strategy</b>',11,3),(21,'<p>The previous questions may have lead to some reflections on your strategy and you may wish to change some elements of it. Among the information windows you will find your previous strategy, your goals and your fore-cast.</p>\r<p>The time for editing your strategy depends on how fast you finished the questionnaire. For the next simulation we have to synchronize the group again. If you have been rather fast, you can think now more deeply about your strategy. If you are rather behind the time suggestion, you have to make your changes quickly.</p>\r<p>The interface for designing your strategy will not be explained again. If you are not sure about some elements, please refer to the information window “Help on strategy design”.</p>\r',30,'<b>Edit your strategy</b>',1,4),(22,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',240,'<b>Design your strategy</b>',2,4),(23,'<p>Before we present the results of your strategy, we would like to see again how you make your decisions day-by-day. On the next page you will find the same interface as you already used to decide on how to fish the modeled fishing grounds.</p>',15,'<b>Applying your strategy in day-by-day decisions</b>',1,5),(24,'',345,'<b>Day-by-day-decisions</b>',2,5),(25,'<p>We will now present you the results of your strategy. By clicking on “Accept” you cannot return to this or any previous page, but the results of your day-by-day decisions (and also of your strategy) will be available in an information window.</p>',15,'<b>Leaving day-bay-day decisions</b>',3,5); /*!40000 ALTER TABLE `question_group` ENABLE KEYS */; UNLOCK TABLES; @@ -522,8 +522,8 @@ PRIMARY KEY (`round_config_id`,`questionGroups_id`), KEY `FKAC0583924E7815A0` (`questionGroups_id`), KEY `FKAC058392634CAB1E` (`round_config_id`), - CONSTRAINT `FKAC058392634CAB1E` FOREIGN KEY (`round_config_id`) REFERENCES `round_config` (`id`), - CONSTRAINT `FKAC0583924E7815A0` FOREIGN KEY (`questionGroups_id`) REFERENCES `question_group` (`id`) + CONSTRAINT `FKAC0583924E7815A0` FOREIGN KEY (`questionGroups_id`) REFERENCES `question_group` (`id`), + CONSTRAINT `FKAC058392634CAB1E` FOREIGN KEY (`round_config_id`) REFERENCES `round_config` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -583,8 +583,8 @@ PRIMARY KEY (`id`), KEY `FK7B993B8846861732` (`dayOutput_id`), KEY `FK7B993B888374539C` (`strategy_id`), - CONSTRAINT `FK7B993B888374539C` FOREIGN KEY (`strategy_id`) REFERENCES `student_strategy` (`id`), - CONSTRAINT `FK7B993B8846861732` FOREIGN KEY (`dayOutput_id`) REFERENCES `student_strategy` (`id`) + CONSTRAINT `FK7B993B8846861732` FOREIGN KEY (`dayOutput_id`) REFERENCES `student_strategy` (`id`), + CONSTRAINT `FK7B993B888374539C` FOREIGN KEY (`strategy_id`) REFERENCES `student_strategy` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -642,8 +642,8 @@ PRIMARY KEY (`id`), KEY `FK49C432973A5846C1` (`roundconfig_id`), KEY `FK49C43297992B5A41` (`student_id`), - CONSTRAINT `FK49C43297992B5A41` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`), - CONSTRAINT `FK49C432973A5846C1` FOREIGN KEY (`roundconfig_id`) REFERENCES `round_config` (`id`) + CONSTRAINT `FK49C432973A5846C1` FOREIGN KEY (`roundconfig_id`) REFERENCES `round_config` (`id`), + CONSTRAINT `FK49C43297992B5A41` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -704,8 +704,8 @@ PRIMARY KEY (`id`), KEY `FKFBDC4543A5846C1` (`roundConfig_id`), KEY `FKFBDC454992B5A41` (`student_id`), - CONSTRAINT `FKFBDC454992B5A41` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`), - CONSTRAINT `FKFBDC4543A5846C1` FOREIGN KEY (`roundConfig_id`) REFERENCES `round_config` (`id`) + CONSTRAINT `FKFBDC4543A5846C1` FOREIGN KEY (`roundConfig_id`) REFERENCES `round_config` (`id`), + CONSTRAINT `FKFBDC454992B5A41` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -727,4 +727,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2009-07-20 0:55:33 +-- Dump completed on 2009-07-20 19:31:38 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-07-23 18:36:53
|
Revision: 203 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=203&view=rev Author: seematalele Date: 2009-07-23 18:36:45 +0000 (Thu, 23 Jul 2009) Log Message: ----------- Created InformationWindow.as and Student.as Added student variable in StudentStrategy.java and DaybyDayDecision.java Modified Paths: -------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/InformationWindow.as mentalmodels/trunk/flex/src/actionscript/Student.as Added: mentalmodels/trunk/flex/src/actionscript/InformationWindow.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/InformationWindow.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/InformationWindow.as 2009-07-23 18:36:45 UTC (rev 203) @@ -0,0 +1,17 @@ +package actionscript +{ + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.InformationWindow")] + public class InformationWindow + { + public var id:int; + + public var sequenceNo:int; + + public var title:String; + + public var block:Block; + + + } +} \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/Student.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Student.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/Student.as 2009-07-23 18:36:45 UTC (rev 203) @@ -0,0 +1,32 @@ +package actionscript +{ + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.Student")] + + public var class Student + { + + public id:int; + + + public var group:Group; + + + public var studentNo:int; + + + public var birthYear:int; + + public var major:String; + + public var semester:String; + + + public var timestamp:Date; + + + public var gender:String; + + + } +} \ No newline at end of file Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java 2009-07-22 21:59:10 UTC (rev 202) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java 2009-07-23 18:36:45 UTC (rev 203) @@ -19,22 +19,22 @@ @Id @GeneratedValue - public Long id; + private Long id; @Column(nullable=false) - public Integer dayNumber; + private Integer dayNumber; @ManyToOne @JoinColumn(nullable=false) - public Location location; + private Location location; //earning will be in pound @Column(nullable=false) - public Double earnings; + private Double earnings; @Column(nullable=false) - public Double money; + private Double money; @ManyToOne @JoinColumn(nullable=false) @@ -79,6 +79,14 @@ public Student getStudent() { return student; } + + public void setDayNumber(Integer dayNumber) { + this.dayNumber = dayNumber; + } + + public Integer getDayNumber() { + return dayNumber; + } } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-07-22 21:59:10 UTC (rev 202) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-07-23 18:36:45 UTC (rev 203) @@ -42,8 +42,8 @@ @Temporal(TemporalType.TIMESTAMP) private Date timestamp; - @Enumerated(EnumType.ORDINAL) - private Gender gender; + + private String gender; public Long getId() { return id; @@ -93,11 +93,11 @@ return semester; } - public void setGender(Gender gender) { + public void setGender(String gender) { this.gender = gender; } - public Gender getGender() { + public String getGender() { return gender; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-07-22 21:59:10 UTC (rev 202) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-07-23 18:36:45 UTC (rev 203) @@ -24,7 +24,7 @@ @Id @GeneratedValue - public Long id; + private Long id; @ManyToOne @JoinColumn(nullable=false) @@ -35,13 +35,13 @@ private Round roundConfig; @Column(name = "allocation_sequence_no",nullable=false) - public Integer allocationSeqNo; + private Integer allocationSeqNo; @Column(nullable=false) - public Integer days; + private Integer days; @Column(nullable=false) - public Double threshold; + private Double threshold; @ManyToOne @JoinColumn(nullable=false) Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-07-22 21:59:10 UTC (rev 202) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-07-23 18:36:45 UTC (rev 203) @@ -34,7 +34,7 @@ Student student = new Student(); student.setBirthYear(birthYear); student.setSemester(semester); - student.setGender(Gender.valueOf(gender)); + student.setGender(gender); student.setMajor(major); student.setTimestamp(new Timestamp(new Date().getTime())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-07-23 19:03:16
|
Revision: 204 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=204&view=rev Author: seematalele Date: 2009-07-23 19:03:10 +0000 (Thu, 23 Jul 2009) Log Message: ----------- Resolved errors in Student.as and StudentResponse.as and removed Alert.show() statements from InitialiseDatabase.mxml Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/flex/src/actionscript/Student.as mentalmodels/trunk/flex/src/actionscript/StudentResponse.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-23 18:36:45 UTC (rev 203) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-23 19:03:10 UTC (rev 204) @@ -58,26 +58,6 @@ private var survey:XML = <list> <module title="Survey Questions" id="0" sequenceNo="0" hours="0" min="0" sec="0"/> - <module title="Preexperiment" sequenceNo="1" hours="0" min="3" sec="0" id="1"> - <block name="Introduction" sequenceNo="1" hours="0" min="3" sec="0" id="1"> - <questiongroup header="Welcome to E-Fishery Experiment" - description="In this experiment you will design..." sequenceNo="1" - hours="0" min="3" sec="0" id="1" /> - - </block> - - </module> - <module title ="Game Round" sequenceNo="2" hours="1" min="30" sec="0" id="2"> - <block name="Characterizing Own Strategy" sequenceNo="1" hours="0" min="30" sec="0" id="2"> - <questiongroup header="What goals did you follow when designing your strategy" description="Please specify three goals..." hours="0" min="3" sec="0" sequenceNo="1" id="2"> - <question title="Most important goal" type="categorical" sequenceNo="1" communication="true" id="1" > - </question> - <question title="second important goal" type="psychometric" sequenceNo="2" communication="false" id="2" > - </question> - </questiongroup> - </block> - - </module> </list>; /** @@ -372,7 +352,7 @@ newQNode.@type = question.type; newQNode.@id = question.id; newQNode.@communication = question.communicationQ; - Alert.show("communication : " + question.communicationQ); + //Alert.show("communication : " + question.communicationQ); } return newQNode; @@ -987,7 +967,7 @@ asPsychometric.type = questionInfo.getType(); asPsychometric.communicationQ = questionInfo.isCommunicationQuestion(); //Alert.show("Psychometric Object :"); - Alert.show("Communication: " + asPsychometric.communicationQ); + //Alert.show("Communication: " + asPsychometric.communicationQ); //Alert.show("SeQ No: " + asPsychometric.sequenceNo); //Alert.show("Type : " + asPsychometric.type); @@ -1121,7 +1101,7 @@ question.sequenceNo = int(questionInfo.getSequenceNo()); question.type = questionInfo.getType(); question.communicationQ = questionInfo.isCommunicationQuestion(); - Alert.show("communication : " + questionInfo.isCommunicationQuestion()); + //Alert.show("communication : " + questionInfo.isCommunicationQuestion()); if(questionInfo.getId() == 0) { if(checkSeqNoQuestion.length() > 0) @@ -1420,7 +1400,7 @@ questionInfo.setQuestion(node.@title); questionInfo.setSequenceNo(node.@sequenceNo); questionInfo.setId(node.@id); - Alert.show("communication: " + node.@communication); + //Alert.show("communication: " + node.@communication); questionInfo.setCommunicationQuestion(node.@communication); var str:String = node.@type; /*Alert.show("q type is: " + node.@type); @@ -1653,14 +1633,14 @@ </mx:Grid> </mx:Canvas> - <mx:Tree id="treeCQ" dataProvider="{categoricalQuestions}" + <!-- <mx:Tree id="treeCQ" dataProvider="{categoricalQuestions}" labelFunction="treeLabelCategoricalQ" allowMultipleSelection="false" selectable="true" showRoot="true" height="50%" width="80%" textAlign="center"/> <mx:Spacer width="20"/> <mx:Tree id="treePQ" dataProvider="{psychometricQuestions}" labelFunction="treeLabelPsychometricQ" allowMultipleSelection="false" selectable="true" - showRoot="true" height="50%" width="80%" textAlign="center"/> + showRoot="true" height="50%" width="80%" textAlign="center"/> --> </mx:VBox> <mx:Panel id = "pnlComponent" height="100%" layout="vertical"> <mx:HBox width="100%"> Modified: mentalmodels/trunk/flex/src/actionscript/Student.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Student.as 2009-07-23 18:36:45 UTC (rev 203) +++ mentalmodels/trunk/flex/src/actionscript/Student.as 2009-07-23 19:03:10 UTC (rev 204) @@ -3,13 +3,13 @@ [Bindable] [RemoteClass(alias="edu.asu.commons.mme.entity.Student")] - public var class Student + public class Student { - public id:int; + public var id:int; - public var group:Group; + //public var group:Group; public var studentNo:int; Modified: mentalmodels/trunk/flex/src/actionscript/StudentResponse.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/StudentResponse.as 2009-07-23 18:36:45 UTC (rev 203) +++ mentalmodels/trunk/flex/src/actionscript/StudentResponse.as 2009-07-23 19:03:10 UTC (rev 204) @@ -7,7 +7,7 @@ public class StudentResponse { public var id:Number; - public var student:Student; + public var student:actionscript.Student; public var question:Question; public var response:String; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-07-23 18:36:45 UTC (rev 203) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-07-23 19:03:10 UTC (rev 204) @@ -33,6 +33,8 @@ } } + //public void daybyday + public void setStudentDao(HibernateStudentDao studentDao) { this.studentDao = studentDao; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-07-24 21:29:24
|
Revision: 206 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=206&view=rev Author: seematalele Date: 2009-07-24 21:29:16 +0000 (Fri, 24 Jul 2009) Log Message: ----------- Created DayByDayDecisionService.java and EarningService.java DayByDayDecisionService.java --> this will be used for keeping track of day by day decision of students and also executing those decisions. EarningService.java --> This will be used for keep track of the input from student in day by day decision game interface. This can be extended for keeping track of time for blocks. Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml Added Paths: ----------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/EarningService.java Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-23 21:15:18 UTC (rev 205) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-24 21:29:16 UTC (rev 206) @@ -943,15 +943,15 @@ if(isQuestionFormValid) { - Alert.show("Parent id: " + node.@id); + //Alert.show("Parent id: " + node.@id); //check the sequence number first, if sequence number already exists throw an error, otherwise create Question var questionGroup:XMLList = survey.module.block.questiongroup.(@id == node.@id); - Alert.show("Parent children length: " + questionGroup.children().length()); + //Alert.show("Parent children length: " + questionGroup.children().length()); if(questionGroup.length() > 0 ) { var checkSeqNoQuestion:XMLList = questionGroup.question.(@sequenceNo == questionInfo.getSequenceNo()); - Alert.show("checkSeqNoQuestion length: " + checkSeqNoQuestion.length()); + //Alert.show("checkSeqNoQuestion length: " + checkSeqNoQuestion.length()); if(currentState == "psychometric") { var psychobj:DisplayObject = pnlComponent.getChildAt(2); @@ -1137,9 +1137,9 @@ if(question_Object != null) { var newQuestionNode:XML = createQuestionNode(question_Object); - Alert.show("question_Object.questionGroup.id " + question_Object.questionGroup.id); + //Alert.show("question_Object.questionGroup.id " + question_Object.questionGroup.id); var questionGroup:XMLList = survey.module.block.questiongroup.(@id == question_Object.questionGroup.id); - Alert.show("question_Object.questionGroup.length " + questionGroup.length()); + //Alert.show("question_Object.questionGroup.length " + questionGroup.length()); if( questionGroup.length() > 0 ) { questionGroup[0].appendChild(newQuestionNode); Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java 2009-07-23 21:15:18 UTC (rev 205) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/DaybyDayDecision.java 2009-07-24 21:29:16 UTC (rev 206) @@ -1,16 +1,20 @@ package edu.asu.commons.mme.entity; import java.io.Serializable; +import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; +import org.hibernate.annotations.CollectionOfElements; + @Entity @Table(name="day_by_day_decision") public class DaybyDayDecision implements Serializable { @@ -40,6 +44,9 @@ @JoinColumn(nullable=false) private Student student; + @CollectionOfElements(fetch = FetchType.EAGER) + private List<Student> otherStudents; + public void setId(Long id) { this.id = id; } @@ -87,6 +94,13 @@ public Integer getDayNumber() { return dayNumber; } - + public void setOtherStudents(List<Student> otherStudents) { + this.otherStudents = otherStudents; + } + + public List<Student> getOtherStudents() { + return otherStudents; + } + } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-07-23 21:15:18 UTC (rev 205) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-07-24 21:29:16 UTC (rev 206) @@ -5,6 +5,9 @@ import edu.asu.commons.mme.dao.HibernateDaybyDayDecisionDao; import edu.asu.commons.mme.dao.HibernateStudentDao; import edu.asu.commons.mme.dao.HibernateStudentResponseDao; +import edu.asu.commons.mme.entity.Block; +import edu.asu.commons.mme.entity.DaybyDayDecision; +import edu.asu.commons.mme.entity.Location; import edu.asu.commons.mme.entity.Student; import edu.asu.commons.mme.entity.StudentResponse; @@ -12,13 +15,15 @@ private HibernateStudentResponseDao studentResponseDao; private HibernateStudentDao studentDao; - private HibernateDaybyDayDecisionDao dayBydayDecisionDao; + //private HibernateDaybyDayDecisionDao dayBydayDecisionDao; + private DayByDayDecisionService daybydayDecisionService; + private ModuleService moduleService; StudentResponse studentResponse; Student student; - public void saveQuestion(List<StudentResponse> studentResponses) + public Block saveQuestion(List<StudentResponse> studentResponses) { for(int i = 0; i < studentResponses.size(); i++ ) { @@ -31,16 +36,29 @@ studentResponse.setStudent(clientStudentResponse.getStudent()); save(studentResponse); } + + return moduleService.getNextBlock(); } - //public void daybyday + public void daybydayOutput(DaybyDayDecision studentDecision) + { + daybydayDecisionService.saveStudentDecision(studentDecision); + } public void setStudentDao(HibernateStudentDao studentDao) { this.studentDao = studentDao; } - public void setDayBydayDecisionDao(HibernateDaybyDayDecisionDao dayBydayDecisionDao) { + /*public void setDayBydayDecisionDao(HibernateDaybyDayDecisionDao dayBydayDecisionDao) { this.dayBydayDecisionDao = dayBydayDecisionDao; + }*/ + + public void setDaybydayDecisionService(DayByDayDecisionService daybydayDecisionService) { + this.daybydayDecisionService = daybydayDecisionService; } + public DayByDayDecisionService getDaybydayDecisionService() { + return daybydayDecisionService; + } + } Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionService.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionService.java 2009-07-24 21:29:16 UTC (rev 206) @@ -0,0 +1,46 @@ +package edu.asu.commons.mme.service; + +import java.util.ArrayList; +import java.util.List; + +import edu.asu.commons.mme.dao.HibernateDaybyDayDecisionDao; +import edu.asu.commons.mme.entity.DaybyDayDecision; +import edu.asu.commons.mme.entity.Question; +import edu.asu.commons.mme.entity.Student; + +public class DayByDayDecisionService extends Service.Base<DaybyDayDecision, HibernateDaybyDayDecisionDao> { + + private List<DaybyDayDecision> studentdecisions = new ArrayList<DaybyDayDecision>(); + + public void setStudentdecisions(List<DaybyDayDecision> studentdecisions) { + this.studentdecisions = studentdecisions; + } + + public List<DaybyDayDecision> getStudentdecisions() { + return studentdecisions; + } + + public void saveStudentDecision(DaybyDayDecision studentDecision) + { + if (studentdecisions == null) { + studentdecisions = new ArrayList<DaybyDayDecision>(); + studentdecisions.add(studentDecision); + + } + else + { + if(!this.studentdecisions.contains(studentDecision)) + { + studentdecisions.add(studentDecision); + + } + else + { + System.out.println("Student Decision already exists!!"); + } + } + + + } + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/EarningService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/EarningService.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/EarningService.java 2009-07-24 21:29:16 UTC (rev 206) @@ -0,0 +1,37 @@ +package edu.asu.commons.mme.service; + +import java.util.List; + +import edu.asu.commons.mme.entity.DaybyDayDecision; +import flex.messaging.MessageBroker; +import flex.messaging.messages.AsyncMessage; +import flex.messaging.util.UUIDUtils; + +public class EarningService extends Thread +{ + + public EarningService(List<DaybyDayDecision> studentDecisions) + { + + } + + public void run() + { + + MessageBroker msgBroker = MessageBroker.getMessageBroker(null); + String clientID = UUIDUtils.createUUID(); + + AsyncMessage msg = new AsyncMessage(); + msg.setDestination("DataPush"); + //msg.setHeader("DSSubtopic", "hello"); + msg.setClientId(clientID); + msg.setMessageId(UUIDUtils.createUUID()); + msg.setTimestamp(System.currentTimeMillis()); + msg.setBody("Sorry time is expired!!! You have to proceed further."); + System.out.println("Message broker is: "+ msgBroker); + System.out.println("Message is: "+ msg); + msgBroker.routeMessageToService(msg, null); + + } +} + Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-07-23 21:15:18 UTC (rev 205) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-07-24 21:29:16 UTC (rev 206) @@ -60,5 +60,20 @@ } return module; } + + public Block getNextBlock() { + /* + *1) Find out the current round number + *2) Find out the current module number + *3)Find out the current block number + *4)return the next block + */ + // TODO Auto-generated method stub + + + Block block = new Block(); + + return block; + } } Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-07-23 21:15:18 UTC (rev 205) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-07-24 21:29:16 UTC (rev 206) @@ -79,6 +79,11 @@ <!-- spring managed service layer --> + +<bean id='dayBydayDecisionService' class='edu.asu.commons.mme.service.DayByDayDecisionService'> + <property name='dao' ref='dayBydayDecisionDao'/> + </bean> + <bean id='roundService' class='edu.asu.commons.mme.service.RoundService'> <property name='dao' ref='roundConfigDao'/> <property name='moduleService' ref='moduleService'/> @@ -89,7 +94,7 @@ <bean id='answeringService' class='edu.asu.commons.mme.service.AnsweringService'> <property name='dao' ref='studentResponseDao'/> <property name='studentDao' ref='studentDao'/> - <property name='dayBydayDecisionDao' ref='dayBydayDecisionDao'/> + <property name='dayBydayDecisionService' ref='dayBydayDecisionService'/> </bean> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-08-12 22:36:05
|
Revision: 248 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=248&view=rev Author: kjonas Date: 2009-08-12 22:35:58 +0000 (Wed, 12 Aug 2009) Log Message: ----------- added some code to submit strategy design updated swf files new compiled files show no difference on kalin's machine for some reason. Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf Modified: mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-08-11 22:08:09 UTC (rev 247) +++ mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-08-12 22:35:58 UTC (rev 248) @@ -17,7 +17,6 @@ } public function progressBarInit():void { - progressTimer = new Timer(100, repetitions); // 21600 * 1000 = 6hrs progressTimer.addEventListener(TimerEvent.TIMER, timerTick); progressTimer.start(); Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-11 22:08:09 UTC (rev 247) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-12 22:35:58 UTC (rev 248) @@ -66,6 +66,7 @@ <mx:method name="getFirstModule" result="moduleResultHandler(event)"/> </mx:RemoteObject> <mx:RemoteObject id="answeringService" destination="answeringService" fault="faultHandler(event)"> + <mx:method name="saveStrategy" result="strategyResultHandler(event)"/> </mx:RemoteObject> <mx:RemoteObject id="locationService" destination="locationService" fault="faultHandler(event)"> <mx:method name="getAllLocations" result="locationResultHandler(event)"/> @@ -239,12 +240,14 @@ } else if(curr.getChildAt(j) is StrategyDesignQuestionC) { - studentResponse.question = (curr.getChildAt(j) as StrategyDesignQuestionC).question; + Alert.show("Strategy Saving"); studentResponse.response = null; + studentResponse.question = null; - //SKIP IT FOR NOW - studentResponse.question = null; + var strategy:StrategyDesignQuestionC = StrategyDesignQuestionC(curr.getChildAt(j)); + answeringService.saveStrategy(strategy.toDatabaseObject()); } + Alert.show(""+(curr.getChildAt(j) is StrategyDesignQuestionC)); if(studentResponse.question != null) { @@ -253,19 +256,19 @@ } } - var str:String = ""; - for(var q:int=0;q<responseList.length;q++) - { - str += "null:"; - str += (responseList.getItemAt(q) == null); - str += "\n"; - str += "response:"; - str += (responseList.getItemAt(q) as StudentResponse).response; - - str += "\n"; - str += "\n"; - } - Alert.show(str); +// var str:String = ""; +// for(var q:int=0;q<responseList.length;q++) +// { +// str += "null:"; +// str += (responseList.getItemAt(q) == null); +// str += "\n"; +// str += "response:"; +// str += (responseList.getItemAt(q) as StudentResponse).response; +// +// str += "\n"; +// str += "\n"; +// } +// Alert.show(str); answeringService.saveQuestion(responseList); } @@ -342,6 +345,10 @@ // Alert.show("locations received: "+locations.length); } } + private function strategyResultHandler(event:ResultEvent):void + { +// Alert.show("Strategy Saved"); + } private function studentResultHandler(event:ResultEvent):void { Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-08-13 23:02:55
|
Revision: 250 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=250&view=rev Author: kjonas Date: 2009-08-13 23:02:37 +0000 (Thu, 13 Aug 2009) Log Message: ----------- modified core to have popups for testing saveStrategy added block 2-5 to database. Modified Paths: -------------- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-13 20:53:14 UTC (rev 249) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-13 23:02:37 UTC (rev 250) @@ -72,8 +72,6 @@ <mx:method name="getAllLocations" result="locationResultHandler(event)"/> </mx:RemoteObject> - - <mx:Producer id="producer" destination="DataPush" acknowledge="ack(event)"/> <mx:Consumer id="consumer" destination="DataPush" message="messageHandler(event.message)" /> @@ -140,7 +138,6 @@ public function init():void { getLocations(); -// Alert.show("initialized"); } private function gotoInstructions():void @@ -247,7 +244,8 @@ var strategy:StrategyDesignQuestionC = StrategyDesignQuestionC(curr.getChildAt(j)); answeringService.saveStrategy(strategy.toDatabaseObject()); } - Alert.show(""+(curr.getChildAt(j) is StrategyDesignQuestionC)); +// if(curr.getChildAt(j) is StrategyDesignQuestionC) +// Alert.show("strategy found"); if(studentResponse.question != null) { Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-13 20:53:14 UTC (rev 249) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-13 23:02:37 UTC (rev 250) @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.1.35, for Win32 (ia32) +-- MySQL dump 10.13 Distrib 5.1.36, for Win32 (ia32) -- -- Host: localhost Database: mme -- ------------------------------------------------------ --- Server version 5.1.35-community +-- Server version 5.1.36-community /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -511,7 +511,7 @@ LOCK TABLES `psychometric_question` WRITE; /*!40000 ALTER TABLE `psychometric_question` DISABLE KEYS */; -INSERT INTO `psychometric_question` VALUES (10,'Unipolar',4),(10,'unipolar',7),(10,'unipolar',9),(10,'unipolar',12),(10,'unipolar',14),(10,'bipolar',15),(10,'unipolar',16),(10,'unipolar',17),(10,'unipolar',18),(10,'bipolar',19),(10,'unipolar',20),(10,'unipolar',21),(10,'unipolar',22),(10,'unipolar',23),(10,'unipolar',24),(10,'unipolar',25),(10,'unipolar',26),(10,'unipolar',27),(10,'unipolar',28),(10,'unipolar',29),(10,'unipolar',30),(10,'bipolar',31),(10,'unipolar',32),(10,'unipolar',33),(10,'bipolar',34),(10,'unipolar',40),(10,'unipolar',41),(10,'unipolar',42),(10,'unipolar',43),(10,'unipolar',44),(10,'bipolar',45),(10,'unipolar',46),(10,'unipolar',47),(10,'unipolar',48),(10,'unipolar',49),(10,'bipolar',50),(10,'unipolar',54),(10,'unipolar',55),(10,'bipolar',56),(10,'bipolar',57),(10,'bipolar',58),(10,'unipolar',59),(10,'unipolar',60),(10,'unipolar',61),(10,'unipolar',62),(10,'bipolar',63),(10,'bipolar',67),(10,'unipolar',68),(10,'unipolar',69),(10,'unipolar',70),(10,'unipolar',71),(10,'unipolar',78); +INSERT INTO `psychometric_question` VALUES (10,'Unipolar',4),(10,'unipolar',7),(10,'unipolar',9),(10,'unipolar',12),(10,'unipolar',14),(10,'bipolar',15),(10,'unipolar',16),(10,'unipolar',17),(10,'unipolar',18),(10,'bipolar',19),(10,'unipolar',20),(10,'unipolar',21),(10,'unipolar',22),(10,'unipolar',23),(10,'unipolar',24),(10,'unipolar',25),(10,'unipolar',26),(10,'unipolar',27),(10,'unipolar',28),(10,'unipolar',29),(10,'unipolar',30),(10,'bipolar',31),(10,'unipolar',32),(10,'unipolar',33),(10,'bipolar',34),(10,'unipolar',40),(10,'unipolar',41),(10,'unipolar',42),(10,'unipolar',43),(10,'unipolar',44),(10,'bipolar',45),(10,'unipolar',46),(10,'unipolar',47),(10,'unipolar',48),(10,'unipolar',49),(10,'bipolar',50),(10,'unipolar',54),(10,'unipolar',55),(10,'bipolar',56),(10,'bipolar',57),(10,'bipolar',58),(10,'unipolar',59),(10,'unipolar',60),(10,'unipolar',61),(10,'unipolar',62),(10,'bipolar',63),(10,'bipolar',67),(10,'unipolar',68),(10,'unipolar',69),(10,'unipolar',70),(10,'unipolar',71),(10,'unipolar',78),(10,'unipolar',79),(10,'unipolar',80),(10,'bipolar',81),(10,'bipolar',82),(10,'bipolar',83),(10,'bipolar',84),(10,'bipolar',85),(10,'unipolar',86),(10,'unipolar',87),(10,'unipolar',88),(10,'unipolar',89),(10,'unipolar',90),(10,'unipolar',91),(10,'unipolar',92),(10,'unipolar',93); /*!40000 ALTER TABLE `psychometric_question` ENABLE KEYS */; UNLOCK TABLES; @@ -536,7 +536,7 @@ LOCK TABLES `psychometric_question_choices` WRITE; /*!40000 ALTER TABLE `psychometric_question_choices` DISABLE KEYS */; -INSERT INTO `psychometric_question_choices` VALUES (4,'nearly as important'),(4,'not important at all'),(7,'very important'),(7,'not important at all'),(9,'nearly as important'),(9,'not important at all'),(12,'nearly as important'),(12,'not important at all'),(14,'nearly as important'),(14,'not important at all'),(15,'I like my group very much'),(15,'neutral'),(15,'I do not like my group at all'),(16,'very important'),(16,'not important at all'),(17,'very important'),(17,'not important at all'),(18,'very important'),(18,'not important at all'),(19,'completely as a team'),(19,'neutral'),(19,'completely as competing players'),(20,'very much'),(20,'not at all'),(21,'very important'),(21,'not important at all'),(22,'very much'),(22,'not at all'),(23,'very much'),(23,'not at all'),(24,'very much'),(24,'not at all'),(25,'very much'),(25,'not at all'),(26,'very much'),(27,'very much'),(27,'not at all'),(28,'very much'),(28,'not at all'),(29,'very much'),(29,'not at all'),(30,'perfectly'),(30,'not at all'),(31,'much better'),(31,'same as me'),(31,'much worse'),(32,'very confident'),(32,'not at all confident'),(33,'totally'),(33,'not at all'),(34,'completely ‘safe’'),(34,'balancing risk and outcomes'),(34,'completely ‘risky’'),(26,'not at all'),(40,'I am very surprised'),(40,'I am not surprised at all'),(41,'very much'),(41,'not at all'),(42,'very much'),(42,'not at all'),(43,'very much'),(43,'not at all'),(44,'very much'),(45,'much more positively'),(45,'same as before'),(45,'much more negatively'),(46,'very much'),(46,'not at all'),(47,'very much'),(47,'not at all'),(48,'very much'),(48,'not at all'),(49,'very much'),(49,'not at all'),(50,'much more positively'),(50,'same as before'),(50,'much more negatively'),(54,'…developed by all group members'),(54,'…made up by a single player'),(55,'…very fair'),(55,'…not fair at all'),(56,'…leading to much higher earnings for the group'),(56,' '),(56,'…leading to much lower earnings for the group'),(57,'…protecting the fish population'),(57,' '),(57,'…destroying the fish population'),(58,'…overall a very good solution'),(58,' '),(58,'…overall a very bad solution'),(59,'totally clear'),(59,'not clear at all'),(60,'…totally understood'),(60,'…did not understand at all'),(61,'I will totally follow the rule'),(61,'I will not at all follow the rule'),(62,'totally follow the rule'),(62,'not at all follow the rule'),(63,'the group will do much better'),(63,' '),(63,'the group will do much worse'),(67,'very interesting'),(67,'neutral'),(67,'very boring'),(68,'very much effort'),(68,'no effort at all'),(69,'very difficult'),(69,'not at all difficult'),(70,'very difficult'),(70,'not at all difficult'),(71,'very clear'),(71,'not clear at all'),(78,'I am very surprised'),(78,'I am not surprised at all'); +INSERT INTO `psychometric_question_choices` VALUES (4,'nearly as important'),(4,'not important at all'),(7,'very important'),(7,'not important at all'),(9,'nearly as important'),(9,'not important at all'),(12,'nearly as important'),(12,'not important at all'),(14,'nearly as important'),(14,'not important at all'),(15,'I like my group very much'),(15,'neutral'),(15,'I do not like my group at all'),(16,'very important'),(16,'not important at all'),(17,'very important'),(17,'not important at all'),(18,'very important'),(18,'not important at all'),(19,'completely as a team'),(19,'neutral'),(19,'completely as competing players'),(20,'very much'),(20,'not at all'),(21,'very important'),(21,'not important at all'),(22,'very much'),(22,'not at all'),(23,'very much'),(23,'not at all'),(24,'very much'),(24,'not at all'),(25,'very much'),(25,'not at all'),(26,'very much'),(27,'very much'),(27,'not at all'),(28,'very much'),(28,'not at all'),(29,'very much'),(29,'not at all'),(30,'perfectly'),(30,'not at all'),(31,'much better'),(31,'same as me'),(31,'much worse'),(32,'very confident'),(32,'not at all confident'),(33,'totally'),(33,'not at all'),(34,'completely ‘safe’'),(34,'balancing risk and outcomes'),(34,'completely ‘risky’'),(26,'not at all'),(40,'I am very surprised'),(40,'I am not surprised at all'),(41,'very much'),(41,'not at all'),(42,'very much'),(42,'not at all'),(43,'very much'),(43,'not at all'),(44,'very much'),(45,'much more positively'),(45,'same as before'),(45,'much more negatively'),(46,'very much'),(46,'not at all'),(47,'very much'),(47,'not at all'),(48,'very much'),(48,'not at all'),(49,'very much'),(49,'not at all'),(50,'much more positively'),(50,'same as before'),(50,'much more negatively'),(54,'…developed by all group members'),(54,'…made up by a single player'),(55,'…very fair'),(55,'…not fair at all'),(56,'…leading to much higher earnings for the group'),(56,' '),(56,'…leading to much lower earnings for the group'),(57,'…protecting the fish population'),(57,' '),(57,'…destroying the fish population'),(58,'…overall a very good solution'),(58,' '),(58,'…overall a very bad solution'),(59,'totally clear'),(59,'not clear at all'),(60,'…totally understood'),(60,'…did not understand at all'),(61,'I will totally follow the rule'),(61,'I will not at all follow the rule'),(62,'totally follow the rule'),(62,'not at all follow the rule'),(63,'the group will do much better'),(63,' '),(63,'the group will do much worse'),(67,'very interesting'),(67,'neutral'),(67,'very boring'),(68,'very much effort'),(68,'no effort at all'),(69,'very difficult'),(69,'not at all difficult'),(70,'very difficult'),(70,'not at all difficult'),(71,'very clear'),(71,'not clear at all'),(78,'I am very surprised'),(78,'I am not surprised at all'),(79,'I am very satisfied'),(79,'I am not satisfied at all'),(80,'very fair'),(80,'not at all fair'),(81,'I got too much fish'),(81,'I got the right amount of fish'),(81,'I got too few fish'),(82,'the others got too much fish'),(82,'the others got the right amount of fish'),(82,'the others got too few fish'),(83,'the earnings were too equal'),(83,'the earnings had the right variance'),(83,'the earnings were too varied'),(84,'the fishermen acted too similarly'),(84,'the actions had the right variance'),(84,'the fishermen acted too differently'),(85,'too much fish remained'),(85,'the right amount of fish remained'),(85,'too few fish remained'),(86,'applies completely'),(86,'applies not at all'),(87,'applies completely'),(87,'applies not at all'),(88,'applies completely'),(88,'applies not at all'),(89,'applies completely'),(89,'applies not at all'),(90,'applies completely'),(90,'applies not at all'),(91,'applies completely'),(91,'applies not at all'),(92,'applies completely'),(92,'applies not at all'),(93,'applies completely'),(93,'applies not at all'); /*!40000 ALTER TABLE `psychometric_question_choices` ENABLE KEYS */; UNLOCK TABLES; @@ -557,7 +557,7 @@ PRIMARY KEY (`id`), KEY `FKBA823BE6CA626674` (`question_group_id`), CONSTRAINT `FKBA823BE6CA626674` FOREIGN KEY (`question_group_id`) REFERENCES `question_group` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=79 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=98 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -566,7 +566,7 @@ LOCK TABLES `question` WRITE; /*!40000 ALTER TABLE `question` DISABLE KEYS */; -INSERT INTO `question` VALUES (1,0,'Most important goal:',1,'categorical',10),(2,0,'Second most important goal:',2,'categorical',10),(3,0,'Third most important goal:',4,'categorical',10),(4,0,'Compared to the most important goal, this goal is',3,'psychometric',10),(6,0,'',1,'daybydaydecisions',6),(7,0,'An example of a scale would be',1,'psychometric',11),(8,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',12),(9,0,'Compared to the most important goal, this goal is',5,'psychometric',10),(10,0,'<b>Most important goal:</b>',1,'categorical',13),(11,0,'<b>Second most important goal:</b>',2,'categorical',13),(12,0,'Compared to the most important goal, this goal is',3,'psychometric',13),(13,0,'<b>Third most important goal:</b>',4,'categorical',13),(14,0,'Compared to the most important goal, this goal is',5,'psychometric',13),(15,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',14),(16,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',14),(17,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',14),(18,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',14),(19,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',14),(20,0,'How much do you trust the others in your group?',1,'psychometric',15),(21,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',15),(22,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',15),(23,1,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',15),(24,1,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',15),(25,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',16),(26,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',16),(27,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',16),(28,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',16),(29,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',16),(30,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',17),(31,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',17),(32,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',17),(33,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',17),(34,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',17),(35,0,'',1,'forecastingfishermen',18),(36,0,'',1,'forecastingfish',19),(37,0,'',1,'strategydesign',9),(38,0,'',1,'strategydesign',22),(39,0,'',1,'daybydaydecisions',24),(40,0,'',1,'psychometric',27),(41,0,'… better understand the dynamics of the fish population.',1,'psychometric',29),(42,0,'… better understand the other fishermen in my group.',2,'psychometric',29),(43,0,'… better understand how to design the strategy.',3,'psychometric',29),(44,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',29),(45,0,'… appraise the other fishermen in my group differently. Now I think about the others…',5,'psychometric',29),(46,0,'… better understand the dynamics of the fish population.',1,'psychometric',30),(47,0,'… better understand the other fishermen.',2,'psychometric',30),(48,0,'… better understand how to design the strategy.',3,'psychometric',30),(49,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',30),(50,0,'… appraise the other fishermen in my group differently. Now I think about the others …',5,'psychometric',30),(51,0,'Did the communication have any form of reference to how to fish or design the strategy?',1,'categorical',31),(52,0,'Did the communication have any form of reference to how to fish or design the strategy?',1,'categorical',31),(53,0,'test',1,'categorical',31),(54,0,'',1,'psychometric',32),(55,0,'',2,'psychometric',32),(56,0,'',3,'psychometric',32),(57,0,'',4,'psychometric',32),(58,0,'',5,'psychometric',32),(59,0,'How clear is it to you, that you have to fish conforming to this rule, agreement or coordination attempt?',1,'psychometric',33),(60,0,'Do you think the other fishermen understood how they have to act according to this rule?<br>I think the others… ',2,'psychometric',33),(61,0,'Will you follow the rule, agreement, or coordination attempt that emerged from communication?<br>I will follow the rule…',3,'psychometric',33),(62,0,'Do you think, the other fishermen in you group will follow the rule, agreement, or coordination attempt?<br>\rI think, the others will… ',4,'psychometric',33),(63,0,'Considering the effects you expect for following the rule and your expectations of how the group will follow the rule, do you think the group will do better or worse due to the rule?',5,'psychometric',33),(64,0,'New understanding of fish dynamics',1,'text',34),(65,0,'New Expectations on how the others of the group will act',2,'text',34),(66,0,'Ideas for improving your strategy',3,'text',34),(67,0,'How interesting was the experiment for you?',1,'psychometric',35),(68,0,'How would you rate the effort you invested to design your strategy?',2,'psychometric',35),(69,0,'How difficult was it to understand the problem?',3,'psychometric',35),(70,0,'How difficult was it to find a good strategy?',4,'psychometric',35),(71,0,'How clear was it what you had to do?',5,'psychometric',35),(72,0,'How many times have you participated in problem solving experiments similar to this one?',1,'text',36),(73,0,'If you already participated in such experiments, when was the last time?',2,'categorical',36),(74,0,'Comments and Feedback',1,'text',37),(75,0,'',1,'strategydesign',40),(76,0,'',1,'strategydesign',53),(77,0,'',1,'daybydaydecisions',55),(78,0,'',1,'psychometric',58); +INSERT INTO `question` VALUES (1,0,'Most important goal:',1,'categorical',10),(2,0,'Second most important goal:',2,'categorical',10),(3,0,'Third most important goal:',4,'categorical',10),(4,0,'Compared to the most important goal, this goal is',3,'psychometric',10),(6,0,'',1,'daybydaydecisions',6),(7,0,'An example of a scale would be',1,'psychometric',11),(8,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',12),(9,0,'Compared to the most important goal, this goal is',5,'psychometric',10),(10,0,'<b>Most important goal:</b>',1,'categorical',13),(11,0,'<b>Second most important goal:</b>',2,'categorical',13),(12,0,'Compared to the most important goal, this goal is',3,'psychometric',13),(13,0,'<b>Third most important goal:</b>',4,'categorical',13),(14,0,'Compared to the most important goal, this goal is',5,'psychometric',13),(15,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',14),(16,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',14),(17,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',14),(18,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',14),(19,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',14),(20,0,'How much do you trust the others in your group?',1,'psychometric',15),(21,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',15),(22,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',15),(23,1,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',15),(24,1,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',15),(25,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',16),(26,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',16),(27,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',16),(28,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',16),(29,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',16),(30,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',17),(31,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',17),(32,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',17),(33,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',17),(34,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',17),(35,0,'',1,'forecastingfishermen',18),(36,0,'',1,'forecastingfish',19),(37,0,'',1,'strategydesign',9),(38,0,'',1,'strategydesign',22),(39,0,'',1,'daybydaydecisions',24),(40,0,'',1,'psychometric',27),(41,0,'… better understand the dynamics of the fish population.',1,'psychometric',29),(42,0,'… better understand the other fishermen in my group.',2,'psychometric',29),(43,0,'… better understand how to design the strategy.',3,'psychometric',29),(44,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',29),(45,0,'… appraise the other fishermen in my group differently. Now I think about the others…',5,'psychometric',29),(46,0,'… better understand the dynamics of the fish population.',1,'psychometric',30),(47,0,'… better understand the other fishermen.',2,'psychometric',30),(48,0,'… better understand how to design the strategy.',3,'psychometric',30),(49,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',30),(50,0,'… appraise the other fishermen in my group differently. Now I think about the others …',5,'psychometric',30),(51,0,'Did the communication have any form of reference to how to fish or design the strategy?',1,'categorical',31),(52,0,'Did the communication have any form of reference to how to fish or design the strategy?',1,'categorical',31),(53,0,'test',1,'categorical',31),(54,0,'',1,'psychometric',32),(55,0,'',2,'psychometric',32),(56,0,'',3,'psychometric',32),(57,0,'',4,'psychometric',32),(58,0,'',5,'psychometric',32),(59,0,'How clear is it to you, that you have to fish conforming to this rule, agreement or coordination attempt?',1,'psychometric',33),(60,0,'Do you think the other fishermen understood how they have to act according to this rule?<br>I think the others… ',2,'psychometric',33),(61,0,'Will you follow the rule, agreement, or coordination attempt that emerged from communication?<br>I will follow the rule…',3,'psychometric',33),(62,0,'Do you think, the other fishermen in you group will follow the rule, agreement, or coordination attempt?<br>\rI think, the others will… ',4,'psychometric',33),(63,0,'Considering the effects you expect for following the rule and your expectations of how the group will follow the rule, do you think the group will do better or worse due to the rule?',5,'psychometric',33),(64,0,'New understanding of fish dynamics',1,'text',34),(65,0,'New Expectations on how the others of the group will act',2,'text',34),(66,0,'Ideas for improving your strategy',3,'text',34),(67,0,'How interesting was the experiment for you?',1,'psychometric',35),(68,0,'How would you rate the effort you invested to design your strategy?',2,'psychometric',35),(69,0,'How difficult was it to understand the problem?',3,'psychometric',35),(70,0,'How difficult was it to find a good strategy?',4,'psychometric',35),(71,0,'How clear was it what you had to do?',5,'psychometric',35),(72,0,'How many times have you participated in problem solving experiments similar to this one?',1,'text',36),(73,0,'If you already participated in such experiments, when was the last time?',2,'categorical',36),(74,0,'Comments and Feedback',1,'text',37),(75,0,'',1,'strategydesign',40),(76,0,'',1,'strategydesign',53),(77,0,'',1,'daybydaydecisions',55),(78,0,'',1,'psychometric',58),(79,0,'',2,'psychometric',27),(80,0,'I feel the outcomes are:',3,'psychometric',27),(81,0,'',1,'psychometric',59),(82,0,'',2,'psychometric',59),(83,0,'',3,'psychometric',59),(84,0,'',4,'psychometric',59),(85,0,'',5,'psychometric',59),(86,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',60),(87,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough.',2,'psychometric',60),(88,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',60),(89,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',60),(90,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',60),(91,0,'The group was too uncoordinated',6,'psychometric',60),(92,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',60),(93,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',60),(94,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',61),(95,0,'New understanding of fish dynamics',1,'text',62),(96,0,'New expectations on how the others of the group will act',2,'text',62),(97,0,'Ideas for improving your strategy',3,'text',62); /*!40000 ALTER TABLE `question` ENABLE KEYS */; UNLOCK TABLES; @@ -587,7 +587,7 @@ PRIMARY KEY (`id`), KEY `FK8F8090E61F51CEC1` (`block_id`), CONSTRAINT `FK8F8090E61F51CEC1` FOREIGN KEY (`block_id`) REFERENCES `block` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -596,7 +596,7 @@ LOCK TABLES `question_group` WRITE; /*!40000 ALTER TABLE `question_group` DISABLE KEYS */; -INSERT INTO `question_group` VALUES (1,'In this experiment you will design a strategy to fish in an abstract fishing ground together with three other persons. As we are mainly interested in the reasons <i>why</i> you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no correct or wrong strategies and no correct or wrong answers. However, since for each pound of fish you get during the experiment you will receive $1.00 US, you might be interested in finding a strategy that fits your goals well. For this, you will need to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group.',30,'<b>Welcome to the E-Fishery Experiment</b>',1,1),(2,'<p>The experiment will run as follows:</p> <ul> <li><b>Introduction</b>: We will explain the interface and how the dynamics of the fish population are modeled. We will also ask you some questions about you and you will have the opportunity to make your decisions on how to fish on a (simulated) day-by-day basis to get a feeling for the dynamics of the fish population. </li> <li><b>Strategy design 1</b>: You will design a fishing strategy that will be simulated together with the strategies of the other persons in your group, and we ask you a larger amount of questions to understand your decisions and to help you reflect on those decisions. </li> <li><b>Fishing and evaluation 1</b>: Besides simulating the strategies you will decide on how to fish on a (simulated) day-by-day basis. Then, we will ask you some questions on your evaluation of the results. </li> <li><b>Communication</b>:You will have the opportunity to chat with the other persons in your group. After the chat we will ask some questions to asses your evaluation of the communication. </li> <li><b>Strategy design, fishing and evaluation 2</b>: The strategy design, fishing and evaluation are repeated as described above. </li> <li><b>Finishing the experiment</b>: The experiment closes with some final questions and more information on the experiment, and you will have the opportunity to give a feedback if you wish to do so. </li> </ul> <p> In the <b>information bar above the main window</b> you can see which part of the experiment you are in, your progress and how you are doing with the time. </p>',30,'<b>Experimental procedure</b>',2,1),(3,'<p>The <b>information window "Fishing Ground"</b> gives you an overview that will be explained here.</p> <p> Imagine you are living on an island and your only income is from a species of fish that only survives in the shallow bays formed by the island. The fish can leave crowed bays and move to less crowded bays, but they cannot survive in the ocean. Nor can new fish arrive from the ocean. </p> <p> The fish population grows at a constant rate. Thus, the more fish are in a bay the faster the population grows. However, the population a bay can sustain is limited and fish leave crowed bays to find less crowded bays. The more crowded a bay, the more fish leave and the less fish enter the bay (the movement is directly proportional to the percentage to which a bay is filled up). The number of fish leaving the bay is proportional to the rate of growth, and the number of fish entering the bay is also proportional to the amount of fish leaving the three bays (i.e. fish in the ocean). </p> <p> The equations of these dynamics are given in the information windows. It is, however, not necessary to know them for designing a strategy. For this, you only have to <b>understand the following five principles</b>: </p> <ul> <li>If all bays are <b>filled up</b> with fish, then the total growth is highest, but all additional lbs of fish are lost to the ocean and the amount of fish in the bays stops growing.</li> <li>If the bays are <b>half filled</b>, then the amount of fish in the bays grows fastest.</li> <li>If the bays are <b>nearly empty</b>, the population grows very slowly.</li> <li>If there is <b>no fish</b> in any of the bays, there will be never any fish again.</li> <li>If there are both <b>crowded and empty</b> bays, a lot of fish move from the crowded to the empty bays.</li> </ul> ',120,'<b>How the dynamics of the fish population are modeled</b>',3,1),(4,'<p>The three bays are different in size and characteristics leading to different growth rates and capacities (i.e. the maximal amount of fish the bay can sustain). At the start of the simulation each bay is half filled.</p> <table> <thead> <th></th><th>Bay 1</th><th>Bay 2</th><th>Bay 3</th> </thead> <tbody> <tr> <td>Capacity:</td><td>10 lb</td><td>20 lb</td><td>30 lb</td> </tr> <tr> <td>Starts with:</td><td>5 lb</td><td>10 lb</td><td>15 lb</td> </tr> <tr> <td>Growth rate:</td><td>50% per day</td><td>15% per day</td><td>5% per day</td> </tr> </tbody> </table> <p> <b>How much fish</b> you take out in a day is <b>directly proportional with the extent that the bay is filled up with fish</b>. Your fishing gear allows you to harvest a maximum of 5 lbs. Thus, if the bay is completely filled up you get 5 lb of fish. If the bay is half filled, you get 2.5 lb of fish. If the bay is filled up only to 20 % you will get 1 lb, etc. The fish population is diminished by the same amount. If several persons fish the same bay and together would get more fish than the bay holds, then all the fish in the bay are distributed equally among these fishermen. </p> <p>However, you can <b>stay in the harbor</b> instead of fishing. This way, you do not get anything and the fish population is not diminished. </p> <p> Your task is to design a strategy of how to fish this fishing ground for 30 days together with three other persons (thus, with you the group compromises 4 persons). You will define the number of days that you stay in each bay or in the harbor. Please note that this is not an exam! We do not expect you to find the mathematically optimal solution to this problem. We want to know how you come up with a solution that sufficiently fulfills your goals. As long as we can understand why you choose a certain strategy you can come up with whatever you like. </p> ',120,'<b>Differences of bays and effects of fishing</b>',4,1),(5,'<p>Before designing the strategy, you have the opportunity to make your decisions on a day-by-day basis for the simulation. You will interact with the actual model of the fishing ground together with the other persons of your group. Thus, the problems and possibilities you will experience in this warm-up are relevant for the design of your strategy. </p> <p> The <b>interface</b> you will encounter on the next page has the following elements: <ul> <li>Information on the day of the simulation</li> <li>Buttons for your decision. If you want to fish in Bay 1, for example, click on Button "Bay 1". </li> <li>Time remaining. You have 10 seconds for each decision. If you do not press any button within these 10 seconds then you will stay in the harbor for this day. However, you can change your decision within these 10 seconds (i.e. if you clicked on "Bay 1" after 4 seconds and after another 4 seconds on "Bay 3", you will go to Bay 3). </li> <li>Table of past results. Your previous locations from past days are highlighted. The table shows you how much you fished and who else was in the same location as you. You do not have any information of locations where you not have been. </li> ',60,'<b>A warm-up</b>',5,1),(6,'',345,'<b>Day-by-day-decisions</b>',6,1),(7,'<p>In what we refer to as a \'strategy\' you predefine your decisions of where to go each day of the simulation.\r Al-though only 30 days will be simulated, your strategy should represent your decisions for an indefinite period. Therefore you define a <b>set of decisions that will be repeated</b> until the end of the simulation. The set can contain as many decisions as you want but try to use as few as possible. Remember: Often simple strategies are more effective!</p> <p>It might be that you want to base your set of repeated decisions on another state of the fish population. In this case you can define a set of not repeated decisions that are applied at the beginning of the simulation. For example, you might first stay in the harbor to let the fish population increase or first fish all the bays to reduce the fish population before you start the repeated sequence of decisions.</p> <p>In this strategy you define how many days you stay at a certain location and to which other location you will move on.\r If, for example, you define to repeat the sequence \"2 days in harbor - 3 days in Bay 1 - 2 days in Bay 2\" you will not fish for two days, then fish in Bay 1 for three days, then fish in Bay 2 for two days, then not fish for two days, then fish in Bay 1 for three days, etc.</p> ',480,'<b>Designing your Strategy</b>',1,2),(8,'<p>Your strategy is mainly based on the number of days you stay at a certain location. However, things might run differently than you expected and you might wish to leave a bay earlier than the days you specified because you get too few fish out of that bay. For doing so you can specify a threshold of income. If you fish less then this threshold, the next day you will not fish this bay anymore but move on to the next location specified in your strategy.</p> <p>Note: Thresholds refer to the quantity of fish you get during one day fishing in a bay and not, for example, to the quantity of fish in the bay, fish fished by others, sum of fish already fished, etc.</p> <p>The final option you have is to stop repeating your strategy and stay in the harbor for some days. This op-tion can be used to prevent the total destruction of the fish population. For this you define a threshold and a number of days. If during one repetition of your decision set you never fished the amount defined by the threshold, then you stay in the harbor for the specified number of days before you start the next repetition.</p> <p>Note: Intentionally we do not allow designing \'intelligent\' strategies that search for solutions during the game. You have to think about what would be the best solution for you and express it with the options explained above.</p> ',90,'<b>Some special features of the strategy design</b>',2,2),(9,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',480,'<b>Design your strategy</b>',3,2),(10,'<p>Please specify three goals that most influenced the design of your strategy. You can select from 18 different goals grouped in three categories (foci). </p><p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal.</p><p> The information you write into these fields will be available the next time you edit your strategy.</p>',30,'<b>What goals did you follow when designing your strategy?</b>',3,3),(11,'<p>We will ask you a number of questions on the strategy you just designed. This will help us to better understand how you came up with your strategy and it might help you reflect on certain aspects to improve your strategy.</p>\r<p>Besides <b>large fields</b> to write text and <b>small fields</b> to write numbers, you will encounter drop-down lists for selecting predefined values and scales. </p>\r<p>To give an answer on a scale, click on the location between the labels that comes closest to your opinion. By clicking on the scale, a slider appears that marks the value you selected. You can change the value by clicking on another position on the scale. By clicking on the reset button, the sliders of all scales on a page are removed and you can start selecting values again.</p>\r<p>Please try to answer all questions even if you are not sure. We are not testing your abilities but rather want to understand how you came up with your strategy.</p>\r',30,'<b>Introduction to questionnaire</b>',1,3),(12,'<p>Please explain your strategy with a few sentences. Particularly consider the following aspects:</p>',300,'<b>Explain the strategy in your own words</b>',2,3),(13,'<p>Specify the three goals that you think most influenced the design of the strategy of the other fishermen in your group. You can select from 18 different goals grouped in three categories (foci).</p>\r<p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal</p>\r',30,'<b>What goals do you think the others follow?</b>',4,3),(14,'',30,'<b>How do you perceive your group?</b>',5,3),(15,'',30,'<b>How much do you count on others and how much can they count on you?</b>',6,3),(16,'',30,'<b>What else influenced your strategy design?</b>',7,3),(17,'',60,'<b>How confident are you in reaching the outcomes you are expecting?</b>',8,3),(18,'<p>Fill in the following table your expectations of the others’ actions (i.e. the number of fishermen in each bay) for the first 15 days. Please note that we ask only for the expectations of where the others will go. </p>',180,'<b>What are you expecting the others will do?</b>',9,3),(19,'<p>Please enter in the table below your expectations of how the fish population develops within the first six days. Note that by clicking on “Update” the earnings and fish remaining in the bays is calculated, using your expecta-tions of the other’s actions and your strategy. Thus, you only have to think about how the fish population changes from one day to the next due to growth and movement of the fish. These estimations can be really rough. We do not expect you do perform detailed calculations.</p>\r<b>Note: You can only change the entries of one day at a time. To calculate the values and activate the next day for entries click on “Update”. You cannot return to previous days!</b>\r',180,'<b>What are you expecting how the fish population will develop?</b>',10,3),(20,'By clicking on “Accept” you will leave this part of the questionnaire and return to the strategy design. <b>You can-not return to this or previous pages!</b> However, important information for the design of your strategy will be available in information windows.',30,'<b>Leaving questionnaire on your strategy</b>',11,3),(21,'<p>The previous questions may have lead to some reflections on your strategy and you may wish to change some elements of it. Among the information windows you will find your previous strategy, your goals and your fore-cast.</p>\r<p>The time for editing your strategy depends on how fast you finished the questionnaire. For the next simulation we have to synchronize the group again. If you have been rather fast, you can think now more deeply about your strategy. If you are rather behind the time suggestion, you have to make your changes quickly.</p>\r<p>The interface for designing your strategy will not be explained again. If you are not sure about some elements, please refer to the information window “Help on strategy design”.</p>\r',30,'<b>Edit your strategy</b>',1,4),(22,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',240,'<b>Design your strategy</b>',2,4),(23,'<p>Before we present the results of your strategy, we would like to see again how you make your decisions day-by-day. On the next page you will find the same interface as you already used to decide on how to fish the modeled fishing grounds.</p>',15,'<b>Applying your strategy in day-by-day decisions</b>',1,5),(24,'',345,'<b>Day-by-day-decisions</b>',2,5),(25,'<p>We will now present you the results of your strategy. By clicking on “Accept” you cannot return to this or any previous page, but the results of your day-by-day decisions (and also of your strategy) will be available in an information window.</p>',15,'<b>Leaving day-bay-day decisions</b>',3,5),(26,'',60,'<b>Your strategy resulted in the following actions</b>',1,6),(27,'<p>First we want to know your emotional reactions to the results:</p>',30,'<b>What are your emotional reactions to the outcome?</b>',2,6),(28,'You can now chat for 5 minutes with the other fishermen in your group. You can talk about whatever you want as long as you…\r<ul><li>…do not reveal your identity.</li>\r<li>…do not threaten others with any consequence after the experiment is finished.</li>\r<li>…do not promise others side-payments after the experiment is completed.</li></ul>\rThe interface works like a text messenger. In the text box at the bottom you write your text and by clicking on “Send” you send this text to all other group members. In the large box in the center of the window you see all messages that have been sent during the communication.<br>\rAfter five minutes the “Send” button will be deactivated and the “Next” button activated. Please click then on “Next” to answer some questions about the communication. You can return to this page to see the communication protocol again.\r',360,'<b>Chat with the other fishermen in your group</b>',1,7),(29,'Due to the conversation, I now…',30,'<b>Did the communication have any effect on you?</b>',1,15),(30,'Due to the conversation, the other fishermen in my group…',30,'<b>What do you think were the effects of the communication on the others?</b>',2,15),(31,'',60,'<b>Did the communication lead to some sort of coordination of the fishing?</b>',3,15),(32,'The rule, agreement, or coordination attempt is… ',30,'<b>What is your opinion about the rule(s) that emerged from communication?</b>',4,15),(33,'',30,'<b>What will be the effects of the rule?</b>',5,15),(34,'In the fields below note what you have learned from the communication to improve your strategy.<br>\rThink about your understanding of the dynamics of the fish population, your expectations about the behavior of the other fishermen in your group and possibilities to improve your strategy. For each of these aspects a separate field is offered. This information will be available in the next round of designing your strategy.<br>\rIf you have no entry for one of the fields below, write “none” in the respective field.<br>\rThe information you write into these fields will be available the next time you edit your strategy.',300,'<b>Lessons learned<b>',6,15),(35,'Congratulations! You finished the actual experiment. We want to ask you some final questions.',30,'<b>Some final questions about the experiment</b>',1,13),(36,'',90,'<b>Some final questions about you</b>',2,13),(37,'Thank you for participating in this experiment. Your contribution will help to better understand the effects of communication on the performance of groups. We tested whether the communication led to…\r<ul>\r<li>…a different understanding of the dynamics of the fish population.</li>\r<li>…different expectations of how the others in your group will act.</li>\r<li>…changes in the goals you follow or you expect the others to follow.</li>\r<li>…a form of ‘group feeling’ or ‘team spirit’.</li>\r<li>…the emergence of rules, agreements or other forms of coordination attempts.</li>\r<li>…the emergence of some kind of social pressure or commitment.</li>\r</ul>\rBesides advancing science, the experiment also allowed you to earn the following money:<br>\rFor participating in the game: US$<br>\rFrom fish you caught: US$<br>\rTotal: US$<br>\rThe money will be paid to you in private. Wait till your computer number is called and then proceed to the conference room where you have signed up.<br>\rWe hope the experiment was satisfying to you.<br>\rWhen you are ready you can click on “Accept” to leave the experiment.<br>\r',120,'<b>The end</b>',1,14),(38,'<p>In what we refer to as a \'strategy\' you predefine your decisions of where to go each day of the simulation.\r Al-though only 30 days will be simulated, your strategy should represent your decisions for an indefinite period. Therefore you define a <b>set of decisions that will be repeated</b> until the end of the simulation. The set can contain as many decisions as you want but try to use as few as possible. Remember: Often simple strategies are more effective!</p> <p>It might be that you want to base your set of repeated decisions on another state of the fish population. In this case you can define a set of not repeated decisions that are applied at the beginning of the simulation. For example, you might first stay in the harbor to let the fish population increase or first fish all the bays to reduce the fish population before you start the repeated sequence of decisions.</p> <p>In this strategy you define how many days you stay at a certain location and to which other location you will move on.\r If, for example, you define to repeat the sequence \"2 days in harbor - 3 days in Bay 1 - 2 days in Bay 2\" you will not fish for two days, then fish in Bay 1 for three days, then fish in Bay 2 for two days, then not fish for two days, then fish in Bay 1 for three days, etc.</p> ',480,'<b>Designing your Strategy</b>',1,8),(39,'<p>Your strategy is mainly based on the number of days you stay at a certain location. However, things might run differently than you expected and you might wish to leave a bay earlier than the days you specified because you get too few fish out of that bay. For doing so you can specify a threshold of income. If you fish less then this threshold, the next day you will not fish this bay anymore but move on to the next location specified in your strategy.</p> <p>Note: Thresholds refer to the quantity of fish you get during one day fishing in a bay and not, for example, to the quantity of fish in the bay, fish fished by others, sum of fish already fished, etc.</p> <p>The final option you have is to stop repeating your strategy and stay in the harbor for some days. This op-tion can be used to prevent the total destruction of the fish population. For this you define a threshold and a number of days. If during one repetition of your decision set you never fished the amount defined by the threshold, then you stay in the harbor for the specified number of days before you start the next repetition.</p> <p>Note: Intentionally we do not allow designing \'intelligent\' strategies that search for solutions during the game. You have to think about what would be the best solution for you and express it with the options explained above.</p> ',90,'<b>Some special features of the strategy design</b>',2,8),(40,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',480,'<b>Design your strategy</b>',3,8),(41,'<p>We will ask you a number of questions on the strategy you just designed. This will help us to better understand how you came up with your strategy and it might help you reflect on certain aspects to improve your strategy.</p>\r<p>Besides <b>large fields</b> to write text and <b>small fields</b> to write numbers, you will encounter drop-down lists for selecting predefined values and scales. </p>\r<p>To give an answer on a scale, click on the location between the labels that comes closest to your opinion. By clicking on the scale, a slider appears that marks the value you selected. You can change the value by clicking on another position on the scale. By clicking on the reset button, the sliders of all scales on a page are removed and you can start selecting values again.</p>\r<p>Please try to answer all questions even if you are not sure. We are not testing your abilities but rather want to understand how you came up with your strategy.</p>\r',90,'<b>Introduction to questionnaire</b>',1,9),(42,'<p>Please explain your strategy with a few sentences. Particularly consider the following aspects:</p>',300,'<b>Explain the strategy in your own words</b>',2,9),(43,'<p>Please specify three goals that most influenced the design of your strategy. You can select from 18 different goals grouped in three categories (foci). </p><p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal.</p><p> The information you write into these fields will be available the next time you edit your strategy.</p>',30,'<b>What goals did you follow when designing your strategy?</b>',3,9),(44,'<p>Specify the three goals that you think most influenced the design of the strategy of the other fishermen in your group. You can select from 18 different goals grouped in three categories (foci).</p>\r<p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal</p>\r',30,'<b>What goals do you think the others follow?</b>',4,9),(45,'',30,'<b>How do you perceive your group?</b>',5,9),(46,'',30,'<b>How much do you count on others and how much can they count on you?</b>',6,9),(47,'',30,'<b>What else influenced your strategy design?</b>',7,9),(48,'',60,'<b>How confident are you in reaching the outcomes you are expecting?</b>',8,9),(49,'<p>Fill in the following table your expectations of the others’ actions (i.e. the number of fishermen in each bay) for the first 15 days. Please note that we ask only for the expectations of where the others will go. </p>',180,'<b>What are you expecting the others will do?</b>',9,9),(50,'<p>Please enter in the table below your expectations of how the fish population develops within the first six days. Note that by clicking on “Update” the earnings and fish remaining in the bays is calculated, using your expecta-tions of the other’s actions and your strategy. Thus, you only have to think about how the fish population changes from one day to the next due to growth and movement of the fish. These estimations can be really rough. We do not expect you do perform detailed calculations.</p>\r<b>Note: You can only change the entries of one day at a time. To calculate the values and activate the next day for entries click on “Update”. You cannot return to previous days!</b>\r',180,'<b>What are you expecting how the fish population will develop?</b>',10,9),(51,'By clicking on “Accept” you will leave this part of the questionnaire and return to the strategy design. <b>You can-not return to this or previous pages!</b> However, important information for the design of your strategy will be available in information windows.',30,'<b>Leaving questionnaire on your strategy</b>',11,9),(52,'<p>The previous questions may have lead to some reflections on your strategy and you may wish to change some elements of it. Among the information windows you will find your previous strategy, your goals and your fore-cast.</p>\r<p>The time for editing your strategy depends on how fast you finished the questionnaire. For the next simulation we have to synchronize the group again. If you have been rather fast, you can think now more deeply about your strategy. If you are rather behind the time suggestion, you have to make your changes quickly.</p>\r<p>The interface for designing your strategy will not be explained again. If you are not sure about some elements, please refer to the information window “Help on strategy design”.</p>\r',30,'<b>Edit your strategy</b>',1,10),(53,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',240,'<b>Design your strategy</b>',2,10),(54,'<p>Before we present the results of your strategy, we would like to see again how you make your decisions day-by-day. On the next page you will find the same interface as you already used to decide on how to fish the modeled fishing grounds.</p>',15,'<b>Applying your strategy in day-by-day decisions</b>',1,11),(55,'',345,'<b>Day-by-day-decisions</b>',2,11),(56,'<p>We will now present you the results of your strategy. By clicking on “Accept” you cannot return to this or any previous page, but the results of your day-by-day decisions (and also of your strategy) will be available in an information window.</p>',15,'<b>Leaving day-bay-day decisions</b>',3,11),(57,'',60,'<b>Your strategy resulted in the following actions</b>',1,12),(58,'<p>First we want to know your emotional reactions to the results:</p>',30,'<b>What are your emotional reactions to the outcome?</b>',2,12); +INSERT INTO `question_group` VALUES (1,'In this experiment you will design a strategy to fish in an abstract fishing ground together with three other persons. As we are mainly interested in the reasons <i>why</i> you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no correct or wrong strategies and no correct or wrong answers. However, since for each pound of fish you get during the experiment you will receive $1.00 US, you might be interested in finding a strategy that fits your goals well. For this, you will need to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group.',30,'<b>Welcome to the E-Fishery Experiment</b>',1,1),(2,'<p>The experiment will run as follows:</p> <ul> <li><b>Introduction</b>: We will explain the interface and how the dynamics of the fish population are modeled. We will also ask you some questions about you and you will have the opportunity to make your decisions on how to fish on a (simulated) day-by-day basis to get a feeling for the dynamics of the fish population. </li> <li><b>Strategy design 1</b>: You will design a fishing strategy that will be simulated together with the strategies of the other persons in your group, and we ask you a larger amount of questions to understand your decisions and to help you reflect on those decisions. </li> <li><b>Fishing and evaluation 1</b>: Besides simulating the strategies you will decide on how to fish on a (simulated) day-by-day basis. Then, we will ask you some questions on your evaluation of the results. </li> <li><b>Communication</b>:You will have the opportunity to chat with the other persons in your group. After the chat we will ask some questions to asses your evaluation of the communication. </li> <li><b>Strategy design, fishing and evaluation 2</b>: The strategy design, fishing and evaluation are repeated as described above. </li> <li><b>Finishing the experiment</b>: The experiment closes with some final questions and more information on the experiment, and you will have the opportunity to give a feedback if you wish to do so. </li> </ul> <p> In the <b>information bar above the main window</b> you can see which part of the experiment you are in, your progress and how you are doing with the time. </p>',30,'<b>Experimental procedure</b>',2,1),(3,'<p>The <b>information window "Fishing Ground"</b> gives you an overview that will be explained here.</p> <p> Imagine you are living on an island and your only income is from a species of fish that only survives in the shallow bays formed by the island. The fish can leave crowed bays and move to less crowded bays, but they cannot survive in the ocean.... [truncated message content] |
From: <kj...@us...> - 2009-08-18 22:43:53
|
Revision: 261 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=261&view=rev Author: kjonas Date: 2009-08-18 22:43:42 +0000 (Tue, 18 Aug 2009) Log Message: ----------- Modified Paths: -------------- mentalmodels/trunk/flex/src/StartGame.mxml mentalmodels/trunk/flex/src/actionscript/Game.as mentalmodels/trunk/flex/src/actionscript/PageDisplay.as mentalmodels/trunk/flex/src/actionscript/StudentStrategy.as mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf Modified: mentalmodels/trunk/flex/src/StartGame.mxml =================================================================== --- mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-18 22:35:46 UTC (rev 260) +++ mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-18 22:43:42 UTC (rev 261) @@ -1,24 +1,54 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> - -<mx:Script> - <![CDATA[ - import actionscript.Block; +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> - import mx.rpc.events.ResultEvent; - import mx.rpc.events.FaultEvent; - import mx.controls.Alert; - - - public function faultHandler(event:FaultEvent):void - { - Alert.show(event.fault.getStackTrace()); - } + <mx:VBox visible="{pageNum==0}" horizontalAlign="center"> + <mx:HBox horizontalAlign="right" width="330" id="firstBox"> + <mx:Label text="$USD per lb of fish:"/> + <mx:TextInput id="txtMoney"/> + </mx:HBox> + <mx:HBox horizontalAlign="right" width="{firstBox.width}"> + <mx:Label text="Brief description of game:"/> + <mx:TextArea id="txtDescription"/> + </mx:HBox> + <mx:Button label="Create Game" id="btnCreateGame" click="false"/> + <mx:HBox horizontalAlign="right" width="{firstBox.width}"> + <mx:Label text="Game ID:"/> + <mx:TextInput id="txtGameID" enabled="false"/> + </mx:HBox> - ]]> -</mx:Script> + <mx:Spacer height="30"/> + + <mx:Text text="Click the Start Game button only after all students have connected using the above ID." width="300"/> + <mx:Button label="Start Game" id="btnStartGame" click="feed.start()"/> + </mx:VBox> - <mx:Button label="Start Game" id="btnStartGame" horizontalCenter="-6" verticalCenter="-46" click="feed.start()"/> - <mx:RemoteObject id="feed" destination="feed" fault="{faultHandler(event)}" /> + <mx:VBox visible="{pageNum==1}"> + <mx:Button label="Get Responses" id="btnGetResponses" click="getResponses()"/> + <mx:VBox id="responsesContent"/> + </mx:VBox> + + <mx:RemoteObject id="feed" destination="feed" fault="{faultHandler(event)}" /> + + <mx:Script> + <![CDATA[ + import actionscript.Block; + import mx.rpc.events.ResultEvent; + import mx.rpc.events.FaultEvent; + import mx.controls.Alert; + + [Bindable]private var pageNum:int = 0; + + public function faultHandler(event:FaultEvent):void + { + Alert.show(event.fault.getStackTrace()); + } + + public function getResponses():void + { + + } + ]]> + </mx:Script> + </mx:Application> Modified: mentalmodels/trunk/flex/src/actionscript/Game.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Game.as 2009-08-18 22:35:46 UTC (rev 260) +++ mentalmodels/trunk/flex/src/actionscript/Game.as 2009-08-18 22:43:42 UTC (rev 261) @@ -11,7 +11,7 @@ public var numberOfLocations:int; public var maxDays:int; public var maxFishHarvest:int; - public var timestamp:Timestamp; + public var timestamp:Date; public var title:String; public var description:String; public var money:Number; Modified: mentalmodels/trunk/flex/src/actionscript/PageDisplay.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-08-18 22:35:46 UTC (rev 260) +++ mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-08-18 22:43:42 UTC (rev 261) @@ -13,14 +13,12 @@ import mx.collections.ArrayCollection; import mx.containers.VBox; - import mx.controls.Alert; import mx.controls.Text; - [Bindable] public class PageDisplay { -public var msg:String = ""; + public var msg:String = ""; public var pages:ArrayCollection; public var minPagesRead:int; Modified: mentalmodels/trunk/flex/src/actionscript/StudentStrategy.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/StudentStrategy.as 2009-08-18 22:35:46 UTC (rev 260) +++ mentalmodels/trunk/flex/src/actionscript/StudentStrategy.as 2009-08-18 22:43:42 UTC (rev 261) @@ -8,12 +8,13 @@ public class StudentStrategy { public var id:Number; + public var student:actionscript.Student; public var allocationSeqNo:int; public var days:int; public var threshold:Number; public var location:Location; public var repeatedDecisions:Boolean; public var dayOutput:ArrayCollection; - + public var roundConfig:actionscript.Round; } } \ No newline at end of file Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-18 22:35:46 UTC (rev 260) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-18 22:43:42 UTC (rev 261) @@ -46,8 +46,7 @@ </mx:State> </mx:states> - <!-- <mx:Canvas id="content" x="5" y="5" width="750" height="470"/> --> - <mx:Canvas id="content" x="0" y="0" width="720" height="475"/> + <mx:Canvas id="content" x="0" y="0" width="720" height="460"/> <mx:Canvas id="expiredContent" x="-1" y="-1" width="1" height="1" visible="false"/> <mx:HBox id="buttonBar" left="{(width-buttonBar.width)/2}" bottom="0" horizontalGap="100"> @@ -60,10 +59,10 @@ <mx:RemoteObject id="roundService" destination="roundService" fault="faultHandler(event)"> <mx:method name="getBlock" result="blockResultHandler(event)"/> + <mx:method name="getCurrentRound" result="roundResultHandler(event)"/> </mx:RemoteObject> <mx:RemoteObject id="startupService" destination="startupService" fault="faultHandler(event)"> <mx:method name="createStudent" result="studentResultHandler(event)"/> - <mx:method name="getFirstModule" result="moduleResultHandler(event)"/> </mx:RemoteObject> <mx:RemoteObject id="answeringService" destination="answeringService" fault="faultHandler(event)"> <mx:method name="saveStrategy" result="strategyResultHandler(event)"/> @@ -106,6 +105,8 @@ public var currentModuleNumber:int = 0; public var currentBlock:Block = null; public var currentBlockNumber:int = 0; + public var currentRound:Round = null; + public var currentRoundNumber:int = 0; [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); public var blockLoader:Function = null; @@ -117,6 +118,7 @@ public var instructionsLoaded:Boolean = false; [Bindable] public var studentObject:actionscript.Student; + [Bindable] public var roundObject:actionscript.Round; private function newLocation(maxCapacity:Number,growth:Number):Location { @@ -130,9 +132,7 @@ [Bindable] public var randomNumbers:String; private function ack(event:MessageAckEvent):void { - //chart.setVisible(true); randomNumbers = event.message.body as String; - //Alert.show("in ack method" + randomNumbers); } public function init():void @@ -144,7 +144,6 @@ { btnForward.enabled = btnBack.enabled = btnReset.enabled = true; instructionsLoaded = true; -// instructions.moduleNumber = currentModuleNumber; currentState = "instructions"; } private function sendBlockQuestions():void @@ -242,10 +241,16 @@ studentResponse.question = null; var strategy:StrategyDesignQuestionC = StrategyDesignQuestionC(curr.getChildAt(j)); - answeringService.saveStrategy(strategy.toDatabaseObject()); + var tempDBObjects:ArrayCollection = strategy.toDatabaseObject(); + + for(var k:int=0;k<tempDBObjects.length;k++) + { + (tempDBObjects.getItemAt(k) as StudentStrategy).student = studentObject; + (tempDBObjects.getItemAt(k) as StudentStrategy).roundConfig = roundObject; + } + + answeringService.saveStrategy(tempDBObjects); } -// if(curr.getChildAt(j) is StrategyDesignQuestionC) -// Alert.show("strategy found"); if(studentResponse.question != null) { @@ -254,19 +259,6 @@ } } -// var str:String = ""; -// for(var q:int=0;q<responseList.length;q++) -// { -// str += "null:"; -// str += (responseList.getItemAt(q) == null); -// str += "\n"; -// str += "response:"; -// str += (responseList.getItemAt(q) as StudentResponse).response; -// -// str += "\n"; -// str += "\n"; -// } -// Alert.show(str); answeringService.saveQuestion(responseList); } @@ -276,16 +268,21 @@ } private function getNextBlock():void { - if(currentBlock != null) sendBlockQuestions(); currentBlock = null; currentBlockNumber++; //server request roundService.getBlock(); -// blockResultHandler(new ResultEvent("",false,true,makeBlock())); } private function blockResultHandler(event:ResultEvent):void { + // save questions from previous Block + if(currentBlock != null) + { + sendBlockQuestions(); + } + + // update with new block currentBlock = (event.result as actionscript.Block); if(currentBlock == null @@ -303,8 +300,12 @@ gotoInstructions(); } + // start timer to alert students to hurry shell.setProgressBarTime(0,0,currentBlock.duration); shell.progressBarInit(); + + // get the present round; hopefully the strategy design has been finished by now + roundService.getCurrentRound(); } private function moduleResultHandler(event:ResultEvent):void { @@ -330,6 +331,11 @@ gotoInstructions(); } } + private function roundResultHandler(event:ResultEvent):void + { + currentRound = event.result as Round; + currentRoundNumber = currentRound.id; + } public function getLocation():void { @@ -340,7 +346,6 @@ if(event.result is ArrayCollection) { locations = event.result as ArrayCollection; -// Alert.show("locations received: "+locations.length); } } private function strategyResultHandler(event:ResultEvent):void @@ -362,7 +367,6 @@ private function messageHandler(message:IMessage):void { randomNumbers = message.body as String; -// Alert.show( ""+randomNumbers); } public function back():Boolean @@ -460,98 +464,6 @@ } } - public function makeBlock():Block - { - var block1:Block = new Block(); - try{ - var questionGroups1:ArrayCollection = new ArrayCollection(); - var qg0:QuestionGroup = new QuestionGroup(); - var qg1:QuestionGroup = new QuestionGroup(); - var qg2:QuestionGroup = new QuestionGroup(); - var qg3:QuestionGroup = new QuestionGroup(); - var qg4:QuestionGroup = new QuestionGroup(); - var qg5:QuestionGroup = new QuestionGroup(); - var qg6:QuestionGroup = new QuestionGroup(); - qg0.questions = new ArrayCollection(); - qg1.questions = new ArrayCollection(); - qg2.questions = new ArrayCollection(); - qg3.questions = new ArrayCollection(); - qg4.questions = new ArrayCollection(); - qg5.questions = new ArrayCollection(); - qg6.questions = new ArrayCollection(); - block1.questionGroups = new ArrayCollection(); - - // create questions - var ddq1:Question = new Question(); - ddq1.question = "dayByDayDecisionsQuestion"; - ddq1.type = "dayByDayDecisions"; - - var cat1:Categorical = new Categorical(); - cat1.question = "categoricalQuestion"; - cat1.type = "categorical"; - cat1.categoricalOptions = new ArrayCollection(); - - var for1:Question = new Question(); - for1.question = "forecastingFishQuestion"; - for1.type = "forecastingFishermen"; - var for2:Question = new Question(); - for2.question = "forecastingFishermenQuestion"; - for2.type = "forecastingFish"; - - var psy1:Psychometric = new Psychometric(); - psy1.question = "psychometricQuestionBipolar"; - psy1.type = "psychometric"; - psy1.maxSliderValue = 10; - psy1.choices = new ArrayCollection(); - psy1.choices.addItem("Highly Agree"); - psy1.choices.addItem("Neutral"); - psy1.choices.addItem("Highly Disagree"); - - var psy2:Psychometric = new Psychometric(); - psy2.question = "psychometricQuestionUnipolar"; - psy2.type = "psychometric"; - psy2.maxSliderValue = 10; - psy2.choices = new ArrayCollection(); - psy2.choices.addItem("Strong"); - psy2.choices.addItem("Neutral"); - - var str1:Question = new Question(); - str1.question = "strategyDesignQuestion"; - str1.type = "strategyDesign"; - - var txt1:Question = new Question(); - txt1.question = "textQuestion"; - txt1.type = "text"; - - // insert questions into groups - qg0.questions.addItem(ddq1); - qg1.questions.addItem(cat1); - qg2.questions.addItem(for1); - qg3.questions.addItem(for2); - qg4.questions.addItem(psy1); - qg4.questions.addItem(psy2); - qg5.questions.addItem(str1); - qg6.questions.addItem(txt1); - - qg1.description = "testDesc"; - qg1.header = "testHead"; - - block1.questionGroups.addItem(qg0); - block1.questionGroups.addItem(qg1); - block1.questionGroups.addItem(qg2); - block1.questionGroups.addItem(qg3); - block1.questionGroups.addItem(qg4); - block1.questionGroups.addItem(qg5); - block1.questionGroups.addItem(qg6); - - - }catch(errObject:Error){ - Alert.show("block creation failure\n" + - errObject.message + "\n" + errObject.getStackTrace()); - } - return block1; - } - ]]> </mx:Script> Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-08-18 22:35:46 UTC (rev 260) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-08-18 22:43:42 UTC (rev 261) @@ -35,6 +35,7 @@ <mx:Script> <![CDATA[ + import actionscript.Round; import actionscript.Location; import actionscript.StudentStrategy; import actionscript.questions.Question; Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-08-19 21:05:42
|
Revision: 265 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=265&view=rev Author: kjonas Date: 2009-08-19 21:05:30 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Student.as contains GameCode core updated to have GameCode field; sends students as objects, not parameters StartGame edited to send request to server StartGame (edited).html included as a sample of an html file with full-url so you can see the embedded flex Modified Paths: -------------- mentalmodels/trunk/flex/src/StartGame.mxml mentalmodels/trunk/flex/src/actionscript/Student.as mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/test.swf Added Paths: ----------- mentalmodels/trunk/src/main/webapp/StartGame (edited).html Modified: mentalmodels/trunk/flex/src/StartGame.mxml =================================================================== --- mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-19 17:37:51 UTC (rev 264) +++ mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-19 21:05:30 UTC (rev 265) @@ -57,6 +57,13 @@ var gameObject:Game = new Game(); gameObject.money = stpMoney.value; gameObject.description = txtDescription.text; + gameObject.numberOfRounds = 2; + gameObject.maxDays = 30; + gameObject.maxFishHarvest = 100; + gameObject.timestamp = new Date(); + gameObject.title = "test Game Title"; + + startupService.createGame(gameObject); } public function start():void { @@ -91,4 +98,3 @@ </mx:Script> </mx:Application> - Modified: mentalmodels/trunk/flex/src/actionscript/Student.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Student.as 2009-08-19 17:37:51 UTC (rev 264) +++ mentalmodels/trunk/flex/src/actionscript/Student.as 2009-08-19 21:05:30 UTC (rev 265) @@ -10,11 +10,12 @@ public var id:int; public var group:int; public var studentNo:int; - public var birthYear:int; - public var major:String; - public var semester:String; + public var birthYear:int; + public var major:String; + public var semester:String; public var timestamp:Date; public var gender:String; + public var gameCode:String; /** * input: Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-19 17:37:51 UTC (rev 264) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-19 21:05:30 UTC (rev 265) @@ -246,7 +246,7 @@ for(var k:int=0;k<tempDBObjects.length;k++) { (tempDBObjects.getItemAt(k) as StudentStrategy).student = studentObject; - (tempDBObjects.getItemAt(k) as StudentStrategy).roundConfig = roundObject; + (tempDBObjects.getItemAt(k) as StudentStrategy).round = roundObject; } answeringService.saveStrategy(tempDBObjects); @@ -413,15 +413,20 @@ if(obj is SocioDemographicPage) { - var Id:uint = 0; if( (SocioDemographicPage)(obj).accept() ) { obj.visible = false; expiredContent.addChild(obj); - var info:SocioDemographicPage = SocioDemographicPage(obj); - Id = startupService.createStudent(info.getYear(), info.getSemester(), info.getGender(),info.getMajor()); + var newStudent:actionscript.Student = new Student(); + newStudent.birthYear = ((obj as SocioDemographicPage).getYear() as int); + newStudent.gender = (obj as SocioDemographicPage).getGender(); + newStudent.major = (obj as SocioDemographicPage).getMajor(); + newStudent.semester = (obj as SocioDemographicPage).getSemester(); + newStudent.gameCode = (obj as SocioDemographicPage).getGameCode(); + startupService.createStudent(newStudent); + currentState = "wait"; btnBack.enabled = btnForward.enabled = btnReset.enabled = true; Modified: mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml 2009-08-19 17:37:51 UTC (rev 264) +++ mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml 2009-08-19 21:05:30 UTC (rev 265) @@ -23,6 +23,10 @@ { return cbxSemester.selectedItem as String; } + public function getGameCode():String + { + return txtGameCode.text; + } public function accept():Boolean { @@ -129,6 +133,11 @@ <mx:ComboBox id="cbxSemester" selectedIndex="0" dataProvider="{new ArrayCollection(['Freshman','Sophomore','Junior','Senior','Graduate/Other'])}"/> <!--<mx:TextInput id="txtSemester" width="75" maxChars="6"/>--> </mx:HBox> + + <mx:HBox> + <mx:Label text="Game Code:" fontWeight="bold" width="100" textAlign="right"/> + <mx:TextInput id="txtGameCode" width="120" maxChars="10"/> + </mx:HBox> </mx:VBox> </mx:VBox> Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Added: mentalmodels/trunk/src/main/webapp/StartGame (edited).html =================================================================== --- mentalmodels/trunk/src/main/webapp/StartGame (edited).html (rev 0) +++ mentalmodels/trunk/src/main/webapp/StartGame (edited).html 2009-08-19 21:05:30 UTC (rev 265) @@ -0,0 +1,139 @@ +<!-- saved from url=(0014)about:internet --> +<html lang="en"> + +<!-- +Smart developers always View Source. + +This application was built using Adobe Flex, an open source framework +for building rich Internet applications that get delivered via the +Flash Player or to desktops via Adobe AIR. + +Learn more about Flex at http://flex.org +// --> + +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + +<!-- BEGIN Browser History required section --> +<link rel="stylesheet" type="text/css" href="history/history.css" /> +<!-- END Browser History required section --> + +<title></title> +<script src="AC_OETags.js" language="javascript"></script> + +<!-- BEGIN Browser History required section --> +<script src="history/history.js" language="javascript"></script> +<!-- END Browser History required section --> + +<style> +body { margin: 0px; overflow:hidden } +</style> + +<script language="JavaScript"> + window.onbeforeunload = confirmExit; + function confirmExit() + { + return "If you are connected to the server, you will be disconnected if the page closes. Students in the experiment will be removed if the window closes."; + } +</script> + +<script language="JavaScript" type="text/javascript"> +<!-- +// ----------------------------------------------------------------------------- +// Globals +// Major version of Flash required +var requiredMajorVersion = 9; +// Minor version of Flash required +var requiredMinorVersion = 0; +// Minor version of Flash required +var requiredRevision = 124; +// ----------------------------------------------------------------------------- +// --> +</script> +</head> + +<body scroll="no"> + + + <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + id="StartGame" width="100%" height="100%" + codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> + <param name="movie" value="StartGame.swf" /> + <PARAM NAME=FlashVars VALUE="ip=test${clientIP}"> + <param name="quality" value="high" /> + <param name="bgcolor" value="#869ca7" /> + <param name="allowScriptAccess" value="sameDomain" /> + <embed src="http://127.0.0.1:8080/mme/StartGame.swf" quality="high" bgcolor="#869ca7" + width="100%" height="100%" name="StartGame" align="middle" + play="true" + loop="false" + quality="high" + allowScriptAccess="sameDomain" + type="application/x-shockwave-flash" + pluginspage="http://www.adobe.com/go/getflashplayer"> + </embed> + </object> +</body> +</html> + AC_FL_RunContent( + "src", "playerProductInstall", + "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+'&ip=test'+clientIP+"", + "width", "100%", + "height", "100%", + "align", "middle", + "id", "StartGame", + "quality", "high", + "bgcolor", "#869ca7", + "name", "StartGame", + "allowScriptAccess","sameDomain", + "type", "application/x-shockwave-flash", + "pluginspage", "http://www.adobe.com/go/getflashplayer" + ); +} else if (hasRequestedVersion) { + // if we've detected an acceptable version + // embed the Flash Content SWF when all tests are passed + AC_FL_RunContent( + "src", "http://127.0.0.1:8080/mme/StartGame", + "width", "100%", + "height", "100%", + "align", "middle", + "valign", "middle", + "id", "StartGame", + "quality", "high", + "bgcolor", "#869ca7", + "name", "StartGame", + "allowScriptAccess","sameDomain", + "type", "application/x-shockwave-flash", + "pluginspage", "http://www.adobe.com/go/getflashplayer", + "FlashVars", "ip=test"+clientIP+"" + ); +} else { // flash is too old or we can't detect the plugin + var alternateContent = 'Alternate HTML content should be placed here. ' + + 'This content requires the Adobe Flash Player. ' + + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; + document.write(alternateContent); // insert non-flash content + } +// --> +</script> +<noscript> + <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + id="StartGame" width="100%" height="100%" + codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> + <param name="movie" value="StartGame.swf" /> + <PARAM NAME=FlashVars VALUE="ip=test${clientIP}"> + <param name="quality" value="high" /> + <param name="bgcolor" value="#869ca7" /> + <param name="allowScriptAccess" value="sameDomain" /> + <embed src="http://127.0.0.1:8080/mme/StartGame.swf" quality="high" bgcolor="#869ca7" + width="100%" height="100%" name="StartGame" align="middle" + play="true" + loop="false" + quality="high" + allowScriptAccess="sameDomain" + type="application/x-shockwave-flash" + pluginspage="http://www.adobe.com/go/getflashplayer"> + </embed> + </object> +</noscript> +</body> +</html> Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-21 22:09:37
|
Revision: 267 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=267&view=rev Author: seematalele Date: 2009-08-21 22:09:28 +0000 (Fri, 21 Aug 2009) Log Message: ----------- 1) Resolve the bug for sending the current round to the client 2) Created RoundLocation entity in flex and java which maps with round and location, so removed the many to many mapping between round and location 3) made changes in the actionscript files accordingly. 4) Changed the test.mxml which will show alert message for getcurrent round function. Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/Location.as mentalmodels/trunk/flex/src/actionscript/Round.as mentalmodels/trunk/flex/src/test.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalQuestion.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml mentalmodels/trunk/src/main/webapp/test.html mentalmodels/trunk/src/main/webapp/test.swf Added Paths: ----------- mentalmodels/trunk/flex/src/actionscript/RoundLocation.as mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java Modified: mentalmodels/trunk/flex/src/actionscript/Location.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Location.as 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/flex/src/actionscript/Location.as 2009-08-21 22:09:28 UTC (rev 267) @@ -11,5 +11,6 @@ public var maxCapacity:int; public var growthRate:Number; public var initialPopulation:int; + public var roundLocations:ArrayCollection; } } \ No newline at end of file Modified: mentalmodels/trunk/flex/src/actionscript/Round.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Round.as 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/flex/src/actionscript/Round.as 2009-08-21 22:09:28 UTC (rev 267) @@ -9,5 +9,6 @@ public var roundNo:int; public var game:Game; public var communicationFlag:Boolean; + public var roundLocations:ArrayCollection; } } \ No newline at end of file Added: mentalmodels/trunk/flex/src/actionscript/RoundLocation.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/RoundLocation.as (rev 0) +++ mentalmodels/trunk/flex/src/actionscript/RoundLocation.as 2009-08-21 22:09:28 UTC (rev 267) @@ -0,0 +1,15 @@ +package actionscript +{ + [Bindable] + [RemoteClass(alias="edu.asu.commons.mme.entity.RoundLocation")] + public class RoundLocation + { + + public var id:int; + + public var round:Round; + + public var location:Location; + + } +} \ No newline at end of file Modified: mentalmodels/trunk/flex/src/test.mxml =================================================================== --- mentalmodels/trunk/flex/src/test.mxml 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/flex/src/test.mxml 2009-08-21 22:09:28 UTC (rev 267) @@ -25,6 +25,7 @@ <mx:Script> <![CDATA[ + import actionscript.Round; import mx.core.UIComponent; import mx.controls.Alert; import mx.rpc.events.FaultEvent; @@ -37,6 +38,10 @@ str += "event.result == null : " + (event.result == null) + "\n"; Alert.show(str, "resultHandler()"); + var round:actionscript.Round = event.result as actionscript.Round; + Alert.show("round no is : " + round.roundNo + " " + round.id); + //Alert.show + } public function faultHandler(event:FaultEvent):void Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-21 22:09:28 UTC (rev 267) @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.1.36, for Win32 (ia32) +-- MySQL dump 10.13 Distrib 5.1.33, for Win32 (ia32) -- -- Host: localhost Database: mme -- ------------------------------------------------------ --- Server version 5.1.36-community +-- Server version 5.1.33-community /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -283,7 +283,7 @@ KEY `FK304BF219A3AF27` (`current_round_id`), CONSTRAINT `FK304BF219A3AF27` FOREIGN KEY (`current_round_id`) REFERENCES `round_config` (`id`), CONSTRAINT `FK304BF2F1265AC7` FOREIGN KEY (`current_block_id`) REFERENCES `block` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -292,7 +292,7 @@ LOCK TABLES `game` WRITE; /*!40000 ALTER TABLE `game` DISABLE KEYS */; -INSERT INTO `game` VALUES (1,'First game','island.jpg',30,5,0,4,4,'2009-07-19 17:30:35','Mental Model Experiment',3,2); +INSERT INTO `game` VALUES (1,'First game','island.jpg',30,5,0,4,4,'2009-07-19 17:30:35','Mental Model Experiment',3,2),(2,'dell2','null',30,100,0.01,0,2,'2009-08-21 14:58:14','test Game Title',1,1); /*!40000 ALTER TABLE `game` ENABLE KEYS */; UNLOCK TABLES; @@ -402,34 +402,6 @@ UNLOCK TABLES; -- --- Table structure for table `location_round_config` --- - -DROP TABLE IF EXISTS `location_round_config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `location_round_config` ( - `location_id` bigint(20) NOT NULL, - `rounds_id` bigint(20) NOT NULL, - PRIMARY KEY (`location_id`,`rounds_id`), - KEY `FK979C4B5D224FD013` (`location_id`), - KEY `FK979C4B5D479268AA` (`rounds_id`), - CONSTRAINT `FK979C4B5D479268AA` FOREIGN KEY (`rounds_id`) REFERENCES `round_config` (`id`), - CONSTRAINT `FK979C4B5D224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `location_round_config` --- - -LOCK TABLES `location_round_config` WRITE; -/*!40000 ALTER TABLE `location_round_config` DISABLE KEYS */; -INSERT INTO `location_round_config` VALUES (1,1),(1,2),(2,1),(2,2),(3,1),(3,2),(4,1),(4,2); -/*!40000 ALTER TABLE `location_round_config` ENABLE KEYS */; -UNLOCK TABLES; - --- -- Table structure for table `module` -- @@ -623,33 +595,6 @@ UNLOCK TABLES; -- --- Table structure for table `round_config_game` --- - -DROP TABLE IF EXISTS `round_config_game`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `round_config_game` ( - `round_config_id` bigint(20) NOT NULL, - `game_id` bigint(20) NOT NULL, - UNIQUE KEY `game_id` (`game_id`), - KEY `FKDF98659E7AC42F73` (`game_id`), - KEY `FKDF98659E2B8C177C` (`round_config_id`), - CONSTRAINT `FKDF98659E2B8C177C` FOREIGN KEY (`round_config_id`) REFERENCES `round_config` (`id`), - CONSTRAINT `FKDF98659E7AC42F73` FOREIGN KEY (`game_id`) REFERENCES `game` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `round_config_game` --- - -LOCK TABLES `round_config_game` WRITE; -/*!40000 ALTER TABLE `round_config_game` DISABLE KEYS */; -/*!40000 ALTER TABLE `round_config_game` ENABLE KEYS */; -UNLOCK TABLES; - --- -- Table structure for table `round_config_location` -- @@ -657,13 +602,14 @@ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `round_config_location` ( - `round_config_id` bigint(20) NOT NULL, - `locations_id` bigint(20) NOT NULL, - PRIMARY KEY (`round_config_id`,`locations_id`), - KEY `FKC67B0361FDF88BCA` (`locations_id`), - KEY `FKC67B03612B8C177C` (`round_config_id`), - CONSTRAINT `FKC67B03612B8C177C` FOREIGN KEY (`round_config_id`) REFERENCES `round_config` (`id`), - CONSTRAINT `FKC67B0361FDF88BCA` FOREIGN KEY (`locations_id`) REFERENCES `location` (`id`) + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `location_id` bigint(20) NOT NULL, + `round_id` bigint(20) NOT NULL, + PRIMARY KEY (`id`), + KEY `FKC67B0361224FD013` (`location_id`), + KEY `FKC67B036147CF2321` (`round_id`), + CONSTRAINT `FKC67B036147CF2321` FOREIGN KEY (`round_id`) REFERENCES `round_config` (`id`), + CONSTRAINT `FKC67B0361224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -673,7 +619,6 @@ LOCK TABLES `round_config_location` WRITE; /*!40000 ALTER TABLE `round_config_location` DISABLE KEYS */; -INSERT INTO `round_config_location` VALUES (1,1),(2,1),(1,2),(2,2),(1,3),(2,3),(1,4),(2,4); /*!40000 ALTER TABLE `round_config_location` ENABLE KEYS */; UNLOCK TABLES; @@ -812,15 +757,15 @@ `repeated_decisions` tinyint(1) NOT NULL, `threshold` double NOT NULL, `location_id` bigint(20) NOT NULL, - `roundConfig_id` bigint(20) NOT NULL, + `round_id` bigint(20) NOT NULL, `student_id` bigint(20) NOT NULL, PRIMARY KEY (`id`), - KEY `FK9615A4F7297B31F` (`roundConfig_id`), KEY `FK9615A4F7224FD013` (`location_id`), + KEY `FK9615A4F747CF2321` (`round_id`), KEY `FK9615A4F7992B5A41` (`student_id`), CONSTRAINT `FK9615A4F7992B5A41` FOREIGN KEY (`student_id`) REFERENCES `student` (`id`), CONSTRAINT `FK9615A4F7224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`), - CONSTRAINT `FK9615A4F7297B31F` FOREIGN KEY (`roundConfig_id`) REFERENCES `round_config` (`id`) + CONSTRAINT `FK9615A4F747CF2321` FOREIGN KEY (`round_id`) REFERENCES `round_config` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -872,4 +817,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2009-08-21 12:00:07 +-- Dump completed on 2009-08-21 22:03:41 Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalQuestion.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalQuestion.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalQuestion.java 2009-08-21 22:09:28 UTC (rev 267) @@ -1,11 +1,8 @@ package edu.asu.commons.mme.entity; -import java.util.Iterator; import java.util.List; - - import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.JoinColumn; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java 2009-08-21 22:09:28 UTC (rev 267) @@ -13,7 +13,6 @@ import javax.persistence.Lob; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.CollectionOfElements; @@ -57,7 +56,7 @@ // FIXME: should this be many-to-many instead? @ManyToMany - @CollectionOfElements(fetch=FetchType.EAGER) + @CollectionOfElements private List<Round> rounds; @ManyToOne @@ -95,12 +94,12 @@ return money; } - public void setRoundconfig(List<Round> roundconfig) { + /*public void setRoundconfig(List<Round> roundconfig) { this.rounds = roundconfig; } public List<Round> getRoundconfig() { return rounds; - } + }*/ public void setTimestamp(Timestamp timestamp) { this.timestamp = timestamp; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Group.java 2009-08-21 22:09:28 UTC (rev 267) @@ -7,8 +7,6 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; import javax.persistence.Table; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-08-21 22:09:28 UTC (rev 267) @@ -5,15 +5,11 @@ import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToMany; +import javax.persistence.OneToMany; import javax.persistence.Table; -import org.hibernate.annotations.CollectionOfElements; - @Entity @Table(name = "location") public class Location implements Serializable{ @@ -24,9 +20,8 @@ @GeneratedValue private Long id; - @ManyToMany - @CollectionOfElements - private List<Round> rounds; + @OneToMany(mappedBy = "location") + private List<RoundLocation> roundLocations; @Column(nullable=false,name="location_name") private String locationName; @@ -51,7 +46,6 @@ return id; } - public Double getGrowthRate() { return growthRate; } @@ -76,17 +70,18 @@ public void setInitialPopulation(Integer initialPopulation) { this.initialPopulation = initialPopulation; } - public void setRounds(List<Round> rounds) { - this.rounds = rounds; - } - public List<Round> getRounds() { - return rounds; - } + public void setCurrentPopulation(Integer currentPopulation) { this.currentPopulation = currentPopulation; } public Integer getCurrentPopulation() { return currentPopulation; } + public void setRoundLocations(List<RoundLocation> roundLocations) { + this.roundLocations = roundLocations; + } + public List<RoundLocation> getRoundLocations() { + return roundLocations; + } } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java 2009-08-21 22:09:28 UTC (rev 267) @@ -3,16 +3,11 @@ import java.io.Serializable; import java.util.List; -import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.OrderBy; import javax.persistence.Table; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java 2009-08-21 22:09:28 UTC (rev 267) @@ -1,7 +1,6 @@ package edu.asu.commons.mme.entity; import java.io.Serializable; -import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; @@ -9,8 +8,6 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.OrderBy; import javax.persistence.Table; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java 2009-08-21 22:09:28 UTC (rev 267) @@ -3,13 +3,11 @@ import java.io.Serializable; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java 2009-08-21 22:09:28 UTC (rev 267) @@ -3,20 +3,15 @@ import java.io.Serializable; import java.util.List; -import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; import javax.persistence.Table; -import org.hibernate.annotations.CollectionOfElements; - @Entity @Table(name="round_config") public class Round implements Serializable { @@ -30,9 +25,9 @@ @Column(name="round_no",nullable=false) private Integer roundNo; - @ManyToMany - @CollectionOfElements(fetch=FetchType.EAGER) - private List<Game> game; + /*@ManyToMany + @CollectionOfElements + private List<Game> game;*/ @Column(name="communication_flag",nullable=false,columnDefinition="Boolean default false") private boolean communicationFlag; @@ -41,9 +36,8 @@ private ModuleRoundConfig round_config;*/ - @ManyToMany - @CollectionOfElements(fetch=FetchType.EAGER) - private List<Location> locations; + @OneToMany(mappedBy = "round") + private List<RoundLocation> roundLocations; public void setId(Long id) { this.id = id; @@ -64,24 +58,24 @@ public boolean getCommunicationFlag() { return communicationFlag; } - - public List<Location> getLocations() { - return locations; + public void setRoundLocations(List<RoundLocation> roundLocations) { + this.roundLocations = roundLocations; } - public void setLocations(List<Location> locations) { - this.locations = locations; + public List<RoundLocation> getRoundLocations() { + return roundLocations; } + /*public void setRound_config(ModuleRoundConfig round_config) { this.round_config = round_config; } public ModuleRoundConfig getRound_config() { return round_config; }*/ - public void setGame(List<Game> game) { + /*public void setGame(List<Game> game) { this.game = game; } public List<Game> getGame() { return game; - } + }*/ } Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundLocation.java 2009-08-21 22:09:28 UTC (rev 267) @@ -0,0 +1,57 @@ +package edu.asu.commons.mme.entity; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="round_config_location") +public class RoundLocation implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3215898164475817212L; + + @Id + @GeneratedValue + private Long id; + + @ManyToOne + @JoinColumn(nullable=false) + private Round round; + + @ManyToOne + @JoinColumn(nullable=false) + private Location location; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setRound(Round round) { + this.round = round; + } + + public Round getRound() { + return round; + } + + public void setLocation(Location location) { + this.location = location; + } + + public Location getLocation() { + return location; + } + +} Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Student.java 2009-08-21 22:09:28 UTC (rev 267) @@ -5,8 +5,6 @@ import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/StudentStrategy.java 2009-08-21 22:09:28 UTC (rev 267) @@ -2,7 +2,6 @@ import java.io.Serializable; -import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; @@ -10,7 +9,6 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; import javax.persistence.Table; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-08-21 22:09:28 UTC (rev 267) @@ -4,13 +4,9 @@ import org.springframework.transaction.annotation.Transactional; -import edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao; -import edu.asu.commons.mme.dao.HibernateStudentDao; import edu.asu.commons.mme.dao.HibernateStudentResponseDao; import edu.asu.commons.mme.dao.HibernateStudentStrategyDao; -import edu.asu.commons.mme.entity.Block; import edu.asu.commons.mme.entity.DayByDayDecisions; -import edu.asu.commons.mme.entity.Location; import edu.asu.commons.mme.entity.Student; import edu.asu.commons.mme.entity.StudentResponse; import edu.asu.commons.mme.entity.StudentStrategy; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/DayByDayDecisionsService.java 2009-08-21 22:09:28 UTC (rev 267) @@ -6,7 +6,6 @@ import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao; -import edu.asu.commons.mme.dao.HibernateLocationDao; import edu.asu.commons.mme.entity.DayByDayDecisions; import edu.asu.commons.mme.entity.Location; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-08-21 22:09:28 UTC (rev 267) @@ -1,18 +1,13 @@ package edu.asu.commons.mme.service; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; - - import org.hibernate.Hibernate; import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateLocationDao; -import edu.asu.commons.mme.entity.Game; import edu.asu.commons.mme.entity.Location; -import edu.asu.commons.mme.entity.Round; @Transactional public class LocationService extends Service.Base<Location, HibernateLocationDao>{ @@ -27,27 +22,9 @@ { initLocation = locations.get(i); Hibernate.initialize(initLocation); - List<Round> rounds = initLocation.getRounds(); - for(int j = 0; j < rounds.size(); j++) - { - Round round = rounds.get(j); - Hibernate.initialize(round); - - Iterator <Game> games = round.getGame().iterator(); - while(games.hasNext()) - { - Hibernate.initialize(games.next()); - - } - - List<Location> roundlocations = round.getLocations(); - for(int k=0;k<roundlocations.size();k++) - { - Hibernate.initialize(roundlocations.get(k)); - } - //round.getLocations() - } + Hibernate.initialize(initLocation.getRoundLocations()); + } return locations; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-08-21 22:09:28 UTC (rev 267) @@ -23,6 +23,7 @@ import edu.asu.commons.mme.entity.Question; import edu.asu.commons.mme.entity.QuestionGroup; import edu.asu.commons.mme.entity.Round; +import edu.asu.commons.mme.entity.RoundLocation; @Transactional public class RoundService extends Service.Base<Round, HibernateRoundConfigDao> { @@ -37,7 +38,7 @@ private Round currentRound; private Block currentBlock; private Game currentGame; - + private int blockSeqNo; private ModuleRoundConfig currentModuleRoundConfig; @@ -57,33 +58,52 @@ public Game createGame(Game game) { + currentGame = new Game(); - currentGame = game; + //currentGame = game; + + currentGame.setDescription(game.getDescription()); + currentGame.setMaxDays(game.getMaxDays()); + currentGame.setMaxFishHarvest(game.getMaxFishHarvest()); + currentGame.setMoney(game.getMoney()); + currentGame.setNumberOfRounds(game.getNumberOfRounds()); + currentGame.setNumberOfLocations(game.getNumberOfLocations()); + currentGame.setTimestamp(game.getTimestamp()); + currentGame.setTitle(game.getTitle()); + currentGame.setImageLocation("null"); +// currentGame.setro// getGameDao().save(currentGame); String str = currentGame.getDescription()+currentGame.getId(); - if(getGameDao().findAllByProperty("description", str) !=null) + + if(getGameDao().findAllByProperty("description", str).size() != 0) { - setCurrentGame(null); + getLogger().debug("in if loop "); + currentGame = null; + setCurrentGame(currentGame); } else { currentGame.setDescription(str); getGameDao().save(currentGame); + getLogger().debug("in else loop 1 " + str); setCurrentGame(currentGame); - initializeGame(currentGame); + getLogger().debug("in else loop 2 " + str); + //initializeGame(currentGame); + getLogger().debug("in else loop 3 " + str); } - return getCurrentGame(); + getLogger().debug("current game from flex is: " + currentGame.getDescription()); + return currentGame; } private void initializeGame(Game game) { // TODO Auto-generated method stub Hibernate.initialize(game); Hibernate.initialize(game.getCurrentBlock()); Hibernate.initialize(game.getCurrentRound()); - Iterator<Round> rounds = game.getRounds().iterator(); + /*Iterator<Round> rounds = game.getRounds().iterator(); while(rounds.hasNext()) { initializeRound(rounds.next()); - } + }*/ } public Module getNextModule(int sequenceNo) @@ -99,10 +119,12 @@ public Block getBlock() { /* - *1) Find out the current module number - *2) check if it is finished, if yes find out the current round number - *3) Find out the current block number - *4) Return the next block + *1) Check if the current module round config is null, this object keeps track of which round + * and which module in that round is going on + *2) Find out the current module number + *3) check if it is finished, if yes find out the current round number + *4) Find out the current block number + *5) Return the next block */ //getLogger().debug("in getBlock "); //setCurrentModuleRoundConfig(currentModuleRoundConfig); @@ -210,6 +232,7 @@ currentRound = new Round(); currentRound = getDao().findByProperty("roundNo", 1); setCurrentRound(currentRound); + initializeRound(currentRound); } else { @@ -422,10 +445,11 @@ private void saveGameState(Block currentBlock) { //FIXME: Game id 1 is hard coded but needs to make it dynamic - Game game = gameDao.find(1L); - game.setCurrentBlock(currentBlock); - game.setCurrentRound(currentRound); - gameDao.save(game); + //Game game = gameDao.find(1L); + + currentGame.setCurrentBlock(currentBlock); + currentGame.setCurrentRound(currentRound); + gameDao.save(currentGame); } public Integer getTimerforBlock(Block block) @@ -477,9 +501,9 @@ public Block getCurrentBlock() { //FIXEME: game id 1 is hard coded, it should be dynamic - Game game = gameDao.find(1L); +// Game game = gameDao.find(1L); Block block = new Block(); - block = game.getCurrentBlock(); + block = currentGame.getCurrentBlock(); // Hibernate.initialize(block); return block; @@ -502,40 +526,30 @@ public Round getCurrentRound() { - initializeRound(currentRound); + getLogger().debug("in get current round funciton"); + /*Round round = currentGame.getCurrentRound(); + //Round round = getDao().find(getCurrentRound().getId()); + + initializeRound(round);*/ + getLogger().debug("round no is " + currentRound.getRoundNo() + " " + currentRound.getId()); return currentRound; } - private void initializeRound(Round currentRound) { + private void initializeRound(Round round) { // TODO Auto-generated method stub - Hibernate.initialize(currentRound); + Hibernate.initialize(round); - Iterator <Game> games = currentRound.getGame().iterator(); - while(games.hasNext()) - { + Hibernate.initialize(round.getRoundLocations()); + + /*for (RoundLocation roundLocation: round.getRoundLocations()) { + Hibernate.initialize(roundLocation); + //hibernateroundLocation.getLocation(); + }*/ - initializeGame(games.next()); - - } - - List<Location> roundlocations = currentRound.getLocations(); - for(int k=0;k<roundlocations.size();k++) - { - Hibernate.initialize(roundlocations.get(k)); - } + //Hibernate.initialize(currentRound.getLocations()); } - /*public void setStartModule(Boolean startModule) { - this.startGame = startModule; - } - - - public Boolean getStartModule() { - return startGame; - }*/ - - public void setGameDao(HibernateGameDao gameDao) { this.gameDao = gameDao; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-08-21 22:09:28 UTC (rev 267) @@ -10,6 +10,7 @@ import flex.messaging.messages.AsyncMessage; import flex.messaging.util.UUIDUtils; + public class StartGame extends Thread { private boolean running; @@ -44,6 +45,7 @@ public Game createGame(Game game) { + System.out.println("game came from flex is: " + game.getDescription()); return roundService.createGame(game); } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-08-21 22:09:28 UTC (rev 267) @@ -16,26 +16,29 @@ @Transactional public class StartupService implements ApplicationContextAware { - + //private QuestionCreatorService questionCreatorService; private StartGame startGame; private ApplicationContext ctx; - + /*public void setQuestionCreatorService(QuestionCreatorService questionCreatorService) { this.questionCreatorService = questionCreatorService; }*/ + public Student createStudent(Student student) { - public Student createStudent(Student student) { - return getStartGame().createStudent(student); } - + public Game createGame(Game game) { - return getStartGame().createGame(game); + if(getStartGame() == null) + { + setStartGame(); + } + return startGame.createGame(game); } - + public void assignGroups() { MessageBroker msgBroker = MessageBroker.getMessageBroker(null); @@ -47,20 +50,20 @@ msg.setMessageId(UUIDUtils.createUUID()); msg.setTimestamp(System.currentTimeMillis()); List<Student> students = new ArrayList<Student>(); - + msg.setBody(students); System.out.println("Message broker is: "+ msgBroker); System.out.println("Students size is: " + students.size()); - + msgBroker.routeMessageToService(msg, null); - + } - + public void startGame() { //push assign groups to all the students assignGroups(); - + //start the game this.startGame.run(); } @@ -69,8 +72,8 @@ startGame.setRunning(false); startGame = null; } - - + + @Override public void setApplicationContext(ApplicationContext context) throws BeansException { @@ -78,12 +81,12 @@ this.ctx = context; } - + public void setStartGame() { try{ if (startGame == null) { this.startGame = (StartGame)ctx.getBean("startGame"); - + } }catch(Exception e) { @@ -92,9 +95,9 @@ } public StartGame getStartGame() { - + return startGame; } - + } Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-08-21 22:09:28 UTC (rev 267) @@ -10,9 +10,12 @@ <mapping class='edu.asu.commons.mme.entity.Game'/> <mapping class='edu.asu.commons.mme.entity.Round'/> <mapping class='edu.asu.commons.mme.entity.Location'/> + <mapping class='edu.asu.commons.mme.entity.RoundLocation'/> <mapping class='edu.asu.commons.mme.entity.Communication'/> <mapping class='edu.asu.commons.mme.entity.Group'/> <mapping class='edu.asu.commons.mme.entity.Student'/> + + <mapping class='edu.asu.commons.mme.entity.StudentRoundConfig'/> <mapping class='edu.asu.commons.mme.entity.StudentStrategy'/> Modified: mentalmodels/trunk/src/main/webapp/test.html =================================================================== --- mentalmodels/trunk/src/main/webapp/test.html 2009-08-21 19:05:54 UTC (rev 266) +++ mentalmodels/trunk/src/main/webapp/test.html 2009-08-21 22:09:28 UTC (rev 267) @@ -28,15 +28,6 @@ <style> body { margin: 0px; overflow:hidden } </style> - -<script language="JavaScript"> - window.onbeforeunload = confirmExit; - function confirmExit() - { - return "If you are connected to the server, you will be disconnected if the page closes. Students in the experiment will be removed if the window closes."; - } -</script> - <script language="JavaScript" type="text/javascript"> <!-- // ----------------------------------------------------------------------------- @@ -53,12 +44,8 @@ </head> <body scroll="no"> - <script language="JavaScript" type="text/javascript"> <!-- - -var clientIP = '<!--#echo var="REMOTE_ADDR"-->'; - // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65) var hasProductInstall = DetectFlashVer(6, 0, 65); @@ -70,12 +57,12 @@ // Location visited after installation is complete if installation is required var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn"; var MMredirectURL = window.location; - document.title = document.title.slice(0, 47) + " - Flash Player Installation"; - var MMdoctitle = document.title; + document.title = document.title.slice(0, 47) + " - Flash Player Installation"; + var MMdoctitle = document.title; AC_FL_RunContent( "src", "playerProductInstall", - "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+'&ip=test'+clientIP+"", + "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"", "width", "100%", "height", "100%", "align", "middle", @@ -95,30 +82,27 @@ "width", "100%", "height", "100%", "align", "middle", - "valign", "middle", "id", "test", "quality", "high", "bgcolor", "#869ca7", "name", "test", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", - "pluginspage", "http://www.adobe.com/go/getflashplayer", - "FlashVars", "ip=test"+clientIP+"" + "pluginspage", "http://www.adobe.com/go/getflashplayer" ); -} else { // flash is too old or we can't detect the plugin - var alternateContent = 'Alternate HTML content should be placed here. ' - + 'This content requires the Adobe Flash Player. ' - + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; - document.write(alternateContent); // insert non-flash content + } else { // flash is too old or we can't detect the plugin + var alternateContent = 'Alternate HTML content should be placed here. ' + + 'This content requires the Adobe Flash Player. ' + + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; + document.write(alternateContent); // insert non-flash content } // --> </script> <noscript> - <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="test" width="100%" height="100%" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> <param name="movie" value="test.swf" /> - <PARAM NAME=FlashVars VALUE="ip=test${clientIP}"> <param name="quality" value="high" /> <param name="bgcolor" value="#869ca7" /> <param name="allowScriptAccess" value="sameDomain" /> Modified: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-08-25 19:54:45
|
Revision: 270 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=270&view=rev Author: kjonas Date: 2009-08-25 19:54:34 +0000 (Tue, 25 Aug 2009) Log Message: ----------- Added button to InitialiseDatabase.mxml which will pop up any information window, based off an ID FisheryExperimentShell.mxml now loads which information windows to show from the Block itself, defaults to basic windows that always display Added code to work with GameCode in FisheryExperimentCore.mxml Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/flex/src/_InstructionsTest.mxml mentalmodels/trunk/flex/src/actionscript/Round.as mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/flex/src/custom/InformationWindowPopup.mxml mentalmodels/trunk/flex/src/custom/InstructionPage.mxml mentalmodels/trunk/flex/src/test.mxml mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/test.html mentalmodels/trunk/src/main/webapp/test.swf Added Paths: ----------- mentalmodels/trunk/flex/src/custom/InformationWindowButton.mxml Modified: mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-08-25 00:20:46 UTC (rev 269) +++ mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-08-25 19:54:34 UTC (rev 270) @@ -17,7 +17,7 @@ } public function progressBarInit():void { - progressTimer = new Timer(100, repetitions); // 21600 * 1000 = 6hrs + progressTimer = new Timer(100, repetitions); // 10rep:1sec, 600rep:1min, 3000rep:5min progressTimer.addEventListener(TimerEvent.TIMER, timerTick); progressTimer.start(); } @@ -70,12 +70,13 @@ </mx:HBox> </mx:HBox> </mx:VBox> - <custom:FisheryExperimentCore id="fisheryContent" blockLoader="loadBlock" shell="{this}"/> + <custom:FisheryExperimentCore id="fisheryContent" shell="{this}"/> </mx:VBox> </mx:HBox> <mx:Script> <![CDATA[ + import actionscript.InformationWindow; import mx.controls.Alert; import mx.controls.Label; import actionscript.Block; @@ -117,11 +118,8 @@ allInfoWindowsA = allInfoWindowsA.getItemAt(0) as ArrayCollection; allInfoWindowsB = allInfoWindowsB.getItemAt(0) as ArrayCollection; - - var arry:ArrayCollection = new ArrayCollection(); // fix when communicating with server... - for(var i:int=0;i<30;i++) arry.addItem(i); // fix when communicating with server... - selectCurrentWindows( arry ); // fix when communicating with server... - cbxChanged(); + // Display only the default windows. + selectCurrentWindows( new ArrayCollection() ); } public function popupInformationWindow(window:int):void @@ -226,6 +224,8 @@ cbxPickerA.dataProvider = currInfoWindowsDescriptions; cbxPickerB.dataProvider = currInfoWindowsDescriptions; + + cbxChanged(); } public function cbxChanged():void @@ -260,9 +260,25 @@ } } - public function loadBlock(module:Module, block:Block):void + public function loadBlock(block:Block, module:Module=null):void { + if(block != null) + { + currBlock = block; + + var tempArray:ArrayCollection = new ArrayCollection(); + for(var i:int = 0; i<currBlock.informationWindows.length; i++) + { + var temp:InformationWindow = (currBlock.informationWindows.getItemAt(i) as InformationWindow); + tempArray.addItem(temp.id); + } + selectCurrentWindows( tempArray ); + } + if(module != null) + { + currModule = module; + } } ]]> Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-08-25 00:20:46 UTC (rev 269) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-08-25 19:54:34 UTC (rev 270) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="custom.db.questions.*" xmlns:basicComp="custom.db.*" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #80FFAA]" - width="100%" height="100%" clipContent="false" layout="absolute" currentState="none" initialize="init()"> + width="100%" height="100%" clipContent="false" layout="absolute" currentState="none" initialize="init()" xmlns:custom="custom.*"> <mx:Script> <![CDATA[ import mx.binding.utils.BindingUtils; @@ -1661,10 +1661,10 @@ <mx:GridRow width="100%" height="100%" id="gridrow2"> <mx:GridItem width="100%" height="100%" id="griditem1"> <mx:Button label="Remove Item" id="butRemModule" click ="{removeItem()}"/> - </mx:GridItem> - - + <mx:GridItem width="100%" height="100%" id="griditem100"> + <custom:InformationWindowButton superParent="{this}"/> + </mx:GridItem> </mx:GridRow> </mx:Grid> Modified: mentalmodels/trunk/flex/src/_InstructionsTest.mxml =================================================================== --- mentalmodels/trunk/flex/src/_InstructionsTest.mxml 2009-08-25 00:20:46 UTC (rev 269) +++ mentalmodels/trunk/flex/src/_InstructionsTest.mxml 2009-08-25 19:54:34 UTC (rev 270) @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="custom.*" xmlns:as="actionscript.*" - layout="horizontal" - backgroundGradientColors="[#FFFFFF, #B0B0FF]" xmlns:strategyDesign="custom.questions.strategyDesign.*" xmlns:dayByDayDecisions="custom.questions.dayByDayDecisions.*"> + layout="vertical" + backgroundGradientColors="[#FFFFFF, #B0B0FF]" xmlns:strategyDesign="custom.questions.strategyDesign.*" xmlns:dayByDayDecisions="custom.questions.dayByDayDecisions.*" xmlns:psychometric="custom.questions.psychometric.*"> + <comp:InformationWindowButton superParent="{this}"/> + + <comp:InstructionPage id="ins" initialize="ins.init(makeBlock())"/> + <mx:VBox> <mx:Button id="save" click="save_click()" label="Save"/> <mx:Button id="load" click="load_click()" label="Load"/> Modified: mentalmodels/trunk/flex/src/actionscript/Round.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Round.as 2009-08-25 00:20:46 UTC (rev 269) +++ mentalmodels/trunk/flex/src/actionscript/Round.as 2009-08-25 19:54:34 UTC (rev 270) @@ -1,6 +1,8 @@ package actionscript { + import mx.collections.ArrayCollection; + [Bindable] [RemoteClass(alias="edu.asu.commons.mme.entity.Round")] public class Round Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-25 00:20:46 UTC (rev 269) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-25 19:54:34 UTC (rev 270) @@ -109,7 +109,6 @@ public var currentRoundNumber:int = 0; [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); - public var blockLoader:Function = null; public var shell:FisheryExperimentShell = null; public var updateObjectA:InformationWindowCreator = null; @@ -276,14 +275,60 @@ } private function blockResultHandler(event:ResultEvent):void { + if(currentState == "none") + { + Alert.show("Block received in End of Game state.","Unexpected Block"); + return; + } + else if(currentState == "wait") + { + loadNextBlock(event.result as actionscript.Block); + } + else if(currentState == "instructions") + { + finishBlockEarly(); + loadNextBlock(event.result as actionscript.Block); + } + else if(currentState == "socioDemographic") + { + currentState = "none"; + Alert.show("Block received in Socio Demographic state.","Unexpected Block"); + } + else if(currentState == "instructionsLoad") + { + currentState = "none"; + Alert.show("Block received in Instructions (load) state.","Unexpected Block"); + } + } + + private function finishBlockEarly():void + { + + } + + private function saveDataToShell():void + { + shell.updateObjectA.updateDayByDayDecisions(instructions.savedDayByDayDecisions); + shell.updateObjectA.updateForecasting(instructions.savedForecastFish, instructions.savedForecastPeople); + shell.updateObjectA.updateStrategyDesign(instructions.savedStrategyDesign); + + shell.updateObjectB.updateDayByDayDecisions(instructions.savedDayByDayDecisions); + shell.updateObjectB.updateForecasting(instructions.savedForecastFish, instructions.savedForecastPeople); + shell.updateObjectB.updateStrategyDesign(instructions.savedStrategyDesign); + } + + private function loadNextBlock(nextBlock:Block):void + { // save questions from previous Block if(currentBlock != null) { sendBlockQuestions(); + instructions.saveData(); + saveDataToShell(); } // update with new block - currentBlock = (event.result as actionscript.Block); + currentBlock = nextBlock; if(currentBlock == null || currentBlock.questionGroups == null @@ -355,6 +400,11 @@ private function studentResultHandler(event:ResultEvent):void { + if(event.result == null) + { + Alert.show("event.result is null"); + } + Alert.show("GameCode is '" + (event.result as actionscript.Student).gameCode + "'"); studentObject = event.result as actionscript.Student; consumer.disconnect(); } @@ -418,7 +468,7 @@ obj.visible = false; expiredContent.addChild(obj); - var newStudent:actionscript.Student = new Student(); + var newStudent:actionscript.Student = new actionscript.Student(); newStudent.birthYear = ((obj as SocioDemographicPage).getYear() as int); newStudent.gender = (obj as SocioDemographicPage).getGender(); newStudent.major = (obj as SocioDemographicPage).getMajor(); Added: mentalmodels/trunk/flex/src/custom/InformationWindowButton.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InformationWindowButton.mxml (rev 0) +++ mentalmodels/trunk/flex/src/custom/InformationWindowButton.mxml 2009-08-25 19:54:34 UTC (rev 270) @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center"> + + <mx:Text width="{idBox.width}" text="Click the button to show popup with that ID"/> + + <mx:HBox id="idBox"> + <mx:Label text="Window ID #:"/> + <mx:NumericStepper id="stpValue" minimum="0" maximum="15" value="0" stepSize="1"/> + </mx:HBox> + + <mx:Button id="btnPopup" label="Show Popup" click="on_click()"/> + + <mx:Script> + <![CDATA[ + import mx.events.CloseEvent; + import mx.controls.Alert; + import mx.managers.PopUpManager; + import actionscript.InformationWindowCreator; + import mx.collections.ArrayCollection; + + private var windows:ArrayCollection = InformationWindowCreator.makeWindows().getItemAt(0) as ArrayCollection; + public var superParent:DisplayObject = null; + private var old:InformationWindowPopup = null; + + private function on_click():void + { + if(superParent == null) superParent = this; + + if(old != null) + { + old.titleWindow_close(new CloseEvent("")); + } + + if(stpValue.value < windows.length) + { + var popup:InformationWindowPopup = PopUpManager.createPopUp(superParent, InformationWindowPopup, false) as InformationWindowPopup; + + var window:ArrayCollection = windows.getItemAt(stpValue.value) as ArrayCollection; + for(var i:int=0; i<window.length; i++) + { + popup.addChild(window.getItemAt(i) as DisplayObject); + } + + PopUpManager.centerPopUp(popup); + old = popup; + } + } + + ]]> + </mx:Script> + +</mx:VBox> Modified: mentalmodels/trunk/flex/src/custom/InformationWindowPopup.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InformationWindowPopup.mxml 2009-08-25 00:20:46 UTC (rev 269) +++ mentalmodels/trunk/flex/src/custom/InformationWindowPopup.mxml 2009-08-25 19:54:34 UTC (rev 270) @@ -13,9 +13,17 @@ public var valid:Boolean = true; public var window:int = -1; - private function titleWindow_close(evt:CloseEvent):void + public function titleWindow_close(evt:CloseEvent):void { - closedFunction.call(this,window); + if(closedFunction != null) + { + closedFunction.call(this,window); + } + else + { + removeAllChildren(); + PopUpManager.removePopUp(this); + } } ]]> </mx:Script> Modified: mentalmodels/trunk/flex/src/custom/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-08-25 00:20:46 UTC (rev 269) +++ mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-08-25 19:54:34 UTC (rev 270) @@ -3,6 +3,8 @@ <mx:Script> <![CDATA[ + import custom.questions.strategyDesign.StrategyDesignQuestionC; + import custom.questions.dayByDayDecisions.DayByDayDecisionsQuestionC; import actionscript.Location; import actionscript.QuestionGroup; import actionscript.Module; @@ -26,7 +28,6 @@ public var savedForecastFish:ArrayCollection = null; public var savedStrategyDesign:ArrayCollection = null; public var savedDayByDayDecisions:ArrayCollection = null; -// public var savedDayByDayDecisions:ArrayCollection = null; private function newLocation(maxCapacity:Number,growth:Number):Location { @@ -178,6 +179,30 @@ } } + public function saveData():void + { + var currPageArray:Array = (pageDisplay.currentPage as VBox).getChildren(); + for(var i:int = 0; i < currPageArray.length; i++) + { + if(currPageArray[i] is ForecastingPeopleQuestionC) + { + savedForecastPeople = (currPageArray[i] as ForecastingPeopleQuestionC).save(); + } + else if(currPageArray[i] is ForecastingFishQuestionC) + { + savedForecastFish = (currPageArray[i] as ForecastingFishQuestionC).save(); + } + else if(currPageArray[i] is DayByDayDecisionsQuestionC) + { + savedDayByDayDecisions = (currPageArray[i] as DayByDayDecisionsQuestionC).save(); + } + else if(currPageArray[i] is StrategyDesignQuestionC) + { + savedStrategyDesign = (currPageArray[i] as StrategyDesignQuestionC).save(); + } + } + } + public function save():ArrayCollection { var saveArray:ArrayCollection = new ArrayCollection(); Modified: mentalmodels/trunk/flex/src/test.mxml =================================================================== --- mentalmodels/trunk/flex/src/test.mxml 2009-08-25 00:20:46 UTC (rev 269) +++ mentalmodels/trunk/flex/src/test.mxml 2009-08-25 19:54:34 UTC (rev 270) @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:actionscript="actionscript.*"> + <actionscript:Student id="stu" gameCode="test1" birthYear="1991" gender="M" major="cse"/> + <mx:HBox> <mx:Button label="roundService.getBlock()" click="roundService.getBlock()"/> <mx:Button label="roundService.getCurrentRound()" click="roundService.getCurrentRound()"/> - <mx:Button label="startupService.createStudent()" click="startupService.createStudent()"/> + <mx:Button label="startupService.createStudent()" click="startupService.createStudent(stu)"/> <mx:Button label="answeringService.saveStrategy()" click="answeringService.saveStrategy()"/> <mx:Button label="locationService.getAllLocations()" click="locationService.getAllLocations()"/> </mx:HBox> Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/test.html =================================================================== --- mentalmodels/trunk/src/main/webapp/test.html 2009-08-25 00:20:46 UTC (rev 269) +++ mentalmodels/trunk/src/main/webapp/test.html 2009-08-25 19:54:34 UTC (rev 270) @@ -28,6 +28,15 @@ <style> body { margin: 0px; overflow:hidden } </style> + +<script language="JavaScript"> + window.onbeforeunload = confirmExit; + function confirmExit() + { + return "If you are connected to the server, you will be disconnected if the page closes. Students in the experiment will be removed if the window closes."; + } +</script> + <script language="JavaScript" type="text/javascript"> <!-- // ----------------------------------------------------------------------------- @@ -44,8 +53,12 @@ </head> <body scroll="no"> + <script language="JavaScript" type="text/javascript"> <!-- + +var clientIP = '<!--#echo var="REMOTE_ADDR"-->'; + // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65) var hasProductInstall = DetectFlashVer(6, 0, 65); @@ -57,12 +70,12 @@ // Location visited after installation is complete if installation is required var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn"; var MMredirectURL = window.location; - document.title = document.title.slice(0, 47) + " - Flash Player Installation"; - var MMdoctitle = document.title; + document.title = document.title.slice(0, 47) + " - Flash Player Installation"; + var MMdoctitle = document.title; AC_FL_RunContent( "src", "playerProductInstall", - "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"", + "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+'&ip=test'+clientIP+"", "width", "100%", "height", "100%", "align", "middle", @@ -82,27 +95,30 @@ "width", "100%", "height", "100%", "align", "middle", + "valign", "middle", "id", "test", "quality", "high", "bgcolor", "#869ca7", "name", "test", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", - "pluginspage", "http://www.adobe.com/go/getflashplayer" + "pluginspage", "http://www.adobe.com/go/getflashplayer", + "FlashVars", "ip=test"+clientIP+"" ); - } else { // flash is too old or we can't detect the plugin - var alternateContent = 'Alternate HTML content should be placed here. ' - + 'This content requires the Adobe Flash Player. ' - + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; - document.write(alternateContent); // insert non-flash content +} else { // flash is too old or we can't detect the plugin + var alternateContent = 'Alternate HTML content should be placed here. ' + + 'This content requires the Adobe Flash Player. ' + + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; + document.write(alternateContent); // insert non-flash content } // --> </script> <noscript> - <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="test" width="100%" height="100%" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> <param name="movie" value="test.swf" /> + <PARAM NAME=FlashVars VALUE="ip=test${clientIP}"> <param name="quality" value="high" /> <param name="bgcolor" value="#869ca7" /> <param name="allowScriptAccess" value="sameDomain" /> Modified: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-28 23:26:05
|
Revision: 271 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=271&view=rev Author: seematalele Date: 2009-08-28 23:25:58 +0000 (Fri, 28 Aug 2009) Log Message: ----------- Finally blocks are pushed to the client and also to StartGame In StartGame.java 5 blocks are pushed for testing purpose after every 20 seconds. When client received the first block it gets an error on DayByDayDecisionQuestionC.mxml on line number 175 Client are getting subsequent blocks (Tested using Alert.show) but is not displaying question groups in the browser Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml mentalmodels/trunk/flex/src/StartGame.mxml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml Modified: mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-08-25 19:54:34 UTC (rev 270) +++ mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-08-28 23:25:58 UTC (rev 271) @@ -76,6 +76,9 @@ <mx:Script> <![CDATA[ + import mx.messaging.events.MessageEvent; + import mx.messaging.MessageAgent; + import mx.messaging.messages.IMessage; import actionscript.InformationWindow; import mx.controls.Alert; import mx.controls.Label; @@ -85,6 +88,7 @@ import mx.collections.ArrayCollection; import custom.InformationWindowPopup; import mx.managers.PopUpManager; + import mx.messaging.events.MessageFaultEvent; public var popupA:InformationWindowPopup = null; public var popupB:InformationWindowPopup = null; @@ -102,6 +106,16 @@ public var currModule:Module = null; public var currBlock:Block = null; + public function faultMsgHandler(msgevent:MessageFaultEvent):void + { + Alert.show("Error in getting message: " + msgevent.faultString); + } + + public function messageHandler(msg:IMessage):void + { + var str:String = msg.body as String; + Alert.show("String came from server: " + str); + } public function init():void { // temporarily store all 3 objects returned... @@ -120,6 +134,7 @@ // Display only the default windows. selectCurrentWindows( new ArrayCollection() ); + } public function popupInformationWindow(window:int):void Modified: mentalmodels/trunk/flex/src/StartGame.mxml =================================================================== --- mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-25 19:54:34 UTC (rev 270) +++ mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-28 23:25:58 UTC (rev 271) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init()" creationComplete="initLogging()"> <mx:VBox visible="{pageNum==0}" horizontalAlign="center"> <mx:HBox horizontalAlign="right" width="330" id="firstBox"> @@ -30,25 +30,77 @@ <mx:RemoteObject id="startupService" destination="startupService" fault="faultHandler(event)"> <mx:method name="createGame" result="gameObjectResultHandler(event)"/> - <mx:method name="startGame" result="noResultHandler(event)"/> + <mx:method name="startGame"/> </mx:RemoteObject> + + <mx:Consumer id="consumer" destination="chat" message="messageHandler(event)" fault="faultMsgHandler(event)" channelSet="{cs}" /> + + <mx:ChannelSet id="cs"> + <!--<mx:StreamingAMFChannel url="http://localhost:8080/mme/messagebroker/streamingamf"/>--> + <mx:AMFChannel url="http://localhost:8080/mme/messagebroker/amfpolling"/> + <mx:AMFChannel url="http://localhost:8080/mme/messagebroker/amflongpolling"/> + + </mx:ChannelSet> <mx:Script> <![CDATA[ + import mx.messaging.events.MessageEvent; import actionscript.Game; import actionscript.Block; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import mx.controls.Alert; + import mx.messaging.messages.IMessage; + import mx.messaging.events.MessageAckEvent; + import mx.messaging.events.MessageFaultEvent; + import mx.messaging.FlexClient; + import mx.messaging.messages.AsyncMessage; + import mx.logging.*; + import mx.logging.targets.*; + + private const logger:ILogger = Log.getLogger("StartGame.mxml"); + [Bindable]private var pageNum:int = 0; + public var currentBlock:Block = null; + public function init():void + { + + } + private function initLogging():void { + // Create a target. + var logTarget:TraceTarget = new TraceTarget(); + + // Log only messages for the classes in the mx.rpc.* and + // mx.messaging packages. + logTarget.filters=["mx.rpc.*","mx.messaging.*"]; + + // Log all log levels. + logTarget.level = LogEventLevel.ALL; + + // Add date, time, category, and log level to the output. + logTarget.includeDate = true; + logTarget.includeTime = true; + logTarget.includeCategory = true; + logTarget.includeLevel = true; + + // Begin logging. + Log.addTarget(logTarget); + } + + // Universal Fault Handler public function faultHandler(event:FaultEvent):void { Alert.show(event.fault.getStackTrace()); } + public function faultMsgHandler(msgevent:MessageFaultEvent):void + { + Alert.show("Error in getting message: " + msgevent.faultString); + } + // Button Click Events public function create():void { @@ -64,12 +116,23 @@ gameObject.title = "test Game Title"; startupService.createGame(gameObject); + /* var message:AsyncMessage = new AsyncMessage(); + message.body = "got gameObject" + gameObject.description; + producer.send(message); + Alert.show("message is send"); */ + consumer.subscribe(); + Alert.show("subscribed to destination: " + consumer.destination); + } public function start():void { btnStartGame.enabled = false; + /*consumer.subscribe(); + Alert.show("subscribed to destination: " + consumer.destination);*/ startupService.startGame(); + //consumer.subtopic = "hello3"; + } public function getResponses():void { @@ -94,6 +157,21 @@ } + private function messageHandler(event:MessageEvent):void + { + //Alert.show("message from server came.."); + var block:actionscript.Block = event.message.body as actionscript.Block; + Alert.show("String came from server is: " + block.id + " " + block.description); + + + /* if(currentBlock == null) + { + Alert.show("Game is over!!"); + } + else + Alert.show("Block from server is : " + currentBlock.description); */ + } + ]]> </mx:Script> Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-08-25 19:54:34 UTC (rev 270) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-08-28 23:25:58 UTC (rev 271) @@ -17,13 +17,11 @@ import edu.asu.commons.mme.entity.CategoricalQuestion; import edu.asu.commons.mme.entity.Game; import edu.asu.commons.mme.entity.InformationWindow; -import edu.asu.commons.mme.entity.Location; import edu.asu.commons.mme.entity.Module; import edu.asu.commons.mme.entity.ModuleRoundConfig; import edu.asu.commons.mme.entity.Question; import edu.asu.commons.mme.entity.QuestionGroup; import edu.asu.commons.mme.entity.Round; -import edu.asu.commons.mme.entity.RoundLocation; @Transactional public class RoundService extends Service.Base<Round, HibernateRoundConfigDao> { Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-08-25 19:54:34 UTC (rev 270) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-08-28 23:25:58 UTC (rev 271) @@ -1,7 +1,7 @@ package edu.asu.commons.mme.service; import java.util.List; - +import org.apache.log4j.Logger; import edu.asu.commons.mme.entity.Block; import edu.asu.commons.mme.entity.Game; import edu.asu.commons.mme.entity.ModuleRoundConfig; @@ -13,6 +13,7 @@ public class StartGame extends Thread { + private static Logger logger = Logger.getLogger(StartGame.class); private boolean running; private RoundService roundService; private LocationService locationService; @@ -73,31 +74,22 @@ MessageBroker msgBroker = MessageBroker.getMessageBroker("_messageBroker"); String clientID = UUIDUtils.createUUID(); int i=0; - while (i<3) { + while (i<5) { i++; String msgDestination = roundService.getCurrentGame().getDescription(); - /*if(getCurrentModuleRoundConfig() == null) - { - setCurrentModuleRoundConfig(new ModuleRoundConfig()); - System.out.println("new currentmoduleroundconfig is created."); - }*/ //Push the first block to the clients AsyncMessage msg = new AsyncMessage(); - msg.setDestination("mme"); - //msg.setHeader("DSSubtopic", "hello"); + msg.setDestination("chat"); + //msg.setHeader("DSSubtopic", "hello3"); msg.setClientId(clientID); msg.setMessageId(UUIDUtils.createUUID()); msg.setTimestamp(System.currentTimeMillis()); - -// System.out.println("in while loop: "); block = roundService.getBlock(); - // System.out.println("after block "); msg.setBody(block); msgBroker.routeMessageToService(msg, null); - System.out.println("Message broker is: "+ msgBroker); - System.out.println("Message is: "+ block.getDescription()); + logger.debug("message is sent to the client: " + msg); /* if(block.getDescription().equalsIgnoreCase("Day-by-day decisions game")) { @@ -115,7 +107,7 @@ //start the timer for the block sent try { //for testing purpose 5000 is given as an argument - Thread.sleep(10000); + Thread.sleep(20000); if(block == null) { running = false; @@ -125,10 +117,9 @@ } + } - - - + private boolean isGameOver() { // TODO Auto-generated method stub Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-08-25 19:54:34 UTC (rev 270) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-08-28 23:25:58 UTC (rev 271) @@ -15,6 +15,7 @@ import flex.messaging.util.UUIDUtils; @Transactional + public class StartupService implements ApplicationContextAware { //private QuestionCreatorService questionCreatorService; Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-08-25 19:54:34 UTC (rev 270) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-08-28 23:25:58 UTC (rev 271) @@ -182,8 +182,8 @@ <flex:remoting-destination ref="feed" /> <!-- Expose services for Flex/BlazeDS messaging --> - <flex:message-destination id="mme" allow-subtopics="true" subtopic-separator="." /> - + <flex:message-destination id="chat" /> + <flex:message-destination id="mme" /> <!-- Flex related information ended--> <bean id="mmeDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties 2009-08-25 19:54:34 UTC (rev 270) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/classes/log4j.properties 2009-08-28 23:25:58 UTC (rev 271) @@ -11,5 +11,5 @@ # Add packages to log log4j.logger.edu.asu.commons=DEBUG -log4j.logger.org.springframework=ERROR +log4j.logger.org.springframework=DEBUG log4j.logger.org.hibernate=ERROR Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml 2009-08-25 19:54:34 UTC (rev 270) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/flex/messaging-config.xml 2009-08-28 23:25:58 UTC (rev 271) @@ -1,34 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> -<service id="message-service" class="flex.messaging.services.MessageService" - messageTypes="flex.messaging.messages.AsyncMessage"> +<service id="message-service" + class="flex.messaging.services.MessageService"> - <adapters> - <adapter-definition id="actionscript" - class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" - default="true" /> - <!-- - <adapter-definition id="jms" - class="flex.messaging.services.messaging.adapters.JMSAdapter"/> - --> - <adapter-definition id="DataPushAdapter" class="StartupService" /> - </adapters> + <adapters> + <adapter-definition id="actionscript" + class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" + default="true"/> + </adapters> - <default-channels> - <channel ref="my-polling-amf" /> - <channel ref="my-streaming-amf" /> - </default-channels> - - <!--<destination id="mme"> - <properties> - <server> - <allow-subtopics>true</allow-subtopics> - <subtopic-separator>.</subtopic-separator> - </server> - </properties> - <channels> - <channel ref="my-streaming-amf" /> - </channels> - <adapter ref="DataPushAdapter"/> - - </destination> --> - </service> + <default-channels> + <channel ref="my-polling-amf"/> + </default-channels> + +</service> \ No newline at end of file Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml 2009-08-25 19:54:34 UTC (rev 270) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/flex/services-config.xml 2009-08-28 23:25:58 UTC (rev 271) @@ -1,104 +1,99 @@ -<?xml version="1.0" encoding="UTF-8"?> -<services-config> - <services> - <service-include file-path="remoting-config.xml"/> - <service-include file-path="proxy-config.xml"/> - <service-include file-path="messaging-config.xml"/> - <default-channels> - <channel ref="my-amf"/> - </default-channels> - </services> - <security> - <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/> - <!-- Uncomment the correct app server - <login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss"> - <login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/> - <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/> - <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/> - --> - <!-- - <security-constraint id="basic-read-access"> - <auth-method>Basic</auth-method> - <roles> - <role>guests</role> - <role>accountants</role> - <role>employees</role> - <role>managers</role> - </roles> - </security-constraint> - --> - </security> - <channels> - <channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel"> - <endpoint url="http://{server.name}:{server.port}/{context.root}/msgbroker/streamingamf" class="flex.messaging.endpoints.StreamingAMFEndpoint"/> - <properties> - <idle-timeout-minutes>0</idle-timeout-minutes> - <max-streaming-clients>10</max-streaming-clients> - <server-to-client-heartbeat-millis>5000</server-to-client-heartbeat-millis> - <user-agent-settings> - <user-agent match-on="MSIE" kickstart-bytes="2048" max-streaming-connections-per-session="3"/> - <user-agent match-on="Firefox" kickstart-bytes="2048" max-streaming-connections-per-session="3"/> - </user-agent-settings> - - </properties> - </channel-definition> - <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> - <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> - </channel-definition> - <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel"> - <endpoint url="https://{server.name}:{server.port}/{context.root}/msgbroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/> - <properties> - <add-no-cache-headers>false</add-no-cache-headers> - </properties> - </channel-definition> - <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel"> - <endpoint url="http://{server.name}:{server.port}/{context.root}/msgbroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/> - <properties> - <polling-enabled>true</polling-enabled> - <polling-interval-seconds>4</polling-interval-seconds> - </properties> - </channel-definition> - <!-- - <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel"> - <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/> - </channel-definition> - - <channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel"> - <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/> - <properties> - <add-no-cache-headers>false</add-no-cache-headers> - </properties> - </channel-definition> - --> - </channels> - <logging> - <target class="flex.messaging.log.ConsoleTarget" level="Error"> - <properties> - <prefix>[BlazeDS] </prefix> - <includeDate>false</includeDate> - <includeTime>false</includeTime> - <includeLevel>false</includeLevel> - <includeCategory>false</includeCategory> - </properties> - <filters> - <pattern>Endpoint.*</pattern> - <pattern>Service.*</pattern> - <pattern>Configuration</pattern> - </filters> - </target> - </logging> - <system> - <redeploy> - <enabled>false</enabled> - <!-- - <watch-interval>20</watch-interval> - <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file> - <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file> - <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file> - <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file> - <watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file> - <touch-file>{context.root}/WEB-INF/web.xml</touch-file> - --> - </redeploy> - </system> -</services-config> +<?xml version="1.0" encoding="UTF-8"?> +<services-config> + + <services> + <service-include file-path="proxy-config.xml" /> + <!-- <service-include file-path="messaging-config.xml" /> --> + + <default-channels> + <channel ref="my-amf"/> + + </default-channels> + + </services> + + + + <channels> + + <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> + </channel-definition> + + <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel"> + <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/> + <properties> + <add-no-cache-headers>false</add-no-cache-headers> + </properties> + </channel-definition> + + <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/> + <properties> + <polling-enabled>true</polling-enabled> + <polling-interval-seconds>4</polling-interval-seconds> + </properties> + </channel-definition> + + <channel-definition id="my-longpolling-amf" class="mx.messaging.channels.AMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amflongpolling" class="flex.messaging.endpoints.AMFEndpoint"/> + <properties> + <polling-enabled>true</polling-enabled> + <polling-interval-seconds>5</polling-interval-seconds> + <!-- <wait-interval-millis>60000</wait-interval-millis>--> +<!-- <client-wait-interval-millis>1</client-wait-interval-millis>--> + <max-waiting-poll-requests>200</max-waiting-poll-requests> + </properties> + </channel-definition> + + <channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf" class="flex.messaging.endpoints.StreamingAMFEndpoint"/> + </channel-definition> + + <!-- + <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel"> + <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/> + </channel-definition> + + <channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel"> + <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/> + <properties> + <add-no-cache-headers>false</add-no-cache-headers> + </properties> + </channel-definition> + --> + </channels> + + <logging> + <target class="flex.messaging.log.ConsoleTarget" level="Warn"> + <properties> + <prefix>[BlazeDS] </prefix> + <includeDate>false</includeDate> + <includeTime>false</includeTime> + <includeLevel>false</includeLevel> + <includeCategory>false</includeCategory> + </properties> + <filters> + <pattern>Endpoint.*</pattern> + <pattern>Service.*</pattern> + <pattern>Configuration</pattern> + </filters> + </target> + </logging> + + <system> + <redeploy> + <enabled>false</enabled> + <!-- + <watch-interval>20</watch-interval> + <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file> + <watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file> + <touch-file>{context.root}/WEB-INF/web.xml</touch-file> + --> + </redeploy> + </system> + +</services-config> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-31 21:30:28
|
Revision: 273 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=273&view=rev Author: seematalele Date: 2009-08-31 21:30:14 +0000 (Mon, 31 Aug 2009) Log Message: ----------- 1) Changed the text editor layouts in Block, Question, QuestionGroup. 2) Tried putting the interface for adding information window into the block section but it is not finished. 3) Entered the information windows into the database manually. 4) Updated init-mme.sql Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/flex/src/custom/db/Block.mxml mentalmodels/trunk/flex/src/custom/db/Question.mxml mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-08-31 18:50:59 UTC (rev 272) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-08-31 21:30:14 UTC (rev 273) @@ -4,6 +4,7 @@ width="100%" height="100%" clipContent="false" layout="absolute" currentState="none" initialize="init()" xmlns:custom="custom.*"> <mx:Script> <![CDATA[ + import actionscript.InformationWindow; import mx.binding.utils.BindingUtils; import actionscript.Block; @@ -26,7 +27,7 @@ /**** * Sample exmaple of Survey Questions structure * <module title="Preexperiment" sequenceNo="1" hours="0" min="3" sec="0" id="1"> - <block name="Introduction" sequenceNo="1" hours="0" min="3" sec="0" id="1"> + <block name="Introduction" sequenceNo="1" hours="0" min="3" sec="0" id="1" informationWindows="Help,Dummy Window,Model of the Fishing Ground"> <questiongroup header="Welcome to E-Fishery Experiment" description="In this experiment you will design..." sequenceNo="1" hours="0" min="3" sec="0" id="1" /> @@ -189,6 +190,23 @@ newBlockNode.@sec = block.getSeconds(); newBlockNode.@id = block.id; + var infoWindowTitles:String = ""; + for(var i:int = 0; i < block.informationWindows.length; i++) + { + if(infoWindowTitles == "") + { + var infoWindow:actionscript.InformationWindow = actionscript.InformationWindow(block.informationWindows.getItemAt(i)); + infoWindowTitles = infoWindow.title; + } + else + { + infoWindow = actionscript.InformationWindow(block.informationWindows.getItemAt(i)); + infoWindowTitles = infoWindowTitles + infoWindow.title; + } + infoWindowTitles = infoWindowTitles + ","; + } + + newBlockNode.@informaitionWindows = infoWindowTitles; return newBlockNode; } @@ -691,6 +709,7 @@ blockXML[0].@hours = block.getHours(); blockXML[0].@min = block.getMinutes(); blockXML[0].@sec = block.getSeconds(); + } } else Modified: mentalmodels/trunk/flex/src/custom/db/Block.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/db/Block.mxml 2009-08-31 18:50:59 UTC (rev 272) +++ mentalmodels/trunk/flex/src/custom/db/Block.mxml 2009-08-31 21:30:14 UTC (rev 273) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" > +<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:custom="custom.*" > <mx:Script> <![CDATA[ import mx.validators.NumberValidator; @@ -83,8 +83,6 @@ } - - public function validateForm(event:Event):Boolean { // Save a reference to the currently focussed form control @@ -157,7 +155,7 @@ <mx:Spacer height="20" /> <mx:FormItem label="Description:"> <!-- <mx:TextArea id="txtName" change="{validateForm(event)}"/> --> - <mx:RichTextEditor id="rchtxtDescription" change="{validateForm(event)}" title="Block Description" width="500" height="500" /> + <mx:RichTextEditor id="rchtxtDescription" change="{validateForm(event)}" title="Block Description" width="100%" height="300" /> </mx:FormItem> <mx:Spacer height="20" /> <mx:FormItem label="Duration(hr:min:sec):"> @@ -170,10 +168,14 @@ <mx:NumericStepper id="seconds" minimum="0" maximum="60" stepSize="1" change="{getSeconds()}"/> </mx:HBox> - - - </mx:FormItem> +<mx:FormItem label="Available Information Windows"> + <custom:InformationWindowButton superParent="{this}"/> +</mx:FormItem> + +<mx:FormItem label="Associated Information Windows"> + <custom:InformationWindowButton superParent="{this}"/> +</mx:FormItem> <mx:NumberValidator id ="validateSeqNo" source="{txtSeqNo}" property="text" minValue="1" maxValue="1000" domain="int"/> </mx:Form> Modified: mentalmodels/trunk/flex/src/custom/db/Question.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/db/Question.mxml 2009-08-31 18:50:59 UTC (rev 272) +++ mentalmodels/trunk/flex/src/custom/db/Question.mxml 2009-08-31 21:30:14 UTC (rev 273) @@ -204,7 +204,7 @@ <mx:Spacer height="20" /> <mx:FormItem label="Question:"> <!-- <mx:TextArea id="rchtxtQuestion" change="{validateForm(event)}"/> --> - <mx:RichTextEditor id="rchtxtQuestion" change="{validateForm(event)}" title="Question Editor" width="500" height="500" /> + <mx:RichTextEditor id="rchtxtQuestion" change="{validateForm(event)}" title="Question Editor" width="100%" height="300" /> </mx:FormItem> <mx:Spacer height="20" /> <mx:FormItem label= "Is this question for communication Round?"> Modified: mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml 2009-08-31 18:50:59 UTC (rev 272) +++ mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml 2009-08-31 21:30:14 UTC (rev 273) @@ -183,8 +183,8 @@ <mx:FormItem label="Decsription:"> - <!-- <mx:TextArea id="txtDescription" change="{validateForm(event)}" width="100%" height="100"/> --> - <mx:RichTextEditor id="rchtxtDescription" change="{validateForm(event)}" title="Question Group Description" width="500" height="500" /> + <!-- <mx:TextArea id="txtDescription" change="{validateForm(event)}" width="300" height="300"/> --> + <mx:RichTextEditor id="rchtxtDescription" change="{validateForm(event)}" title="Question Group Description" width="100%" height="300" /> </mx:FormItem> Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-31 18:50:59 UTC (rev 272) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-31 21:30:14 UTC (rev 273) @@ -361,7 +361,7 @@ PRIMARY KEY (`id`), KEY `FK349B7A631F51CEC1` (`block_id`), CONSTRAINT `FK349B7A631F51CEC1` FOREIGN KEY (`block_id`) REFERENCES `block` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=91 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -370,6 +370,7 @@ LOCK TABLES `information_window` WRITE; /*!40000 ALTER TABLE `information_window` DISABLE KEYS */; +INSERT INTO `information_window` VALUES (1,1,'Dummy',1),(2,2,'Problem Presentation',1),(3,1,'Problem Presentation',2),(4,2,'Help For Strategy Design',2),(5,1,'Problem Presentation',3),(6,2,'Own Strategy',3),(7,1,'Problem Presentation',4),(8,2,'Own Strategy',4),(9,3,'Help For Strategy Design',4),(10,4,'Own Goals',4),(11,5,'Forecast',4),(12,1,'Problem Presentation',5),(13,2,'Own Strategy',5),(14,1,'Problem Presentation',6),(15,2,'Own Strategy',6),(16,3,'Own Goals',6),(17,4,'Forecast',6),(18,5,'Results of Day-By-Day decisions',6),(19,6,'Results of strategy',6),(20,1,'Problem Presentation',7),(21,2,'Own Strategy',7),(22,1,'Problem Presentation',8),(23,2,'Own Strategy',8),(24,3,'Help For Strategy Design',8),(25,4,'Forecast',8),(26,5,'Results of Day-By-Day decisions',8),(27,6,'Results of strategy',8),(28,7,'Planned changes to strategy',8),(29,8,'Conclusions from communication',8),(30,2,'Problem Presentation',1),(31,1,'Problem Presentation',2),(32,2,'Help For Strategy Design',2),(33,1,'Problem Presentation',3),(34,2,'Own Strategy',3),(35,1,'Problem Presentation',4),(36,2,'Own Strategy',4),(37,3,'Help For Strategy Design',4),(38,4,'Own Goals',4),(39,5,'Forecast',4),(40,1,'Problem Presentation',5),(41,2,'Own Strategy',5),(42,1,'Problem Presentation',6),(43,2,'Own Strategy',6),(44,3,'Own Goals',6),(45,4,'Forecast',6),(46,5,'Results of Day-By-Day decisions',6),(47,6,'Results of strategy',6),(48,1,'Problem Presentation',7),(49,2,'Own Strategy',7),(50,1,'Problem Presentation',8),(51,2,'Own Strategy',8),(52,3,'Help For Strategy Design',8),(53,4,'Forecast',8),(54,5,'Results of Day-By-Day decisions',8),(55,6,'Results of strategy',8),(56,7,'Planned changes to strategy',8),(57,8,'Conclusions from communication',8),(58,1,'Problem Presentation',9),(59,2,'Own Strategy',9),(60,3,'Forecast',9),(61,4,'Results of Day-By-Day decisions',9),(62,5,'Results of strategy',9),(63,6,'Planned changes to strategy',9),(64,7,'Conclusions from communication',9),(65,1,'Problem Presentation',10),(66,2,'Help For Strategy Design',10),(67,3,'Own Strategy',10),(68,4,'Own Goals',10),(69,5,'Forecast',10),(70,6,'Results of Day-By-Day decisions',10),(71,7,'Results of strategy',10),(72,8,'Planned changes to strategy',10),(73,9,'Conclusions from communication',10),(74,1,'Problem Presentation',12),(75,2,'Help For Strategy Design',12),(76,3,'Own Strategy',12),(77,4,'Own Goals',12),(78,5,'Forecast',12),(79,6,'Results of Day-By-Day decisions',12),(80,7,'Results of strategy',12),(81,8,'Planned changes to strategy',12),(82,9,'Conclusions from communication',12),(83,1,'Problem Presentation',13),(84,2,'Own Strategy',13),(85,3,'Results of Day-By-Day decisions',13),(86,4,'Results of strategy',13),(87,1,'Problem Presentation',14),(88,2,'Own Strategy',14),(89,3,'Results of Day-By-Day decisions',14),(90,4,'Results of strategy',14); /*!40000 ALTER TABLE `information_window` ENABLE KEYS */; UNLOCK TABLES; @@ -817,4 +818,4 @@ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2009-08-21 22:03:41 +-- Dump completed on 2009-08-31 21:27:49 Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-31 22:30:59
|
Revision: 274 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=274&view=rev Author: seematalele Date: 2009-08-31 22:30:50 +0000 (Mon, 31 Aug 2009) Log Message: ----------- -- Was getting error so, removed the code in createBlock function in InitialiseDatabase.mxml. -- Added a block (day by day decision game interface) for Module 1 and removed the question group and also question associated for the node Day by Day decisions. Now Module 1 contains 2 blocks. 1 is Introduction while other is Day-by-day decisions. Added question group and question for newly added block. -- init-mme is changed accordingly. Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-08-31 21:30:14 UTC (rev 273) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-08-31 22:30:50 UTC (rev 274) @@ -190,7 +190,7 @@ newBlockNode.@sec = block.getSeconds(); newBlockNode.@id = block.id; - var infoWindowTitles:String = ""; + /* var infoWindowTitles:String = ""; for(var i:int = 0; i < block.informationWindows.length; i++) { if(infoWindowTitles == "") @@ -206,7 +206,7 @@ infoWindowTitles = infoWindowTitles + ","; } - newBlockNode.@informaitionWindows = infoWindowTitles; + newBlockNode.@informaitionWindows = infoWindowTitles; */ return newBlockNode; } Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-31 21:30:14 UTC (rev 273) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-31 22:30:50 UTC (rev 274) @@ -31,7 +31,7 @@ PRIMARY KEY (`id`), KEY `FK597C48D4D4A8AF3` (`module_id`), CONSTRAINT `FK597C48D4D4A8AF3` FOREIGN KEY (`module_id`) REFERENCES `module` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40,7 +40,7 @@ LOCK TABLES `block` WRITE; /*!40000 ALTER TABLE `block` DISABLE KEYS */; -INSERT INTO `block` VALUES (1,'Introduction',1080,1,1),(2,'Design Strategy',1080,1,2),(3,'Characterizing own strategy',1020,2,2),(4,'Editing strategy',300,3,2),(5,'Day-by-day decisions game',360,4,2),(6,'Evaluation of Outcomes',660,5,2),(7,'Communication',360,1,3),(8,'Design Strategy',300,1,4),(9,'Characterizing own strategy',540,2,4),(10,'Editing strategy',180,3,4),(11,'Day-by-day decisions game',360,4,4),(12,'Evaluation of Outcomes',360,5,4),(13,'Final data gathering',120,1,5),(14,'Debriefing',120,2,5),(15,'Communication - Questions',480,2,3); +INSERT INTO `block` VALUES (1,'Introduction',1080,1,1),(2,'Design Strategy',1080,1,2),(3,'Characterizing own strategy',1020,2,2),(4,'Editing strategy',300,3,2),(5,'Day-by-day decisions game',360,4,2),(6,'Evaluation of Outcomes',660,5,2),(7,'Communication',360,1,3),(8,'Design Strategy',300,1,4),(9,'Characterizing own strategy',540,2,4),(10,'Editing strategy',180,3,4),(11,'Day-by-day decisions game',360,4,4),(12,'Evaluation of Outcomes',360,5,4),(13,'Final data gathering',120,1,5),(14,'Debriefing',120,2,5),(15,'Communication - Questions',480,2,3),(16,'Day-by-day decisions game',345,2,1); /*!40000 ALTER TABLE `block` ENABLE KEYS */; UNLOCK TABLES; @@ -527,7 +527,7 @@ PRIMARY KEY (`id`), KEY `FKBA823BE6CA626674` (`question_group_id`), CONSTRAINT `FKBA823BE6CA626674` FOREIGN KEY (`question_group_id`) REFERENCES `question_group` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=153 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=154 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -536,7 +536,7 @@ LOCK TABLES `question` WRITE; /*!40000 ALTER TABLE `question` DISABLE KEYS */; -INSERT INTO `question` VALUES (1,0,'Most important goal:',1,'categorical',10),(2,0,'Second most important goal:',2,'categorical',10),(3,0,'Third most important goal:',4,'categorical',10),(4,0,'Compared to the most important goal, this goal is',3,'psychometric',10),(6,0,'',1,'daybydaydecisions',6),(7,0,'An example of a scale would be',1,'psychometric',11),(8,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',12),(9,0,'Compared to the most important goal, this goal is',5,'psychometric',10),(10,0,'<b>Most important goal:</b>',1,'categorical',13),(11,0,'<b>Second most important goal:</b>',2,'categorical',13),(12,0,'Compared to the most important goal, this goal is',3,'psychometric',13),(13,0,'<b>Third most important goal:</b>',4,'categorical',13),(14,0,'Compared to the most important goal, this goal is',5,'psychometric',13),(15,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',14),(16,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',14),(17,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',14),(18,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',14),(19,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',14),(20,0,'How much do you trust the others in your group?',1,'psychometric',15),(21,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',15),(22,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',15),(23,1,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',15),(24,1,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',15),(25,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',16),(26,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',16),(27,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',16),(28,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',16),(29,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',16),(30,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',17),(31,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',17),(32,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',17),(33,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',17),(34,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',17),(35,0,'',1,'forecastingfishermen',18),(36,0,'',1,'forecastingfish',19),(37,0,'',1,'strategydesign',9),(38,0,'',1,'strategydesign',22),(39,0,'',1,'daybydaydecisions',24),(40,0,'',1,'psychometric',27),(41,0,'… better understand the dynamics of the fish population.',1,'psychometric',29),(42,0,'… better understand the other fishermen in my group.',2,'psychometric',29),(43,0,'… better understand how to design the strategy.',3,'psychometric',29),(44,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',29),(45,0,'… appraise the other fishermen in my group differently. Now I think about the others…',5,'psychometric',29),(46,0,'… better understand the dynamics of the fish population.',1,'psychometric',30),(47,0,'… better understand the other fishermen.',2,'psychometric',30),(48,0,'… better understand how to design the strategy.',3,'psychometric',30),(49,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',30),(50,0,'… appraise the other fishermen in my group differently. Now I think about the others …',5,'psychometric',30),(51,0,'Did the communication have any form of reference to how to fish or design the strategy?',1,'categorical',31),(54,0,'',1,'psychometric',32),(55,0,'',2,'psychometric',32),(56,0,'',3,'psychometric',32),(57,0,'',4,'psychometric',32),(58,0,'',5,'psychometric',32),(59,0,'How clear is it to you, that you have to fish conforming to this rule, agreement or coordination attempt?',1,'psychometric',33),(60,0,'Do you think the other fishermen understood how they have to act according to this rule?<br>I think the others… ',2,'psychometric',33),(61,0,'Will you follow the rule, agreement, or coordination attempt that emerged from communication?<br>I will follow the rule…',3,'psychometric',33),(62,0,'Do you think, the other fishermen in you group will follow the rule, agreement, or coordination attempt?<br>\rI think, the others will… ',4,'psychometric',33),(63,0,'Considering the effects you expect for following the rule and your expectations of how the group will follow the rule, do you think the group will do better or worse due to the rule?',5,'psychometric',33),(64,0,'New understanding of fish dynamics',1,'text',34),(65,0,'New Expectations on how the others of the group will act',2,'text',34),(66,0,'Ideas for improving your strategy',3,'text',34),(67,0,'How interesting was the experiment for you?',1,'psychometric',35),(68,0,'How would you rate the effort you invested to design your strategy?',2,'psychometric',35),(69,0,'How difficult was it to understand the problem?',3,'psychometric',35),(70,0,'How difficult was it to find a good strategy?',4,'psychometric',35),(71,0,'How clear was it what you had to do?',5,'psychometric',35),(72,0,'How many times have you participated in problem solving experiments similar to this one?',1,'text',36),(73,0,'If you already participated in such experiments, when was the last time?',2,'categorical',36),(74,0,'Comments and Feedback',1,'text',37),(75,0,'',1,'strategydesign',40),(76,0,'',1,'strategydesign',53),(77,0,'',1,'daybydaydecisions',55),(78,0,'',1,'psychometric',58),(79,0,'',2,'psychometric',27),(80,0,'I feel the outcomes are:',3,'psychometric',27),(81,0,'',1,'psychometric',59),(82,0,'',2,'psychometric',59),(83,0,'',3,'psychometric',59),(84,0,'',4,'psychometric',59),(85,0,'',5,'psychometric',59),(86,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',60),(87,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough.',2,'psychometric',60),(88,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',60),(89,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',60),(90,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',60),(91,0,'The group was too uncoordinated',6,'psychometric',60),(92,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',60),(93,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',60),(94,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',61),(95,0,'New understanding of fish dynamics',1,'text',62),(96,0,'New expectations on how the others of the group will act',2,'text',62),(97,0,'Ideas for improving your strategy',3,'text',62),(98,0,'',2,'psychometric',58),(99,0,'I feel the outcomes are:',3,'psychometric',58),(100,0,'',1,'psychometric',63),(101,0,'',2,'psychometric',63),(102,0,'',3,'psychometric',63),(103,0,'',4,'psychometric',63),(104,0,'',5,'psychometric',63),(105,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',64),(106,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough',2,'psychometric',64),(107,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',64),(108,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',64),(109,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',64),(110,0,'The group was too uncoordinated',6,'psychometric',64),(111,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',64),(112,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',64),(113,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',65),(114,0,'New understanding of fish dynamics',1,'text',66),(115,0,'New expectations on how the others of the group will act',2,'text',66),(116,0,'Ideas for improving your strategy',3,'text',66),(117,0,'Describe in your own words what the rule, agreement, or other coordination attempt states. Describe how you and the others should act and what would happen if one does not act in this way.<br>\rIf you cannot identify any sort of coordination attempt in the communication, write \"no coordination\" in the field below.<br>\r(The information you write in this field will be available the next time you edit your strategy.)',2,'text',31),(118,0,'How often do you play strategy games (i.e. any games where you have to anticipate the moves of other players and plan your own moves ahead, like computer games, card games, board games, etc)?',3,'categorical',36),(120,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',42),(121,0,'Most important goal:',1,'categorical',43),(122,0,'Second most important goal:',2,'categorical',43),(123,0,'Compared to the most important goal, this goal is',3,'psychometric',43),(124,0,'Third most important goal:',4,'categorical',43),(125,0,'Compared to the most important goal, this goal is',5,'psychometric',43),(126,0,'<b>Most important goal:</b>',1,'categorical',44),(127,0,'<b>Second most important goal:</b>',2,'categorical',44),(128,0,'Compared to the most important goal, this goal is',3,'psychometric',44),(129,0,'<b>Third most important goal:</b>',4,'categorical',44),(130,0,'Compared to the most important goal, this goal is',5,'psychometric',44),(131,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',45),(132,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',45),(133,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',45),(134,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',45),(135,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',45),(136,0,'How much do you trust the others in your group?',1,'psychometric',46),(137,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',46),(138,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',46),(139,0,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',46),(140,0,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',46),(141,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',47),(142,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',47),(143,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',47),(144,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',47),(145,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',47),(146,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',48),(147,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',48),(148,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',48),(149,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',48),(150,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',48),(151,0,'',1,'forecastingfishermen',49),(152,0,'',1,'forecastingfish',50); +INSERT INTO `question` VALUES (1,0,'Most important goal:',1,'categorical',10),(2,0,'Second most important goal:',2,'categorical',10),(3,0,'Third most important goal:',4,'categorical',10),(4,0,'Compared to the most important goal, this goal is',3,'psychometric',10),(7,0,'An example of a scale would be',1,'psychometric',11),(8,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',12),(9,0,'Compared to the most important goal, this goal is',5,'psychometric',10),(10,0,'<b>Most important goal:</b>',1,'categorical',13),(11,0,'<b>Second most important goal:</b>',2,'categorical',13),(12,0,'Compared to the most important goal, this goal is',3,'psychometric',13),(13,0,'<b>Third most important goal:</b>',4,'categorical',13),(14,0,'Compared to the most important goal, this goal is',5,'psychometric',13),(15,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',14),(16,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',14),(17,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',14),(18,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',14),(19,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',14),(20,0,'How much do you trust the others in your group?',1,'psychometric',15),(21,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',15),(22,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',15),(23,1,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',15),(24,1,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',15),(25,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',16),(26,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',16),(27,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',16),(28,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',16),(29,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',16),(30,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',17),(31,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',17),(32,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',17),(33,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',17),(34,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',17),(35,0,'',1,'forecastingfishermen',18),(36,0,'',1,'forecastingfish',19),(37,0,'',1,'strategydesign',9),(38,0,'',1,'strategydesign',22),(39,0,'',1,'daybydaydecisions',24),(40,0,'',1,'psychometric',27),(41,0,'… better understand the dynamics of the fish population.',1,'psychometric',29),(42,0,'… better understand the other fishermen in my group.',2,'psychometric',29),(43,0,'… better understand how to design the strategy.',3,'psychometric',29),(44,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',29),(45,0,'… appraise the other fishermen in my group differently. Now I think about the others…',5,'psychometric',29),(46,0,'… better understand the dynamics of the fish population.',1,'psychometric',30),(47,0,'… better understand the other fishermen.',2,'psychometric',30),(48,0,'… better understand how to design the strategy.',3,'psychometric',30),(49,0,'… feel a ‘team spirit’ in the group.',4,'psychometric',30),(50,0,'… appraise the other fishermen in my group differently. Now I think about the others …',5,'psychometric',30),(51,0,'Did the communication have any form of reference to how to fish or design the strategy?',1,'categorical',31),(54,0,'',1,'psychometric',32),(55,0,'',2,'psychometric',32),(56,0,'',3,'psychometric',32),(57,0,'',4,'psychometric',32),(58,0,'',5,'psychometric',32),(59,0,'How clear is it to you, that you have to fish conforming to this rule, agreement or coordination attempt?',1,'psychometric',33),(60,0,'Do you think the other fishermen understood how they have to act according to this rule?<br>I think the others… ',2,'psychometric',33),(61,0,'Will you follow the rule, agreement, or coordination attempt that emerged from communication?<br>I will follow the rule…',3,'psychometric',33),(62,0,'Do you think, the other fishermen in you group will follow the rule, agreement, or coordination attempt?<br>\rI think, the others will… ',4,'psychometric',33),(63,0,'Considering the effects you expect for following the rule and your expectations of how the group will follow the rule, do you think the group will do better or worse due to the rule?',5,'psychometric',33),(64,0,'New understanding of fish dynamics',1,'text',34),(65,0,'New Expectations on how the others of the group will act',2,'text',34),(66,0,'Ideas for improving your strategy',3,'text',34),(67,0,'How interesting was the experiment for you?',1,'psychometric',35),(68,0,'How would you rate the effort you invested to design your strategy?',2,'psychometric',35),(69,0,'How difficult was it to understand the problem?',3,'psychometric',35),(70,0,'How difficult was it to find a good strategy?',4,'psychometric',35),(71,0,'How clear was it what you had to do?',5,'psychometric',35),(72,0,'How many times have you participated in problem solving experiments similar to this one?',1,'text',36),(73,0,'If you already participated in such experiments, when was the last time?',2,'categorical',36),(74,0,'Comments and Feedback',1,'text',37),(75,0,'',1,'strategydesign',40),(76,0,'',1,'strategydesign',53),(77,0,'',1,'daybydaydecisions',55),(78,0,'',1,'psychometric',58),(79,0,'',2,'psychometric',27),(80,0,'I feel the outcomes are:',3,'psychometric',27),(81,0,'',1,'psychometric',59),(82,0,'',2,'psychometric',59),(83,0,'',3,'psychometric',59),(84,0,'',4,'psychometric',59),(85,0,'',5,'psychometric',59),(86,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',60),(87,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough.',2,'psychometric',60),(88,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',60),(89,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',60),(90,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',60),(91,0,'The group was too uncoordinated',6,'psychometric',60),(92,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',60),(93,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',60),(94,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',61),(95,0,'New understanding of fish dynamics',1,'text',62),(96,0,'New expectations on how the others of the group will act',2,'text',62),(97,0,'Ideas for improving your strategy',3,'text',62),(98,0,'',2,'psychometric',58),(99,0,'I feel the outcomes are:',3,'psychometric',58),(100,0,'',1,'psychometric',63),(101,0,'',2,'psychometric',63),(102,0,'',3,'psychometric',63),(103,0,'',4,'psychometric',63),(104,0,'',5,'psychometric',63),(105,0,'I did not understand the dynamics of the fish population well enough.',1,'psychometric',64),(106,0,'Some of the other fishermen did not understand the dynamics of the fish population well enough',2,'psychometric',64),(107,0,'The actions of the others in my group did not help my strategy work well.',3,'psychometric',64),(108,0,'Some of the other fishermen acted too reluctantly (harvested too few).',4,'psychometric',64),(109,0,'Some of the other fishermen acted too aggressively (harvested too much).',5,'psychometric',64),(110,0,'The group was too uncoordinated',6,'psychometric',64),(111,0,'The group did not follow the rules or agreements that emerged from the communication enough.',7,'psychometric',64),(112,0,'The rules or agreements that emerged from the communication did not work out well.',8,'psychometric',64),(113,0,'What were the most important reasons for you to deviate from your strategy during the day-by-day decisions?<br>\rIf you did not deviate from your strategy then please write something like \"No difference\" in the text field.',1,'text',65),(114,0,'New understanding of fish dynamics',1,'text',66),(115,0,'New expectations on how the others of the group will act',2,'text',66),(116,0,'Ideas for improving your strategy',3,'text',66),(117,0,'Describe in your own words what the rule, agreement, or other coordination attempt states. Describe how you and the others should act and what would happen if one does not act in this way.<br>\rIf you cannot identify any sort of coordination attempt in the communication, write \"no coordination\" in the field below.<br>\r(The information you write in this field will be available the next time you edit your strategy.)',2,'text',31),(118,0,'How often do you play strategy games (i.e. any games where you have to anticipate the moves of other players and plan your own moves ahead, like computer games, card games, board games, etc)?',3,'categorical',36),(120,0,'<ul>\r<li>Why did you design the strategy the way you did? What did you consider and why do you think your strategy is an adequate solution?</li>\r<li>What actions do you expect from the other fishermen in your group? Why do you think, they might act this way?</li>\r<li>How do you think your strategy will work? Will the fish population grow or shrink in the different bays? What earnings do you expect?</li>\r</ul>\r',1,'text',42),(121,0,'Most important goal:',1,'categorical',43),(122,0,'Second most important goal:',2,'categorical',43),(123,0,'Compared to the most important goal, this goal is',3,'psychometric',43),(124,0,'Third most important goal:',4,'categorical',43),(125,0,'Compared to the most important goal, this goal is',5,'psychometric',43),(126,0,'<b>Most important goal:</b>',1,'categorical',44),(127,0,'<b>Second most important goal:</b>',2,'categorical',44),(128,0,'Compared to the most important goal, this goal is',3,'psychometric',44),(129,0,'<b>Third most important goal:</b>',4,'categorical',44),(130,0,'Compared to the most important goal, this goal is',5,'psychometric',44),(131,0,'Over all, how much do like your group (i.e. the other players)?',1,'psychometric',45),(132,0,'How important is it for you what the others think about you and your behavior (i.e. your reputation in the group)?',2,'psychometric',45),(133,0,'How important is it for you that the others can reach their goals (i.e. the outcomes are fair)?',3,'psychometric',45),(134,0,'What do you think, how important is it for the others that you can reach your goals (i.e. the outcomes are fair)?',4,'psychometric',45),(135,0,'Do you perceive the group as a team or as competing players?',5,'psychometric',45),(136,0,'How much do you trust the others in your group?',1,'psychometric',46),(137,0,'How important is it for you that the others in your group can and do trust you?',2,'psychometric',46),(138,0,'How much do you think your group trying to coordinate their actions to reach better outcomes for all?',3,'psychometric',46),(139,0,'How much are you trying to follow rules or agreements that emerged from the communication?',4,'psychometric',46),(140,0,'How much do you think <i>the others</i> are trying to follow rules or agreements that emerged from the communica-tion?',5,'psychometric',46),(141,0,'Do you feel a sense of ‘commitment’ to act in the way you specified in your strategy?',1,'psychometric',47),(142,0,'Would you feel any discomfort or tension if you would act differently than you specified in your strategy?',2,'psychometric',47),(143,0,'Do you feel any sort of ‘social pressure’ to act in the way you specified in your strategy?',3,'psychometric',47),(144,0,'Would you feel guilt or shame if you had acted differently than you specified in your strategy?',4,'psychometric',47),(145,0,'Are you afraid of some sort of ‘punishment’ if you had acted differently as specified in your strategy?',5,'psychometric',47),(146,0,'How well did you understand the dynamics of the fish population?',1,'psychometric',48),(147,0,'Did the others in your group understand the dynamics better or worse than you?',2,'psychometric',48),(148,0,'How confident are you in having developed a strategy that leads to ‘good’ outcomes regarding your goals?',3,'psychometric',48),(149,0,'How much does your strategy depend on how the others in the group will act to reach the desired outcomes?',4,'psychometric',48),(150,0,'Would you classify your strategy as ‘safe’ in the sense of having acceptable but suboptimal results for sure, or rather as ‘risky’ in the sense of having the optimal results if everything runs like expected or very poor results otherwise?',5,'psychometric',48),(151,0,'',1,'forecastingfishermen',49),(152,0,'',1,'forecastingfish',50),(153,0,'',1,'daybydaydecisions',67); /*!40000 ALTER TABLE `question` ENABLE KEYS */; UNLOCK TABLES; @@ -557,7 +557,7 @@ PRIMARY KEY (`id`), KEY `FK8F8090E61F51CEC1` (`block_id`), CONSTRAINT `FK8F8090E61F51CEC1` FOREIGN KEY (`block_id`) REFERENCES `block` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -566,7 +566,7 @@ LOCK TABLES `question_group` WRITE; /*!40000 ALTER TABLE `question_group` DISABLE KEYS */; -INSERT INTO `question_group` VALUES (1,'In this experiment you will design a strategy to fish in an abstract fishing ground together with three other persons. As we are mainly interested in the reasons <i>why</i> you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no correct or wrong strategies and no correct or wrong answers. However, since for each pound of fish you get during the experiment you will receive $1.00 US, you might be interested in finding a strategy that fits your goals well. For this, you will need to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group.',30,'<b>Welcome to the E-Fishery Experiment</b>',1,1),(2,'<p>The experiment will run as follows:</p> <ul> <li><b>Introduction</b>: We will explain the interface and how the dynamics of the fish population are modeled. We will also ask you some questions about you and you will have the opportunity to make your decisions on how to fish on a (simulated) day-by-day basis to get a feeling for the dynamics of the fish population. </li> <li><b>Strategy design 1</b>: You will design a fishing strategy that will be simulated together with the strategies of the other persons in your group, and we ask you a larger amount of questions to understand your decisions and to help you reflect on those decisions. </li> <li><b>Fishing and evaluation 1</b>: Besides simulating the strategies you will decide on how to fish on a (simulated) day-by-day basis. Then, we will ask you some questions on your evaluation of the results. </li> <li><b>Communication</b>:You will have the opportunity to chat with the other persons in your group. After the chat we will ask some questions to asses your evaluation of the communication. </li> <li><b>Strategy design, fishing and evaluation 2</b>: The strategy design, fishing and evaluation are repeated as described above. </li> <li><b>Finishing the experiment</b>: The experiment closes with some final questions and more information on the experiment, and you will have the opportunity to give a feedback if you wish to do so. </li> </ul> <p> In the <b>information bar above the main window</b> you can see which part of the experiment you are in, your progress and how you are doing with the time. </p>',30,'<b>Experimental procedure</b>',2,1),(3,'<p>The <b>information window "Fishing Ground"</b> gives you an overview that will be explained here.</p> <p> Imagine you are living on an island and your only income is from a species of fish that only survives in the shallow bays formed by the island. The fish can leave crowed bays and move to less crowded bays, but they cannot survive in the ocean. Nor can new fish arrive from the ocean. </p> <p> The fish population grows at a constant rate. Thus, the more fish are in a bay the faster the population grows. However, the population a bay can sustain is limited and fish leave crowed bays to find less crowded bays. The more crowded a bay, the more fish leave and the less fish enter the bay (the movement is directly proportional to the percentage to which a bay is filled up). The number of fish leaving the bay is proportional to the rate of growth, and the number of fish entering the bay is also proportional to the amount of fish leaving the three bays (i.e. fish in the ocean). </p> <p> The equations of these dynamics are given in the information windows. It is, however, not necessary to know them for designing a strategy. For this, you only have to <b>understand the following five principles</b>: </p> <ul> <li>If all bays are <b>filled up</b> with fish, then the total growth is highest, but all additional lbs of fish are lost to the ocean and the amount of fish in the bays stops growing.</li> <li>If the bays are <b>half filled</b>, then the amount of fish in the bays grows fastest.</li> <li>If the bays are <b>nearly empty</b>, the population grows very slowly.</li> <li>If there is <b>no fish</b> in any of the bays, there will be never any fish again.</li> <li>If there are both <b>crowded and empty</b> bays, a lot of fish move from the crowded to the empty bays.</li> </ul> ',120,'<b>How the dynamics of the fish population are modeled</b>',3,1),(4,'<p>The three bays are different in size and characteristics leading to different growth rates and capacities (i.e. the maximal amount of fish the bay can sustain). At the start of the simulation each bay is half filled.</p> <table> <thead> <th></th><th>Bay 1</th><th>Bay 2</th><th>Bay 3</th> </thead> <tbody> <tr> <td>Capacity:</td><td>10 lb</td><td>20 lb</td><td>30 lb</td> </tr> <tr> <td>Starts with:</td><td>5 lb</td><td>10 lb</td><td>15 lb</td> </tr> <tr> <td>Growth rate:</td><td>50% per day</td><td>15% per day</td><td>5% per day</td> </tr> </tbody> </table> <p> <b>How much fish</b> you take out in a day is <b>directly proportional with the extent that the bay is filled up with fish</b>. Your fishing gear allows you to harvest a maximum of 5 lbs. Thus, if the bay is completely filled up you get 5 lb of fish. If the bay is half filled, you get 2.5 lb of fish. If the bay is filled up only to 20 % you will get 1 lb, etc. The fish population is diminished by the same amount. If several persons fish the same bay and together would get more fish than the bay holds, then all the fish in the bay are distributed equally among these fishermen. </p> <p>However, you can <b>stay in the harbor</b> instead of fishing. This way, you do not get anything and the fish population is not diminished. </p> <p> Your task is to design a strategy of how to fish this fishing ground for 30 days together with three other persons (thus, with you the group compromises 4 persons). You will define the number of days that you stay in each bay or in the harbor. Please note that this is not an exam! We do not expect you to find the mathematically optimal solution to this problem. We want to know how you come up with a solution that sufficiently fulfills your goals. As long as we can understand why you choose a certain strategy you can come up with whatever you like. </p> ',120,'<b>Differences of bays and effects of fishing</b>',4,1),(5,'<p>Before designing the strategy, you have the opportunity to make your decisions on a day-by-day basis for the simulation. You will interact with the actual model of the fishing ground together with the other persons of your group. Thus, the problems and possibilities you will experience in this warm-up are relevant for the design of your strategy. </p> <p> The <b>interface</b> you will encounter on the next page has the following elements: <ul> <li>Information on the day of the simulation</li> <li>Buttons for your decision. If you want to fish in Bay 1, for example, click on Button "Bay 1". </li> <li>Time remaining. You have 10 seconds for each decision. If you do not press any button within these 10 seconds then you will stay in the harbor for this day. However, you can change your decision within these 10 seconds (i.e. if you clicked on "Bay 1" after 4 seconds and after another 4 seconds on "Bay 3", you will go to Bay 3). </li> <li>Table of past results. Your previous locations from past days are highlighted. The table shows you how much you fished and who else was in the same location as you. You do not have any information of locations where you not have been. </li> ',60,'<b>A warm-up</b>',5,1),(6,'',345,'<b>Day-by-day-decisions</b>',6,1),(7,'<p>In what we refer to as a \'strategy\' you predefine your decisions of where to go each day of the simulation.\r Al-though only 30 days will be simulated, your strategy should represent your decisions for an indefinite period. Therefore you define a <b>set of decisions that will be repeated</b> until the end of the simulation. The set can contain as many decisions as you want but try to use as few as possible. Remember: Often simple strategies are more effective!</p> <p>It might be that you want to base your set of repeated decisions on another state of the fish population. In this case you can define a set of not repeated decisions that are applied at the beginning of the simulation. For example, you might first stay in the harbor to let the fish population increase or first fish all the bays to reduce the fish population before you start the repeated sequence of decisions.</p> <p>In this strategy you define how many days you stay at a certain location and to which other location you will move on.\r If, for example, you define to repeat the sequence \"2 days in harbor - 3 days in Bay 1 - 2 days in Bay 2\" you will not fish for two days, then fish in Bay 1 for three days, then fish in Bay 2 for two days, then not fish for two days, then fish in Bay 1 for three days, etc.</p> ',480,'<b>Designing your Strategy</b>',1,2),(8,'<p>Your strategy is mainly based on the number of days you stay at a certain location. However, things might run differently than you expected and you might wish to leave a bay earlier than the days you specified because you get too few fish out of that bay. For doing so you can specify a threshold of income. If you fish less then this threshold, the next day you will not fish this bay anymore but move on to the next location specified in your strategy.</p> <p>Note: Thresholds refer to the quantity of fish you get during one day fishing in a bay and not, for example, to the quantity of fish in the bay, fish fished by others, sum of fish already fished, etc.</p> <p>The final option you have is to stop repeating your strategy and stay in the harbor for some days. This op-tion can be used to prevent the total destruction of the fish population. For this you define a threshold and a number of days. If during one repetition of your decision set you never fished the amount defined by the threshold, then you stay in the harbor for the specified number of days before you start the next repetition.</p> <p>Note: Intentionally we do not allow designing \'intelligent\' strategies that search for solutions during the game. You have to think about what would be the best solution for you and express it with the options explained above.</p> ',90,'<b>Some special features of the strategy design</b>',2,2),(9,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',480,'<b>Design your strategy</b>',3,2),(10,'<p>Please specify three goals that most influenced the design of your strategy. You can select from 18 different goals grouped in three categories (foci). </p><p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal.</p><p> The information you write into these fields will be available the next time you edit your strategy.</p>',30,'<b>What goals did you follow when designing your strategy?</b>',3,3),(11,'<p>We will ask you a number of questions on the strategy you just designed. This will help us to better understand how you came up with your strategy and it might help you reflect on certain aspects to improve your strategy.</p>\r<p>Besides <b>large fields</b> to write text and <b>small fields</b> to write numbers, you will encounter drop-down lists for selecting predefined values and scales. </p>\r<p>To give an answer on a scale, click on the location between the labels that comes closest to your opinion. By clicking on the scale, a slider appears that marks the value you selected. You can change the value by clicking on another position on the scale. By clicking on the reset button, the sliders of all scales on a page are removed and you can start selecting values again.</p>\r<p>Please try to answer all questions even if you are not sure. We are not testing your abilities but rather want to understand how you came up with your strategy.</p>\r',30,'<b>Introduction to questionnaire</b>',1,3),(12,'<p>Please explain your strategy with a few sentences. Particularly consider the following aspects:</p>',300,'<b>Explain the strategy in your own words</b>',2,3),(13,'<p>Specify the three goals that you think most influenced the design of the strategy of the other fishermen in your group. You can select from 18 different goals grouped in three categories (foci).</p>\r<p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal</p>\r',30,'<b>What goals do you think the others follow?</b>',4,3),(14,'',30,'<b>How do you perceive your group?</b>',5,3),(15,'',30,'<b>How much do you count on others and how much can they count on you?</b>',6,3),(16,'',30,'<b>What else influenced your strategy design?</b>',7,3),(17,'',60,'<b>How confident are you in reaching the outcomes you are expecting?</b>',8,3),(18,'<p>Fill in the following table your expectations of the others’ actions (i.e. the number of fishermen in each bay) for the first 15 days. Please note that we ask only for the expectations of where the others will go. </p>',180,'<b>What are you expecting the others will do?</b>',9,3),(19,'<p>Please enter in the table below your expectations of how the fish population develops within the first six days. Note that by clicking on “Update” the earnings and fish remaining in the bays is calculated, using your expecta-tions of the other’s actions and your strategy. Thus, you only have to think about how the fish population changes from one day to the next due to growth and movement of the fish. These estimations can be really rough. We do not expect you do perform detailed calculations.</p>\r<b>Note: You can only change the entries of one day at a time. To calculate the values and activate the next day for entries click on “Update”. You cannot return to previous days!</b>\r',180,'<b>What are you expecting how the fish population will develop?</b>',10,3),(20,'By clicking on “Accept” you will leave this part of the questionnaire and return to the strategy design. <b>You can-not return to this or previous pages!</b> However, important information for the design of your strategy will be available in information windows.',30,'<b>Leaving questionnaire on your strategy</b>',11,3),(21,'<p>The previous questions may have lead to some reflections on your strategy and you may wish to change some elements of it. Among the information windows you will find your previous strategy, your goals and your fore-cast.</p>\r<p>The time for editing your strategy depends on how fast you finished the questionnaire. For the next simulation we have to synchronize the group again. If you have been rather fast, you can think now more deeply about your strategy. If you are rather behind the time suggestion, you have to make your changes quickly.</p>\r<p>The interface for designing your strategy will not be explained again. If you are not sure about some elements, please refer to the information window “Help on strategy design”.</p>\r',30,'<b>Edit your strategy</b>',1,4),(22,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',240,'<b>Design your strategy</b>',2,4),(23,'<p>Before we present the results of your strategy, we would like to see again how you make your decisions day-by-day. On the next page you will find the same interface as you already used to decide on how to fish the modeled fishing grounds.</p>',15,'<b>Applying your strategy in day-by-day decisions</b>',1,5),(24,'',345,'<b>Day-by-day-decisions</b>',2,5),(25,'<p>We will now present you the results of your strategy. By clicking on “Accept” you cannot return to this or any previous page, but the results of your day-by-day decisions (and also of your strategy) will be available in an information window.</p>',15,'<b>Leaving day-bay-day decisions</b>',3,5),(26,'',60,'<b>Your strategy resulted in the following actions</b>',1,6),(27,'<p>First we want to know your emotional reactions to the results:</p>',30,'<b>What are your emotional reactions to the outcome?</b>',2,6),(28,'You can now chat for 5 minutes with the other fishermen in your group. You can talk about whatever you want as long as you…\r<ul><li>…do not reveal your identity.</li>\r<li>…do not threaten others with any consequence after the experiment is finished.</li>\r<li>…do not promise others side-payments after the experiment is completed.</li></ul>\rThe interface works like a text messenger. In the text box at the bottom you write your text and by clicking on “Send” you send this text to all other group members. In the large box in the center of the window you see all messages that have been sent during the communication.<br>\rAfter five minutes the “Send” button will be deactivated and the “Next” button activated. Please click then on “Next” to answer some questions about the communication. You can return to this page to see the communication protocol again.\r',360,'<b>Chat with the other fishermen in your group</b>',1,7),(29,'Due to the conversation, I now…',30,'<b>Did the communication have any effect on you?</b>',1,15),(30,'Due to the conversation, the other fishermen in my group…',30,'<b>What do you think were the effects of the communication on the others?</b>',2,15),(31,'',60,'<b>Did the communication lead to some sort of coordination of the fishing?</b>',3,15),(32,'The rule, agreement, or coordination attempt is… ',30,'<b>What is your opinion about the rule(s) that emerged from communication?</b>',4,15),(33,'',30,'<b>What will be the effects of the rule?</b>',5,15),(34,'In the fields below note what you have learned from the communication to improve your strategy.<br>\rThink about your understanding of the dynamics of the fish population, your expectations about the behavior of the other fishermen in your group and possibilities to improve your strategy. For each of these aspects a separate field is offered. This information will be available in the next round of designing your strategy.<br>\rIf you have no entry for one of the fields below, write “none” in the respective field.<br>\rThe information you write into these fields will be available the next time you edit your strategy.',300,'<b>Lessons learned<b>',6,15),(35,'Congratulations! You finished the actual experiment. We want to ask you some final questions.',30,'<b>Some final questions about the experiment</b>',1,13),(36,'',90,'<b>Some final questions about you</b>',2,13),(37,'Thank you for participating in this experiment. Your contribution will help to better understand the effects of communication on the performance of groups. We tested whether the communication led to…\r<ul>\r<li>…a different understanding of the dynamics of the fish population.</li>\r<li>…different expectations of how the others in your group will act.</li>\r<li>…changes in the goals you follow or you expect the others to follow.</li>\r<li>…a form of ‘group feeling’ or ‘team spirit’.</li>\r<li>…the emergence of rules, agreements or other forms of coordination attempts.</li>\r<li>…the emergence of some kind of social pressure or commitment.</li>\r</ul>\rBesides advancing science, the experiment also allowed you to earn the following money:<br>\rFor participating in the game: US$<br>\rFrom fish you caught: US$<br>\rTotal: US$<br>\rThe money will be paid to you in private. Wait till your computer number is called and then proceed to the conference room where you have signed up.<br>\rWe hope the experiment was satisfying to you.<br>\rWhen you are ready you can click on “Accept” to leave the experiment.<br>\r',120,'<b>The end</b>',1,14),(38,'<p>After seeing the results of your first strategy design and having chatted with your fellow fishermen, you might want to change some aspects of your strategy. On the next page you find the same interface you already used for designing your strategy. The explanation will not be repeated but if you forgot certain functionalities you can refer to the <b>information window \"Help for strategy design\".</b></p>',480,'<b>Improve your Strategy</b>',1,8),(40,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',480,'<b>Design your strategy</b>',2,8),(42,'<p>Please explain your strategy with a few sentences. Particularly consider the following aspects:</p>',120,'<b>Explain the strategy in your own words</b>',1,9),(43,'<p>Please specify three goals that most influenced the design of your strategy. You can select from 18 different goals grouped in three categories (foci). </p><p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal.</p><p> The information you write into these fields will be available the next time you edit your strategy.</p>',30,'<b>What goals did you follow when designing your strategy?</b>',2,9),(44,'<p>Specify the three goals that you think most influenced the design of the strategy of the other fishermen in your group. You can select from 18 different goals grouped in three categories (foci).</p>\r<p>First select the focus of the goal (earnings, fish population or the other fishermen). Based on this selection, the list on the right hand sight will be filled and you can select one of these goals. For the second and third most important goal, also state, how much less important they are in relation to the most important goal</p>\r',30,'<b>What goals do you think the others follow?</b>',3,9),(45,'',30,'<b>How do you perceive your group?</b>',4,9),(46,'',30,'<b>How much do you count on others and how much can they count on you?</b>',5,9),(47,'',30,'<b>What else influenced your strategy design?</b>',6,9),(48,'',30,'<b>How confident are you in reaching the outcomes you are expecting?</b>',7,9),(49,'<p>Fill in the following table your expectations of the others’ actions (i.e. the number of fishermen in each bay) for the first 15 days. Please note that we ask only for the expectations of where the others will go. </p>',180,'<b>What are you expecting the others will do?</b>',8,9),(50,'<p>Please enter in the table below your expectations of how the fish population develops within the first six days. Note that by clicking on “Update” the earnings and fish remaining in the bays is calculated, using your expecta-tions of the other’s actions and your strategy. Thus, you only have to think about how the fish population changes from one day to the next due to growth and movement of the fish. These estimations can be really rough. We do not expect you do perform detailed calculations.</p>\r<b>Note: You can only change the entries of one day at a time. To calculate the values and activate the next day for entries click on “Update”. You cannot return to previous days!</b>\r',180,'<b>What are you expecting how the fish population will develop?</b>',9,9),(51,'By clicking on “Accept” you will leave this part of the questionnaire and return to the strategy design. <b>You can-not return to this or previous pages!</b> However, important information for the design of your strategy will be available in information windows.',30,'<b>Leaving questionnaire on your strategy</b>',10,9),(52,'<p>The previous questions may have lead to some reflections on your strategy and you may wish to change some elements of it. Among the information windows you will find your previous strategy, your goals and your fore-cast.</p>\r<p>The time for editing your strategy depends on how fast you finished the questionnaire. For the next simulation we have to synchronize the group again. If you have been rather fast, you can think now more deeply about your strategy. If you are rather behind the time suggestion, you have to make your changes quickly.</p>\r<p>The interface for designing your strategy will not be explained again. If you are not sure about some elements, please refer to the information window “Help on strategy design”.</p>\r',30,'<b>Edit your strategy</b>',1,10),(53,'<p>Design your strategy by clicking on <b>\'New\'</b> and <b>\'Delete\'</b>. You have to specify at least one repeated decision! If you are not sure about the meaning of the concepts used, refer to the information window \'Help for strategy design\'. </br>\rWhen you are done, click on <b>\'Next\'</b> </p>',240,'<b>Design your strategy</b>',2,10),(54,'<p>Before we present the results of your strategy, we would like to see again how you make your decisions day-by-day. On the next page you will find the same interface as you already used to decide on how to fish the modeled fishing grounds.</p>',15,'<b>Applying your strategy in day-by-day decisions</b>',1,11),(55,'',345,'<b>Day-by-day-decisions</b>',2,11),(56,'<p>We will now present you the results of your strategy. By clicking on “Accept” you cannot return to this or any previous page, but the results of your day-by-day decisions (and also of your strategy) will be available in an information window.</p>',15,'<b>Leaving day-bay-day decisions</b>',3,11),(57,'',60,'<b>Your strategy resulted in the following actions</b>',1,12),(58,'<p>First we want to know your emotional reactions to the results:</p>',30,'<b>What are your emotional reactions to the outcome?</b>',2,12),(59,'',30,'<b>What is your evaluation of the outcome</b>',3,6),(60,'',60,'<b>What might be the causes for the outcome?</b>',4,6),(61,'If you open the results of the day-by-day decisions in one information window and your strategy in the other, you can compare the actions and developments.',120,'<b>Comparing your strategy with your day-by-day decisions</b>',5,6),(62,'In the fields below you can note what you have learned from the results of your strategy and the day-by-day decisions to improve your strategy.<br>\rThink about your understanding of the dynamics of the fish population, your expectations about the behavior of the other fishermen in your group and possibilities to improve your strategy. For each of these aspects we offer you a separate field. This information will be available in the next round of designing your strategy.<br>\rIf you have no entry for one of the fields below, write \"none\" in the respective field.',300,'<b>Lessons Learned</b>',6,6),(63,'',30,'<b>What is your evaluation of the outcome</b>',3,12),(64,'',60,'<b>What might be the causes for the outcome?</b>',4,12),(65,'If you open the results of the day-by-day decisions in one information window and your strategy... [truncated message content] |
From: <see...@us...> - 2009-09-24 19:16:50
|
Revision: 281 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=281&view=rev Author: seematalele Date: 2009-09-24 19:16:41 +0000 (Thu, 24 Sep 2009) Log Message: ----------- Can create multiple games. Tested it by creating and starting 2 games at different times Made changes in the startGame.mxml Changed the schema of mme Modified Paths: -------------- mentalmodels/trunk/flex/src/StartGame.mxml mentalmodels/trunk/src/main/db/init-mme.sql mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml Added Paths: ----------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameRoundDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameRound.java Modified: mentalmodels/trunk/flex/src/StartGame.mxml =================================================================== --- mentalmodels/trunk/flex/src/StartGame.mxml 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/flex/src/StartGame.mxml 2009-09-24 19:16:41 UTC (rev 281) @@ -33,7 +33,7 @@ <mx:method name="startGame"/> </mx:RemoteObject> - <mx:Consumer id="consumer" destination="chat" message="messageHandler(event)" fault="faultMsgHandler(event)" channelSet="{cs}" /> + <mx:Consumer id="consumer" destination="mme" message="messageHandler(event)" fault="faultMsgHandler(event)" channelSet="{cs}" /> <mx:ChannelSet id="cs"> <!--<mx:StreamingAMFChannel url="http://localhost:8080/mme/messagebroker/streamingamf"/>--> @@ -64,6 +64,7 @@ [Bindable]private var pageNum:int = 0; public var currentBlock:Block = null; + public var game:Game = null; public function init():void { @@ -120,8 +121,8 @@ message.body = "got gameObject" + gameObject.description; producer.send(message); Alert.show("message is send"); */ - consumer.subscribe(); - Alert.show("subscribed to destination: " + consumer.destination); + + } public function start():void @@ -130,7 +131,7 @@ /*consumer.subscribe(); Alert.show("subscribed to destination: " + consumer.destination);*/ - startupService.startGame(); + startupService.startGame(game); //consumer.subtopic = "hello3"; } @@ -144,8 +145,14 @@ { if(event.result != null) { - txtGameID.text = (event.result as Game).description; + + var description:String = (event.result as Game).description; btnStartGame.enabled = true; + game = event.result as Game; + txtGameID.text = description; + consumer.subtopic = description; + consumer.subscribe(); + Alert.show("subscribed to destination: " + consumer.destination); } else { @@ -161,15 +168,14 @@ { //Alert.show("message from server came.."); var block:actionscript.Block = event.message.body as actionscript.Block; - Alert.show("String came from server is: " + block.id + " " + block.description); + //Alert.show("String came from server is: " + block.id + " " + block.description); - - /* if(currentBlock == null) + if(block == null) { Alert.show("Game is over!!"); } else - Alert.show("Block from server is : " + currentBlock.description); */ + Alert.show("Block from server is : " + block.description); } ]]> Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-09-24 19:16:41 UTC (rev 281) @@ -292,29 +292,6 @@ -- Table structure for table `game` -- -DROP TABLE IF EXISTS `game`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `game` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `description` longtext, - `image_location` varchar(255) DEFAULT NULL, - `max_days` int(11) NOT NULL, - `max_fish_harvest` int(11) NOT NULL, - `money` double DEFAULT NULL, - `no_of_locations` int(11) NOT NULL, - `no_of_rounds` int(11) NOT NULL, - `timestamp` datetime NOT NULL, - `title` varchar(255) NOT NULL, - `current_block_id` bigint(20) DEFAULT NULL, - `current_round_id` bigint(20) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `FK304BF2F1265AC7` (`current_block_id`), - KEY `FK304BF219A3AF27` (`current_round_id`), - CONSTRAINT `FK304BF219A3AF27` FOREIGN KEY (`current_round_id`) REFERENCES `round_config` (`id`), - CONSTRAINT `FK304BF2F1265AC7` FOREIGN KEY (`current_block_id`) REFERENCES `block` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `game` @@ -330,29 +307,8 @@ -- Table structure for table `game_round_config` -- -DROP TABLE IF EXISTS `game_round_config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `game_round_config` ( - `game_id` bigint(20) NOT NULL, - `rounds_id` bigint(20) NOT NULL, - UNIQUE KEY `rounds_id` (`rounds_id`), - KEY `FKA0C2A407AC42F73` (`game_id`), - KEY `FKA0C2A40479268AA` (`rounds_id`), - CONSTRAINT `FKA0C2A40479268AA` FOREIGN KEY (`rounds_id`) REFERENCES `round_config` (`id`), - CONSTRAINT `FKA0C2A407AC42F73` FOREIGN KEY (`game_id`) REFERENCES `game` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; --- --- Dumping data for table `game_round_config` --- -LOCK TABLES `game_round_config` WRITE; -/*!40000 ALTER TABLE `game_round_config` DISABLE KEYS */; -/*!40000 ALTER TABLE `game_round_config` ENABLE KEYS */; -UNLOCK TABLES; - -- -- Table structure for table `grp` -- @@ -578,16 +534,6 @@ -- Table structure for table `round_config` -- -DROP TABLE IF EXISTS `round_config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `round_config` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `communication_flag` tinyint(1) NOT NULL DEFAULT '0', - `round_no` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `round_config` @@ -603,34 +549,8 @@ -- Table structure for table `round_config_location` -- -DROP TABLE IF EXISTS `round_config_location`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `round_config_location` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `location_id` bigint(20) NOT NULL, - `round_id` bigint(20) NOT NULL, - PRIMARY KEY (`id`), - KEY `FKC67B0361224FD013` (`location_id`), - KEY `FKC67B036147CF2321` (`round_id`), - CONSTRAINT `FKC67B036147CF2321` FOREIGN KEY (`round_id`) REFERENCES `round_config` (`id`), - CONSTRAINT `FKC67B0361224FD013` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; --- --- Dumping data for table `round_config_location` --- -LOCK TABLES `round_config_location` WRITE; -/*!40000 ALTER TABLE `round_config_location` DISABLE KEYS */; -/*!40000 ALTER TABLE `round_config_location` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `student` --- - DROP TABLE IF EXISTS `student`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameRoundDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameRoundDao.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameRoundDao.java 2009-09-24 19:16:41 UTC (rev 281) @@ -0,0 +1,11 @@ +package edu.asu.commons.mme.dao; + +import edu.asu.commons.mme.entity.GameRound; + +public class HibernateGameRoundDao extends HibernateDao<GameRound>{ + + public HibernateGameRoundDao() + { + super(GameRound.class); + } +} Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java 2009-09-24 19:16:41 UTC (rev 281) @@ -6,16 +6,15 @@ import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.Lob; -import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; import javax.persistence.Table; -import org.hibernate.annotations.CollectionOfElements; - @Entity @Table(name="game") public class Game implements Serializable { @@ -54,9 +53,8 @@ private String imageLocation; // FIXME: should this be many-to-many instead? - @ManyToMany - @CollectionOfElements - private List<Round> rounds; + @OneToMany(mappedBy = "game") + private List<GameRound> gameRounds; @ManyToOne @JoinColumn(name="current_round_id", nullable=true) @@ -66,6 +64,9 @@ @JoinColumn(name="current_block_id", nullable=true) private Block currentBlock; + @OneToMany(mappedBy = "game") + private List<Location> locations; + public void setId(Long id) { this.id = id; @@ -135,12 +136,7 @@ public void setImageLocation(String imageLocation) { this.imageLocation = imageLocation; } - public List<Round> getRounds() { - return rounds; - } - public void setRounds(List<Round> rounds) { - this.rounds = rounds; - } + public void setCurrentRound(Round currentRound) { this.currentRound = currentRound; } @@ -153,7 +149,18 @@ public Block getCurrentBlock() { return currentBlock; } - - + public void setLocations(List<Location> locations) { + this.locations = locations; + } + public List<Location> getLocations() { + return locations; + } + public void setGameRounds(List<GameRound> gameRounds) { + this.gameRounds = gameRounds; + } + public List<GameRound> getGameRounds() { + return gameRounds; + } + } Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameRound.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameRound.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/GameRound.java 2009-09-24 19:16:41 UTC (rev 281) @@ -0,0 +1,57 @@ +package edu.asu.commons.mme.entity; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "game_round_config") +public class GameRound implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -2918858356542877284L; + + @Id + @GeneratedValue + private Long id; + + @ManyToOne + @JoinColumn(nullable=false) + private Round round; + + @ManyToOne + @JoinColumn(nullable=false) + private Game game; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setRound(Round round) { + this.round = round; + } + + public Round getRound() { + return round; + } + + public void setGame(Game game) { + this.game = game; + } + + public Game getGame() { + return game; + } + +} Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-09-24 19:16:41 UTC (rev 281) @@ -21,8 +21,8 @@ @GeneratedValue private Long id; - @OneToMany(mappedBy = "location") - private List<RoundLocation> roundLocations; +/* @OneToMany(mappedBy = "location") + private List<RoundLocation> roundLocations;*/ @Column(nullable=false,name="location_name") private String locationName; @@ -87,12 +87,12 @@ public Double getCurrentPopulation() { return currentPopulation; } - public void setRoundLocations(List<RoundLocation> roundLocations) { + /*public void setRoundLocations(List<RoundLocation> roundLocations) { this.roundLocations = roundLocations; } public List<RoundLocation> getRoundLocations() { return roundLocations; - } + }*/ public void setFishLeaving(Double fishLeaving) { this.fishLeaving = fishLeaving; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/ModuleRoundConfig.java 2009-09-24 19:16:41 UTC (rev 281) @@ -8,6 +8,7 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; +import javax.persistence.OrderBy; import javax.persistence.Table; @@ -33,6 +34,7 @@ @ManyToOne @JoinColumn(nullable = false) + @OrderBy("sequenceNo") private Round round; public void setSequenceNo(Integer sequenceNo) { Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Round.java 2009-09-24 19:16:41 UTC (rev 281) @@ -24,9 +24,8 @@ @Column(name="round_no",nullable=false) private Integer roundNo; - /*@ManyToMany - @CollectionOfElements - private List<Game> game;*/ + @OneToMany(mappedBy = "round") + private List<GameRound> gameRounds; @Column(name="communication_flag",nullable=false,columnDefinition="Boolean default false") private boolean communicationFlag; @@ -35,9 +34,9 @@ private ModuleRoundConfig round_config;*/ - @OneToMany(mappedBy = "round") + /*@OneToMany(mappedBy = "round") private List<RoundLocation> roundLocations; - + */ public void setId(Long id) { this.id = id; } @@ -57,13 +56,20 @@ public boolean getCommunicationFlag() { return communicationFlag; } - public void setRoundLocations(List<RoundLocation> roundLocations) { + /*public void setRoundLocations(List<RoundLocation> roundLocations) { this.roundLocations = roundLocations; } public List<RoundLocation> getRoundLocations() { return roundLocations; + }*/ + public void setGameRounds(List<GameRound> gameRounds) { + this.gameRounds = gameRounds; } + public List<GameRound> getGameRounds() { + return gameRounds; + } + /*public void setRound_config(ModuleRoundConfig round_config) { this.round_config = round_config; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-09-24 19:16:41 UTC (rev 281) @@ -9,6 +9,7 @@ import edu.asu.commons.mme.dao.HibernateLocationDao; import edu.asu.commons.mme.entity.Game; import edu.asu.commons.mme.entity.Location; +import edu.asu.commons.mme.entity.Round; @Transactional public class LocationService extends Service.Base<Location, HibernateLocationDao>{ @@ -24,13 +25,24 @@ for(int i = 0; i < locations.size(); i++) { initLocation = locations.get(i); - Hibernate.initialize(initLocation); - Hibernate.initialize(initLocation.getRoundLocations()); - + initializeLocation(initLocation); } return locations; } + public void initializeLocation(Location location) { + // TODO Auto-generated method stub + Hibernate.initialize(location); + //Hibernate.initialize(location.getRoundLocations()); + Game game = location.getGame(); + Hibernate.initialize(game); + Hibernate.initialize(game); + Hibernate.initialize(game.getCurrentBlock()); + Hibernate.initialize(game.getCurrentRound()); + Hibernate.initialize(game.getGameRounds()); + Hibernate.initialize(game.getLocations()); + } + public Location getLocation(String locationName) { // TODO Auto-generated method stub @@ -94,5 +106,4 @@ getLogger().info("Saved Location " + bay3.getLocationName() +" with id "+ bay3.getId()); } - } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-09-24 19:16:41 UTC (rev 281) @@ -1,14 +1,17 @@ package edu.asu.commons.mme.service; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.hibernate.Hibernate; import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateBlockDao; import edu.asu.commons.mme.dao.HibernateGameDao; +import edu.asu.commons.mme.dao.HibernateGameRoundDao; import edu.asu.commons.mme.dao.HibernateModuleDao; import edu.asu.commons.mme.dao.HibernateModuleRoundConfigDao; import edu.asu.commons.mme.dao.HibernateRoundConfigDao; @@ -17,12 +20,15 @@ import edu.asu.commons.mme.entity.CategoricalOption; import edu.asu.commons.mme.entity.CategoricalQuestion; import edu.asu.commons.mme.entity.Game; +import edu.asu.commons.mme.entity.GameRound; import edu.asu.commons.mme.entity.InformationWindow; +import edu.asu.commons.mme.entity.Location; import edu.asu.commons.mme.entity.Module; import edu.asu.commons.mme.entity.ModuleRoundConfig; import edu.asu.commons.mme.entity.Question; import edu.asu.commons.mme.entity.QuestionGroup; import edu.asu.commons.mme.entity.Round; +import edu.asu.commons.mme.entity.RoundLocation; @Transactional public class RoundService extends Service.Base<Round, HibernateRoundConfigDao> { @@ -31,85 +37,109 @@ private HibernateBlockDao blockDao; private HibernateGameDao gameDao; private HibernateModuleRoundConfigDao moduleRoundDao; + private HibernateGameRoundDao gameRoundDao; private LocationService locationService; - - private Module currentModule; + + //private Module currentModule; //private boolean startGame = true; - private Round currentRound; - private Block currentBlock; - private List<Game> currentGames; + //private Round currentRound; + //private Block currentBlock; private int blockSeqNo; - private ModuleRoundConfig currentModuleRoundConfig; - - private boolean gameFinished; public RoundService() { - setCurrentGame(null); + /*setCurrentGame(null); setCurrentBlock(null); setCurrentModule(null); setCurrentModuleRoundConfig(null); - setCurrentRound(null); + setCurrentRound(null);*/ setBlockSeqNo(0); setGameFinished(false); } public Game createGame(Game game) { + getLogger().debug("game came from flex is : " + game.getDescription()); + Game newGame = new Game(); //currentGame = game; - newGame.setDescription(game.getDescription()); - newGame.setMaxDays(game.getMaxDays()); - newGame.setMaxFishHarvest(game.getMaxFishHarvest()); - newGame.setMoney(game.getMoney()); - newGame.setNumberOfRounds(game.getNumberOfRounds()); - newGame.setNumberOfLocations(game.getNumberOfLocations()); - newGame.setTimestamp(game.getTimestamp()); - newGame.setTitle(game.getTitle()); - newGame.setImageLocation("null"); - -// currentGame.setro// - getGameDao().save(newGame); - String str = newGame.getDescription()+newGame.getId(); - - if(getGameDao().findAllByProperty("description", str).size() != 0) + try { - getLogger().debug("in if loop "); - newGame = null; - setCurrentGame(newGame); - } - else + newGame.setDescription(game.getDescription()); + newGame.setMaxDays(game.getMaxDays()); + newGame.setMaxFishHarvest(game.getMaxFishHarvest()); + newGame.setMoney(game.getMoney()); + newGame.setNumberOfRounds(game.getNumberOfRounds()); + newGame.setNumberOfLocations(game.getNumberOfLocations()); + newGame.setTimestamp(game.getTimestamp()); + newGame.setTitle(game.getTitle()); + newGame.setImageLocation("null"); + getGameDao().save(newGame); + String str = newGame.getDescription()+newGame.getId(); + + if(getGameDao().findAllByProperty("description", str).size() != 0) + { + //getLogger().debug("in if loop "); + newGame = null; + } + else + { + newGame.setDescription(str); + getGameDao().save(newGame); + getLogger().info("Created the game: " + newGame.getId()); + initializeGameRounds(newGame); + initializeLocations(newGame); + initializeGame(newGame); + } + }catch(Exception e) { - newGame.setDescription(str); - getGameDao().save(newGame); - setCurrentGame(newGame); - - //initializeGame(newGame); - getLogger().info("Created the game: " + newGame.getId()); - initializeLocations(newGame); + e.printStackTrace(); } getLogger().debug("current game from flex is: " + newGame.getDescription()); return newGame; } - + + private void initializeGameRounds(Game newGame) { + // TODO Auto-generated method stub + List<GameRound> gameRounds = new ArrayList<GameRound>(); + + for(Round round:getDao().findAll()) + { + GameRound gameRound = new GameRound(); + gameRound.setGame(newGame); + gameRound.setRound(round); + gameRoundDao.save(gameRound); + gameRounds.add(gameRound); + } + newGame.setGameRounds(gameRounds); + getGameDao().save(newGame); + } + private void initializeLocations(Game newGame) { locationService.setAllLocations(newGame); + newGame.setLocations(locationService.getAllLocations()); + getGameDao().save(newGame); } - private void initializeGame(Game game) { + public void initializeGame(Game game) { // TODO Auto-generated method stub Hibernate.initialize(game); Hibernate.initialize(game.getCurrentBlock()); Hibernate.initialize(game.getCurrentRound()); - /*Iterator<Round> rounds = game.getRounds().iterator(); - while(rounds.hasNext()) - { - initializeRound(rounds.next()); - }*/ + // Hibernate.initialize(game.getLocations()); + + for(GameRound gameRound :game.getGameRounds()){ + Hibernate.initialize(gameRound); + //Hibernate.initialize(gameRound.getGame()); + initializeRound(gameRound.getRound()); + } + for(Location location :game.getLocations()){ + locationService.initializeLocation(location); + } } public Module getNextModule(int sequenceNo) @@ -130,82 +160,107 @@ *4) Find out the current block number *5) Return the next block */ - - public Block getBlock() + + public Game getBlock(Game game) { - //getLogger().debug("in getBlock "); - //setCurrentModuleRoundConfig(currentModuleRoundConfig); - //find out the current module number - if(currentModuleRoundConfig == null){ - currentModuleRoundConfig = new ModuleRoundConfig(); - if(currentRound == null) - { - setNextRound(); - setModuleForCurrentRound(0); - if(currentBlock == null) - { - setCurrentBlock(new Block()); - currentBlock = getBlock(1); - } - } + ModuleRoundConfig currentModuleRoundConfig; + Block currentBlock = null; + Round currentRound = null; + + //check if it is a start of the game + if(game.getCurrentRound() == null && game.getCurrentBlock() == null ) + { + getLogger().debug("Current Round is null... "); + getLogger().debug("Current block is null... "); + + getLogger().debug("Starting of the game...." + game.getDescription()); + currentRound = getNextRound(null); + currentModuleRoundConfig = getModuleRoundConfig(0, currentRound); + Module currentModule = getModuleForCurrentRound(currentModuleRoundConfig); + currentBlock = getBlock(currentModule,1); } else { - if(isCurrentModuleFinished()) + getLogger().debug("Current Round is : " + game.getCurrentRound().getId()); + getLogger().debug("Current block is : " + game.getCurrentBlock().getId()); + currentBlock = game.getCurrentBlock(); + currentRound = game.getCurrentRound(); + if(isModuleFinished(game.getCurrentBlock())) { getLogger().debug("current module is finished"); - if(isCurrentRoundFinished()) + //currentModuleRoundConfig = game.getCurrentRound(). + if(isCurrentRoundFinished(game)) { getLogger().debug("current round is finished"); - if(isGameFinished()) + if(isGameFinished(game)) { + getLogger().debug("Game is finished..." + game.getId()); return null; } else { //set the next round - setNextRound(); - setModuleForCurrentRound(0); - if(currentBlock == null) - { - setCurrentBlock(new Block()); - currentBlock = getBlock(1); - } + currentRound = getNextRound(game.getCurrentRound()); + currentModuleRoundConfig = getModuleRoundConfig(0, currentRound); + Module currentModule = getModuleForCurrentRound(currentModuleRoundConfig); + currentBlock = getBlock(currentModule,1); } } else { getLogger().debug("current round is not finished"); - setModuleForCurrentRound(getCurrentModuleRoundConfig().getSequenceNo()); - if(currentBlock == null) - { - setCurrentBlock(new Block()); - currentBlock = getBlock(1); - } + //currentRound = getNextRound(game.getCurrentRound()); + + currentModuleRoundConfig = getModuleRoundConfig(getPreviousModuleConfigSequenceNo(game), currentRound); + Module currentModule = getModuleForCurrentRound(currentModuleRoundConfig); + currentBlock = getBlock(currentModule,1); + } } else { //get the next block in the module - getLogger().debug("currentmodule is " + currentModule.getId()); - setNextBlock(); - getLogger().debug(currentBlock.getDescription()); + //getLogger().debug("currentmodule is " + game.getCurrentBlock().getModule().getId()); + currentBlock = getNextBlock(game.getCurrentBlock()); + getLogger().debug("the next block for the game is: " + game.getCurrentBlock().getDescription()); } } - saveGameState(currentBlock); - getLogger().debug("question group sizes is : " + currentBlock.getQuestionGroups().size()); - initializeCurrentBlock(currentBlock); - getLogger().debug("Module is " + currentModule.getId() + "Block sent to the server is: " + getCurrentBlock().getDescription()); - return getCurrentBlock(); + Game newGame = saveGameState(currentBlock,currentRound,game); + getLogger().debug("question group sizes is : " + newGame.getCurrentBlock().getQuestionGroups().size()); + //initializeCurrentBlock(newGame.getCurrentBlock()); + initializeGame(newGame); + getLogger().debug("Module is " + newGame.getCurrentBlock().getModule().getId() + "Block sent to the server is: " + currentBlock.getDescription()); + return newGame; } - private void setModuleForCurrentRound(int prevSeqNo) { + private int getPreviousModuleConfigSequenceNo(Game game) { // TODO Auto-generated method stub + List<ModuleRoundConfig> moduleRoundConfigs = new ArrayList<ModuleRoundConfig> (); + ModuleRoundConfig currentModuleRoundConfig = null; + + Map<String, Object> variables = new HashMap<String, Object>(); + variables.put("module",game.getCurrentBlock().getModule()); + variables.put("round", game.getCurrentRound()); + moduleRoundConfigs = moduleRoundDao.findByEqCriteria(variables); + if(moduleRoundConfigs.size() == 1) + { + currentModuleRoundConfig = moduleRoundConfigs.get(0); + moduleRoundConfigs.clear(); + } + getLogger().debug("the prev Sequence no is : " + currentModuleRoundConfig.getSequenceNo()); + if(currentModuleRoundConfig != null) + return currentModuleRoundConfig.getSequenceNo(); + return 0; + } + + private ModuleRoundConfig getModuleRoundConfig(int prevSeqNo, Round currentRound) { + // TODO Auto-generated method stub //int prevSeqNo = 0; List<ModuleRoundConfig> moduleRoundConfigs = new ArrayList<ModuleRoundConfig> (); + ModuleRoundConfig currentModuleRoundConfig = null; try { moduleRoundConfigs = moduleRoundDao.findAllByProperty("round",currentRound); @@ -214,94 +269,59 @@ if(moduleRoundConfigs.get(i).getSequenceNo() > prevSeqNo) { currentModuleRoundConfig = moduleRoundConfigs.get(i); - setCurrentModuleRoundConfig(currentModuleRoundConfig); - setCurrentModule(moduleRoundConfigs.get(i).getModule()); - getLogger().debug("current module is: " + getCurrentModule().getDescription()); - setCurrentBlock(null); break; + + /*setCurrentModule(moduleRoundConfigs.get(i).getModule()); + getLogger().debug("current module is: " + getCurrentModule().getDescription()); + currentBlock = null; + break;*/ } } }catch(Exception e) { e.printStackTrace(); } + return currentModuleRoundConfig; } + private Module getModuleForCurrentRound(ModuleRoundConfig moduleRoundConfig) { + // TODO Auto-generated method stub + //getLogger().debug("current module is: " + getCurrentModule().getDescription()); + return moduleRoundConfig.getModule(); + } - private void setNextRound() { + + private Round getNextRound(Round currentRound) { // TODO Auto-generated method stub + Round returnRound = null; if(currentRound == null) { - currentRound = new Round(); - currentRound = getDao().findByProperty("roundNo", 1); - setCurrentRound(currentRound); - initializeRound(currentRound); + returnRound = getDao().findByProperty("roundNo", 1); + //returnRound = currentRound; + //initializeRound(returnRound); } else { + getLogger().debug("current round no is: " + currentRound.getRoundNo()); List<Round> rounds = getDao().findAll(); for(int i = 0; i < rounds.size(); i++) { + getLogger().debug("in for loop round no is: " + rounds.get(i).getRoundNo()); if(currentRound.getRoundNo() < rounds.get(i).getRoundNo()) { - setCurrentRound(rounds.get(i)); + returnRound = rounds.get(i); break; + //getLogger().debug("currentround object is "+ rounds.get(i).getId()); } } } - getLogger().debug("currentround object is "+ currentRound.getId()); + getLogger().debug("currentround object is "+ returnRound.getId()); + return returnRound; } - - private boolean isCurrentRoundFinished() { - // TODO Auto-generated method stub - List<ModuleRoundConfig> moduleRoundConfigs = new ArrayList<ModuleRoundConfig> (); - moduleRoundConfigs = moduleRoundDao.findAllByProperty("round",currentRound); - - if(currentModuleRoundConfig == null) - { - getLogger().debug("currentModuleRoundConfig is null"); - return true; - } - else - { - if(moduleRoundConfigs.size() == 1) - { - return true; - - } - else - { - getLogger().debug("check condition is "+ moduleRoundConfigs.get(moduleRoundConfigs.size() - 1).getSequenceNo()); - int seqNo = moduleRoundConfigs.get(moduleRoundConfigs.size() - 1).getSequenceNo(); - if((currentModuleRoundConfig.getSequenceNo()) == seqNo) - { - getLogger().debug("flag return is true"); - return true; - - } - else - { - for(int i = 0; i < moduleRoundConfigs.size(); i++) - { - // getLogger().debug("moduleroundconfig seq no is" + moduleRoundConfigs.get(i).getSequenceNo()); - getLogger().debug("Current seq no is" + currentModuleRoundConfig.getSequenceNo() +"and the moduleroundconfig is "+ moduleRoundConfigs.get(i).getSequenceNo()); - - if(currentModuleRoundConfig.getSequenceNo() < moduleRoundConfigs.get(i).getSequenceNo()) - { - return false; - } - } - } - } - } - - return false; - } - public HibernateModuleDao getModuleDao() { return moduleDao; } @@ -339,25 +359,25 @@ Module module = block.getModule(); Hibernate.initialize(module); - initializeModule(currentModule); + initializeModule(module); } - private void setNextBlock() { + private Block getNextBlock(Block currentBlock) { // TODO Auto-generated method stub List<Block> blocks = new ArrayList<Block>(); - blocks = getCurrentModule().getBlocks(); - + blocks = currentBlock.getModule().getBlocks(); + Block returnBlock = null; for(int i = 0; i < blocks.size(); i++) { if(currentBlock.getSequenceNo() < blocks.get(i).getSequenceNo()) { - setCurrentBlock(blocks.get(i)); + returnBlock = blocks.get(i); break; } - } + return returnBlock; } @@ -373,7 +393,7 @@ return module; } - public Block getBlock(int seqNo) + public Block getBlock(Module currentModule, int seqNo) { //Module module = new Module(); // module = currentModule; @@ -390,7 +410,7 @@ return block; } - private void setRound(int roundNo) { + /* private void setRound(int roundNo) { // TODO Auto-generated method stub currentRound = new Round(); @@ -399,9 +419,9 @@ getLogger().debug("currentround object is "+ currentRound.getId()); setCurrentRound(currentRound); - } + }*/ - private int getCurrentRoundNo() { + /*private int getCurrentRoundNo() { // TODO Auto-generated method stub //FIXME: Game id 1 is hard coded but needs to make it dynamic //Game game = gameDao.find(1L); @@ -410,51 +430,134 @@ else return getCurrentGame().getCurrentRound().getRoundNo(); + }*/ + public boolean isGameFinished(Game game) { + List<GameRound> gameRounds = game.getGameRounds(); + boolean flag = false; + + if(game.getCurrentRound().getRoundNo() == gameRounds.get(gameRounds.size() - 1).getRound().getRoundNo()) + { + flag = true; + } + else + { + for(GameRound gameRound:gameRounds) + { + if(game.getCurrentRound().getRoundNo() < game.getCurrentRound().getRoundNo()) + { + flag = false; + } + } + + } + return flag; } - private boolean isCurrentModuleFinished() { + private boolean isCurrentRoundFinished(Game game) { + boolean flag = false; + List<ModuleRoundConfig> moduleRoundConfigs = new ArrayList<ModuleRoundConfig> (); + Round currentRound = game.getCurrentRound(); + Module currentModule = game.getCurrentBlock().getModule(); + + ModuleRoundConfig currentModuleRoundConfig = new ModuleRoundConfig(); + + Map<String, Object> variables = new HashMap<String, Object>(); + variables.put("module",currentModule); + variables.put("round", currentRound); + moduleRoundConfigs = moduleRoundDao.findByEqCriteria(variables); + if(moduleRoundConfigs.size() == 1) + { + currentModuleRoundConfig = moduleRoundConfigs.get(0); + moduleRoundConfigs.clear(); + } + moduleRoundConfigs = moduleRoundDao.findAllByProperty("round",currentRound); + getLogger().debug("the module round configs size is: " + moduleRoundConfigs.size()); + //check if it contains only one module, if yes then round is over + if(moduleRoundConfigs.size() == 1) + { + flag = true; + } + else + { + getLogger().debug("module round config is "+ moduleRoundConfigs.get(moduleRoundConfigs.size() - 1).getSequenceNo()); + int seqNo = moduleRoundConfigs.get(moduleRoundConfigs.size() - 1).getSequenceNo(); + if((currentModuleRoundConfig.getSequenceNo()) == seqNo) + { + flag = true; + } + else + { + for(int i = 0; i < moduleRoundConfigs.size(); i++) + { + // getLogger().debug("moduleroundconfig seq no is" + moduleRoundConfigs.get(i).getSequenceNo()); + getLogger().debug("Current seq no is" + currentModuleRoundConfig.getSequenceNo() +"and the moduleroundconfig is "+ moduleRoundConfigs.get(i).getSequenceNo()); + + if(currentModuleRoundConfig.getSequenceNo() == moduleRoundConfigs.get(moduleRoundConfigs.size() - 1).getSequenceNo()) + flag = true; + if(currentModuleRoundConfig.getSequenceNo() < moduleRoundConfigs.get(i).getSequenceNo()) + { + flag = false; + } + } + } + } + return flag; + } + + + private boolean isModuleFinished(Block currentBlock) { // TODO Auto-generated method stub + boolean flag = false; + List<Block> blocks = new ArrayList<Block>(); getLogger().debug("in iscurrentmodulefinished"); - if(currentModule == null) + if(currentBlock == null) { - return true; + flag = true; } else { - blocks = getCurrentModule().getBlocks(); + Module currentModule = currentBlock.getModule(); + //getBlocks() return blocks in order of sequence number + blocks = currentModule.getBlocks(); //select max(b.sequence_no) from block b where b.module_id=2; - getLogger().debug("no of blocks " + blocks.size() +"for module id: " + getCurrentModule().getId()); - + getLogger().debug("no of blocks " + blocks.size() +"for module id: " + currentModule.getId()); + //if module contains only one block if(blocks.size() == 1) - return true; + flag = true; else { for(int i = 0; i < blocks.size(); i++) { - if(currentBlock.getSequenceNo() == blocks.get(blocks.size() - 1).getSequenceNo()) - return true; + flag = true; if(currentBlock.getSequenceNo() < blocks.get(i).getSequenceNo()) { - return false; + flag = false; } } } } - return false; + return flag; } + private Game saveGameState(Block currentBlock, Round currentRound, Game game) { - private void saveGameState(Block currentBlock) { - //FIXME: Game id 1 is hard coded but needs to make it dynamic - //Game game = gameDao.find(1L); - - currentGame.setCurrentBlock(currentBlock); - currentGame.setCurrentRound(currentRound); - gameDao.save(currentGame); + getLogger().info(" Game id to SAVE is: " + game.getId()); + Game newGame = null; + newGame = gameDao.find(game.getId()); + getLogger().info("The current block is: " + currentBlock.getId() + " while the current Round is: " + currentRound.getId()); + if(newGame.getCurrentBlock() == null && newGame.getCurrentRound()==null) + getLogger().info("BEFORE GAME SAVE: The current block NULL while the current Round is NULL"); + else + getLogger().info("BEFORE GAME SAVE: The current block is: " + newGame.getCurrentBlock().getId() + " while the current Round is: " + newGame.getCurrentRound().getId()); + newGame.setCurrentBlock(currentBlock); + newGame.setCurrentRound(currentRound); + gameDao.save(newGame); + getLogger().info("The game state is saved. The current block : " + newGame.getCurrentBlock().getId() + "while the current Round is: " + newGame.getCurrentRound().getId()); + return newGame; } public Integer getTimerforBlock(Block block) @@ -502,49 +605,43 @@ } } - public Block getCurrentBlock() { + /*public Block getCurrentBlock() { //FIXEME: game id 1 is hard coded, it should be dynamic -// Game game = gameDao.find(1L); + // Game game = gameDao.find(1L); Block block = new Block(); block = currentGame.getCurrentBlock(); // Hibernate.initialize(block); return block; - } + }*/ - public void setCurrentModule(Module currentModule) { - this.currentModule = currentModule; - } - public Module getCurrentModule() { - return currentModule; - } - - public void setCurrentRound(Round currentRound) { - this.currentRound = currentRound; - } - - public Round getCurrentRound() { + /*public Round getCurrentRound() { getLogger().debug("in get current round funciton"); - /*Round round = currentGame.getCurrentRound(); + Round round = currentGame.getCurrentRound(); //Round round = getDao().find(getCurrentRound().getId()); - - initializeRound(round);*/ + + initializeRound(round); getLogger().debug("round no is " + currentRound.getRoundNo() + " " + currentRound.getId()); return currentRound; - } + }*/ private void initializeRound(Round round) { // TODO Auto-generated method stub Hibernate.initialize(round); - - Hibernate.initialize(round.getRoundLocations()); + //Hibernate.initialize(round.getRoundLocations()); + /*for (RoundLocation roundLocation: round.getRoundLocations()) { Hibernate.initialize(roundLocation); //hibernateroundLocation.getLocation(); }*/ - + for (GameRound gameRound: round.getGameRounds()) { + Hibernate.initialize(gameRound); + //hibernateroundLocation.getLocation(); + } + + //Hibernate.initialize(currentRound.getLocations()); } @@ -575,46 +672,12 @@ public HibernateBlockDao getBlockDao() { return blockDao; } - - public void setModuleRoundConfig(ModuleRoundConfig moduleRoundConfig) { - this.currentModuleRoundConfig = moduleRoundConfig; - } - - public ModuleRoundConfig getModuleRoundConfig() { - return currentModuleRoundConfig; - } - public void setGameFinished(boolean gameFinished) { this.gameFinished = gameFinished; } - public boolean isGameFinished() { - if(getCurrentGame().getCurrentRound().getRoundNo() < currentRound.getRoundNo()) - { - gameFinished = true; - } - return false; - } - public void setCurrentBlock(Block currentBlock) { - this.currentBlock = currentBlock; - } - public ModuleRoundConfig getCurrentModuleRoundConfig() { - return currentModuleRoundConfig; - } - - public void setCurrentModuleRoundConfig( - ModuleRoundConfig currentModuleRoundConfig) { - this.currentModuleRoundConfig = currentModuleRoundConfig; - } - public void setCurrentGame(Game game) { - this.currentGame = game; - } - public Game getCurrentGame() { - return currentGame; - } - public void setLocationService(LocationService locationService) { this.locationService = locationService; } @@ -623,11 +686,16 @@ return locationService; } - public void setCurrentGames(List<Game> currentGames) { - this.currentGames = currentGames; + public String getDescription(Game game) { + // TODO Auto-generated method stub + return game.getDescription(); } - public List<Game> getCurrentGames() { - return currentGames; + public void setGameRoundDao(HibernateGameRoundDao gameRoundDao) { + this.gameRoundDao = gameRoundDao; } + + public HibernateGameRoundDao getGameRoundDao() { + return gameRoundDao; + } } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-09-24 19:16:41 UTC (rev 281) @@ -11,7 +11,7 @@ import flex.messaging.util.UUIDUtils; -public class StartGame extends Thread { +public class StartGame implements Runnable { private static Logger logger = Logger.getLogger(StartGame.class); private boolean running; @@ -20,19 +20,24 @@ private DayByDayDecisionsService dayBydayDecisionService; private StudentService studentService; private ModuleRoundConfig currentModuleRoundConfig; - + private Game game; + public StartGame() { - System.out.println("module service object is "); + //System.out.println("module service object is "); /*moduleService.test(); moduleService.setStartModule(true);*/ + /*setRoundService(new RoundService()); + setLocationService(new LocationService()); + */ setRunning(true); + } - + public Student createStudent(Student student) { -// Game game = new Game(); - Game game = roundService.getCurrentGame(); + // Game game = new Game(); + Game game = student.getGame(); Student studentReturn = null; //System.out.println("game description: " + game.getDescription() + " student game code is: " + student.getGameCode()); if(game.getDescription().equals(student.getGameCode())) @@ -44,13 +49,21 @@ } return studentReturn; } - + public Game createGame(Game game) { - System.out.println("game came from flex is: " + game.getDescription()); - return roundService.createGame(game); + //System.out.println("game came from flex is: " + game.getDescription()); + game = roundService.createGame(game); + System.out.println("game object return from round service is: " + game); + if(game != null) + { + setGame(game); + } + //roundService.initializeGame(game); + return game; + } - + public List<Student> assignGroups() { return studentService.assignGroups(); @@ -67,31 +80,43 @@ */ public void run() { - Block block = new Block(); + Game newGameState = null; + Block block = null; //roundService.test(); - MessageBroker msgBroker = MessageBroker.getMessageBroker("_messageBroker"); String clientID = UUIDUtils.createUUID(); + newGameState = game; int i=0; - while (i<5) { + while (i<17) { i++; - String msgDestination = roundService.getCurrentGame().getDescription(); + String msgDestination = roundService.getDescription(game); //Push the first block to the clients AsyncMessage msg = new AsyncMessage(); - msg.setDestination("chat"); - //msg.setHeader("DSSubtopic", "hello3"); + + msg.setDestination("mme"); + msg.setHeader("DSSubtopic", msgDestination); msg.setClientId(clientID); msg.setMessageId(UUIDUtils.createUUID()); msg.setTimestamp(System.currentTimeMillis()); - block = roundService.getBlock(); - msg.setBody(block); + + newGameState = roundService.getBlock(game); + setGame(newGameState); + if(newGameState == null) + { + msg.setBody(null); + } + else + { + block = newGameState.getCurrentBlock(); + msg.setBody(block); + } msgBroker.routeMessageToService(msg, null); logger.debug("message is sent to the client: " + msg); - - /* if(block.getDescription().equalsIgnoreCase("Day-by-day decisions game")) + + /* if(block.getDescription().equalsIgnoreCase("Day-by-day decisions game")) { //start day by day decision //getDayBydayDecisionService(). @@ -107,22 +132,18 @@ //start the timer for the block sent try { //for testing purpose 5000 is given as an argument - Thread.sleep(20000); + Thread.sleep(10000); if(block == null) { running = false; } } catch (InterruptedException e) { } - - } - } - + private boolean isGameOver() { // TODO Auto-generated method stub - return false; } @@ -166,5 +187,12 @@ this.studentService = studentService; } + public void setGame(Game game) { + this.game = game; + } + + public Game getGame() { + return game; + } } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-09-24 19:16:41 UTC (rev 281) @@ -21,6 +21,7 @@ //private QuestionCreatorService questionCreatorService; private StartGame startGame; private ApplicationContext ctx; + private ArrayList<StartGame> currentGames; /*public void setQuestionCreatorService(QuestionCreatorService questionCreatorService) { this.questionCreatorService = questionCreatorService; @@ -33,11 +34,27 @@ public Game createGame(Game game) { - if(getStartGame() == null) + Game newGame = null; + try { setStartGame(); + newGame = getStartGame().createGame(game); + if(newGame != null) + { + System.out.println("new Game is: " + newGame); + if(currentGames == null) + { + currentGames = new ArrayList<StartGame>(); + } + System.out.println("startGame is: " + startGame); + System.out.println("current games are: " + currentGames); + currentGames.add(startGame); + } + }catch(Exception e ) + { + e.printStackTrace(); } - return startGame.createGame(game); + return newGame; } public void assignGroups() @@ -57,19 +74,34 @@ System.out.println("Students size is: " + students.size()); msgBroker.routeMessageToService(msg, null); - } - public void startGame() + public void startGame(Game game) { //push assign groups to all the students //assignGroups(); //start the game - this.startGame.run(); + System.out.println("Game came from client is to start: " + game.getId() + "size of currentGame is " + currentGames.size()); + try + { + for(int i = 0; i < currentGames.size(); i++) + { + System.out.println("game in for loop is: " + currentGames.get(i).getGame().getId()); + + if(currentGames.get(i).getGame().getId().equals(game.getId())) + { + System.out.println("Game is found"); + currentGames.get(i).run(); + } + } + }catch(Exception e) + { + e.printStackTrace(); + } } - public void stop() { + public void stop(Game game) { startGame.setRunning(false); startGame = null; } @@ -83,10 +115,8 @@ public void setStartGame() { try{ - if (startGame == null) { - this.startGame = (StartGame)ctx.getBean("startGame"); - - } + this.startGame = (StartGame)ctx.getBean("startGame"); + System.out.println("startGame is: " + startGame); }catch(Exception e) { System.out.println(e.getStackTrace()); @@ -94,7 +124,6 @@ } public StartGame getStartGame() { - return startGame; } } Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-09-24 19:16:41 UTC (rev 281) @@ -100,6 +100,10 @@ <bean id='moduleRoundDao' class='edu.asu.commons.mme.dao.HibernateModuleRoundConfigDao'> <property name='sessionFactory' ref='sessionFactory'/> </bean> + + <bean id='gameRoundDao' class='edu.asu.commons.mme.dao.HibernateGameRoundDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> <!-- spring managed service layer --> @@ -114,7 +118,7 @@ <property name='gameDao' ref='gameDao' /> <property name='moduleRoundDao' ref='moduleRoundDao' /> <property name='locationService' ref='locationService'/> - <!-- <property name='blockDao' ref='blockDao'/> --> + <property name='gameRoundDao' ref='gameRoundDao'/> </bean> @@ -161,7 +165,7 @@ <property name="startModule" value="Testing String."/> </bean> --> - <bean id="startGame" class="edu.asu.commons.mme.service.StartGame"> + <bean id="startGame" class="edu.asu.commons.mme.service.StartGame" scope = "prototype"> <property name='roundService' ref='roundService'/> <property name='locationService' ref='locationService'/> <property name='studentService' ref='studentService'/> @@ -184,7 +188,7 @@ <!-- Expose services for Flex/BlazeDS messaging --> <flex:message-destination id="chat" /> - <flex:message-destination id="mme" /> + <flex:message-destination id="mme" allow-subtopics="true" subtopic-separator="." /> <!-- Flex related information ended--> <bean id="mmeDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-09-16 21:14:48 UTC (rev 280) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-09-24 19:16:41 UTC (rev 281) @@ -10,12 +10,15 @@ <mapping class='edu.asu.commons.mme.entity.Game'/> <mapping class='edu.asu.commons.mme.entity.Round'/> <mapping class='edu.asu.commons.mme.entity.Location'/> + <!-- <mapping class='edu.asu.commons.mme.entity.RoundLocation'/> + --> + <mapping class='edu.asu.commons.mme.entity.Communication'/> <mapping class='edu.asu.commons.mme.entity.Group'/> <mapping class='edu.asu.commons.mme.entity.Student'/> + <mapping class='edu.asu.commons.mme.entity.GameRound'/> - <mapping class='edu.asu.commons.mme.entity.StudentRoundConfig'/> <mapping class='edu.asu.commons.mme.entity.StudentStrategy'/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-10-12 22:05:19
|
Revision: 294 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=294&view=rev Author: seematalele Date: 2009-10-12 22:05:11 +0000 (Mon, 12 Oct 2009) Log Message: ----------- Created Interface PushData.java which provides mechanism for callback, when block timer is over. Able to sent blocks to the clients (Checked using Alert.Show messages in StartGame.swf). Currently the timer is set is 5 sec. (in sendBlock() method of MessageHandler class). Timer thread is created. This thread sleeps for 1 sec. sendblock checks after 1 sec if time for block is over or not. Problems: FisheryExperimentShell is still giving an error for DayByDayDecisionsC.mxml at 178 line. Need to resolve this issue Modified Paths: -------------- mentalmodels/trunk/flex/src/StartGame.mxml mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java Added Paths: ----------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/PushData.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/Timer.java Modified: mentalmodels/trunk/flex/src/StartGame.mxml =================================================================== --- mentalmodels/trunk/flex/src/StartGame.mxml 2009-10-10 01:18:43 UTC (rev 293) +++ mentalmodels/trunk/flex/src/StartGame.mxml 2009-10-12 22:05:11 UTC (rev 294) @@ -28,7 +28,7 @@ <mx:VBox id="responsesContent"/> </mx:VBox> - <mx:RemoteObject id="startupService" destination="startupService" fault="faultHandler(event)"> + <mx:RemoteObject id="gameService" destination="gameService" fault="faultHandler(event)"> <mx:method name="createGame" result="gameObjectResultHandler(event)"/> <mx:method name="startGame"/> </mx:RemoteObject> @@ -55,6 +55,7 @@ import mx.messaging.events.MessageFaultEvent; import mx.messaging.FlexClient; import mx.messaging.messages.AsyncMessage; + import mx.collections.ArrayCollection; import mx.logging.*; import mx.logging.targets.*; @@ -111,15 +112,12 @@ gameObject.money = stpMoney.value; gameObject.gameCode = txtDescription.text; gameObject.timestamp = new Date(); - - startupService.createGame(gameObject); + + gameService.createGame(gameObject); /* var message:AsyncMessage = new AsyncMessage(); message.body = "got gameObject" + gameObject.description; producer.send(message); Alert.show("message is send"); */ - - - } public function start():void { @@ -127,7 +125,7 @@ /*consumer.subscribe(); Alert.show("subscribed to destination: " + consumer.destination);*/ - startupService.startGame(game); + gameService.startGame(game); //consumer.subtopic = "hello3"; } @@ -163,15 +161,23 @@ private function messageHandler(event:MessageEvent):void { //Alert.show("message from server came.."); - var block:actionscript.Block = event.message.body as actionscript.Block; + if(event.message.body as actionscript.Block) + { + var block:actionscript.Block = event.message.body as actionscript.Block; //Alert.show("String came from server is: " + block.id + " " + block.description); - if(block == null) + if(block == null) + { + Alert.show("Game is over!!"); + } + else + Alert.show("Block from server is : " + block.description); + } + else if(event.message.body as ArrayCollection) { - Alert.show("Game is over!!"); + Alert.show("something else "); } - else - Alert.show("Block from server is : " + block.description); + } ]]> Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-10-10 01:18:43 UTC (rev 293) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-10-12 22:05:11 UTC (rev 294) @@ -57,7 +57,7 @@ </mx:HBox> - <mx:RemoteObject id="startupService" destination="startupService" fault="faultHandler(event)"> + <mx:RemoteObject id="studentService" destination="studentService" fault="faultHandler(event)"> <mx:method name="createStudent" result="studentResultHandler(event)"/> </mx:RemoteObject> <mx:RemoteObject id="answeringService" destination="answeringService" fault="faultHandler(event)"> @@ -127,7 +127,30 @@ private function messageHandler(event:MessageEvent):void { - setBlock(event.message.body as actionscript.Block); + var msg:IMessage; + + if(event.message.body as actionscript.Block) + { + setBlock(event.message.body as actionscript.Block); + } + else if(event.message.body as ArrayCollection) + { + var students:ArrayCollection = new ArrayCollection(); + students = ArrayCollection(event.message.body); + Alert.show("Student size is: " + students.length); + if(students.length !=0) + { + for(var i:int = 0; i< students.length; i++) + { + if(actionscript.Student(students.getItemAt(i)).id == studentObject.id) + { + studentObject.group = actionscript.Student(students.getItemAt(i)).group; + studentObject.studentNo = actionscript.Student(students.getItemAt(i)).studentNo; + } + } + } + Alert.show("Current Student Information is: " + "\n"+studentObject.id +"\n"+studentObject.gameCode+"\n"+studentObject.studentNo); + } } private function blockResultHandler(event:ResultEvent):void { @@ -472,7 +495,7 @@ newStudent.semester = (obj as SocioDemographicPage).getSemester(); newStudent.gameCode = (obj as SocioDemographicPage).getGameCode(); - startupService.createStudent(newStudent); + studentService.createStudent(newStudent); currentState = "wait"; btnBack.enabled = btnForward.enabled = btnReset.enabled = true; Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java 2009-10-10 01:18:43 UTC (rev 293) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/GameService.java 2009-10-12 22:05:11 UTC (rev 294) @@ -35,12 +35,10 @@ import edu.asu.commons.mme.entity.Round; import edu.asu.commons.mme.entity.Student; import edu.asu.commons.mme.utility.MessageHandler; -import flex.messaging.MessageBroker; -import flex.messaging.messages.AsyncMessage; -import flex.messaging.util.UUIDUtils; +import edu.asu.commons.mme.utility.PushData; @Transactional -public class GameService extends Service.Base<Game, HibernateGameDao>{ +public class GameService extends Service.Base<Game, HibernateGameDao> implements PushData{ private HibernateModuleDao moduleDao; @@ -54,8 +52,14 @@ private HibernateLocationDao locationDao; private int blockSeqNo; + + private RoundService roundService; - private RoundService roundService; + MessageHandler msgHandler; + + public GameService() + { + } public GameConfig createGameConfig(GameConfig gameConfig) { @@ -131,66 +135,67 @@ public void startGame(Game game) { assignGroups(game); -/* getRoundService().setGame(game); - getRoundService().run(); -*/ + getLogger().debug("system has assigned groups. "); + pushBlock(game); + } + + + private void pushBlock(Game game) { Game newGameState = null; Block block = null; boolean running = false; getLogger().info("game start is: " + game.getId()); newGameState = getDao().find(game.getId()); - MessageHandler msgHandler = new MessageHandler(); + //FIXME: Do not know if this is a right way, I do not think because it will create refrecne to message handler for every block + msgHandler = new MessageHandler(this); msgHandler.setDestination("mme"); msgHandler.setSubtopic(getGameCode(newGameState)); - int noOfBlocks = getNumberOfBlock(game); - + //int noOfBlocks = getNumberOfBlock(game); + int i=0; try { - while (i<noOfBlocks) { - + //while (i<noOfBlocks) { i++; newGameState = getBlock(game); game = newGameState; if(newGameState == null) { - msgHandler.send(null); + getLogger().debug("game state is null..."); + msgHandler.sendBlock(null, null); } else { + getLogger().debug("game state is NOT null..."); block = newGameState.getCurrentBlock(); - msgHandler.send(block); + msgHandler.sendBlock(block,newGameState); } - if(block.getDescription().equalsIgnoreCase("Day-by-day decisions game")) - { - //start day by day decision - //getDayBydayDecisionService(). + /*if(block.getDescription().equalsIgnoreCase("Day-by-day decisions game")) + { + //start day by day decision + //getDayBydayDecisionService(). - } - else if (block.getDescription().equalsIgnoreCase("Communication")) - { - //start communication round + } + else if (block.getDescription().equalsIgnoreCase("Communication")) + { + //start communication round - } - //get the timer for the block - Integer timer = getTimerforBlock(block); - //start the timer for the block sent - - //for testing purpose 5000 is given as an argument - Thread.sleep(10000); - if(block == null) - { - running = false; - } - } - }catch (InterruptedException e) { + }*/ + //} + }catch (Exception e) { + getLogger().debug(e); } } - + public void pushNextData(Game game) { + // TODO Auto-generated method stub + pushBlock(game); + + } private int getNumberOfBlock(Game game) { // TODO Auto-generated method stub + + //game.getGameConfig() - //game.getGameConfig() return 0; } @@ -203,8 +208,6 @@ Game game = getDao().find(currentGame.getId()); try{ //getLogger().debug("In the assigngroups." + game.getId()); - - students = getStudentDao().findAllByProperty("game", game); //getLogger().debug("test student object is : " + students.size()); @@ -261,7 +264,7 @@ getLogger().debug("size of 5 : " + noOfGroupsWithSize5); */ - int groupNo = 0; + int startGroupNo = 0; //assign every student a number and group if(!students.isEmpty()) @@ -269,25 +272,25 @@ if(noOfGroupsWithSize5 > 0) { - for(Student student5:assignGroupstoStudents(5,noOfGroupsWithSize5,students,groupNo)) + for(Student student5:assignGroupstoStudents(5,noOfGroupsWithSize5,students,startGroupNo)) studentWithGroupsAssigned.add(student5); //getLogger().debug("student size after 5 is: " + students.size()); getLogger().debug("student with groups assigned: " + studentWithGroupsAssigned.size()); } - groupNo = noOfGroupsWithSize5; + startGroupNo = noOfGroupsWithSize5; if(noOfGroupsWithSize4 > 0) { - for(Student student4:assignGroupstoStudents(4,noOfGroupsWithSize4,students,groupNo)) + for(Student student4:assignGroupstoStudents(4,noOfGroupsWithSize4,students,startGroupNo)) studentWithGroupsAssigned.add(student4); //getLogger().debug("student size after 4 is: " + students.size()); getLogger().debug("student with groups assigned: " + studentWithGroupsAssigned.size()); } - groupNo = noOfGroupsWithSize5 + noOfGroupsWithSize4; + startGroupNo = noOfGroupsWithSize5 + noOfGroupsWithSize4; if(noOfGroupsWithSize3 > 0) { - for(Student student3:assignGroupstoStudents(3,noOfGroupsWithSize3,students,groupNo)) + for(Student student3:assignGroupstoStudents(3,noOfGroupsWithSize3,students,startGroupNo)) studentWithGroupsAssigned.add(student3); //getLogger().debug("student size after 3 is: " + students.size()); getLogger().debug("student with groups assigned: " + studentWithGroupsAssigned.size()); @@ -321,7 +324,7 @@ System.out.println("Students size is: " + studentWithGroupsAssigned.size()); msgBroker.routeMessageToService(msg, null);*/ - MessageHandler msgHandler = new MessageHandler(); + msgHandler = new MessageHandler(null); msgHandler.setDestination("mme"); msgHandler.setSubtopic(game.getGameCode()); /*for(Student student: studentWithGroupsAssigned) @@ -937,7 +940,7 @@ boolean flag = false; List<Block> blocks = new ArrayList<Block>(); - getLogger().debug("in iscurrentmodulefinished"); + //getLogger().debug("in iscurrentmodulefinished"); if(currentBlock == null) { flag = true; @@ -987,11 +990,11 @@ return newGame; } - public Integer getTimerforBlock(Block block) + /*public Integer getTimerforBlock(Block block) { return block.getDuration(); - } + }*/ /*public Block getCurrentBlock() { //FIXEME: game id 1 is hard coded, it should be dynamic @@ -1115,4 +1118,9 @@ public RoundService getRoundService() { return roundService; } + + + + + } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-10-10 01:18:43 UTC (rev 293) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-10-12 22:05:11 UTC (rev 294) @@ -775,7 +775,7 @@ boolean running = false; getLogger().info("game start is: " + game.getId()); newGameState = getGameDao().find(game.getId()); - MessageHandler msgHandler = new MessageHandler(); + MessageHandler msgHandler = new MessageHandler(null); msgHandler.setDestination("mme"); msgHandler.setSubtopic(getGameCode(newGameState)); Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-10-10 01:18:43 UTC (rev 293) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-10-12 22:05:11 UTC (rev 294) @@ -58,7 +58,7 @@ public List<Student> assignGroups(Game game) { List<Student> students = null; - students = studentService.assignGroups(game); + // students = studentService.assignGroups(game); if(students != null) { MessageBroker msgBroker = MessageBroker.getMessageBroker("_messageBroker"); Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-10-10 01:18:43 UTC (rev 293) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-10-12 22:05:11 UTC (rev 294) @@ -10,7 +10,6 @@ import edu.asu.commons.mme.dao.HibernateGroupDao; import edu.asu.commons.mme.dao.HibernateStudentDao; import edu.asu.commons.mme.entity.Game; -import edu.asu.commons.mme.entity.Group; import edu.asu.commons.mme.entity.Student; /** @@ -79,157 +78,6 @@ return false; } - - public List<Student> assignGroups(Game game) - { - //createGroup(1); - List<Student> studentWithGroupsAssigned = new ArrayList<Student>(); - List<Student> students = new ArrayList<Student>(); - try{ - getLogger().debug("In the assigngroups." + game.getId()); - - students = getDao().findAllByProperty("game", game); - - //getLogger().debug("test student object is : " + students.size()); - if(students.size() > 1) - { - //write an algorithm to form groups - int totalStudents = students.size(); - int noOfGroupsWithSize3=0; - int noOfGroupsWithSize4=0; - int noOfGroupsWithSize5=0; - int x; - - - //no of groups - noOfGroupsWithSize5=((int)(totalStudents/5)); - - - x= totalStudents%5; - - /* if(x==0) - { - totalGroups=groupSize5; - } - else*/ - if(x==1) - { - noOfGroupsWithSize5=noOfGroupsWithSize5 - 1; - noOfGroupsWithSize3=2; - // totalGroups=groupSize5 + groupSize3; - } - - else if(x==2) - { - noOfGroupsWithSize5=noOfGroupsWithSize5-1; - noOfGroupsWithSize4=1; - noOfGroupsWithSize3=1; - // totalGroups=groupSize5 + groupSize3 + groupSize4; - } - else if(x==3) - { - noOfGroupsWithSize3=1; - // totalGroups=groupSize3 + groupSize5; - } - - else if(x==4) - { - noOfGroupsWithSize4=1; - // totalGroups=groupSize4 + groupSize5; - } - - - //getLogger().debug("size of 4 : " + noOfGroupsWithSize4); - //getLogger().debug("size of 3 : " + noOfGroupsWithSize3); - //getLogger().debug("size of 5 : " + noOfGroupsWithSize5); - - int groupNo = 0; - //assign every student a number and group - if(!students.isEmpty()) - { - if(noOfGroupsWithSize5 > 0) - { - studentWithGroupsAssigned.addAll(assignGroupstoStudents(5,noOfGroupsWithSize5,students,groupNo)); - //getLogger().debug("student size after 5 is: " + students.size()); - //getLogger().debug("student with groups assigned: " + studentWithGroupsAssigned.size()); - } - groupNo = noOfGroupsWithSize5; - if(noOfGroupsWithSize4 > 0) - { - studentWithGroupsAssigned.addAll(assignGroupstoStudents(4,noOfGroupsWithSize4,students,groupNo)); - //getLogger().debug("student size after 4 is: " + students.size()); - //getLogger().debug("student with groups assigned: " + studentWithGroupsAssigned.size()); - } - groupNo = noOfGroupsWithSize5 + noOfGroupsWithSize4; - if(noOfGroupsWithSize3 > 0) - { - studentWithGroupsAssigned.addAll(assignGroupstoStudents(3,noOfGroupsWithSize3,students,groupNo)); - //getLogger().debug("student size after 3 is: " + students.size()); - //getLogger().debug("student with groups assigned: " + studentWithGroupsAssigned.size()); - } - } - } - getLogger().debug("Final student with groups assigned: " + studentWithGroupsAssigned.size()); - }catch(Exception e) - { - getLogger().error(e); - } - return studentWithGroupsAssigned; - - } - - private List<Student> assignGroupstoStudents(int groupSize, int noOfGroups,List<Student> students,int groupNo) { - // TODO Auto-generated method stub - Student student = new Student(); - List<Student> studentWithGroupsAssigned = new ArrayList<Student>(); - getLogger().debug("group size is : "+groupSize + " and group number is : "+ groupNo); - - for(int counter = 0; counter < noOfGroups; counter++) - { - //create group - Group grp = new Group(); - - grp.setNumber(++groupNo); - groupDao.save(grp); - - getLogger().info("Group is created with id: " + grp.getId()); - int studentNo = 1; - int j = 0; - for(int i = 0; i <= groupSize-1 ; i++) - { - //get a student from a list - student = students.get(0); - getLogger().debug("i is: " + i +"student id is : "+student.getId()); - if(student.getGroup() == null) - { - //assign student no and group to each student - getLogger().debug("group assigned is : " + grp.getId()); - student.setStudentNo(studentNo); - student.setGroup(grp); - getDao().save(student); - studentNo++; - initializeStudent(student); - studentWithGroupsAssigned.add(student); - students.remove(0); - } - j++; - } - } - return students; - } - - public Group createGroup(int groupNo) - { - Group grp = new Group(); - grp.setNumber(groupNo); - groupDao.save(grp); - getLogger().info("Group is created with id: " + grp.getId()); - return grp; - } - /*public HibernateGroupDao getGroupDao() { - return groupDao; - }*/ - public void setGroupDao(HibernateGroupDao groupDao) { this.groupDao = groupDao; } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2009-10-10 01:18:43 UTC (rev 293) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2009-10-12 22:05:11 UTC (rev 294) @@ -1,17 +1,25 @@ package edu.asu.commons.mme.utility; +import org.apache.log4j.Logger; import edu.asu.commons.mme.entity.Block; +import edu.asu.commons.mme.entity.Game; +import edu.asu.commons.mme.service.GameService; import edu.asu.commons.mme.service.StartGame; import flex.messaging.MessageBroker; import flex.messaging.messages.AcknowledgeMessage; import flex.messaging.messages.AsyncMessage; import flex.messaging.util.UUIDUtils; -import org.apache.log4j.Logger; public class MessageHandler { - + private static Logger logger = Logger.getLogger(StartGame.class); + + private PushData pushData; + public MessageHandler(PushData pushData) { + // TODO Auto-generated constructor stub + this.pushData = pushData; + } private String destination; public String getDestination() { @@ -34,7 +42,7 @@ public void send(Object message) { - + MessageBroker msgBroker = MessageBroker.getMessageBroker("_messageBroker"); String clientID = UUIDUtils.createUUID(); @@ -51,28 +59,48 @@ System.out.println("Students size is: " + message); AcknowledgeMessage ack = msgBroker.routeMessageToService(msg, null); - logger.info("Ack received from client for message " + msg + "is : " + ack); + /*logger.info("Ack received from client for message " + msg + "is : " + ack);*/ } - - public void sendBlock(Block block) + + public void sendBlock(Block block, Game game) { MessageBroker msgBroker = MessageBroker.getMessageBroker("_messageBroker"); String clientID = UUIDUtils.createUUID(); AsyncMessage msg = new AsyncMessage(); msg.setDestination(destination); - //String msgDestination = game.getGameCode(); msg.setHeader("DSSubtopic", subtopic); msg.setClientId(clientID); msg.setMessageId(UUIDUtils.createUUID()); msg.setTimestamp(System.currentTimeMillis()); - msg.setBody(block); - System.out.println("Message broker is: "+ msgBroker); - //System.out.println("Students size is: " + message); + AcknowledgeMessage ack = msgBroker.routeMessageToService(msg, null); + if(block!=null) + { + //int duration = block.getDuration(); + + int duration = 5; + Timer timer = new Timer(); + Long startTime = System.currentTimeMillis()/1000; + System.out.println("Started time is : " + System.currentTimeMillis()/1000); - AcknowledgeMessage ack = msgBroker.routeMessageToService(msg, null); + while((startTime + duration) > System.currentTimeMillis()/1000) + { + + System.out.println("Still Running..." + System.currentTimeMillis()/1000); + timer.run(); + } + System.out.println("Stop timer..." + System.currentTimeMillis()/1000); + pushData.pushNextData(game); + } + else + { + System.out.println("Game is Over..." + msg); + } + + + /*AcknowledgeMessage ack = msgBroker.routeMessageToService(msg, null); logger.info("Ack received from client for message " + msg + "is : " + ack); - + */ } } Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/PushData.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/PushData.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/PushData.java 2009-10-12 22:05:11 UTC (rev 294) @@ -0,0 +1,8 @@ +package edu.asu.commons.mme.utility; + +import edu.asu.commons.mme.entity.Game; + +public interface PushData { + + public void pushNextData(Game game); +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/Timer.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/Timer.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/Timer.java 2009-10-12 22:05:11 UTC (rev 294) @@ -0,0 +1,21 @@ +package edu.asu.commons.mme.utility; + +public class Timer implements Runnable { + + public Timer() + { + + } + + public void run() { + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-10-28 17:42:26
|
Revision: 339 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=339&view=rev Author: kjonas Date: 2009-10-28 17:42:18 +0000 (Wed, 28 Oct 2009) Log Message: ----------- Added error-checking so that the Instruction Pages are not updated with information that doesn't exist (information.saved* is null) increased duration to 20s Modified Paths: -------------- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-10-27 06:53:06 UTC (rev 338) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-10-28 17:42:18 UTC (rev 339) @@ -11,7 +11,6 @@ x="{(content.width-socioDemographic.width)/2}" y="{(content.height-socioDemographic.height)/2}"/> </mx:AddChild> - <mx:SetProperty target="{content}" name="x"/> <mx:SetStyle target="{content}" name="horizontalCenter" value="0"/> </mx:State> @@ -35,7 +34,9 @@ </mx:State> <mx:State name="none"> - <mx:RemoveChild target="{instructions}"/> + <!--<mx:RemoveChild target="{instructions}"/>--> + <mx:AddChild relativeTo="{expiredContent}" target="{instructions}"/> + <mx:SetProperty target="{instructions}" name="visible" value="false"/> <mx:AddChild relativeTo="{content}"> <mx:Label id="end" text="Thank you for playing!" fontSize="30"/> </mx:AddChild> @@ -332,13 +333,23 @@ private function saveDataToShell():void { - shell.updateObjectA.updateDayByDayDecisions(instructions.savedDayByDayDecisions); - shell.updateObjectA.updateForecasting(instructions.savedForecastFish, instructions.savedForecastPeople); - shell.updateObjectA.updateStrategyDesign(instructions.savedStrategyDesign); + if(instructions.savedDayByDayDecisions != null) + { + shell.updateObjectA.updateDayByDayDecisions(instructions.savedDayByDayDecisions); + shell.updateObjectB.updateDayByDayDecisions(instructions.savedDayByDayDecisions); + } - shell.updateObjectB.updateDayByDayDecisions(instructions.savedDayByDayDecisions); - shell.updateObjectB.updateForecasting(instructions.savedForecastFish, instructions.savedForecastPeople); - shell.updateObjectB.updateStrategyDesign(instructions.savedStrategyDesign); + if(instructions.savedForecastFish != null && instructions.savedForecastPeople != null) + { + shell.updateObjectA.updateForecasting(instructions.savedForecastFish, instructions.savedForecastPeople); + shell.updateObjectB.updateForecasting(instructions.savedForecastFish, instructions.savedForecastPeople); + } + + if(instructions.savedStrategyDesign != null) + { + shell.updateObjectA.updateStrategyDesign(instructions.savedStrategyDesign); + shell.updateObjectB.updateStrategyDesign(instructions.savedStrategyDesign); + } } private function loadNextBlock(nextBlock:Block):void @@ -359,6 +370,7 @@ || currentBlock.questionGroups.length < 1) { currentState = "none"; + Alert.show("block is null or no question groups"); return; } @@ -377,30 +389,30 @@ shell.setProgressBarTime(0,0,currentBlock.duration); shell.progressBarInit(); } - private function moduleResultHandler(event:ResultEvent):void - { - currentModule = (event.result as actionscript.Module); - - if(currentModule == null) - { - currentState = "none"; - } - else if(currentModule.blocks == null || currentModule.blocks.length < 1 || - (currentModule.blocks.getItemAt(0) as Block) == null || - (currentModule.blocks.getItemAt(0) as Block).questionGroups == null || - (currentModule.blocks.getItemAt(0) as Block).questionGroups.length < 1) - { - currentState = "none"; - } - else if(!instructionsLoaded) - { - currentState = "instructionsLoad"; - } - else - { - gotoInstructions(); - } - } +// private function moduleResultHandler(event:ResultEvent):void +// { +// currentModule = (event.result as actionscript.Module); +// +// if(currentModule == null) +// { +// currentState = "none"; +// } +// else if(currentModule.blocks == null || currentModule.blocks.length < 1 || +// (currentModule.blocks.getItemAt(0) as Block) == null || +// (currentModule.blocks.getItemAt(0) as Block).questionGroups == null || +// (currentModule.blocks.getItemAt(0) as Block).questionGroups.length < 1) +// { +// currentState = "none"; +// } +// else if(!instructionsLoaded) +// { +// currentState = "instructionsLoad"; +// } +// else +// { +// gotoInstructions(); +// } +// } public function getLocation():void { @@ -543,4 +555,3 @@ </mx:Script> </mx:Canvas> - Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2009-10-27 06:53:06 UTC (rev 338) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/utility/MessageHandler.java 2009-10-28 17:42:18 UTC (rev 339) @@ -79,7 +79,7 @@ { //int duration = block.getDuration(); - int duration = 5; + int duration = 20; Timer timer = new Timer(); Long startTime = System.currentTimeMillis()/1000; System.out.println("Started time is : " + System.currentTimeMillis()/1000); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |