I know you mean I should use components but in what way ? I retracted the inheritance approache and replaced it with the switching<http://tapestry.apache.org/switching-cases.html>idea which is marvelous. This way I won't get into the messy "t:if" tree.
I'm trying to figure out *every possible way* of composing pages from components, that's why I asked you what do you mean :) And this way I'll learn more about components till hopefully reach the point when I say "Now I get it !" :) For example consider this case, what if I want to have the blocks in the switching example, to be in a separate .tml file ? Just to reduce the page's size and make it easier to maintain. Actually I can apply this idea to the common test fields part. It's a bean editor declaration in the page's .tml file: * <t:CommonTestDataBeanEditor t:id="commonTestDataEditor" object="commonTestData">* * <t:parameter name="prefix">* * <t:label for="**prefix**" />* * <t:textfield t:id="**prefix**" value="commonTestData.**prefix**"/>* * </t:parameter>* * </t:CommonTestDataBeanEditor>* Is it possible to get this bean-editor's declaration from another .tml file ? I tried extending the bean editor component, but I couldn't figure out what to put in the .tml file ! Can mixins fit in ? I'm all about trying everything and mastering this very flexible and nice framework, that's why I'm asking too many questions :) Thank you for your time :) On Wed, Sep 28, 2011 at 1:37 PM, Taha Hafeez <tawus.tapes...@gmail.com>wrote: > Use components :) > > > On Wed, Sep 28, 2011 at 5:03 PM, Muhammad Gelbana <m.gelb...@gmail.com> > wrote: > > Thank you Taha :) > > > > But what do you mean by "You can always re-factor your code by > composition." > > > > > > On Wed, Sep 28, 2011 at 1:11 PM, Taha Hafeez <tawus.tapes...@gmail.com > >wrote: > > > >> Hi Muhammad > >> > >> I don't think inheritance is the best approach with tapestry. You can > >> always re-factor your code by composition. Using components is always > >> a better approach. > >> > >> If you have a child page trying to access a component in parent page, > >> IMHO, you should reconsider your refactoring. > >> > >> On Wed, Sep 28, 2011 at 3:58 PM, Muhammad Gelbana <m.gelb...@gmail.com> > >> wrote: > >> > This is a new approach I'm taking to compose pages. I'm trying to > convert > >> an > >> > existing application to tapestry but one page turned out to be really > big > >> > and hard to maintain. This page has many form fields. Some fields > should > >> > always exists, and conditionally show other fields depending on a > >> condition, > >> > let's say a "test type". > >> > > >> > I used to do this in one page template, then conditionally showing the > >> > fields I want using the "t:if" component and a configured bean-editor > >> > inside. > >> > Then I decided to go more scalable so I decided to make a page for > each > >> > "test" and inherit the page with the common fields. This will release > me > >> for > >> > the messy "t:if" "p:else" tags all over the center of the page. > >> > > >> > Now I'm facing an issue that my parent page has injected components > >> > (@InjectComponent) and when displaying the child page, it complains: > >> > Component tests/DNSTest does not contain embedded component > >> 'gatewayField'. > >> > The "gatewayField" variable exists in the parent page as: > >> > @InjectComponent > >> > private TextField gatewayField > >> > > >> > ..and there are other fields. I tried adding @Property, and > >> getters\setters > >> > my self, still didn't work. It only worked when I commented these > fields > >> and > >> > code referring to them. > >> > > >> > How can I resolve this ? And is this the best approach to dynamically > >> > construct a page ? > >> > > >> > Thank you all for your time :) > >> > > >> > -- > >> > *Regards,* > >> > *Muhammad Gelbana > >> > Java Developer* > >> > > >> > >> > >> > >> -- > >> Regards > >> > >> Taha Hafeez Siddiqi (tawus) > >> http://tawus.wordpress.com > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >> For additional commands, e-mail: users-h...@tapestry.apache.org > >> > >> > > > > > > -- > > *Regards,* > > *Muhammad Gelbana > > Java Developer* > > > > > > -- > Regards > > Taha Hafeez Siddiqi (tawus) > http://tawus.wordpress.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- *Regards,* *Muhammad Gelbana Java Developer*