Some possible solutions:

1) Ideally, instantiating a Page should be extremely cheap. Everything
should use lazy initialization so invoking getPage() to do page
comparison won't be much more expensive than getPageClass().

2) When we call getPageClass() and decide not to call getPage(), how
expensive would it be to call getPage() anyway? If the page is the
current page, wouldn't getPage() be very cheap (return instance to an
already-existing object)?

        In both of the above cases, I suggest removing getPageClass()
altogether...

3) How about "boolean linksTo(Page page)"? Since we're comparing the
link to a page which is already instantiated, the link could tell us
whether it links to that page or not. I find this clearer than
getPageClass().

Gili

On Wed, 26 Jan 2005 09:43:25 -0800, Jonathan Locke wrote:

>
>but it's not.  URI's have a very specific syntax.  this method returns a 
>Class, which is not a URI (which is a java.net class).  this would 
>confuse the casual observer.   it would confuse me as well!
>
>Gili wrote:
>
>>      But in Wicket's case, the class *is* used as a URI. The only
>>reason you are getting the Page class is so you can find out whether
>>the link points to the current page or not. Getting the URI would do
>>that and it is more intuitive.
>>
>>Gili
>>
>>On Tue, 25 Jan 2005 15:59:11 -0800, Jonathan Locke wrote:
>>
>>  
>>
>>>but that's not what it does.  i think better docs are the solution.  it 
>>>gets the class of Page not the URI. 
>>>
>>>can you submit a bug that this needs to be documented?  i don't want us 
>>>to foget it.
>>>
>>>thanks,
>>>
>>>    jon
>>>
>>>Gili wrote:
>>>
>>>    
>>>
>>>>    My 2 cents: the name getPageClass() is the source of this
>>>>confusion. Everyone naturally assumes that getPageClass() is redundant
>>>>because you could use getPage().getClass() but if you renamed it to
>>>>getPageURI() or something it would make a lot more sense to people.
>>>>Also, getPageClass()'s online Javadoc is empty which is also
>>>>contributing to the problem.
>>>>
>>>>Gili
>>>>
>>>>On Tue, 25 Jan 2005 09:10:10 -0800, Jonathan Locke wrote:
>>>>
>>>> 
>>>>
>>>>      
>>>>
>>>>>Juergen Donnerstag wrote:
>>>>>
>>>>>   
>>>>>
>>>>>        
>>>>>
>>>>>>IPageLink requires us to implement two methods: getPage() and
>>>>>>getPageClass(). Aren't these two information redundant? The page
>>>>>>
>>>>>>
>>>>>>     
>>>>>>
>>>>>>          
>>>>>>
>>>>>nope.  getPage() actually resolves the Page when a link is clicked.  
>>>>>getPageClass is part of the information used before the link is clicked 
>>>>>to determine how a link should be rendered.
>>>>>
>>>>>the docs state this:
>>>>>
>>>>>* ... The getPageClass()
>>>>>* method returns the subclass of Page that getPage() will return if
>>>>>* and when it is  called. 
>>>>>* <p>
>>>>>* This way of arranging things is useful in determining whether a
>>>>>* link links to a given page, which is in turn useful for deciding
>>>>>* how to display the link (because links in a navigation which link to
>>>>>* a page itself are not useful and generally should instead indicate
>>>>>* where the user is in the navigation).
>>>>>
>>>>>   
>>>>>
>>>>>        
>>>>>
>>>>>>returned by getPage() is able to provide its Class. From the sources I
>>>>>>understand what they required for, but from a user's perspective I
>>>>>>don't. Does anybody knwo the details of this implementation and may be
>>>>>>come up with a suggestion on how to avoid getPageClass() in IPageLink.
>>>>>>
>>>>>>Juergen
>>>>>>
>>>>>>
>>>>>>-------------------------------------------------------
>>>>>>This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
>>>>>>Tool for open source databases. Create drag-&-drop reports. Save time
>>>>>>by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>>>>>>Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>>>>>>_______________________________________________
>>>>>>Wicket-develop mailing list
>>>>>>[email protected]
>>>>>>https://lists.sourceforge.net/lists/listinfo/wicket-develop
>>>>>>
>>>>>>
>>>>>>
>>>>>>     
>>>>>>
>>>>>>          
>>>>>>
>>>>>-------------------------------------------------------
>>>>>This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
>>>>>Tool for open source databases. Create drag-&-drop reports. Save time
>>>>>by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>>>>>Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>>>>>_______________________________________________
>>>>>Wicket-develop mailing list
>>>>>[email protected]
>>>>>https://lists.sourceforge.net/lists/listinfo/wicket-develop
>>>>>
>>>>>   
>>>>>
>>>>>        
>>>>>
>>>>
>>>>
>>>>-------------------------------------------------------
>>>>This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
>>>>Tool for open source databases. Create drag-&-drop reports. Save time
>>>>by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>>>>Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>>>>_______________________________________________
>>>>Wicket-develop mailing list
>>>>[email protected]
>>>>https://lists.sourceforge.net/lists/listinfo/wicket-develop
>>>>
>>>> 
>>>>
>>>>      
>>>>
>>>-------------------------------------------------------
>>>This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
>>>Tool for open source databases. Create drag-&-drop reports. Save time
>>>by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>>>Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>>>_______________________________________________
>>>Wicket-develop mailing list
>>>[email protected]
>>>https://lists.sourceforge.net/lists/listinfo/wicket-develop
>>>
>>>    
>>>
>>
>>
>>
>>
>>-------------------------------------------------------
>>This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
>>Tool for open source databases. Create drag-&-drop reports. Save time
>>by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>>Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>>_______________________________________________
>>Wicket-develop mailing list
>>[email protected]
>>https://lists.sourceforge.net/lists/listinfo/wicket-develop
>>
>>  
>>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
>Tool for open source databases. Create drag-&-drop reports. Save time
>by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>_______________________________________________
>Wicket-develop mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/wicket-develop
>




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to