Hi
(Sylvain),
I have to set a
selection list on a field, based on success or failure of a
validation.
When I use the
following fragment:
TntCformsJavaSelectionList mySelectionList = new
TntCformsJavaSelectionList(true);
mySelectionList.setDatatype(new
StringType());
myField.setSelectionList(mySelectionList);
I get an error:
Tried to assign a SelectionList that is not
associated with this widget's datatype.
The fragment responsible for this Exception:
public void
setSelectionList(SelectionList selectionList)
{
if (selectionList != null &&
selectionList.getDatatype() != null &&
selectionList.getDatatype() != getDatatype()) {
throw new RuntimeException("Tried to assign a SelectionList that is not associated with this widget's datatype.");
}
if (selectionList != null &&
selectionList.getDatatype() != null &&
selectionList.getDatatype() != getDatatype()) {
throw new RuntimeException("Tried to assign a SelectionList that is not associated with this widget's datatype.");
}
The problem is, that
this tests for java reference equality.
Could you maybe
implement an equals() method in the Datatype subclasses, and test for
equality?
like:
selectionList.getDataType().equals(getDatatTypeI())
Regards, Ron
PS If you think this
is a good idea, I can do it myself.
PPS Keep up the good
work on Cforms. I'm love it!
