I think logic like this should be in the onsubmit handler because that what should logically trigger it: the form submit in the signin panel.
 
Having this in your onbeginrequest causes this logic to execute everytime the page is access which is not necessarily what you want.
 
Furthermore you dont need to create any interdependencies, you can navigate the structure in the onsubmit handler using ids:
 
ie
 
public final void onSubmit()
        {              
             Panel signin=getPage().get("path").get("to").get("signin");
             Panel info=getPage().get("path").get("to").get("info");
        }

-Igor

 
On 10/31/05, Dipu <[EMAIL PROTECTED]> wrote:
cool , thats lot better, thanks you for the tip.
 
Dipu
 
----- Original Message -----
From: "pepone pepone" <[EMAIL PROTECTED] >
Sent: Monday, October 31, 2005 12:38 PM
Subject: Re: [Wicket-user] refreshing page content

I think that my aproach is cleaner because you don't need to create a
dependecie between InfoPanel and LoginPanel

in your Page or Component

add(loginPanel=new LoginPanel("loginPanel"));
add(infoPanel=new InfoPanel("InfoPanel"));

overload this method to do the job

onBeginRequest()
{
   if(getSession.isSignedIn ())
  {
      infoPanel.setVisible(true);
      loginPanel.setVisible(false);
  }
   else
   {      infoPanel.setVisible(false);
           loginPanel.setVisible(true);
   }
}
On 10/31/05, Dipu <
[EMAIL PROTECTED]> wrote:
>
> Can't you send the reference of the respective panels to the form and switch
> visibility
>
> so i will have the following panels like given below
> WelcomePanel welcomePanel = new WelcomePanel("welcomePanel");
> add(welcomePanel);
> welcomePanel.setVisible(false);
>
> LoginPanel loginPanel = new
> LoginPanel("loginPanel",properties);
>
> LoginForm loginForm =new
> LoginForm("LoginForm",welcomePanel,loginPanel )
> add(loginForm );
>
>
> and do the following in the forms on submit
>
> public final void onSubmit()
>         {
>              if (authenticateUser("uname","password"))
>             {
>              this.loginPanel.setVisible(false);
>              this.welcomePanel.setVisible(true);
>             }
>             else
>             {
>                 // do something here
>             }
>         }
>
> I am not sure if this is the best way
>
> Dipu
>
> ----- Original Message -----
> From: "Dorel Vaida" <
[EMAIL PROTECTED]>
> To: <
wicket-user@lists.sourceforge.net>
>
> Sent: Monday, October 31, 2005 11:57 AM
> Subject: Re: [Wicket-user] refreshing page content
>
>
> > Dipu wrote:
> >
> >> you can do this by simply switching the visibility of the panels on
> >> and off in the onSubmit of your form.
> >> I tried it out and its working for me without any problems.
> >
> > Hmm, the thing is that in my case they are not on the same form, they
> > are on different panels. So there is a panel containing my form, and
> > below it, there is a panel containing the label. I can't put them in the
> > same form because they really belong to different components (in my case).
> >
> >>
> >> Dipu
> >>
> >>
> >> ----- Original Message -----
> >> From: "Dorel Vaida" <
[EMAIL PROTECTED]
> >> <mailto:[EMAIL PROTECTED] >>
> >> To: <
wicket-user@lists.sourceforge.net
> >> < mailto:wicket-user@lists.sourceforge.net>>
> >> Sent: Monday, October 31, 2005 9:43 AM
> >> Subject: [Wicket-user] refreshing page content
> >>
> >> > Hi guys,
> >> >
> >> > I have a small problem with refreshing the page content and I don't
> >> know
> >> > which is the best way to handle it.
> >> >
> >> > In short, I have a sign in panel to the left and after the user
> >> signs in
> >> > I'd like to set it to invisible and display a "Welcome" label in
> >> another
> >> > panel. The code is trivial, I just add to the page both the sign in
> >> > panel and the panel containing the label and I set their visibility to
> >> > true and false respectively based on session user is/is not null.
> >> >
> >> > What happens is that the signin panel/ welcome label remain the same
> >> > after signing in, until I reenter the page by the way of clicking on
> >> the
> >> > menu link which displays the page, but I'd like the refresh to be
> >> > performed right after submission. It's like the setVisible(true/false)
> >> > for both panels is not called until the next page rendering.
> >> >
> >> > Now I know I am missing something related to how components are
> >> rendered
> >> > inside the page or something, but maybe someone can give me a hint.
> >> >
> >> > thanks
> >> >
> >> >
> >> >
> -------------------------------------------------------
> >> > This SF.Net email is sponsored by the JBoss Inc.
> >> > Get Certified Today * Register for a JBoss Training Course
> >> > Free Certification Exam for All Training Attendees Through End of 2005
> >> > Visit
http://www.jboss.com/services/certification for
> more information
> >> > _______________________________________________
> >> > Wicket-user mailing list
> >> >
Wicket-user@lists.sourceforge.net
> >> <mailto:Wicket-user@lists.sourceforge.net >
> >> >
>
https://lists.sourceforge.net/lists/listinfo/wicket-user
> >> >
> >>
> >> __________ NOD32 1.1187 (20050805) Information __________
> >>
> >> This message was checked by NOD32 Antivirus System.
> >>
http://www.nod32.com
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by the JBoss Inc.
> > Get Certified Today * Register for a JBoss Training Course
> > Free Certification Exam for All Training Attendees Through End of 2005
> > Visit
http://www.jboss.com/services/certification for
> more information
> > _______________________________________________
> > Wicket-user mailing list
> >
Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit
http://www.jboss.com/services/certification for more information
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to