From: Mike.Adair@CCRS.NRCan.gc.ca - 2004-09-25 17:59:07
|
Hi Cameron, It sounds like we are the same page here. I've actually got this implemented are running correctly now. If there are no objections, I'd like to check it in. There are a lot of changes though, almost every .js file gets touched. Mostly changing the call to the base class and changing bits of code to run as an loadModel event listener. It also means changing lots of "this" to "objref" and vice versa but I think I've fixed most of those problems. Some other important points: - the listeners I'm using are "newModel" and "loadModel". It should be easy to change tweak/configure these if required. The newModel event is called just before the document is loaded to give widgets a chance to clear themselves if required. Most of the init functions get called on the loadModel event. - using the new inheritance mechanism is great because now the base classes can register event listeners and pass in the correct object reference. I also means that the base class becomes truly abstract, in that you can't use it without passing in a valid object reference. This means in config we have to use <Model> and <Widget> instead of <ModelBase> <WidgetBase>. - I've consolidated mapContainer code into a new MapContainerBase class that extends WidgetBase. Then widgets like MapPane and GmlRenderer that want to share a map container for their output will extend MapContainerBase. Other rendering widgets can also extend this class to have their output appended to the container. This also cleans up WidgetBase somewhat since most widgets don't care about the container. - added the beginnings of a model list controller object as tools/ModelList to support dynamic models. The idea for this tool is that it is initialized with some Xpath to select a nodelist from the doc. Then for each node in the list there are methods to create/append/update/re-order. etc. Mike > -----Original Message----- > From: Cameron Shorter [mailto:sho...@op...] > Sent: September 24, 2004 4:27 PM > To: Mike.Adair@CCRS.NRCan.gc.ca > Cc: map...@li... > Subject: Re: [Mapbuilder-devel] Initialisation sequence > > > Mike.Adair@CCRS.NRCan.gc.ca wrote: > > >Hi Cameron, > > > >Remember this email? > > > > Yes. I have still been working toward this myself. When > implementing > this last time, I ran into a dependancy problem with Tools that were > rendering. Ie AoiBox. > From memory, when AoiBox was initialising it tried to render into a > Widget which had not been drawn yet. > > So I'm currently working on a widget/AoiBox2.xsl so that we > can move the > rendering part of tool/AoiBox.js into a widget. > By the way, AoiBox2 extends GmlRenderer which is another test > I wanted > to try. > > > I think this is a good idea and it turns out that we > >need this for generating the dynamic models. I have it > almost running with > >an initialization sequence somewhat like you proposed, ie. > updates and > >initialization are driven by event listeners. > > > > > > > > > Ok, I will have a look. > > >I think I've also found a better? way to do inheretance. Instead of: > >function Model(modelNode, parent) { > > var modelBase = new ModelBase(modelNode, parent); > > for (sProperty in base) { > > this[sProperty] = base[sProperty]; > > } > > > >you pass in the object reference as well like this: > >function Model(modelNode, parent) { > > var modelBase = new ModelBase(this, modelNode, parent); > > > >This allows you to set the properties directly on the object > being created, > >but it also permits setting up listener functions in the > base class with the > >correct object reference. > > > > > > Sounds like a good idea. > > |