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