Re: page activation + components

2008-05-05 Thread Josh Canfield
 Message-
  
   From: Andy Huhn [mailto:[EMAIL PROTECTED]
   Sent: 29 April 2008 17:34
   To: Tapestry users
   Subject: Re: page activation + components
  
  
   Hello,
  
   You can define the scope of each service...you can set that
  particular
   service to be tied to only one session.
  
   See
http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
   and
   search for perthread.
  
   Thanks,
   Andy
  
   On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
   [EMAIL PROTECTED] wrote:
  
  
   Hi there,
  
   the service approach (as I expected) is session-agnostic
  (and is
   page-independent so concurrent users would interfere badly),
  
  
   therefore is
  
  
   not ok.
  
   I will now try the Environment approach... if that is
session-aware
  
  
   :)
  
  
   thx again
   janos
  
   2008/4/29 János Jarecsni [EMAIL PROTECTED]:
  
Hi Chris,
  
   even so you could help :) I want this kind of generic way
  of
   passing
   around information (component to component communication
  :)) so
   I'll
  
  
   look
  
  
   for the solutions Kristian and you outlined.
  
   thanks!
  
   cheers,
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
Janos,
  
   Without code or a description of your actual goal, I'm
  finding
  
  
   your
  
   situation too hypothetical to really digest. The one thing I
  can
  
   point
  
   out is what you said about wanting a component to set a
  property
  
   in
  
   the
  
  
   page. If you want to do that, then you have to know the
  class
of
  
   the
  
   page and so injecting a page would make sense. Of course
  that
  
   means
  
   tightly coupling a component to a page, which to me doesn't
  make
  
   sense.
  
   If you simply need a generic way of passing data between
  pages
and
  
   components, consider using a service that provides an
  untyped
   list
  
  
   or
  
   putting something in the environment as Kristian suggested.
  I'm
  
   sorry
  
   I
  
  
   can't be more helpful but as I said I'm not clear on what
you're
  
   really
  
   trying to do.
  
   good luck
   chris
  
   János Jarecsni wrote:
  
  
   Hi Chris,
  
   I thought of pages as contexts for the components
  embedded
  
  
   within
  
   them.
  
   So, in one event handler of a component I would like to
  set
   some
  
  
   property or
  
  
   another (in the page object), and the other components in
  the
  
  
   page,
  
   which
  
   are also able to access this property may change their
  
  
   appearance
  
   (say, the
  
   .TML would test the property). Maybe I'm on a wrong
  track,
  
  
   please
  
   let
  
  
   me
  
   know :)
  
   thx
   Cheers,
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
  
Janos,
  
   I'm having a hard time understanding a case that a
  component
  
  
   should
  
   know
  
   in which page it is embedded, so my suggestion probably
wasn't
  
   a
  
   good
  
  
   one. Activation contexts aren't meant for components but
  for
  
   pages
  
   -
  
  
   you
  
   should be using component parameters to configure them,
  and
if
  
   it's
  
   a
  
  
   more sophisticated component, probably a service.
  
   chris
  
   János Jarecsni wrote:
  
and how a component can get to know the page in which
  it is
  
   included? I
  
   mean, I can't @InjectPage, as the component will be
  included
  
   in
  
   many
  
  
   kinds
  
of pages.
  
   @Kristian: thx for the many ways :) I'll try these,
  hope
   that
  
  
   the
  
   @Environmental stuff is scalable (I'm trying to bypass
  session
  
   creation
  
   as
  
much as possible)
  
   Is there a doc on the various annotations available?
  
   @Michael:
   Could you include a tiny bit of example? THX!
  
   Thx to you all
   cheers
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
  
  
5) @InjectPage the page and call the getter
  
   Kristian Marinkovic wrote

Re: page activation + components

2008-05-02 Thread János Jarecsni
 don't your problem
   can still be solved by using a session to serve as an arbitrary
 holder.
   If you've settled on this architecture, why not write such a generic
   service and move on?
  
   János Jarecsni wrote:
Hi,
   
I looked everywhere for usage of request scope variables, but found
   nothing
(maybe I'm impatient a bit :)...
Is it really that unrealistic to have two components in a page, one
 (A)
having an action link eventhandler where it would set some attribute
 for
   the
request only (not the session!) and then component B could render
 itself
according to the attribute set by component A?
   
I think it should be a piece of cake :)
   
thx
Janos
   
2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:
   
   
Nope, you're exactly right.
   
-Filip
   
Blower, Andy skrev:
   
 This is not what I understood 'perthread' scope to be. I thought
 that
   it
   
meant that each thread using a service gets its own instance of
 the
   service
to use, even though that instance may not be the same as any
 previous
instance it used. In other words, nothing to do with user
 sessions,
   it's
just for services that are not thread safe and cannot be
 singletons.
   
Have I got the wrong end of the stick here?
   
 -Original Message-
   
From: Andy Huhn [mailto:[EMAIL PROTECTED]
Sent: 29 April 2008 17:34
To: Tapestry users
Subject: Re: page activation + components
   
   
Hello,
   
You can define the scope of each service...you can set that
   particular
service to be tied to only one session.
   
See
 http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
and
search for perthread.
   
Thanks,
Andy
   
On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
[EMAIL PROTECTED] wrote:
   
   
Hi there,
   
the service approach (as I expected) is session-agnostic (and is
page-independent so concurrent users would interfere badly),
   
   
therefore is
   
   
not ok.
   
I will now try the Environment approach... if that is
 session-aware
   
   
:)
   
   
thx again
janos
   
2008/4/29 János Jarecsni [EMAIL PROTECTED]:
   
 Hi Chris,
   
even so you could help :) I want this kind of generic way of
passing
around information (component to component communication :)) so
I'll
   
   
look
   
   
for the solutions Kristian and you outlined.
   
thanks!
   
cheers,
janos
   
2008/4/29 Chris Lewis [EMAIL PROTECTED]:
   
 Janos,
   
Without code or a description of your actual goal, I'm finding
   
   
your
   
situation too hypothetical to really digest. The one thing I can
   
point
   
out is what you said about wanting a component to set a property
   
in
   
the
   
   
page. If you want to do that, then you have to know the class
 of
   
the
   
page and so injecting a page would make sense. Of course that
   
means
   
tightly coupling a component to a page, which to me doesn't make
   
sense.
   
If you simply need a generic way of passing data between pages
 and
   
components, consider using a service that provides an untyped
list
   
   
or
   
putting something in the environment as Kristian suggested. I'm
   
sorry
   
I
   
   
can't be more helpful but as I said I'm not clear on what
 you're
   
really
   
trying to do.
   
good luck
chris
   
János Jarecsni wrote:
   
   
Hi Chris,
   
I thought of pages as contexts for the components embedded
   
   
within
   
them.
   
So, in one event handler of a component I would like to set
some
   
   
property or
   
   
another (in the page object), and the other components in the
   
   
page,
   
which
   
are also able to access this property may change their
   
   
appearance
   
(say, the
   
.TML would test the property). Maybe I'm on a wrong track,
   
   
please
   
let
   
   
me
   
know :)
   
thx
Cheers,
janos
   
2008/4/29 Chris Lewis [EMAIL PROTECTED]:
   
   
 Janos,
   
I'm having a hard time understanding a case that a component
   
   
should
   
know
   
in which page it is embedded, so my suggestion probably
 wasn't
   
a
   
good
   
   
one. Activation contexts aren't meant for components but for
   
pages
   
-
   
   
you
   
should be using component parameters to configure them, and
 if
   
it's
   
a
   
   
more sophisticated component, probably a service.
   
chris
   
János Jarecsni wrote:
   
 and how a component can get to know the page in which it is
   
included? I
   
mean, I can't @InjectPage, as the component will be included
   
in
   
many
   
   
kinds
   
 of pages.
   
@Kristian: thx for the many

Re: page activation + components

2008-05-02 Thread nicholas Krul
 idioms such as
 request
parameters, and instead replace those with a higher level of
  application
logic that eclipses them entirely (when possible). That's not to say
that your perspective is flawed, but from the small bit of
  understanding
I've taken from your posts I can't see why one would do what you
 want.
The thing that I've been saying is missing here is, what are you
  trying
to do? I don't mean technically, I mean what is the end result for
 the
user? Understanding this is critical, but even if I don't your
 problem
can still be solved by using a session to serve as an arbitrary
  holder.
If you've settled on this architecture, why not write such a generic
service and move on?
   
János Jarecsni wrote:
 Hi,

 I looked everywhere for usage of request scope variables, but
 found
nothing
 (maybe I'm impatient a bit :)...
 Is it really that unrealistic to have two components in a page,
 one
  (A)
 having an action link eventhandler where it would set some
 attribute
  for
the
 request only (not the session!) and then component B could render
  itself
 according to the attribute set by component A?

 I think it should be a piece of cake :)

 thx
 Janos

 2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:


 Nope, you're exactly right.

 -Filip

 Blower, Andy skrev:

  This is not what I understood 'perthread' scope to be. I thought
  that
it

 meant that each thread using a service gets its own instance of
  the
service
 to use, even though that instance may not be the same as any
  previous
 instance it used. In other words, nothing to do with user
  sessions,
it's
 just for services that are not thread safe and cannot be
  singletons.

 Have I got the wrong end of the stick here?

  -Original Message-

 From: Andy Huhn [mailto:[EMAIL PROTECTED]
 Sent: 29 April 2008 17:34
 To: Tapestry users
 Subject: Re: page activation + components


 Hello,

 You can define the scope of each service...you can set that
particular
 service to be tied to only one session.

 See
  http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
 and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:


 Hi there,

 the service approach (as I expected) is session-agnostic (and
 is
 page-independent so concurrent users would interfere badly),


 therefore is


 not ok.

 I will now try the Environment approach... if that is
  session-aware


 :)


 thx again
 janos

 2008/4/29 János Jarecsni [EMAIL PROTECTED]:

  Hi Chris,

 even so you could help :) I want this kind of generic way of
 passing
 around information (component to component communication :))
 so
 I'll


 look


 for the solutions Kristian and you outlined.

 thanks!

 cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  Janos,

 Without code or a description of your actual goal, I'm
 finding


 your

 situation too hypothetical to really digest. The one thing I
 can

 point

 out is what you said about wanting a component to set a
 property

 in

 the


 page. If you want to do that, then you have to know the class
  of

 the

 page and so injecting a page would make sense. Of course that

 means

 tightly coupling a component to a page, which to me doesn't
 make

 sense.

 If you simply need a generic way of passing data between
 pages
  and

 components, consider using a service that provides an
 untyped
 list


 or

 putting something in the environment as Kristian suggested.
 I'm

 sorry

 I


 can't be more helpful but as I said I'm not clear on what
  you're

 really

 trying to do.

 good luck
 chris

 János Jarecsni wrote:


 Hi Chris,

 I thought of pages as contexts for the components
 embedded


 within

 them.

 So, in one event handler of a component I would like to set
 some


 property or


 another (in the page object), and the other components in
 the


 page,

 which

 are also able to access this property may change their


 appearance

 (say, the

 .TML would test the property). Maybe I'm on a wrong track,


 please

 let


 me

 know :)

 thx
 Cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED

Re: page activation + components

2008-05-02 Thread János Jarecsni
.
   If you've settled on this architecture, why not write such a generic
   service and move on?
  
   János Jarecsni wrote:
Hi,
   
I looked everywhere for usage of request scope variables, but found
   nothing
(maybe I'm impatient a bit :)...
Is it really that unrealistic to have two components in a page, one
 (A)
having an action link eventhandler where it would set some attribute
 for
   the
request only (not the session!) and then component B could render
 itself
according to the attribute set by component A?
   
I think it should be a piece of cake :)
   
thx
Janos
   
2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:
   
   
Nope, you're exactly right.
   
-Filip
   
Blower, Andy skrev:
   
 This is not what I understood 'perthread' scope to be. I thought
 that
   it
   
meant that each thread using a service gets its own instance of
 the
   service
to use, even though that instance may not be the same as any
 previous
instance it used. In other words, nothing to do with user
 sessions,
   it's
just for services that are not thread safe and cannot be
 singletons.
   
Have I got the wrong end of the stick here?
   
 -Original Message-
   
From: Andy Huhn [mailto:[EMAIL PROTECTED]
Sent: 29 April 2008 17:34
To: Tapestry users
Subject: Re: page activation + components
   
   
Hello,
   
You can define the scope of each service...you can set that
   particular
service to be tied to only one session.
   
See
 http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
and
search for perthread.
   
Thanks,
Andy
   
On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
[EMAIL PROTECTED] wrote:
   
   
Hi there,
   
the service approach (as I expected) is session-agnostic (and is
page-independent so concurrent users would interfere badly),
   
   
therefore is
   
   
not ok.
   
I will now try the Environment approach... if that is
 session-aware
   
   
:)
   
   
thx again
janos
   
2008/4/29 János Jarecsni [EMAIL PROTECTED]:
   
 Hi Chris,
   
even so you could help :) I want this kind of generic way of
passing
around information (component to component communication :)) so
I'll
   
   
look
   
   
for the solutions Kristian and you outlined.
   
thanks!
   
cheers,
janos
   
2008/4/29 Chris Lewis [EMAIL PROTECTED]:
   
 Janos,
   
Without code or a description of your actual goal, I'm finding
   
   
your
   
situation too hypothetical to really digest. The one thing I can
   
point
   
out is what you said about wanting a component to set a property
   
in
   
the
   
   
page. If you want to do that, then you have to know the class
 of
   
the
   
page and so injecting a page would make sense. Of course that
   
means
   
tightly coupling a component to a page, which to me doesn't make
   
sense.
   
If you simply need a generic way of passing data between pages
 and
   
components, consider using a service that provides an untyped
list
   
   
or
   
putting something in the environment as Kristian suggested. I'm
   
sorry
   
I
   
   
can't be more helpful but as I said I'm not clear on what
 you're
   
really
   
trying to do.
   
good luck
chris
   
János Jarecsni wrote:
   
   
Hi Chris,
   
I thought of pages as contexts for the components embedded
   
   
within
   
them.
   
So, in one event handler of a component I would like to set
some
   
   
property or
   
   
another (in the page object), and the other components in the
   
   
page,
   
which
   
are also able to access this property may change their
   
   
appearance
   
(say, the
   
.TML would test the property). Maybe I'm on a wrong track,
   
   
please
   
let
   
   
me
   
know :)
   
thx
Cheers,
janos
   
2008/4/29 Chris Lewis [EMAIL PROTECTED]:
   
   
 Janos,
   
I'm having a hard time understanding a case that a component
   
   
should
   
know
   
in which page it is embedded, so my suggestion probably
 wasn't
   
a
   
good
   
   
one. Activation contexts aren't meant for components but for
   
pages
   
-
   
   
you
   
should be using component parameters to configure them, and
 if
   
it's
   
a
   
   
more sophisticated component, probably a service.
   
chris
   
János Jarecsni wrote:
   
 and how a component can get to know the page in which it is
   
included? I
   
mean, I can't @InjectPage, as the component will be included
   
in
   
many
   
   
kinds
   
 of pages.
   
@Kristian: thx for the many ways :) I'll try these, hope
that
   
   
the
   
@Environmental stuff is scalable

Re: page activation + components

2008-05-02 Thread Josh Canfield
 looks at this
  piece
   of
info, and loads the news with id 4527 (or gets it from an app level
   cache
:)) and renders it.
   
Hope it tells something about what I am up to :)
   
thx
Janos
   
2008/4/30 Chris Lewis [EMAIL PROTECTED]:
   
   
 Honestly it's difficult for me to imagine a situation where I'd do
   that
 because it seems to violate a degree of encapsulation that tapestry
 imposes as a freeing law of the framework. The epicenter of that
   being
 that one should not think in terms of low-level idioms such as
  request
 parameters, and instead replace those with a higher level of
   application
 logic that eclipses them entirely (when possible). That's not to say
 that your perspective is flawed, but from the small bit of
   understanding
 I've taken from your posts I can't see why one would do what you
  want.
 The thing that I've been saying is missing here is, what are you
   trying
 to do? I don't mean technically, I mean what is the end result for
  the
 user? Understanding this is critical, but even if I don't your
  problem
 can still be solved by using a session to serve as an arbitrary
   holder.
 If you've settled on this architecture, why not write such a generic
 service and move on?

 János Jarecsni wrote:
  Hi,
 
  I looked everywhere for usage of request scope variables, but
  found
 nothing
  (maybe I'm impatient a bit :)...
  Is it really that unrealistic to have two components in a page,
  one
   (A)
  having an action link eventhandler where it would set some
  attribute
   for
 the
  request only (not the session!) and then component B could render
   itself
  according to the attribute set by component A?
 
  I think it should be a piece of cake :)
 
  thx
  Janos
 
  2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:
 
 
  Nope, you're exactly right.
 
  -Filip
 
  Blower, Andy skrev:
 
   This is not what I understood 'perthread' scope to be. I thought
   that
 it
 
  meant that each thread using a service gets its own instance of
   the
 service
  to use, even though that instance may not be the same as any
   previous
  instance it used. In other words, nothing to do with user
   sessions,
 it's
  just for services that are not thread safe and cannot be
   singletons.
 
  Have I got the wrong end of the stick here?
 
   -Original Message-
 
  From: Andy Huhn [mailto:[EMAIL PROTECTED]
  Sent: 29 April 2008 17:34
  To: Tapestry users
  Subject: Re: page activation + components
 
 
  Hello,
 
  You can define the scope of each service...you can set that
 particular
  service to be tied to only one session.
 
  See
   http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
  and
  search for perthread.
 
  Thanks,
  Andy
 
  On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
  [EMAIL PROTECTED] wrote:
 
 
  Hi there,
 
  the service approach (as I expected) is session-agnostic (and
  is
  page-independent so concurrent users would interfere badly),
 
 
  therefore is
 
 
  not ok.
 
  I will now try the Environment approach... if that is
   session-aware
 
 
  :)
 
 
  thx again
  janos
 
  2008/4/29 János Jarecsni [EMAIL PROTECTED]:
 
   Hi Chris,
 
  even so you could help :) I want this kind of generic way of
  passing
  around information (component to component communication :))
  so
  I'll
 
 
  look
 
 
  for the solutions Kristian and you outlined.
 
  thanks!
 
  cheers,
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
   Janos,
 
  Without code or a description of your actual goal, I'm
  finding
 
 
  your
 
  situation too hypothetical to really digest. The one thing I
  can
 
  point
 
  out is what you said about wanting a component to set a
  property
 
  in
 
  the
 
 
  page. If you want to do that, then you have to know the class
   of
 
  the
 
  page and so injecting a page would make sense. Of course that
 
  means
 
  tightly coupling a component to a page, which to me doesn't
  make
 
  sense.
 
  If you simply need a generic way of passing data between
  pages
   and
 
  components, consider using a service that provides an
  untyped
  list
 
 
  or
 
  putting something in the environment as Kristian suggested.
  I'm
 
  sorry
 
  I
 
 
  can't be more helpful but as I said I'm not clear on what
   you're
 
  really
 
  trying to do

Re: page activation + components

2008-05-02 Thread Josh Canfield
   to show the text of a given news in full), it simply looks at this piece
  of
   info, and loads the news with id 4527 (or gets it from an app level
  cache
   :)) and renders it.
  
   Hope it tells something about what I am up to :)
  
   thx
   Janos
  
   2008/4/30 Chris Lewis [EMAIL PROTECTED]:
  
  
Honestly it's difficult for me to imagine a situation where I'd do
  that
because it seems to violate a degree of encapsulation that tapestry
imposes as a freeing law of the framework. The epicenter of that
  being
that one should not think in terms of low-level idioms such as request
parameters, and instead replace those with a higher level of
  application
