cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ron van de Ven" <Ron.vande...@mp-objects.com>
Subject [Cforms] Java Selection List
Date Thu, 16 Jun 2005 08:51:57 GMT
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.");
        }
 
 
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!

             

Mime
View raw message