Re: Choose witch Component to use by a String

2011-06-16 Thread Bo Gao
Thanks


On Jun 17, 2011, at 10:37 AM, Thiago H. de Paula Figueiredo wrote:

> On Thu, 16 Jun 2011 23:21:27 -0300, Bo Gao  wrote:
> 
>> I tried this approach.
>> Is this means I must put all my components in a page.
>> Is their a performance problem if i have many components in one page?
> 
> No.
> 
>> How to pass parameter to the component I get in this way.
> 
> Use the Environment service.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and 
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

--
Bo Gao
eli...@gmail.com





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



Re: Choose witch Component to use by a String

2011-06-16 Thread Thiago H. de Paula Figueiredo

On Thu, 16 Jun 2011 23:21:27 -0300, Bo Gao  wrote:


I tried this approach.
Is this means I must put all my components in a page.
Is their a performance problem if i have many components in one page?


No.


How to pass parameter to the component I get in this way.


Use the Environment service.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: Choose witch Component to use by a String

2011-06-16 Thread Bo Gao
> You can use ComponentSource to grab other pages, and then grab components off 
> of those pages.
> I've used this approach for plugin-style apps where the components to use for 
> a given data type are determined at runtime and can be "plugged-in". 

I tried this approach.
Is this means I must put all my components in a page. 
Is their a performance problem if i have many components in one page?

How to pass parameter to the component I get in this way.

Thanks


On Jun 16, 2011, at 2:37 AM, Robert Zeigler wrote:

> You can use ComponentSource to grab other pages, and then grab components off 
> of those pages.
> I've used this approach for plugin-style apps where the components to use for 
> a given data type are determined at runtime and can be "plugged-in". 
> 
> Robert
> 
> On Jun 15, 2011, at 6/151:31 PM , Bo Gao wrote:
> 
>> Thanks.
>> 
>>> You can't choose your components at runtime. Although, if you have a
>>> set of known components that you want to choose from you can put your
>>> components in  and load the block by id.
>> 
>> 
>> If there are too many known components, I don't want to put so many 
>> components in on page.
>> 
>> I have another thought. Can I create a new component, and based on a String
>> parameter, render this component as another known component. 
>> (Like a page forward to another page).
>> 
>> or, is there a way to get an instance of a Component using java code at 
>> runtime.
>> 
>> 
>> On Jun 16, 2011, at 1:26 AM, Josh Canfield wrote:
>> 
 I want to use a component in a page, but i don't know which to use,
 I only know a String at Runtime, How can I do this.
>>> 
>>> http://tapestry.apache.org/principles.html
>>> 
>>> Principle 1 – Static Structure, Dynamic Behavior
>>> 
>>> You can't choose your components at runtime. Although, if you have a
>>> set of known components that you want to choose from you can put your
>>> components in  and load the block by id.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Josh
>>> 
>>> On Wed, Jun 15, 2011 at 10:20 AM, Bo Gao  wrote:
 I want to use a component in a page, but i don't know which to use,
 I only know a String at Runtime, How can I do this.
 
 I add to a .tml file, "component1" is the 
 Component Class name.
 I try to add a method getComponentName() to the java file, then i can 
 control which
 component to use, but i failed.
 
 Is their another way to do this?
 
 Thanks.
>>> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>> 
>> --
>> Bo Gao
>> eli...@gmail.com
>> 
>> 
>> 
>> 
>> 
>> -
>> 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
> 

--
Bo Gao
eli...@gmail.com





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



Re: Choose witch Component to use by a String

2011-06-15 Thread Thiago H. de Paula Figueiredo
On Wed, 15 Jun 2011 15:37:55 -0300, Robert Zeigler  
 wrote:


You can use ComponentSource to grab other pages, and then grab  
components off of those pages.
I've used this approach for plugin-style apps where the components to  
use for a given data type are determined at runtime and can be  
"plugged-in".


