Before asking my question I would like to explain little about my architecture.My data is of mixed types like String , Array Collection , Boolean I have to populate the data into appropriate UI component – for example Boolean to check box , Array to List…… so We have created a factory class which will return 3 different type of component based on the input argument
- CTextfield -> extends mx.controls.Text
- CList -> extends mx.controls.List
- CCheckBox -> extends custom.MultiLineCheckBox
.
MultiLineCheckBox which extends mx.controls.CheckBox and few methods are overridden to bring the multiple line label.
http://spy6.blogspot.com/2008/09/flex-multiline-checkbox.html
It works perfect.Am using the MultiLineCheckBox in the entire application wherever I want check Box.
Now I went into a scenario where I want check Box instead of MultiLineCheckBox. How to rewrite my CCheckBox to handle MultiLineCheckBox and also default CheckBox?
Note : Each of the CCheckBox class has lot of methods init.
You need an abstract factory that extends from your concrete factory (http://cnx.org/content/m17203/latest/AbstractFactory.jpg) then write the logic of handle the different scenarios in it, when to use checkbox vs multilinecheckbox