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

Reply via email to