> Is there any way to get component > instance by its name even if this component is not used in any other page?
The short answer is no. I don't remember the long answer off hand... -- Josh On Sep 18, 2010, at 5:41 AM, Anton Mezerny <anton.meze...@gmail.com> wrote: > Looking on ComponentSource code I understood, that it gets only components, > that are already defined within some page. Is there any way to get component > instance by its name even if this component is not used in any other page? > > 2010/9/18 Anton Mezerny <anton.meze...@gmail.com> > >> Igor, I am now trying to write something like in your book, but first of >> all I don't want to define blocks in one tml page, and a number or blocks in >> java-class. I try to get component instance dynamically using method >> componentSource.getComponent(String) >> but I have an exception on this method. >> >> >> org.apache.tapestry5.internal.services.RenderQueueException >> Render queue error in BeginRender[Step:dynamicformfield.delegate]: Failure >> reading parameter 'to' of component Step:dynamicformfield.delegate: Unable >> to resolve 'textfield' to a known page name. Available page names: (blank), >> About, Contact, ExceptionReport, Index, PropertyDisplayBlocks, >> PropertyEditBlocks, ServiceStatus, Step. >> >> I can't understand why Tapestry looks for pages and not components. So for >> example if I change method to componentSource.getPage("About"); everything >> renders fine - I get a number of About pages rendered inside my form. (About >> is one of pages defined in my application) >> >> >> 2010/9/18 Markus Feindler <markus.feind...@gmx.de> >> >> Why would you need a submit notifier? I checked out your book and it works >>> fine without one. >>> >>> What you need is a combination of Loop, Delegate, and SubmitNotifier >>>> components and a couple of blocks inside your template. Check this out: >>>> >>>> >>>> http://code.google.com/p/tapestrybook/source/browse/trunk/tapestry-dynamic-forms/src/main/webapp/ViewReport.tml >>>> >>>> http://code.google.com/p/tapestrybook/source/browse/trunk/tapestry-dynamic-forms/src/main/java/de/t5book/pages/ViewReport.java >>>> >>>> On Sat, Sep 18, 2010 at 12:03 AM, Антон Мезерный<anton.meze...@gmail.com >>>>> wrote: >>>> >>>> >>>> >>>>> And what is the best way to create such a dynamic form? Using Delegate >>>>> component or modifying beaneditform? Or maybe there is better approach? >>>>> >>>>> I tried to write it using Delegate and I have a problem - I can't get >>>>> component instance from ComponentSource - Exception: >>>>> >>>>> org.apache.tapestry5.internal.services.RenderQueueException >>>>> Render queue error in BeginRender[Step:dynamicformfield.delegate]: >>>>> Failure >>>>> reading parameter 'to' of component Step:dynamicformfield.delegate: >>>>> Unable >>>>> to resolve 'textfield' to a known page name. Available page names: >>>>> (blank), >>>>> About, Contact, ExceptionReport, Index, PropertyDisplayBlocks, >>>>> PropertyEditBlocks, ServiceStatus, Step. >>>>> >>>>> Why is it looking for a page, not component? >>>>> >>>>> 2010/9/17 Thiago H. de Paula Figueiredo<thiag...@gmail.com> >>>>> >>>>> >>>>> >>>>>> On Thu, 16 Sep 2010 19:09:05 -0300, Антон Мезерный< >>>>>> anton.meze...@gmail.com> wrote: >>>>>> >>>>>> Hello, >>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>> Hi! >>>>>> >>>>>> >>>>>> I am trying to make a dynamic form component, something like >>>>>> >>>>>> >>>>> beaneditform, >>>>> >>>>> >>>>>> but based not on bean field type, but on some property in database. >>>>>>> >>>>>>> >>>>>>> >>>>>> I strongly advise you to read the BeanEditor sources and do something >>>>>> similar or, better yet, contribute viewing and edition blocks. The end >>>>>> of >>>>>> this page shows you how to add blocks: >>>>>> http://tapestry.apache.org/tapestry5.1/guide/beaneditform.html. >>>>>> Besides >>>>>> that, create one of more DataTypeAnalyzer and contribute them to the >>>>>> DataTypeAnalyzer service. See >>>>>> >>>>>> http://tapestry.1045711.n5.nabble.com/Custom-Edit-Block-td2427355.htmlfor >>>>>> a little more detail. >>>>>> >>>>>> >>>>>> Another words I want to create something like >>>>>> >>>>>> >>>>>>> <t:${componentNameFromDB} ...> >>>>>>> >>>>>>> >>>>>>> >>>>>> Short answer: you can't. Tapestry pages and components have stricly >>>>>> >>>>>> >>>>> static >>>>> >>>>> >>>>>> structure. >>>>>> Long answer: you can use blocks (<t:block>) and the Delegate component >>>>>> to >>>>>> render blocks or components dynamically. >>>>>> >>>>>> >>>>>> I tried to use delegate component, but as I understood, I should >>>>>> define >>>>>> >>>>>> >>>>>>> all my components (inputs and other) inside one tml-page in block tags >>>>>>> >>>>>>> >>>>>> and >>>>> >>>>> >>>>>> >>>>>>> >>>>>> Not necessarily in a single page. >>>>>> >>>>>> >>>>>> create block instances in java code. Can I do that with separate >>>>>> >>>>>> >>>>>>> components for every element in the form? >>>>>>> >>>>>>> >>>>>>> >>>>>> Yes. >>>>>> >>>>>> >>>>>> What is the best way to achieve it? >>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>> ComponentSource will help you to grab page instances. >>>>>> >>>>>> -- >>>>>> Thiago H. de Paula Figueiredo >>>>>> Independent Java, Apache Tapestry 5 and Hibernate consultant, >>>>>> developer, >>>>>> and instructor >>>>>> Owner, Ars Machina Tecnologia da Informação Ltda. >>>>>> http://www.arsmachina.com.br >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org