marioosh.net wrote:
>
> I have LoginPanel like below:
>
> public class LoginPanel extends Panel {
>
> public LoginPanel(String id) {
> super(id);
>
> MySession.get().setLoginPanel(this);
> this.setOutputMarkupId(true);
>
> if(MySession.get().getUser() != null) {
> add(new LoggedPanel("panel"));
> } else {
> add(new LoggedOutPanel("panel"));
> }
> }
> }
>
> I have save in MySession reference to this panel.
>
> public final class MySession extends WebSession {
>
> private Tuser user;
> private LoginPanel loginPanel;
>
> public LoginPanel getLoginPanel() {
> return loginPanel;
> }
>
> public void setLoginPanel(LoginPanel loginPanel) {
> this.loginPanel = loginPanel;
> }
>
> public static MySession get() {
> return (MySession)Session.get();
> }
> ...
> }
>
> Is possible to reload LoginPanel from inner panels: LoggedPanel and
> LoggedOutPanel ?
> I have do that like below, but it doesn't reload LoginPanel:
>
> public class LoggedOutPanel extends Panel {
> private final Tuser b = new Tuser();
>
> public LoggedOutPanel(String id) {
> super(id);
> ...
> AjaxSubmitLink ok = new AjaxSubmitLink("ok") {
> @Override
> protected void onSubmit(AjaxRequestTarget target,
> Form<?> form) {
>
> //ajax reload loginpanel
> LoginPanel lp = MySession.get().getLoginPanel();
> target.addComponent(lp);
>
> }
> };
> ...
> }
> }
>
>
> --
> Greetings,
> marioosh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
Idiscover that ajax in my example works! :) I need ONLY one hint:
Where and how do i have to put code to replacing LoggedPanel with
LoggedOutPanel and vice versa:
if(MySession.get().getUser() != null) {
//replace LoggedOutPanel with LoggedPanel
} else {
//replace LoggedPanel with LoggedOutPanel
}
I see that i can override onRender method in WebPage class...
Anybody help with that ?
--
View this message in context:
http://old.nabble.com/Ajax-refresh-outer-panel-tp27721145p27741408.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]