personally I'm no fan of conditional adding components with the same id.
e.g.
if (user.isSignedIn() {
add(new SignedInPanel("foo"));
else {
add(new SignedOutPanel("foo"));
}
I rather add all panels and make them invisible or visible
add(new SignedInPanel("foo").setVisible(user.isSignedIn()); // or override
isvisible if that may change ...
add(new SignedOutPanel("bar").setVisible(!user.isSignedIn());
this way you always know which panels are added to the page and what they
are ...
regards,
Michael
ashtek wrote:
>
> Hey All,
>
> I apologize for the long content -
>
> I have a navigation bar on the side that contains links to add Users,
> Permissions, Roles, etc... When a user clicks on a navigation link (say
> Users), a Users home page is displayed that contains a link to add users,
> and a list of all available users.
>
> The link to add users is a panel that contains
>
> <wicket:link>
> <td> # Add Users </td>
> </wicket:link>
>
>
> In each of the home pages I add the panel like this -
>
> On the User home page I add, add(new AddPanel("addPanel",
> AddPanel.USER));
>
> On the Roles home page I add, add(new AddPanel("addPanel",
> AddPanel.ROLES));
>
>
> And this is what I have in the AddPanel.class
>
> public AddPanel(String id, int addWhat) {
> super(id);
>
> switch (addWhat) {
> case USER:
> add(new BookmarkablePageLink("addLink",
> EditUsers.class));
> case ROLES:
> case PERMISSIONS:
> add(new BookmarkablePageLink("addLink",
> EditPermissions.class));
> default:
> }
>
>
> The Problem is, when I click on the Users homepage, and then I click on
> the Permissions home page, I get an error saying "addLink already exists
> in the markup". Is there a better way to handle links than this?
>
> Thanks!
>
-----
Michael Sparer
http://techblog.molindo.at
--
View this message in context:
http://www.nabble.com/Adding-Replacing-links-in-Panels-tp21989041p21995364.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]