Hi All,
  I've been wondering if anyone could offer advice on implementing a 
decorator pattern for UIComponents...  For instance, could I some 
how come up with a set of classes that could be wrapped around any 
UIComponent in any order to modify it's visual representation.  For 
example, Let's say I have the following "decorator" classes:

org.decorator.StarIcon  //add a star icon to the nested component
org.decorator.BlueBackground   //add a blue background to the nested 
component
org.decorator.AddGreenImageAtX0Y10  //add an image to the nested 
component
org.decorator.AddGlowFilter   //add a filter to the nested component

...and I wanted to use them like so...

//creates a UIComponent with a blue background, star icon and glow 
filter...
var composite:UIComponent = new AddGlowFilter(new StarIcon(new 
BlueBackground(someExistingControl)));

How would something like this be done?  I'd like to take a reference 
to "composite" and still get back to the original undecorated 
control.  Since there's no inheritance between these "decorator" 
classes I guess super.updateDisplayList wouldn't work...

Just curious... I've recently built a component that may have this 
need.  The mix and match requirement seems to lead away from just 
flex component states.  Perhaps this can be worked out with skins?

Let me know if this doesn't make sense!
Thanks,
James

Reply via email to