Jon,
This is not about ExternalLink. This is about the fact that you cannot denote a link to an image. I simply said we should fix ExternalLink while we're at it. And yes, I think this is worth holding up a release for because it is basic HTML and should be covered by 1.0.
Gili
Jonathan Locke wrote:
it would be nice if ExternalLink inherited from Link. the fact that it doesn't makes it impossible to enable/disable an external link.
but this obscure use case is hardly a reason to stop the ship process or refactor links. we can do that later and without breaking anyone.
Gili wrote:
I chated with Juergen a few mins ago about problems I've been having with our current Link OO model and I've got to go to sleep now (it's 3:30am local time) so I wanted to summarize some of the things we discussed:
- I define a link as something a user clicks on to navigate from one page to another. Notice the definition of Page here is client-specific, not server-specific. HTML, after all, is a client-side markup. For example, a user can click on an image, PDF file, etc and navigate away from the current Page. Our current implementation only allows links to wicket.Page which is boils down to a Java file with an associated markup. This mismatches with the client interpretation of what a Page or a Link is. On on this below...
- I expect *all* links to extend wicket.markup.html.link.Link, but ExternalLink does not. This is confusing and results from the discussion of "what is a link" above. From a OO point of view: ExternalLink *is a* link and should extend it. The problem is that our current definition of wicket.markup.html.link.Link is too Page-centric which makes it impossible for ExternalLink to extend it. I am advocating making wicket.markup.html.link.Link more generic, having ExternalLink extend it and have PageLink and BookmarkablePageLink remain Page-specific.
- The problem, as I see it, is that our current definition of Link is too restrictive. Links can only point to Pages. But what are Pages? Pages must have markups. Well, in real life, not all HTML links point to entities with markups. Images don't have markups.
What I propose is the following:
1) Add ImageResource.getURL() which will return the application-relative URL to the image resource.
2) Make wicket.markup.html.link.Link more generic. A link is simply an entity that points to a URL. Assuming this class is concrete, this allows us to kill ExternalLink and developers can simply instantiate Links directly. PageLink and BookmarkablePageLink can still extend this class and translate links to Pages to links to URLs.
So linking to images would involve:
Link myLink = new Link(myImageResource.getURL())
and everyone is happy. What do you guys think?
Gili
------------------------------------------------------- This SF.net email is sponsored by Demarc: A global provider of Threat Management Solutions. Download our HomeAdmin security software for free today! http://www.demarc.com/info/Sentarus/hamr30 _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- This SF.net email is sponsored by Demarc: A global provider of Threat Management Solutions. Download our HomeAdmin security software for free today! http://www.demarc.com/info/Sentarus/hamr30 _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
