Re: Best practice for initializing page to default context

2009-12-08 Thread DH
Of course, but since I am not very good at javassit, my implementation may be 
ugly and a bit long. Anyone please consummate it.
Like PageActivationContext, I introduce an PageActivationUnitWorker.
The key part is to collect the param fields and add the param map to page class 
in runtime. onActivate and onPassivate would use this map to set value or 
retrieve value.

1. For annotation:

@Target(FIELD)
@Documented
@Retention(RUNTIME)
public @interface PageActivationUnit {
 String value() default ;
}

2. For worker:
public class PageActivationUnitWorker implements ComponentClassTransformWorker {

 private TypeCoercer _typeCoercer;
 
 public PageActivationUnitWorker(TypeCoercer typeCoercer) {
  this._typeCoercer = typeCoercer;
 }
 
 public void transform(ClassTransformation transformation, 
MutableComponentModel model) {
  ListString fieldNames = 
transformation.findFieldsWithAnnotation(PageActivationUnit.class);
  
  if (fieldNames != null  fieldNames.size()  0) {
   
   MapString, String fieldParamMap = new HashMapString, String();
   for (String fieldName : fieldNames) {
PageActivationUnit annotation = transformation.getFieldAnnotation(fieldName,
  PageActivationUnit.class);
fieldParamMap.put(fieldName, getParameterName(fieldName, 
annotation.value()));
   }
   
   String typeCoercer = transformation.addInjectedField(TypeCoercer.class, 
typeCoercer, _typeCoercer);
   
   TransformMethodSignature activate
 = new TransformMethodSignature(Modifier.PROTECTED | Modifier.FINAL, 
boolean,
   onActivate,
   new String[] 
{EventContext.class.getName()}, null);
   
   TransformMethodSignature passivate
 = new TransformMethodSignature(Modifier.PROTECTED | 
Modifier.FINAL, java.lang.Object[],
   onPassivate,
   null, null);
   
   BodyBuilder activeBuilder = new BodyBuilder().begin();
   activeBuilder.addln(java.util.Map keyValueMap = new java.util.HashMap(););
   activeBuilder.add(for (int i = 0; i  $1.getCount(); i++));
   activeBuilder.begin();
   activeBuilder.addln(String []keyValue = ((String)$1.get(String.class, 
i)).split(\-\););
   activeBuilder.addln(String key = keyValue[0];);
   activeBuilder.addln(String value = (keyValue.length  1) ? keyValue[1] : 
null;);
   activeBuilder.addln(keyValueMap.put(key, value););
   activeBuilder.end();
   // end for
   for (int i = 0, size = fieldNames.size(); i  size; i++) {
String fieldName = fieldNames.get(i);
String fieldType = transformation.getFieldType(fieldName);
activeBuilder.addln(String fieldValue=(String)keyValueMap.get(\%s\);, 
fieldParamMap.get(fieldName));
activeBuilder.addln(if (fieldValue != null) {);
activeBuilder.addln(%s=(%s)%s.coerce(fieldValue, Class.forName(\%s\));, 
fieldName, fieldType, typeCoercer, fieldType);
activeBuilder.addln(});
   }
   activeBuilder.addln(return true;);
   // end method body
   activeBuilder.end();
 
   BodyBuilder deactiveBuilder = new BodyBuilder().begin();
   for (int i = 0, size = fieldNames.size(); i  size; i++) {
String fieldName = fieldNames.get(i);

if (i == size - 1) {
 deactiveBuilder.add(\%s-\ +  (%s != null ? (String)%s.coerce(%s, 
String.class) : \\), fieldParamMap.get(fieldName), fieldName, typeCoercer, 
fieldName);
} else {
 deactiveBuilder.add(\%s-\ +  (%s != null ? (String)%s.coerce(%s, 
String.class) : \\),, fieldParamMap.get(fieldName), fieldName, typeCoercer, 
fieldName);
}
   }
   deactiveBuilder.end();
   
   transformation.addTransformedMethod(activate, activeBuilder.toString());
   transformation.addTransformedMethod(passivate, return new Object[] + 
deactiveBuilder.toString() + ;);
  }
 }

 private String getParameterName(String fieldName, String annotatedName)
{
if (InternalUtils.isNonBlank(annotatedName)) return annotatedName;

return InternalUtils.stripMemberName(fieldName);
}
}

3. In app module

public static void contributeComponentClassTransformWorker(
OrderedConfigurationComponentClassTransformWorker configuration, 
TypeCoercer typeCoercer) {
 configuration.add(PageActivationUnit, new 
PageActivationUnitWorker(typeCoercer), before:OnEvent);
}

