Tapestry 4.1.2 LinkSubmit issue

2007-07-08 Thread VitalyA

Hi all,
I know that LinkSubmit implementation was changed in the last snapshot of
4.1.2. Now javascript method call, which submit the form pass from href
attribute to onclick attribute of the link. I have custom javascript method,
which i want to call as a handler of onclick event before form submit. How
can I add my method as a handler of onclick event?
-- 
View this message in context: 
http://www.nabble.com/Tapestry-4.1.2-LinkSubmit-issue-tf4047483.html#a11496848
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: T5 IoC: How to invoke a decorator method after the service method invoked

2007-07-08 Thread Joshua Jackson

Thanks for the reply Howard. What I'm trying to achieve here is to
create a declarative transaction. So before the service method is
invoked, I want to begin a transaction, and commit when the service
method is finished.

I'm going to try out the explanation you have given me. But I think
I'm still far off from creating an interceptor with javassist.

Another question: Is the SampleInterceptor.foo invoked from the
decorator method?

PS: I think you need to add a reference regarding on creating custom
decorator here just to prevent others asking the same question like I
did. :-D

Regards,
joshua

On 7/9/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:

The decorator creates the interceptor.

The interceptor has the same interface as the service.

The decorator is passed the service, which it can then provide to the
interceptor.  It's called the "delegate" (because it may not be the
service, it may be another interceptor, but that's actually not
relevant).

So, the interceptor has the same methods as the service, and a
do-nothing interceptor would just re-invoke each method on the
service.

Example:

public interface Sample() {
 String foo(String bar);
}

A hand-assembled interceptor would look like:

public class SampleInterceptor {
 private final Sample _delegate;

 public SampleInterceptor(Sample delegate) { _delegate = delegate; }

 public String foo(String bar) {
   // Logic before delegate invocation here.
   String result =  _delegate.foo(bar);
  // Logic after delegate invocation here.

 return result;
 }
}

Of course, we don't use hand-written interceptors often, we instead
brew up the interceptors on the fly inside decorator methods, using
JDK dynamic proxies, or Javassist (ClassFactory and friends).

Notice the two comments; you see that you can add logic before
delegating, even to the point of changing method parameters before
re-invoking.  In theory you could even invoke a different method on
delegate, or not invoke the method, or invoke a method on some other
object.

Likewise, you can have logic after invoking the method.  You could
even but a try ... finally arround the call to _delegate and trap
exceptions.

On 7/8/07, Joshua Jackson <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Sorry for the long subject :-D.
>
> Ok straight to the point. I'm currently building a decorator for a
> Service. But the problem I'm facing is, the method inside the
> decorator is only invoked before the service method is invoked. What I
> want is the decorator method to be invoked before and after the
> service method is invoked. How do I get this? I saw the logging
> decorator method is invoked before and after, but I just still can not
> get the idea. Perhaps there should be a reference on building custom
> decorator? :-D
>
> Thanks in advance
>
> --
> Let's create a highly maintainable and efficient code
>
> YM!: thejavafreak
> Blog: http://www.nagasakti.or.id/roller/joshua/
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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





--
Let's create a highly maintainable and efficient code

YM!: thejavafreak
Blog: http://www.nagasakti.or.id/roller/joshua/

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



(T4.1.2) Ajax enabled Table componet in T.1.2.

2007-07-08 Thread Jon Oakes

Hi Group,
Forgive me if the answer is obvious, but I have searched using Google 
and have not found anything helpful.  I am using Tapestry 4.1.2 on my 
first Tapestry project and I would like to use the table component but 
with Ajax updating.  Ideally I would like to say something like 
async="true" and updateComponents="myTable" with the table components 
like with all the other tapestry components.  Can someone point me in 
the right direction or let me know that this is not possible.

Thanks,
Jon

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



Re: T4.1.2 Survey: Is Selenium working for you?

2007-07-08 Thread Geoff Callender
Thanks, Jun, but are you using client-side validation AND Selenium  
TestRunner (as opposed to Selenium RC or Selenium IDE)?


On 06/07/2007, at 12:08 PM, Jun Tsai wrote:


I use selenium to test my ERP system based on T4.1.2.



2007/7/4, Geoff Callender <[EMAIL PROTECTED]>:


A question for everyone using Selenium who has upgraded from Tapestry
4.1.1 to 4.1.2:

- Is Selenium TestRunner still working for you?  - Does it  
get

through client validation errors OK?

I've found that Selenium IDE is fine but Selenium TestRunner stops at
client validation errors.  Is that your experience too?


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





--
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net



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



Re: [T5] Optional constraint in Validator?

2007-07-08 Thread Howard Lewis Ship

The fact that optional parameters worked in the past was
unintentional.  However it seems like a good idea, I'm just trying to
think of the best way to implement it.  I'd rather not add another
method to the Validator interface, if possible ... in fact, I'm
thinking of simplifying it (putting more of the information gathered
from the interface into a contribution to the service) ... go ahead,
an an issue, but bear in mind that the API will likely change a bit.
Viva le Alpha!

On 7/6/07, Dan Adams <[EMAIL PROTECTED]> wrote:

I have a validator that takes one optional constraint. If it's not
specified it defaults to something reasonable. But now that I updated to
5.0.5 I don't seem to be able to do this. Should I file a ticket?

--
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


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





--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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



Re: T5 IoC: How to invoke a decorator method after the service method invoked

2007-07-08 Thread Howard Lewis Ship

The decorator creates the interceptor.

The interceptor has the same interface as the service.

The decorator is passed the service, which it can then provide to the
interceptor.  It's called the "delegate" (because it may not be the
service, it may be another interceptor, but that's actually not
relevant).

So, the interceptor has the same methods as the service, and a
do-nothing interceptor would just re-invoke each method on the
service.

