On 9/15/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
Sorry that it comes across as resistance, I tend to keep on asking
questions when I don't understand it. And when I don't understand it
than I'm probably a little bit resistance to change it.

i was just tired, it was way too far into the am :)

Please correct me if I'm wrong but in your example Class c ==
this.getClass () (== BeanSection.class) and id is equal to getId(),
provided we make sure the id is in the Component constructor before
getAlternateParent() is called. That should be possible to guaranty.

no, c is passed into the method - it is the class of the child that is being added. the idea is that based on the class of the child you add a different middleman panel. because textareas need to be attached to <textarea> and textfields, others to <input with the proper type.

getAlternateParent(Class childClass, String childId)

-Igor

 

Juergen


On 9/15/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> argh! i was laying down with my eyes closed thinking about this and couldnt
> fall asleep!
>
> i remember the usecase better now
>
> basically i had a section border for my bean panel. when a form component
> was added to the border i needed to insert a panel in between so the form
> component would have the appropriate markup to attach to such as <input or
> <textarea
>
> so it might look something like this:
>
> getAlternateParent(Class c, String id) {
>   if (c instanceof FormComponent) {
>         if (c instanceof TextArea) {
>            return new TextAreaPanel(this, "input");
>         } else if (c instanceof .... ) {
>              return new InputPanel(this, "input");
>         }
>     } else return this;
> }
>
> inputpanel is <input wicket:id="component"> textarepanel is <textarea
> wicket:id="component">
>
> and outside code can now look like this
>
> sec=new BeanSection(...);
> new TextField(sec, "component"); or new TextArea(sec, "component") and it
> all works automagically
>
> -Igor
>
>
>
>
>
> On 9/15/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> >
> > yes, i understand these are two different usecases, and we do need them
> both. the reparenting we can save for later or for another thread
> altogether. i have been thinking about this interface for a long time, here
> is a note i keep for myself in gmail
> >
> > have some IParentLocator { Component getTrueParent(); } interface that
> components implement. if the parent component implements that interface the
> true parent will be used instead of the specified parent.
> >
> > its from Feb 26, 2006 12:06 AM, so i have been thinking about this for a
> while :) the main thing i was waiting on is the markup refactor you just
> did. since feb  i have hit a lot of usecases where it would be nice to know
> a bit more information, mainly they center around embedding wicket:body
> components into someting else thats in the border, search this thread for
> IParentResolver to see the exact def of the usecase.
> >
> > getAlternateParent(Class childClass, String childId)
> >
> > the id here is only to make figuring out if this parent should be routed
> or not easier. you do if (border!=null) route() else dontroute(). now if you
> have more then one child there are a couple of options you can use to toggle
> routing, and one of them might be to check the list of predefined ids you
> have. whether that is useful or not i dont know, but there is no reason not
> to have it. i would rather have it in the interface now rather then add it
> later.
> >
> > now the class param is useful if you have two or more alternate parents
> and you need to route based on component type. i dont remember the exact
> usecase details but i hit it while trying to build a bean panel, so its not
> trivial.
> >
> > out of curiosity, why so much resistance to adding those two params? as
> you can see in my first thoughts i also just had a getTrueParent(), but i
> dont think its practical.
> >
> >
> > -Igor
> >
> >
> > On 9/15/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
> >
> > > Are you sure the border page use case and the ones you encountered are
> > > similar in nature? I know we talked about re-parenting etc. but I
> > > think it is different as we don't allow to re-parent, we just provide
> > > an alternate parent to the components constructor and there is only
> > > one point in time when the getAlternateParent() is called and that is
> > > when the component determines its parent.
> > >
> > > Juergen
> > >
> > > On 9/15/06, Igor Vaynberg < [EMAIL PROTECTED] > wrote:
> > > > it works for this _very_ simple usecase. some usecases ive hit
> recently that
> > > > i wanted to implement but couldnt were a bit more complex and you
> really
> > > > need to know more about what you are working on. now that i think
> about it,
> > > > model is really not needed. i think getAlternateParent(Class clazz,
> String
> > > > id) should be enough.
> > > >
> > > > -Igor
> > > >
> > > >
> > > >
> > > > On 9/15/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote:
> > > > > On 9/15/06, Igor Vaynberg < [EMAIL PROTECTED] > wrote:
> > > > > > this is exactly the interface i described earlier in this thread,
> and
> > > > yeah
> > > > > > it will work for this usecase as well even though i explained
> another
> > > > one.
> > > > > >
> > > > > > you just have to be careful to provide the page as the parent when
> the
> > > > > > border component itself is added - but you can do that by checking
> the
> > > > id.
> > > > > >
> > > > >
> > > > > The I implemented it the return value of getAlternateParent() must
> > > > > never be null. You must either return the border or the page, if the
> > > > > border == null. This was necessary as HtmlHeaderContainer and
> > > > > HtmlBoldyContainer are added prior to the border as well.
> > > > >
> > > > > > so the interface would actually need to have
> getAlernateParent(Component
> > > > c);
> > > > > > so you can be selective - which also means we need to set the id
> before
> > > > the
> > > > > > parent. this is where the danger comes in - getAlternateParent is
> > > > dealing
> > > > > > with an uninitialized component object. so maybe
> getAlternatePrent(Class
> > > > > > clazz, String id, IModel model) would be better because those 3
> things
> > > > we
> > > > > > know upfront and they are safe to touch.
> > > > >
> > > > > I haven't understood yet why we need to be selective. Why doesn't
> > > > >
> > > > > MarkupContainer getAlternateParent()
> > > > > {
> > > > >     return (this.border == null ? this : this.border);
> > > > > }
> > > > >
> > > > > work? It seems to work fine in the current code base.
> > > > >
> > > > > Juergen
> > > > >
> > > > > >
> > > > > > -Igor
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 9/14/06, Juergen Donnerstag < [EMAIL PROTECTED]>
> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 9/14/06, Juergen Donnerstag < [EMAIL PROTECTED] >
> wrote:
> > > > > >
> > > > > > > While starting to removing the bordered page code pieces it came
> to me
> > > > > > > that an Interface such as
> > > > > > >
> > > > > > > interface IAlternateParentProvider
> > > > > > > {
> > > > > > >    MarkupContainer getAlternateParent()
> > > > > > > }
> > > > > > >
> > > > > > > could do the trick in 2.0 if in Container.<init> we do
> > > > > > >
> > > > > > > if (parent instanceof IAlternateParentProvider)
> > > > > > > {
> > > > > > >    this.parent = ((IAlternateParentProvider)
> parent).getParent();
> > > > > > > }
> > > > > > > else
> > > > > > > {
> > > > > > >    this.parent = parent;
> > > > > > > }
> > > > > > >
> > > > > > > The outcome is that your bordered page needs to implement the
> > > > > > > interface, you provide the border component, and that's it. Any
> > > > > > > component create in Page will be added to border instead. It is
> > > > > > > non-intrusive and to me it is much more intuitive as well
> compared to
> > > > > > > border.setTransparent().
> > > > > > >
> > > > > > > Juergen
> > > > > > >
> > > > > > > On 9/14/06, Eelco Hillenius < [EMAIL PROTECTED]> wrote:
> > > > > > > > On 9/14/06, Juergen Donnerstag < [EMAIL PROTECTED] >
> > > > wrote:
> > > > > > > > > Some more food for thought or what we should support and
> what not.
> > > > > > > > >
> > > > > > > > > Transparent containers allow you to add a component to the
> > > > transparent
> > > > > > > > > container and the markup is expected to be in the
> transparent
> > > > > > > > > containers parent. Thats why it is called transparent. I'm
> fine
> > > > with
> > > > > > > > > this use case and I think we should support it.
> > > > > > > > >
> > > > > > > > > In contrast with a bordered page you add the component to a
> > > > container
> > > > > > > > > (e.g. Page) and the markup can be found in any transparent
> > > > container
> > > > > > > > > which is also a child of Page. In order to find the markup
> for the
> > > > > > > > > component you hence must scan the Pages markup file the
> components
> > > > > > > > > markup as well as the markup associated with all transparent
> > > > > > > > > containers also add to Page. This use case ( e.g. bordered
> pages),
> > > > IMHO
> > > > > > > > > we shouldn't support.
> > > > > > > > >
> > > > > > > > > I currently believe there is too much magic involved in the
> latter
> > > > use
> > > > > > > > > case and as already mentioned you'll find quite some clunky
> code
> > > > in
> > > > > > > > > the code base already to just support that use case. I'd
> much try
> > > > to
> > > > > > > > > stay as close as possible to the 1:1 mapping of component
> > > > hierarchy
> > > > > > > > > and markup hierarchy.
> > > > > > > >
> > > > > > > > +1
> > > > > > > >
> > > > > > > > Eelco
> > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> -------------------------------------------------------------------------
> > > > > > > > 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-develop mailing list
> > > > > > > > Wicket-develop@lists.sourceforge.net
> > > > > > > >
> > > > > >
> > > >
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > >
> -------------------------------------------------------------------------
> > > > > > > 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-develop mailing list
> > > > > > > Wicket-develop@lists.sourceforge.net
> > > > > > >
> > > > > >
> > > >
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > >
> -------------------------------------------------------------------------
> > > > > > 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-develop mailing list
> > > > > > Wicket-develop@lists.sourceforge.net
> > > > > >
> > > >
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> -------------------------------------------------------------------------
> > > > > 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-develop mailing list
> > > > > Wicket-develop@lists.sourceforge.net
> > > > >
> > > >
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
> > > > >
> > > >
> > > >
> > > >
> -------------------------------------------------------------------------
> > > > 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-develop mailing list
> > > > Wicket-develop@lists.sourceforge.net
> > > >
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
> > > >
> > > >
> > > >
> > >
> > >
> -------------------------------------------------------------------------
> > > 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-develop mailing list
> > > Wicket-develop@lists.sourceforge.net
> > >
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
> > >
> >
> >
>
>
> -------------------------------------------------------------------------
> 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-develop mailing list
> Wicket-develop@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
>
>
>

-------------------------------------------------------------------------
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-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop

-------------------------------------------------------------------------
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-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to