That's all.
One disadvantage is that you can't use primitive type for param field, so use 
Integer instead of int.

DH
http://www.gaonline.com.cn
- Original Message - 
From: Inge Solvoll 
To: Tapestry users users@tapestry.apache.org
Sent: Tuesday, December 08, 2009 4:14 PM
Subject: Re: Best practice for initializing page to default context


 Would it be possible for you to share that code with us? I don't necessarily
 want to use that approach, but it would be very helpful to see how you
 implemented it.
 
 Inge
 
 On Tue, Dec 8, 2009 at 9:10 AM, DH ningd...@gmail.com wrote:
 
 Once I found it difficult too, and I never used  EventContext because I
 think it is not 

Cross field validation in a component

2009-12-08 Thread Klaus Kopruch

Hello *

I have a component DateSelector which must be in a form. DateSelector
contains 3 Select components.

My question is, how can I perform cross-field validation in DateSelector? As
far as I see, there is no event which the component gets which I can use to
perform this task. DateSelector gets the 3 VALIDATE events from the 3
embedded Select components but what I need is an event which will be sent to
DateSelector after the 3 VALIDATE events, because not till then the 3 values
from the 3 embedded Select components are set.

So, what I need in my component is a kind of VALIDATE_FORM and also a
SUCCESS event (in order to set the resulting value from the 3 values).

Does anybody know, how a component can get those kind of events?

Thanks

Klaus
-- 
View this message in context: 
http://old.nabble.com/Cross-field-validation-in-a-component-tp26690823p26690823.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



page name generating

2009-12-08 Thread Jan Jirout

Hi,

I have two probably related problems.

1) I have business object Article and User and also I have package 
com.myapp.pages. Inside this package are placed pages Article and User. 
Both of them works and contains with business object Article and User. 
It lead to state when I have to fully specify business object package 
name. I woud like to use page names as ArticlePage and UserPage but in 
tml file use refference to them as user and article


2) I have page class files like createNewUser.java and template 
createNewUser.tml. When I access this page URL is createnewnser but I 
would like to see URL create-new-user.


I think that both problems are related to name stripping, but I don't 
know how to add new rules to this process. It seems to me, that URL 
rewriting doesn't help at all.


thanks for help

Jan

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



Re: Select does not submit form on change

2009-12-08 Thread Mite

Thank you for the reply.
It does not make any difference. Still the same result.

This is really bad. Trying to get to work an event on a select for a whole
day.
It is so much easier with .NET or only JavaScript and HTML. 



Try

this.form.submit()

-- 
View this message in context: 
http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26692063.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



RE: Select does not submit form on change

2009-12-08 Thread Newham, Cameron
The only way I got this to work was via Javascript called from the
select to do the submit.



-Original Message-
From: Mite [mailto:mitemeis...@gmail.com] 
Sent: 08 December 2009 10:58
To: users@tapestry.apache.org
Subject: Re: Select does not submit form on change


Thank you for the reply.
It does not make any difference. Still the same result.

This is really bad. Trying to get to work an event on a select for a
whole
day.
It is so much easier with .NET or only JavaScript and HTML. 



Try

this.form.submit()

-- 
View this message in context:
http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p2
6692063.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


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



Re: Select does not submit form on change

2009-12-08 Thread Inge Solvoll
You're not giving us very much information to work with here...

Are you using some debug tool to verify if a request is sent to the server?
Like firebug in firefox? Are you getting a javascript error when you select
something?

On Tue, Dec 8, 2009 at 11:58 AM, Mite mitemeis...@gmail.com wrote:


 Thank you for the reply.
 It does not make any difference. Still the same result.

 This is really bad. Trying to get to work an event on a select for a whole
 day.
 It is so much easier with .NET or only JavaScript and HTML.



 Try

 this.form.submit()

 --
 View this message in context:
 http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26692063.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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




Re: Select does not submit form on change

2009-12-08 Thread Mite

No, I just have the function:

void onSubmit() { 
System.out.println(Value changed!); 
}

t:selectObject t:id=courses list=courses value=currentCourse
labelField=literal:courseId onChange=this.form.submit();/ 

which prints to console when a submit is made, but it does not print
anything when I change the value.


Are you using some debug tool to verify if a request is sent to the server?
Like firebug in firefox? Are you getting a javascript error when you select
something?


-- 
View this message in context: 
http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26692303.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: t5 handling events by components, event handling sequence

