Re: dynamic components in page

2009-01-13 Thread lst-ara
Thanks for responses.

Using ajax  (via component "zone") is one of  possibly solutions. But,
ideally, i would like solve this without Java Script - ideally all
should be done on server side.

I try refine my question. My idea was something like this:

The component's "Index.tml"

... Some Boundary Begin ...
  
... Some Boundary End ...



public class Index {

@Inject
private ComponentFactory componentFactory; // or any other
service to obtaint component's instance, ComponentResources ...  ??

public Object getRequiredComponent() {

   String pathToComponent = getPathFromAnywhere();
AnyComponentClass componentInstance =
componentFactory.getOrLoadComponent(pathToComponent);   // or any other
way to obtain component's instance dynamically (without injection)
// do something with "componentInstance"
return componentInstance;
}
}

There could be more ways to obtain component's instance: using path,
using component class, ...  ??
This is idea only. I do not know if something  such this is possible.

As far as I know, the component source in template  (e.g. something like
this: ) is now reference to page
directly (or to field annotated as @Component(id = "COMPONENT_SOURCE")
... ) and there cannot be typed any expression (all typed here is
interpreted as component´s page link or ID, including brackets ${...}).

Radek Terber napsal(a):
> Hi
>
> Is there possibility to render components in T5 page "dynamically" (in
> dependency on return value of any method in page´s class for example, 
> or so) ?
> Methods "onEvent..." return pages whose are rendered "dynamically" too -
> each method can return many pages. I thing it would be possible allow
> dynamic including components similar way, but i am not able to do it.
>
> Thanks.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
>   



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



Re: dynamic components in page

2009-01-13 Thread Ulrich Stärk
Please look at the Delegate 
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Delegate.html 
component as Daniel suggested. In combination with blocks, this fits 
your problem (see the example, it does exactly what you want).


Also remember Tapestry's "static structure, dynamic behaviour" paradigm. 
You can't manipulate a page's structure at runtime, i.e. all components 
have to be defined on the page.


Cheers,

Uli

Radek Terber schrieb:

Thanks for responses.

Using ajax  (via component "zone") is one of  possibly solutions. But,
ideally, i would like to solve this without Java Script - ideally all
should be done on server side.

I try refine my question. My idea was something like this:

The component's "Index.tml"

... Some Boundary Begin ...
  
... Some Boundary End ...



public class Index {

@Inject
private ComponentFactory componentFactory; // or any other
service to obtaint component's instance, ComponentResources ...  ??

public Object getRequiredComponent() {

   String pathToComponent = getPathFromAnywhere();
AnyComponentClass componentInstance =
componentFactory.getOrLoadComponent(pathToComponent);   // or any other
way to obtain component's instance dynamically (without injection)
// do something with "componentInstance"
return componentInstance;
}
}

There could be more ways to obtain component's instance: using path,
using component class, ...  ??
This is idea only. I do not know if something  such this is possible.

As far as I know, the component source in template  (e.g. something like
this: ) is now reference to page
directly (or to field annotated as @Component(id = "COMPONENT_SOURCE")
... ) and there cannot be typed any expression (all typed here is
interpreted as component´s page link or ID, including brackets ${...}).

Radek Terber napsal(a):

Hi

Is there possibility to render components in T5 page "dynamically" (in
dependency on return value of any method in page´s class for example, 
or so) ?

Methods "onEvent..." return pages whose are rendered "dynamically" too -
each method can return many pages. I thing it would be possible allow
dynamic including components similar way, but i am not able to do it.

Thanks.

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


  




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




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



Re: dynamic components in page

2009-01-13 Thread Radek Terber
Thanks for responses.

Using ajax  (via component "zone") is one of  possibly solutions. But,
ideally, i would like to solve this without Java Script - ideally all
should be done on server side.

I try refine my question. My idea was something like this:

The component's "Index.tml"

... Some Boundary Begin ...
  
... Some Boundary End ...



