[ 
http://issues.apache.org/click/browse/CLK-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11716#action_11716
 ] 

Bob Schellink commented on CLK-497:
-----------------------------------

Its true that the Field#isDisabled checks with the parent first if it should be 
disabled. However if the parent (Form or FieldSet) is not disabled it falls 
back to its own disabled property. So it would be possible to create a custom 
Container which pushes the disabled property to child fields:

public class MyContainer extends AbstractContainer {

  public void setDisabled (boolean disabled) {
    List<Field> fields = ContainerUtils.getFields(this);
    for (Field field : fields) {
      field.setDisabled(disabled);
    }
  }
}

The code above would push the state to the child fields. Granted a disabled 
Form or FieldSet would override the state MyContainer pushed to its fields.

Hmm perhaps we should remove the Field#isDisabled logic and let the 
Form/FieldSet push the state to the child fields? Would that help?

kind regards

bob


> FieldSet isDisabled and isReadonly methods broken
> -------------------------------------------------
>
>                 Key: CLK-497
>                 URL: http://issues.apache.org/click/browse/CLK-497
>             Project: Click
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 2.0.1
>         Environment: Windows XP, Java 6
>            Reporter: James P Brown
>         Attachments: FieldSet_isDisabled_isReadonly_bug.zip
>
>
> The FieldSet is supposed to force its child components to be 
> disabled/readonly when it is set to disabled/readonly. I did not observe this 
> when I attempted to create a FieldSet with a child component.
> I believe the code to support this is not working as anticipated. The Field 
> class has modified methods for isDisabled/isReadonly that specifically check 
> if the parent component (i.e. container) is an instanceof FieldSet (or Form, 
> which is working AFAIK). The problem is that the design of FieldSet relies on 
> an instance of its private inner class FieldSet.InnerContainerField for 
> managing those child elements. When I step through the code in debug mode, 
> the class instance is of this inner class type (InnerContainerField) not 
> FieldSet. Since InnerContainerField is not a type of FieldSet, the subsequent 
> logic is ignored.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to