Example:

public interface Sample() {
 String foo(String bar);
}

A hand-assembled interceptor would look like:

public class SampleInterceptor {
 private final Sample _delegate;

 public SampleInterceptor(Sample delegate) { _delegate = delegate; }

 public String foo(String bar) {
   // Logic before delegate invocation here.
   String result =  _delegate.foo(bar);
  // Logic after delegate invocation here.

 return result;
 }
}

Of course, we don't use hand-written interceptors often, we instead
brew up the interceptors on the fly inside decorator methods, using
JDK dynamic proxies, or Javassist (ClassFactory and friends).

Notice the two comments; you see that you can add logic before
delegating, even to the point of changing method parameters before
re-invoking.  In theory you could even invoke a different method on
delegate, or not invoke the method, or invoke a method on some other
object.

Likewise, you can have logic after invoking the method.  You could
even but a try ... finally arround the call to _delegate and trap
exceptions.

On 7/8/07, Joshua Jackson <[EMAIL PROTECTED]> wrote:

Hi all,

Sorry for the long subject :-D.

Ok straight to the point. I'm currently building a decorator for a
Service. But the problem I'm facing is, the method inside the
decorator is only invoked before the service method is invoked. What I
want is the decorator method to be invoked before and after the
service method is invoked. How do I get this? I saw the logging
decorator method is invoked before and after, but I just still can not
get the idea. Perhaps there should be a reference on building custom
decorator? :-D

Thanks in advance

--
Let's create a highly maintainable and efficient code

YM!: thejavafreak
Blog: http://www.nagasakti.or.id/roller/joshua/

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





--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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



T5 IoC: How to invoke a decorator method after the service method invoked

2007-07-08 Thread Joshua Jackson

Hi all,

Sorry for the long subject :-D.

Ok straight to the point. I'm currently building a decorator for a
Service. But the problem I'm facing is, the method inside the
decorator is only invoked before the service method is invoked. What I
want is the decorator method to be invoked before and after the
service method is invoked. How do I get this? I saw the logging
decorator method is invoked before and after, but I just still can not
get the idea. Perhaps there should be a reference on building custom
decorator? :-D

Thanks in advance

--
Let's create a highly maintainable and efficient code

YM!: thejavafreak
Blog: http://www.nagasakti.or.id/roller/joshua/

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



Re: T5 - Changing Locale

2007-07-08 Thread yosemite

Your code worked for me, except I replaced ThreadLocale by PersistentLocale

@Inject
@Service("PersistentLocale")
private PersistentLocale persistentLocaleService;

then it works using e.g.

persistentLocaleService.set(new Locale("fr"));

Karel


petros wrote:
> 
> tapestry version 5.0.4
> 
> I have the following code in the html template of my LayoutCmpnt
> Greek
> English
> 
> and the following code in the LayoutCmpnt.java
>   @Inject
>   @Service("ThreadLocale")
>   private ThreadLocale threadLocaleService;
>   
>   @Inject
>   private Locale currentLocale; 
>   
>   @OnEvent(value = "action", component = "greekLocaleLink")
>   Object onActionFromGreekLocaleLink()
>   {
>   threadLocaleService.setLocale(new Locale("el"));
>   return null;
>   }
>   
>   @OnEvent(value = "action", component = "englishLocaleLink")
>   Object onActionFromEnglishLocaleLink()
>   {
>   threadLocaleService.setLocale(new Locale("en"));
>   return null;
>   }   
> 
> When the Greek link is clicked the onActionFromGreekLocaleLink() method is
> called as expected, but just before the method is returned the
> currentLocale object is still set to the "en" Locale. Is this the right
> way to change the Locale programmatically ?
> 
> Petros
> 
> 
> Howard Lewis Ship wrote:
>> 
>> I think that comment is out of date.
>> 
>> You should be able to inject the ThreadLocale service and change the
>> locale there.  Tapestry will pick up on that and write out an updated
>> cookie, which will cause the subsequent render request to be in the
>> new locale.
>> 
>> On 3/9/07, Bogdan Calmac <[EMAIL PROTECTED]> wrote:
>>> Thanks guys, I saw that, but there was no mention about the ability to
>>> change the locale at application level. So I can assume that for my
>>> use case I would inject a new service in my page and use it to change
>>> the locale programatically?
>>>
>>> Thanks,
>>>
>>> Bogdan Calmac.
>>>
>>> On 3/9/07, Hugo Palma <[EMAIL PROTECTED]> wrote:
>>> > Take a look at the bottom of this page
>>> >
>>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/localization.html.
>>> >
>>> > /"Tapestry does not yet support changing the locale, but that will be
>>> > available shortly."/
>>> >
>>> > Bogdan Calmac wrote:
>>> > > Is it possible in Tapestry 5 to programatically change the locale
>>> for
>>> > > a sesison similar to IEngine.setLocale() from Tapestry 4?
>>> > >
>>> > > In my case I want to set the locale after the login into the
>>> > > application (locale is stored in the user profile) and not rely on
>>> the
>>> > > browser locale.
>>> > >
>>> > > Thank you,
>>> > >
>>> > > Bogdan Calmac.
>>> > >
>>> > >
>>> -
>>> > > 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]
>>>
>>>
>> 
>> 
>> -- 
>> Howard M. Lewis Ship
>> TWD Consulting, Inc.
>> Independent J2EE / Open-Source Java Consultant
>> Creator and PMC Chair, Apache Tapestry
>> Creator, Apache HiveMind
>> 
>> Professional Tapestry training, mentoring, support
>> and project work.  http://howardlewisship.com
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5---Changing-Locale-tf3376399.html#a11489178
Sent from the Tapestry - User mailing list archive at Nabble.com.


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