Discussion:
[T5] programmatically setting/getting @Property values
manuel aldana
2009-01-28 00:15:36 UTC
Permalink
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
***@gmx.de
software-engineering blog: http://www.aldana-online.de


---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tapestry.apache.org
For additional commands, e-mail: users-***@tapestry.apache.org
Thiago H. de Paula Figueiredo
2009-01-28 01:22:01 UTC
Permalink
Post by manuel aldana
hi,
Olá!
Post by manuel aldana
@Property is used, so setters/getters are generated in runtime. As an
example take PageLink, it is usually set through .tml file (with
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).
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-***@tapestry.apache.org
For additional commands, e-mail: users-***@tapestry.apache.org
Howard Lewis Ship
2009-01-28 00:21:39 UTC
Permalink
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.
Post by manuel aldana
hi,
@Property is used, so setters/getters are generated in runtime. As an
example take PageLink, it is usually set through .tml file (with
in a consise and short way?
--
manuel aldana
software-engineering blog: http://www.aldana-online.de
---------------------------------------------------------------------
--
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tapestry.apache.org
For additional commands, e-mail: users-***@tapestry.apache.org
manuel aldana
2009-01-28 00:34:08 UTC
Permalink
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.
Post by Howard Lewis Ship
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.
Post by manuel aldana
hi,
@Property is used, so setters/getters are generated in runtime. As an
example take PageLink, it is usually set through .tml file (with
in a consise and short way?
--
manuel aldana
software-engineering blog: http://www.aldana-online.de
---------------------------------------------------------------------
--
manuel aldana
***@gmx.de
software-engineering blog: http://www.aldana-online.de


---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tapestry.apache.org
For additional commands, e-mail: users-***@tapestry.apache.org
Howard Lewis Ship
2009-01-28 00:59:39 UTC
Permalink
<a href="${navLink}"> ... </a>

@Inject
private ComponentResources resources;


public Link getNavLink()
{
return resources.createPageLink("SomePage", false);
}
Post by manuel aldana
To give you some background why I would like to use to set the PageLink
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.
Post by Howard Lewis Ship
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.
Post by manuel aldana
hi,
@Property is used, so setters/getters are generated in runtime. As an
example take PageLink, it is usually set through .tml file (with
programmatically
in a consise and short way?
--
manuel aldana
software-engineering blog: http://www.aldana-online.de
---------------------------------------------------------------------
--
manuel aldana
software-engineering blog: http://www.aldana-online.de
---------------------------------------------------------------------
--
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tapestry.apache.org
For additional commands, e-mail: users-***@tapestry.apache.org
Loading...