virtualcommons-svn Mailing List for Virtual Commons Experiment Software (Page 68)
Status: Beta
Brought to you by:
alllee
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(21) |
Aug
(31) |
Sep
(6) |
Oct
(15) |
Nov
(2) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(4) |
Feb
(6) |
Mar
(12) |
Apr
(52) |
May
(14) |
Jun
(19) |
Jul
(81) |
Aug
(115) |
Sep
(36) |
Oct
(88) |
Nov
(46) |
Dec
(58) |
2010 |
Jan
(52) |
Feb
(55) |
Mar
(48) |
Apr
(15) |
May
(5) |
Jun
(38) |
Jul
(27) |
Aug
(24) |
Sep
(28) |
Oct
(1) |
Nov
(2) |
Dec
(29) |
2011 |
Jan
(87) |
Feb
(39) |
Mar
(63) |
Apr
(42) |
May
(26) |
Jun
(53) |
Jul
(23) |
Aug
(43) |
Sep
(37) |
Oct
(25) |
Nov
(4) |
Dec
(7) |
2012 |
Jan
(73) |
Feb
(79) |
Mar
(62) |
Apr
(28) |
May
(12) |
Jun
(2) |
Jul
(9) |
Aug
(1) |
Sep
(8) |
Oct
|
Nov
(3) |
Dec
(3) |
2013 |
Jan
(8) |
Feb
(16) |
Mar
(38) |
Apr
(74) |
May
(62) |
Jun
(15) |
Jul
(49) |
Aug
(19) |
Sep
(9) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(25) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <see...@us...> - 2009-08-07 21:42:13
|
Revision: 233 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=233&view=rev Author: seematalele Date: 2009-08-07 21:42:05 +0000 (Fri, 07 Aug 2009) Log Message: ----------- Hibernate.initialize all the round in the location Modified Paths: -------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 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-07 21:41:30 UTC (rev 232) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-08-07 21:42:05 UTC (rev 233) @@ -26,9 +26,12 @@ { initLocation = locations.get(i); Hibernate.initialize(initLocation); - Iterator<Round> iterRound = initLocation.getRounds().iterator(); - while(iterRound.hasNext()) - Hibernate.initialize(iterRound.next()); + List<Round> rounds = initLocation.getRounds(); + for(int j = 0; j < rounds.size(); j++) + { + Hibernate.initialize(rounds.get(i)); + } + } return locations; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-07 21:41:38
|
Revision: 232 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=232&view=rev Author: seematalele Date: 2009-08-07 21:41:30 +0000 (Fri, 07 Aug 2009) Log Message: ----------- made List of round as a @CollectionOfElements Modified Paths: -------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 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-07 21:29:49 UTC (rev 231) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-08-07 21:41:30 UTC (rev 232) @@ -5,12 +5,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.ManyToMany; import javax.persistence.Table; +import org.hibernate.annotations.CollectionOfElements; + @Entity @Table(name = "location") public class Location implements Serializable{ @@ -23,6 +26,7 @@ @ManyToMany @JoinColumn(name="rounds_id") + @CollectionOfElements(fetch= FetchType.EAGER) private List<Round> rounds; @Column(nullable=false,name="location_name") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-07 21:29:59
|
Revision: 231 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=231&view=rev Author: seematalele Date: 2009-08-07 21:29:49 +0000 (Fri, 07 Aug 2009) Log Message: ----------- made changes in the location table. Added null values for currentPopulation Modified Paths: -------------- mentalmodels/trunk/src/main/db/init-mme.sql Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-07 20:22:26 UTC (rev 230) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-07 21:29:49 UTC (rev 231) @@ -329,18 +329,6 @@ -- Table structure for table `location` -- -DROP TABLE IF EXISTS `location`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `location` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `growth_rate` double NOT NULL, - `initial_population` int(11) NOT NULL, - `location_name` varchar(255) NOT NULL, - `max_capacity` 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 `location` @@ -348,7 +336,7 @@ LOCK TABLES `location` WRITE; /*!40000 ALTER TABLE `location` DISABLE KEYS */; -INSERT INTO `location` VALUES (1,0.5,5,'Bay1',10),(2,0.15,10,'Bay2',20),(3,0.05,15,'Bay3',30),(4,0,0,'Harbor',0); +INSERT INTO `location` VALUES (1,null,0.5,5,'Bay1',10),(2,null,0.15,10,'Bay2',20),(3,null,0.05,15,'Bay3',30),(4,null,0,0,'Harbor',0); /*!40000 ALTER TABLE `location` ENABLE KEYS */; UNLOCK TABLES; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Kalin J. <kj...@as...> - 2009-08-07 20:48:02
|
Back from lunch 13:45 On Fri, Aug 7, 2009 at 1:24 PM, Kalin Jonas <kj...@as...> wrote: > 13:30 I go for lunch (2hr) > I have finished the assignGroups function, and finished up testing the > integration with the locationService. I will be doing more testing with > answeringservice when i return > > > On Fri, Aug 7, 2009 at 12:21 PM, Kalin Jonas <kj...@as...> wrote: > >> Friday I come in at 11:30am >> I will be working on forming groups, and answeringservice >> > > |
From: Kalin J. <kj...@as...> - 2009-08-07 20:24:33
|
13:30 I go for lunch (2hr) I have finished the assignGroups function, and finished up testing the integration with the locationService. I will be doing more testing with answeringservice when i return On Fri, Aug 7, 2009 at 12:21 PM, Kalin Jonas <kj...@as...> wrote: > Friday I come in at 11:30am > I will be working on forming groups, and answeringservice > |
From: <kj...@us...> - 2009-08-07 20:22:35
|
Revision: 230 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=230&view=rev Author: kjonas Date: 2009-08-07 20:22:26 +0000 (Fri, 07 Aug 2009) Log Message: ----------- changed to include static method assignGroups: takes in an ArrayCollection of Student.as objects, returns the same list. all students are given a group and student number, up to the maximum size of the group. they will be assigned groups and numbers in the same order as they appear in the list, not randomly. Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/Student.as Modified: mentalmodels/trunk/flex/src/actionscript/Student.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Student.as 2009-08-07 18:36:30 UTC (rev 229) +++ mentalmodels/trunk/flex/src/actionscript/Student.as 2009-08-07 20:22:26 UTC (rev 230) @@ -1,32 +1,52 @@ package actionscript { + import mx.collections.ArrayCollection; + [Bindable] [RemoteClass(alias="edu.asu.commons.mme.entity.Student")] public class Student { - - public var 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; + 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 timestamp:Date; + public var gender:String; - + /** + * input: + * students:ArrayCollection - list of Student objects + * maxGroupSize:int - maximum number of students in a group + * + * sorts students into groups + * the remaining students may be put into a group that is smaller than maxGroupSize + * objects are modified; you do not have to use the arraylist that is returned. + * + * returns: + * modified list of students + */ + public static function assignGroups(students:ArrayCollection, maxGroupSize:int=5):ArrayCollection + { + var groupSize:int = 0; + var groupNum:int = 1; + for(var i:int = 0; i < students.length; i++) + { + groupSize++; + + (students.getItemAt(i) as Student).group = groupNum; //which group + (students.getItemAt(i) as Student).studentNo = groupSize; //what number in the group + + if(groupSize == maxGroupSize) + { + groupSize = 1; + groupNum++; + } + } + + return students; + } } } \ 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: Kalin J. <kj...@as...> - 2009-08-07 19:22:05
|
Friday I come in at 11:30am I will be working on forming groups, and answeringservice |
From: <see...@us...> - 2009-08-07 18:36:47
|
Revision: 229 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=229&view=rev Author: seematalele Date: 2009-08-07 18:36:30 +0000 (Fri, 07 Aug 2009) Log Message: ----------- Added the StartGame.mxml Added Paths: ----------- mentalmodels/trunk/flex/src/StartGame.mxml Added: mentalmodels/trunk/flex/src/StartGame.mxml =================================================================== --- mentalmodels/trunk/flex/src/StartGame.mxml (rev 0) +++ mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-07 18:36:30 UTC (rev 229) @@ -0,0 +1,24 @@ +<?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; + + 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:Script> + + <mx:Button label="Start Game" id="btnStartGame" horizontalCenter="-6" verticalCenter="-46" click="feed.start()"/> + <mx:RemoteObject id="feed" destination="feed" fault="{faultHandler(event)}" /> +</mx:Application> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-07 00:57:44
|
Revision: 228 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=228&view=rev Author: seematalele Date: 2009-08-07 00:57:34 +0000 (Fri, 07 Aug 2009) Log Message: ----------- Created HibernateGameDao.java and HibernateModuleRoundConfigDao.java Written code in RoundService.java which will return blocks but it is not working properly. StartGame.java pushes block to the clients once time is over. This code is not properly working. Deleted Gender.java Modified Paths: -------------- 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/service/AnsweringService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/Feed.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml mentalmodels/trunk/src/main/webapp/startfeed.jsp Added Paths: ----------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateModuleRoundConfigDao.java mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java mentalmodels/trunk/src/main/webapp/StartGame.swf mentalmodels/trunk/src/main/webapp/WEB-INF/classes/applicationContext.xml Removed Paths: ------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java Modified: mentalmodels/trunk/src/main/db/init-mme.sql =================================================================== --- mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/db/init-mme.sql 2009-08-07 00:57:34 UTC (rev 228) @@ -262,31 +262,13 @@ -- 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, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Dumping data for table `game` -- LOCK TABLES `game` WRITE; /*!40000 ALTER TABLE `game` DISABLE KEYS */; -INSERT INTO `game` VALUES (1,'First game','island.jpg',30,5,0,4,3,'2009-07-19 17:30:35','Mental Model Experiment'); +INSERT INTO `game` VALUES (1,'First game','island.jpg',30,5,0,4,3,'2009-07-19 17:30:35','Mental Model Experiment',null,null); /*!40000 ALTER TABLE `game` ENABLE KEYS */; UNLOCK TABLES; @@ -450,7 +432,7 @@ LOCK TABLES `module_round_config` WRITE; /*!40000 ALTER TABLE `module_round_config` DISABLE KEYS */; -INSERT INTO `module_round_config` VALUES (1,1,2,1),(2,1,3,2),(3,2,2,2); +INSERT INTO `module_round_config` VALUES (1,1,1,1),(2,1,2,2),(3,1,3,3),(4,2,4,3),(5,1,5,4); /*!40000 ALTER TABLE `module_round_config` ENABLE KEYS */; UNLOCK TABLES; @@ -593,7 +575,7 @@ LOCK TABLES `round_config` WRITE; /*!40000 ALTER TABLE `round_config` DISABLE KEYS */; -INSERT INTO `round_config` VALUES (1,0,1,1,NULL),(2,1,2,1,NULL); +INSERT INTO `round_config` VALUES (1,0,1,1,NULL),(2,0,2,1,NULL),(3,1,3,1,NULL),(4,0,4,1,NULL); /*!40000 ALTER TABLE `round_config` ENABLE KEYS */; UNLOCK TABLES; Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameDao.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateGameDao.java 2009-08-07 00:57:34 UTC (rev 228) @@ -0,0 +1,12 @@ +package edu.asu.commons.mme.dao; + +import edu.asu.commons.mme.entity.Game; + +public class HibernateGameDao extends HibernateDao<Game>{ + + public HibernateGameDao() + { + super(Game.class); + } + +} Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateModuleRoundConfigDao.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateModuleRoundConfigDao.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateModuleRoundConfigDao.java 2009-08-07 00:57:34 UTC (rev 228) @@ -0,0 +1,13 @@ +package edu.asu.commons.mme.dao; + +import edu.asu.commons.mme.entity.ModuleRoundConfig; + +public class HibernateModuleRoundConfigDao extends HibernateDao<ModuleRoundConfig> +{ + + public HibernateModuleRoundConfigDao() { + super(ModuleRoundConfig.class); + // TODO Auto-generated constructor stub + } + +} 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-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java 2009-08-07 00:57:34 UTC (rev 228) @@ -10,6 +10,7 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.Lob; +import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -55,14 +56,22 @@ @JoinColumn(name="rounds_id") private List<Round> rounds; + @ManyToOne + @JoinColumn(name="current_round_id", nullable=true) + private Round currentRound; + + @ManyToOne + @JoinColumn(name="current_block_id", nullable=true) + private Block currentBlock; + + public void setId(Long id) { this.id = id; } public Long getId() { return id; } - - + public void setTitle(String title) { this.title = title; } @@ -130,6 +139,18 @@ public void setRounds(List<Round> rounds) { this.rounds = rounds; } + public void setCurrentRound(Round currentRound) { + this.currentRound = currentRound; + } + public Round getCurrentRound() { + return currentRound; + } + public void setCurrentBlock(Block currentBlock) { + this.currentBlock = currentBlock; + } + public Block getCurrentBlock() { + return currentBlock; + } } Deleted: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java 2009-08-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Gender.java 2009-08-07 00:57:34 UTC (rev 228) @@ -1,5 +0,0 @@ -package edu.asu.commons.mme.entity; - -public enum Gender { - F, M -} 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-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/AnsweringService.java 2009-08-07 00:57:34 UTC (rev 228) @@ -23,7 +23,7 @@ StudentResponse studentResponse; Student student; - public Block saveQuestion(List<StudentResponse> studentResponses) + public void saveQuestion(List<StudentResponse> studentResponses) { for(int i = 0; i < studentResponses.size(); i++ ) { @@ -37,7 +37,7 @@ save(studentResponse); } - return moduleService.getNextBlock(); + //return moduleService.getBlock(); } public void daybydayOutput(DayByDayDecisions studentDecision) 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-08-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/Feed.java 2009-08-07 00:57:34 UTC (rev 228) @@ -1,70 +1,50 @@ package edu.asu.commons.mme.service; -//package edu.asu.commons.mme.service; -import flex.messaging.MessageBroker; -import flex.messaging.messages.AsyncMessage; -import flex.messaging.util.UUIDUtils; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; -public class Feed{ +public class Feed implements ApplicationContextAware{ public static void main(String args[]) { Feed feed = new Feed(); feed.start(); } - - private static FeedThread thread; + private StartGame thread; + private ApplicationContext ctx; + public Feed() { } public void start() { - if (thread == null) { - thread = new FeedThread(); - thread.start(); + + try{ + if (thread == null) { + thread = (StartGame)ctx.getBean("startGame"); + thread.run(); + } + }catch(Exception e) + { + System.out.println(e.getStackTrace()); } } public void stop() { - thread.running = false; + thread.setRunning(false); thread = null; } - public static class FeedThread extends Thread { + @Override + public void setApplicationContext(ApplicationContext context) + throws BeansException { + // TODO Auto-generated method stub + this.ctx = context; - public boolean running = true; + } - public void run() { - MessageBroker msgBroker = MessageBroker.getMessageBroker(null); - String clientID = UUIDUtils.createUUID(); - - 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("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); - - - - } - } - - - } - /*@Override public Object invoke(Message msg) { // TODO Auto-generated method stub 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-08-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/ModuleService.java 2009-08-07 00:57:34 UTC (rev 228) @@ -6,26 +6,180 @@ import org.hibernate.Hibernate; import org.springframework.transaction.annotation.Transactional; +import edu.asu.commons.mme.dao.HibernateGameDao; import edu.asu.commons.mme.dao.HibernateModuleDao; +import edu.asu.commons.mme.dao.HibernateModuleRoundConfigDao; import edu.asu.commons.mme.entity.Block; 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.InformationWindow; import edu.asu.commons.mme.entity.Module; import edu.asu.commons.mme.entity.Question; import edu.asu.commons.mme.entity.QuestionGroup; +import edu.asu.commons.mme.entity.Round; @Transactional public class ModuleService extends Service.Base<Module, HibernateModuleDao>{ + + private HibernateGameDao gameDao; + private HibernateModuleRoundConfigDao moduleRoundConfigDao; + private Module currentModule; + private boolean startGame = true; + private Round currentRound; + private int blockSeqNo; + private Block currentBlock; - public Module getModule(int moduleNumber) + + public void test() { - // Enter the sequence number in new Integer(Sequence number of module u want to fetch) + getLogger().debug("test to check if module service is working...." ); + } + + public Block getBlock(Module module, int seqNo) + { + //Module module = new Module(); + // module = currentModule; + Block block = new Block(); + for(int i = 0; i < module.getBlocks().size(); i++) + { + block = module.getBlocks().get(i); + if(block.getSequenceNo() == seqNo) + { + return block; + } + } + + return block; + } + /* + *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 + */ + + + /*public Block getNextBlock() + { + int currentRoundNo = getCurrentRoundNo(); + getLogger().debug("current round number is: " + currentRoundNo); + + if(currentRoundNo == 0) + { + //get first round no + currentRound = getRound(1); + + } + currentBlock = new Block(); + //getLogger().debug("start module " + getStartModule()); + if(currentModule == null) + { + if(startGame) + { + //get the first module + currentModule = new Module(); + currentModule = getModule(1); + + //get the first block in the first module + currentBlock = getBlock(currentModule, 1); + // blockSeqNo = 1; + getLogger().debug(currentBlock.getDescription()); + //get the current game and set the current round and current block ids + + saveGameState(currentRound, currentBlock); + + startGame = false; + + //getBlock() + } + else if(isModuleFinished(currentModule)) + { + //get the current game + //get the current round + currentRound = getCurrentRound(); + //get the current module in the round + } + } + + else + { + + } + return currentBlock; + + }*/ + + + private Round getRound(int roundNo) { + // TODO Auto-generated method stub + currentRound = new Round(); + + + return null; + } + + 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); + if(game.getCurrentRound() == null) + return 0; + else + return game.getCurrentRound().getRoundNo(); + + } + + private boolean isModuleFinished(Module module) { + // TODO Auto-generated method stub + Block block = new Block(); + block = getFinishedBlock(); + module.getBlocks().size(); + //if(current) + return false; + } + + private Block getFinishedBlock() { + // TODO Auto-generated method stub + Block block = new Block(); + return block; + } + + private void saveGameState(Round round, Block block) { + + + //FIXME: Game id 1 is hard coded but needs to make it dynamic + Game game = gameDao.find(1L); + game.setCurrentBlock(block); + game.setCurrentRound(round); + gameDao.save(game); + + } + + public Module getModule(Round round, int moduleNumber) + { + // Enter the sequence number in new Integer(Sequence number of module u want to fetch) + Module module = getDao().findByProperty("sequenceNo", moduleNumber); - + Hibernate.initialize(module); getLogger().debug("Module object is " + module.getDescription()); - + initializeModule(module); + + return module; + } + + + public Integer getTimerforBlock(Block block) + { + return block.getDuration(); + + } + + + private void initializeModule(Module module) + { + // TODO Auto-generated method stub Iterator<Block> iterateBlock = module.getBlocks().iterator(); while(iterateBlock.hasNext()) { @@ -42,8 +196,9 @@ { QuestionGroup questionGroup = iteratorquestionGrp.next(); Hibernate.initialize(questionGroup); + // getLogger().debug(questionGroup.getDescription()); List<Question> questions = questionGroup.getQuestions(); - + for(int j = 0; j < questions.size(); j++) { Hibernate.initialize(questions.get(j)); @@ -56,24 +211,68 @@ } } } - + } - 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; + + + + public void setCurrentModule(Module currentModule) { + this.currentModule = currentModule; } - + + + public Module getCurrentModule() { + return currentModule; + } + + + public void setCurrentRound(Round currentRound) { + this.currentRound = currentRound; + } + + + public Round getCurrentRound() { + return currentRound; + } + + + public void setStartModule(Boolean startModule) { + this.startGame = startModule; + } + + + public Boolean getStartModule() { + return startGame; + } + + + public void setGameDao(HibernateGameDao gameDao) { + this.gameDao = gameDao; + } + + public HibernateGameDao getGameDao() { + return gameDao; + } + + public void setBlockSeqNo(int blockSeqNo) { + this.blockSeqNo = blockSeqNo; + } + + public int getBlockSeqNo() { + return blockSeqNo; + } + + public void setModuleRoundConfigDao(HibernateModuleRoundConfigDao moduleRoundConfigDao) { + this.moduleRoundConfigDao = moduleRoundConfigDao; + } + + public HibernateModuleRoundConfigDao getModuleRoundConfigDao() { + return moduleRoundConfigDao; + } + + } Modified: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java 2009-08-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java 2009-08-07 00:57:34 UTC (rev 228) @@ -1,11 +1,8 @@ package edu.asu.commons.mme.service; -import java.lang.reflect.Field; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; -import java.util.Set; import org.hibernate.Hibernate; import org.springframework.transaction.annotation.Transactional; @@ -17,14 +14,13 @@ import edu.asu.commons.mme.dao.HibernateQuestionDao; import edu.asu.commons.mme.dao.HibernateQuestionGroupDao; import edu.asu.commons.mme.entity.Block; -import edu.asu.commons.mme.entity.CategoricalQuestion; import edu.asu.commons.mme.entity.CategoricalOption; +import edu.asu.commons.mme.entity.CategoricalQuestion; import edu.asu.commons.mme.entity.InformationWindow; import edu.asu.commons.mme.entity.Module; import edu.asu.commons.mme.entity.PsychometricQuestion; import edu.asu.commons.mme.entity.Question; import edu.asu.commons.mme.entity.QuestionGroup; -import edu.asu.commons.mme.entity.Round; /** 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-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/RoundService.java 2009-08-07 00:57:34 UTC (rev 228) @@ -1,20 +1,390 @@ 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.hibernate.criterion.MatchMode; +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.HibernateModuleDao; +import edu.asu.commons.mme.dao.HibernateModuleRoundConfigDao; import edu.asu.commons.mme.dao.HibernateRoundConfigDao; +import edu.asu.commons.mme.entity.Block; +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.InformationWindow; 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; +@Transactional public class RoundService extends Service.Base<Round, HibernateRoundConfigDao> { - private ModuleService moduleService; + private HibernateModuleDao moduleDao; + private HibernateBlockDao blockDao; + private HibernateGameDao gameDao; + private HibernateModuleRoundConfigDao moduleRoundDao; + + private Module currentModule; + private boolean startGame = true; + private Round currentRound; + private int blockSeqNo; + //private Block currentBlock; + + + public Module getNextModule(int sequenceNo) + { + return getModule(sequenceNo); + } + + + public void test() + { + getLogger().debug("test to check if module service is working...." ); + } - public void setModuleService(ModuleService moduleService) { - this.moduleService = moduleService; + public Block getBlock() + { + /* + *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 + */ + currentRound = new Round(); + int currentRoundNo = getCurrentRoundNo(); + getLogger().debug("current round number is: " + currentRoundNo); + Block currentBlock = null; + if(currentRoundNo == 0) + { + //get first round no + getLogger().debug("in if loop"); + setRound(1); + + currentModule = new Module(); + setModule(); + + //get the first block in the first module + currentBlock = new Block(); + currentBlock = getBlock(1); + getLogger().debug(currentBlock.getDescription()); + + //get the current game and set the current round and current block ids + saveGameState(currentBlock); + } + + else + { + /**Check if the current module is finished , if yes then get next module + * if no then get next block + */ + if(isCurrentModuleFinished(currentBlock)) + { + //get next module if any, else get next round + + getNextModule(); + } + else + { + //get next block + getNextBlock(getCurrentBlock()); + } + } + initializeCurrentBlock(currentBlock); + return currentBlock; + } + + private void setModule() { + // TODO Auto-generated method stub + + ModuleRoundConfig moduleRoundconfig = new ModuleRoundConfig(); + + moduleRoundconfig.setRound(currentRound); + getLogger().debug("currentround id is "+ currentRound.getId()); + moduleRoundconfig.setSequenceNo(1); + List<ModuleRoundConfig> moduleRoundConfigs = new ArrayList<ModuleRoundConfig> (); + + moduleRoundConfigs = moduleRoundDao.findByExampleLike(moduleRoundconfig, MatchMode.EXACT); + getLogger().debug("module size is " + moduleRoundConfigs.size()); + if(moduleRoundConfigs.size() == 1) + { + setCurrentModule(moduleRoundConfigs.get(0).getModule()); + getLogger().debug("module is set " + currentModule.getDescription()); + } + //return moduleRoundConfig; + } - public Module getNextModule(int sequenceNo) + + private void getNextModule() { + // TODO Auto-generated method stub + //moduleRoundDao.findAllByProperty("", propertyValue) + + } + + + public HibernateModuleDao getModuleDao() { + return moduleDao; + } + + + public void setModuleDao(HibernateModuleDao moduleDao) { + this.moduleDao = moduleDao; + } + + + private void initializeCurrentBlock(Block currentBlock) { + // TODO Auto-generated method stub + + Hibernate.initialize(currentBlock); + Iterator<QuestionGroup> iteratorquestionGrp = currentBlock.getQuestionGroups().iterator(); + { + while(iteratorquestionGrp.hasNext()) + { + QuestionGroup questionGroup = iteratorquestionGrp.next(); + Hibernate.initialize(questionGroup); +// getLogger().debug(questionGroup.getDescription()); + List<Question> questions = questionGroup.getQuestions(); + + for(int j = 0; j < questions.size(); j++) + { + Hibernate.initialize(questions.get(j)); + if(questions.get(j).getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.CategoricalQuestion")) + { + CategoricalQuestion categoricalQ = (CategoricalQuestion)questions.get(j); + Iterator<CategoricalOption> categoricalOption = categoricalQ.getCategoricalOptions().iterator(); + Hibernate.initialize(categoricalOption); + } + } + } + } + + } + private void getNextBlock(Block currentBlock) { + // TODO Auto-generated method stub + List<Block> blocks = new ArrayList<Block>(); + blocks = currentModule.getBlocks(); + + for(int i = 0; i < blocks.size(); i++) + { + if(currentBlock.getSequenceNo() < blocks.get(i).getSequenceNo()) + { + currentBlock = blocks.get(i); + } + + } + + } + + public Module getModule(int moduleNumber) { - return moduleService.getModule(sequenceNo); + // Enter the sequence number in new Integer(Sequence number of module u want to fetch) + + Module module = moduleDao.findByProperty("sequenceNo", moduleNumber); + + Hibernate.initialize(module); + getLogger().debug("Module object is " + module.getDescription()); + initializeModule(module); + + return module; } + + public Block getBlock(int seqNo) + { + //Module module = new Module(); + // module = currentModule; + Block block = new Block(); + for(int i = 0; i < currentModule.getBlocks().size(); i++) + { + block = currentModule.getBlocks().get(i); + if(block.getSequenceNo() == seqNo) + { + return block; + } + } + + return block; + } + + private void setRound(int roundNo) { + // TODO Auto-generated method stub + currentRound = new Round(); + + currentRound = getDao().findByProperty("roundNo", roundNo); + //Hibernate.initialize(currentRound); + //getLogger().debug("currentround object is "+ currentRound.getId()); + setCurrentRound(currentRound); + + } + + 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); + if(game.getCurrentRound() == null) + return 0; + else + return game.getCurrentRound().getRoundNo(); + + } + + private boolean isCurrentModuleFinished(Block currentBlock) { + // TODO Auto-generated method stub + List<Block> blocks = new ArrayList<Block>(); + blocks = currentModule.getBlocks(); + //select max(b.sequence_no) from block b where b.module_id=2; + + for(int i = 0; i < blocks.size(); i++) + { + if(currentBlock.getSequenceNo() < blocks.get(i).getSequenceNo()) + { + return false; + } + else + return true; + } + return false; + } + + 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); + } + + + public Integer getTimerforBlock(Block block) + { + return block.getDuration(); + + } + + + private void initializeModule(Module module) + { + // TODO Auto-generated method stub + Iterator<Block> iterateBlock = module.getBlocks().iterator(); + while(iterateBlock.hasNext()) + { + Block block = iterateBlock.next(); + Hibernate.initialize(block); + Iterator<InformationWindow> infoWindow = block.getInformationWindows().iterator(); + while(infoWindow.hasNext()) + { + Hibernate.initialize(infoWindow.next()); + } + Iterator<QuestionGroup> iteratorquestionGrp = block.getQuestionGroups().iterator(); + { + while(iteratorquestionGrp.hasNext()) + { + QuestionGroup questionGroup = iteratorquestionGrp.next(); + Hibernate.initialize(questionGroup); + // getLogger().debug(questionGroup.getDescription()); + List<Question> questions = questionGroup.getQuestions(); + + for(int j = 0; j < questions.size(); j++) + { + Hibernate.initialize(questions.get(j)); + if(questions.get(j).getClass().getName().equalsIgnoreCase("edu.asu.commons.mme.entity.CategoricalQuestion")) + { + CategoricalQuestion categoricalQ = (CategoricalQuestion)questions.get(j); + Iterator<CategoricalOption> categoricalOption = categoricalQ.getCategoricalOptions().iterator(); + Hibernate.initialize(categoricalOption); + } + } + } + } + + } + + + } + + + public Block getCurrentBlock() { + //FIXEME: game id 1 is hard coded, it should be dynamic + Game game = gameDao.find(1L); + Block block = new Block(); + block = game.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() { + return currentRound; + } + + + public void setStartModule(Boolean startModule) { + this.startGame = startModule; + } + + + public Boolean getStartModule() { + return startGame; + } + + + public void setGameDao(HibernateGameDao gameDao) { + this.gameDao = gameDao; + } + + public HibernateGameDao getGameDao() { + return gameDao; + } + + public void setBlockSeqNo(int blockSeqNo) { + this.blockSeqNo = blockSeqNo; + } + + public int getBlockSeqNo() { + return blockSeqNo; + } + public void setModuleRoundDao(HibernateModuleRoundConfigDao moduleRoundDao) { + this.moduleRoundDao = moduleRoundDao; + } + public HibernateModuleRoundConfigDao getModuleRoundDao() { + return moduleRoundDao; + } + public void setBlockDao(HibernateBlockDao blockDao) { + this.blockDao = blockDao; + } + public HibernateBlockDao getBlockDao() { + return blockDao; + } + + + + } Added: mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java =================================================================== --- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java (rev 0) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartGame.java 2009-08-07 00:57:34 UTC (rev 228) @@ -0,0 +1,105 @@ +package edu.asu.commons.mme.service; + +import edu.asu.commons.mme.entity.Block; +import flex.messaging.MessageBroker; +import flex.messaging.messages.AsyncMessage; +import flex.messaging.util.UUIDUtils; + +public class StartGame extends Thread { + + private boolean running; + private RoundService roundService; + + public StartGame() + { + + System.out.println("module service object is "); + /*moduleService.test(); + moduleService.setStartModule(true);*/ + setRunning(true); + } + + /** + * 1)Initially first block will get pushed to all the clients. + * 2)get timer for that block + * 3)start the timer + * 4)Once the timer is over, push the next block + * + */ + public void run() { + + Block block = new Block(); + //roundService.test(); + roundService.setStartModule(true); + + MessageBroker msgBroker = MessageBroker.getMessageBroker(null); + String clientID = UUIDUtils.createUUID(); + + if(isGameOver()) + { + + } + else + { + while (running) { + + //Push the first block to the clients + AsyncMessage msg = new AsyncMessage(); + msg.setDestination("DataPush"); + //msg.setHeader("DSSubtopic", "hello"); + msg.setClientId(clientID); + msg.setMessageId(UUIDUtils.createUUID()); + msg.setTimestamp(System.currentTimeMillis()); + + block = roundService.getBlock(); + if(block != null) + { + msg.setBody("Here is a block!!!" + block); + System.out.println("Message broker is: "+ msgBroker); + System.out.println("Message is: "+ block.getDescription()); + msgBroker.routeMessageToService(msg, null); + + //get the timer for the block + Integer timer = roundService.getTimerforBlock(block); + + //start the timer for the block sent + try { + Thread.sleep(5000); + //running = false; + } catch (InterruptedException e) { + } + } + else + { + running = false; + break; + } + + } + } + } + + + private boolean isGameOver() { + // TODO Auto-generated method stub + + return false; + } + + public RoundService getRoundService() { + return roundService; + } + + public void setRoundService(RoundService roundService) { + this.roundService = roundService; + } + + public void setRunning(boolean running) + { + this.running = running; + } + + + +} + 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-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StartupService.java 2009-08-07 00:57:34 UTC (rev 228) @@ -38,11 +38,11 @@ return studentService.createStudent(birthYear, semester, gender, major); } - public Module getFirstModule() + /*public Block getFirstBlock() { //studentService.formGroups(); - return moduleService.getModule(1); - } + return moduleService.getBlock(); + }*/ public void setModuleService(ModuleService moduleService) { 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-08-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/StudentService.java 2009-08-07 00:57:34 UTC (rev 228) @@ -1,14 +1,13 @@ package edu.asu.commons.mme.service; +import java.sql.Timestamp; import java.util.ArrayList; -import java.util.List; import java.util.Date; -import java.sql.Timestamp; +import java.util.List; import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateStudentDao; -import edu.asu.commons.mme.entity.Gender; import edu.asu.commons.mme.entity.Student; /** Added: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Property changes on: mentalmodels/trunk/src/main/webapp/StartGame.swf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-08-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml 2009-08-07 00:57:34 UTC (rev 228) @@ -76,8 +76,15 @@ <property name='sessionFactory' ref='sessionFactory'/> </bean> - + <bean id='gameDao' class='edu.asu.commons.mme.dao.HibernateGameDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + <bean id='moduleRoundDao' class='edu.asu.commons.mme.dao.HibernateModuleRoundConfigDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + <!-- spring managed service layer --> <bean id='dayByDayDecisionsService' class='edu.asu.commons.mme.service.DayByDayDecisionsService'> @@ -86,9 +93,11 @@ <bean id='roundService' class='edu.asu.commons.mme.service.RoundService'> <property name='dao' ref='roundConfigDao'/> - <property name='moduleService' ref='moduleService'/> - - </bean> + <property name='moduleDao' ref='moduleDao'/> + <property name='gameDao' ref='gameDao' /> + <property name='moduleRoundDao' ref='moduleRoundDao' /> + <property name='blockDao' ref='blockDao'/> +</bean> <bean id='answeringService' class='edu.asu.commons.mme.service.AnsweringService'> @@ -125,10 +134,24 @@ <!-- spring managed service layer --> <bean id='moduleService' class="edu.asu.commons.mme.service.ModuleService"> <property name='dao' ref='moduleDao'/> - </bean> + <property name='gameDao' ref='gameDao' /> + </bean> + + <!-- <bean id="testService" class="edu.asu.commons.mme.service.TestService"> + <property name='moduleService' ref='moduleService'/> + <property name="startModule" value="Testing String."/> + </bean> --> + <bean id="startGame" class="edu.asu.commons.mme.service.StartGame"> + <property name='roundService' ref='roundService'/> + </bean> + + <bean id="feed" class="edu.asu.commons.mme.service.Feed"> + + </bean> -<!-- Expose services for BlazeDS remoting --> + +<!-- Expose services for Flex/BlazeDS remoting --> <flex:remote-service ref="studentService" /> <flex:remote-service ref="moduleService" /> <flex:remote-service ref="questionCreatorService" /> @@ -136,6 +159,7 @@ <flex:remote-service ref="startupService" /> <flex:remote-service ref="answeringService" /> <flex:remote-service ref="locationService" /> + <flex:remote-service ref="feed" /> <!-- Flex related information ended--> Added: mentalmodels/trunk/src/main/webapp/WEB-INF/classes/applicationContext.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/classes/applicationContext.xml (rev 0) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/classes/applicationContext.xml 2009-08-07 00:57:34 UTC (rev 228) @@ -0,0 +1,185 @@ +<?xml version="1.0"?> +<!-- + vim:sts=2:sw=2: +--> +<!-- + $Id: applicationContext.xml 617 2008-03-28 17:27:23Z alllee $ +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:flex="http://www.springframework.org/schema/flex" + xmlns:security="http://www.springframework.org/schema/security" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xmlns:tx="http://www.springframework.org/schema/tx" + xsi:schemaLocation=" + + http://www.springframework.org/schema/tx + http://www.springframework.org/schema/tx/spring-tx-2.0.xsd + http://www.springframework.org/schema/aop + http://www.springframework.org/schema/aop/spring-aop-2.0.xsd + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/flex + http://www.springframework.org/schema/flex/spring-flex-1.0.xsd + http://www.springframework.org/schema/security + http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"> + + +<!-- Flex related information started --> + <flex:message-broker /> + +<!-- XXX: Split these out into separate XML files and import them if this file gets too large --> +<!-- spring managed daos --> + <bean id='studentDao' class='edu.asu.commons.mme.dao.HibernateStudentDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + <bean id='roundConfigDao' class='edu.asu.commons.mme.dao.HibernateRoundConfigDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + <bean id='moduleDao' class="edu.asu.commons.mme.dao.HibernateModuleDao"> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + <bean id='blockDao' class='edu.asu.commons.mme.dao.HibernateBlockDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + <bean id='questionDao' class='edu.asu.commons.mme.dao.HibernateQuestionDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + <bean id='psychometricQuestionDao' class='edu.asu.commons.mme.dao.HibernatePsychometricQuestionDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + + <bean id='categoricalQuestionDao' class='edu.asu.commons.mme.dao.HibernateCategoricalQuestionDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + + <bean id='questionGroupDao' class='edu.asu.commons.mme.dao.HibernateQuestionGroupDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + <bean id='studentResponseDao' class='edu.asu.commons.mme.dao.HibernateStudentResponseDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + <bean id='dayByDayDecisionsDao' class='edu.asu.commons.mme.dao.HibernateDayByDayDecisionsDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + <bean id='locationDao' class='edu.asu.commons.mme.dao.HibernateLocationDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + <bean id='gameDao' class='edu.asu.commons.mme.dao.HibernateGameDao'> + <property name='sessionFactory' ref='sessionFactory'/> + </bean> + + +<!-- spring managed service layer --> + +<bean id='dayByDayDecisionsService' class='edu.asu.commons.mme.service.DayByDayDecisionsService'> + <property name='dao' ref='dayByDayDecisionsDao'/> + </bean> + +<bean id='roundService' class='edu.asu.commons.mme.service.RoundService'> + <property name='dao' ref='roundConfigDao'/> + <property name='moduleService' ref='moduleService'/> + + </bean> + + + <bean id='answeringService' class='edu.asu.commons.mme.service.AnsweringService'> + <property name='dao' ref='studentResponseDao'/> + <property name='studentDao' ref='studentDao'/> + <property name='dayByDayDecisionsService' ref='dayByDayDecisionsService'/> + + </bean> + + <bean id='questionCreatorService' class='edu.asu.commons.mme.service.QuestionCreatorService'> + <property name='dao' ref='questionDao'/> + <property name='blockDao' ref='blockDao'/> + <property name='moduleDao' ref='moduleDao'/> + <property name='questionGroupDao' ref='questionGroupDao'/> + <property name='psychometricQuestionDao' ref='psychometricQuestionDao'/> + <property name='categoricalQuestionDao' ref='categoricalQuestionDao'/> + + </bean> + + <bean id='startupService' class='edu.asu.commons.mme.service.StartupService'> + <property name='questionCreatorService' ref='questionCreatorService'/> + <property name='studentService' ref='studentService'/> + </bean> + + <bean id='locationService' class='edu.asu.commons.mme.service.LocationService'> + <property name='dao' ref='locationDao'/> + </bean> + + + <bean id='studentService' class='edu.asu.commons.mme.service.StudentService'> + <property name='dao' ref='studentDao'/> + </bean> + +<!-- spring managed service layer --> + <bean id='moduleService' class="edu.asu.commons.mme.service.ModuleService"> + <property name='dao' ref='moduleDao'/> + <property name='gameDao' ref='gameDao' /> + </bean> + + <bean id="startGame" class="edu.asu.commons.mme.service.StartGame"> + <property name='moduleService' ref='moduleService'/> + </bean> + + <bean id="testService" class="edu.asu.commons.mme.service.TestService"> + <property name='moduleService' ref='moduleService'/> + <property name="startModule" value="Testing String."/> + </bean> + + +<!-- Expose services for BlazeDS remoting --> + <flex:remote-service ref="studentService" /> + <flex:remote-service ref="moduleService" /> + <flex:remote-service ref="questionCreatorService" /> + <flex:remote-service ref="roundService" /> + <flex:remote-service ref="startupService" /> + <flex:remote-service ref="answeringService" /> + <flex:remote-service ref="locationService" /> + +<!-- Flex related information ended--> + + <bean id="mmeDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <property name="driverClassName" value="${hibernate.connection.driver_class}"/> + <property name="url" value="${hibernate.connection.url}"/> + <property name="username" value="${hibernate.connection.user}"/> + <property name="password" value="${hibernate.connection.password}"/> + </bean> + + <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> + <property name="location" value="/WEB-INF/hibernate.properties"/> + <property name="beanName" value="mmeDataSource"/> + </bean> + + <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> + <property name="configLocation" value="/WEB-INF/hibernate.cfg.xml"/> + <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop> + <prop key="hibernate.show_sql">false</prop> + </props> + </property> + <property name="dataSource" ref="mmeDataSource"/> + </bean> + + <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> + <property name="sessionFactory" ref="sessionFactory"/> + </bean> + <!-- XXX: don't need proxy-target-class if services are interfaces instead --> + <tx:annotation-driven proxy-target-class="true"/> + +</beans> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-08-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/hibernate.cfg.xml 2009-08-07 00:57:34 UTC (rev 228) @@ -33,7 +33,7 @@ <mapping class='edu.asu.commons.mme.entity.ModuleRoundConfig'/> <mapping class='edu.asu.commons.mme.entity.InformationWindow'/> <mapping class='edu.asu.commons.mme.entity.DayByDayDecisions'/> - + </session-factory> </hibernate-configuration> Modified: mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml =================================================================== --- mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml 2009-08-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/webapp/WEB-INF/web.xml 2009-08-07 00:57:34 UTC (rev 228) @@ -15,6 +15,7 @@ <url-pattern>/*</url-pattern> </filter-mapping> --> + <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> Modified: mentalmodels/trunk/src/main/webapp/startfeed.jsp =================================================================== --- mentalmodels/trunk/src/main/webapp/startfeed.jsp 2009-08-06 22:00:47 UTC (rev 227) +++ mentalmodels/trunk/src/main/webapp/startfeed.jsp 2009-08-07 00:57:34 UTC (rev 228) @@ -5,6 +5,6 @@ feed.start(); out.println("Server started to accept the students."); } catch (Exception e) { - out.println("A problem occured while starting the server: "+e.getMessage()); + out.println("A problem occured while starting the server: "+e.getStackTrace()); } %> \ 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-08-06 22:00:59
|
Revision: 227 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=227&view=rev Author: seematalele Date: 2009-08-06 22:00:47 +0000 (Thu, 06 Aug 2009) Log Message: ----------- change Rounds from set to List Modified Paths: -------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 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-06 22:00:27 UTC (rev 226) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Location.java 2009-08-06 22:00:47 UTC (rev 227) @@ -1,7 +1,7 @@ package edu.asu.commons.mme.entity; import java.io.Serializable; -import java.util.Set; +import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; @@ -23,7 +23,7 @@ @ManyToMany @JoinColumn(name="rounds_id") - private Set<Round> rounds; + private List<Round> rounds; @Column(nullable=false,name="location_name") private String locationName; @@ -37,6 +37,10 @@ @Column(nullable=false,name="initial_population") private Integer initialPopulation; + @Column(name="current_population") + private Integer currentPopulation; + + public void setId(Long id) { this.id = id; } @@ -69,11 +73,17 @@ public void setInitialPopulation(Integer initialPopulation) { this.initialPopulation = initialPopulation; } - public void setRounds(Set<Round> rounds) { + public void setRounds(List<Round> rounds) { this.rounds = rounds; } - public Set<Round> getRounds() { + public List<Round> getRounds() { return rounds; } + public void setCurrentPopulation(Integer currentPopulation) { + this.currentPopulation = currentPopulation; + } + public Integer getCurrentPopulation() { + return currentPopulation; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-06 22:00:35
|
Revision: 226 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=226&view=rev Author: seematalele Date: 2009-08-06 22:00:27 +0000 (Thu, 06 Aug 2009) Log Message: ----------- made LocationService.java as @Transactional Modified Paths: -------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 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-06 21:41:37 UTC (rev 225) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-08-06 22:00:27 UTC (rev 226) @@ -7,11 +7,13 @@ import org.hibernate.Hibernate; +import org.springframework.transaction.annotation.Transactional; import edu.asu.commons.mme.dao.HibernateLocationDao; import edu.asu.commons.mme.entity.Location; import edu.asu.commons.mme.entity.Round; +@Transactional public class LocationService extends Service.Base<Location, HibernateLocationDao>{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Kalin J. <kj...@as...> - 2009-08-06 21:57:49
|
Checking out for now at 15:00 (3.45 hours total today) I am going to work on managing the blocks that come from the server, but there are errors in the locationService, and the blockService has not been completed yet. I will be waiting until Seema finishes this code, and complete the remaining two hours I have reported for today at that time. On Thu, Aug 6, 2009 at 2:20 PM, Kalin Jonas <kj...@as...> wrote: > I took a lunch break from 12:00 to 13:00pm, and I have been back working > since. > > > On Thu, Aug 6, 2009 at 10:21 AM, Kalin Jonas <kj...@as...> wrote: > >> Today I come in to work at 10:15am >> I will discuss the current tasks with Seema, and help to make sure the >> program fetches the blocks properly. >> > > |
From: <see...@us...> - 2009-08-06 21:41:45
|
Revision: 225 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=225&view=rev Author: seematalele Date: 2009-08-06 21:41:37 +0000 (Thu, 06 Aug 2009) Log Message: ----------- initialized the round objects in locations list Modified Paths: -------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 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-06 21:29:02 UTC (rev 224) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-08-06 21:41:37 UTC (rev 225) @@ -1,12 +1,16 @@ package edu.asu.commons.mme.service; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; + + import org.hibernate.Hibernate; import edu.asu.commons.mme.dao.HibernateLocationDao; import edu.asu.commons.mme.entity.Location; +import edu.asu.commons.mme.entity.Round; public class LocationService extends Service.Base<Location, HibernateLocationDao>{ @@ -15,9 +19,14 @@ { List<Location> locations = new ArrayList<Location>(); locations = getDao().findAll(); + Location initLocation = new Location(); for(int i = 0; i < locations.size(); i++) { - Hibernate.initialize(locations.get(i)); + initLocation = locations.get(i); + Hibernate.initialize(initLocation); + Iterator<Round> iterRound = initLocation.getRounds().iterator(); + while(iterRound.hasNext()) + Hibernate.initialize(iterRound.next()); } return locations; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <see...@us...> - 2009-08-06 21:29:15
|
Revision: 224 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=224&view=rev Author: seematalele Date: 2009-08-06 21:29:02 +0000 (Thu, 06 Aug 2009) Log Message: ----------- Resolved problem in location service. done hibernate.initialize Modified Paths: -------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 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-06 21:25:51 UTC (rev 223) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-08-06 21:29:02 UTC (rev 224) @@ -3,6 +3,8 @@ import java.util.ArrayList; import java.util.List; +import org.hibernate.Hibernate; + import edu.asu.commons.mme.dao.HibernateLocationDao; import edu.asu.commons.mme.entity.Location; @@ -15,10 +17,9 @@ locations = getDao().findAll(); for(int i = 0; i < locations.size(); i++) { - Hibernate.initialize(locations[i]); + Hibernate.initialize(locations.get(i)); } return locations; - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-08-06 21:26:04
|
Revision: 223 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=223&view=rev Author: kjonas Date: 2009-08-06 21:25:51 +0000 (Thu, 06 Aug 2009) Log Message: ----------- Now initializes the locations before sending to client. Modified Paths: -------------- mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 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-06 01:27:52 UTC (rev 222) +++ mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/LocationService.java 2009-08-06 21:25:51 UTC (rev 223) @@ -9,10 +9,14 @@ public class LocationService extends Service.Base<Location, HibernateLocationDao>{ - public List<Location> getallLocations() + public List<Location> getAllLocations() { List<Location> locations = new ArrayList<Location>(); locations = getDao().findAll(); + for(int i = 0; i < locations.size(); i++) + { + Hibernate.initialize(locations[i]); + } return locations; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Kalin J. <kj...@as...> - 2009-08-06 21:20:23
|
I took a lunch break from 12:00 to 13:00pm, and I have been back working since. On Thu, Aug 6, 2009 at 10:21 AM, Kalin Jonas <kj...@as...> wrote: > Today I come in to work at 10:15am > I will discuss the current tasks with Seema, and help to make sure the > program fetches the blocks properly. > |
From: Kalin J. <kj...@as...> - 2009-08-06 17:22:11
|
Today I come in to work at 10:15am I will discuss the current tasks with Seema, and help to make sure the program fetches the blocks properly. |
From: <kj...@us...> - 2009-08-06 01:28:00
|
Revision: 222 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=222&view=rev Author: kjonas Date: 2009-08-06 01:27:52 +0000 (Thu, 06 Aug 2009) Log Message: ----------- Modified components so they may be able to receive the locations from server, rather than hard-coding. hard-coded the "request from server" until it is properly implemented. (Compiled Files) Modified Paths: -------------- mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf Property Changed: ---------------- mentalmodels/trunk/src/main/db/ mentalmodels/trunk/src/main/webapp/ Property changes on: mentalmodels/trunk/src/main/db ___________________________________________________________________ Modified: svn:ignore - generated + generated init-mme_old.sql Property changes on: mentalmodels/trunk/src/main/webapp ___________________________________________________________________ Added: svn:ignore + old Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) 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: <kj...@us...> - 2009-08-06 01:25:58
|
Revision: 221 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=221&view=rev Author: kjonas Date: 2009-08-06 01:25:00 +0000 (Thu, 06 Aug 2009) Log Message: ----------- Modified components so they may be able to receive the locations from server, rather than hard-coding. hard-coded the "request from server" until it is properly implemented. Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/flex/src/custom/InstructionPage.mxml mentalmodels/trunk/flex/src/custom/questions/DayByDayOutput.mxml mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastComponent.mxml mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml Modified: mentalmodels/trunk/flex/src/actionscript/PageDisplay.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-08-06 01:25:00 UTC (rev 221) @@ -13,6 +13,7 @@ import mx.collections.ArrayCollection; import mx.containers.VBox; + import mx.controls.Alert; import mx.controls.Text; @@ -25,12 +26,22 @@ public var minPagesRead:int; public var currentPageNumber:int; public var highestPageReached:int; - public var locations:ArrayCollection = null; + public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); + public var currBlock:Block; - public function PageDisplay(newBlock:Block, minimumPagesRead:int=1, locations:ArrayCollection=null) + private function newLocation(maxCapacity:Number,growth:Number):Location { + var newLoc:Location = new Location(); + newLoc.maxCapacity = maxCapacity; + newLoc.growthRate = growth; + newLoc.initialPopulation = maxCapacity / 2.0; + return newLoc; + } + + public function PageDisplay(newBlock:Block, minimumPagesRead:int, locations:ArrayCollection) + { currBlock = newBlock; minPagesRead = minimumPagesRead; currentPageNumber = 0; @@ -112,6 +123,7 @@ { var ddq:DayByDayDecisionsQuestionC = new DayByDayDecisionsQuestionC(); ddq.locations = locations; + Alert.show(locations.length+""); ddq.loadFromQuestion(Question(tempQuestion)); ddq.id = "q"+question; Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -102,7 +102,7 @@ public var currentModuleNumber:int = 0; public var currentBlock:Block = null; public var currentBlockNumber:int = 0; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0),newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); public var blockLoader:Function = null; @@ -144,7 +144,7 @@ } private function sendBlockQuestions():void { - if(instructions == null) return; + if(currentBlock == null) return; var responseList:ArrayCollection = new ArrayCollection(); var studentResponse:StudentResponse; @@ -245,15 +245,14 @@ answeringService.saveQuestion(responseList); } - private function reportBlockFinished():void + + private function getLocations():void { - sendBlockQuestions(); - - // send something to server to indicate that someone finished a block + locationResultHandler(null); //TK } private function getNextModule():void { - if(instructions != null) reportBlockFinished(); + if(instructionsLoaded) sendBlockQuestions(); currentModule = null; currentModuleNumber++; @@ -261,7 +260,7 @@ } private function getNextBlock():void { - if(instructions != null) reportBlockFinished(); + if(currentBlock != null) sendBlockQuestions(); currentBlock = null; currentBlockNumber++; @@ -398,6 +397,7 @@ currentState = "wait"; btnBack.enabled = btnForward.enabled = btnReset.enabled = true; + getLocations(); getNextBlock(); returnValue = true; } @@ -468,8 +468,12 @@ cat1.type = "categorical"; cat1.categoricalOptions = new ArrayCollection(); - var for1:ForecastingPeople = new ForecastingPeople(); - var for2:ForecastingFish = new ForecastingFish(); + 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"; Modified: mentalmodels/trunk/flex/src/custom/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -20,7 +20,7 @@ [Bindable] public var numPages:int = 1; [Bindable] public var currPage:int = 0; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); public var savedForecastPeople:ArrayCollection = null; public var savedForecastFish:ArrayCollection = null; Modified: mentalmodels/trunk/flex/src/custom/questions/DayByDayOutput.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/DayByDayOutput.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/questions/DayByDayOutput.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -6,12 +6,15 @@ <![CDATA[ import mx.collections.ArrayCollection; + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); + public var savedStrategy:ArrayCollection = null; public var savedDayByDay:ArrayCollection = null; public function init():void { dayByDay.removeChild(dayByDay.buttons); + dayByDay.locations = locations; // dayByDay.removeChild(dayByDay.timer); if(savedStrategy != null) Modified: mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -30,7 +30,7 @@ import actionscript.questions.*; import custom.questions.dayByDayDecisions.OneDay; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0),newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); [Bindable] public var deciding:int = 0; [Bindable] public var cumTotal:Number = 0; [Bindable] public var dollarPerLb:Number = 3.99; Modified: mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -8,7 +8,7 @@ import mx.controls.Label; import mx.collections.ArrayCollection; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0),newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); [Bindable] public var decisions:ArrayCollection; public var previousTotal:Number = 0; Modified: mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastComponent.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastComponent.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastComponent.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -5,6 +5,7 @@ <mx:Script> <![CDATA[ + import actionscript.Location; import mx.controls.Alert; import mx.events.FlexEvent; import mx.controls.DataGrid; @@ -24,7 +25,8 @@ // Game Data [Bindable] public var style:int = 0; // 0:People, 1:Fish, 2:Calculated - [Bindable] public var numBays:int = 3; +// [Bindable] public var numBays:int = 3; + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); [Bindable] public var numColumns:int = -1; [Bindable] public var numFields:int = 15; [Bindable] public var minValue:int = 0; @@ -36,6 +38,15 @@ // for lining up grids [Bindable] public var minimumWidth:int = 160; + private function newLocation(maxCapacity:Number,growth:Number):Location + { + var newLoc:Location = new Location(); + newLoc.maxCapacity = maxCapacity; + newLoc.growthRate = growth; + newLoc.initialPopulation = maxCapacity / 2.0; + return newLoc; + } + // // public accessible functions // @@ -178,7 +189,7 @@ addLabel("# People in Harbor:"); addField(); - for(bayNumber=0; bayNumber<numBays; bayNumber++) + for(bayNumber=0; bayNumber<locations.length-1; bayNumber++) { addLabel("# People in Bay " + (bayNumber+1) + ":"); addField(); @@ -186,7 +197,7 @@ } else if(style==1) { - for(bayNumber=0; bayNumber<numBays; bayNumber++) + for(bayNumber=0; bayNumber<locations.length-1; bayNumber++) { addLabel("# Fish in Bay " + (bayNumber+1) + "(AM):"); addField(); @@ -200,7 +211,7 @@ addField(); addLabel("Others will get USD:"); addField(); - for(bayNumber=0; bayNumber<numBays; bayNumber++) + for(bayNumber=0; bayNumber<locations.length-1; bayNumber++) { addLabel("# Fish in Bay " + (bayNumber+1) + "(PM):"); addField(); @@ -215,13 +226,13 @@ switch(style) { case(0): // 0:People - dataGrid.height = (23)*(numBays+2)-1; + dataGrid.height = (23)*(locations.length+1)-1; break; case(1): // 2:Fish - dataGrid.height = (23)*(numBays+1); + dataGrid.height = (23)*(locations.length); break; case(2): // 3:Calculated - dataGrid.height = (23)*(numBays+4)-3; + dataGrid.height = (23)*(locations.length+3)-3; break; } } Modified: mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingFishQuestionC.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -10,12 +10,12 @@ </mx:Script> <components:ForecastComponent id="fishEntry" style="1" isEntry="true" maxValue="30" - numBays="{numBays}" numColumns="{numColumns}" initialize="false" + preinitialize="fishEntry.locations = locations" numColumns="{numColumns}" initialize="false" updaterObject="{this}" updater="{recalculate}"/> <components:ForecastComponent id="peopleDisplay" style="0" isEntry="false" - numBays="{numBays}" numColumns="15" initialize="false"/> + preinitialize="peopleDisplay.locations = locations" numColumns="15" initialize="false"/> <components:ForecastComponent id="calculated" style="2" isEntry="false" - numBays="{numBays}" numColumns="{numColumns}" initialize="false"/> + preinitialize="calculated.locations = locations" numColumns="{numColumns}" initialize="false"/> <mx:HBox> <mx:Spacer width="160"/> @@ -36,9 +36,8 @@ public var loadFish:ArrayCollection = null; public var loadPeople:ArrayCollection = null; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); - [Bindable] public var numBays:int = locations.length; [Bindable] public var numColumns:int = 6; private function newLocation(maxCapacity:Number,growth:Number):Location @@ -103,9 +102,9 @@ calculated.setItem(1,column,0); calculated.setItem(2,column,0); - for(var bay:int = 0; bay < numBays; bay++) + for(var bay:int = 1; bay < locations.length; bay++) { - calculated.setItem(3+bay,column,Number(fishEntry.getItem(bay,column)) * 0.9); + calculated.setItem(3+bay,column,Number(fishEntry.getItem(bay-1,column)) * 0.9); } } calculated.redraw(); Modified: mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/questions/forecasting/ForecastingPeopleQuestionC.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -12,7 +12,7 @@ <mx:Text width="600" text="The sum of expected fishermen each day is {(peopleEntry.groupSize-1)}.\nDo not include yourself in the count."/> <components:ForecastComponent id="peopleEntry" style="0" isEntry="true" - numBays="{numBays}" numColumns="{numColumns}" initialize="false"/> + preinitialize="peopleEntry.locations = locations" numColumns="{numColumns}" initialize="false"/> <mx:HBox> <mx:Spacer width="160"/> @@ -31,9 +31,8 @@ import custom.questions.forecasting.ForecastComponent; public var loadPeople:ArrayCollection = null; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); - [Bindable] public var numBays:int = locations.length; [Bindable] public var numColumns:int = 15; private function newLocation(maxCapacity:Number,growth:Number):Location Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/Planner.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -11,7 +11,7 @@ public var valueRequired:Boolean = false; public var hasBeenChanged:Boolean = false; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); private function newLocation(maxCapacity:Number,growth:Number):Location { Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -6,7 +6,7 @@ import actionscript.Location; public var valueRequired:Boolean = false; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); private function newLocation(maxCapacity:Number,growth:Number):Location { Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-08-05 00:17:23 UTC (rev 220) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-08-06 01:25:00 UTC (rev 221) @@ -12,11 +12,11 @@ <mx:HBox> <mx:VBox> <mx:Label text="Not Repeated decisions (start-up)" fontSize="18"/> - <qComp:Planner id="notRepeated" preinitialize="notRepeated.locations=this.locations"/> + <qComp:Planner id="notRepeated"/> </mx:VBox> <mx:VBox> <mx:Label text="Repeated decisions (after start-up)" fontSize="18"/> - <qComp:Planner id="repeated" valueRequired="true" preinitialize="repeated.locations=this.locations"/> + <qComp:Planner id="repeated" valueRequired="true"/> </mx:VBox> </mx:HBox> @@ -40,7 +40,7 @@ import actionscript.questions.Question; import mx.collections.ArrayCollection; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); private function newLocation(maxCapacity:Number,growth:Number):Location { @@ -51,6 +51,12 @@ return newLoc; } + public function init():void + { + notRepeated.locations=this.locations; + repeated.locations=this.locations; + } + public function getNotRepeated():ArrayCollection { return notRepeated.save(); } @@ -85,7 +91,7 @@ this.question = question; initialize(); -// init(); + init(); } public function toDatabaseObject():ArrayCollection This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Kalin J. <kj...@as...> - 2009-08-06 01:23:35
|
Today I leave at 18:00pm (3hr) Modified components so they may be able to receive the locations from server, rather than hard-coding. hard-coded the "request from server" until it is properly implemented. On Wed, Aug 5, 2009 at 3:09 PM, Kalin Jonas <kj...@as...> wrote: > Today I come in to work at 15:00pm > I will be working on fixing the apparent problems with recording the > Locations, so that they can be gotten from the server. > I will also work on anything that Seema and I discuss doing. > |
From: Kalin J. <kj...@as...> - 2009-08-05 22:10:01
|
Today I come in to work at 15:00pm I will be working on fixing the apparent problems with recording the Locations, so that they can be gotten from the server. I will also work on anything that Seema and I discuss doing. |
From: <al...@us...> - 2009-08-05 00:17:35
|
Revision: 220 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=220&view=rev Author: alllee Date: 2009-08-05 00:17:23 +0000 (Wed, 05 Aug 2009) Log Message: ----------- initializing client positions in the reinitialize() method Modified Paths: -------------- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java 2009-08-05 00:01:16 UTC (rev 219) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java 2009-08-05 00:17:23 UTC (rev 220) @@ -118,6 +118,7 @@ addClientToGroup(clientData, group); // XXX: this must occur after we add the client to the group because addClientToGroup() sets // the position according to the spacing algorithm. + System.err.println("setting client: " + clientData.getId() + " to position: " + ace.getPosition()); clientData.setPosition(ace.getPosition()); // AddClientEvent ace = (AddClientEvent) persistableEvent; @@ -384,6 +385,12 @@ public void reinitialize() { setNullEventChannel(); resetGroupResourceDistributions(); + // initialize all client positions + for (GroupDataModel group: getGroups()) { + for (ClientData clientData: group.getClientDataMap().values()) { + clientData.initializePosition(); + } + } } public boolean isLastRound() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-08-05 00:01:27
|
Revision: 219 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=219&view=rev Author: kjonas Date: 2009-08-05 00:01:16 +0000 (Wed, 05 Aug 2009) Log Message: ----------- Repairing two parts of the program that are accidentally showing 4 bays (more to be fixed later) Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml mentalmodels/trunk/flex/src/actionscript/PageDisplay.as mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml Modified: mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-08-05 00:00:30 UTC (rev 218) +++ mentalmodels/trunk/flex/src/FisheryExperimentShell.mxml 2009-08-05 00:01:16 UTC (rev 219) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:custom="custom.*" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #B0B0FF]" - width="100%" height="100%" layout="vertical" horizontalAlign="center" + width="100%" height="100%" layout="absolute" initialize="init()"> <mx:Script><![CDATA[ @@ -24,7 +24,10 @@ } ]]></mx:Script> - <mx:HBox horizontalGap="30" y="60"> + <mx:HBox id="shell" horizontalGap="30" + y="{(height - shell.height)/2}" + x="{(width - shell.width)/2}"> + <mx:VBox id="vbxInfo"> <mx:TitleWindow id="InformationWindowA" width="400" height="220" title="Information Window A" clipContent="true" horizontalScrollPolicy="on" verticalScrollPolicy="on"> Modified: mentalmodels/trunk/flex/src/actionscript/PageDisplay.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-08-05 00:00:30 UTC (rev 218) +++ mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-08-05 00:01:16 UTC (rev 219) @@ -99,7 +99,7 @@ tempBox.addChild(tq); } - if(tempQuestion.type.toLowerCase() == "strategydesign") + else if(tempQuestion.type.toLowerCase() == "strategydesign") { var sdq:StrategyDesignQuestionC = new StrategyDesignQuestionC(); sdq.locations = locations; @@ -158,8 +158,8 @@ desc.width = 600; head.htmlText = questionGroup.header; desc.htmlText = questionGroup.description; + if(desc.htmlText.length != 0) tempBox.addChildAt(desc,0); if(head.htmlText.length != 0) tempBox.addChildAt(head,0); - if(desc.htmlText.length != 0) tempBox.addChildAt(desc,1); pages.addItem(tempBox); // msg += "item added\n"; Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-05 00:00:30 UTC (rev 218) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-08-05 00:01:16 UTC (rev 219) @@ -17,7 +17,8 @@ <mx:State name="instructionsLoad"> <mx:AddChild relativeTo="{content}"> - <comp:InstructionPage id="instructions" initialize="gotoInstructions()" locations="{locations}"/> + <comp:InstructionPage id="instructions" initialize="gotoInstructions()" x="0" y="0" + preinitialize="instructions.locations=locations"/> </mx:AddChild> </mx:State> @@ -101,7 +102,7 @@ public var currentModuleNumber:int = 0; public var currentBlock:Block = null; public var currentBlockNumber:int = 0; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0),newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); public var blockLoader:Function = null; @@ -138,7 +139,7 @@ { btnForward.enabled = btnBack.enabled = btnReset.enabled = true; instructionsLoaded = true; - instructions.moduleNumber = currentModuleNumber; +// instructions.moduleNumber = currentModuleNumber; currentState = "instructions"; } private function sendBlockQuestions():void @@ -265,7 +266,27 @@ currentBlockNumber++; //server request + blockResultHandler(new ResultEvent("",false,true,makeBlock())); } + private function blockResultHandler(event:ResultEvent):void + { + currentBlock = (event.result as actionscript.Block); + + if(currentBlock == null + || currentBlock.questionGroups == null + || currentBlock.questionGroups.length < 1) + { + currentState = "none"; + } + else if(!instructionsLoaded) + { + currentState = "instructionsLoad"; + } + else + { + gotoInstructions(); + } + } private function moduleResultHandler(event:ResultEvent):void { currentModule = (event.result as actionscript.Module); @@ -298,6 +319,7 @@ private function locationResultHandler(event:ResultEvent):void { locations = new ArrayCollection(); + locations.addItem(newLocation(0, 0)); locations.addItem(newLocation(10, 0.50)); locations.addItem(newLocation(20, 0.15)); locations.addItem(newLocation(30, 0.05)); @@ -376,7 +398,7 @@ currentState = "wait"; btnBack.enabled = btnForward.enabled = btnReset.enabled = true; - getNextModule(); + getNextBlock(); returnValue = true; } } Modified: mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-08-05 00:00:30 UTC (rev 218) +++ mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/DayByDayDecisionsQuestionC.mxml 2009-08-05 00:01:16 UTC (rev 219) @@ -30,7 +30,7 @@ import actionscript.questions.*; import custom.questions.dayByDayDecisions.OneDay; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0),newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); [Bindable] public var deciding:int = 0; [Bindable] public var cumTotal:Number = 0; [Bindable] public var dollarPerLb:Number = 3.99; @@ -66,17 +66,17 @@ txtTemp.text = "Harbor"; labels.addChild(txtTemp); - for(var i:int = 0; i < locations.length; i++) + for(var i:int = 1; i < locations.length; i++) { btnTemp = new Button(); - btnTemp.label = "Bay" + (i+1); + btnTemp.label = "Bay" + (i); btnTemp.id = "btn" + btnTemp.label; btnTemp.addEventListener(MouseEvent.CLICK,clicked); buttons.addChild(btnTemp); txtTemp = new Text(); txtTemp = stylize(txtTemp); - txtTemp.text = "Bay" + (i+1); + txtTemp.text = "Bay" + (i); labels.addChild(txtTemp); } @@ -217,6 +217,10 @@ { zeroDec = ".00"; } + else if((moneyMade*10) as int == (moneyMade*10)) + { + zeroDec = "0"; + } var moneyString:String = "$" + moneyMade + zeroDec; return moneyString; } Modified: mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml 2009-08-05 00:00:30 UTC (rev 218) +++ mentalmodels/trunk/flex/src/custom/questions/dayByDayDecisions/OneDay.mxml 2009-08-05 00:01:16 UTC (rev 219) @@ -8,7 +8,7 @@ import mx.controls.Label; import mx.collections.ArrayCollection; - [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); + [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0),newLocation(10, 0.50),newLocation(20, 0.15),newLocation(30, 0.05)]); [Bindable] public var decisions:ArrayCollection; public var previousTotal:Number = 0; @@ -57,7 +57,7 @@ public function drawPartial():void { var temp:OneDecision; - for(var i:int = decisions.length; i < locations.length+1; i++) + for(var i:int = decisions.length; i < locations.length; i++) { temp = new OneDecision(); temp.active = false; @@ -80,7 +80,7 @@ dayText.minWidth = 50; addChild(dayText); - for(var i:int = 0; i < locations.length+1 && i < decisions.length; i++) + for(var i:int = 0; i < locations.length && i < decisions.length; i++) { var temp:OneDecision = (decisions.getItemAt(i) as OneDecision); presentTotal += temp.lbsFished; Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml 2009-08-05 00:00:30 UTC (rev 218) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/PlannerRow.mxml 2009-08-05 00:01:16 UTC (rev 219) @@ -25,10 +25,10 @@ obj.label = obj.data; locs.addItem(obj); - for(var i:int=0; i<locations.length; i++) + for(var i:int=1; i<locations.length; i++) { obj = new Object(); - obj.data = "Bay " + (i+1); + obj.data = "Bay " + (i); obj.label = obj.data; locs.addItem(obj); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kj...@us...> - 2009-08-05 00:00:40
|
Revision: 218 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=218&view=rev Author: kjonas Date: 2009-08-05 00:00:30 +0000 (Wed, 05 Aug 2009) Log Message: ----------- Latest compiled files Modified Paths: -------------- mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) 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: Kalin J. <kj...@as...> - 2009-08-04 23:58:10
|
Today I will be leaving at 16:45pm (3hr) (5hr total today) I have fixed a few errors in the way that the program dealt with Locations, so that it will assume the first location is the harbor. I will keep fixing these errors when I have free time. The experiment is not fetching the blocks yet, it is currently using a pre-made block. On Tue, Aug 4, 2009 at 1:45 PM, Kalin Jonas <kj...@as...> wrote: > I return at 13:45 to work. > I am going to test if the program will work if it is given a block, and > fixing any issues as they crop up. > > > On Tue, Aug 4, 2009 at 1:00 PM, Kalin Jonas <kj...@as...> wrote: > >> at 13:00pm (2hr) I go for lunch. >> The program centers on the page >> Pops up a warning when the user tries to close or refresh, if they are >> looking at the html. >> Nothing happens when they close the SWF >> >> >> On Tue, Aug 4, 2009 at 11:33 AM, Kalin Jonas <kj...@as...> wrote: >> >>> Today I arrived at 11:00am, and began discussing my work over the last >>> week. >>> I will continue to discuss changes I have made, commit my previous code. >>> I will be working to make sure that my code can properly handle when it >>> receives a block. >>> After this, I will center the content within the application, but it will >>> not re-size itself right now. >>> Intermittently, I will be talking to Seema regarding the program and >>> changes to be made. >>> >> >> > |