Hi All,
I need some help with determing the best way to do Binding of Components to Data.
My objective is to use and existing IndexedValueCollection as model.
The Widget must update value in this model object.
IndexedValueCollection (can be considers a a map which has a key and value pair).
public class IndexedValueCollection {
public String getValue(int iValue){
}
public void setValue(int iValue, String sValue, UpdateContext ctx){}
}
}
A Sample Layout
Label - Componenet
Product - Combo Box
Customer Name - Text Box
Widget Model
- Label for Product
QuestionnaireListBox : - value - valColl[1]
QuestionnaireListBox : - rendered / Vissible - valColl[0]
- Combo Box for Product
QuestionnaireListBox : - value - valColl[2]
QuestionnaireListBox : - required - valColl[0]
QuestionnaireListBox : - rendered / Vissible- valColl[0]
- Label for Customer Name
QuestionnaireEditBox : - value - valColl[6]
QuestionnaireEditBox : - rendered / Vissible- valColl[0]
- Text Box for Customer Name
QuestionnaireEditBox : - value - valColl[7]
QuestionnaireEditBox : - required - valColl[0]
QuestionnaireEditBox : - rendered / Vissible- valColl[0]
The IndexedValueCollection hold value which a Widget reads to determie its various properties.
valColl[0]
= true
: valColl[1]
= Product
: valColl[2]
= null
: valColl[3]
= false
: valColl[4]
= 0
: valColl[5]
= 1
: valColl[6]
= Customer Name
: valColl[7]
= null
I have not been able to figure if I can use the IndexedValueCollection direclty for data binding or will i have to use something like a IndexedContainer and map the data manually on commit.
I did this case in JSF and was able to extend the BeanELResolver to achieve the functionality.
Thanks for any suggestion.