what do you think about performance? seems kind of overkill to traverse the entire tree every time you add a component, especially for listview/dataview type stuff. i know it wont be a problem in prod because component-use-check should be turned off, but still in development it might be a pain.

i think maybe this one we call user error and leave it at that?

-Igor


On 12/21/05, Juergen Donnerstag < [EMAIL PROTECTED]> wrote:
We do not check that a component (same object instance) is added twice
at different levels in the hierarchy.

This test could be added to MarkupContainer.add() though. Something like

                // Check that the same component instance is not
                // added more than once.
                if (getApplicationSettings().getComponentUseCheck())
                {
                        Page page = findPage();
                        if (page != null)
                        {
                                page.visitChildren(new IVisitor()
                                        {
                                                public Object component(Component component)
                                                {
                                                        if (component.equals(child))
                                                        {
                                                                throw new WicketRuntimeException(
                                                                                "You can not add the same Component twice: "
                                                                                + child.toString());
                                                        }
                                                        return IVisitor.CONTINUE_TRAVERSAL;
                                                }
                                        });
                        }
                }


It seems to work. Any objections?

Juergen

On 12/21/05, Juergen Donnerstag < [EMAIL PROTECTED]> wrote:
> On 12/21/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > hi Juergen,
> > could you please take a look at
> >
> > Bugs item #1375584, was opened at 2005-12-07 18:44
> > Message generated for change (Comment added) made by ivaynberg
> > You can respond by visiting:
> > https://sourceforge.net/tracker/?func=detail&atid=684975&aid=1375584&group_id=119783
> >
> > i think this is more your area then mine. this guy added the same component
> > to the page twice. once to a form and once to a feedbackborder which was
> > also added to the form. wicket didnt catch this.
> >
>
> I'll check it.
>
> Juergen
>


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to