logic that eclipses them entirely (when possible). That's not to say
that your perspective is flawed, but from the small bit of
  understanding
I've taken from your posts I can't see why one would do what you want.
The thing that I've been saying is missing here is, what are you
  trying
to do? I don't mean technically, I mean what is the end result for the
user? Understanding this is critical, but even if I don't your problem
can still be solved by using a session to serve as an arbitrary
  holder.
If you've settled on this architecture, why not write such a generic
service and move on?
   
János Jarecsni wrote:
 Hi,

 I looked everywhere for usage of request scope variables, but found
nothing
 (maybe I'm impatient a bit :)...
 Is it really that unrealistic to have two components in a page, one
  (A)
 having an action link eventhandler where it would set some attribute
  for
the
 request only (not the session!) and then component B could render
  itself
 according to the attribute set by component A?

 I think it should be a piece of cake :)

 thx
 Janos

 2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:


 Nope, you're exactly right.

 -Filip

 Blower, Andy skrev:

  This is not what I understood 'perthread' scope to be. I thought
  that
it

 meant that each thread using a service gets its own instance of
  the
service
 to use, even though that instance may not be the same as any
  previous
 instance it used. In other words, nothing to do with user
  sessions,
it's
 just for services that are not thread safe and cannot be
  singletons.

 Have I got the wrong end of the stick here?

  -Original Message-

 From: Andy Huhn [mailto:[EMAIL PROTECTED]
 Sent: 29 April 2008 17:34
 To: Tapestry users
 Subject: Re: page activation + components


 Hello,

 You can define the scope of each service...you can set that
particular
 service to be tied to only one session.

 See
  http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
 and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:


 Hi there,

 the service approach (as I expected) is session-agnostic (and is
 page-independent so concurrent users would interfere badly),


 therefore is


 not ok.

 I will now try the Environment approach... if that is
  session-aware


 :)


 thx again
 janos

 2008/4/29 János Jarecsni [EMAIL PROTECTED]:

  Hi Chris,

 even so you could help :) I want this kind of generic way of
 passing
 around information (component to component communication :)) so
 I'll


 look


 for the solutions Kristian and you outlined.

 thanks!

 cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  Janos,

 Without code or a description of your actual goal, I'm finding


 your

 situation too hypothetical to really digest. The one thing I can

 point

 out is what you said about wanting a component to set a property

 in

 the


 page. If you want to do that, then you have to know the class
  of

 the

 page and so injecting a page would make sense. Of course that

 means

 tightly coupling a component to a page, which to me doesn't make

 sense.

 If you simply need a generic way of passing data between pages
  and

 components, consider using a service that provides an untyped
 list


 or

 putting something in the environment as Kristian suggested. I'm

 sorry

 I


 can't be more helpful but as I said I'm not clear on what
  you're

 really

 trying to do.

 good luck
 chris

 János Jarecsni wrote:


 Hi Chris,

 I thought of pages as contexts for the components embedded


 within

Re: page activation + components

2008-05-02 Thread János Jarecsni
 a ComponentContext object into the Environment
   onActivate, and setupRender in your page (env gets cleared before
   render phase, not sure if there is a better way than doing it in
   both.) Then collect component parameter mappings. onPassivate for your
   page would organize and return these as it's context (you might want
   to sort them to get consistent results)
  
   Your url might look like this:
  
   http://localhost/context/mypage/cc/news/4527/stock/MCD
  
   Then onactivate you init the ComponentContext from the url keying off
   the cc to grab the remaining parameters and use them as key/value
   for the components. The your components do something like:
  
   @Environmental
   private ComponentContext _compContext;
  
   void setupRender() {
Long newsId = _compContext.getLong(_resources.getId());
   }
  
   void onPickNewsItem(Long id) {
_compContext.put(_resources.getId(), id);
   }
  
  
   Josh
  
   On Wed, Apr 30, 2008 at 5:23 AM, János Jarecsni
   [EMAIL PROTECTED] wrote:
Hi Chris,
   
I try to explain :)
Say, you have a NewsQuote component, which shows a few lines from
 the
   5
latest news. At the and of each quotations, there a More link.
 Now,
   when
the user clicks on this link (an action link, for that matter), the
NewsQuote component will set a request scope info saying that the
 news
   with
ID=4527 is requested. And when it comes to the News component (it
 is
   able
to show the text of a given news in full), it simply looks at this
 piece
   of
info, and loads the news with id 4527 (or gets it from an app level
   cache
:)) and renders it.
   
Hope it tells something about what I am up to :)
   
thx
Janos
   
2008/4/30 Chris Lewis [EMAIL PROTECTED]:
   
   
 Honestly it's difficult for me to imagine a situation where I'd do
   that
 because it seems to violate a degree of encapsulation that
 tapestry
 imposes as a freeing law of the framework. The epicenter of that
   being
 that one should not think in terms of low-level idioms such as
 request
 parameters, and instead replace those with a higher level of
   application
 logic that eclipses them entirely (when possible). That's not to
 say
 that your perspective is flawed, but from the small bit of
   understanding
 I've taken from your posts I can't see why one would do what you
 want.
 The thing that I've been saying is missing here is, what are you
   trying
 to do? I don't mean technically, I mean what is the end result for
 the
 user? Understanding this is critical, but even if I don't your
 problem
 can still be solved by using a session to serve as an arbitrary
   holder.
 If you've settled on this architecture, why not write such a
 generic
 service and move on?

 János Jarecsni wrote:
  Hi,
 
  I looked everywhere for usage of request scope variables, but
 found
 nothing
  (maybe I'm impatient a bit :)...
  Is it really that unrealistic to have two components in a page,
 one
   (A)
  having an action link eventhandler where it would set some
 attribute
   for
 the
  request only (not the session!) and then component B could
 render
   itself
  according to the attribute set by component A?
 
  I think it should be a piece of cake :)
 
  thx
  Janos
 
  2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:
 
 
  Nope, you're exactly right.
 
  -Filip
 
  Blower, Andy skrev:
 
   This is not what I understood 'perthread' scope to be. I
 thought
   that
 it
 
  meant that each thread using a service gets its own instance
 of
   the
 service
  to use, even though that instance may not be the same as any
   previous
  instance it used. In other words, nothing to do with user
   sessions,
 it's
  just for services that are not thread safe and cannot be
   singletons.
 
  Have I got the wrong end of the stick here?
 
   -Original Message-
 
  From: Andy Huhn [mailto:[EMAIL PROTECTED]
  Sent: 29 April 2008 17:34
  To: Tapestry users
  Subject: Re: page activation + components
 
 
  Hello,
 
  You can define the scope of each service...you can set that
 particular
  service to be tied to only one session.
 
  See
   http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
  and
  search for perthread.
 
  Thanks,
  Andy
 
  On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
  [EMAIL PROTECTED] wrote:
 
 
  Hi there,
 
  the service approach (as I expected) is session-agnostic
 (and is
  page-independent so concurrent users would interfere badly),
 
 
  therefore is
 
 
  not ok.
 
  I will now try the Environment approach... if that is
   session-aware
 
 
  :)
 
 
  thx again

Re: page activation + components

2008-05-01 Thread Chris Lewis
Josh,

Yeah that looks like it would do it, working much like what proposed
with pagelinks. Given a choice I would use the pagelink based way
because architecturally it works the same (news page collects the id via
context), but using pagelinks reduces the round-trips and the need to
deal with events.
Janos if you're still listening ;-), I think we've found the best ways
possible to do what you want. The missing piece is that you said your
News component was a component and not a page, so in that case use a
page property (like Josh said) and in your page's template, testing for
a valid newsId, provide the News component with it. These are the best
methods we've seen, I just can't figure out why my mind keeps saying
there's a better way :-|.

chris

Josh Canfield wrote:
 Here's an app that does what I believe is trying to be done:

 // Page
 public class News {
   @Property
   private Integer _newsId;
   public void onActivate(Integer newsId) {
   _newsId = newsId;
   }
   
   public Integer onPassivate() {
   return _newsId;
   }
 }

 // Page Template
 ?xml version=1.0 encoding=UTF-8 ?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
   http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;

 html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
 body
 t:newsQuote newsId=newsId /
 /body
 /html

 // Component
 public class NewsQuote {

   @Parameter
   private Integer _newsId;

   @Inject
   private ComponentResources _resources;

   void beginRender(MarkupWriter writer) {
   writer.element(ul);
   for (int i = 0; i  5; ++i) {
   writer.element(li);
   Link link = _resources.createActionLink(show, false, 
 i);
   writer.element(a, href, link.toURI());
   writer.write(News number  + i);
   writer.end();
   if (_newsId != null  _newsId.equals(i)) {
   writer.write( You picked  + _newsId);
   }
   writer.end();
   }
   writer.end();
   }
   
   // The Action handler
   void onShow(Integer id) {
   // stored into the bound parameter, feeding it back into the 
 page
   _newsId = id;
   }
 }

 The url http://localhost:8080/news/4

 Renders

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
   link href=/assets/tapestry/default.css rel=stylesheet type=text/css
 /head
 body
 ul
 lia href=/news.newsquote:show/0?t:ac=4News number 0/a/li
 lia href=/news.newsquote:show/1?t:ac=4News number 1/a/li
 lia href=/news.newsquote:show/2?t:ac=4News number 2/a/li
 lia href=/news.newsquote:show/3?t:ac=4News number 3/a/li
 lia href=/news.newsquote:show/4?t:ac=4News number 4/a You picked 
 4/li
 /ul
 /body
 /html

 Josh

 On Wed, Apr 30, 2008 at 2:49 PM, Chris Lewis [EMAIL PROTECTED] wrote:
   
 I do hope we've missed a simpler way, but I don't think it's surfaced
 yet. Regarding parameters, how would that address the issue? NewsQuote
 displays a collection of items as links that represent selectable items
 (expressed as links). The action must be taken based on the user's
 selection, so a component parameter doesn't apply here.
 The event-based approach seems a theoretical perfect fit, but I can't
 see how to do it without using @Persist (which Janos wants to avoid).
 The only other thing I thought of is to have the NewsQuote component
 generate pagelinks based on the containing page instead of action links.
 This circumvents entirely the need for the events as the value will be
 in the page context, does not not make 2 requests, and ultimately gets
 the job done. It doesn't seem as elegant to me, but does the job and is
 completely decoupled from the page.

 Still not sure if we've had our epiphany yet :-)

 chris


 Josh Canfield wrote:
 
 I mean really, how is that any simpler than
 dealing directly with query parameters?

 
 Hehe... I have to admit that I was solving a much more complicated
 problem than the original question, probably brought on by an earlier
 request about dynamic component rendering... I was shooting for
 completely decoupled context handling for an unknown assortment of
 components. Say you have 50 potential portlet components on a page
 that may get included multiple times and may or may not add to the
 context of the page, you probably don't want to manage that through
 individual page properties.

 Anyway,
 Isn't the straight forward solution to this problem to use component
 parameters as Joel pointed out? If your NewsQuote component accepts a
 newsId parameter, that binding is bi-directional. When the event
 occurs in the component it calls the setter of the bound parameter,
 which updates the value in the page and gets put 

Re: page activation + components

2008-04-30 Thread János Jarecsni
:15
Bitte antworten an
Tapestry users users@tapestry.apache.org
   
   
An
Tapestry users users@tapestry.apache.org
Kopie
   
Thema
page activation + components
   
   
   
   
   
   
Hi there,
   
I have an activatable page, in its onActivate(String param)
  method
   I
   
   
save
   
   
the param to a normal instance variable of the page class (no
persistence!).
How can any component embedded within this page access this
   variable?
   
the page class:
   
//...
private String param;
   
public void onActivate(String param) {
   this.param = param;
}
   
   
public String getParam() {...}
   
   
Thx in advance!
Janos
   
   
   
   
   
--
http://thegodcode.net
   
   
   
   -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
   
--
http://thegodcode.net
   
   
   
  -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
  
   --
   http://thegodcode.net
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 


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




Re: page activation + components

2008-04-30 Thread Kristian Marinkovic
if you inject the Tapestry Request services - available in any pages, 
components
and mixins - you can access the HttpSession in an abstract way via the 
Session 
interface. If you want the real stuff you can inject the RequestGlobals 
instance :)

nevertheless i'd not use the HttpSession directly but try to use one of 
the provided
services to do so. For example you can inject the ApplicationStateManager 
to 
put/get instances from the HttpSession. The only thing you have to be 
aware of
is that if you put in a instance with the classname foo.class any page 
that declares
@ApplicationState Foo f; will have this instance 

you could also use a PropertyShadowBuilder to abstract the access to a 
certain
property/attribute  of the HttpSession ... but that's another story :)

i'm still not sure what your use-case is. if you elaborate more on your 
problem 
will probably be able to give a more concise advice :)

g,
kris




János Jarecsni [EMAIL PROTECTED] 
30.04.2008 08:50
Bitte antworten an
Tapestry users users@tapestry.apache.org


An
Tapestry users users@tapestry.apache.org
Kopie

Thema
Re: page activation + components






Hi,

thx for the info! Another idea... is there a HttpRequest like object
available to components and pages? If it were, then setting a request
attribute would be ok for me. Anyway the per-request service is similar to
this, so it will be ok for me.

thx again
janos

2008/4/29 Andy Huhn [EMAIL PROTECTED]:


 Hello,

 You can define the scope of each service...you can set that particular
 service to be tied to only one session.

 See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html, and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:
  Hi there,
 
  the service approach (as I expected) is session-agnostic (and is
  page-independent so concurrent users would interfere badly), therefore
 is
  not ok.
 
  I will now try the Environment approach... if that is session-aware :)
 
  thx again
  janos
 
  2008/4/29 János Jarecsni [EMAIL PROTECTED]:
 
  Hi Chris,
 
  even so you could help :) I want this kind of generic way of passing
  around information (component to component communication :)) so I'll
  look
  for the solutions Kristian and you outlined.
 
  thanks!
 
  cheers,
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
   Janos,
  
   Without code or a description of your actual goal, I'm finding your
   situation too hypothetical to really digest. The one thing I can
 point
   out is what you said about wanting a component to set a property in
  the
   page. If you want to do that, then you have to know the class of 
the
   page and so injecting a page would make sense. Of course that means
   tightly coupling a component to a page, which to me doesn't make
  sense.
   If you simply need a generic way of passing data between pages and
   components, consider using a service that provides an untyped list 
or
   putting something in the environment as Kristian suggested. I'm 
sorry
  I
   can't be more helpful but as I said I'm not clear on what you're
  really
   trying to do.
  
   good luck
   chris
  
   János Jarecsni wrote:
Hi Chris,
   
I thought of pages as contexts for the components embedded 
within
   them.
So, in one event handler of a component I would like to set some
   property or
another (in the page object), and the other components in the 
page,
   which
are also able to access this property may change their appearance
   (say, the
.TML would test the property). Maybe I'm on a wrong track, please
  let
   me
know :)
   
thx
Cheers,
janos
   
2008/4/29 Chris Lewis [EMAIL PROTECTED]:
   
   
Janos,
   
I'm having a hard time understanding a case that a component
 should
   know
in which page it is embedded, so my suggestion probably wasn't a
  good
one. Activation contexts aren't meant for components but for 
pages
  -
   you
should be using component parameters to configure them, and if
 it's
  a
more sophisticated component, probably a service.
   
chris
   
János Jarecsni wrote:
   
and how a component can get to know the page in which it is
   included? I
mean, I can't @InjectPage, as the component will be included in
  many
   
kinds
   
of pages.
   
@Kristian: thx for the many ways :) I'll try these, hope that 
the
@Environmental stuff is scalable (I'm trying to bypass session
   creation
   
as
   
much as possible)
   
Is there a doc on the various annotations available?
   
@Michael:
Could you include a tiny bit of example? THX!
   
Thx to you all
cheers
janos
   
2008/4/29 Chris Lewis [EMAIL PROTECTED]:
   
   
   
5) @InjectPage the page and call the getter
   
Kristian Marinkovic wrote:
   
   
hi janos,
   
there are several possibilities:
   
1) declare a component parameter and pass in the variable
   
2) put

Re: page activation + components

2008-04-30 Thread János Jarecsni
 understanding a case that a component
  should
know
 in which page it is embedded, so my suggestion probably wasn't a
   good
 one. Activation contexts aren't meant for components but for
  pages
   -
you
 should be using component parameters to configure them, and if
  it's
   a
 more sophisticated component, probably a service.

 chris

 János Jarecsni wrote:

 and how a component can get to know the page in which it is
included? I
 mean, I can't @InjectPage, as the component will be included in
   many

 kinds

 of pages.

 @Kristian: thx for the many ways :) I'll try these, hope that
  the
 @Environmental stuff is scalable (I'm trying to bypass session
creation

 as

 much as possible)

 Is there a doc on the various annotations available?

 @Michael:
 Could you include a tiny bit of example? THX!

 Thx to you all
 cheers
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:



 5) @InjectPage the page and call the getter

 Kristian Marinkovic wrote:


 hi janos,

 there are several possibilities:

 1) declare a component parameter and pass in the variable

 2) put it in a ASO and inject the ASO in all your components
(using
 @ApplicationState)
 the drawback is that any other page or component will be able
  to

 access

 the ASO

 3) put it into the Environment and read it whereever you need
  it
in

 your

 nested components.
 be careful when you put your object in your environment. if
  you
put it


 in


 during the action
 request it will not be able in the render request (because of
   the
page
 redirect).

 page:

 @Inject Environment env;

 @Persist(flash) whateverclass w;

 onActivate(w) {  this.w= w }

 setupRender() { env.push(whateverclass.class,w);}

 components:

 @Environmental Whateverclass var;

 4) define a service that can take this variable (and saves it


 appropriatly


 so it is not
 lost on a redirect:)) and inject your service in the
  components
where
 needed
 to retrieve the value.

 maybe there are some more possibilities :)

 g,
 kris




 János Jarecsni [EMAIL PROTECTED]
 29.04.2008 08:15
 Bitte antworten an
 Tapestry users users@tapestry.apache.org


 An
 Tapestry users users@tapestry.apache.org
 Kopie

 Thema
 page activation + components






 Hi there,

 I have an activatable page, in its onActivate(String param)
   method
I


 save


 the param to a normal instance variable of the page class (no
 persistence!).
 How can any component embedded within this page access this
variable?

 the page class:

 //...
 private String param;

 public void onActivate(String param) {
this.param = param;
 }


 public String getParam() {...}


 Thx in advance!
 Janos





 --
 http://thegodcode.net



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




 --
 http://thegodcode.net



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



   
--
http://thegodcode.net
   
   
   
  -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
  
  
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: page activation + components

2008-04-30 Thread János Jarecsni
Hi Kris,
I'd like to avoid the session - as far as possible, say until login has
done. What I'd like to do is to set a value in the request in one component
and read that value in another component (or the page itself) (both
components are in the same page). Like in the example I sent: the action
link event handler sets the attribute and the page tries to display that
(with no effect :))

hope this is more concrete - and thx you haven't given up helping me out :)

janos

