You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by manuel aldana <al...@gmx.de> on 2009/01/28 01:15:36 UTC
[T5] programmatically setting/getting @Property values
hi,
@Property is used, so setters/getters are generated in runtime. As an
example take PageLink, it is usually set through .tml file (with
t:page="xxx"). How is it possible to set @Property fields
programmatically in a consise and short way?
Or is it always better to use .tml templates for setting @Property fields?
--
manuel aldana
aldana@gmx.de
software-engineering blog: http://www.aldana-online.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] programmatically setting/getting @Property values
Posted by Howard Lewis Ship <hl...@gmail.com>.
<a href="${navLink}"> ... </a>
@Inject
private ComponentResources resources;
public Link getNavLink()
{
return resources.createPageLink("SomePage", false);
}
On Tue, Jan 27, 2009 at 4:34 PM, manuel aldana <al...@gmx.de> wrote:
> To give you some background why I would like to use to set the PageLink
> component programmatically:
>
> In a navigation-component (which is built up dynamically) I want to refer to
> a main-content page. For that I'd like reuse the PageLink component, so I
> can use tapestry facilities for link creation. So far the
> navigation-component worked without template, so don't want to create a
> template for just passing a PageLink component.
>
>
> Howard Lewis Ship schrieb:
>>
>> I think you are asking two different things.
>>
>> You can use the PropertyConduit service to create PropertyConduit
>> instances; these allow you to dynamically read and update an
>> expression on any object; it doesn't even have to be a component.
>>
>> So propertyConduitSource.create(foo.getClass(), "stuff").set(foo,
>> "mojo") will create a PC for the "stuff" property and update it.
>>
>> On Tue, Jan 27, 2009 at 4:15 PM, manuel aldana <al...@gmx.de> wrote:
>>
>>>
>>> hi,
>>>
>>> @Property is used, so setters/getters are generated in runtime. As an
>>> example take PageLink, it is usually set through .tml file (with
>>> t:page="xxx"). How is it possible to set @Property fields
>>> programmatically
>>> in a consise and short way?
>>>
>>> Or is it always better to use .tml templates for setting @Property
>>> fields?
>>>
>>> --
>>> manuel aldana
>>> aldana@gmx.de
>>> software-engineering blog: http://www.aldana-online.de
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>>
>>
>>
>
>
> --
> manuel aldana
> aldana@gmx.de
> software-engineering blog: http://www.aldana-online.de
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] programmatically setting/getting @Property values
Posted by manuel aldana <al...@gmx.de>.
To give you some background why I would like to use to set the PageLink
component programmatically:
In a navigation-component (which is built up dynamically) I want to
refer to a main-content page. For that I'd like reuse the PageLink
component, so I can use tapestry facilities for link creation. So far
the navigation-component worked without template, so don't want to
create a template for just passing a PageLink component.
Howard Lewis Ship schrieb:
> I think you are asking two different things.
>
> You can use the PropertyConduit service to create PropertyConduit
> instances; these allow you to dynamically read and update an
> expression on any object; it doesn't even have to be a component.
>
> So propertyConduitSource.create(foo.getClass(), "stuff").set(foo,
> "mojo") will create a PC for the "stuff" property and update it.
>
> On Tue, Jan 27, 2009 at 4:15 PM, manuel aldana <al...@gmx.de> wrote:
>
>> hi,
>>
>> @Property is used, so setters/getters are generated in runtime. As an
>> example take PageLink, it is usually set through .tml file (with
>> t:page="xxx"). How is it possible to set @Property fields programmatically
>> in a consise and short way?
>>
>> Or is it always better to use .tml templates for setting @Property fields?
>>
>> --
>> manuel aldana
>> aldana@gmx.de
>> software-engineering blog: http://www.aldana-online.de
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
>
>
--
manuel aldana
aldana@gmx.de
software-engineering blog: http://www.aldana-online.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] programmatically setting/getting @Property values
Posted by Howard Lewis Ship <hl...@gmail.com>.
I think you are asking two different things.
You can use the PropertyConduit service to create PropertyConduit
instances; these allow you to dynamically read and update an
expression on any object; it doesn't even have to be a component.
So propertyConduitSource.create(foo.getClass(), "stuff").set(foo,
"mojo") will create a PC for the "stuff" property and update it.
On Tue, Jan 27, 2009 at 4:15 PM, manuel aldana <al...@gmx.de> wrote:
> hi,
>
> @Property is used, so setters/getters are generated in runtime. As an
> example take PageLink, it is usually set through .tml file (with
> t:page="xxx"). How is it possible to set @Property fields programmatically
> in a consise and short way?
>
> Or is it always better to use .tml templates for setting @Property fields?
>
> --
> manuel aldana
> aldana@gmx.de
> software-engineering blog: http://www.aldana-online.de
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] programmatically setting/getting @Property values
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 27 Jan 2009 21:15:36 -0300, manuel aldana <al...@gmx.de> escreveu:
> hi,
Olá!
> @Property is used, so setters/getters are generated in runtime. As an
> example take PageLink, it is usually set through .tml file (with
> t:page="xxx"). How is it possible to set @Property fields
> programmatically in a consise and short way?
As far as I know, it is not possible to programatically set or get
@Property fields, only access them from bindings (don't forget that using
a ${property} in a template is using the prop binding).
> Or is it always better to use .tml templates for setting @Property
> fields?
It is not a good practice to have templates changing the state of page
classes and components unless it is something like setting a Grid row or
index or a Loop value or index.
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org