You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "john (JIRA)" <ta...@jakarta.apache.org> on 2006/11/16 12:34:37 UTC
[jira] Commented: (TAPESTRY-1149) Initializing component parameters
using code (not via annotation).
[ http://issues.apache.org/jira/browse/TAPESTRY-1149?page=comments#action_12450357 ]
john commented on TAPESTRY-1149:
--------------------------------
If the parameter bindings are bi-directional, then maybe we can use the following:
@Inject
private ComponentResources resources;
@SetupRender // or BeforeRender
public void initComponents() {
resources.bind(echo, "value", "name");
}
or better yet, if JDK supports field(method) reference without reflection, we can use the following:
public void initComponents() {
resources.bind(echo.value.field, name.field);
resources.bind(echo.value.field, user.address.street.field);
resources.bind(echo.value.field, user.getAddress().street.field);
}
Anyway, it's more static type based and more code centric.
> Initializing component parameters using code (not via annotation).
> ------------------------------------------------------------------
>
> Key: TAPESTRY-1149
> URL: http://issues.apache.org/jira/browse/TAPESTRY-1149
> Project: Tapestry
> Issue Type: Improvement
> Affects Versions: 5.0
> Reporter: john
> Priority: Minor
>
> In tapestry 5, most things are done in codes and I like that approach. So naturally I want to pass parameters to components in codes.
> The parameters must be passed using attributes in html or in code like this:
> @ComponentClass
> public class Start {
> private String name = "john";
> @Component(parameters={"value=name"})
> private Echo echo;
> }
> I'd like to set parameters in code like following:
> @ComponentClass
> public class Start {
> private String name = "john";
> @Component
> private Echo echo;
> @SetupRender // or BeforeRender
> public void initComponents() {
> echo.setValue(name);
> }
> }
> It's more swing alike and has all the benefits of typed using like refactoring and static type check.
> Currently, Tapestry will complain that the required parameters not filled. I think move the required parameter checking AFTER the @SetupRender will work. But another issue is that it seems that you can't set parameter value using method like setValue.
> BTW, Wicket also uses this style of component parameter setting as I know.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org