[ 
https://issues.apache.org/jira/browse/WICKET-1905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644073#action_12644073
 ] 

Igor Vaynberg commented on WICKET-1905:
---------------------------------------

the reason why you dont want to share instances, especially for differen tabs 
is that it is going to cause a lot of problems. user has the same page instance 
opened in two tabs. does something in tab A that swaps a panel, goes to tab B 
and clicks on a link in the now swapped panel and gets an error because the 
panel is no longer on the page.

so think carefully about what you are doing here.

further what you want can be implemented without any modifications to the code. 
install your own pagefactory that checks which class is being instantiated and 
if it is the homepage or if it has some annotation on it pull it from session 
instead of creating a new instance.

all those methods you pointed to that are final are convinience methods, and 
they are final just for that reason.

> Component.getPageFactory() vs. Session.getPageFactory() and 
> Session.getPageFactory(Page)
> ----------------------------------------------------------------------------------------
>
>                 Key: WICKET-1905
>                 URL: https://issues.apache.org/jira/browse/WICKET-1905
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-M4
>            Reporter: Jan Loose
>
> I was found strange code:
> In Session:
>       public final IPageFactory getPageFactory()
>       {
>               return getApplication().getSessionSettings().getPageFactory();
>       }
>       public final IPageFactory getPageFactory(final Page page)
>       {
>               if (page != null)
>               {
>                       return page.getPageFactory();
>               }
>               return getPageFactory();
>       }
> Both method are 'final', the first gets PageFactory from SessionSettings and 
> the second uses Page#PageFactory (defined in Component) or uses the 
> Session#getPageFactory() (the first method).
> In Component:
>       /**
>        * @return The page factory for the session that this component is in
>        */
>       public final IPageFactory getPageFactory()
>       {
>               return getSession().getPageFactory();
>       }
> And again 'final' and gets the PageFactory by Session#getPageFactory() too.
> Why is there this code? I think that the final word in 
> Component#getPageFactory() should be removed (i need it:-)).
> Thx,
> H.

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

Reply via email to