2008/4/30 Kristian Marinkovic [EMAIL PROTECTED]:

 if you inject the Tapestry Request services - available in any pages,
 components
 and mixins - you can access the HttpSession in an abstract way via the
 Session
 interface. If you want the real stuff you can inject the RequestGlobals
 instance :)

 nevertheless i'd not use the HttpSession directly but try to use one of
 the provided
 services to do so. For example you can inject the ApplicationStateManager
 to
 put/get instances from the HttpSession. The only thing you have to be
 aware of
 is that if you put in a instance with the classname foo.class any page
 that declares
 @ApplicationState Foo f; will have this instance

 you could also use a PropertyShadowBuilder to abstract the access to a
 certain
 property/attribute  of the HttpSession ... but that's another story :)

 i'm still not sure what your use-case is. if you elaborate more on your
 problem
 will probably be able to give a more concise advice :)

 g,
 kris




 János Jarecsni [EMAIL PROTECTED]
 30.04.2008 08:50
 Bitte antworten an
 Tapestry users users@tapestry.apache.org


 An
 Tapestry users users@tapestry.apache.org
 Kopie

 Thema
 Re: page activation + components






 Hi,

 thx for the info! Another idea... is there a HttpRequest like object
 available to components and pages? If it were, then setting a request
 attribute would be ok for me. Anyway the per-request service is similar to
 this, so it will be ok for me.

 thx again
 janos

 2008/4/29 Andy Huhn [EMAIL PROTECTED]:

 
  Hello,
 
  You can define the scope of each service...you can set that particular
  service to be tied to only one session.
 
  See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html, and
  search for perthread.
 
  Thanks,
  Andy
 
  On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
  [EMAIL PROTECTED] wrote:
   Hi there,
  
   the service approach (as I expected) is session-agnostic (and is
   page-independent so concurrent users would interfere badly), therefore
  is
   not ok.
  
   I will now try the Environment approach... if that is session-aware :)
  
   thx again
   janos
  
   2008/4/29 János Jarecsni [EMAIL PROTECTED]:
  
   Hi Chris,
  
   even so you could help :) I want this kind of generic way of passing
   around information (component to component communication :)) so I'll
   look
   for the solutions Kristian and you outlined.
  
   thanks!
  
   cheers,
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
Janos,
   
Without code or a description of your actual goal, I'm finding your
situation too hypothetical to really digest. The one thing I can
  point
out is what you said about wanting a component to set a property in
   the
page. If you want to do that, then you have to know the class of
 the
page and so injecting a page would make sense. Of course that means
tightly coupling a component to a page, which to me doesn't make
   sense.
If you simply need a generic way of passing data between pages and
components, consider using a service that provides an untyped list
 or
putting something in the environment as Kristian suggested. I'm
 sorry
   I
can't be more helpful but as I said I'm not clear on what you're
   really
trying to do.
   
good luck
chris
   
János Jarecsni wrote:
 Hi Chris,

 I thought of pages as contexts for the components embedded
 within
them.
 So, in one event handler of a component I would like to set some
property or
 another (in the page object), and the other components in the
 page,
which
 are also able to access this property may change their appearance
(say, the
 .TML would test the property). Maybe I'm on a wrong track, please
   let
me
 know :)

 thx
 Cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:


 Janos,

 I'm having a hard time understanding a case that a component
  should
know
 in which page it is embedded, so my suggestion probably wasn't a
   good
 one. Activation contexts aren't meant for components but for
 pages
   -
you
 should be using component parameters to configure them, and if
  it's
   a
 more sophisticated component, probably a service.

 chris

 János Jarecsni wrote:

 and how a component can get to know the page in which it is
included? I
 mean, I can't @InjectPage, as the component will be included in
   many

 kinds

RE: page activation + components

2008-04-30 Thread Blower, Andy
This is not what I understood 'perthread' scope to be. I thought that it meant 
that each thread using a service gets its own instance of the service to use, 
even though that instance may not be the same as any previous instance it used. 
In other words, nothing to do with user sessions, it's just for services that 
are not thread safe and cannot be singletons.

Have I got the wrong end of the stick here?

 -Original Message-
 From: Andy Huhn [mailto:[EMAIL PROTECTED]
 Sent: 29 April 2008 17:34
 To: Tapestry users
 Subject: Re: page activation + components


 Hello,

 You can define the scope of each service...you can set that particular
 service to be tied to only one session.

 See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html, and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:
  Hi there,
 
  the service approach (as I expected) is session-agnostic (and is
  page-independent so concurrent users would interfere badly),
 therefore is
  not ok.
 
  I will now try the Environment approach... if that is session-aware
 :)
 
  thx again
  janos
 
  2008/4/29 János Jarecsni [EMAIL PROTECTED]:
 
  Hi Chris,
 
  even so you could help :) I want this kind of generic way of passing
  around information (component to component communication :)) so I'll
  look
  for the solutions Kristian and you outlined.
 
  thanks!
 
  cheers,
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
   Janos,
  
   Without code or a description of your actual goal, I'm finding
 your
   situation too hypothetical to really digest. The one thing I can
 point
   out is what you said about wanting a component to set a property
 in
  the
   page. If you want to do that, then you have to know the class of
 the
   page and so injecting a page would make sense. Of course that
 means
   tightly coupling a component to a page, which to me doesn't make
  sense.
   If you simply need a generic way of passing data between pages and
   components, consider using a service that provides an untyped list
 or
   putting something in the environment as Kristian suggested. I'm
 sorry
  I
   can't be more helpful but as I said I'm not clear on what you're
  really
   trying to do.
  
   good luck
   chris
  
   János Jarecsni wrote:
Hi Chris,
   
I thought of pages as contexts for the components embedded
 within
   them.
So, in one event handler of a component I would like to set some
   property or
another (in the page object), and the other components in the
 page,
   which
are also able to access this property may change their
 appearance
   (say, the
.TML would test the property). Maybe I'm on a wrong track,
 please
  let
   me
know :)
   
thx
Cheers,
janos
   
2008/4/29 Chris Lewis [EMAIL PROTECTED]:
   
   
Janos,
   
I'm having a hard time understanding a case that a component
 should
   know
in which page it is embedded, so my suggestion probably wasn't
 a
  good
one. Activation contexts aren't meant for components but for
 pages
  -
   you
should be using component parameters to configure them, and if
 it's
  a
more sophisticated component, probably a service.
   
chris
   
János Jarecsni wrote:
   
and how a component can get to know the page in which it is
   included? I
mean, I can't @InjectPage, as the component will be included
 in
  many
   
kinds
   
of pages.
   
@Kristian: thx for the many ways :) I'll try these, hope that
 the
@Environmental stuff is scalable (I'm trying to bypass session
   creation
   
as
   
much as possible)
   
Is there a doc on the various annotations available?
   
@Michael:
Could you include a tiny bit of example? THX!
   
Thx to you all
cheers
janos
   
2008/4/29 Chris Lewis [EMAIL PROTECTED]:
   
   
   
5) @InjectPage the page and call the getter
   
Kristian Marinkovic wrote:
   
   
hi janos,
   
there are several possibilities:
   
1) declare a component parameter and pass in the variable
   
2) put it in a ASO and inject the ASO in all your components
   (using
@ApplicationState)
the drawback is that any other page or component will be
 able to
   
access
   
the ASO
   
3) put it into the Environment and read it whereever you
 need it
   in
   
your
   
nested components.
be careful when you put your object in your environment. if
 you
   put it
   
   
in
   
   
during the action
request it will not be able in the render request (because
 of
  the
   page
redirect).
   
page:
   
@Inject Environment env;
   
@Persist(flash) whateverclass w;
   
onActivate(w) {  this.w= w }
   
setupRender() { env.push(whateverclass.class,w);}
   
components:
   
@Environmental Whateverclass var;
   
4) define a service that can take this variable (and saves
 it
   
   
appropriatly

Re: page activation + components

2008-04-30 Thread János Jarecsni
No, I think then I misunderstood you :)
The essential thing, is I'd like to have something similar to request scoped
variables... something that would be available to all components and the
page itself in the same request. Intention is to avoid creating a session as
far as possible.

thx!
cheers
janos

2008/4/30 Blower, Andy [EMAIL PROTECTED]:

 This is not what I understood 'perthread' scope to be. I thought that it
 meant that each thread using a service gets its own instance of the service
 to use, even though that instance may not be the same as any previous
 instance it used. In other words, nothing to do with user sessions, it's
 just for services that are not thread safe and cannot be singletons.

 Have I got the wrong end of the stick here?

  -Original Message-
  From: Andy Huhn [mailto:[EMAIL PROTECTED]
  Sent: 29 April 2008 17:34
  To: Tapestry users
  Subject: Re: page activation + components
 
 
  Hello,
 
  You can define the scope of each service...you can set that particular
  service to be tied to only one session.
 
  See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html, and
  search for perthread.
 
  Thanks,
  Andy
 
  On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
  [EMAIL PROTECTED] wrote:
   Hi there,
  
   the service approach (as I expected) is session-agnostic (and is
   page-independent so concurrent users would interfere badly),
  therefore is
   not ok.
  
   I will now try the Environment approach... if that is session-aware
  :)
  
   thx again
   janos
  
   2008/4/29 János Jarecsni [EMAIL PROTECTED]:
  
   Hi Chris,
  
   even so you could help :) I want this kind of generic way of passing
   around information (component to component communication :)) so I'll
   look
   for the solutions Kristian and you outlined.
  
   thanks!
  
   cheers,
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
Janos,
   
Without code or a description of your actual goal, I'm finding
  your
situation too hypothetical to really digest. The one thing I can
  point
out is what you said about wanting a component to set a property
  in
   the
page. If you want to do that, then you have to know the class of
  the
page and so injecting a page would make sense. Of course that
  means
tightly coupling a component to a page, which to me doesn't make
   sense.
If you simply need a generic way of passing data between pages and
components, consider using a service that provides an untyped list
  or
putting something in the environment as Kristian suggested. I'm
  sorry
   I
can't be more helpful but as I said I'm not clear on what you're
   really
trying to do.
   
good luck
chris
   
János Jarecsni wrote:
 Hi Chris,

 I thought of pages as contexts for the components embedded
  within
them.
 So, in one event handler of a component I would like to set some
property or
 another (in the page object), and the other components in the
  page,
which
 are also able to access this property may change their
  appearance
(say, the
 .TML would test the property). Maybe I'm on a wrong track,
  please
   let
me
 know :)

 thx
 Cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:


 Janos,

 I'm having a hard time understanding a case that a component
  should
know
 in which page it is embedded, so my suggestion probably wasn't
  a
   good
 one. Activation contexts aren't meant for components but for
  pages
   -
you
 should be using component parameters to configure them, and if
  it's
   a
 more sophisticated component, probably a service.

 chris

 János Jarecsni wrote:

 and how a component can get to know the page in which it is
included? I
 mean, I can't @InjectPage, as the component will be included
  in
   many

 kinds

 of pages.

 @Kristian: thx for the many ways :) I'll try these, hope that
  the
 @Environmental stuff is scalable (I'm trying to bypass session
creation

 as

 much as possible)

 Is there a doc on the various annotations available?

 @Michael:
 Could you include a tiny bit of example? THX!

 Thx to you all
 cheers
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:



 5) @InjectPage the page and call the getter

 Kristian Marinkovic wrote:


 hi janos,

 there are several possibilities:

 1) declare a component parameter and pass in the variable

 2) put it in a ASO and inject the ASO in all your components
(using
 @ApplicationState)
 the drawback is that any other page or component will be
  able to

 access

 the ASO

 3) put it into the Environment and read it whereever you
  need it
in

 your

 nested components.
 be careful when you

Re: page activation + components

2008-04-30 Thread Filip S. Adamsen

Nope, you're exactly right.

-Filip

Blower, Andy skrev:

This is not what I understood 'perthread' scope to be. I thought that it meant 
that each thread using a service gets its own instance of the service to use, 
even though that instance may not be the same as any previous instance it used. 
In other words, nothing to do with user sessions, it's just for services that 
are not thread safe and cannot be singletons.

Have I got the wrong end of the stick here?


-Original Message-
From: Andy Huhn [mailto:[EMAIL PROTECTED]
Sent: 29 April 2008 17:34
To: Tapestry users
Subject: Re: page activation + components


Hello,

You can define the scope of each service...you can set that particular
service to be tied to only one session.

See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html, and
search for perthread.

Thanks,
Andy

On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
[EMAIL PROTECTED] wrote:

Hi there,

the service approach (as I expected) is session-agnostic (and is
page-independent so concurrent users would interfere badly),

therefore is

not ok.

I will now try the Environment approach... if that is session-aware

:)

thx again
janos

2008/4/29 János Jarecsni [EMAIL PROTECTED]:


Hi Chris,

even so you could help :) I want this kind of generic way of passing
around information (component to component communication :)) so I'll

look

for the solutions Kristian and you outlined.

thanks!

cheers,
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:


Janos,

Without code or a description of your actual goal, I'm finding

your

situation too hypothetical to really digest. The one thing I can

point

out is what you said about wanting a component to set a property

in

the

page. If you want to do that, then you have to know the class of

the

page and so injecting a page would make sense. Of course that

means

tightly coupling a component to a page, which to me doesn't make

sense.

If you simply need a generic way of passing data between pages and
components, consider using a service that provides an untyped list

or

putting something in the environment as Kristian suggested. I'm

sorry

I

can't be more helpful but as I said I'm not clear on what you're

really

trying to do.

good luck
chris

János Jarecsni wrote:

Hi Chris,

I thought of pages as contexts for the components embedded

within

them.

So, in one event handler of a component I would like to set some

property or

another (in the page object), and the other components in the

page,

which

are also able to access this property may change their

appearance

(say, the

.TML would test the property). Maybe I'm on a wrong track,

please

let

me

know :)

thx
Cheers,
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:



Janos,

I'm having a hard time understanding a case that a component

should

know

in which page it is embedded, so my suggestion probably wasn't

a

good

one. Activation contexts aren't meant for components but for

pages

-

you

should be using component parameters to configure them, and if

it's

a

more sophisticated component, probably a service.

chris

János Jarecsni wrote:


and how a component can get to know the page in which it is

included? I

mean, I can't @InjectPage, as the component will be included

in

many

kinds


of pages.

@Kristian: thx for the many ways :) I'll try these, hope that

the

@Environmental stuff is scalable (I'm trying to bypass session

creation

as


much as possible)

Is there a doc on the various annotations available?

@Michael:
Could you include a tiny bit of example? THX!

Thx to you all
cheers
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:




5) @InjectPage the page and call the getter

Kristian Marinkovic wrote:



hi janos,

there are several possibilities:

1) declare a component parameter and pass in the variable

2) put it in a ASO and inject the ASO in all your components

(using

@ApplicationState)
the drawback is that any other page or component will be

able to

access


the ASO

3) put it into the Environment and read it whereever you

need it

in

your


nested components.
be careful when you put your object in your environment. if

you

put it



in



during the action
request it will not be able in the render request (because

of

the

page

redirect).

page:

@Inject Environment env;

@Persist(flash) whateverclass w;

onActivate(w) {  this.w= w }

setupRender() { env.push(whateverclass.class,w);}

components:

@Environmental Whateverclass var;

4) define a service that can take this variable (and saves

it



appropriatly



so it is not
lost on a redirect:)) and inject your service in the

components

where

needed
to retrieve the value.

maybe there are some more possibilities :)

g,
kris




János Jarecsni [EMAIL PROTECTED]
29.04.2008 08:15
Bitte antworten an
Tapestry users users@tapestry.apache.org


An
Tapestry users users@tapestry.apache.org
Kopie

Thema
page activation + components






Hi there,

I have an activatable page, in its

Re: page activation + components

2008-04-30 Thread Filip S. Adamsen
This is not what @Retain is for. If you use it, the value won't be 
cleared out at the end of the request.


http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/annotations/Retain.html

-Filip

Michael Gerzabek skrev:
6) @Retain could do the job. Your String will be available until the end 
of the request.



János Jarecsni schrieb:

Hi there,

I have an activatable page, in its onActivate(String param) method I save
the param to a normal instance variable of the page class (no 
persistence!).

How can any component embedded within this page access this variable?

the page class:

//...
private String param;

public void onActivate(String param) {
   this.param = param;
}


public String getParam() {...}


Thx in advance!
Janos

  



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



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



Re: page activation + components

2008-04-30 Thread János Jarecsni
Hi,

I looked everywhere for usage of request scope variables, but found nothing
(maybe I'm impatient a bit :)...
Is it really that unrealistic to have two components in a page, one (A)
having an action link eventhandler where it would set some attribute for the
request only (not the session!) and then component B could render itself
according to the attribute set by component A?

I think it should be a piece of cake :)

thx
Janos

2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:

 Nope, you're exactly right.

 -Filip

 Blower, Andy skrev:

  This is not what I understood 'perthread' scope to be. I thought that it
  meant that each thread using a service gets its own instance of the service
  to use, even though that instance may not be the same as any previous
  instance it used. In other words, nothing to do with user sessions, it's
  just for services that are not thread safe and cannot be singletons.
 
  Have I got the wrong end of the stick here?
 
   -Original Message-
   From: Andy Huhn [mailto:[EMAIL PROTECTED]
   Sent: 29 April 2008 17:34
   To: Tapestry users
   Subject: Re: page activation + components
  
  
   Hello,
  
   You can define the scope of each service...you can set that particular
   service to be tied to only one session.
  
   See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
   and
   search for perthread.
  
   Thanks,
   Andy
  
   On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
   [EMAIL PROTECTED] wrote:
  
Hi there,
   
the service approach (as I expected) is session-agnostic (and is
page-independent so concurrent users would interfere badly),
   
   therefore is
  
not ok.
   
I will now try the Environment approach... if that is session-aware
   
   :)
  
thx again
janos
   
2008/4/29 János Jarecsni [EMAIL PROTECTED]:
   
 Hi Chris,

 even so you could help :) I want this kind of generic way of
 passing
 around information (component to component communication :)) so
 I'll

look
   
 for the solutions Kristian and you outlined.

 thanks!

 cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  Janos,
 
  Without code or a description of your actual goal, I'm finding
 
 your
  
situation too hypothetical to really digest. The one thing I can
 
 point
  
out is what you said about wanting a component to set a property
 
 in
  
the
   
 page. If you want to do that, then you have to know the class of
 
 the
  
page and so injecting a page would make sense. Of course that
 
 means
  
tightly coupling a component to a page, which to me doesn't make
 
 sense.
   
 If you simply need a generic way of passing data between pages and
  components, consider using a service that provides an untyped
  list
 
 or
  
putting something in the environment as Kristian suggested. I'm
 
 sorry
  
I
   
 can't be more helpful but as I said I'm not clear on what you're
 
 really
   
 trying to do.
 
  good luck
  chris
 
  János Jarecsni wrote:
 
   Hi Chris,
  
   I thought of pages as contexts for the components embedded
  
  within
  
them.
 
   So, in one event handler of a component I would like to set
   some
  
  property or
 
   another (in the page object), and the other components in the
  
  page,
  
which
 
   are also able to access this property may change their
  
  appearance
  
(say, the
 
   .TML would test the property). Maybe I'm on a wrong track,
  
  please
  
let
   
 me
 
   know :)
  
   thx
   Cheers,
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
  
Janos,
   
I'm having a hard time understanding a case that a component
   
   should
  
know
 
   in which page it is embedded, so my suggestion probably wasn't
   
   a
  
good
   
 one. Activation contexts aren't meant for components but for
   
   pages
  
-
   
 you
 
   should be using component parameters to configure them, and if
   
   it's
  
a
   
 more sophisticated component, probably a service.
   
chris
   
János Jarecsni wrote:
   
 and how a component can get to know the page in which it is

included? I
 
   mean, I can't @InjectPage, as the component will be included

in
  
many
   
 kinds
   
 of pages.

 @Kristian: thx for the many ways :) I'll try these, hope
 that

the
  
