> 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 <t:block> 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 <t:block> and load the block by id.
>>> 
>>> 
>>> <t:delegate to="namedBlock"/><!-- where namedBlock is a page property
>>> which returns the block based on your runtime value -->
>>> 
>>> <t:block t:id="circle"><t:drawcircle/></t:block>
>>> <t:block t:id="square"><t:drawsquare/></t:block>
>>> <t:block t:id="triangle"><t:drawtriangle/></t:block>
>>> 
>>> 
>>> Josh
>>> 
>>> On Wed, Jun 15, 2011 at 10:20 AM, Bo Gao <eli...@gmail.com> 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 <div t:type="component1"></div>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

Reply via email to