Passing it in the constructor works, but you would have to call
setOutputMarkupPlaceHolderTag(true) on the logout panel otherwise it won't
be in the dom before the user logs in, and therefore can't be updated. This
is also why toggling the css attribute with script client side won't work
with isVisible false on the wicket side. If you do it by toggling an inline
stylesheet, then leave isVisble true on the wicket side. This doesn't really
mesh with the wicket way, however.

Since these two components operate together I would enclose them in a panel
together, something like

class SessionPanel extends Panel {

public SessionPanel(String id) {
 add(new LogoutPanel("logout"));
 LoginPanel lp = new LoginPanel("lp");
 add(lp);
 lp.add(new AjaxSubmitButton("sb") {
             onSubmit(target) {
                 target.addComponent(SessionPanel.this);
            }
     });
}

}


best,

jim


That way you don't need to worry about what is in the client dom. But there
are a million other ways to do it :)
On 5/4/07, Francisco Diaz Trepat - gmail <[EMAIL PROTECTED]>
wrote:

Hello, I have two panels, one that is mostly a form for login (user/pass
+button) and the other panel is just a link (onClick==>logou).

Now I changed the button for the login form to an ajax button. Everythig
works fine.

The thing is that I had a code something like this in the logout panel.



@Override
public boolean isVisible(){
    return getMyWicketSession().isUserLoggedIn();
}

this code made every round trip evaluate whether the user was still logged
in and if so then render the appropriate option to logout.

how could I add to the target, the logout panel, do I need to pass it
through the constructor :


private final logoutPanel;
public LoginPanel(String id, LogoutPanel panel){
   logoutPanel = panel;

}

Ajax....onSubmit(target.......{
    target.add(logoutPanel)
}
??

Or could I just set in the constructor of the LogoutPanel
setOutputMarkupId(true) and then call on it from the onSubmit AJAX button?

I am a bit lost on this. Or could I just add a simple JavaScript "
document.getElementById('logoutPanel').style.visibility = "visible";

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
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