@Environmental stuff is scalable (I'm trying to bypass session

creation
 
   as
   
 much as possible

Re: page activation + components

2008-04-30 Thread János Jarecsni
Maybe the request approach does not work, as T5 has two requests
action+render following each other? And the request attributes are reset
between them?

Janos

2008/4/30 János Jarecsni [EMAIL PROTECTED]:

 No, I think then I misunderstood you :)
 The essential thing, is I'd like to have something similar to request
 scoped variables... something that would be available to all components and
 the page itself in the same request. Intention is to avoid creating a
 session as far as possible.

 thx!
 cheers
 janos

 2008/4/30 Blower, Andy [EMAIL PROTECTED]:

 This is not what I understood 'perthread' scope to be. I thought that it
  meant that each thread using a service gets its own instance of the service
  to use, even though that instance may not be the same as any previous
  instance it used. In other words, nothing to do with user sessions, it's
  just for services that are not thread safe and cannot be singletons.
 
  Have I got the wrong end of the stick here?
 
   -Original Message-
   From: Andy Huhn [mailto:[EMAIL PROTECTED]
   Sent: 29 April 2008 17:34
   To: Tapestry users
   Subject: Re: page activation + components
  
  
   Hello,
  
   You can define the scope of each service...you can set that particular
   service to be tied to only one session.
  
   See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
  and
   search for perthread.
  
   Thanks,
   Andy
  
   On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
   [EMAIL PROTECTED] wrote:
Hi there,
   
the service approach (as I expected) is session-agnostic (and is
page-independent so concurrent users would interfere badly),
   therefore is
not ok.
   
I will now try the Environment approach... if that is session-aware
   :)
   
thx again
janos
   
2008/4/29 János Jarecsni [EMAIL PROTECTED]:
   
Hi Chris,
   
even so you could help :) I want this kind of generic way of
  passing
around information (component to component communication :)) so
  I'll
look
for the solutions Kristian and you outlined.
   
thanks!
   
cheers,
janos
   
2008/4/29 Chris Lewis [EMAIL PROTECTED]:
   
 Janos,

 Without code or a description of your actual goal, I'm finding
   your
 situation too hypothetical to really digest. The one thing I can
   point
 out is what you said about wanting a component to set a property
   in
the
 page. If you want to do that, then you have to know the class of
   the
 page and so injecting a page would make sense. Of course that
   means
 tightly coupling a component to a page, which to me doesn't make
sense.
 If you simply need a generic way of passing data between pages
  and
 components, consider using a service that provides an untyped
  list
   or
 putting something in the environment as Kristian suggested. I'm
   sorry
I
 can't be more helpful but as I said I'm not clear on what you're
really
 trying to do.

 good luck
 chris

 János Jarecsni wrote:
  Hi Chris,
 
  I thought of pages as contexts for the components embedded
   within
 them.
  So, in one event handler of a component I would like to set
  some
 property or
  another (in the page object), and the other components in the
   page,
 which
  are also able to access this property may change their
   appearance
 (say, the
  .TML would test the property). Maybe I'm on a wrong track,
   please
let
 me
  know :)
 
  thx
  Cheers,
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
 
  Janos,
 
  I'm having a hard time understanding a case that a component
   should
 know
  in which page it is embedded, so my suggestion probably wasn't
   a
good
  one. Activation contexts aren't meant for components but for
   pages
-
 you
  should be using component parameters to configure them, and if
   it's
a
  more sophisticated component, probably a service.
 
  chris
 
  János Jarecsni wrote:
 
  and how a component can get to know the page in which it is
 included? I
  mean, I can't @InjectPage, as the component will be included
   in
many
 
  kinds
 
  of pages.
 
  @Kristian: thx for the many ways :) I'll try these, hope that
   the
  @Environmental stuff is scalable (I'm trying to bypass
  session
 creation
 
  as
 
  much as possible)
 
  Is there a doc on the various annotations available?
 
  @Michael:
  Could you include a tiny bit of example? THX!
 
  Thx to you all
  cheers
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
 
 
  5) @InjectPage the page and call the getter
 
  Kristian Marinkovic wrote:
 
 
  hi janos,
 
  there are several possibilities:
 
  1) declare a component

Re: page activation + components

2008-04-30 Thread Filip S. Adamsen
That's pretty hard to do without some kind of persistence because of the 
redirect that happens between the component action and the page render.


There's of course tapestry.suppress-redirect-from-action-requests, but I 
would strongly recommend AGAINST using that.


http://tapestry.apache.org/tapestry5/tapestry-core/guide/conf.html

-Filip

János Jarecsni skrev:

Hi,

I looked everywhere for usage of request scope variables, but found nothing
(maybe I'm impatient a bit :)...
Is it really that unrealistic to have two components in a page, one (A)
having an action link eventhandler where it would set some attribute for the
request only (not the session!) and then component B could render itself
according to the attribute set by component A?

I think it should be a piece of cake :)

thx
Janos

2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:


Nope, you're exactly right.

-Filip

Blower, Andy skrev:

 This is not what I understood 'perthread' scope to be. I thought that it

meant that each thread using a service gets its own instance of the service
to use, even though that instance may not be the same as any previous
instance it used. In other words, nothing to do with user sessions, it's
just for services that are not thread safe and cannot be singletons.

Have I got the wrong end of the stick here?

 -Original Message-

From: Andy Huhn [mailto:[EMAIL PROTECTED]
Sent: 29 April 2008 17:34
To: Tapestry users
Subject: Re: page activation + components


Hello,

You can define the scope of each service...you can set that particular
service to be tied to only one session.

See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
and
search for perthread.

Thanks,
Andy

On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
[EMAIL PROTECTED] wrote:


Hi there,

the service approach (as I expected) is session-agnostic (and is
page-independent so concurrent users would interfere badly),


therefore is


not ok.

I will now try the Environment approach... if that is session-aware


:)


thx again
janos

2008/4/29 János Jarecsni [EMAIL PROTECTED]:

 Hi Chris,

even so you could help :) I want this kind of generic way of
passing
around information (component to component communication :)) so
I'll


look


for the solutions Kristian and you outlined.

thanks!

cheers,
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:

 Janos,

Without code or a description of your actual goal, I'm finding


your

situation too hypothetical to really digest. The one thing I can

point

out is what you said about wanting a component to set a property

in

the


page. If you want to do that, then you have to know the class of
the

page and so injecting a page would make sense. Of course that

means

tightly coupling a component to a page, which to me doesn't make

sense.
If you simply need a generic way of passing data between pages and

components, consider using a service that provides an untyped
list


or

putting something in the environment as Kristian suggested. I'm

sorry

I


can't be more helpful but as I said I'm not clear on what you're
really
trying to do.

good luck
chris

János Jarecsni wrote:


Hi Chris,

I thought of pages as contexts for the components embedded


within

them.

So, in one event handler of a component I would like to set
some


property or


another (in the page object), and the other components in the


page,

which

are also able to access this property may change their


appearance

(say, the

.TML would test the property). Maybe I'm on a wrong track,


please

let


me

know :)

thx
Cheers,
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:


 Janos,

I'm having a hard time understanding a case that a component


should

know

in which page it is embedded, so my suggestion probably wasn't
a

good


one. Activation contexts aren't meant for components but for

pages

-


you

should be using component parameters to configure them, and if
it's

a


more sophisticated component, probably a service.

chris

János Jarecsni wrote:

 and how a component can get to know the page in which it is
included? I

mean, I can't @InjectPage, as the component will be included

in

many


kinds

 of pages.

@Kristian: thx for the many ways :) I'll try these, hope
that


the

@Environmental stuff is scalable (I'm trying to bypass session

creation

as

 much as possible)

Is there a doc on the various annotations available?

@Michael:
Could you include a tiny bit of example? THX!

Thx to you all
cheers
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:



 5) @InjectPage the page and call the getter

Kristian Marinkovic wrote:


 hi janos,

there are several possibilities:

1) declare a component parameter and pass in the
variable

2) put it in a ASO and inject the ASO in all your
components


(using

@ApplicationState)

the drawback is that any other page or component will
be


able to

access

 the ASO

3) put it into the Environment and read it whereever
you


need it

in

your

 nested components.

be careful

Re: page activation + components

2008-04-30 Thread Chris Lewis
Honestly it's difficult for me to imagine a situation where I'd do that
because it seems to violate a degree of encapsulation that tapestry
imposes as a freeing law of the framework. The epicenter of that being
that one should not think in terms of low-level idioms such as request
parameters, and instead replace those with a higher level of application
logic that eclipses them entirely (when possible). That's not to say
that your perspective is flawed, but from the small bit of understanding
I've taken from your posts I can't see why one would do what you want.
The thing that I've been saying is missing here is, what are you trying
to do? I don't mean technically, I mean what is the end result for the
user? Understanding this is critical, but even if I don't your problem
can still be solved by using a session to serve as an arbitrary holder.
If you've settled on this architecture, why not write such a generic
service and move on?

János Jarecsni wrote:
 Hi,

 I looked everywhere for usage of request scope variables, but found nothing
 (maybe I'm impatient a bit :)...
 Is it really that unrealistic to have two components in a page, one (A)
 having an action link eventhandler where it would set some attribute for the
 request only (not the session!) and then component B could render itself
 according to the attribute set by component A?

 I think it should be a piece of cake :)

 thx
 Janos

 2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:

   
 Nope, you're exactly right.

 -Filip

 Blower, Andy skrev:

  This is not what I understood 'perthread' scope to be. I thought that it
 
 meant that each thread using a service gets its own instance of the service
 to use, even though that instance may not be the same as any previous
 instance it used. In other words, nothing to do with user sessions, it's
 just for services that are not thread safe and cannot be singletons.

 Have I got the wrong end of the stick here?

  -Original Message-
   
 From: Andy Huhn [mailto:[EMAIL PROTECTED]
 Sent: 29 April 2008 17:34
 To: Tapestry users
 Subject: Re: page activation + components


 Hello,

 You can define the scope of each service...you can set that particular
 service to be tied to only one session.

 See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
 and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:

 
 Hi there,

 the service approach (as I expected) is session-agnostic (and is
 page-independent so concurrent users would interfere badly),

   
 therefore is

 
 not ok.

 I will now try the Environment approach... if that is session-aware

   
 :)

 
 thx again
 janos

 2008/4/29 János Jarecsni [EMAIL PROTECTED]:

  Hi Chris,
   
 even so you could help :) I want this kind of generic way of
 passing
 around information (component to component communication :)) so
 I'll

 
 look

   
 for the solutions Kristian and you outlined.

 thanks!

 cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  Janos,
 
 Without code or a description of your actual goal, I'm finding

   
 your
 
 situation too hypothetical to really digest. The one thing I can
   
 point
 
 out is what you said about wanting a component to set a property
   
 in
 
 the

   
 page. If you want to do that, then you have to know the class of
 
 the
 
 page and so injecting a page would make sense. Of course that
   
 means
 
 tightly coupling a component to a page, which to me doesn't make
   
 sense.
 
 If you simply need a generic way of passing data between pages and
 
 components, consider using a service that provides an untyped
 list

   
 or
 
 putting something in the environment as Kristian suggested. I'm
   
 sorry
 
 I

   
 can't be more helpful but as I said I'm not clear on what you're
 
 really
 
 trying to do.
 
 good luck
 chris

 János Jarecsni wrote:

   
 Hi Chris,

 I thought of pages as contexts for the components embedded

 
 within
   
 them.
   
 So, in one event handler of a component I would like to set
 some

 
 property or

   
 another (in the page object), and the other components in the

 
 page,
   
 which
   
 are also able to access this property may change their

 
 appearance
   
 (say, the
   
 .TML would test the property). Maybe I'm on a wrong track,

 
 please
   
 let

   
 me
 
 know :)

 thx
 Cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:


  Janos,
 
 I'm having a hard time

Re: page activation + components

2008-04-30 Thread János Jarecsni
Hi
and thx for the info! why would you discourage from doing so? (I will read
the page you sent now).
cheers
janos

2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:

 That's pretty hard to do without some kind of persistence because of the
 redirect that happens between the component action and the page render.

 There's of course tapestry.suppress-redirect-from-action-requests, but I
 would strongly recommend AGAINST using that.

 http://tapestry.apache.org/tapestry5/tapestry-core/guide/conf.html

 -Filip

 János Jarecsni skrev:

  Hi,
 
  I looked everywhere for usage of request scope variables, but found
  nothing
  (maybe I'm impatient a bit :)...
  Is it really that unrealistic to have two components in a page, one (A)
  having an action link eventhandler where it would set some attribute for
  the
  request only (not the session!) and then component B could render itself
  according to the attribute set by component A?
 
  I think it should be a piece of cake :)
 
  thx
  Janos
 
  2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:
 
   Nope, you're exactly right.
  
   -Filip
  
   Blower, Andy skrev:
  
This is not what I understood 'perthread' scope to be. I thought that
   it
  
meant that each thread using a service gets its own instance of the
service
to use, even though that instance may not be the same as any
previous
instance it used. In other words, nothing to do with user sessions,
it's
just for services that are not thread safe and cannot be singletons.
   
Have I got the wrong end of the stick here?
   
 -Original Message-
   
 From: Andy Huhn [mailto:[EMAIL PROTECTED]
 Sent: 29 April 2008 17:34
 To: Tapestry users
 Subject: Re: page activation + components


 Hello,

 You can define the scope of each service...you can set that
 particular
 service to be tied to only one session.

 See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html
 ,
 and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:

  Hi there,
 
  the service approach (as I expected) is session-agnostic (and is
  page-independent so concurrent users would interfere badly),
 
   therefore is

  not ok.
 
  I will now try the Environment approach... if that is
  session-aware
 
   :)

  thx again
  janos
 
  2008/4/29 János Jarecsni [EMAIL PROTECTED]:
 
   Hi Chris,
 
   even so you could help :) I want this kind of generic way of
   passing
   around information (component to component communication :))
   so
   I'll
  
look
 
   for the solutions Kristian and you outlined.
  
   thanks!
  
   cheers,
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
Janos,
  
Without code or a description of your actual goal, I'm
finding
   
 your
  
  situation too hypothetical to really digest. The one thing I can
 
   point
  
  out is what you said about wanting a component to set a property
 
   in
  
  the
 
   page. If you want to do that, then you have to know the class
   of
   the
  
  page and so injecting a page would make sense. Of course that
 
   means
  
  tightly coupling a component to a page, which to me doesn't make
 
   sense.
   If you simply need a generic way of passing data between pages
   and
  
components, consider using a service that provides an
untyped
list
   
 or
  
  putting something in the environment as Kristian suggested. I'm
 
   sorry
  
  I
 
   can't be more helpful but as I said I'm not clear on what
   you're
   really
   trying to do.
  
good luck
chris
   
János Jarecsni wrote:
   
 Hi Chris,

 I thought of pages as contexts for the components
 embedded

  within
   
   them.
 
   So, in one event handler of a component I would like to set
 some

  property or
   
 another (in the page object), and the other components in
 the

  page,
   
   which
 
   are also able to access this property may change their

  appearance
   
   (say, the
 
   .TML would test the property). Maybe I'm on a wrong track,

  please
   
   let
 
   me
  
know :)

 thx
 Cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:


  Janos,

  I'm having a hard time understanding a case

Re: page activation + components

2008-04-30 Thread Chris Lewis
Much clearer :-). When you say when it comes to my 'News' component do
you mean news page? That is, clicking a 'more' link from NewsQuote leads
to a News page?

János Jarecsni wrote:
 Hi Chris,

 I try to explain :)
 Say, you have a NewsQuote component, which shows a few lines from the 5
 latest news. At the and of each quotations, there a More link. Now, when
 the user clicks on this link (an action link, for that matter), the
 NewsQuote component will set a request scope info saying that the news with
 ID=4527 is requested. And when it comes to the News component (it is able
 to show the text of a given news in full), it simply looks at this piece of
 info, and loads the news with id 4527 (or gets it from an app level cache
 :)) and renders it.

 Hope it tells something about what I am up to :)

 thx
 Janos

 2008/4/30 Chris Lewis [EMAIL PROTECTED]:

   
 Honestly it's difficult for me to imagine a situation where I'd do that
 because it seems to violate a degree of encapsulation that tapestry
 imposes as a freeing law of the framework. The epicenter of that being
 that one should not think in terms of low-level idioms such as request
 parameters, and instead replace those with a higher level of application
 logic that eclipses them entirely (when possible). That's not to say
 that your perspective is flawed, but from the small bit of understanding
 I've taken from your posts I can't see why one would do what you want.
 The thing that I've been saying is missing here is, what are you trying
 to do? I don't mean technically, I mean what is the end result for the
 user? Understanding this is critical, but even if I don't your problem
 can still be solved by using a session to serve as an arbitrary holder.
 If you've settled on this architecture, why not write such a generic
 service and move on?

 János Jarecsni wrote:
 
 Hi,

 I looked everywhere for usage of request scope variables, but found
   
 nothing
 
 (maybe I'm impatient a bit :)...
 Is it really that unrealistic to have two components in a page, one (A)
 having an action link eventhandler where it would set some attribute for
   
 the
 
 request only (not the session!) and then component B could render itself
 according to the attribute set by component A?

 I think it should be a piece of cake :)

 thx
 Janos

 2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:


   
 Nope, you're exactly right.

 -Filip

 Blower, Andy skrev:

  This is not what I understood 'perthread' scope to be. I thought that
 
 it
 
 meant that each thread using a service gets its own instance of the
   
 service
 
 to use, even though that instance may not be the same as any previous
 instance it used. In other words, nothing to do with user sessions,
   
 it's
 
 just for services that are not thread safe and cannot be singletons.

 Have I got the wrong end of the stick here?

  -Original Message-

   
 From: Andy Huhn [mailto:[EMAIL PROTECTED]
 Sent: 29 April 2008 17:34
 To: Tapestry users
 Subject: Re: page activation + components


 Hello,

 You can define the scope of each service...you can set that
 
 particular
 
 service to be tied to only one session.

 See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
 and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:


 
 Hi there,

 the service approach (as I expected) is session-agnostic (and is
 page-independent so concurrent users would interfere badly),


   
 therefore is


 
 not ok.

 I will now try the Environment approach... if that is session-aware


   
 :)


 
 thx again
 janos

 2008/4/29 János Jarecsni [EMAIL PROTECTED]:

  Hi Chris,

   
 even so you could help :) I want this kind of generic way of
 passing
 around information (component to component communication :)) so
 I'll


 
 look


   
 for the solutions Kristian and you outlined.

 thanks!

 cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  Janos,

 
 Without code or a description of your actual goal, I'm finding


   
 your

 
 situation too hypothetical to really digest. The one thing I can

   
 point

 
 out is what you said about wanting a component to set a property

   
 in

 
 the


   
 page. If you want to do that, then you have to know the class of

 the

 
 page and so injecting a page would make sense. Of course that

   
 means

 
 tightly coupling a component to a page, which to me doesn't make

   
 sense.

 If you simply need a generic way of passing data between pages and

 
 components, consider using a service that provides an untyped
 list

Re: page activation + components

2008-04-30 Thread János Jarecsni
Hi Chris,

I try to explain :)
Say, you have a NewsQuote component, which shows a few lines from the 5
latest news. At the and of each quotations, there a More link. Now, when
the user clicks on this link (an action link, for that matter), the
NewsQuote component will set a request scope info saying that the news with
ID=4527 is requested. And when it comes to the News component (it is able
to show the text of a given news in full), it simply looks at this piece of
info, and loads the news with id 4527 (or gets it from an app level cache
:)) and renders it.

Hope it tells something about what I am up to :)

thx
Janos

