You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Joe Hudson (JIRA)" <ji...@apache.org> on 2009/10/17 14:53:31 UTC

[jira] Reopened: (WICKET-2489) need to know if a component has been added to the AjaxRequestTarget

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

Joe Hudson reopened WICKET-2489:
--------------------------------


I see the getComponents method and that's great but I might potentially be calling this method many times per request (1 for every component added to the AjaxRequestTarget as well as all their parent components) and I was really hoping to:

1) take advantage of the Map data structure
2) not create a new List every time this method is called

Is there any way you could just add a "contains" method which can just check against the the markupIdToComponent map and returns a boolean?
Also, it would be great if the containsAncestorFor method was public as well... but now I'm getting needy :)

Thank you for all your hard work on Wicket!

> need to know if a component has been added to the AjaxRequestTarget
> -------------------------------------------------------------------
>
>                 Key: WICKET-2489
>                 URL: https://issues.apache.org/jira/browse/WICKET-2489
>             Project: Wicket
>          Issue Type: Wish
>          Components: wicket
>    Affects Versions: 1.4.1
>            Reporter: Joe Hudson
>            Assignee: Juergen Donnerstag
>             Fix For: 1.4.2, 1.5-M1
>
>
> We need to evaluate the AjaxRequestTarget to determine if a component has been directly added (as opposed to the component rendering because of a parent component being added).  This is useful for applying markup wrapping through the use of behaviors.  This is required because, on a ajax request - and if the component that has the markup wrapping behavior was added directly to the AjaxRequestTarget, the markup provided with the behavior will be duplicated.  We currently have a workaround but it required the use of a custom AjaxRequestTarget:
> public class AjaxRequestTarget extends org.apache.wicket.ajax.AjaxRequestTarget {
> 	private Map<String, Boolean> addedComponents = new HashMap<String, Boolean>();
> 	public AjaxRequestTarget(Page page) {
> 		super(page);
> 	}
> 	@Override
> 	public void addComponent(Component component) {
> 		addedComponents.put(component.getMarkupId(), Boolean.TRUE);
> 		super.addComponent(component);
> 	}
> 	public boolean wasComponentAdded(Component component) {
> 		return (null != addedComponents.get(component.getMarkupId()));
> 	}
> }
> It would be nice if the Wicket AjaxRequestTarget had a method (the name of the method name doesn't really matter and is just for example purposes) like the following:
> public boolean wasComponentAdded(Component component) {
> 	return (null != markupIdToComponent.get(component.getMarkupId());
> }

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