You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "David (JIRA)" <ji...@apache.org> on 2009/01/26 13:47:59 UTC

[jira] Created: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

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


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.


[jira] Resolved: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juergen Donnerstag resolved WICKET-2049.
----------------------------------------

    Resolution: Won't Fix
      Assignee: Juergen Donnerstag

beforeRender is invoked before the render process. But only during the render process the component associated to the markup tag is dynamically identified and thus only than the behavior you attached to the ComponentTag can be handled. I don't see any way to fix it. But there is another solution: please see WicketRemoveTagHandler

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


[jira] Issue Comment Edited: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "David (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677014#action_12677014 ] 

medavid edited comment on WICKET-2049 at 2/26/09 7:01 AM:
--------------------------------------------------------

we have pages(containing forms) that have a different markup for each client using the application. We differ using the setStyle method in Wicket. Usually it is just some layout, but sometimes it is that certain fields need to be removed. In the current situation we can do two things: hardcode it in the page, checking the style/ client name or hacking around it using a display:none in the markup. Both options don't satisfy me, so I was looking for a different solution. Any other alternative approaches are welcome

      was (Author: medavid):
    we have pages(containing forms) that have a different markup for each client using the application. We differ using the setStyle method in Wicket. Usually it is just some layout, but sometimes it is that certain fields need to be removed. In the curren situation we can do two things: hardcode it in the page, checking the style/ client name or hacking around it using a display:none in the markup. Both options don't satisfy me, so I was looking for a different solution. Any other alternative approaches are welcome
  
> 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.


[jira] Resolved: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juergen Donnerstag resolved WICKET-2049.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4-RC3

You now can do something like in your IMarkupFilter. 

tag = new ComponentTag(tag)
{
	public void onBeforeRender(final Component component, final MarkupStream markupStream) 
	{
		super.onBeforeRender(component,markupStream);

		IValueMap attr = markupStream.getTag().getAttributes();
		String value = attr.getString(ComponentTag.DEFAULT_WICKET_NAMESPACE + ":hidden");
		if ("hidden".equals(value)) 
		{
			component.setVisibilityAllowed(false);
		}
	}
};

> 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
>             Fix For: 1.4-RC3
>
>         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.


[jira] Commented: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "David (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677146#action_12677146 ] 

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

Nice fix, thanks!

> 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
>             Fix For: 1.4-RC3
>
>         Attachments: ComponentTagAddBehaviourBug.zip, HiddenComponentsMarkupFilter.java
>
>
> 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.


[jira] Updated: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juergen Donnerstag updated WICKET-2049:
---------------------------------------

    Attachment: HiddenComponentsMarkupFilter.java

Attached an updated version of your IMarkupFilter which does the trick

> 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
>             Fix For: 1.4-RC3
>
>         Attachments: ComponentTagAddBehaviourBug.zip, HiddenComponentsMarkupFilter.java
>
>
> 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.


[jira] Commented: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "David (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "David (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12676997#action_12676997 ] 

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

Neither do I see any way to fix, but the WicketRemoveTagHandler way is not a solution, as then the java component hierarchy will no longer match the markup hierarchy

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


[jira] Reopened: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juergen Donnerstag reopened WICKET-2049:
----------------------------------------


found a rather simple solution

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


[jira] Commented: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677003#action_12677003 ] 

Juergen Donnerstag commented on WICKET-2049:
--------------------------------------------

If you just want to make it invisible by default, why don't you just change your Page/Container constructor and make the component invisible?

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


[jira] Commented: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "David (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677014#action_12677014 ] 

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

we have pages(containing forms) that have a different markup for each client using the application. We differ using the setStyle method in Wicket. Usually it is just some layout, but sometimes it is that certain fields need to be removed. In the curren situation we can do two things: hardcode it in the page, checking the style/ client name or hacking around it using a display:none in the markup. Both options don't satisfy me, so I was looking for a different solution. Any other alternative approaches are welcome

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


[jira] Updated: (WICKET-2049) beforeRender not called for behaviour added to ComponentTag

Posted by "David (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David updated WICKET-2049:
--------------------------

    Attachment: ComponentTagAddBehaviourBug.zip

quickstart demonstrating the bug

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