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]

Reply via email to