Print

Print


> However now I have this problem: I have a simple SimState I just finished reading from file. How do I feed it to GUIState?

A GUIState contains two items that matter to you:

	- The underlying SimState

	- Various *queues* which collectively form the "MiniSchedule" of the GUIState.  GUI objects can register themselves to be executed at various times as the model is running.  For example, windows can update themselves every timestep by registering themselves with the MiniSchedule to be pulsed every timestep after the model has been pulsed.

When you create a model as
	new GUIState(state)
1. The state is set
2. The queues are cleared
3. The whole thing is set to start() from scratch

When you create a model from a checkpoint as
	guistate.load(state)
1. The state is set
2. The start queues are executed

When you create a model from checkpoint as 	
	readNewStateFromCheckpoint(File)
1. The state is loaded from the file
2. It's checked for validity.
3. If valid, then 
	3a. finish() is called on the old state
	3b. load(state)

The console calls readNewStateFromCheckpoint(File).  However afterwards it does further setup at the Console level (see lines 2176 through 2202 of Console.jave)

So what I would try is overriding the code in GUIState.readNewStateFromCheckpoint(File) called, replacing the serialization code with code setting up the state from your file however you do it.  I'd do it this way so you don't have to hack Console.java as well.

Sean