What you describes looks fine to me.


Donnerstag, Juergen wrote:
 Any comments on that? Shall I commit it?

Regards
Juergen

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] Im Auftrag von
Donnerstag, Juergen
Gesendet: Sonntag, 17. Oktober 2004 14:55
An: [EMAIL PROTECTED]
Betreff: AW: [Wicket-develop] strange problem with autolinks

I tried to fix that problem. Before committing it however, I'd like to
explain the approach.

As described by Eelco the autoIndex must be unique within a Page, which
currently is not guaranteed. I modified MarkupParser constructor to except
an additional int parameter autoIndexPrefix which used by MarkupParser to
create names like [autolink]-<autoIndexPrefix>-<autoIndex> (e.g.
[autolink]-0-0). I added incrementAutoIndex() to Page und modified Container
which is the only class which instantiates a MarkupParser to call
page.incrementAutoIndex(). Finally I modified ComponentTag to be able to
cope with the modified tag.

I've tested Eelco's CD example, as well as all other examples and unit tests
of course as well. The required changes are actually minimal (about 15 lines
of code modified/added)

Regards
Juergen 

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] Im Auftrag von Eelco
Hillenius
Gesendet: Freitag, 15. Oktober 2004 17:17
An: [EMAIL PROTECTED]
Betreff: Re: [Wicket-develop] strange problem with autolinks

I now know what the problem is, but - though I played around a bit - not yet
what the best solution should look like.

The problem is that the border component uses two markup streams. With
normal components, this is not a problem, as they are independently added to
the component hierarchy, but with auto-components this is. The
autocomponents of both streams are added to the same border component, BUT
the autolinks get a unique number within the scope of the markupstream only.

This is in MarkupParser:

   // If value is an automaticLink link, like [autolink], then add
   // automaticLink numbering to keep tag value separate from other
   // tags
   if (value.equals("[autolink]"))
   {
     value += ("-" + autoIndex);
     autoIndex++;
     tag.automaticLink = true;
   }

This is container.renderNext:

    Component component = get(componentName);

     // Check for automatic links
     if ((component == null) && tag.isAutomaticLink())
     {
        // Add automaticLink external page link
        component = tag.createAutomaticLink(getPage(), markupStream);
        add(component);
       }

Now in the CDAPP case, [autolink]-0..- 2 of the border are added first. 
But, after the border component was handled, the autolink of the HomePage
also has name [autolink]-0, and thus can be found with statement Component
component = get(componentName); Hence, test if ((component == null) &&
tag.isAutomaticLink()) is false, and thus the creation of the automatic link
is skipped. And even if this test would pass, we are not allowed to add more
than one component with the same name.

The effect in the end is that the autolink on the HomePage is rendered as a
link to HomePage, as that was the first autolink that was added to the
border.

I added a TODO in MarkupParser as that seems to be a logical place to solve
this problem.

Can anyone solve this problem? I'll be on a vacation for 3,5 weeks. See you
next month!

   Eelco


Eelco Hillenius wrote:

  
Hi all,

I've got a strange problem, and not enough time to really delve into 
it. The problem occurs in the cd app example. I'm working with a 
border that has some autolinks. Now, when using those autolinks, my 
autolink on the homepage is not rendered well (actually, it's never 
even added as a new component it seems, so I think it is rendered as 
[autolink-0], which was added in the border as the link to the home 
page). Now, if I remove the autolinks from the border, the autolink on 
home page renders fine (and *is* added as a new component).

Weird. Any idea's?

Cheers,

   Eelco
    




-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use
IT products in your business? Tell us what you think of them. Give us Your
Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Wicket-develop mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/wicket-develop


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use
IT products in your business? Tell us what you think of them. Give us Your
Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Wicket-develop mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/wicket-develop


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Wicket-develop mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/wicket-develop


  

Reply via email to