This content has been marked as final. Show 3 replies
well thats quite easy, have a seperate service that returns items for combo boxex etc make it as dataprovider
and call servie only once at creationcomplete and then reuse result
That's what we're doing - putting the service is in the parent window - but as I said, it adds a lot of code to the parent window that "doesn't belong there", and then we have to do it all over again when we use the popup on another screen. And the communication between all the various popups and the parent is getting out of control. Very messy. We have this working, but what we're looking for is a cleaner, simpler approach. Has anyone done this in a way that you can somehow encapsulate all interactions that are required? For example, say you had a "Comment Editor" that you needed to drop into many different screens, and have it come up as a popup. On this editor was a "Comment Type" combo box that was sourced dynamically from a database. The way we have it set up now, every parent component that uses it would have to initialize the comment type list. And ditto for every other popup. I'm looking for some ideas on how to make this sort of thing reusable with a minimal amount of wiring. Is there a way, maybe, to make some sort of global "List Manager" that handles initialization of all the ComboBox sources?
We went with the "List Manager" concept, by creating a class that encapsulates all data retrievals needed by every ComboBox in the system. These are lazy loaded, in the sense that if a screen needs, say, list A, B, and C, that screen submits those requests to a queue in the ListManager. When all the list data are retrieved from the database (they may already be there from a previous call), the ListManager raises an event and the caller knows the data is ready. The serialization is important, because the Combos have to be sourced before you can set the value to display. The ListManager holds only the data, as ArrayCollections converted from XML, and is used as a singleton. The ArrayCollections are made available to any screen that needs to source a combo box.