2009-12-08 Thread Thiago H. de Paula Figueiredo

Em Mon, 07 Dec 2009 21:38:17 -0200, kamiseq kami...@gmail.com escreveu:


hi,


Hi!

I ve wrote simple component that renders link and handles event  
triggered by

the link then it sets some value and should render that value.
the problem is that I get the value but then the value is lost as  
tapestry redirects to a page that holds the component

why is so and how can design my component to fix that. Of course I can
annotate the value field as @Persist-ent but I really would like to avoid
session as much as possible.


You cannot avoid the session in this case, as Tapestry uses  
redirect-after-post. You can use @Persist(flash): the value will be  
removed from the session after it is read the first time.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.

http://www.arsmachina.com.br

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



Re: Best practice for initializing page to default context

2009-12-08 Thread Thiago H. de Paula Figueiredo
Em Tue, 08 Dec 2009 04:22:58 -0200, Kalle Korhonen  
kalle.o.korho...@gmail.com escreveu:



and subsequently, if my page has multiple entry points, I typically
resort to implementing it in a single onActivate(EventContext
eventContext) operation containing a big if-else clause.


That's the recommended way when you have a variable number of activation  
context parameters.



Since the activation context is anyway sent with an event request (as in
?t:ac=mycontext), rather than using the encoded context for rendering,
wouldn't it be just simpler if that context was used for activating
the page for the event request and the following redirect for
rendering would just use whatever context onPassivate() returns?


The activation context is always what onPassivate() returns. I don't  
understand what is the problem here.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.

http://www.arsmachina.com.br

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



Re: page name generating

2009-12-08 Thread Thiago H. de Paula Figueiredo
Em Tue, 08 Dec 2009 08:40:34 -0200, Jan Jirout jir...@coroptis.com  
escreveu:



Hi,


Hi!

I think that both problems are related to name stripping, but I don't  
know how to add new rules to this process. It seems to me, that URL  
rewriting doesn't help at all.


URL rewriting is definitely the best solution to both your problems. Using  
it, you have total control about your URLs.


The I woud like to use page names as ArticlePage and UserPage but in tml  
file use refference to them as 'user' and 'article' could be solved by  
decorating or advising the ComponentSource and changing the parameter of  
the getPage() method. I suggest you to not do that, as one of the beauties  
of Tapestry is exactly that the page class, the template and how you  
reference the page are all the same.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.

http://www.arsmachina.com.br

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



Re: t5 handling events by components, event handling sequence

2009-12-08 Thread kamiseq
yep
I am just after huge argument with my firend about tapestry and wishes vs
reality :)
now I understand and it makes some sense although I try to avoid @persist as
much as possible

and the main problem here is to define how user must use the page and
interact with it and what if session expires / he/she redirects to another
page and comes back to the first one. I need to think about those at first
place

thanks for help

pozdrawiam
Paweł Kamiński

kami...@gmail.com
pkaminski@gmail.com
__


Re: Best practice for initializing page to default context

2009-12-08 Thread NingDH
Of course, but since I am not very good at javassit, my implementation may be 
ugly and a bit long. Anyone please consummate it.
Like PageActivationContext, I introduce an PageActivationUnitWorker.
The key part is to collect the param fields and add the param map to page class 
in runtime. onActivate and onPassivate would use this map to set value or 
retrieve value.

1. For annotation:

@Target(FIELD)
@Documented
@Retention(RUNTIME)
public @interface PageActivationUnit {
 String value() default ;
}

2. For worker:
public class PageActivationUnitWorker implements ComponentClassTransformWorker {

 private TypeCoercer _typeCoercer;
 
 public PageActivationUnitWorker(TypeCoercer typeCoercer) {
  this._typeCoercer = typeCoercer;
 }
 