And that's exactly the approach used by BeanEditForm, BeanEditor, Grid and  
BeanDisplay (except they use blocks instead of components directly, but  
this doesn't make almost any difference).


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: Choose witch Component to use by a String

2011-06-15 Thread Robert Zeigler
You can use ComponentSource to grab other pages, and then grab components off 
of those pages.
I've used this approach for plugin-style apps where the components to use for a 
given data type are determined at runtime and can be "plugged-in". 

Robert

On Jun 15, 2011, at 6/151:31 PM , Bo Gao wrote:

> Thanks.
> 
>> You can't choose your components at runtime. Although, if you have a
>> set of known components that you want to choose from you can put your
>> components in  and load the block by id.
> 
> 
> If there are too many known components, I don't want to put so many 
> components in on page.
> 
> I have another thought. Can I create a new component, and based on a String
> parameter, render this component as another known component. 
> (Like a page forward to another page).
> 
> or, is there a way to get an instance of a Component using java code at 
> runtime.
> 
> 
> On Jun 16, 2011, at 1:26 AM, Josh Canfield wrote:
> 
>>> I want to use a component in a page, but i don't know which to use,
>>> I only know a String at Runtime, How can I do this.
>> 
>> http://tapestry.apache.org/principles.html
>> 
>> Principle 1 – Static Structure, Dynamic Behavior
>> 
>> You can't choose your components at runtime. Although, if you have a
>> set of known components that you want to choose from you can put your
>> components in  and load the block by id.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Josh
>> 
>> On Wed, Jun 15, 2011 at 10:20 AM, Bo Gao  wrote:
>>> I want to use a component in a page, but i don't know which to use,
>>> I only know a String at Runtime, How can I do this.
>>> 
>>> I add to a .tml file, "component1" is the 
>>> Component Class name.
>>> I try to add a method getComponentName() to the java file, then i can 
>>> control which
>>> component to use, but i failed.
>>> 
>>> Is their another way to do this?
>>> 
>>> Thanks.
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
> 
> --
> Bo Gao
> eli...@gmail.com
> 
> 
> 
> 
> 
> -
> 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: Choose witch Component to use by a String

2011-06-15 Thread Bo Gao
Thanks.

> You can't choose your components at runtime. Although, if you have a
> set of known components that you want to choose from you can put your
> components in  and load the block by id.


If there are too many known components, I don't want to put so many 
components in on page.

I have another thought. Can I create a new component, and based on a String
parameter, render this component as another known component. 
(Like a page forward to another page).

or, is there a way to get an instance of a Component using java code at runtime.


On Jun 16, 2011, at 1:26 AM, Josh Canfield wrote:

>> I want to use a component in a page, but i don't know which to use,
>> I only know a String at Runtime, How can I do this.
> 
> http://tapestry.apache.org/principles.html
> 
> Principle 1 – Static Structure, Dynamic Behavior
> 
> You can't choose your components at runtime. Although, if you have a
> set of known components that you want to choose from you can put your
> components in  and load the block by id.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Josh
> 
> On Wed, Jun 15, 2011 at 10:20 AM, Bo Gao  wrote:
>> I want to use a component in a page, but i don't know which to use,
>> I only know a String at Runtime, How can I do this.
>> 
>> I add to a .tml file, "component1" is the 
>> Component Class name.
>> I try to add a method getComponentName() to the java file, then i can 
>> control which
>> component to use, but i failed.
>> 
>> Is their another way to do this?
>> 
>> Thanks.
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

--
Bo Gao
eli...@gmail.com





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



Re: Choose witch Component to use by a String

2011-06-15 Thread Josh Canfield
> I want to use a component in a page, but i don't know which to use,
> I only know a String at Runtime, How can I do this.

http://tapestry.apache.org/principles.html

Principle 1 – Static Structure, Dynamic Behavior

You can't choose your components at runtime. Although, if you have a
set of known components that you want to choose from you can put your
components in  and load the block by id.









Josh

On Wed, Jun 15, 2011 at 10:20 AM, Bo Gao  wrote:
> I want to use a component in a page, but i don't know which to use,
> I only know a String at Runtime, How can I do this.
>
> I add to a .tml file, "component1" is the 
> Component Class name.
> I try to add a method getComponentName() to the java file, then i can control 
> which
> component to use, but i failed.
>
> Is their another way to do this?
>
> Thanks.

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