Jlist & JGoodies Binding



Hi,

I have the following java bean:

public class UniversityCourse extends Model {

public static final LEVEL_PROPERTY = "levels";

//the name of the course
private String name ;

//Eg: 1st yr, 2nd yr...
private List levels ;

//More properties....

//Instance creation *******************************
public UniversityCourse (){
setName("");
setLevels(new ArrayList ());
}

//get the name
public String getName (){return name;}

//set the name
public void setLevels (String value){
String oldValue = name;
name = value;
fireProperyChange(LEVELS_PROPERY,
oldValue, newValue);
}

//More getter and setter methods
}



[Scenario]
I have a CourseView class that contains all the fiels of the course.
The view is bounded to the UniversityCourse bean, using jgoodies
binding. I have two JLists : (a) one that contains all the levels of
the university (say 1st yr to 5th yr)- call this availableLevelList .
And another JList in which the user can add all the levels for which a
particular course will be offered. Call this a selectedLevelList . This
list is bounded to levels [see UniversityCourse above].Example: A
course may done by the last two levels or the 1st three.

[Problem]
But if I select a level from the availableLevelList to the
selectedLevelList, the selected levels do not reflect in
UniversityCourse.

This is how I did the binding:
....
....
ValueModel levelModel =
coursePresentationModel.getModel(UniversityCourse.LEVEL_PROPERY);
SelectionInList selectionInList =
new SelectionInList((ListModel)courseArrayListModel);

Bindings.bind(getSelectedLevelsList, selectionInList);

....binding other fields

[Question]
What am I doing wrong? How can I solve the above problem.

Please help.

Thanks in advance.

Yours,
Me

.