tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Velikiy (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (TAP5-1895) ValidationDecorator.insideLabel(...) is called after the removal of PropertyContext in PropertyEditor
Date Wed, 04 Apr 2012 10:06:24 GMT

     [ https://issues.apache.org/jira/browse/TAP5-1895?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Vladimir Velikiy updated TAP5-1895:
-----------------------------------

    Fix Version/s: 5.4
                   5.3.3
    
> ValidationDecorator.insideLabel(...) is called after the removal of PropertyContext in
PropertyEditor
> -----------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1895
>                 URL: https://issues.apache.org/jira/browse/TAP5-1895
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.2
>            Reporter: Vladimir Velikiy
>              Labels: label, validationdecorator
>             Fix For: 5.3.3, 5.4
>
>         Attachments: TAP5-1895.patch
>
>
> I want to add css class to label if field is required in my custom ValidationDecorator:
>    
> @Override
>     public void insideLabel(Field field, Element labelElement) {
>         if(field == null) return;
>         if(field.isRequired()) {
>             labelElement.addClassName("required-label");
>         }
>         if(inError(field)) {
>             labelElement.addClassName(CSSClassConstants.ERROR);
>         }
>     }
> It does not work with BeanEditForm component. The problem arises because method ValidationDecorator.insideLabel(...)
is called in Label component after removal of PropertyContext from Environment (PropertyContext
is needed for get the validator and call isRequired() method):
> @HeartbeatDeferred
>     private void updateAttributes()
>     {
>         String fieldId = field.getClientId();
>         labelElement.forceAttributes("for", fieldId);
>         decorator.insideLabel(field, labelElement);
>     }
> The solution for this problem would be to move the call to decorator.insideLabel (field,
labelElement) to the beginRender method in Label component. Label decorating does not need
to wait for rendering field element and only needs a label element.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message