If I have a flex component that is a general popup, it’s basically just a white popup that I pass an Array named “modules” to.
For instance:
var array:Array = ["mainArticle","title"];
or
var array:Array = ["creditCard"];
These are two examples that I might pass in. The first one would add my modules to the popup so the popup will be used for editing an “article.” The second would add the Credit Card Change module, which would be a form that would allow the user to update their credit card information.
My question resides in the dataProvider for this popup. If I am passing in the article updater, I need a dataProvider that contains information like “font,” “color,” “size,” etc. If I am passing in the credit card updater, I need a dataProvider that contains information like “number,” “securit code,” “expiration date,” etc.
I could have a dataProvider class that has all of the information and only sets what I need, but it could get huge if I did something like:
public class myDataProvider {
public var mainTextFont:String;
public var mainTextSize:int;
public var mainText:String;
public var cardNumber:String;
public var cardExpiration:Date;
public var cardSecurity:String;
}
This is sort of an abstract idea, but I am looking for a solution that allows me to give my popup dataproviders without using one central dataProvider that would have a copy for every possible situation.
Thanks!
The simplest way to approach this is to create different dataProviders, depending on the class. My main popup has a “ModuleList” (custom list of strings) and it adds “modules” (not an actual flex module) to itself, giving each one the correct type of dataProvider.
This is just a generic idea, I was wondering what the best way to do this was, and this is how I decided to approach it.