2008/4/30 Chris Lewis [EMAIL PROTECTED]:

 Honestly it's difficult for me to imagine a situation where I'd do that
 because it seems to violate a degree of encapsulation that tapestry
 imposes as a freeing law of the framework. The epicenter of that being
 that one should not think in terms of low-level idioms such as request
 parameters, and instead replace those with a higher level of application
 logic that eclipses them entirely (when possible). That's not to say
 that your perspective is flawed, but from the small bit of understanding
 I've taken from your posts I can't see why one would do what you want.
 The thing that I've been saying is missing here is, what are you trying
 to do? I don't mean technically, I mean what is the end result for the
 user? Understanding this is critical, but even if I don't your problem
 can still be solved by using a session to serve as an arbitrary holder.
 If you've settled on this architecture, why not write such a generic
 service and move on?

 János Jarecsni wrote:
  Hi,
 
  I looked everywhere for usage of request scope variables, but found
 nothing
  (maybe I'm impatient a bit :)...
  Is it really that unrealistic to have two components in a page, one (A)
  having an action link eventhandler where it would set some attribute for
 the
  request only (not the session!) and then component B could render itself
  according to the attribute set by component A?
 
  I think it should be a piece of cake :)
 
  thx
  Janos
 
  2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:
 
 
  Nope, you're exactly right.
 
  -Filip
 
  Blower, Andy skrev:
 
   This is not what I understood 'perthread' scope to be. I thought that
 it
 
  meant that each thread using a service gets its own instance of the
 service
  to use, even though that instance may not be the same as any previous
  instance it used. In other words, nothing to do with user sessions,
 it's
  just for services that are not thread safe and cannot be singletons.
 
  Have I got the wrong end of the stick here?
 
   -Original Message-
 
  From: Andy Huhn [mailto:[EMAIL PROTECTED]
  Sent: 29 April 2008 17:34
  To: Tapestry users
  Subject: Re: page activation + components
 
 
  Hello,
 
  You can define the scope of each service...you can set that
 particular
  service to be tied to only one session.
 
  See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
  and
  search for perthread.
 
  Thanks,
  Andy
 
  On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
  [EMAIL PROTECTED] wrote:
 
 
  Hi there,
 
  the service approach (as I expected) is session-agnostic (and is
  page-independent so concurrent users would interfere badly),
 
 
  therefore is
 
 
  not ok.
 
  I will now try the Environment approach... if that is session-aware
 
 
  :)
 
 
  thx again
  janos
 
  2008/4/29 János Jarecsni [EMAIL PROTECTED]:
 
   Hi Chris,
 
  even so you could help :) I want this kind of generic way of
  passing
  around information (component to component communication :)) so
  I'll
 
 
  look
 
 
  for the solutions Kristian and you outlined.
 
  thanks!
 
  cheers,
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
   Janos,
 
  Without code or a description of your actual goal, I'm finding
 
 
  your
 
  situation too hypothetical to really digest. The one thing I can
 
  point
 
  out is what you said about wanting a component to set a property
 
  in
 
  the
 
 
  page. If you want to do that, then you have to know the class of
 
  the
 
  page and so injecting a page would make sense. Of course that
 
  means
 
  tightly coupling a component to a page, which to me doesn't make
 
  sense.
 
  If you simply need a generic way of passing data between pages and
 
  components, consider using a service that provides an untyped
  list
 
 
  or
 
  putting something in the environment as Kristian suggested. I'm
 
  sorry
 
  I
 
 
  can't be more helpful but as I said I'm not clear on what you're
 
  really
 
  trying to do.
 
  good luck
  chris
 
  János Jarecsni wrote:
 
 
  Hi Chris,
 
  I thought of pages as contexts for the components embedded
 
 
  within
 
  them.
 
  So, in one event handler of a component I would like to set
  some
 
 
  property or
 
 
  another (in the page object), and the other components in the
 
 
  page,
 
  which
 
  are also able to access this property may

Re: page activation + components

2008-04-30 Thread János Jarecsni
This did the trick! Superb, it works just like I want it :)
Actually, having 2 network roundtrips for a single requests sounds a little
bad doesn't it?

cheers
janos

2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:

 That's pretty hard to do without some kind of persistence because of the
 redirect that happens between the component action and the page render.

 There's of course tapestry.suppress-redirect-from-action-requests, but I
 would strongly recommend AGAINST using that.

 http://tapestry.apache.org/tapestry5/tapestry-core/guide/conf.html

 -Filip

 János Jarecsni skrev:

  Hi,
 
  I looked everywhere for usage of request scope variables, but found
  nothing
  (maybe I'm impatient a bit :)...
  Is it really that unrealistic to have two components in a page, one (A)
  having an action link eventhandler where it would set some attribute for
  the
  request only (not the session!) and then component B could render itself
  according to the attribute set by component A?
 
  I think it should be a piece of cake :)
 
  thx
  Janos
 
  2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:
 
   Nope, you're exactly right.
  
   -Filip
  
   Blower, Andy skrev:
  
This is not what I understood 'perthread' scope to be. I thought that
   it
  
meant that each thread using a service gets its own instance of the
service
to use, even though that instance may not be the same as any
previous
instance it used. In other words, nothing to do with user sessions,
it's
just for services that are not thread safe and cannot be singletons.
   
Have I got the wrong end of the stick here?
   
 -Original Message-
   
 From: Andy Huhn [mailto:[EMAIL PROTECTED]
 Sent: 29 April 2008 17:34
 To: Tapestry users
 Subject: Re: page activation + components


 Hello,

 You can define the scope of each service...you can set that
 particular
 service to be tied to only one session.

 See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html
 ,
 and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:

  Hi there,
 
  the service approach (as I expected) is session-agnostic (and is
  page-independent so concurrent users would interfere badly),
 
   therefore is

  not ok.
 
  I will now try the Environment approach... if that is
  session-aware
 
   :)

  thx again
  janos
 
  2008/4/29 János Jarecsni [EMAIL PROTECTED]:
 
   Hi Chris,
 
   even so you could help :) I want this kind of generic way of
   passing
   around information (component to component communication :))
   so
   I'll
  
look
 
   for the solutions Kristian and you outlined.
  
   thanks!
  
   cheers,
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
Janos,
  
Without code or a description of your actual goal, I'm
finding
   
 your
  
  situation too hypothetical to really digest. The one thing I can
 
   point
  
  out is what you said about wanting a component to set a property
 
   in
  
  the
 
   page. If you want to do that, then you have to know the class
   of
   the
  
  page and so injecting a page would make sense. Of course that
 
   means
  
  tightly coupling a component to a page, which to me doesn't make
 
   sense.
   If you simply need a generic way of passing data between pages
   and
  
components, consider using a service that provides an
untyped
list
   
 or
  
  putting something in the environment as Kristian suggested. I'm
 
   sorry
  
  I
 
   can't be more helpful but as I said I'm not clear on what
   you're
   really
   trying to do.
  
good luck
chris
   
János Jarecsni wrote:
   
 Hi Chris,

 I thought of pages as contexts for the components
 embedded

  within
   
   them.
 
   So, in one event handler of a component I would like to set
 some

  property or
   
 another (in the page object), and the other components in
 the

  page,
   
   which
 
   are also able to access this property may change their

  appearance
   
   (say, the
 
   .TML would test the property). Maybe I'm on a wrong track,

  please
   
   let
 
   me
  
know :)

 thx
 Cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:


  Janos,

  I'm having

Re: page activation + components

2008-04-30 Thread János Jarecsni
Hi Chris,

no! that's the essential part. the same page redisplayed. with the News
component changing state and showing the requested news.

cheers,
janos

2008/4/30 Chris Lewis [EMAIL PROTECTED]:

 Much clearer :-). When you say when it comes to my 'News' component do
 you mean news page? That is, clicking a 'more' link from NewsQuote leads
 to a News page?

 János Jarecsni wrote:
  Hi Chris,
 
  I try to explain :)
  Say, you have a NewsQuote component, which shows a few lines from the
 5
  latest news. At the and of each quotations, there a More link. Now,
 when
  the user clicks on this link (an action link, for that matter), the
  NewsQuote component will set a request scope info saying that the news
 with
  ID=4527 is requested. And when it comes to the News component (it is
 able
  to show the text of a given news in full), it simply looks at this piece
 of
  info, and loads the news with id 4527 (or gets it from an app level
 cache
  :)) and renders it.
 
  Hope it tells something about what I am up to :)
 
  thx
  Janos
 
  2008/4/30 Chris Lewis [EMAIL PROTECTED]:
 
 
  Honestly it's difficult for me to imagine a situation where I'd do that
  because it seems to violate a degree of encapsulation that tapestry
  imposes as a freeing law of the framework. The epicenter of that
 being
  that one should not think in terms of low-level idioms such as request
  parameters, and instead replace those with a higher level of
 application
  logic that eclipses them entirely (when possible). That's not to say
  that your perspective is flawed, but from the small bit of
 understanding
  I've taken from your posts I can't see why one would do what you want.
  The thing that I've been saying is missing here is, what are you trying
  to do? I don't mean technically, I mean what is the end result for the
  user? Understanding this is critical, but even if I don't your problem
  can still be solved by using a session to serve as an arbitrary holder.
  If you've settled on this architecture, why not write such a generic
  service and move on?
 
  János Jarecsni wrote:
 
  Hi,
 
  I looked everywhere for usage of request scope variables, but found
 
  nothing
 
  (maybe I'm impatient a bit :)...
  Is it really that unrealistic to have two components in a page, one
 (A)
  having an action link eventhandler where it would set some attribute
 for
 
  the
 
  request only (not the session!) and then component B could render
 itself
  according to the attribute set by component A?
 
  I think it should be a piece of cake :)
 
  thx
  Janos
 
  2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:
 
 
 
  Nope, you're exactly right.
 
  -Filip
 
  Blower, Andy skrev:
 
   This is not what I understood 'perthread' scope to be. I thought
 that
 
  it
 
  meant that each thread using a service gets its own instance of the
 
  service
 
  to use, even though that instance may not be the same as any
 previous
  instance it used. In other words, nothing to do with user sessions,
 
  it's
 
  just for services that are not thread safe and cannot be singletons.
 
  Have I got the wrong end of the stick here?
 
   -Original Message-
 
 
  From: Andy Huhn [mailto:[EMAIL PROTECTED]
  Sent: 29 April 2008 17:34
  To: Tapestry users
  Subject: Re: page activation + components
 
 
  Hello,
 
  You can define the scope of each service...you can set that
 
  particular
 
  service to be tied to only one session.
 
  See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
  and
  search for perthread.
 
  Thanks,
  Andy
 
  On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
  [EMAIL PROTECTED] wrote:
 
 
 
  Hi there,
 
  the service approach (as I expected) is session-agnostic (and is
  page-independent so concurrent users would interfere badly),
 
 
 
  therefore is
 
 
 
  not ok.
 
  I will now try the Environment approach... if that is
 session-aware
 
 
 
  :)
 
 
 
  thx again
  janos
 
  2008/4/29 János Jarecsni [EMAIL PROTECTED]:
 
   Hi Chris,
 
 
  even so you could help :) I want this kind of generic way of
  passing
  around information (component to component communication :)) so
  I'll
 
 
 
  look
 
 
 
  for the solutions Kristian and you outlined.
 
  thanks!
 
  cheers,
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
   Janos,
 
 
  Without code or a description of your actual goal, I'm finding
 
 
 
  your
 
 
  situation too hypothetical to really digest. The one thing I can
 
 
  point
 
 
  out is what you said about wanting a component to set a property
 
 
  in
 
 
  the
 
 
 
  page. If you want to do that, then you have to know the class of
 
  the
 
 
  page and so injecting a page would make sense. Of course that
 
 
  means
 
 
  tightly coupling a component to a page, which to me doesn't make
 
 
  sense.
 
  If you simply need a generic way of passing data between pages
 and
 
 
  components, consider using a service that provides an untyped
  list
 
 
 
  or
 
 
  putting something

Re: page activation + components

2008-04-30 Thread Filip S. Adamsen
Nope, that's an often used pattern in web applications, that is, it's a 
broader version of the Post/Redirect/Get pattern. It's normally only 
used for forms, but since you can do stuff in components actions that 
corresponds to what you would do on a form submit, it makes perfect 
sense. And it makes it a lot easier for Tapestry to handle, as far as I 
know.


http://en.wikipedia.org/wiki/Post/Redirect/Get

-Filip

János Jarecsni skrev:

This did the trick! Superb, it works just like I want it :)
Actually, having 2 network roundtrips for a single requests sounds a little
bad doesn't it?

cheers
janos

2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:


That's pretty hard to do without some kind of persistence because of the
redirect that happens between the component action and the page render.

There's of course tapestry.suppress-redirect-from-action-requests, but I
would strongly recommend AGAINST using that.

http://tapestry.apache.org/tapestry5/tapestry-core/guide/conf.html

-Filip

János Jarecsni skrev:

 Hi,

I looked everywhere for usage of request scope variables, but found
nothing
(maybe I'm impatient a bit :)...
Is it really that unrealistic to have two components in a page, one (A)
having an action link eventhandler where it would set some attribute for
the
request only (not the session!) and then component B could render itself
according to the attribute set by component A?

I think it should be a piece of cake :)

thx
Janos

2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:

 Nope, you're exactly right.

-Filip

Blower, Andy skrev:

 This is not what I understood 'perthread' scope to be. I thought that
it


meant that each thread using a service gets its own instance of the
service
to use, even though that instance may not be the same as any
previous
instance it used. In other words, nothing to do with user sessions,
it's
just for services that are not thread safe and cannot be singletons.

Have I got the wrong end of the stick here?

 -Original Message-


From: Andy Huhn [mailto:[EMAIL PROTECTED]
Sent: 29 April 2008 17:34
To: Tapestry users
Subject: Re: page activation + components


Hello,

You can define the scope of each service...you can set that
particular
service to be tied to only one session.

See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html
,
and
search for perthread.

Thanks,
Andy

On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
[EMAIL PROTECTED] wrote:

 Hi there,

the service approach (as I expected) is session-agnostic (and is
page-independent so concurrent users would interfere badly),

 therefore is

 not ok.

I will now try the Environment approach... if that is
session-aware

 :)

 thx again

janos

2008/4/29 János Jarecsni [EMAIL PROTECTED]:

 Hi Chris,


even so you could help :) I want this kind of generic way of
passing
around information (component to component communication :))
so
I'll

 look

 for the solutions Kristian and you outlined.

thanks!

cheers,
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:

 Janos,


Without code or a description of your actual goal, I'm
finding

 your

situation too hypothetical to really digest. The one thing I can


point


out is what you said about wanting a component to set a property


in


the

 page. If you want to do that, then you have to know the class

of
the


page and so injecting a page would make sense. Of course that


means


tightly coupling a component to a page, which to me doesn't make


sense.
If you simply need a generic way of passing data between pages
and


components, consider using a service that provides an
untyped
list

 or

putting something in the environment as Kristian suggested. I'm


sorry


I

 can't be more helpful but as I said I'm not clear on what

you're
really
trying to do.


good luck
chris

János Jarecsni wrote:

 Hi Chris,

I thought of pages as contexts for the components
embedded

 within

them.
So, in one event handler of a component I would like to set

some

 property or

 another (in the page object), and the other components in

the

 page,

which
are also able to access this property may change their

 appearance

(say, the
.TML would test the property). Maybe I'm on a wrong track,

 please

let

 me

know :)

thx
Cheers,
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:


 Janos,


I'm having a hard time understanding a case that a
component

 should

know

in which page it is embedded, so my suggestion probably wasn't

a


good

 one. Activation contexts aren't meant for components but for

pages
-

 you

should be using component parameters to configure them, and

if
it's


a

 more sophisticated component, probably a service.

chris

János Jarecsni wrote:

 and how a component can get to know the page in which
it is
included? I


mean, I can't @InjectPage, as the component will be
included


in


many

 kinds

 of pages.

@Kristian: thx for the many ways :) I'll try these,
hope
that

 the

@Environmental stuff is scalable (I'm trying to bypass

session

Re: page activation + components

2008-04-30 Thread Josh Canfield
Are you trying to keep the news id out of the url? Doesn't sound like
it from your response to not doing the redirect. Since that's the
case, why not add it to the page context?

I suppose if you were building a portal with several components then
keeping track of component parameters could get unwieldy. If you were
showing a news article from the news portlet, and a stock highlight
from the stock portlet... At that point you're sort of building a
framework on a framework.

You could build your page such that it accumulated context from it's
components. Push a ComponentContext object into the Environment
onActivate, and setupRender in your page (env gets cleared before
render phase, not sure if there is a better way than doing it in
both.) Then collect component parameter mappings. onPassivate for your
page would organize and return these as it's context (you might want
to sort them to get consistent results)

Your url might look like this:

http://localhost/context/mypage/cc/news/4527/stock/MCD

Then onactivate you init the ComponentContext from the url keying off
the cc to grab the remaining parameters and use them as key/value
for the components. The your components do something like:

@Environmental
private ComponentContext _compContext;

void setupRender() {
  Long newsId = _compContext.getLong(_resources.getId());
}

void onPickNewsItem(Long id) {
  _compContext.put(_resources.getId(), id);
}


Josh

On Wed, Apr 30, 2008 at 5:23 AM, János Jarecsni
[EMAIL PROTECTED] wrote:
 Hi Chris,

 I try to explain :)
 Say, you have a NewsQuote component, which shows a few lines from the 5
 latest news. At the and of each quotations, there a More link. Now, when
 the user clicks on this link (an action link, for that matter), the
 NewsQuote component will set a request scope info saying that the news with
 ID=4527 is requested. And when it comes to the News component (it is able
 to show the text of a given news in full), it simply looks at this piece of
 info, and loads the news with id 4527 (or gets it from an app level cache
 :)) and renders it.

 Hope it tells something about what I am up to :)

 thx
 Janos

 2008/4/30 Chris Lewis [EMAIL PROTECTED]:


  Honestly it's difficult for me to imagine a situation where I'd do that
  because it seems to violate a degree of encapsulation that tapestry
  imposes as a freeing law of the framework. The epicenter of that being
  that one should not think in terms of low-level idioms such as request
  parameters, and instead replace those with a higher level of application
  logic that eclipses them entirely (when possible). That's not to say
  that your perspective is flawed, but from the small bit of understanding
  I've taken from your posts I can't see why one would do what you want.
  The thing that I've been saying is missing here is, what are you trying
  to do? I don't mean technically, I mean what is the end result for the
  user? Understanding this is critical, but even if I don't your problem
  can still be solved by using a session to serve as an arbitrary holder.
  If you've settled on this architecture, why not write such a generic
  service and move on?
 
  János Jarecsni wrote:
   Hi,
  
   I looked everywhere for usage of request scope variables, but found
  nothing
   (maybe I'm impatient a bit :)...
   Is it really that unrealistic to have two components in a page, one (A)
   having an action link eventhandler where it would set some attribute for
  the
   request only (not the session!) and then component B could render itself
   according to the attribute set by component A?
  
   I think it should be a piece of cake :)
  
   thx
   Janos
  
   2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:
  
  
   Nope, you're exactly right.
  
   -Filip
  
   Blower, Andy skrev:
  
This is not what I understood 'perthread' scope to be. I thought that
  it
  
   meant that each thread using a service gets its own instance of the
  service
   to use, even though that instance may not be the same as any previous
   instance it used. In other words, nothing to do with user sessions,
  it's
   just for services that are not thread safe and cannot be singletons.
  
   Have I got the wrong end of the stick here?
  
