You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Jan Loose (JIRA)" <ji...@apache.org> on 2008/10/30 15:35:44 UTC

[jira] Created: (WICKET-1905) Component.getPageFactory() vs. Session.getPageFactory() and Session.getPageFactory(Page)

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.


[jira] Commented: (WICKET-1905) Component.getPageFactory() vs. Session.getPageFactory() and Session.getPageFactory(Page)

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644139#action_12644139 ] 

Johan Compagner commented on WICKET-1905:
-----------------------------------------

if we should do anything then we should remove that method from component it doesnt make any sense there

> 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
>            Assignee: Igor Vaynberg
>
> 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.


[jira] Commented: (WICKET-1905) Component.getPageFactory() vs. Session.getPageFactory() and Session.getPageFactory(Page)

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (WICKET-1905) Component.getPageFactory() vs. Session.getPageFactory() and Session.getPageFactory(Page)

Posted by "Jan Loose (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643998#action_12643998 ] 

Jan Loose commented on WICKET-1905:
-----------------------------------

one-instance-page = per session - I have in session a instance of created home page

> 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.


[jira] Commented: (WICKET-1905) Component.getPageFactory() vs. Session.getPageFactory() and Session.getPageFactory(Page)

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644141#action_12644141 ] 

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

way ahead of you :) go fix wicket-bench! :)

> 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
>            Assignee: Igor Vaynberg
>
> 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.


[jira] Commented: (WICKET-1905) Component.getPageFactory() vs. Session.getPageFactory() and Session.getPageFactory(Page)

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644021#action_12644021 ] 

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

1) page factory has nothing to do with urls
2) increase in speed? are you saying that instantiating the homepage is slow?

> 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.


[jira] Commented: (WICKET-1905) Component.getPageFactory() vs. Session.getPageFactory() and Session.getPageFactory(Page)

Posted by "Jan Loose (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644056#action_12644056 ] 

Jan Loose commented on WICKET-1905:
-----------------------------------

ad 1) yes page factory has nothing to do with urls .... and this is good for me:-)
ad 2) no no no;-) I was thinking our usecases ... we have many of complex panels with many and many components ... and this all functionallity is not necessarily to create every request - if the page is bookmarkable - the hybrid coding is solution for this in most of usecases, but in this case is hybrid coding unusable ... because there is no way how to mount some page as / and there is no way how to share instances between tabs in browser - to have two views for the same instance of page (or there is other solution?). 

> 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.


[jira] Commented: (WICKET-1905) Component.getPageFactory() vs. Session.getPageFactory() and Session.getPageFactory(Page)

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643990#action_12643990 ] 

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

what do you need it for?

> 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.


[jira] Resolved: (WICKET-1905) Component.getPageFactory() vs. Session.getPageFactory() and Session.getPageFactory(Page)

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-1905.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg

> 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
>            Assignee: Igor Vaynberg
>
> 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.


[jira] Commented: (WICKET-1905) Component.getPageFactory() vs. Session.getPageFactory() and Session.getPageFactory(Page)

Posted by "Jan Loose (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643994#action_12643994 ] 

Jan Loose commented on WICKET-1905:
-----------------------------------

I need to have some one-instance-pages (e.g. home page). I need increase speed, bookmarkable url and solve some problems with micro-applications which are runnig as panel inside these pages - problem with history and many opened tabs in browser. But other pages use the standard cases - DiskPageStorage, Bookmarkable/Hybrid mounts, ...

This problem can be solved by modification of DefaultPageFactory. But this class has all method final (for now I create a copy). The second solution is override the Component#getPageFactory() and return here some special PageFactory, but the code is final.

And finnaly the code listed above is ugly - because the code does nothing - in all cases returns getApplication().getSessionSettings().getPageFactory() ....

> 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.