On 2/1/07, Ryan <[EMAIL PROTECTED]> wrote:

You don't get off that easy. =)

What if login link parent is not the same parent as the login panel...
for instance like 5 levels deep where passing it through all the
constructors is highly undesirable.



you have to pass a reference somehow. if you do not want to pass it down the
constructor chain then you cannot use it inside component constructor - so
you have to delay it until render time.

interface ILoginPanelContainer { LoginPanel getLoginPanel() }

class mypage extends webpage implements iloginpanelcontainer {
 private final LoginPanel panel;

 public mypage() { panel=new }

 LoginPanel getLoginPanel() { return panel; }
}

class loginlink extends link {

  LoginPanel findLoginPanel() {

         iloginpanelprovider provider=null;
         Component ancestor=getParent();
         while (ancestor!=null) { if (ancestor isntanceof
iloginpanelprovider) { provider=ancestor; break; } }
         return provider.getloginpanel();
  }

  onclick() {
        panel=findloginpanel();
       //fooo
  }
}

-igor


Ryan

On 2/1/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> class mypage extends webpage {
>    public mypage() {
>           final Panel loginpanel=loginpanel=new LoginPanel(...);
>           add(loginpanel);
>
>           add(new LoginLink(..., loginpanel));
>           add(new LoginLink(..., loginpanel));
>    }
> }
>
> -igor
>
>
>
>
>
> On 2/1/07, Ryan <[EMAIL PROTECTED]> wrote:
> >
> > I am working on creating an "inline login link" that when clicked uses
> > javascript to present a previously hidden login form (if javascript is
> > disabled it will go to a login page). There will be several login
> > links on a single page so I would like to render the login form once
> > and have each link refer to the same form by id.
> >
> > What is a good strategy for only rendering the login form panel once
> > but allow links that live at many places in the render hierarchy to
> > refer to it? It seems like the main issue to solve is that at
> > construction time the hierarchy is not known so the link components
> > can not refer to its page and obtain a reference to the login panel.
> > Is there a clean way to design this?
> >
> > Thanks!
> >
> > Ryan
> >
> >
>
-------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services,
security?
> > Get stuff done quickly with pre-integrated technology to make your job
> easier.
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
> >
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
>
-------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services,
security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to