-Original Message-
  
   From: Andy Huhn [mailto:[EMAIL PROTECTED]
   Sent: 29 April 2008 17:34
   To: Tapestry users
   Subject: Re: page activation + components
  
  
   Hello,
  
   You can define the scope of each service...you can set that
  particular
   service to be tied to only one session.
  
   See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
   and
   search for perthread.
  
   Thanks,
   Andy
  
   On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
   [EMAIL PROTECTED] wrote:
  
  
   Hi there,
  
   the service approach (as I expected) is session-agnostic (and is
   page-independent so concurrent users would interfere badly),
  
  
   therefore is
  
  
   not ok.
  
   I will now try the Environment approach

Re: page activation + components

2008-04-30 Thread Chris Lewis
 safe and cannot be singletons.

 Have I got the wrong end of the stick here?

  -Original Message-

 
 From: Andy Huhn [mailto:[EMAIL PROTECTED]
 Sent: 29 April 2008 17:34
 To: Tapestry users
 Subject: Re: page activation + components


 Hello,

 You can define the scope of each service...you can set that
   
 particular
   
 service to be tied to only one session.

 See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
 and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:


   
 Hi there,

 the service approach (as I expected) is session-agnostic (and is
 page-independent so concurrent users would interfere badly),


 
 therefore is


   
 not ok.

 I will now try the Environment approach... if that is session-aware


 
 :)


   
 thx again
 janos

 2008/4/29 János Jarecsni [EMAIL PROTECTED]:

  Hi Chris,

 
 even so you could help :) I want this kind of generic way of
 passing
 around information (component to component communication :)) so
 I'll


   
 look


 
 for the solutions Kristian and you outlined.

 thanks!

 cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  Janos,

   
 Without code or a description of your actual goal, I'm finding


 
 your

   
 situation too hypothetical to really digest. The one thing I can

 
 point

   
 out is what you said about wanting a component to set a property

 
 in

   
 the


 
 page. If you want to do that, then you have to know the class of

 the

   
 page and so injecting a page would make sense. Of course that

 
 means

   
 tightly coupling a component to a page, which to me doesn't make

 
 sense.

 If you simply need a generic way of passing data between pages and

   
 components, consider using a service that provides an untyped
 list


 
 or

   
 putting something in the environment as Kristian suggested. I'm

 
 sorry

   
 I


 
 can't be more helpful but as I said I'm not clear on what you're

 really

 trying to do.

   
 good luck
 chris

 János Jarecsni wrote:


 
 Hi Chris,

 I thought of pages as contexts for the components embedded


   
 within

 
 them.

 
 So, in one event handler of a component I would like to set
 some


   
 property or


 
 another (in the page object), and the other components in the


   
 page,

 
 which

 
 are also able to access this property may change their


   
 appearance

 
 (say, the

 
 .TML would test the property). Maybe I'm on a wrong track,


   
 please

 
 let


 
 me

   
 know :)

 thx
 Cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:


  Janos,

   
 I'm having a hard time understanding a case that a component


 
 should

   
 know

 
 in which page it is embedded, so my suggestion probably wasn't

 a

   
 good


 
 one. Activation contexts aren't meant for components but for

   
 pages

   
 -


 
 you

   
 should be using component parameters to configure them, and if

 it's

   
 a


 
 more sophisticated component, probably a service.

   
 chris

 János Jarecsni wrote:

  and how a component can get to know the page in which it is

 included? I

 
 mean, I can't @InjectPage, as the component will be included

   
 in

 
 many


 
 kinds

   
  of pages.

 
 @Kristian: thx for the many ways :) I'll try these, hope
 that


   
 the

 
 @Environmental stuff is scalable (I'm trying to bypass session

 
 creation

 
 as

   
  much as possible)

 
 Is there a doc on the various annotations available?

 @Michael:
 Could you include a tiny bit of example? THX!

 Thx to you all
 cheers
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:



  5) @InjectPage the page and call the getter

   
 Kristian Marinkovic wrote:


  hi janos

Re: page activation + components

2008-04-30 Thread Chris Lewis
 it should be a piece of cake :)

 thx
 Janos

 2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:


 
 Nope, you're exactly right.

 -Filip

 Blower, Andy skrev:

  This is not what I understood 'perthread' scope to be. I thought that
   
 it
   
 meant that each thread using a service gets its own instance of the
 
 service
   
 to use, even though that instance may not be the same as any previous
 instance it used. In other words, nothing to do with user sessions,
 
 it's
   
 just for services that are not thread safe and cannot be singletons.

 Have I got the wrong end of the stick here?

  -Original Message-

 
 From: Andy Huhn [mailto:[EMAIL PROTECTED]
 Sent: 29 April 2008 17:34
 To: Tapestry users
 Subject: Re: page activation + components


 Hello,

 You can define the scope of each service...you can set that
   
 particular
   
 service to be tied to only one session.

 See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
 and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:


   
 Hi there,

 the service approach (as I expected) is session-agnostic (and is
 page-independent so concurrent users would interfere badly),


 
 therefore is


   
 not ok.

 I will now try the Environment approach... if that is session-aware


 
 :)


   
 thx again
 janos

 2008/4/29 János Jarecsni [EMAIL PROTECTED]:

  Hi Chris,

 
 even so you could help :) I want this kind of generic way of
 passing
 around information (component to component communication :)) so
 I'll


   
 look


 
 for the solutions Kristian and you outlined.

 thanks!

 cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  Janos,

   
 Without code or a description of your actual goal, I'm finding


 
 your

   
 situation too hypothetical to really digest. The one thing I can

 
 point

   
 out is what you said about wanting a component to set a property

 
 in

   
 the


 
 page. If you want to do that, then you have to know the class of

 the

   
 page and so injecting a page would make sense. Of course that

 
 means

   
 tightly coupling a component to a page, which to me doesn't make

 
 sense.

 If you simply need a generic way of passing data between pages and

   
 components, consider using a service that provides an untyped
 list


 
 or

   
 putting something in the environment as Kristian suggested. I'm

 
 sorry

   
 I


 
 can't be more helpful but as I said I'm not clear on what you're

 really

 trying to do.

   
 good luck
 chris

 János Jarecsni wrote:


 
 Hi Chris,

 I thought of pages as contexts for the components embedded


   
 within

 
 them.

 
 So, in one event handler of a component I would like to set
 some


   
 property or


 
 another (in the page object), and the other components in the


   
 page,

 
 which

 
 are also able to access this property may change their


   
 appearance

 
 (say, the

 
 .TML would test the property). Maybe I'm on a wrong track,


   
 please

 
 let


 
 me

   
 know :)

 thx
 Cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:


  Janos,

   
 I'm having a hard time understanding a case that a component


 
 should

   
 know

 
 in which page it is embedded, so my suggestion probably wasn't

 a

   
 good


 
 one. Activation contexts aren't meant for components but for

   
 pages

   
 -


 
 you

   
 should be using component parameters to configure them, and if

 it's

   
 a


 
 more sophisticated component, probably a service.

   
 chris

 János Jarecsni wrote:

  and how a component can get to know the page in which it is

 included? I

 
 mean, I can't @InjectPage, as the component will be included

   
 in

 
 many


 
 kinds

   
  of pages.

 
 @Kristian: thx for the many ways :) I'll try these, hope

RE: page activation + components

2008-04-30 Thread Joel Wiegman
I may be chiming in a little late on this, but if Janos is just trying to 
communicate activation context values to child components, isn't this what the 
@Parameter annotation of a component is for?

http://tapestry.apache.org/tapestry5/tapestry-core/guide/parameters.html

Just kick me out if I'm off base... I only skimmed the thread.
 

-Original Message-
From: Chris Lewis [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 30, 2008 4:27 PM
To: Tapestry users
Subject: Re: page activation + components

I see how this whole push on/pull off environment will solve the issue, but it 
just seems so nasty. I mean really, how is that any simpler than dealing 
directly with query parameters? I point at this only to highlight that perhaps 
Janos has brought to light a legitimately rough edge in T5, or else there's a 
cleaner way to do it and we're all just missing it. I'm convinced that the 
event system is the way to go as it seems a natural fit, but the 
redirect-after-action part is rendering it useless without using @Persist! Let 
me share what I've put together, and maybe someone will find the missing piece. 
I have a working test and I'll abbreviate the code here and assume a few things:

(coming in another message - i tripped the spam filter :-| )

Josh Canfield wrote:
 Are you trying to keep the news id out of the url? Doesn't sound like 
 it from your response to not doing the redirect. Since that's the 
 case, why not add it to the page context?

 I suppose if you were building a portal with several components then 
 keeping track of component parameters could get unwieldy. If you were 
 showing a news article from the news portlet, and a stock highlight 
 from the stock portlet... At that point you're sort of building a 
 framework on a framework.

 You could build your page such that it accumulated context from it's 
 components. Push a ComponentContext object into the Environment 
 onActivate, and setupRender in your page (env gets cleared before 
 render phase, not sure if there is a better way than doing it in
 both.) Then collect component parameter mappings. onPassivate for your 
 page would organize and return these as it's context (you might want 
 to sort them to get consistent results)

 Your url might look like this:

 http://localhost/context/mypage/cc/news/4527/stock/MCD

 Then onactivate you init the ComponentContext from the url keying off 
 the cc to grab the remaining parameters and use them as key/value 
 for the components. The your components do something like:

 @Environmental
 private ComponentContext _compContext;

 void setupRender() {
   Long newsId = _compContext.getLong(_resources.getId());
 }

 void onPickNewsItem(Long id) {
   _compContext.put(_resources.getId(), id); }


 Josh

 On Wed, Apr 30, 2008 at 5:23 AM, János Jarecsni
 [EMAIL PROTECTED] wrote:
   
 Hi Chris,

 I try to explain :)
 Say, you have a NewsQuote component, which shows a few lines from the 5
 latest news. At the and of each quotations, there a More link. Now, when
 the user clicks on this link (an action link, for that matter), the
 NewsQuote component will set a request scope info saying that the news with
 ID=4527 is requested. And when it comes to the News component (it is able
 to show the text of a given news in full), it simply looks at this piece of
 info, and loads the news with id 4527 (or gets it from an app level cache
 :)) and renders it.

 Hope it tells something about what I am up to :)

 thx
 Janos

 2008/4/30 Chris Lewis [EMAIL PROTECTED]:


 
 Honestly it's difficult for me to imagine a situation where I'd do that
 because it seems to violate a degree of encapsulation that tapestry
 imposes as a freeing law of the framework. The epicenter of that being
 that one should not think in terms of low-level idioms such as request
 parameters, and instead replace those with a higher level of application
 logic that eclipses them entirely (when possible). That's not to say
 that your perspective is flawed, but from the small bit of understanding
 I've taken from your posts I can't see why one would do what you want.
 The thing that I've been saying is missing here is, what are you trying
 to do? I don't mean technically, I mean what is the end result for the
 user? Understanding this is critical, but even if I don't your problem
 can still be solved by using a session to serve as an arbitrary holder.
 If you've settled on this architecture, why not write such a generic
 service and move on?

 János Jarecsni wrote:
   
 Hi,

 I looked everywhere for usage of request scope variables, but found
 
 nothing
   
 (maybe I'm impatient a bit :)...
 Is it really that unrealistic to have two components in a page, one (A)
 having an action link eventhandler where it would set some attribute for
 
 the
   
 request only (not the session!) and then component B could render itself
 according to the attribute set by component A?

 I think it should be a piece of cake

Re: page activation + components

2008-04-30 Thread Chris Lewis
 that are not thread safe and cannot be singletons.

 Have I got the wrong end of the stick here?

  -Original Message-

 
 From: Andy Huhn [mailto:[EMAIL PROTECTED]
 Sent: 29 April 2008 17:34
 To: Tapestry users
 Subject: Re: page activation + components


 Hello,

 You can define the scope of each service...you can set that
   
 particular
   
 service to be tied to only one session.

 See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
 and
 search for perthread.

 Thanks,
 Andy

 On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
 [EMAIL PROTECTED] wrote:


   
 Hi there,

 the service approach (as I expected) is session-agnostic (and is
 page-independent so concurrent users would interfere badly),


 
 therefore is


   
 not ok.

 I will now try the Environment approach... if that is session-aware


 
 :)


   
 thx again
 janos

 2008/4/29 János Jarecsni [EMAIL PROTECTED]:

  Hi Chris,

 
 even so you could help :) I want this kind of generic way of
 passing
 around information (component to component communication :)) so
 I'll


   
 look


 
 for the solutions Kristian and you outlined.

 thanks!

 cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  Janos,

   
 Without code or a description of your actual goal, I'm finding


 
 your

   
 situation too hypothetical to really digest. The one thing I can

 
 point

   
 out is what you said about wanting a component to set a property

 
 in

   
 the


 
 page. If you want to do that, then you have to know the class of

 the

   
 page and so injecting a page would make sense. Of course that

 
 means

   
 tightly coupling a component to a page, which to me doesn't make

 
 sense.

 If you simply need a generic way of passing data between pages and

   
 components, consider using a service that provides an untyped
 list


 
 or

   
 putting something in the environment as Kristian suggested. I'm

 
 sorry

   
 I


 
 can't be more helpful but as I said I'm not clear on what you're

 really

 trying to do.

   
 good luck
 chris

 János Jarecsni wrote:


 
 Hi Chris,

 I thought of pages as contexts for the components embedded


   
 within

 
 them.

 
 So, in one event handler of a component I would like to set
 some


   
 property or


 
 another (in the page object), and the other components in the


   
 page,

 
 which

 
 are also able to access this property may change their


   
 appearance

 
 (say, the

 
 .TML would test the property). Maybe I'm on a wrong track,


   
 please

 
 let


 
 me

   
 know :)

 thx
 Cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:


  Janos,

   
 I'm having a hard time understanding a case that a component


 
 should

   
 know

 
 in which page it is embedded, so my suggestion probably wasn't

 a

   
 good


 
 one. Activation contexts aren't meant for components but for

   
 pages

   
 -


 
 you

   
 should be using component parameters to configure them, and if

 it's

   
 a


 
 more sophisticated component, probably a service.

   
 chris

 János Jarecsni wrote:

  and how a component can get to know the page in which it is

 included? I

 
 mean, I can't @InjectPage, as the component will be included

   
 in

 
 many


 
 kinds

   
  of pages.

 
 @Kristian: thx for the many ways :) I'll try these, hope
 that


   
 the

 
 @Environmental stuff is scalable (I'm trying to bypass session

 
 creation

 
 as

   
  much as possible)

 
 Is there a doc on the various annotations available?

 @Michael:
 Could you include a tiny bit of example? THX!

 Thx to you all
 cheers
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:



  5) @InjectPage the page and call the getter

   
 Kristian Marinkovic wrote:


  hi

Re: page activation + components

2008-04-30 Thread Chris Lewis
this the last of it

4) In our embedding page class, News, we have an event handler to be
notified of the selection by handling the viewitem event:

void onViewitem(long id) {
   
this.currentItem = newsSource.getItemById(id);
logger.info(got  + this.currentItem.getTitle());

}


Now if you run this (I can pass along the project with a mock dao, no
real db needed) you'll see that up through the last bit, where the page
handles the event from the NewsQuote component, everything works
perfectly. We catch the event in the page and grab the object. The
problem is still how to deal with the T5-encouraged redirect and
maintain that value in the page, so we can render the news item. That
is, without using @Persist

Still thinking on this - input welcome!

chris

Josh Canfield wrote:
 Are you trying to keep the news id out of the url? Doesn't sound like
 it from your response to not doing the redirect. Since that's the
 case, why not add it to the page context?

 I suppose if you were building a portal with several components then
 keeping track of component parameters could get unwieldy. If you were
 showing a news article from the news portlet, and a stock highlight
 from the stock portlet... At that point you're sort of building a
 framework on a framework.

 You could build your page such that it accumulated context from it's
 components. Push a ComponentContext object into the Environment
 onActivate, and setupRender in your page (env gets cleared before
 render phase, not sure if there is a better way than doing it in
 both.) Then collect component parameter mappings. onPassivate for your
 page would organize and return these as it's context (you might want
 to sort them to get consistent results)

 Your url might look like this:

 http://localhost/context/mypage/cc/news/4527/stock/MCD

 Then onactivate you init the ComponentContext from the url keying off
 the cc to grab the remaining parameters and use them as key/value
 for the components. The your components do something like:

 @Environmental
 private ComponentContext _compContext;

 void setupRender() {
   Long newsId = _compContext.getLong(_resources.getId());
 }

 void onPickNewsItem(Long id) {
   _compContext.put(_resources.getId(), id);
 }


   

-- 
http://thegodcode.net


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



Re: page activation + components

2008-04-30 Thread Josh Canfield
 is, what are you trying
  to do? I don't mean technically, I mean what is the end result for the
  user? Understanding this is critical, but even if I don't your problem
  can still be solved by using a session to serve as an arbitrary holder.
  If you've settled on this architecture, why not write such a generic
  service and move on?
 
  János Jarecsni wrote:
 
  Hi,
 
  I looked everywhere for usage of request scope variables, but found
 
  nothing
 
  (maybe I'm impatient a bit :)...
  Is it really that unrealistic to have two components in a page, one (A)
  having an action link eventhandler where it would set some attribute for
 
  the
 
  request only (not the session!) and then component B could render itself
  according to the attribute set by component A?
 
  I think it should be a piece of cake :)
 
  thx
  Janos
 
  2008/4/30 Filip S. Adamsen [EMAIL PROTECTED]:
 
 
 
  Nope, you're exactly right.
 
  -Filip
 
  Blower, Andy skrev:
 
   This is not what I understood 'perthread' scope to be. I thought that
 
  it
 
  meant that each thread using a service gets its own instance of the
 
  service
 
  to use, even though that instance may not be the same as any previous
  instance it used. In other words, nothing to do with user sessions,
 
  it's
 
  just for services that are not thread safe and cannot be singletons.
 
  Have I got the wrong end of the stick here?
 
   -Original Message-
 
 
  From: Andy Huhn [mailto:[EMAIL PROTECTED]
  Sent: 29 April 2008 17:34
  To: Tapestry users
  Subject: Re: page activation + components
 
 
  Hello,
 
  You can define the scope of each service...you can set that
 
  particular
 
  service to be tied to only one session.
 
  See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html,
  and
  search for perthread.
 
  Thanks,
  Andy
 
  On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
  [EMAIL PROTECTED] wrote:
 
 
 
  Hi there,
 
  the service approach (as I expected) is session-agnostic (and is
  page-independent so concurrent users would interfere badly),
 
 
 
  therefore is
 
 
 
  not ok.
 
  I will now try the Environment approach... if that is session-aware
 
 
 
  :)
 
 
 
  thx again
  janos
 
  2008/4/29 János Jarecsni [EMAIL PROTECTED]:
 
   Hi Chris,
 
 
  even so you could help :) I want this kind of generic way of
  passing
  around information (component to component communication :)) so
  I'll
 
 
 
  look
 
 
 
  for the solutions Kristian and you outlined.
 
  thanks!
 
  cheers,
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
   Janos,
 
 
  Without code or a description of your actual goal, I'm finding
 
 
 
  your
 
 
  situation too hypothetical to really digest. The one thing I can
 
 
  point
 
 
  out is what you said about wanting a component to set a property
 
 
  in
 
 
  the
 
 
 
  page. If you want to do that, then you have to know the class of
 
  the
 
 
  page and so injecting a page would make sense. Of course that
 
 
  means
 
 
  tightly coupling a component to a page, which to me doesn't make
 
 
  sense.
 
  If you simply need a generic way of passing data between pages and
 
 
  components, consider using a service that provides an untyped
  list
 
 
 
  or
 
 
  putting something in the environment as Kristian suggested. I'm
 
 
  sorry
 
 
  I
 
 
 
  can't be more helpful but as I said I'm not clear on what you're
 
  really
 
  trying to do.
 
 
  good luck
  chris
 
  János Jarecsni wrote:
 
 
 
  Hi Chris,
 
  I thought of pages as contexts for the components embedded
 
 
 
  within
 
 
  them.
 
 
  So, in one event handler of a component I would like to set
  some
 
 
 
  property or
 
 
 
  another (in the page object), and the other components in the
 
 
 
  page,
 
 
  which
 
 
  are also able to access this property may change their
 
 
 
  appearance
 
 
  (say, the
 
 
  .TML would test the property). Maybe I'm on a wrong track,
 
 
 
  please
 
 
  let
 
 
 
  me
 
 
  know :)
 
  thx
  Cheers,
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
 
   Janos,
 
 
  I'm having a hard time understanding a case that a component
 
 
 
  should
 
 
  know
 
 
  in which page it is embedded, so my suggestion probably wasn't
 
  a
 
 
  good
 
 
 
  one. Activation contexts aren't meant for components but for
 
 
  pages
 
 
  -
 
 
 
  you
 
 
  should be using component parameters to configure them, and if
 
  it's
 
 
  a
 
 
 
  more sophisticated component, probably a service.
 
 
  chris
 
  János Jarecsni wrote:
 
   and how a component can get to know the page in which it is
 
  included? I
 
 
  mean, I can't @InjectPage, as the component will be included
 
 
  in
 
 
  many
 
 
 
  kinds
 
 
   of pages.
 
 
  @Kristian: thx for the many ways :) I'll try these, hope
  that
 
 
 
  the
 
 
  @Environmental stuff is scalable (I'm trying to bypass session
 
 
  creation
 
 
  as
 
 
   much as possible)
 
 
  Is there a doc on the various annotations available?
 
  @Michael

