[ 
https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677045#action_12677045
 ] 

David commented on WICKET-2049:
-------------------------------

Adding the following override to a component will allow for the expected 
behaviour, but it has to be added on a per-component basis:


                private boolean hasHiddenAttribute = false;
                @Override
                public boolean isVisible() {
                        if(getMarkupStream()!= null) {
                                try{
                                        ComponentTag tag = 
getMarkupStream().getTag();
                                        final String value = 
tag.getAttributes().getString(ComponentTag.DEFAULT_WICKET_NAMESPACE + 
":hidden");
                                        System.out.println("value1: " + value);
                                        if("hidden".equals(value)) {
                                                hasHiddenAttribute = true;      
                                        }
                                } catch(MarkupException e) {
                                        
                                }
                        }
                        return super.isVisible() && !hasHiddenAttribute;
                }

> beforeRender not called for behaviour added to ComponentTag
> -----------------------------------------------------------
>
>                 Key: WICKET-2049
>                 URL: https://issues.apache.org/jira/browse/WICKET-2049
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>            Reporter: David
>            Assignee: Juergen Donnerstag
>         Attachments: ComponentTagAddBehaviourBug.zip
>
>
> When adding a IMarkupFilter and adding a behaviour to the ComponentTag, the 
> beforeRender method is never called, only onComponentTag will be called, but 
> by then it is too late to modify the component.
> Usecase: I would like to make components hidden if the markup contains 
> wicket:hidden="hidden". For this i need to modify the components visiblitiy 
> depending on if the markup contains that attribute.
> The attached quickstart will never reach the 
> System.out.println("beforeRender: should hide component"); in 
> HiddenComponentMarkupFilter

-- 
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