Re: [T5] instantiate a component on the fly

2007-08-21 Thread David Avenante
On 8/20/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
>
> That's close to my opinion.
>
> I appreciate how people would like to create a new component on the
> fly, and I understand the use cases involving that.
>
> However, it goes against the grain of Tapestry.  I've finally
> documented this, the concept of static structure and dynamic behavior.
>
> Once you allow "some" pages to have a different structure but the same
> name, much of what Tapestry is capable of doing is thrown away. It
> can't cache effectively, it can't operate in a cluster effectively.
> There's so much going on in the design that says "if I know the page
> name, I can trust that the structure is identical" even when its a
> different page instance and a different server in the cluster.



But my opinion is the Page concept is not good enough. For me the main
concept in Component (actual ComponentPageElement)
If I can cache a Page why I can't cache a Component ?


I think it's very important that Tapestry store as little as possible
> in the session. The new in T5 redirect-after-action pattern does force
> you to store more data in the session (with huge benefits, and the
> option to store on the client instead) so there's a bit of a
> compromise going on.  However, doing as Wicket and JSF and storing big
> chunks of page structure in the session (necessary to support runtime
> dynamic page structure) is something I'm fundamentally opposed to,
> given that there are quite satisfactory solutions, based on blocks and
> other structures.



For me the first target of Tapestry should be to focus on users concern and
actually Ajax
is the new way to build large web application. Maybe Seams is not "cluster
ready"
due to the use of Conversation through Statefull Session Bean but it resolve
users concern.

When I manipulate some concepts (in this case the two concept of Page and
ComponentPageElement)
and my feeling is "humm it's seems to me very close concept" so I try to
find an other way to express my concept.

So in my humble opinion I think the main concept is the EventManager, Ajax
web application need to be driven by an event bus.

So some use cases :

1 - Start Page use case
 User send request -> no event -> T5 generate a default event : call
Start Component -> Start Component is rendered.
 My Start component is like the actually page with html template and sub
component.

2 - Simple Page use case
 User send request -> with event call:MyPageTwo (who is in fact a
component) -> MyPageTwo Component is rendered.

2 - Simple Ajax call
 User send a request -> with event call:myCompnent -> if myComponent is
not in the cache it's created (like a page actualy).
 My component is rendered like the actually page.

 What some crazy things can I do with that ?
 A node substitution on a html page :
 I call a NodeSubstitutionComponent -> the component is created and
cached after that is rendered.
 This component contain other component and is main function is to
