From: Brett L. <wak...@ea...> - 2005-09-19 16:37:21
|
We don't currently "tell" the UI about changes to companies. The Paint/Repaint methods are called to draw the UI whenever the values in our Stock model change. The UI then calls the appropriate get methods to obtain the current values of the model. Also, I've noticed you've forked the API a bit for implementing the map. Is there a reason we can't just replace the old methods with the newer ones? ---Brett -----Original Message----- From: Erik Vos <eri...@hc...> Sent: Sep 18, 2005 3:00 PM To: rai...@li... Subject: [Rails-devel] Trains I have added Trains. Most options related to buying trains have been implemented, except - buying "unlimited" trains, - cheap exchange for first Diesel, - train limits (will come when Phases are added), - dual trains, like 18VA 4/3G or 18Scan 4/3+3. I am thinking about ways to simplify keeping all data shown in the UI up to date. Sometimes "deep" changes occur (such as new trains becoming available), and now the UI must poll each time a train is bought if such a change has occurred. The same applies to share prices, cash amounts, and in fact all on-screen items. It could be easier to have the values "tell" the UI about any changes. Two ways to achieve that are 1. Create an Event each time a values changes, and let each and every UI field listen to changes of its underlying value. 2. An older and IMO simpler way is the Observer/Observable pattern. The main hurdle is that each such value must get the capability to register its own listener(s). I played a bit with Events and EventListeners but it looks rather heavy to me. The simplest solution might be to create Observable subclass types (ObservableInteger etc.) and embed values like cash amounts and share percentages in such types. The UI Field class should then implement Observer, and each Field instance should register as an Observer of its own Observable. Any thoughts about this idea? Erik. ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ Rails-devel mailing list Rai...@li... https://lists.sourceforge.net/lists/listinfo/rails-devel |