I don't think that what you want to do is in anyway a problem for
Wicket, The approach I would take is:
1) Create an Application class that contains a factory method that
allows you to pass a logical page name and in response creates and
returns a Panel subclass. You could configure how this works using XML
or whatever:
public class MyApplication extends Application {
public Panel getContent(String pageName, String panelName) {
// Do something to lookup and create the content panel. E.g.
return new SomePanel(panelName);
}
2) Create a reusable page class, something like:
public class MySitePage extends WebPage {
public MySitePage(PageParameters params) {
this((String)params.get("pageName"));
}
public MySitePage(String pageName) {
add(new NavigationPanel("nav"));
Panel contentPanel =
((MyApplication)getApplication()).getContent(pageName, "content");
add(contentPanel);
}
}
3) If you always access all pages via bookmarkable page links then there
should be no problems, just make sure that you always pass the pageName
parameter.
4) If you want to use other links in some way you may want to create
your own page factory or similar to allow the pageName string to be used
when new page instances are instantiated. I will leave that as an
exercise for the reader ;)
Hope that helps,
regards,
Chris
All the pages on my site look essentially the same, except for the
title, navigation and a central "content" area.
Ideally, I would have a single page class, a navigation component class
and an application class.
Somewhere (the application?) there would be a list of all the pages in
the
site (provided in code or XML, maybe?). There would be a corresponding
list of files containing the content for each page.
The page class would pull content for the main body from the
corresponding
content file (stripping everything outside the body tags) and insert it
into the central content area.
I suppose each page would need to have some sort of identifier to allow
links from one page to another.
The biggest obstacle I see to this is the external linking issue. If
each BookmarkableLink has to be a separate class, then I'm doomed,
because
I want all my pages bookmarkable -- which would mean I would have to
write
a new class for every page in the system. That would defeat part of my
purpose.
Sounds like maybe Wicket isn't the right tool, after all :(
C
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user