 public void transform(ClassTransformation transformation, 
MutableComponentModel model) {
  ListString fieldNames = 
transformation.findFieldsWithAnnotation(PageActivationUnit.class);
  
  if (fieldNames != null  fieldNames.size()  0) {
   
   MapString, String fieldParamMap = new HashMapString, String();
   for (String fieldName : fieldNames) {
PageActivationUnit annotation = transformation.getFieldAnnotation(fieldName,
  PageActivationUnit.class);
fieldParamMap.put(fieldName, getParameterName(fieldName, 
annotation.value()));
   }
   
   String typeCoercer = transformation.addInjectedField(TypeCoercer.class, 
typeCoercer, _typeCoercer);
   
   TransformMethodSignature activate
 = new TransformMethodSignature(Modifier.PROTECTED | Modifier.FINAL, 
boolean,
   onActivate,
   new String[] 
{EventContext.class.getName()}, null);
   
   TransformMethodSignature passivate
 = new TransformMethodSignature(Modifier.PROTECTED | 
Modifier.FINAL, java.lang.Object[],
   onPassivate,
   null, null);
   
   BodyBuilder activeBuilder = new BodyBuilder().begin();
   activeBuilder.addln(java.util.Map keyValueMap = new java.util.HashMap(););
   activeBuilder.add(for (int i = 0; i  $1.getCount(); i++));
   activeBuilder.begin();
   activeBuilder.addln(String []keyValue = ((String)$1.get(String.class, 
i)).split(\-\););
   activeBuilder.addln(String key = keyValue[0];);
   activeBuilder.addln(String value = (keyValue.length  1) ? keyValue[1] : 
null;);
   activeBuilder.addln(keyValueMap.put(key, value););
   activeBuilder.end();
   // end for
   for (int i = 0, size = fieldNames.size(); i  size; i++) {
String fieldName = fieldNames.get(i);
String fieldType = transformation.getFieldType(fieldName);
activeBuilder.addln(String fieldValue=(String)keyValueMap.get(\%s\);, 
fieldParamMap.get(fieldName));
activeBuilder.addln(if (fieldValue != null) {);
activeBuilder.addln(%s=(%s)%s.coerce(fieldValue, Class.forName(\%s\));, 
fieldName, fieldType, typeCoercer, fieldType);
activeBuilder.addln(});
   }
   activeBuilder.addln(return true;);
   // end method body
   activeBuilder.end();
 
   BodyBuilder deactiveBuilder = new BodyBuilder().begin();
   for (int i = 0, size = fieldNames.size(); i  size; i++) {
String fieldName = fieldNames.get(i);

if (i == size - 1) {
 deactiveBuilder.add(\%s-\ +  (%s != null ? (String)%s.coerce(%s, 
String.class) : \\), fieldParamMap.get(fieldName), fieldName, typeCoercer, 
fieldName);
} else {
 deactiveBuilder.add(\%s-\ +  (%s != null ? (String)%s.coerce(%s, 
String.class) : \\),, fieldParamMap.get(fieldName), fieldName, typeCoercer, 
fieldName);
}
   }
   deactiveBuilder.end();
   
   transformation.addTransformedMethod(activate, activeBuilder.toString());
   transformation.addTransformedMethod(passivate, return new Object[] + 
deactiveBuilder.toString() + ;);
  }
 }

 private String getParameterName(String fieldName, String annotatedName)
{
if (InternalUtils.isNonBlank(annotatedName)) return annotatedName;

return InternalUtils.stripMemberName(fieldName);
}
}

3. In app module

public static void contributeComponentClassTransformWorker(
OrderedConfigurationComponentClassTransformWorker configuration, 
TypeCoercer typeCoercer) {
 configuration.add(PageActivationUnit, new 
PageActivationUnitWorker(typeCoercer), before:OnEvent);
}

That's all.
One disadvantage is that you can't use primitive type for param field, so use 
Integer instead of int.

DH
http://www.gaonline.com.cn
- Original Message - 
From: Inge Solvoll 
To: Tapestry users users@tapestry.apache.org
Sent: Tuesday, December 08, 2009 4:14 PM
Subject: Re: Best practice for initializing page to default context


 Would it be possible for you to share that code with us? I don't necessarily
 want to use that approach, but it would be very helpful to see how you
 implemented it.
 
 Inge
 
 On Tue, Dec 8, 2009 at 9:10 AM, DH ningd...@gmail.com wrote:
 
 Once I found it difficult too, and I never used  EventContext because I
 think it is not 

Re: Lock contention in PerthreadManagerImpl

2009-12-08 Thread Howard Lewis Ship
On Tue, Dec 8, 2009 at 5:08 AM, Olle Hallin olle.hal...@hit.se wrote:
 Hi!

 We are load testing our new high volume site before soft launch, and we have
 noticed that we have two sources of severe lock contention.
 Of 300 threads, in average 165 are waiting for one of these two locks.

 One is in ZipFile (caused by �...@incudejavascriptlibrary(classpath:...)) 
 and
 the other is in
 org.apache.tapestry5.ioc.internal.services.PerthreadManagerImpl

 The ZipFile bottleneck is harmless, since we will use a CDN in production.
 The second one is harder to work-around, since it is caused by
 RequestGlobals.storeServletRequestResponse().

 I have browsed PerthreadManagerImpl.java, and have found two cases where a
 lock on this is requested.

 In both cases the lock is requested before accessing a ThreadLocal
 (ThreadLocal.get() and ThreadLocal.remove()).
 Since ThreadLocal is thread-safe, external locking is uneeded.


