change
protected void onAttach() {
//Verify visible status
setVisible(getWicketSession().isUserLoggedIn());
}
to
boolean isVisible() { return getWicketSession().isUserLoggedIn(); }
imho that is better
-igor
On 4/24/07, Francisco Diaz Trepat - gmail <[EMAIL PROTECTED]>
wrote:
Hi, I have this working code. But I feel I'am mistaking and this is not
the most apropiate place for it.
Very simple, a logout panel (just a link) that on attached sets itself
visible or not. Here is the code.
public class LogoutPanel extends BasePanel {
/** Creates a new instance of LogoutPanel */
public LogoutPanel(String id) {
super(id);
//Create logout link
Link cLogoutLink = new Link("logoutLink") {
//Logout action
public void onClick() {
//Logout
getWicketSession().logout();
setResponsePage(Index.class);
}
};
//add class attribute.
cLogoutLink.add(new AttributeModifier("class", true, new
AbstractReadOnlyModel() {
public Object getObject(Component component) {
return "headerWiteLink";
}
}));
//add the logoutLink
add(cLogoutLink);
}
protected void onAttach() {
//Verify visible status
setVisible(getWicketSession().isUserLoggedIn());
}
}
This works fine, but is it the correct way of doing this?
Some comments on it could really help.
f(t)
-------------------------------------------------------------------------
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
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user