Re: page activation + components

2008-04-30 Thread Chris Lewis
I do hope we've missed a simpler way, but I don't think it's surfaced
yet. Regarding parameters, how would that address the issue? NewsQuote
displays a collection of items as links that represent selectable items
(expressed as links). The action must be taken based on the user's
selection, so a component parameter doesn't apply here.
The event-based approach seems a theoretical perfect fit, but I can't
see how to do it without using @Persist (which Janos wants to avoid).
The only other thing I thought of is to have the NewsQuote component
generate pagelinks based on the containing page instead of action links.
This circumvents entirely the need for the events as the value will be
in the page context, does not not make 2 requests, and ultimately gets
the job done. It doesn't seem as elegant to me, but does the job and is
completely decoupled from the page.

Still not sure if we've had our epiphany yet :-)

chris

Josh Canfield wrote:
 I mean really, how is that any simpler than
 dealing directly with query parameters?
 

 Hehe... I have to admit that I was solving a much more complicated
 problem than the original question, probably brought on by an earlier
 request about dynamic component rendering... I was shooting for
 completely decoupled context handling for an unknown assortment of
 components. Say you have 50 potential portlet components on a page
 that may get included multiple times and may or may not add to the
 context of the page, you probably don't want to manage that through
 individual page properties.

 Anyway,
 Isn't the straight forward solution to this problem to use component
 parameters as Joel pointed out? If your NewsQuote component accepts a
 newsId parameter, that binding is bi-directional. When the event
 occurs in the component it calls the setter of the bound parameter,
 which updates the value in the page and gets put back into the url via
 context returned by onPassivate. When the value is set during render
 time the component grabs the news item and renders it, if not it grabs
 the top five and displays them...

 Perhaps as Joel pointed out we're just making this too complicated and
 we should be the ones kicked out!

 Josh

 On Wed, Apr 30, 2008 at 1:27 PM, Chris Lewis [EMAIL PROTECTED] wrote:
   
 I see how this whole push on/pull off environment will solve the issue,
 but it just seems so nasty. I mean really, how is that any simpler than
 dealing directly with query parameters? I point at this only to
 highlight that perhaps Janos has brought to light a legitimately rough
 edge in T5, or else there's a cleaner way to do it and we're all just
 missing it. I'm convinced that the event system is the way to go as it
 seems a natural fit, but the redirect-after-action part is rendering it
 useless without using @Persist! Let me share what I've put together, and
 maybe someone will find the missing piece. I have a working test and
 I'll abbreviate the code here and assume a few things:

 (coming in another message - i tripped the spam filter :-| )


 Josh Canfield wrote:
 
 Are you trying to keep the news id out of the url? Doesn't sound like
 it from your response to not doing the redirect. Since that's the
 case, why not add it to the page context?

 I suppose if you were building a portal with several components then
 keeping track of component parameters could get unwieldy. If you were
 showing a news article from the news portlet, and a stock highlight
 from the stock portlet... At that point you're sort of building a
 framework on a framework.

 You could build your page such that it accumulated context from it's
 components. Push a ComponentContext object into the Environment
 onActivate, and setupRender in your page (env gets cleared before
 render phase, not sure if there is a better way than doing it in
 both.) Then collect component parameter mappings. onPassivate for your
 page would organize and return these as it's context (you might want
 to sort them to get consistent results)

 Your url might look like this:

 http://localhost/context/mypage/cc/news/4527/stock/MCD

 Then onactivate you init the ComponentContext from the url keying off
 the cc to grab the remaining parameters and use them as key/value
 for the components. The your components do something like:

 @Environmental
 private ComponentContext _compContext;

 void setupRender() {
   Long newsId = _compContext.getLong(_resources.getId());
 }

 void onPickNewsItem(Long id) {
   _compContext.put(_resources.getId(), id);
 }


 Josh

 On Wed, Apr 30, 2008 at 5:23 AM, János Jarecsni
 [EMAIL PROTECTED] wrote:

   
 Hi Chris,

 I try to explain :)
 Say, you have a NewsQuote component, which shows a few lines from the 5
 latest news. At the and of each quotations, there a More link. Now, when
 the user clicks on this link (an action link, for that matter), the
 NewsQuote component will set a request scope info saying that the news with
 ID=4527 is requested. And when it comes to the News component 

Re: page activation + components

2008-04-30 Thread Josh Canfield
Here's an app that does what I believe is trying to be done:

// Page
public class News {
@Property
private Integer _newsId;
public void onActivate(Integer newsId) {
_newsId = newsId;
}

public Integer onPassivate() {
return _newsId;
}
}

// Page Template
?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;

html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
body
t:newsQuote newsId=newsId /
/body
/html

// Component
public class NewsQuote {

@Parameter
private Integer _newsId;

@Inject
private ComponentResources _resources;

void beginRender(MarkupWriter writer) {
writer.element(ul);
for (int i = 0; i  5; ++i) {
writer.element(li);
Link link = _resources.createActionLink(show, false, 
i);
writer.element(a, href, link.toURI());
writer.write(News number  + i);
writer.end();
if (_newsId != null  _newsId.equals(i)) {
writer.write( You picked  + _newsId);
}
writer.end();
}
writer.end();
}

// The Action handler
void onShow(Integer id) {
// stored into the bound parameter, feeding it back into the 
page
_newsId = id;
}
}

The url http://localhost:8080/news/4

Renders

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
  link href=/assets/tapestry/default.css rel=stylesheet type=text/css
/head
body
ul
lia href=/news.newsquote:show/0?t:ac=4News number 0/a/li
lia href=/news.newsquote:show/1?t:ac=4News number 1/a/li
lia href=/news.newsquote:show/2?t:ac=4News number 2/a/li
lia href=/news.newsquote:show/3?t:ac=4News number 3/a/li
lia href=/news.newsquote:show/4?t:ac=4News number 4/a You picked 4/li
/ul
/body
/html

Josh

On Wed, Apr 30, 2008 at 2:49 PM, Chris Lewis [EMAIL PROTECTED] wrote:
 I do hope we've missed a simpler way, but I don't think it's surfaced
 yet. Regarding parameters, how would that address the issue? NewsQuote
 displays a collection of items as links that represent selectable items
 (expressed as links). The action must be taken based on the user's
 selection, so a component parameter doesn't apply here.
 The event-based approach seems a theoretical perfect fit, but I can't
 see how to do it without using @Persist (which Janos wants to avoid).
 The only other thing I thought of is to have the NewsQuote component
 generate pagelinks based on the containing page instead of action links.
 This circumvents entirely the need for the events as the value will be
 in the page context, does not not make 2 requests, and ultimately gets
 the job done. It doesn't seem as elegant to me, but does the job and is
 completely decoupled from the page.

 Still not sure if we've had our epiphany yet :-)

 chris


 Josh Canfield wrote:
  I mean really, how is that any simpler than
  dealing directly with query parameters?
 
 
  Hehe... I have to admit that I was solving a much more complicated
  problem than the original question, probably brought on by an earlier
  request about dynamic component rendering... I was shooting for
  completely decoupled context handling for an unknown assortment of
  components. Say you have 50 potential portlet components on a page
  that may get included multiple times and may or may not add to the
  context of the page, you probably don't want to manage that through
  individual page properties.
 
  Anyway,
  Isn't the straight forward solution to this problem to use component
  parameters as Joel pointed out? If your NewsQuote component accepts a
  newsId parameter, that binding is bi-directional. When the event
  occurs in the component it calls the setter of the bound parameter,
  which updates the value in the page and gets put back into the url via
  context returned by onPassivate. When the value is set during render
  time the component grabs the news item and renders it, if not it grabs
  the top five and displays them...
 
  Perhaps as Joel pointed out we're just making this too complicated and
  we should be the ones kicked out!
 
  Josh
 
  On Wed, Apr 30, 2008 at 1:27 PM, Chris Lewis [EMAIL PROTECTED] wrote:
 
  I see how this whole push on/pull off environment will solve the issue,
  but it just seems so nasty. I mean really, how is that any simpler than
  dealing directly with query parameters? I point at this only to
  highlight that perhaps Janos has brought to light a legitimately rough
  edge in T5, or else there's a cleaner way to do it and we're all just
  missing it. I'm convinced 

page activation + components

2008-04-29 Thread János Jarecsni
Hi there,

I have an activatable page, in its onActivate(String param) method I save
the param to a normal instance variable of the page class (no persistence!).
How can any component embedded within this page access this variable?

the page class:

//...
private String param;

public void onActivate(String param) {
   this.param = param;
}


public String getParam() {...}


Thx in advance!
Janos


Re: page activation + components

2008-04-29 Thread Kristian Marinkovic
hi janos,

there are several possibilities:

1) declare a component parameter and pass in the variable

2) put it in a ASO and inject the ASO in all your components (using 
@ApplicationState)
the drawback is that any other page or component will be able to access 
the ASO

3) put it into the Environment and read it whereever you need it in your 
nested components.
be careful when you put your object in your environment. if you put it in 
during the action
request it will not be able in the render request (because of the page 
redirect).

page:

@Inject Environment env;

@Persist(flash) whateverclass w;

onActivate(w) {  this.w= w }

setupRender() { env.push(whateverclass.class,w);}

components:

@Environmental Whateverclass var;

4) define a service that can take this variable (and saves it appropriatly 
so it is not
lost on a redirect:)) and inject your service in the components where 
needed 
to retrieve the value.

maybe there are some more possibilities :)

g,
kris




János Jarecsni [EMAIL PROTECTED] 
29.04.2008 08:15
Bitte antworten an
Tapestry users users@tapestry.apache.org


An
Tapestry users users@tapestry.apache.org
Kopie

Thema
page activation + components






Hi there,

I have an activatable page, in its onActivate(String param) method I save
the param to a normal instance variable of the page class (no 
persistence!).
How can any component embedded within this page access this variable?

the page class:

//...
private String param;

public void onActivate(String param) {
   this.param = param;
}


public String getParam() {...}


Thx in advance!
Janos



Re: page activation + components

2008-04-29 Thread Chris Lewis
5) @InjectPage the page and call the getter

Kristian Marinkovic wrote:
 hi janos,

 there are several possibilities:

 1) declare a component parameter and pass in the variable

 2) put it in a ASO and inject the ASO in all your components (using 
 @ApplicationState)
 the drawback is that any other page or component will be able to access 
 the ASO

 3) put it into the Environment and read it whereever you need it in your 
 nested components.
 be careful when you put your object in your environment. if you put it in 
 during the action
 request it will not be able in the render request (because of the page 
 redirect).

 page:

 @Inject Environment env;

 @Persist(flash) whateverclass w;

 onActivate(w) {  this.w= w }

 setupRender() { env.push(whateverclass.class,w);}

 components:

 @Environmental Whateverclass var;

 4) define a service that can take this variable (and saves it appropriatly 
 so it is not
 lost on a redirect:)) and inject your service in the components where 
 needed 
 to retrieve the value.

 maybe there are some more possibilities :)

 g,
 kris




 János Jarecsni [EMAIL PROTECTED] 
 29.04.2008 08:15
 Bitte antworten an
 Tapestry users users@tapestry.apache.org


 An
 Tapestry users users@tapestry.apache.org
 Kopie

 Thema
 page activation + components






 Hi there,

 I have an activatable page, in its onActivate(String param) method I save
 the param to a normal instance variable of the page class (no 
 persistence!).
 How can any component embedded within this page access this variable?

 the page class:

 //...
 private String param;

 public void onActivate(String param) {
this.param = param;
 }


 public String getParam() {...}


 Thx in advance!
 Janos


   

-- 
http://thegodcode.net


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



Re: page activation + components

2008-04-29 Thread Michael Gerzabek
6) @Retain could do the job. Your String will be available until the end 
of the request.



János Jarecsni schrieb:

Hi there,

I have an activatable page, in its onActivate(String param) method I save
the param to a normal instance variable of the page class (no persistence!).
How can any component embedded within this page access this variable?

the page class:

//...
private String param;

public void onActivate(String param) {
   this.param = param;
}


public String getParam() {...}


Thx in advance!
Janos

  



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



Re: page activation + components

2008-04-29 Thread Michael Gerzabek

@Retain
private String param;

Salue

János Jarecsni schrieb:

and how a component can get to know the page in which it is included? I
mean, I can't @InjectPage, as the component will be included in many kinds
of pages.

@Kristian: thx for the many ways :) I'll try these, hope that the
@Environmental stuff is scalable (I'm trying to bypass session creation as
much as possible)

Is there a doc on the various annotations available?

@Michael:
Could you include a tiny bit of example? THX!

Thx to you all
cheers
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  

5) @InjectPage the page and call the getter

Kristian Marinkovic wrote:


hi janos,

there are several possibilities:

1) declare a component parameter and pass in the variable

2) put it in a ASO and inject the ASO in all your components (using
@ApplicationState)
the drawback is that any other page or component will be able to access
the ASO

3) put it into the Environment and read it whereever you need it in your
nested components.
be careful when you put your object in your environment. if you put it
  

in


during the action
request it will not be able in the render request (because of the page
redirect).

page:

@Inject Environment env;

@Persist(flash) whateverclass w;

onActivate(w) {  this.w= w }

setupRender() { env.push(whateverclass.class,w);}

components:

@Environmental Whateverclass var;

4) define a service that can take this variable (and saves it
  

appropriatly


so it is not
lost on a redirect:)) and inject your service in the components where
needed
to retrieve the value.

maybe there are some more possibilities :)

g,
kris




János Jarecsni [EMAIL PROTECTED]
29.04.2008 08:15
Bitte antworten an
Tapestry users users@tapestry.apache.org


An
Tapestry users users@tapestry.apache.org
Kopie

Thema
page activation + components






Hi there,

I have an activatable page, in its onActivate(String param) method I
  

save


the param to a normal instance variable of the page class (no
persistence!).
How can any component embedded within this page access this variable?

the page class:

//...
private String param;

public void onActivate(String param) {
   this.param = param;
}


public String getParam() {...}


Thx in advance!
Janos



  

--
http://thegodcode.net


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






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



Re: page activation + components

2008-04-29 Thread Chris Lewis
Janos,

I'm having a hard time understanding a case that a component should know
in which page it is embedded, so my suggestion probably wasn't a good
one. Activation contexts aren't meant for components but for pages - you
should be using component parameters to configure them, and if it's a
more sophisticated component, probably a service.

chris

János Jarecsni wrote:
 and how a component can get to know the page in which it is included? I
 mean, I can't @InjectPage, as the component will be included in many kinds
 of pages.

 @Kristian: thx for the many ways :) I'll try these, hope that the
 @Environmental stuff is scalable (I'm trying to bypass session creation as
 much as possible)

 Is there a doc on the various annotations available?

 @Michael:
 Could you include a tiny bit of example? THX!

 Thx to you all
 cheers
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

   
 5) @InjectPage the page and call the getter

 Kristian Marinkovic wrote:
 
 hi janos,

 there are several possibilities:

 1) declare a component parameter and pass in the variable

 2) put it in a ASO and inject the ASO in all your components (using
 @ApplicationState)
 the drawback is that any other page or component will be able to access
 the ASO

 3) put it into the Environment and read it whereever you need it in your
 nested components.
 be careful when you put your object in your environment. if you put it
   
 in
 
 during the action
 request it will not be able in the render request (because of the page
 redirect).

 page:

 @Inject Environment env;

 @Persist(flash) whateverclass w;

 onActivate(w) {  this.w= w }

 setupRender() { env.push(whateverclass.class,w);}

 components:

 @Environmental Whateverclass var;

 4) define a service that can take this variable (and saves it
   
 appropriatly
 
 so it is not
 lost on a redirect:)) and inject your service in the components where
 needed
 to retrieve the value.

 maybe there are some more possibilities :)

 g,
 kris




 János Jarecsni [EMAIL PROTECTED]
 29.04.2008 08:15
 Bitte antworten an
 Tapestry users users@tapestry.apache.org


 An
 Tapestry users users@tapestry.apache.org
 Kopie

 Thema
 page activation + components






 Hi there,

 I have an activatable page, in its onActivate(String param) method I
   
 save
 
 the param to a normal instance variable of the page class (no
 persistence!).
 How can any component embedded within this page access this variable?

 the page class:

 //...
 private String param;

 public void onActivate(String param) {
this.param = param;
 }


 public String getParam() {...}


 Thx in advance!
 Janos



   
 --
 http://thegodcode.net


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


 

-- 
http://thegodcode.net


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



Re: page activation + components

2008-04-29 Thread János Jarecsni
and how a component can get to know the page in which it is included? I
mean, I can't @InjectPage, as the component will be included in many kinds
of pages.

@Kristian: thx for the many ways :) I'll try these, hope that the
@Environmental stuff is scalable (I'm trying to bypass session creation as
much as possible)

Is there a doc on the various annotations available?

@Michael:
Could you include a tiny bit of example? THX!

Thx to you all
cheers
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:

 5) @InjectPage the page and call the getter

 Kristian Marinkovic wrote:
  hi janos,
 
  there are several possibilities:
 
  1) declare a component parameter and pass in the variable
 
  2) put it in a ASO and inject the ASO in all your components (using
  @ApplicationState)
  the drawback is that any other page or component will be able to access
  the ASO
 
  3) put it into the Environment and read it whereever you need it in your
  nested components.
  be careful when you put your object in your environment. if you put it
 in
  during the action
  request it will not be able in the render request (because of the page
  redirect).
 
  page:
 
  @Inject Environment env;
 
  @Persist(flash) whateverclass w;
 
  onActivate(w) {  this.w= w }
 
  setupRender() { env.push(whateverclass.class,w);}
 
  components:
 
  @Environmental Whateverclass var;
 
  4) define a service that can take this variable (and saves it
 appropriatly
  so it is not
  lost on a redirect:)) and inject your service in the components where
  needed
  to retrieve the value.
 
  maybe there are some more possibilities :)
 
  g,
  kris
 
 
 
 
  János Jarecsni [EMAIL PROTECTED]
  29.04.2008 08:15
  Bitte antworten an
  Tapestry users users@tapestry.apache.org
 
 
  An
  Tapestry users users@tapestry.apache.org
  Kopie
 
  Thema
  page activation + components
 
 
 
 
 
 
  Hi there,
 
  I have an activatable page, in its onActivate(String param) method I
 save
  the param to a normal instance variable of the page class (no
  persistence!).
  How can any component embedded within this page access this variable?
 
  the page class:
 
  //...
  private String param;
 
  public void onActivate(String param) {
 this.param = param;
  }
 
 
  public String getParam() {...}
 
 
  Thx in advance!
  Janos
 
 
 

 --
 http://thegodcode.net


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




