Many ui panels needs interaction with same object

Posted by user877329 on Programmers See other posts from Programmers or by user877329
Published on 2014-06-01T08:28:22Z Indexed on 2014/06/01 9:38 UTC
Read the original article Hit count: 206

Filed under:
|

I am developing a tool for simulating systems like the Gray-Scott model (That is systems where spatial distribution depends on time). The actual model is loaded from a DLL or shared object and the simulation is performed by a Simulation object.

There are at least two situations when the simulation needs to be destroyed:

  • The user loads a new model
  • The user changes the size of the domain

To make sure nothing goes wrong, the current Model, Simulation, and rendering Thread are all managed by an ApplicationState object. But the two cases above are initiated from two different UI objects. Is it then ok to distribute a reference to the ApplicationState object to all panels that need to access at least one method on the ApplicationState object?

Another solution would be to use aggregation so that the panel from which the user chooses model knows the simulation parameter panel.

Also, the ApplicationState class seems somewhat clumsy, so I would like to have something else

© Programmers or respective owner

Related posts about design-patterns

Related posts about gui