« flex builder modules debugging | Main | flexmdi Effects »

September 11, 2007

Brief intro of MDIManager

The flexmdi MDIManager is at the heart of managing the mdi windows. It's responsible for adding, removing, tiling, cascading, whipping, selecting, announcing, berating, belittling, restoring and the all-in-all keeper of the watchtower so to speak. Apart from a little math, it doesn't do much besides route windows through the appropriate processes. But when looking to extend functionality of the flexmdi framework it should be in the back of your mind. Knowing how to use it will open a lot of possibilities up.

Events and Scope

Always look to the manager when you want to manage all windows at once, or set global or instance level handlers. If you wanted all your windows to display a confirmation box upon close you could set this once on the manager. If you wanted to set default positions for your windows when added or apply an effect to certain types of events such as minimize or restore you could set this on the manager. The manager is also responsible for applying group events. A group event takes place at the manager level and applies to all windows such as cascade and tile. The manager is also the place to intercept window events  to change default behavior. You can apply a context menu for the container on the manager as well.


Infinite Managers For The Price of One

The managers is the master of context. As a convenience it has a global application manager that can be accessed with MDIManager.global which uses the Application.application as it's container and adds windows via the PopUpManager so graciously provided by the flex framework. But the manager can also be confined to manage windows in any type of container. As an example, if you were to create a viewstack you could have a manager for each parent level container in the view stack which would allow you to hide,show,maximize,restore,tile,cascade, etc.., windows at the viewstack level and  allow your  users to  switch back and forth for some free stylin' window management. To create a local instance of the manager you just need a to have a container for it to manage:

public var manager:MDIManager = new MDIManager(myContainer);

From this point any windows you add to manager will be managed within the confines of myContainer. You can also pass an effectsLib class to the manager as well. (more on that in a later post).

Summary

Personally I think of the manager as the name describes as the man in charge of the action. Managing windows on a more global or container level allows you to only write the code for the special short bus windows when you have to. Less code to write is good. As always look in the docs to find the details.


and example of flexmdi can be seen here .

you can find the flexmdi framework at http://flexmdi.googlecode.com/



 



TrackBack

TrackBack URL for this entry:
http://www.typepad.com/t/trackback/2357234/21407275

Listed below are links to weblogs that reference Brief intro of MDIManager:

Comments

Great work on this pacakge for Flex.Once a window has been maximized or minimized, the backgroundAlpha gets set to 1, and a even a setStyle call can't change it back. Is there a style property I'm overlooking or is this an issue?

@ill, you're not missing anything. The backgroundAlpha get sets on the minimize because there was issues with white space showing when the windows were minimized. If you look in the manager class in the windowEventProxy() method you'll see the minimize and restore cases where it's getting set. It is an issue for now. thanks.

This framework is just exactly what I was looking for, congratulations on the project. I have one question though, since it's fairly easy to get lost inside all the project code.

Is it possible to remove certain events? Say for example, disable the window resizing. I've disabled the listeners responsible for the resizing but it continues working... any help?

Please keep doing the great work

@Ricardo, are you trying to remove them at the window or manager level? if you set a listener on your window for resize and then run event.stoppropagation() it should stop the resize. That might be a bit of a hack, but I'm not sure exactly what you're trying to do. Also, you could try posing your question to the flexlib group (flexmdi is now apart of flexlib) which can be found here http://groups.google.com/group/flexlib

Post a comment

If you have a TypeKey or TypePad account, please Sign In