Re: Live support solution

2013-04-23 Thread Tom Nys

I found that the problem accurs in the onActivate() function.

Our pages give information between eachotter trought the activationcontext.
Since it's a fake request it doesn't have this context, and or pages are 
made that they redirect when the context is empty.
removing this check is not realy an option. I guess that putting the chat in 
the sidebar is just impossible becous of this?


-Oorspronkelijk bericht- 
From: Lance Java

Sent: Monday, April 22, 2013 6:14 PM
To: Tapestry users
Subject: Re: Live support solution

Also, do you have a security framework that might be getting in the way?
Perhaps this framework is returning a login page Link because it can't find
the session on the Fake request.
On 22 Apr 2013 16:56, Lance Java lance.j...@googlemail.com wrote:


I get the feeling that your push action is returning a Link (or a page or
something) when it should return a Block. I'm not sure why else tapestry
would try and call response.encodeRedirectURL(...)

Take another look at the demo, there are two topics defined in 
ChatService:


/chatservice/users - the java.util.Collection of users is broadcast on
this topic whenever
a user enters or leaves the chatroom

/chatservice/chat - All chat messages are broadcast to this topic.

Then there is a page with two PushTargets (one for each topic)

https://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/resources/org/lazan/t5/cometddemo/pages/Chat.tml

The main guts of the demo is in these two classes:

https://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/java/org/lazan/t5/cometddemo/services/internal/ChatServiceImpl.java


https://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/java/org/lazan/t5/cometddemo/services/internal/ChatSubscriptionListener.java
 On 22 Apr 2013 15:58, Tom Nys runesmac...@hotmail.com wrote:


Well i'm trying to put the chatmessages into a div thats in my sidebar
(admin side of my application).

I have the error on all the pages that have an OnPassivate() method.

I tryed the demo application but i didn't understand everything that's
happening so i'm tryng to start from scratch (looking at the wiki pages 
you

posted)
I also think one of the problems is that we use an ssl connection (no
real proof here) and the chat also needs to be encrypted. i don't know if
this chat is.

What i need the application to eventually do:

a client can log onto the site and open a chat with an admin.
the admin gets a notice and clicks on the name of that client to open the
chat with him.
they start chatting and the admin eventually closes that chat. he can
then choos anothcer client that opened the chat.

The side of the admin needs to be in the sidebar component wich appears
on every page of our application so he can go to the details of that user
and don't lose the chat.

The client side is just a page for the moment (so no specials there, just
a simple chat reciever-sender like on your wiki).

Greets
Runesmacher
-Oorspronkelijk bericht- From: Lance Java
Sent: Monday, April 22, 2013 4:17 PM
To: Tapestry users
Subject: Re: Live support solution

Hi, sorry for the late response, I've  been on holiday. I'm the author of
tapestry-cometd.

Tapestry-cometd has to fool tapestry into thinking there is a real
request /response when a push is initiated. It does this via a
FakeHttpServletRequest (and Response). Note that not all methods are
implemented in the fake objects (eg encodeRedirectURL)

It looks like your push action is trying to do a redirect. Can you tell 
me

a bit more about what you're trying to do in your push?

The main use case for tapestry-cometd is to render a template and return 
a

Block which is used to append, prepend or replace the content in a
PushTarget.

I have not done a release yet but if you take a look at trunk for
tapestry-cometd and tapestry-cometd-demo, you will see a much better chat
example.

Cheers,
Lance.
On 22 Apr 2013 09:13, Tom Nys runesmac...@hotmail.com wrote:

 I've looked into tapestry-cometd again. hoping to find a solution.


but i get the folowing error when trying to implement it in my sidebar
component.

   java.lang.UnsupportedOperationException
   encodeRedirectURL

   Filter stack frames Stack trace
   org.lazan.t5.cometd.services.internal.**
FakeHttpServletResponse.encodeRedirectURL(**
FakeHttpServletResponse.java:109)
   org.apache.tapestry5.internal.services.ResponseImpl.**
encodeRedirectURL(ResponseImpl.java:67)
   org.apache.tapestry5.internal.services.LinkImpl.**
toRedirectURI(LinkImpl.java:138)
   org.apache.tapestry5.internal.services.**