Re: page activation + components

2008-04-29 Thread János Jarecsni
Hi Chris,

I thought of pages as contexts for the components embedded within them.
So, in one event handler of a component I would like to set some property or
another (in the page object), and the other components in the page, which
are also able to access this property may change their appearance (say, the
.TML would test the property). Maybe I'm on a wrong track, please let me
know :)

thx
Cheers,
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:

 Janos,

 I'm having a hard time understanding a case that a component should know
 in which page it is embedded, so my suggestion probably wasn't a good
 one. Activation contexts aren't meant for components but for pages - you
 should be using component parameters to configure them, and if it's a
 more sophisticated component, probably a service.

 chris

 János Jarecsni wrote:
  and how a component can get to know the page in which it is included? I
  mean, I can't @InjectPage, as the component will be included in many
 kinds
  of pages.
 
  @Kristian: thx for the many ways :) I'll try these, hope that the
  @Environmental stuff is scalable (I'm trying to bypass session creation
 as
  much as possible)
 
  Is there a doc on the various annotations available?
 
  @Michael:
  Could you include a tiny bit of example? THX!
 
  Thx to you all
  cheers
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
 
  5) @InjectPage the page and call the getter
 
  Kristian Marinkovic wrote:
 
  hi janos,
 
  there are several possibilities:
 
  1) declare a component parameter and pass in the variable
 
  2) put it in a ASO and inject the ASO in all your components (using
  @ApplicationState)
  the drawback is that any other page or component will be able to
 access
  the ASO
 
  3) put it into the Environment and read it whereever you need it in
 your
  nested components.
  be careful when you put your object in your environment. if you put it
 
  in
 
  during the action
  request it will not be able in the render request (because of the page
  redirect).
 
  page:
 
  @Inject Environment env;
 
  @Persist(flash) whateverclass w;
 
  onActivate(w) {  this.w= w }
 
  setupRender() { env.push(whateverclass.class,w);}
 
  components:
 
  @Environmental Whateverclass var;
 
  4) define a service that can take this variable (and saves it
 
  appropriatly
 
  so it is not
  lost on a redirect:)) and inject your service in the components where
  needed
  to retrieve the value.
 
  maybe there are some more possibilities :)
 
  g,
  kris
 
 
 
 
  János Jarecsni [EMAIL PROTECTED]
  29.04.2008 08:15
  Bitte antworten an
  Tapestry users users@tapestry.apache.org
 
 
  An
  Tapestry users users@tapestry.apache.org
  Kopie
 
  Thema
  page activation + components
 
 
 
 
 
 
  Hi there,
 
  I have an activatable page, in its onActivate(String param) method I
 
  save
 
  the param to a normal instance variable of the page class (no
  persistence!).
  How can any component embedded within this page access this variable?
 
  the page class:
 
  //...
  private String param;
 
  public void onActivate(String param) {
 this.param = param;
  }
 
 
  public String getParam() {...}
 
 
  Thx in advance!
  Janos
 
 
 
 
  --
  http://thegodcode.net
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 http://thegodcode.net


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




Re: page activation + components

2008-04-29 Thread Chris Lewis
Janos,

Without code or a description of your actual goal, I'm finding your
situation too hypothetical to really digest. The one thing I can point
out is what you said about wanting a component to set a property in the
page. If you want to do that, then you have to know the class of the
page and so injecting a page would make sense. Of course that means
tightly coupling a component to a page, which to me doesn't make sense.
If you simply need a generic way of passing data between pages and
components, consider using a service that provides an untyped list or
putting something in the environment as Kristian suggested. I'm sorry I
can't be more helpful but as I said I'm not clear on what you're really
trying to do.

good luck
chris

János Jarecsni wrote:
 Hi Chris,

 I thought of pages as contexts for the components embedded within them.
 So, in one event handler of a component I would like to set some property or
 another (in the page object), and the other components in the page, which
 are also able to access this property may change their appearance (say, the
 .TML would test the property). Maybe I'm on a wrong track, please let me
 know :)

 thx
 Cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

   
 Janos,

 I'm having a hard time understanding a case that a component should know
 in which page it is embedded, so my suggestion probably wasn't a good
 one. Activation contexts aren't meant for components but for pages - you
 should be using component parameters to configure them, and if it's a
 more sophisticated component, probably a service.

 chris

 János Jarecsni wrote:
 
 and how a component can get to know the page in which it is included? I
 mean, I can't @InjectPage, as the component will be included in many
   
 kinds
 
 of pages.

 @Kristian: thx for the many ways :) I'll try these, hope that the
 @Environmental stuff is scalable (I'm trying to bypass session creation
   
 as
 
 much as possible)

 Is there a doc on the various annotations available?

 @Michael:
 Could you include a tiny bit of example? THX!

 Thx to you all
 cheers
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:


   
 5) @InjectPage the page and call the getter

 Kristian Marinkovic wrote:

 
 hi janos,

 there are several possibilities:

 1) declare a component parameter and pass in the variable

 2) put it in a ASO and inject the ASO in all your components (using
 @ApplicationState)
 the drawback is that any other page or component will be able to
   
 access
 
 the ASO

 3) put it into the Environment and read it whereever you need it in
   
 your
 
 nested components.
 be careful when you put your object in your environment. if you put it

   
 in

 
 during the action
 request it will not be able in the render request (because of the page
 redirect).

 page:

 @Inject Environment env;

 @Persist(flash) whateverclass w;

 onActivate(w) {  this.w= w }

 setupRender() { env.push(whateverclass.class,w);}

 components:

 @Environmental Whateverclass var;

 4) define a service that can take this variable (and saves it

   
 appropriatly

 
 so it is not
 lost on a redirect:)) and inject your service in the components where
 needed
 to retrieve the value.

 maybe there are some more possibilities :)

 g,
 kris




 János Jarecsni [EMAIL PROTECTED]
 29.04.2008 08:15
 Bitte antworten an
 Tapestry users users@tapestry.apache.org


 An
 Tapestry users users@tapestry.apache.org
 Kopie

 Thema
 page activation + components






 Hi there,

 I have an activatable page, in its onActivate(String param) method I

   
 save

 
 the param to a normal instance variable of the page class (no
 persistence!).
 How can any component embedded within this page access this variable?

 the page class:

 //...
 private String param;

 public void onActivate(String param) {
this.param = param;
 }


 public String getParam() {...}


 Thx in advance!
 Janos




   
 --
 http://thegodcode.net


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



 
 --
 http://thegodcode.net


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


 

-- 
http://thegodcode.net


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



Re: page activation + components

2008-04-29 Thread János Jarecsni
Hi Chris,

even so you could help :) I want this kind of generic way of passing around
information (component to component communication :)) so I'll look for the
solutions Kristian and you outlined.

thanks!
cheers,
janos

2008/4/29 Chris Lewis [EMAIL PROTECTED]:

 Janos,

 Without code or a description of your actual goal, I'm finding your
 situation too hypothetical to really digest. The one thing I can point
 out is what you said about wanting a component to set a property in the
 page. If you want to do that, then you have to know the class of the
 page and so injecting a page would make sense. Of course that means
 tightly coupling a component to a page, which to me doesn't make sense.
 If you simply need a generic way of passing data between pages and
 components, consider using a service that provides an untyped list or
 putting something in the environment as Kristian suggested. I'm sorry I
 can't be more helpful but as I said I'm not clear on what you're really
 trying to do.

 good luck
 chris

 János Jarecsni wrote:
  Hi Chris,
 
  I thought of pages as contexts for the components embedded within
 them.
  So, in one event handler of a component I would like to set some
 property or
  another (in the page object), and the other components in the page,
 which
  are also able to access this property may change their appearance (say,
 the
  .TML would test the property). Maybe I'm on a wrong track, please let me
  know :)
 
  thx
  Cheers,
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
 
  Janos,
 
  I'm having a hard time understanding a case that a component should
 know
  in which page it is embedded, so my suggestion probably wasn't a good
  one. Activation contexts aren't meant for components but for pages -
 you
  should be using component parameters to configure them, and if it's a
  more sophisticated component, probably a service.
 
  chris
 
  János Jarecsni wrote:
 
  and how a component can get to know the page in which it is included?
 I
  mean, I can't @InjectPage, as the component will be included in many
 
  kinds
 
  of pages.
 
  @Kristian: thx for the many ways :) I'll try these, hope that the
  @Environmental stuff is scalable (I'm trying to bypass session
 creation
 
  as
 
  much as possible)
 
  Is there a doc on the various annotations available?
 
  @Michael:
  Could you include a tiny bit of example? THX!
 
  Thx to you all
  cheers
  janos
 
  2008/4/29 Chris Lewis [EMAIL PROTECTED]:
 
 
 
  5) @InjectPage the page and call the getter
 
  Kristian Marinkovic wrote:
 
 
  hi janos,
 
  there are several possibilities:
 
  1) declare a component parameter and pass in the variable
 
  2) put it in a ASO and inject the ASO in all your components (using
  @ApplicationState)
  the drawback is that any other page or component will be able to
 
  access
 
  the ASO
 
  3) put it into the Environment and read it whereever you need it in
 
  your
 
  nested components.
  be careful when you put your object in your environment. if you put
 it
 
 
  in
 
 
  during the action
  request it will not be able in the render request (because of the
 page
  redirect).
 
  page:
 
  @Inject Environment env;
 
  @Persist(flash) whateverclass w;
 
  onActivate(w) {  this.w= w }
 
  setupRender() { env.push(whateverclass.class,w);}
 
  components:
 
  @Environmental Whateverclass var;
 
  4) define a service that can take this variable (and saves it
 
 
  appropriatly
 
 
  so it is not
  lost on a redirect:)) and inject your service in the components
 where
  needed
  to retrieve the value.
 
  maybe there are some more possibilities :)
 
  g,
  kris
 
 
 
 
  János Jarecsni [EMAIL PROTECTED]
  29.04.2008 08:15
  Bitte antworten an
  Tapestry users users@tapestry.apache.org
 
 
  An
  Tapestry users users@tapestry.apache.org
  Kopie
 
  Thema
  page activation + components
 
 
 
 
 
 
  Hi there,
 
  I have an activatable page, in its onActivate(String param) method I
 
 
  save
 
 
  the param to a normal instance variable of the page class (no
  persistence!).
  How can any component embedded within this page access this
 variable?
 
  the page class:
 
  //...
  private String param;
 
  public void onActivate(String param) {
 this.param = param;
  }
 
 
  public String getParam() {...}
 
 
  Thx in advance!
  Janos
 
 
 
 
 
  --
  http://thegodcode.net
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  --
  http://thegodcode.net
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 http://thegodcode.net


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




Re: page activation + components

2008-04-29 Thread János Jarecsni
Hi there,

the service approach (as I expected) is session-agnostic (and is
page-independent so concurrent users would interfere badly), therefore is
not ok.

I will now try the Environment approach... if that is session-aware :)

thx again
janos

2008/4/29 János Jarecsni [EMAIL PROTECTED]:

 Hi Chris,

 even so you could help :) I want this kind of generic way of passing
 around information (component to component communication :)) so I'll look
 for the solutions Kristian and you outlined.

 thanks!

 cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  Janos,
 
  Without code or a description of your actual goal, I'm finding your
  situation too hypothetical to really digest. The one thing I can point
  out is what you said about wanting a component to set a property in the
  page. If you want to do that, then you have to know the class of the
  page and so injecting a page would make sense. Of course that means
  tightly coupling a component to a page, which to me doesn't make sense.
  If you simply need a generic way of passing data between pages and
  components, consider using a service that provides an untyped list or
  putting something in the environment as Kristian suggested. I'm sorry I
  can't be more helpful but as I said I'm not clear on what you're really
  trying to do.
 
  good luck
  chris
 
  János Jarecsni wrote:
   Hi Chris,
  
   I thought of pages as contexts for the components embedded within
  them.
   So, in one event handler of a component I would like to set some
  property or
   another (in the page object), and the other components in the page,
  which
   are also able to access this property may change their appearance
  (say, the
   .TML would test the property). Maybe I'm on a wrong track, please let
  me
   know :)
  
   thx
   Cheers,
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
  
   Janos,
  
   I'm having a hard time understanding a case that a component should
  know
   in which page it is embedded, so my suggestion probably wasn't a good
   one. Activation contexts aren't meant for components but for pages -
  you
   should be using component parameters to configure them, and if it's a
   more sophisticated component, probably a service.
  
   chris
  
   János Jarecsni wrote:
  
   and how a component can get to know the page in which it is
  included? I
   mean, I can't @InjectPage, as the component will be included in many
  
   kinds
  
   of pages.
  
   @Kristian: thx for the many ways :) I'll try these, hope that the
   @Environmental stuff is scalable (I'm trying to bypass session
  creation
  
   as
  
   much as possible)
  
   Is there a doc on the various annotations available?
  
   @Michael:
   Could you include a tiny bit of example? THX!
  
   Thx to you all
   cheers
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
  
  
   5) @InjectPage the page and call the getter
  
   Kristian Marinkovic wrote:
  
  
   hi janos,
  
   there are several possibilities:
  
   1) declare a component parameter and pass in the variable
  
   2) put it in a ASO and inject the ASO in all your components
  (using
   @ApplicationState)
   the drawback is that any other page or component will be able to
  
   access
  
   the ASO
  
   3) put it into the Environment and read it whereever you need it
  in
  
   your
  
   nested components.
   be careful when you put your object in your environment. if you
  put it
  
  
   in
  
  
   during the action
   request it will not be able in the render request (because of the
  page
   redirect).
  
   page:
  
   @Inject Environment env;
  
   @Persist(flash) whateverclass w;
  
   onActivate(w) {  this.w= w }
  
   setupRender() { env.push(whateverclass.class,w);}
  
   components:
  
   @Environmental Whateverclass var;
  
   4) define a service that can take this variable (and saves it
  
  
   appropriatly
  
  
   so it is not
   lost on a redirect:)) and inject your service in the components
  where
   needed
   to retrieve the value.
  
   maybe there are some more possibilities :)
  
   g,
   kris
  
  
  
  
   János Jarecsni [EMAIL PROTECTED]
   29.04.2008 08:15
   Bitte antworten an
   Tapestry users users@tapestry.apache.org
  
  
   An
   Tapestry users users@tapestry.apache.org
   Kopie
  
   Thema
   page activation + components
  
  
  
  
  
  
   Hi there,
  
   I have an activatable page, in its onActivate(String param) method
  I
  
  
   save
  
  
   the param to a normal instance variable of the page class (no
   persistence!).
   How can any component embedded within this page access this
  variable?
  
   the page class:
  
   //...
   private String param;
  
   public void onActivate(String param) {
  this.param = param;
   }
  
  
   public String getParam() {...}
  
  
   Thx in advance!
   Janos
  
  
  
  
  
   --
   http://thegodcode.net
  
  
  
  -
   To unsubscribe, e-mail: [EMAIL

Re: page activation + components

2008-04-29 Thread Andy Huhn

Hello,

You can define the scope of each service...you can set that particular
service to be tied to only one session.

See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html, and
search for perthread.

Thanks,
Andy

On Tue, 29 Apr 2008 18:02:52 +0200, János Jarecsni
[EMAIL PROTECTED] wrote:
 Hi there,
 
 the service approach (as I expected) is session-agnostic (and is
 page-independent so concurrent users would interfere badly), therefore is
 not ok.
 
 I will now try the Environment approach... if that is session-aware :)
 
 thx again
 janos
 
 2008/4/29 János Jarecsni [EMAIL PROTECTED]:
 
 Hi Chris,

 even so you could help :) I want this kind of generic way of passing
 around information (component to component communication :)) so I'll
 look
 for the solutions Kristian and you outlined.

 thanks!

 cheers,
 janos

 2008/4/29 Chris Lewis [EMAIL PROTECTED]:

  Janos,
 
  Without code or a description of your actual goal, I'm finding your
  situation too hypothetical to really digest. The one thing I can point
  out is what you said about wanting a component to set a property in
 the
  page. If you want to do that, then you have to know the class of the
  page and so injecting a page would make sense. Of course that means
  tightly coupling a component to a page, which to me doesn't make
 sense.
  If you simply need a generic way of passing data between pages and
  components, consider using a service that provides an untyped list or
  putting something in the environment as Kristian suggested. I'm sorry
 I
  can't be more helpful but as I said I'm not clear on what you're
 really
  trying to do.
 
  good luck
  chris
 
  János Jarecsni wrote:
   Hi Chris,
  
   I thought of pages as contexts for the components embedded within
  them.
   So, in one event handler of a component I would like to set some
  property or
   another (in the page object), and the other components in the page,
  which
   are also able to access this property may change their appearance
  (say, the
   .TML would test the property). Maybe I'm on a wrong track, please
 let
  me
   know :)
  
   thx
   Cheers,
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
  
   Janos,
  
   I'm having a hard time understanding a case that a component should
  know
   in which page it is embedded, so my suggestion probably wasn't a
 good
   one. Activation contexts aren't meant for components but for pages
 -
  you
   should be using component parameters to configure them, and if it's
 a
   more sophisticated component, probably a service.
  
   chris
  
   János Jarecsni wrote:
  
   and how a component can get to know the page in which it is
  included? I
   mean, I can't @InjectPage, as the component will be included in
 many
  
   kinds
  
   of pages.
  
   @Kristian: thx for the many ways :) I'll try these, hope that the
   @Environmental stuff is scalable (I'm trying to bypass session
  creation
  
   as
  
   much as possible)
  
   Is there a doc on the various annotations available?
  
   @Michael:
   Could you include a tiny bit of example? THX!
  
   Thx to you all
   cheers
   janos
  
   2008/4/29 Chris Lewis [EMAIL PROTECTED]:
  
  
  
   5) @InjectPage the page and call the getter
  
   Kristian Marinkovic wrote:
  
  
   hi janos,
  
   there are several possibilities:
  
   1) declare a component parameter and pass in the variable
  
   2) put it in a ASO and inject the ASO in all your components
  (using
   @ApplicationState)
   the drawback is that any other page or component will be able to
  
   access
  
   the ASO
  
   3) put it into the Environment and read it whereever you need it
  in
  
   your
  
   nested components.
   be careful when you put your object in your environment. if you
  put it
  
  
   in
  
  
   during the action
   request it will not be able in the render request (because of
 the
  page
   redirect).
  
   page:
  
   @Inject Environment env;
  
   @Persist(flash) whateverclass w;
  
   onActivate(w) {  this.w= w }
  
   setupRender() { env.push(whateverclass.class,w);}
  
   components:
  
   @Environmental Whateverclass var;
  
   4) define a service that can take this variable (and saves it
  
  
   appropriatly
  
  
   so it is not
   lost on a redirect:)) and inject your service in the components
  where
   needed
   to retrieve the value.
  
   maybe there are some more possibilities :)
  
   g,
   kris
  
  
  
  
   János Jarecsni [EMAIL PROTECTED]
   29.04.2008 08:15
   Bitte antworten an
   Tapestry users users@tapestry.apache.org
  
  
   An
   Tapestry users users@tapestry.apache.org
   Kopie
  
   Thema
   page activation + components
  
  
  
  
  
  
   Hi there,
  
   I have an activatable page, in its onActivate(String param)
 method
  I
  
  
   save
  
  
   the param to a normal instance variable of the page class (no
   persistence!).
   How can any component embedded within this page access this
  variable?
  
   the page class:
  
   //...
   private