encapsulate the html return in, for example, a json call like :

   {execute: function() {Ext.DomHelper.createTemplate('" +
SubComponentsRendering+ "').overwrite( Ext.get('" +
idOfMyComponentOrPreviousComponent + "'));}}";

 3 - Another Ajax call
  User send a request on a component with and event
  The event is propaged only on the targeted Component

 4 - Complex Ajax call
  User send only a event. Tapestry transmit the event though all the
registered component for this event.
  We can make complex case with this approach make ordered render
response, trigger some other inter component event


So "voila" my 2 cents on the debat, Ajax web application have few pages and
many components so keep Page as central in T5
maybe will be an handicap for the futur !


Re: [T5] instantiate a component on the fly

2007-08-20 Thread Massimo Lusetti
On 8/21/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:

> However, it goes against the grain of Tapestry.  I've finally
> documented this, the concept of static structure and dynamic behavior.

This seems to answer (or comment if you prefer) on other thread
"Recursion of components", nice!

-- 
Massimo
http://meridio.blogspot.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] instantiate a component on the fly

2007-08-20 Thread Howard Lewis Ship
That's close to my opinion.

I appreciate how people would like to create a new component on the
fly, and I understand the use cases involving that.

However, it goes against the grain of Tapestry.  I've finally
documented this, the concept of static structure and dynamic behavior.

Once you allow "some" pages to have a different structure but the same
name, much of what Tapestry is capable of doing is thrown away. It
can't cache effectively, it can't operate in a cluster effectively.
There's so much going on in the design that says "if I know the page
name, I can trust that the structure is identical" even when its a
different page instance and a different server in the cluster.

I think it's very important that Tapestry store as little as possible
in the session. The new in T5 redirect-after-action pattern does force
you to store more data in the session (with huge benefits, and the
option to store on the client instead) so there's a bit of a
compromise going on.  However, doing as Wicket and JSF and storing big
chunks of page structure in the session (necessary to support runtime
dynamic page structure) is something I'm fundamentally opposed to,
given that there are quite satisfactory solutions, based on blocks and
other structures.


On 8/17/07, Mark Stang <[EMAIL PROTECTED]> wrote:
> In the past, and I haven't heard anything from Howard to make me think 
> differently, this was not possible.
>
> Howard's view has been that there is no need to create a component on the 
> fly. Instead the standard procedure is to embed it in a page and hide it 
> until needed.
>
> hth.
>
> Mark J. Stang
> Software Engineer
> office: +1 303.468.2900
> Ping Identity
>
>
>
> -Original Message-
> From: David Avenante [mailto:[EMAIL PROTECTED]
> Sent: Fri 8/17/2007 10:29 AM
> To: Tapestry users
> Subject: Re: [T5] instantiate a component on the fly
>
> Hum I not sure.
>
> My component is not define in class and is not define in the template =>
> It's a really a NEW component.
>
> So as I can see there is a possibility with
> PageElementFactory.newComponentElement() that I can inject in my page.
>
> But there is too many parameters. I hope Tapestry give me a day a very
> simplistic way to do this.
>
> I continue my investigations.
>
> Thanks for the input Robert ;)
>
>


-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] instantiate a component on the fly

2007-08-20 Thread David Avenante
Humm alway in my way 

So I try to enhance T5 to support some Ajax Features.

1 - I've Aliased  the ComponentActionRequestHandler to use my own.
2 - Now if my ComponentAction is and ajax action ex :
http://mySite/myPage.myComponent:ajax/99 I want try to instanciate my
targeted component.

So I need to have a ComponentLoader and especially a ComponentLoader. But
after investigation and more and more I read the source code of Tapestry 5,
more and more I feel
that difference between Page and ComponentPageElement is very thin.

So why I need a page to instantiate a ComponentPageElement
(ComponentPageElementImpl), why a Component can't existe wihout a page ?

Thanks


Re: [T5] instantiate a component on the fly

2007-08-17 Thread David Avenante
Yes but in an Ajax point of view I think you can't use this approach in my
humble point of view.

In an Ajax way for me the good approach is to have a component call like
ComponentSubstitution who encapsulate
and permit to generate an Ajax return whit html node substitution.

With T5 it's very easy to make some simple Ajax response, I play with T5
coupled with Ext and the possibility are amazing ;)
But if I want to use the full potential of T5 I need to be able to do
something like that :

AjaxCall -> T5 event like display MyComplexeComponent -> Instantiate
MyComplexeComponent -> encapsulate the response in something like :
{execute: function() {Ext.DomHelper.createTemplate('" + ComponentRendering+
"').overwrite(Ext.get('" + idOfMyComponentOrPreviousComponent + "'));}}";

and it'll be magic ;)

Actually it's a pain but Tapestry is definitively on the right way ;)

Regards


RE: [T5] instantiate a component on the fly

2007-08-17 Thread Mark Stang
In the past, and I haven't heard anything from Howard to make me think 
differently, this was not possible.

Howard's view has been that there is no need to create a component on the fly. 
Instead the standard procedure is to embed it in a page and hide it until 
needed.

hth.

Mark J. Stang
Software Engineer
office: +1 303.468.2900
Ping Identity



-Original Message-
From: David Avenante [mailto:[EMAIL PROTECTED]
Sent: Fri 8/17/2007 10:29 AM
To: Tapestry users
Subject: Re: [T5] instantiate a component on the fly
 
Hum I not sure.

My component is not define in class and is not define in the template =>
It's a really a NEW component.

So as I can see there is a possibility with
PageElementFactory.newComponentElement() that I can inject in my page.

But there is too many parameters. I hope Tapestry give me a day a very
simplistic way to do this.

I continue my investigations.

Thanks for the input Robert ;)



Re: [T5] instantiate a component on the fly

2007-08-17 Thread David Avenante
Hum I not sure.

My component is not define in class and is not define in the template =>
It's a really a NEW component.

So as I can see there is a possibility with
PageElementFactory.newComponentElement() that I can inject in my page.

But there is too many parameters. I hope Tapestry give me a day a very
simplistic way to do this.

I continue my investigations.

Thanks for the input Robert ;)


Re: [T5] instantiate a component on the fly

2007-08-17 Thread Robert Zeigler
Best bet here is probably to put your component into a block, then  
render the block (or else grab the component from the block and  
render the component).

Check out the "delegate" component, for example.

Robert

On Aug 17, 2007, at 8/179:26 AM , David Avenante wrote:


Hi,

I'm very disappointed. After some investigation it seem it's not  
possible to

instantiate a component in a page on the fly in T5.

I have a page and his template, my component is not defined on the  
template
but on a specific event, I want to create and instantiate this  
component.


I need something like this :

@Inject
private ComponentClassTransformer componentClassTransformer;

private StreamResponse myEvent() {

Component component =  
componentClassTransformer.createInstantiator(

My.class).newInstance( BAN );


}

I can find a instance of InternalComponentResources. This class  
can't be

injected as service.
The inspection of the Tapestry code watch me that component  
creation is very

close coupled with Page instantiation

Is it possible to instantiate a component on the fly ?

Thanks for any informations.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[T5] instantiate a component on the fly

2007-08-17 Thread David Avenante
Hi,

I'm very disappointed. After some investigation it seem it's not possible to
instantiate a component in a page on the fly in T5.

I have a page and his template, my component is not defined on the template
but on a specific event, I want to create and instantiate this component.

I need something like this :

@Inject
private ComponentClassTransformer componentClassTransformer;

private StreamResponse myEvent() {

Component component = componentClassTransformer.createInstantiator(
My.class).newInstance( BAN );


}

I can find a instance of InternalComponentResources. This class can't be
injected as service.
The inspection of the Tapestry code watch me that component creation is very
close coupled with Page instantiation

Is it possible to instantiate a component on the fly ?

Thanks for any informations.