One idea would be to create a class that represents the logical idea of
a link, e.g....

public class NavEntry {
    private String title;
    private Class pageClass;
    private PageParameters parameters;
    ...
}

Pass a list of these to the constructor of your panel, which then
renders these into actual links and labels.

If this is too restrictive, e.g. if you want different kinds of links,
not just BookmarkablePageLinks, you can defer creation of the link to
the NavEntry object:

public class NavEntry {
    ...
    public abstract WebMarkupContainer createLink(String id);
}

public class BookmarkablePageNavEntry extends NavEntry {
    private Class pageClass;
    private PageParameters parameters;
    public WebMarkupContainer createLink(String id) {
        return new BookmarkablePageLink(pageClass, parameters);
    }
}

A similar technique is used in the tabs package in wicket-extensions.

jk

On Tue, May 29, 2007 at 07:55:48PM +0200, Johannes Schneider wrote:
> Hi,
> 
> I am new to Wicket and I really like the things I have seen so far. But 
> I also have a few questions.
> At the moment I create a small page. Therefore I have created a 
> NavigationComponent (extends Panel) with its own markup file and some 
> other resources (css, images).
> 
> Can anybody describe me the best way to add Links (most of them are 
> BookmarkableLinks) and the corresponding Labels to this component?
> At the moment I create a List of Links. Each of those links has a Label 
> added. Those links are then provided to a DataView and given to the 
> NavigationComponent.
> I don't like this because I have to create the components manually 
> (Links and Labels) with the "correct" ids. What approach would a wicket 
> expert take?
> 
> Later I might reuse the NavigationComponent within another application. 
> But therefore I would like to modify/replace the CSS and replace some 
> images. What is the Wicket way to achive this?
> 
> 
> Thanks in advance,
> 
> 
> Johannes Schneider
> -- 
> Johannes Schneider
> Im Lindenwasen 15
> 72810 Gomaringen
> 
> Fon +49 7072 9229972
> Fax +49 7072 509999
> Mobil +49 178 1364488
> 
> [EMAIL PROTECTED]
> http://www.johannes-schneider.info



> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to