public class Index {

@Inject
private ComponentFactory componentFactory; // or any other
service to obtaint component's instance, ComponentResources ...  ??

public Object getRequiredComponent() {

   String pathToComponent = getPathFromAnywhere();
AnyComponentClass componentInstance =
componentFactory.getOrLoadComponent(pathToComponent);   // or any other
way to obtain component's instance dynamically (without injection)
// do something with "componentInstance"
return componentInstance;
}
}

There could be more ways to obtain component's instance: using path,
using component class, ...  ??
This is idea only. I do not know if something  such this is possible.

As far as I know, the component source in template  (e.g. something like
this: ) is now reference to page
directly (or to field annotated as @Component(id = "COMPONENT_SOURCE")
... ) and there cannot be typed any expression (all typed here is
interpreted as component´s page link or ID, including brackets ${...}).

Radek Terber napsal(a):
> Hi
>
> Is there possibility to render components in T5 page "dynamically" (in
> dependency on return value of any method in page´s class for example, 
> or so) ?
> Methods "onEvent..." return pages whose are rendered "dynamically" too -
> each method can return many pages. I thing it would be possible allow
> dynamic including components similar way, but i am not able to do it.
>
> Thanks.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
>   



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



Re: dynamic components in page

2009-01-12 Thread Daniel Jue
Hi,

Your wording is a little vague.  You probably want to use the Block
component.  For pages from onEvent, they can be anything, and you can return
Strings or MyPage.class to get to the new page.  For components, you have to
list them in the source of your page class and/or page template.
When you stick them inside a  tag in your template, they are not
rendered until specified elsewhere.
The ChenilleKit Tab Panel is a good example of using this.

Also look at the Delegate component.
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Delegate.html

This is about as Dynamic as it gets, without a fair amount of
warranty-voiding magic.

"Static Structure, Dynamic Content"


2009/1/12 Radek Terber 

> Hi
>
> Is there possibility to render components in T5 page "dynamically" (in
> dependency on return value of any method in page´s class for example,
> or so) ?
> Methods "onEvent..." return pages whose are rendered "dynamically" too -
> each method can return many pages. I thing it would be possible allow
> dynamic including components similar way, but i am not able to do it.
>
> Thanks.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: dynamic components in page

2009-01-12 Thread Thiago H. de Paula Figueiredo
Em Mon, 12 Jan 2009 16:38:37 -0300, Radek Terber   
escreveu:



Hi


Hi!


Is there possibility to render components in T5 page "dynamically" (in
dependency on return value of any method in page´s class for example,
or so) ? Methods "onEvent..." return pages whose are rendered  
"dynamically" too -

each method can return many pages. I thing it would be possible allow
dynamic including components similar way, but i am not able to do it.


Take a look at the Zone component, maybe it is what you're:  
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html.  
There's way very nice example here:  
http://lombok.demon.co.uk/tapestry5Demo/test/core/zonedemoone.


--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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



Re: dynamic components in page

2009-01-12 Thread Andy Pahne

Radek Terber schrieb:

Hi

Is there possibility to render components in T5 page "dynamically" (in
dependency on return value of any method in page´s class for example, 
or so) ?

Methods "onEvent..." return pages whose are rendered "dynamically" too -
each method can return many pages. I thing it would be possible allow
dynamic including components similar way, but i am not able to do it.

Thanks.

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

  



If I understand it right, the current situation is that you cannot 
"dynamically" create a component (on the fly) and then add it to the page.


In case you try to update a zone, you may use blocks. Predefine all 
possible outcomes as separate blocks and let your event handler return 
one of those blocks.


The difference is: the block's content is not generated on the fly, it 
is completly defned when page rendering starts.


Hope that helps,
Andy

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



dynamic components in page

2009-01-12 Thread Radek Terber
Hi

Is there possibility to render components in T5 page "dynamically" (in
dependency on return value of any method in page´s class for example, 
or so) ?
Methods "onEvent..." return pages whose are rendered "dynamically" too -
each method can return many pages. I thing it would be possible allow
dynamic including components similar way, but i am not able to do it.

Thanks.

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