You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2009/09/23 01:36:16 UTC

[jira] Resolved: (WICKET-2464) Link: Why isn't the default implementation of Link.linksTo() 'return getResponsePage.equals(page)' ?

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

Igor Vaynberg resolved WICKET-2464.
-----------------------------------

    Resolution: Fixed
      Assignee: Igor Vaynberg

what is the getResponsePage() method? and even if we had one...the linksTo is checked at render time of the link, at which point the response page is not known. the response page is usually set in the onclick() of the link or sometimes not at all - a lot of links simply mutate the state of the current page instead of navigating to a new one.

the default implementation is the only reasonable one that i can see.

> Link: Why isn't the default implementation of Link.linksTo() 'return getResponsePage.equals(page)' ?
> ----------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-2464
>                 URL: https://issues.apache.org/jira/browse/WICKET-2464
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Knut Pape
>            Assignee: Igor Vaynberg
>            Priority: Minor
>
> The default implementation of Link.linksTo(Page page) just returns false.
> For a page that has state the defaults Link.linksTo(Page page) of a PageLink doesn't fit you should override this method and use an implementation that checks the state of that page.
> More on this topic can be found at the bottom of the page http://cwiki.apache.org/confluence/display/WICKET/Bookmarkable .
> ---
> This means that in cases where you are Linking to the same page from multiple places you have two options:
> 1. Re-implement the comparision logic on each site where a Link is created.
> 2. Create a specialized link class for this Page (you have to be aware of this and use it on all referencing Pages)
> Just out of curiosity: Why isn't the default implementation of linksTo 'return getResponsePage.equals(page)' ?
> This would mean that it is the responsibility of a state full page to implement equals() in a correct way.
> Anyway, IMO the equals method of the Page is the place where comparison logic for comparing two pages belongs intuitively.
> Regarding Regression we have 3 scenarios:
> 1. The equals method of the page was not overridden, the linksTo was also not overridden.
> As long as both pages are not the same object instance (default equals implementation) you will still get false as a result.
> 2. The  linksTo method was implemented.
> The linksTo override supersedes the implementation based on equals, so no change.
> 3. The equals method of a page was overridden with a meaningful implementation, linksTo() was not implemented.
> This is a change compare to the original behavior which would have always returned false even if the two pages were the same.

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