CheckBoxListControl load

Help
2009-03-21
2012-12-13
  • Zsolt Paroczi
    Zsolt Paroczi
    2009-03-21

    I am trying to use a CheckBoxListControl but it seems to me that the
    control does not set the selected values during the load.

    Lets see Demo4:

    1. Start app select 1 record, the detail page opens
    2. I check in the debugger that the record contains 2 items in the listValues attribute
        (this attribute is connected to the control)
    3. I suppose that the control shoul match the values from the attribut to the domain codes
       and should set check if some of it matches.

    Question:

    How it matches the domain's code to the attribute if the attribute is a list?
    I mean if the attribute is a List<String> it sould be match the String item to the domain item code.
    But what if it is a List<XxxVO> what the matcher algoritm search for getCode function or what?

    Suggestion : it would be nice feature to set property on the control that sets the matcher property
    on the VO that will be compare to the domain code.

    thanks forward your reply,
    Zsolt

     
    • Zsolt Paroczi
      Zsolt Paroczi
      2009-04-03

      Hi,

      I did some debug and as I can understand the code the CheckBoxListControl object initilaized via the setValues() method. It is called from the Form object, the Form object
      would pass the initialization list to the control. The initialization list is comes from the VOModel by the parameter of the attribute name of the control. And the problem is that the VO model does not contain the List attributes from the valueObject.

      this is a fragment from the VOModel.java :

              if (props[i].getReadMethod()!=null &&
                  props[i].getReadMethod().getParameterTypes().length==0) {
                // check if attribute must be ignored because it's not compatible...
                if (!(ValueObject.class.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      Boolean.class.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      Number.class.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      byte[].class.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      String.class.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      java.util.Date.class.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      Boolean.TYPE.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      Short.TYPE.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      Integer.TYPE.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      Long.TYPE.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      Float.TYPE.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      Double.TYPE.isAssignableFrom(props[i].getReadMethod().getReturnType()) ||
                      Character.TYPE.isAssignableFrom(props[i].getReadMethod().getReturnType())
                ))
                  continue;
              }

      From the above code I suspect that if I use List or String[] types it won't be in the VOModel and the model.getValue(comp.getAttributeName()) call returns null.

      Regards,
      Zsolt

       
    • Zsolt Paroczi
      Zsolt Paroczi
      2009-04-03

      Ignore my question from the original post I figured out from the code that it uses the
      Object class' equal method to match the domain list to the values from a VO.

       
    • mcarniel
      mcarniel
      2009-04-04

      Hi!

      thanks for reporting me the issue on CheckBoxListControl in demo4: I fixed the bug (...you had already identified).
      Fix will be available with next relase of OpenSwing, planned for next monday.