Unfortunately, ThreadLocal.get()/remove() was buggy and not thread
safe in JDK 1.5.


 Shall I file a JIRA issue, or have I missed something?

 We use T5 5.1.0.5

 Olle Hallin
 Senior Java Developer and Architect
 olle.hal...@crisp.se
 www.crisp.se
 http://www.linkedin.com/in/ollehallin




-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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



Re: Select does not submit form on change

2009-12-08 Thread Inge Solvoll
I will be more specific then.

What you need to do is:

- Use Firefox and Firebug (or some other request monitoring tool) to see
what happens when you select something in your select. Is any event trigered
in the browser. Is something sent to the server?

- Check on the server side if the page class is at all contacted. Set a
breakpoint in your onActivate method or something similar.

On Tue, Dec 8, 2009 at 12:18 PM, Mite mitemeis...@gmail.com wrote:


 No, I just have the function:

 void onSubmit() {
System.out.println(Value changed!);
 }

 t:selectObject t:id=courses list=courses value=currentCourse
 labelField=literal:courseId onChange=this.form.submit();/

 which prints to console when a submit is made, but it does not print
 anything when I change the value.


 Are you using some debug tool to verify if a request is sent to the server?
 Like firebug in firefox? Are you getting a javascript error when you select
 something?


 --
 View this message in context:
 http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26692303.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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




Re: Best practice for initializing page to default context

2009-12-08 Thread Kalle Korhonen
On Tue, Dec 8, 2009 at 3:39 AM, Thiago H. de Paula Figueiredo
thiag...@gmail.com wrote:
 Em Tue, 08 Dec 2009 04:22:58 -0200, Kalle Korhonen
 kalle.o.korho...@gmail.com escreveu:
 and subsequently, if my page has multiple entry points, I typically
 resort to implementing it in a single onActivate(EventContext
 eventContext) operation containing a big if-else clause.
 That's the recommended way when you have a variable number of activation
 context parameters.

DH's approach looks interesting, but maybe a bit involving with field
names encoded to the url. Thiago, I know it's the recommended approach
but I'm just saying it doesn't strike me as the ideal approach.

 Since the activation context is anyway sent with an event request (as in
 ?t:ac=mycontext), rather than using the encoded context for rendering,
 wouldn't it be just simpler if that context was used for activating
 the page for the event request and the following redirect for
 rendering would just use whatever context onPassivate() returns?
 The activation context is always what onPassivate() returns. I don't
 understand what is the problem here.

That sounds like I don't understand and don't want to hear about it
- why bother responding if that's the case? Now I'm not sure if it's
worth my time to write more details or sample code to describe what I
mean if you are not interested in explaining or exploring how to do it
better.

Kalle

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



Re: Best practice for initializing page to default context

2009-12-08 Thread ningdh
I can't think of a better way not to involve the field name encoded.

And if you don't like the field name exposed, you can also customize the param 
name by setting the annotation value, such as 

@PageActivationUnit(cat)
private Category category;

Then the url is like /searchpage/cat-VALUE

I like this style a lot and use heavily in my multiple projects.

DH

- Original Message - 
From: Kalle Korhonen 
To: Tapestry users users@tapestry.apache.org
Sent: Wednesday, December 09, 2009 1:49 AM
Subject: Re: Best practice for initializing page to default context


 On Tue, Dec 8, 2009 at 3:39 AM, Thiago H. de Paula Figueiredo
 thiag...@gmail.com wrote:
 Em Tue, 08 Dec 2009 04:22:58 -0200, Kalle Korhonen
 kalle.o.korho...@gmail.com escreveu:
 and subsequently, if my page has multiple entry points, I typically
 resort to implementing it in a single onActivate(EventContext
 eventContext) operation containing a big if-else clause.
 That's the recommended way when you have a variable number of activation
 context parameters.
 
 DH's approach looks interesting, but maybe a bit involving with field
 names encoded to the url. Thiago, I know it's the recommended approach
 but I'm just saying it doesn't strike me as the ideal approach.
 
 Since the activation context is anyway sent with an event request (as in
 ?t:ac=mycontext), rather than using the encoded context for rendering,
 wouldn't it be just simpler if that context was used for activating
 the page for the event request and the following redirect for
 rendering would just use whatever context onPassivate() returns?
 The activation context is always what onPassivate() returns. I don't
 understand what is the problem here.
 
 That sounds like I don't understand and don't want to hear about it
 - why bother responding if that's the case? Now I'm not sure if it's
 worth my time to write more details or sample code to describe what I
 mean if you are not interested in explaining or exploring how to do it
 better.
 
 Kalle
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 