AjaxLinkComponentEventResultProcessor.processResultValue(
AjaxLinkComponentEventResultProcessor.java:41)
   org.apache.tapestry5.internal.services.**
AjaxLinkComponentEventResultProcessor.processResultValue(
AjaxLinkComponentEventResultProcessor.java:27)
   org.apache.tapestry5.internal.services.**

Re: Live support solution

2013-04-23 Thread Lance Java
Do you do any redirecting in your onActivate? (eg do you return another
page under some conditions).

Can you show me the (simplified) code that's firing for your push?

I think I might have spotted a bug, tapestry-cometd will always pass
EMPTY_EVENT_CONTEXT as the page activation context for push events. Perhaps
this is causing your issue?

https://github.com/uklance/tapestry-cometd/blob/master/src/main/java/org/lazan/t5/cometd/services/internal/PushManagerImpl.java#L60
On 23 Apr 2013 08:15, Tom Nys runesmac...@hotmail.com wrote:

 I found that the problem accurs in the onActivate() function.

 Our pages give information between eachotter trought the activationcontext.
 Since it's a fake request it doesn't have this context, and or pages are
 made that they redirect when the context is empty.
 removing this check is not realy an option. I guess that putting the chat
 in the sidebar is just impossible becous of this?

 -Oorspronkelijk bericht- From: Lance Java
 Sent: Monday, April 22, 2013 6:14 PM
 To: Tapestry users
 Subject: Re: Live support solution

 Also, do you have a security framework that might be getting in the way?
 Perhaps this framework is returning a login page Link because it can't find
 the session on the Fake request.
 On 22 Apr 2013 16:56, Lance Java lance.j...@googlemail.com wrote:

  I get the feeling that your push action is returning a Link (or a page or
 something) when it should return a Block. I'm not sure why else tapestry
 would try and call response.encodeRedirectURL(...**)

 Take another look at the demo, there are two topics defined in
 ChatService:

 /chatservice/users - the java.util.Collection of users is broadcast on
 this topic whenever
 a user enters or leaves the chatroom

 /chatservice/chat - All chat messages are broadcast to this topic.

 Then there is a page with two PushTargets (one for each topic)

 https://github.com/uklance/**tapestry-cometd-demo/blob/**
 master/src/main/resources/org/**lazan/t5/cometddemo/pages/**Chat.tmlhttps://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/resources/org/lazan/t5/cometddemo/pages/Chat.tml

 The main guts of the demo is in these two classes:

 https://github.com/uklance/**tapestry-cometd-demo/blob/**
 master/src/main/java/org/**lazan/t5/cometddemo/services/**
 internal/ChatServiceImpl.javahttps://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/java/org/lazan/t5/cometddemo/services/internal/ChatServiceImpl.java


 https://github.com/uklance/**tapestry-cometd-demo/blob/**
 master/src/main/java/org/**lazan/t5/cometddemo/services/**internal/**
 ChatSubscriptionListener.javahttps://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/java/org/lazan/t5/cometddemo/services/internal/ChatSubscriptionListener.java
  On 22 Apr 2013 15:58, Tom Nys runesmac...@hotmail.com wrote:

  Well i'm trying to put the chatmessages into a div thats in my sidebar
 (admin side of my application).

 I have the error on all the pages that have an OnPassivate() method.

 I tryed the demo application but i didn't understand everything that's
 happening so i'm tryng to start from scratch (looking at the wiki pages
 you
 posted)
 I also think one of the problems is that we use an ssl connection (no
 real proof here) and the chat also needs to be encrypted. i don't know if
 this chat is.

 What i need the application to eventually do:

 a client can log onto the site and open a chat with an admin.
 the admin gets a notice and clicks on the name of that client to open the
 chat with him.
 they start chatting and the admin eventually closes that chat. he can
 then choos anothcer client that opened the chat.

 The side of the admin needs to be in the sidebar component wich appears
 on every page of our application so he can go to the details of that user
 and don't lose the chat.

 The client side is just a page for the moment (so no specials there, just
 a simple chat reciever-sender like on your wiki).

 Greets
 Runesmacher
 -Oorspronkelijk bericht- From: Lance Java
 Sent: Monday, April 22, 2013 4:17 PM
 To: Tapestry users
 Subject: Re: Live support solution

 Hi, sorry for the late response, I've  been on holiday. I'm the author of
 tapestry-cometd.

 Tapestry-cometd has to fool tapestry into thinking there is a real
 request /response when a push is initiated. It does this via a
 FakeHttpServletRequest (and Response). Note that not all methods are
 implemented in the fake objects (eg encodeRedirectURL)

 It looks like your push action is trying to do a redirect. Can you tell
 me
 a bit more about what you're trying to do in your push?

 The main use case for tapestry-cometd is to render a template and return
 a
 Block which is used to append, prepend or replace the content in a
 PushTarget.

 I have not done a release yet but if you take a look at trunk for
 tapestry-cometd and tapestry-cometd-demo, you will see a much better chat
 example.

 Cheers,
 Lance.
 On 22 Apr 2013 09:13, Tom Nys 

Re: Live support solution

2013-04-23 Thread Lance Java
I've created an issue here
https://github.com/uklance/tapestry-cometd/issues/55


Re: Live support solution

2013-04-23 Thread Tom Nys

the activate is somthing like:

Object onActivate(context)
{
   if(context.count()0)
   do somthing
   else
   redirect to other page
}

my onchat method is unchanged from your demo project.


I'm now trying to add an eventlink to the list of users to make 1v1 chat 
possible by changing the topic.


Try adding an eventlink in the loop of users in your demo project.

t:block id=chatUsersBlock
   ul
   t:loop source=chatUsers value=currentUser
   lit:eventlink event=user 
context=${currentUser}${currentUser}/eventlink/li

   /t:loop
   /ul
/t:block

and in java

void onUser(String user){
   system.out.println(user)
}

this also gives the encodeURL error. (is this the same error as what you 
said?)


any other idea on how to do this?

-Oorspronkelijk bericht- 
From: Lance Java

Sent: Tuesday, April 23, 2013 10:24 AM
To: Tapestry users
Subject: Re: Live support solution

Do you do any redirecting in your onActivate? (eg do you return another
page under some conditions).

Can you show me the (simplified) code that's firing for your push?

I think I might have spotted a bug, tapestry-cometd will always pass
EMPTY_EVENT_CONTEXT as the page activation context for push events. Perhaps
this is causing your issue?

https://github.com/uklance/tapestry-cometd/blob/master/src/main/java/org/lazan/t5/cometd/services/internal/PushManagerImpl.java#L60
On 23 Apr 2013 08:15, Tom Nys runesmac...@hotmail.com wrote:


I found that the problem accurs in the onActivate() function.

Our pages give information between eachotter trought the 
activationcontext.

Since it's a fake request it doesn't have this context, and or pages are
made that they redirect when the context is empty.
removing this check is not realy an option. I guess that putting the chat
in the sidebar is just impossible becous of this?

-Oorspronkelijk bericht- From: Lance Java
Sent: Monday, April 22, 2013 6:14 PM
To: Tapestry users
Subject: Re: Live support solution

Also, do you have a security framework that might be getting in the way?
Perhaps this framework is returning a login page Link because it can't 
find

the session on the Fake request.
On 22 Apr 2013 16:56, Lance Java lance.j...@googlemail.com wrote:

 I get the feeling that your push action is returning a Link (or a page or

something) when it should return a Block. I'm not sure why else tapestry
would try and call response.encodeRedirectURL(...**)

Take another look at the demo, there are two topics defined in
ChatService:

/chatservice/users - the java.util.Collection of users is broadcast on
this topic whenever
a user enters or leaves the chatroom

/chatservice/chat - All chat messages are broadcast to this topic.

Then there is a page with two PushTargets (one for each topic)

https://github.com/uklance/**tapestry-cometd-demo/blob/**
master/src/main/resources/org/**lazan/t5/cometddemo/pages/**Chat.tmlhttps://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/resources/org/lazan/t5/cometddemo/pages/Chat.tml

The main guts of the demo is in these two classes:

https://github.com/uklance/**tapestry-cometd-demo/blob/**
master/src/main/java/org/**lazan/t5/cometddemo/services/**
internal/ChatServiceImpl.javahttps://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/java/org/lazan/t5/cometddemo/services/internal/ChatServiceImpl.java


https://github.com/uklance/**tapestry-cometd-demo/blob/**
master/src/main/java/org/**lazan/t5/cometddemo/services/**internal/**
ChatSubscriptionListener.javahttps://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/java/org/lazan/t5/cometddemo/services/internal/ChatSubscriptionListener.java
 On 22 Apr 2013 15:58, Tom Nys runesmac...@hotmail.com wrote:

 Well i'm trying to put the chatmessages into a div thats in my sidebar

(admin side of my application).

I have the error on all the pages that have an OnPassivate() method.

I tryed the demo application but i didn't understand everything that's
happening so i'm tryng to start from scratch (looking at the wiki pages
you
posted)
I also think one of the problems is that we use an ssl connection (no
real proof here) and the chat also needs to be encrypted. i don't know 
if

this chat is.

What i need the application to eventually do:

a client can log onto the site and open a chat with an admin.
the admin gets a notice and clicks on the name of that client to open 
the

chat with him.
they start chatting and the admin eventually closes that chat. he can
then choos anothcer client that opened the chat.

The side of the admin needs to be in the sidebar component wich appears
on every page of our application so he can go to the details of that 
user

and don't lose the chat.

The client side is just a page for the moment (so no specials there, 
just

a simple chat reciever-sender like on your wiki).

Greets
Runesmacher
-Oorspronkelijk bericht- From: Lance Java
Sent: Monday, April 22, 2013 4:17 PM
To: Tapestry users
Subject: Re: Live support solution


Re: Live support solution

2013-04-23 Thread Lance Java
Unfortunately, the bug in tapestry-cometd means that context.getCount()
will always be 0. I will need to fix this bug.

This is executing your redirect logic in the push event which is then
failing.

I'll try to get you a fix over the weekend. I've detailed the bug fix quite
thoroughly in the issue.
On 23 Apr 2013 10:36, Tom Nys runesmac...@hotmail.com wrote:

 the activate is somthing like:

 Object onActivate(context)
 {
if(context.count()0)
do somthing
else
redirect to other page
 }

 my onchat method is unchanged from your demo project.


 I'm now trying to add an eventlink to the list of users to make 1v1 chat
 possible by changing the topic.

 Try adding an eventlink in the loop of users in your demo project.

 t:block id=chatUsersBlock
ul
t:loop source=chatUsers value=currentUser
lit:eventlink event=user context=${currentUser}${**
 currentUser}/eventlink/li
/t:loop
/ul
 /t:block

 and in java

 void onUser(String user){
system.out.println(user)
 }

 this also gives the encodeURL error. (is this the same error as what you
 said?)

 any other idea on how to do this?

 -Oorspronkelijk bericht- From: Lance Java
 Sent: Tuesday, April 23, 2013 10:24 AM
 To: Tapestry users
 Subject: Re: Live support solution

 Do you do any redirecting in your onActivate? (eg do you return another
 page under some conditions).

 Can you show me the (simplified) code that's firing for your push?

 I think I might have spotted a bug, tapestry-cometd will always pass
 EMPTY_EVENT_CONTEXT as the page activation context for push events. Perhaps
 this is causing your issue?

 https://github.com/uklance/**tapestry-cometd/blob/master/**
 src/main/java/org/lazan/t5/**cometd/services/internal/**
 PushManagerImpl.java#L60https://github.com/uklance/tapestry-cometd/blob/master/src/main/java/org/lazan/t5/cometd/services/internal/PushManagerImpl.java#L60
 On 23 Apr 2013 08:15, Tom Nys runesmac...@hotmail.com wrote:

  I found that the problem accurs in the onActivate() function.

 Our pages give information between eachotter trought the
 activationcontext.
 Since it's a fake request it doesn't have this context, and or pages are
 made that they redirect when the context is empty.
 removing this check is not realy an option. I guess that putting the chat
 in the sidebar is just impossible becous of this?

 -Oorspronkelijk bericht- From: Lance Java
 Sent: Monday, April 22, 2013 6:14 PM
 To: Tapestry users
 Subject: Re: Live support solution

 Also, do you have a security framework that might be getting in the way?
 Perhaps this framework is returning a login page Link because it can't
 find
 the session on the Fake request.
 On 22 Apr 2013 16:56, Lance Java lance.j...@googlemail.com wrote:

  I get the feeling that your push action is returning a Link (or a page or

 something) when it should return a Block. I'm not sure why else tapestry
 would try and call response.encodeRedirectURL(...)

 Take another look at the demo, there are two topics defined in
 ChatService:

 /chatservice/users - the java.util.Collection of users is broadcast on
 this topic whenever
 a user enters or leaves the chatroom

 /chatservice/chat - All chat messages are broadcast to this topic.

 Then there is a page with two PushTargets (one for each topic)

 https://github.com/uklance/tapestry-cometd-demo/blob/**https://github.com/uklance/**tapestry-cometd-demo/blob/**
 master/src/main/resources/org/lazan/t5/cometddemo/pages/
 Chat.tmlhttps://github.com/**uklance/tapestry-cometd-demo/**
 blob/master/src/main/**resources/org/lazan/t5/**
 cometddemo/pages/Chat.tmlhttps://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/resources/org/lazan/t5/cometddemo/pages/Chat.tml
 

 The main guts of the demo is in these two classes:

 https://github.com/uklance/tapestry-cometd-demo/blob/**https://github.com/uklance/**tapestry-cometd-demo/blob/**
 master/src/main/java/org/lazan/t5/cometddemo/services/
 internal/ChatServiceImpl.java**https://github.com/uklance/**
 tapestry-cometd-demo/blob/**master/src/main/java/org/**
 lazan/t5/cometddemo/services/**internal/ChatServiceImpl.javahttps://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/java/org/lazan/t5/cometddemo/services/internal/ChatServiceImpl.java
 


 https://github.com/uklance/tapestry-cometd-demo/blob/**https://github.com/uklance/**tapestry-cometd-demo/blob/**
 master/src/main/java/org/lazan/t5/cometddemo/services/***
 *internal/**
 ChatSubscriptionListener.java**https://github.com/uklance/**
 tapestry-cometd-demo/blob/**master/src/main/java/org/**
 lazan/t5/cometddemo/services/**internal/**ChatSubscriptionListener.javahttps://github.com/uklance/tapestry-cometd-demo/blob/master/src/main/java/org/lazan/t5/cometddemo/services/internal/ChatSubscriptionListener.java
 
  On 22 Apr 2013 15:58, Tom Nys runesmac...@hotmail.com wrote:

  Well i'm trying to put the chatmessages into a div thats in 

Re: Live support solution

2013-04-23 Thread Lance Java
Unfortunately, the bug in tapestry-cometd means that context.getCount()
will always be 0. I will need to fix this bug.

This is executing your redirect logic in the push event which is then
failing.

I'll try to get you a fix over the weekend. I've detailed the bug fix quite
thoroughly in the issue.


Handling onEvent change from a Select component

2013-04-23 Thread Ben Titmarsh
After a lot of Googling around I'm unable to find a solution to my problem.  I 
want to handle the change event from a Select Component.  I'm creating a bunch 
of these components in a loop:

t:select t:id=type model=cardTypeModel encoder=cardTypeEncoder 
value=cubeCard.cardType blankOption=never/

And I've got the following handler declaration:

@OnEvent(component=type, value = change)
public Object onChangeOfCardType(String value) {
System.out.println(onChange!!!);
return cardTypeZone.getBody();
}

Ideally I want to provide some context to this handler too so that it knows 
which CardType to update (i.e. which Select the event came from).  The handler 
just isn't getting called at the moment, what am I doing wrong?
  

@BeginRender equivalent for component AJAX events

2013-04-23 Thread Michael Prescott
I have a component that includes a zone - the zone is periodically
refreshed using the ZoneRefresh mixin.

Is there any equivalent to @BeginRender that I can use to set up data to
support the zone re-rendering?  @BeginRender methods are called when the
page renders, but they're not called when the zone re-renders via ajax.

The only event I've found that gets called is @PageAttached, but of course
this is deprecated.

Any tips would be appreciated!

Gratefully,

Michael


Re: Handling onEvent change from a Select component

2013-04-23 Thread Jens Breitenstein

Hi Ben!

I am using the tapestry-jquery mixin for this:

tml:

t:select t:id=yourId model=yourModel encoder=yourEncoder 
t:validate=required value=yourValue
t:mixins=jquery/bind bind.context=${yourValue.pk} 
bind.event=yourSelectionChanged bind.eventType=change/


page:

public Object onYourSelectionChanged(final long pk)
{
System.out.println(pk);
return null;
}



so any change of the select input control triggers change which calls 
the yourSelectionChanged method, which is named 
onYourSelectionChanged in java by tapestry convention. I believe you 
can use [${yourValue.pk}, ${whateverId}]  to pass multiple arguments to 
your method, too (be careful: this is just my gut feeling, never tried it)


Jens



Am 23.04.13 17:58, schrieb Ben Titmarsh:

After a lot of Googling around I'm unable to find a solution to my problem.  I 
want to handle the change event from a Select Component.  I'm creating a bunch 
of these components in a loop:

t:select t:id=type model=cardTypeModel encoder=cardTypeEncoder 
value=cubeCard.cardType blankOption=never/

And I've got the following handler declaration:

 @OnEvent(component=type, value = change)
 public Object onChangeOfCardType(String value) {
 System.out.println(onChange!!!);
 return cardTypeZone.getBody();
 }
 
Ideally I want to provide some context to this handler too so that it knows which CardType to update (i.e. which Select the event came from).  The handler just isn't getting called at the moment, what am I doing wrong?





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



Re: Handling onEvent change from a Select component

2013-04-23 Thread George Christman
Hi Ben, a really basic example. I'm assuming your trying to loop the zones,
I hope this helps.


t:Loop source=products value=product
${product}
t:select t:id=cardType validate=required zone=${product}/
t:zone t:id=cardTypeZone id=${product}

t:if test=cardTypes
p ${cardTypes}/p
t:if

t:zone
t:Loop


@Property
private CardType cardType;
@Property
private String cardTypes;
@InjectComponent
private Zone cardTypeZone;
private String products = desk,computer;
@Property
private String _product;

public String[] getProducts() {
return products.split(,);
}

public Object onValueChanged(CardType cardType) {
cardTypes = findCardType(cardType);
return cardTypeZone.getBody();
}

public String findCardType(final CardType cardType) {
switch (cardType) {
case DISCOVER:
return Discover Card;
case VISA:
return Visa;
case MASTERCARD:
return Mastercard;
default:
return American Express;
}
}

public enum CardType {
DISCOVER, VISA, MASTERCARD, AMEX;
}


On Tue, Apr 23, 2013 at 3:27 PM, Jens Breitenstein mailingl...@j-b-s.dewrote:

 Hi Ben!

 I am using the tapestry-jquery mixin for this:

 tml:

 t:select t:id=yourId model=yourModel encoder=yourEncoder
 t:validate=required value=yourValue
 t:mixins=jquery/bind bind.context=${yourValue.pk} bind.event=
 **yourSelectionChanged bind.eventType=change/

 page:

 public Object onYourSelectionChanged(final long pk)
 {
 System.out.println(pk);
 return null;
 }



 so any change of the select input control triggers change which calls
 the yourSelectionChanged method, which is named onYourSelectionChanged
 in java by tapestry convention. I believe you can use [${yourValue.pk},
 ${whateverId}]  to pass multiple arguments to your method, too (be careful:
 this is just my gut feeling, never tried it)

 Jens



 Am 23.04.13 17:58, schrieb Ben Titmarsh:

  After a lot of Googling around I'm unable to find a solution to my
 problem.  I want to handle the change event from a Select Component.  I'm
 creating a bunch of these components in a loop:

 t:select t:id=type model=cardTypeModel encoder=cardTypeEncoder
 value=cubeCard.cardType blankOption=never/

 And I've got the following handler declaration:

  @OnEvent(component=type, value = change)
  public Object onChangeOfCardType(String value) {
  System.out.println(onChange!!**!);
  return cardTypeZone.getBody();
  }
  Ideally I want to provide some context to this handler too so that
 it knows which CardType to update (i.e. which Select the event came from).
  The handler just isn't getting called at the moment, what am I doing wrong?




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




-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York


Re: mixin script added in afterrender not fired for xhr requests

2013-04-23 Thread Paul Stanton
Turned out this was because I was adding the script via 
ajaxResponseRenderer.addCallback which used to be the recommended 
approach.


JavascriptSupport now handles partial renders via partialMode (if you 
look at the source).


Perhaps ajaxResponseRenderer.addCallback should be deprecated now?

p.

On 22/04/2013 11:56 AM, Paul Stanton wrote:

Feel free to answer on StackOverflow and I will give you the rep points.

http://stackoverflow.com/questions/16138055/mixin-script-added-in-afterrender-not-fired-for-xhr-requests 



On 21/04/2013 4:05 PM, Paul Stanton wrote:

this is tapestry 5.3

On 19/04/2013 11:28 AM, Paul Stanton wrote:

Hi all,

Can someone familiar with the mixin lifecycle please advise me:

I have a mixin which triggers some javascript from 'afterRender'. I 
do this in 'afterRender' because I need the field's clientId to be 
initialised.


It works great if the Field it attaches to is rendered when the page 
is first rendered, however if it is rendered as part of a zone 
update/xhr request, the script is never sent to the client.


I have breakpointed the JavaScriptCallback and while it is 
successfully added to the ajaxResponseRenderer, it is never called.


Thanks for advice!


code Eg:

public class MyMixin
{
...

void afterRender()
{
addScript(MyMixin.create('%s', '%s');, 
field.getClientId(), myVariable);

}

private void addScript(final String format, final Object... args)
{
if (!request.isXHR())
{
jsSupport.addScript(InitializationPriority.NORMAL, 
format, args);

return;
}

ajaxResponseRenderer.addCallback(new JavaScriptCallback()
{
@Override
public void run(JavaScriptSupport javascriptSupport)
{
javascriptSupport.addScript(InitializationPriority.NORMAL, format, 
args);

}
});
}
}

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





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





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





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



Re: mixin script added in afterrender not fired for xhr requests

2013-04-23 Thread Paul Stanton
Actually, no .. I cannot just use JavascriptSupport.addScript 
everywhere I used to use AjaxResponseRenderer.addCallback


In XHR cases I get: UnknownValueException - No object of type 
org.apache.tapestry5.services.javascript.JavaScriptSupport is available 
from the Environment.


I wonder why this is not the case in the Mixin's afterRender.. ?

This is getting confusing because calling 
AjaxResponseRenderer.addCallback does not work in the case of the 
Mixin.afterRender, however JavascriptSupport does not work in XHR 
event handlers.


I imagine this has to do with the render phase somehow... would love to 
hear some experts opinion...


thanks, p.

On 24/04/2013 2:40 PM, Paul Stanton wrote:
Turned out this was because I was adding the script via 
ajaxResponseRenderer.addCallback which used to be the recommended 
approach.


JavascriptSupport now handles partial renders via partialMode (if 
you look at the source).


Perhaps ajaxResponseRenderer.addCallback should be deprecated now?

p.

On 22/04/2013 11:56 AM, Paul Stanton wrote:

Feel free to answer on StackOverflow and I will give you the rep points.

http://stackoverflow.com/questions/16138055/mixin-script-added-in-afterrender-not-fired-for-xhr-requests 



On 21/04/2013 4:05 PM, Paul Stanton wrote:

this is tapestry 5.3

On 19/04/2013 11:28 AM, Paul Stanton wrote:

Hi all,

Can someone familiar with the mixin lifecycle please advise me:

I have a mixin which triggers some javascript from 'afterRender'. I 
do this in 'afterRender' because I need the field's clientId to be 
initialised.


It works great if the Field it attaches to is rendered when the 
page is first rendered, however if it is rendered as part of a zone 
update/xhr request, the script is never sent to the client.


I have breakpointed the JavaScriptCallback and while it is 
successfully added to the ajaxResponseRenderer, it is never called.


Thanks for advice!


code Eg:

public class MyMixin
{
...

void afterRender()
{
addScript(MyMixin.create('%s', '%s');, 
field.getClientId(), myVariable);

}

private void addScript(final String format, final Object... args)
{
if (!request.isXHR())
{
jsSupport.addScript(InitializationPriority.NORMAL, format, args);
return;
}

ajaxResponseRenderer.addCallback(new JavaScriptCallback()
{
@Override
public void run(JavaScriptSupport javascriptSupport)
{
javascriptSupport.addScript(InitializationPriority.NORMAL, format, 
args);

}
});
}
}

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





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





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





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





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