getBodyContainer() already exists

Juergen

On 10/9/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> we can add border.getBodyContainer() to make it easier to find the body
> container.
>
> a couple of notes on wicket 2.0 in general.
>
> because of constructor change and the need for IAlternateParentProvider you
> can no longer assume that
>
> Container c=new Container(...);
> Label l=new Label(c);
>
> l.getParent()==c
>
> that is simply the nature of the beast. if you need to get a hold of l after
> you added it to c later, then keep a reference, dont depend on the id.
>
> same thing is with models because of the way they wrap each other
>
> IModel model=getModel();
> Labe l=new Label();
> l.setModel(model);
>
> you cannot depend on
>
> model==l.getModel()
>
> because if model was assignment aware it wouldve generated a wrapper of
> itself in setModel() call.
>
> -Igor
>
>
>
>
> On 10/9/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
> >
> > On 10/9/06, Alberto Bueno <[EMAIL PROTECTED] > wrote:
> > > Yes, now the ways to find the child into the border are the ways that
> > > you say, but I think that the
> > > way would have to be transparent, like when we add a new child:
> > >
> > > TextField textfield = new TextField<String>(formBorder, "name",
> > > new PropertyModel<String>(
> > >               properties, "name"));
> > >
> >
> > not quite. Remember that in case of FormBorder you  must call
> > Border.setBorderBodyContainer(parent). Hence, it is not completely
> > transparent.
> >
> > > In that case, I really don't know where the textfield is added.
> >
> > call Component.getPath()
> >
> > >Only
> > > internally the textfield is added in the body container.
> > > For the same reason, when I want to search a child, I don't have to know
> > > where is exactly this child...
> > > I think that in this case, I only have to know that the textfield has
> been
> > > added in a formborder, and I have to go to search this field in the
> formBorder.
> > > In this case, the get() method of the formBorder have to know internally
> where is the
> > > children, depending of the body container.
> > >
> > > I think this is a good idea to implement for components that implements
> IAlternateParent...
> > >
> >
> > You see the nasty point about this is that we would have to maintain
> > two parent per component. The real one and the user one.
> > Give me some time to think about it.
> >
> > Juergen
> >
> > >
> > >
> > >
> > >
> > > > Because FormBorder puts a <form> _around_ the wicket:body tag, the
> > > > "name" component gets added to the body container. The body container
> > > > id is border.getId() + "Body". Hence
> > > > get(" border.form.borderBody.name") or
> > > > border.getBodyContainer().get("name") or
> > > > formBorder.get("borderBody.name")
> > > >
> > > > Juergen
> > > >
> > > > On 10/9/06, Alberto Bueno < [EMAIL PROTECTED]> wrote:
> > > >
> > > >> Hi Juergen Donnerstag
> > > >>
> > > >> Thanks for you patience. ;)
> > > >>
> > > >> The problem has been fixed with the changes that we have added to the
> > > >> trunk.
> > > >> Now I have another question.
> > > >> In the example BoxBorderTextPage_7 we add a TextField in the
> FormBorder.
> > > >> After that,
> > > >> If I want to find this component into the FormBorder component, I
> cannot
> > > >> find it.
> > > >>
> > > >>    public BoxBorderTestPage_7()
> > > >>    {
> > > >>        Border formBorder = new FormBorder(this, "border");
> > > >>
> > > >>        TextField textfield = new TextField<String>(formBorder,
> "name",
> > > >> new PropertyModel<String>(
> > > >>                properties, "name"));
> > > >>
> > > >>        Component c = formBorder.get("name");
> > > >>
> > > >>        // Test setVisible on formBorders
> > > >>        textfield.setVisible(false);
> > > >>
> > > >>        new Link(this, "link")
> > > >>        {
> > > >>            private static final long serialVersionUID = 1L;
> > > >>
> > > >>            @Override
> > > >>            public void onClick()
> > > >>            {
> > > >>                String p = "";
> > > >>            }
> > > >>        };
> > > >>    }
> > > >>
> > > >> The line Component c = formBorder.get("name"); has been added in the
> > > >> example, and return null.
> > > >> Is correct this result, or the get() method should return the
> TextField
> > > >> component?
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>> I extened BoxBorderTestPage_7 to click the link and to validate the
> > > >>> output of the second render as well. The problem should be fixed.
> > > >>>
> > > >>> Juergen
> > > >>>
> > > >>> On 10/7/06, Alberto Bueno <[EMAIL PROTECTED]> wrote:
> > > >>>
> > > >>>
> > > >>>> Hi Juergen Donnerstag,
> > > >>>>
> > > >>>> The example BoxBorderTestPage_7 runs correctly because you only
> render
> > > >>>> the page only one time. The problem is if
> > > >>>> you have to reload the page again, because TextField has been
> removed in
> > > >>>> the first rendering and the markup
> > > >>>> doesn't find this component in the second rendering.
> > > >>>> I don't know how to simulate the situation in a test case, but if
> you
> > > >>>> check the example that I wrote,
> > > >>>> you will see the problem:
> > > >>>>
> > > >>>> MyBorderPage.html
> > > >>>>
> > > >>>> <div wicket:id="border">
> > > >>>> <label wicket:id="span">
> > > >>>> test
> > > >>>> </label>
> > > >>>> </div>
> > > >>>> <a wicket:id="link">link</a>
> > > >>>>
> > > >>>>
> > > >>>> MyBorderPage.java
> > > >>>>
> > > >>>> FormBorder border = new FormBorder(this, "border");
> > > >>>>
> > > >>>> Label span = new Label(border, "span","testt");
> > > >>>> span.setVisible(false);
> > > >>>>
> > > >>>> new Link(this, "link"){
> > > >>>>
> > > >>>> @Override
> > > >>>> public void onClick() {
> > > >>>> String p ="";
> > > >>>>
> > > >>>> }
> > > >>>>
> > > >>>> };
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>> I've copied BoxBorderTestPage_3 into BoxBorderTestPage_7 and made
> the
> > > >>>>> change you suggested. It is working properly. The textield is no
> > > >>>>> longer printed.
> > > >>>>>
> > > >>>>> Juergen
> > > >>>>>
> > > >>>>> On 10/6/06, Alberto Bueno < [EMAIL PROTECTED]> wrote:
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>> you have the the test case:
> > > >>>>>>
> > > >>>>>> public class BoxBorderTestPage_3 extends WebPage
> > > >>>>>> {
> > > >>>>>>     private static final long serialVersionUID = 1L;
> > > >>>>>>
> > > >>>>>>     private final ValueMap properties = new ValueMap();
> > > >>>>>>
> > > >>>>>>     /**
> > > >>>>>>      * Construct.
> > > >>>>>>      *
> > > >>>>>>      *
> > > >>>>>>      */
> > > >>>>>>     public BoxBorderTestPage_3()
> > > >>>>>>     {
> > > >>>>>>         Border formBorder = new FormBorder(this, "border");
> > > >>>>>>
> > > >>>>>>        new TextField<String>(formBorder, "name", new
> > > >>>>>> PropertyModel<String>(properties, "name"));
> > > >>>>>>     }
> > > >>>>>> }
> > > >>>>>>
> > > >>>>>> That runs correctly.
> > > >>>>>>
> > > >>>>>> But if you change TextField component to setVisible(false):
> > > >>>>>>
> > > >>>>>>         TextField textfield = new TextField<String>(formBorder,
> "name",
> > > >>>>>> new PropertyModel<String>(properties, "name"));
> > > >>>>>>         textfield.setVisible(false);
> > > >>>>>>
> > > >>>>>> Then the case has an error, because in the
> > > >>>>>> DiffUtil.validatePage (document, this.getClass(), filename) the
> component
> > > >>>>>> doesn't exists.
> > > >>>>>> (Because has been removed by the page when it check if the
> autocomponent
> > > >>>>>> contain not visible component to remove).
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>> This is V2 svn trunk? Could you please create a test case (see
> > > >>>>>>> src/test) for me which makes is much easier to follow up. Thanks
> > > >>>>>>>
> > > >>>>>>> Juergen
> > > >>>>>>>
> > > >>>>>>> On 10/6/06, Alberto Bueno < [EMAIL PROTECTED]> wrote:
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>> Hi,
> > > >>>>>>>>
> > > >>>>>>>> the problem is when I want to add in a FormBorder a component
> with
> > > >>>>>>>> setVisible(false), because  this component
> > > >>>>>>>> is removed in the first rendering, and in the next rendering
> the
> > > >>>>>>>> component is not found.
> > > >>>>>>>> This is a simple example:
> > > >>>>>>>>
> > > >>>>>>>> MyBorderPage.html
> > > >>>>>>>>
> > > >>>>>>>> <div wicket:id="border">
> > > >>>>>>>>               <label wicket:id="span">
> > > >>>>>>>>                   test
> > > >>>>>>>>            </label>
> > > >>>>>>>> </div>
> > > >>>>>>>> <a wicket:id="link">link</a>
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>> MyBorderPage.java
> > > >>>>>>>>
> > > >>>>>>>> FormBorder border = new FormBorder(this, "border");
> > > >>>>>>>>
> > > >>>>>>>>        Label span = new Label(border, "span","testt");
> > > >>>>>>>>        span.setVisible(false);
> > > >>>>>>>>
> > > >>>>>>>>        new Link(this, "link"){
> > > >>>>>>>>
> > > >>>>>>>>            @Override
> > > >>>>>>>>            public void onClick() {
> > > >>>>>>>>                String p ="";
> > > >>>>>>>>
> > > >>>>>>>>            }
> > > >>>>>>>>
> > > >>>>>>>>        };
> > > >>>>>>>>
> > > >>>>>>>> When I click the link, I have the error:
> > > >>>>>>>>
> > > >>>>>>>> Unable to find component with id 'span' in [MarkupContainer
> > > >>>>>>>> [Component id = <auto>-body, page =
> com.isencia.paging.wicket.MyBorderPage,
> > > >>>>>>>> path = 8:border:myForm:<auto>-body.Border$BorderBody ,
> isVisible = true,
> > > >>>>>>>> isVersioned = true]].
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>> Do you know any solution to solve this problem, or is a bug?
> > > >>>>>>>>
> > > >>>>>>>> Thanks
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>>
> -------------------------------------------------------------------------
> > > >>>>>>>> Take Surveys. Earn Cash. Influence the Future of IT
> > > >>>>>>>> Join SourceForge.net's Techsay panel and you'll get the chance
> to share your
> > > >>>>>>>> opinions on IT & business topics through brief surveys -- and
> earn cash
> > > >>>>>>>>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > >>>>>>>>
> _______________________________________________
> > > >>>>>>>> Wicket-user mailing list
> > > >>>>>>>> [email protected]
> > > >>>>>>>>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>>
> > > >>>>>>>
> -------------------------------------------------------------------------
> > > >>>>>>> Take Surveys. Earn Cash. Influence the Future of IT
> > > >>>>>>> Join SourceForge.net's Techsay panel and you'll get the chance
> to share your
> > > >>>>>>> opinions on IT & business topics through brief surveys -- and
> earn cash
> > > >>>>>>>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > >>>>>>> _______________________________________________
> > > >>>>>>> Wicket-user mailing list
> > > >>>>>>> [email protected]
> > > >>>>>>>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>>
> > > >>>>>>
> -------------------------------------------------------------------------
> > > >>>>>> Take Surveys. Earn Cash. Influence the Future of IT
> > > >>>>>> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> > > >>>>>> opinions on IT & business topics through brief surveys -- and
> earn cash
> > > >>>>>>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > >>>>>> _______________________________________________
> > > >>>>>> Wicket-user mailing list
> > > >>>>>> [email protected]
> > > >>>>>>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>
> -------------------------------------------------------------------------
> > > >>>>> Take Surveys. Earn Cash. Influence the Future of IT
> > > >>>>> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> > > >>>>> opinions on IT & business topics through brief surveys -- and earn
> cash
> > > >>>>>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > >>>>> _______________________________________________
> > > >>>>> Wicket-user mailing list
> > > >>>>> [email protected]
> > > >>>>>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>
> -------------------------------------------------------------------------
> > > >>>> Take Surveys. Earn Cash. Influence the Future of IT
> > > >>>> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> > > >>>> opinions on IT & business topics through brief surveys -- and earn
> cash
> > > >>>>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > >>>> _______________________________________________
> > > >>>> Wicket-user mailing list
> > > >>>> [email protected]
> > > >>>>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>
> -------------------------------------------------------------------------
> > > >>> Take Surveys. Earn Cash. Influence the Future of IT
> > > >>> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> > > >>> opinions on IT & business topics through brief surveys -- and earn
> cash
> > > >>>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > >>> _______________________________________________
> > > >>> Wicket-user mailing list
> > > >>> [email protected]
> > > >>>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >>>
> > > >>>
> > > >>
> -------------------------------------------------------------------------
> > > >> Take Surveys. Earn Cash. Influence the Future of IT
> > > >> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> > > >> opinions on IT & business topics through brief surveys -- and earn
> cash
> > > >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > >> _______________________________________________
> > > >> Wicket-user mailing list
> > > >> [email protected]
> > > >>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >>
> > > >>
> > > >
> > > >
> -------------------------------------------------------------------------
> > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> > > > opinions on IT & business topics through brief surveys -- and earn
> cash
> > > >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > > _______________________________________________
> > > > Wicket-user mailing list
> > > > [email protected]
> > > >
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >
> > >
> > >
> > >
> -------------------------------------------------------------------------
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> > > opinions on IT & business topics through brief surveys -- and earn cash
> > >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > _______________________________________________
> > > Wicket-user mailing list
> > > [email protected]
> > >
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> >
> -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> > opinions on IT & business topics through brief surveys -- and earn cash
> >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to