Re: t5 handling events by components, event handling sequence

2009-12-08 Thread Geoff Callender
Why don't you want to pass the page's context to the tab component? Isn't the 
content of the tabs dependent on the value of the page's context?

On 09/12/2009, at 4:46 AM, kamiseq wrote:

 ok one more thing, my tabs are working great but let examine such a usecase
 
 1)I have user page with a grid of a user list
 2)when user is selected I rerender the page with context specified by grid
 element
 3)my url then is something like myapp/user/1 and the tab control is
 displayed with 3 tabs (for example)
 4)when I click a tab event is triggered to component and then it redirects
 back to the page to rerender its context and here where the problem occurs
 cos the link is incorrect and the initial selection is lost
 
 I figured out something like in tab component
 
 @Inject
 private PageRenderLinkSource pagerender;
 @Inject
 private ComponentResources resources;
 
 @OnEvent(component = tabSelect)
 Object onTabActivated(String panelId) {
this.activeTabInfo = new TabInfo(panelId);
 *return
 pagerender.createPageRenderLinkWithContext(this.resources.getPage().getClass(),
 ??);*
 }
 
 and if I replace ?? with the initial context value (let say 1 everything
 works fine - the question is where to get the initial page's context from.
 
 maybe I can aquire it as well from ComponentResources as it seams that
 framework knows about it
 [INFO] AppModule.TimingFilter Request time: 3 ms
 127.0.0.1 -  -  [08/gru/2009:17:15:06 +]
 GET*/myapp/user/index.tabnavigation.tabselect/tabVersions HTTP/1.1
 *302 0 *http://localhost:8080/myapp/user/1;
 ..
 *127.0.0.1 -  -  [08/gru/2009:17:15:06 +]* GET /myapp/user
 HTTP/1.1*200 1954
 * http://localhost:8080/myapp/user/1*
 
 the page's Long onPasivate() doesn't help so I am a bit stuck here, and I
 dont want to pass page's context value to tab component
 
 pozdrawiam
 Paweł Kamiński
 
 kami...@gmail.com
 pkaminski@gmail.com
 __


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



Re: Select does not submit form on change

2009-12-08 Thread Vangel V. Ajanovski


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Select does not submit form on change

2009-12-08 Thread Vangel V. Ajanovski
Sorry, but there might be some problem with the mailing list, my message
was considered as a SPAM and first the text was removed from the
message, and the next time I got info that it was considered as SPAM.

I am sending the message again.

On 08.12.2009 02:47, Mite wrote:
 I have written this code so far:

 form t:type=form
 t:selectObject t:id=courses list=courses value=currentCourse
 labelField=literal:courseId onChange=form.submit();/
 t:submit/
 /form
  

This issue is not really a problem of Tapestry, this is a Javascript
browser implementation problem.
In my code sample this works in IE 8, and it does not work in Firefox
3.6 or Opera 10

Take the submit button out, and it will work with no problem.

So, What exactly happens in for example Firefox is that when you add a
Submit button, the Submit() function is overriden with the Submit button
and it becomes a property.
Now the form.submit is not the function for submitting any more, but in
fact now it is the submit button itself.

I think that I never ever had a need to use a button and a list for
submitting at the same time, so I never saw this as a problem.

But, the bad thing is that here Thiago's solution does not help - with
it I get an
Event.observe is not a function
And now it does not work even in IE.



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Select does not submit form on change

2009-12-08 Thread Vangel V. Ajanovski
On 09.12.2009 01:33, Vangel V. Ajanovski wrote:

 But, the bad thing is that here Thiago's solution does not help - with
 it I get an
 Event.observe is not a function
 And now it does not work even in IE.

   
Now I am replying to myself ;)
Of course it doesn't work - prototype is not automatically bundled with
such a simple page - will have to do that manually.



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Select does not submit form on change

2009-12-08 Thread Mite

I removed the submit button and it works indeed.
Thank you for the answer.
-- 
View this message in context: 
http://old.nabble.com/Select-does-not-submit-form-on-change-tp26687467p26703632.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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