Re: Insight: T5 is a compiler

2011-04-28 Thread Pierce T. Wetter III

I think we're saying the same thing in different ways. 

"Tapestry compiles the template into a program to generate the content" is a 
shorter way of saying what you just said. As opposed to JSP which interprets 
the template character by character. 

Other systems (WebObjects is one) convert templates into data structures, but I 
think Tapestry is unique in the way that it builds property accessors into 
those structures. To me that smacks much more of compilation than 
interpretation. 

Pierce

> I think the biggest insight I attempt to inject into people is the
> component template:  It's easy to think about it the way a JSP
> operates: working character-by-character.  But for Tapestry, the
> template is actually a blueprint for building a structure in memory,
> and that structure is a program for generating a server-side DOM, and
> only at the end is that DOM emitted character-by-character.
> 
> "The string is a stark data structure and everywhere it is passed
> there is much duplication of process. It is a perfect vehicle for
> hiding information.
> -- Alan Perlis
> 
> I interpret this as "strings are bad", they hide information, or make
> it more difficult to manipulate. Treating the template as a structure
> of objects lets Tapestry do things implicitly that are complex in
> other environments.
> 
> 
> On Thu, Apr 28, 2011 at 9:23 AM, Pierce T. Wetter III
>  wrote:
>> 
>>  I'm job hunting right now which means I sometimes have to explain why I
>> chose Tapestry for a web application platform. (
>> http://www.linkedin.com/in/pwetter if your company needs a new Director of
>> Web Development ).
>>  I had an insight yesterday that I thought I would share. Tapestry is a
>> compiler.
>> That is, Tapestry considers your .tml files and your .java files as just a
>> starting point. From that starting point it builds data structures, new
>> classes, bytecodes and a host of other cool stuff behind the scenes. That's
>> one of the reasons its so fast and efficient as an application framework
>> while running. Unlike a lot of other frameworks that are essentially running
>> as interpreters, Tapestry runs as compiled code.
>>   The key insight here is something I've known about T5 for a while: Your
>> .java files and .tml files are just the starting point; they're essentially
>> declarations that are re-interpreted by T5 to produce a lot of stuff behind
>> the scenes. You may think that you have Component.java, which declares a
>> class called Component with one or 2 methods, but by the time Tapestry is
>> finished with it numerous additional methods and instance variables have
>> been added, certain things in your class have been rewired, all kinds of
>> cool stuff. Just as a few lines of declaration code imply a whole bunch of
>> work by the java compiler behind the scenes, so does a few lines of Tapestry
>> code imply a whole bunch of work by the "Tapestry compiler".
>>I hope this insight helps people.
>>  Pierce
>> 
> 
> 
> 
> -- 
> 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
> 



smime.p7s
Description: S/MIME cryptographic signature


T5: @Cached(watch) parameter requires public property

2011-04-28 Thread Adam Zimowski
Hi Again -

Is there a specific reason why watch parameter for @Cached annotation
requires public property when using default prop binding? This is an
inconvenient limitation IMO, as I don't necessarily want to expose my
watch property publicly. For example, my watch on getShoppingCart may
be something like this:

@Cached(watch="cartWatch")
public ShoppingCartBean getShoppingCart() {

Long userId = getUserId();
Long cartId = getCartId();
log.debug("cartId: {}, userId: {}", cartId, userId);

return cartService.findShoppingCart(cartId, userId);
}

private long getCartWatch() {
Long userId = getUserId();
Long cartId = getCartId();
if(userId == null) userId = 0L;
if(cartId == null) cartId = 0L;

return userId + cartId;
}

Minor issue, but unless there is a strict reason behind it, I thing
watch should allow any scope.

Adam

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



Re: Insight: T5 is a compiler

2011-04-28 Thread Howard Lewis Ship
I think the biggest insight I attempt to inject into people is the
component template:  It's easy to think about it the way a JSP
operates: working character-by-character.  But for Tapestry, the
template is actually a blueprint for building a structure in memory,
and that structure is a program for generating a server-side DOM, and
only at the end is that DOM emitted character-by-character.

"The string is a stark data structure and everywhere it is passed
there is much duplication of process. It is a perfect vehicle for
hiding information.
-- Alan Perlis

I interpret this as "strings are bad", they hide information, or make
it more difficult to manipulate. Treating the template as a structure
of objects lets Tapestry do things implicitly that are complex in
other environments.


On Thu, Apr 28, 2011 at 9:23 AM, Pierce T. Wetter III
 wrote:
>
>  I'm job hunting right now which means I sometimes have to explain why I
> chose Tapestry for a web application platform. (
> http://www.linkedin.com/in/pwetter if your company needs a new Director of
> Web Development ).
>  I had an insight yesterday that I thought I would share. Tapestry is a
> compiler.
> That is, Tapestry considers your .tml files and your .java files as just a
> starting point. From that starting point it builds data structures, new
> classes, bytecodes and a host of other cool stuff behind the scenes. That's
> one of the reasons its so fast and efficient as an application framework
> while running. Unlike a lot of other frameworks that are essentially running
> as interpreters, Tapestry runs as compiled code.
>   The key insight here is something I've known about T5 for a while: Your
> .java files and .tml files are just the starting point; they're essentially
> declarations that are re-interpreted by T5 to produce a lot of stuff behind
> the scenes. You may think that you have Component.java, which declares a
> class called Component with one or 2 methods, but by the time Tapestry is
> finished with it numerous additional methods and instance variables have
> been added, certain things in your class have been rewired, all kinds of
> cool stuff. Just as a few lines of declaration code imply a whole bunch of
> work by the java compiler behind the scenes, so does a few lines of Tapestry
> code imply a whole bunch of work by the "Tapestry compiler".
>    I hope this insight helps people.
>  Pierce
>



-- 
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



Insight: T5 is a compiler

2011-04-28 Thread Pierce T. Wetter III

 I'm job hunting right now which means I sometimes have to explain why I chose 
Tapestry for a web application platform. ( http://www.linkedin.com/in/pwetter 
if your company needs a new Director of Web Development ). 

 I had an insight yesterday that I thought I would share. Tapestry is a 
compiler. 

That is, Tapestry considers your .tml files and your .java files as just a 
starting point. From that starting point it builds data structures, new 
classes, bytecodes and a host of other cool stuff behind the scenes. That's one 
of the reasons its so fast and efficient as an application framework while 
running. Unlike a lot of other frameworks that are essentially running as 
interpreters, Tapestry runs as compiled code. 

  The key insight here is something I've known about T5 for a while: Your .java 
files and .tml files are just the starting point; they're essentially 
declarations that are re-interpreted by T5 to produce a lot of stuff behind the 
scenes. You may think that you have Component.java, which declares a class 
called Component with one or 2 methods, but by the time Tapestry is finished 
with it numerous additional methods and instance variables have been added, 
certain things in your class have been rewired, all kinds of cool stuff. Just 
as a few lines of declaration code imply a whole bunch of work by the java 
compiler behind the scenes, so does a few lines of Tapestry code imply a whole 
bunch of work by the "Tapestry compiler". 

   I hope this insight helps people. 

 Pierce

  

smime.p7s
Description: S/MIME cryptographic signature


T5: @PageReset called on page refresh

2011-04-27 Thread Adam Zimowski
Hi

My understanding is that pageReset lifecycle method introduced in 5.2
should only be called when page is left and returned from another
page. Per Howard from
http://markmail.org/message/67dbxuwf3rw3naja#query:+page:1+mid:67dbxuwf3rw3naja+state:results

"When a page is first accessed (from another page), the pageReset()
lifecycle method is invoked. If you stay on the page (component
events, ajax events, or page render requests for the same page) then
no pageReset. It's when you return to a page from some other page that
the page is reset."

And per JavaDoc:

"Marker annotation for a method that should be invoked when a page is
reset. A page reset occurs when a page is linked to from another
page."

However, I am observing that when I simply refresh the page with
pageReset method, pageReset is called anyway.

@Log
@PageReset
void pageReset() {}

According to documentation, when I stay on the page, a refresh should
not trigger pageReset. Is that right?

Adam

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



Re: T5: @Validate on RadioGroup

2011-04-26 Thread Adam Zimowski
https://issues.apache.org/jira/browse/TAP5-1513

On Wed, Apr 13, 2011 at 9:46 AM, Adam Zimowski  wrote:
> Taha -
>
> You are correct, I was wrong. I patched up RadioGroup by adding:
>
>    Binding defaultValidate()
>    {
>        return defaultProvider.defaultValidatorBinding("value", resources);
>    }
>
> and now the @Validate annotation on my bean enum property is read in
> correctly. So this is the bug in RadioGroup, which is missing the
> above as you pointed out.
>
> Adam
>
> On Wed, Apr 13, 2011 at 7:25 AM, Taha Hafeez  wrote:
>> Hi Adam
>>
>> Hi Adam
>>
>> On Wed, Apr 13, 2011 at 5:19 PM, Adam Zimowski  wrote:
>>
>>> Hi Taha,
>>>
>>> > You are still not getting the point...
>>>
>>> Why so direct, having a bad day? Please tell me how am I not getting
>>> the point when I clearly wrote that:
>>>
>>>
>> Sorry if it appeared rude, that was certainly not my intention (In
>> my defense, English is not my first language). I think it should have been
>> "you are missing the point" :)
>>
>>
>>> 
>>>
>>> Works. The validate parameter is not null with the above, and the
>>> Radio group works as expected, as shown in RadioGroup
>>> processSubmission():
>>>
>>> if (validate != null)
>>>  fieldValidationSupport.validate(rawValue, resources, validate);
>>>
>>>
>>> I think you are missing the point. I realized that validate parameter
>>> in RadioGroup is null when @Validate on the bean is present and so
>>> validation does not get triggered.
>>>
>>> If this is a bug, which we both seem to agree, rather than stating the
>>> obvious, I would be interested (due to lack of expertise in Tapestry)
>>> where in the source does Tapestry read a @Validate annotation off a
>>> bean field, and interprets it accordingly.
>>>
>>> That I mentioned in my last mail
>>
>>
>>> The RadioGroup does not seem to be the problem, and the if statement
>>> it contains to test nullability of the validate parameter is not the
>>> issue, either.
>>>
>>>
>> RadioGroup is the problem as it does not contain
>>
>> defaultValidate(){
>>   return defaultProvider.defaultValidatorBinding("value", resources);
>> }
>>
>> If it was there the defaultProvider(as I already mentioned in my previous
>> mail) with indirectly take care of the case where validate @Parameter is
>> null
>>
>>
>>> Regards,
>>> Adam
>>>
>>>
>>>
>> Sorry again
>>
>> regards
>> Taha
>>
>>
>> On Wed, Apr 13, 2011 at 6:30 AM, Taha Hafeez 
>>> wrote:
>>> > You are still not getting the point...
>>> >
>>> >
>>> > 1. fieldValidationSupport,validate is the service responsible for
>>> validating
>>> > a field. It requries a FieldValidator which is passed as a parameter to
>>> it.
>>> > If this @Parameter validate is null, as is the case with RadioGroup,
>>> > fieldValidationSupport is never called as the source shows
>>> >
>>> > if (validate != null)
>>> >   fieldValidationSupport.validate(rawValue, resources, validate);
>>> >
>>> > 2. In other components like Select, if @Parameter validate is not
>>> provided a
>>> > default is chosen. The default is provided by ComponentDefaultProvider
>>> which
>>> > in turn calls FieldValidatorDefaultProvider which uses
>>> FieldValidatorSource
>>> > for creating default validators based on the field annotations and type.
>>> >
>>> > in case of Select we have default validate like this
>>> >
>>> > Binding defaultValidate()
>>> >    {
>>> >        return defaultProvider.defaultValidatorBinding("value",
>>> resources);
>>> >    }
>>> >
>>> > so if we don't provide a validate, the default is chosen
>>> >
>>> >
>>> > Now in a RadioGroup as the code does not use a default in case @Parameter
>>> > validate is not provided, the field annotations are not taken into
>>> > consideration
>>> >
>>> > regards
>>> > Taha
>>> >
>>> > On Wed, Apr 13, 2011 at 4:24 PM, Adam Zimowski 
>>> wrote:
>>> >
>>> >> Hi Taha -
>>> >>
>>> >> I agree with you it seems to be a bug, and I (think) I get what you are
>>> >> saying.
>>> >>
>>> >> However, I am having a hard time seeing why the bug would be in
>>> >> RadioGroup processSubmission() or anywhere in the RadioGroup class for
>>> >> that matter.
>>> >>
>>> >> Rather, it seems the bug (if exists) is deeper in the chain, where the
>>> >> @Validate annotation is read off of a bean and applied to a
>>> >> RadioGroup.
>>> >>
>>> >> I believe this because RadioGroup *does* behave correctly if TML
>>> defines:
>>> >>
>>> >> 
>>> >>
>>> >> but now when the @Validate("required") is on the bean.
>>> >>
>>> >> Adam
>>> >>
>>> >>
>>> >> On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez 
>>> >> wrote:
>>> >> > it is the @Parameter validate in RadioGroup that is required not
>>> >> @Validate
>>> >> > as that is never checked in case @Parameter validate is not given in a
>>> >> > RadioGroup ... Please read my answer again :)
>>> >> >
>>> >> > It seems to be bug!!
>>> >> >
>>> >> > regards
>>> >> > Taha
>>> >> >
>>> >> > On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski 
>>> >> wrote:
>>> >> >
>>> >> >> Thanks Taha, but I did supply @Validate("require

Re: T5: select zone update in a form

2011-04-26 Thread Adam Zimowski
https://issues.apache.org/jira/browse/TAP5-1512

On Mon, Apr 25, 2011 at 12:15 PM, Adam Zimowski  wrote:
> After more debugging, the problem seems to be with Tapestry's
> IdAllocator and how it generates client side id's for select
> components, particularly when Zone is updated.
>
> In this case, what happens is that every time I update zone while form
> is in error, the ID of my select changes with incremented suffix:
>
> ORIGINAL AS EXPECTED BY FORM: a_state
>
> After resetting country causing state dropdown to repopulate, id
> becomes: a_state_1
> then a_state_2 etc...
>
> This causes ValidationTracker put error under wrong key, and
> consequently error to field binding in tracker's map cannot be
> resolved, causing  thinking that all is good. That's why
>  does display the error, as it simply loops over collection
> of errors.
>
> Out of lack of deep understanding of Tapestry, I coded a simple hack
> to verify that if select update via zone kept its original id things
> would work, and indeed, the following hack fixes the problem for my
> case:
>
> Tapestry 5.2.5, AbstractField line 183:
>
>    private void setupControlName(String controlName)
>    {
>        if(controlName.startsWith("a_state"))
>                this.controlName = "a_state";
>        else
>                this.controlName = controlName;
>    }
>
> I tried filing this in JIRA but it seems to be down (Bad Gateway). In
> any case, I do not know enough about framework internals to fix this
> properly. Additional insight would be highly appreciated.
>
> Adam
>
> On Thu, Apr 21, 2011 at 11:33 AM, Adam Zimowski  wrote:
>> Okay, now I am pretty sure this is a bug related to usage of
>>  in 5.2.5.  If I put  (which I didn't have
>> before), the state required error shows up as expected. If I use
>>  attached to state field, the error does not show.
>>
>> It's like looking for a needle in a haystack.. lol. still could
>> appreciate suggestion if anyone knows how to temporarily fix this.
>>
>> Adam
>>
>> On Thu, Apr 21, 2011 at 11:14 AM, Adam Zimowski  wrote:
>>> Quick update:
>>>
>>> By debugging Select component I see that validation tracker correctly
>>> records the error when I submit the blank option for state. The blank
>>> option is submitted throug the following use case:
>>>
>>> 1. Select country and state (both have blank options therefore are
>>> required), but leave other fields empty.
>>> 2. Submit form. Validation on required fields (such as city, zip)
>>> results in form rendering error messages. Note: Country and State are
>>> not in error at this point.
>>> 3. While correcting errors on the form, change country. As a result,
>>> state select component is repopulated (zone update), and default blank
>>> option is select. Do not chose state.
>>> 4. Submit form with state NOT selected. Debugging select shows that it
>>> records error. Yet form is not displaying the error.
>>>
>>> So the problem is that on the first submit Tapestry is not rendering
>>> the error, which is really there. Bug?
>>>
>>> Adam
>>>
>>>
>>>
>>> On Thu, Apr 21, 2011 at 10:20 AM, Adam Zimowski  
>>> wrote:
 I'm sorry, I am on Tapestry 5.2.5 :-)

 On Thu, Apr 21, 2011 at 10:19 AM, Adam Zimowski  
 wrote:
> @Josh - When I debug Select in 5.2.4 (break on processSubmission(),
> line 166), selectedValue is blank which is expected. So select
> correctly submits without a value, it's just it seems that the
> validator does not recognize that select state was repopulated via
> zone and consequently no value was submitted the 2nd time. It seems to
> me like the form validator somehow things that select has the value
> from the prior submission, but it really doesn't since it was reset
> via zone update.
>
> @Mark - by validation kicks in, I meant that form was submitted and
> validated. I have a debug on state code passed from the state select
> component when form activates, and AddressUiBean comes back with the
> correct value. That is, when I select the state from the dropdown,
> AddressUiBean carries the state as expected. Even when form is in
> error, as I change the country thereby causing state dropdown get
> repopulated, and resubmit the form with blank option for state (did
> not select the state), AddressUiBean shows null state code (as
> expected). Yet the form does not report the error on the required
> state field.
>
> Adam
>
> On Wed, Apr 20, 2011 at 10:25 PM, Mark  wrote:
>> When you say "Validation kicks in" does this occur after a submit?  If 
>> so,
>> is it possible that AddressUIBean is remembering the value that was 
>> present
>> when the submit occurred and then on the second submit it is getting set 
>> to
>> null again?
>>
>> At the point when you would expect an error to occur, what is the value 
>> of
>> the state field?  That should give you a good clue as to what is 
>> happening.
>

Re: T5: select zone update in a form

2011-04-25 Thread Adam Zimowski
After more debugging, the problem seems to be with Tapestry's
IdAllocator and how it generates client side id's for select
components, particularly when Zone is updated.

In this case, what happens is that every time I update zone while form
is in error, the ID of my select changes with incremented suffix:

ORIGINAL AS EXPECTED BY FORM: a_state

After resetting country causing state dropdown to repopulate, id
becomes: a_state_1
then a_state_2 etc...

This causes ValidationTracker put error under wrong key, and
consequently error to field binding in tracker's map cannot be
resolved, causing  thinking that all is good. That's why
 does display the error, as it simply loops over collection
of errors.

Out of lack of deep understanding of Tapestry, I coded a simple hack
to verify that if select update via zone kept its original id things
would work, and indeed, the following hack fixes the problem for my
case:

Tapestry 5.2.5, AbstractField line 183:

private void setupControlName(String controlName)
{
if(controlName.startsWith("a_state"))
this.controlName = "a_state";
else
this.controlName = controlName;
}

I tried filing this in JIRA but it seems to be down (Bad Gateway). In
any case, I do not know enough about framework internals to fix this
properly. Additional insight would be highly appreciated.

Adam

On Thu, Apr 21, 2011 at 11:33 AM, Adam Zimowski  wrote:
> Okay, now I am pretty sure this is a bug related to usage of
>  in 5.2.5.  If I put  (which I didn't have
> before), the state required error shows up as expected. If I use
>  attached to state field, the error does not show.
>
> It's like looking for a needle in a haystack.. lol. still could
> appreciate suggestion if anyone knows how to temporarily fix this.
>
> Adam
>
> On Thu, Apr 21, 2011 at 11:14 AM, Adam Zimowski  wrote:
>> Quick update:
>>
>> By debugging Select component I see that validation tracker correctly
>> records the error when I submit the blank option for state. The blank
>> option is submitted throug the following use case:
>>
>> 1. Select country and state (both have blank options therefore are
>> required), but leave other fields empty.
>> 2. Submit form. Validation on required fields (such as city, zip)
>> results in form rendering error messages. Note: Country and State are
>> not in error at this point.
>> 3. While correcting errors on the form, change country. As a result,
>> state select component is repopulated (zone update), and default blank
>> option is select. Do not chose state.
>> 4. Submit form with state NOT selected. Debugging select shows that it
>> records error. Yet form is not displaying the error.
>>
>> So the problem is that on the first submit Tapestry is not rendering
>> the error, which is really there. Bug?
>>
>> Adam
>>
>>
>>
>> On Thu, Apr 21, 2011 at 10:20 AM, Adam Zimowski  wrote:
>>> I'm sorry, I am on Tapestry 5.2.5 :-)
>>>
>>> On Thu, Apr 21, 2011 at 10:19 AM, Adam Zimowski  
>>> wrote:
 @Josh - When I debug Select in 5.2.4 (break on processSubmission(),
 line 166), selectedValue is blank which is expected. So select
 correctly submits without a value, it's just it seems that the
 validator does not recognize that select state was repopulated via
 zone and consequently no value was submitted the 2nd time. It seems to
 me like the form validator somehow things that select has the value
 from the prior submission, but it really doesn't since it was reset
 via zone update.

 @Mark - by validation kicks in, I meant that form was submitted and
 validated. I have a debug on state code passed from the state select
 component when form activates, and AddressUiBean comes back with the
 correct value. That is, when I select the state from the dropdown,
 AddressUiBean carries the state as expected. Even when form is in
 error, as I change the country thereby causing state dropdown get
 repopulated, and resubmit the form with blank option for state (did
 not select the state), AddressUiBean shows null state code (as
 expected). Yet the form does not report the error on the required
 state field.

 Adam

 On Wed, Apr 20, 2011 at 10:25 PM, Mark  wrote:
> When you say "Validation kicks in" does this occur after a submit?  If so,
> is it possible that AddressUIBean is remembering the value that was 
> present
> when the submit occurred and then on the second submit it is getting set 
> to
> null again?
>
> At the point when you would expect an error to occur, what is the value of
> the state field?  That should give you a good clue as to what is 
> happening.
>
> Mark
>
> On Tue, Apr 19, 2011 at 5:11 PM, Adam Zimowski  
> wrote:
>
>> I have a typical address form with street, city zip textfields and two
>> dropdowns: country and state. The state dropdown is wrapped in a zone
>> so tha

Re: T5: select zone update in a form

2011-04-21 Thread Adam Zimowski
Okay, now I am pretty sure this is a bug related to usage of
 in 5.2.5.  If I put  (which I didn't have
before), the state required error shows up as expected. If I use
 attached to state field, the error does not show.

It's like looking for a needle in a haystack.. lol. still could
appreciate suggestion if anyone knows how to temporarily fix this.

Adam

On Thu, Apr 21, 2011 at 11:14 AM, Adam Zimowski  wrote:
> Quick update:
>
> By debugging Select component I see that validation tracker correctly
> records the error when I submit the blank option for state. The blank
> option is submitted throug the following use case:
>
> 1. Select country and state (both have blank options therefore are
> required), but leave other fields empty.
> 2. Submit form. Validation on required fields (such as city, zip)
> results in form rendering error messages. Note: Country and State are
> not in error at this point.
> 3. While correcting errors on the form, change country. As a result,
> state select component is repopulated (zone update), and default blank
> option is select. Do not chose state.
> 4. Submit form with state NOT selected. Debugging select shows that it
> records error. Yet form is not displaying the error.
>
> So the problem is that on the first submit Tapestry is not rendering
> the error, which is really there. Bug?
>
> Adam
>
>
>
> On Thu, Apr 21, 2011 at 10:20 AM, Adam Zimowski  wrote:
>> I'm sorry, I am on Tapestry 5.2.5 :-)
>>
>> On Thu, Apr 21, 2011 at 10:19 AM, Adam Zimowski  wrote:
>>> @Josh - When I debug Select in 5.2.4 (break on processSubmission(),
>>> line 166), selectedValue is blank which is expected. So select
>>> correctly submits without a value, it's just it seems that the
>>> validator does not recognize that select state was repopulated via
>>> zone and consequently no value was submitted the 2nd time. It seems to
>>> me like the form validator somehow things that select has the value
>>> from the prior submission, but it really doesn't since it was reset
>>> via zone update.
>>>
>>> @Mark - by validation kicks in, I meant that form was submitted and
>>> validated. I have a debug on state code passed from the state select
>>> component when form activates, and AddressUiBean comes back with the
>>> correct value. That is, when I select the state from the dropdown,
>>> AddressUiBean carries the state as expected. Even when form is in
>>> error, as I change the country thereby causing state dropdown get
>>> repopulated, and resubmit the form with blank option for state (did
>>> not select the state), AddressUiBean shows null state code (as
>>> expected). Yet the form does not report the error on the required
>>> state field.
>>>
>>> Adam
>>>
>>> On Wed, Apr 20, 2011 at 10:25 PM, Mark  wrote:
 When you say "Validation kicks in" does this occur after a submit?  If so,
 is it possible that AddressUIBean is remembering the value that was present
 when the submit occurred and then on the second submit it is getting set to
 null again?

 At the point when you would expect an error to occur, what is the value of
 the state field?  That should give you a good clue as to what is happening.

 Mark

 On Tue, Apr 19, 2011 at 5:11 PM, Adam Zimowski  
 wrote:

> I have a typical address form with street, city zip textfields and two
> dropdowns: country and state. The state dropdown is wrapped in a zone
> so that when country is selected, states are populated:
>
>  t:id="a_state" model="stateModel" validate="required"
> value="stateKode" blankOption="ALWAYS" blankLabel="literal:--Please
> Select"/>
>
> All works okay, except for a test case my business analyst found which
> I can't figure out.
>
> You fill out a form, pick a country then pick a state and suppose you
> leave city field empty which is required. Validation kicks in. While
> correcting a city error, you decide to switch a country causing state
> list to get repopulated and state be not selected again. Suppose you
> submit the form, I expect the error that state is required, but error
> is not thrown. Only if I resubmit the form a second time, state will
> be flagged in error.
>
> I am resetting state to null on country change. I have even tried
> setting form state field in error, none of which works.
>
> -- TML --
>
> 
> Address Information
>  
>   :
>   value="address.line1"/>
>  
>  
>  
>   :
>   value="address.line2"/>
>  
>  
>  
>   :
>   value="address.line3"/>
>  
>  
>  
>   :
>   value="address.city"/>
>  
>  
>  
>   :
>   value="address.zipCode"/>
>  
>  
>  
>   :
>   t:id="a_state" model="stateModel" validate="required"
> value="address.stateCode" blankOption="ALWAYS"
> blankLabel="literal:--Please Sele

Re: T5: select zone update in a form

2011-04-21 Thread Adam Zimowski
Quick update:

By debugging Select component I see that validation tracker correctly
records the error when I submit the blank option for state. The blank
option is submitted throug the following use case:

1. Select country and state (both have blank options therefore are
required), but leave other fields empty.
2. Submit form. Validation on required fields (such as city, zip)
results in form rendering error messages. Note: Country and State are
not in error at this point.
3. While correcting errors on the form, change country. As a result,
state select component is repopulated (zone update), and default blank
option is select. Do not chose state.
4. Submit form with state NOT selected. Debugging select shows that it
records error. Yet form is not displaying the error.

So the problem is that on the first submit Tapestry is not rendering
the error, which is really there. Bug?

Adam



On Thu, Apr 21, 2011 at 10:20 AM, Adam Zimowski  wrote:
> I'm sorry, I am on Tapestry 5.2.5 :-)
>
> On Thu, Apr 21, 2011 at 10:19 AM, Adam Zimowski  wrote:
>> @Josh - When I debug Select in 5.2.4 (break on processSubmission(),
>> line 166), selectedValue is blank which is expected. So select
>> correctly submits without a value, it's just it seems that the
>> validator does not recognize that select state was repopulated via
>> zone and consequently no value was submitted the 2nd time. It seems to
>> me like the form validator somehow things that select has the value
>> from the prior submission, but it really doesn't since it was reset
>> via zone update.
>>
>> @Mark - by validation kicks in, I meant that form was submitted and
>> validated. I have a debug on state code passed from the state select
>> component when form activates, and AddressUiBean comes back with the
>> correct value. That is, when I select the state from the dropdown,
>> AddressUiBean carries the state as expected. Even when form is in
>> error, as I change the country thereby causing state dropdown get
>> repopulated, and resubmit the form with blank option for state (did
>> not select the state), AddressUiBean shows null state code (as
>> expected). Yet the form does not report the error on the required
>> state field.
>>
>> Adam
>>
>> On Wed, Apr 20, 2011 at 10:25 PM, Mark  wrote:
>>> When you say "Validation kicks in" does this occur after a submit?  If so,
>>> is it possible that AddressUIBean is remembering the value that was present
>>> when the submit occurred and then on the second submit it is getting set to
>>> null again?
>>>
>>> At the point when you would expect an error to occur, what is the value of
>>> the state field?  That should give you a good clue as to what is happening.
>>>
>>> Mark
>>>
>>> On Tue, Apr 19, 2011 at 5:11 PM, Adam Zimowski  wrote:
>>>
 I have a typical address form with street, city zip textfields and two
 dropdowns: country and state. The state dropdown is wrapped in a zone
 so that when country is selected, states are populated:

 >>> t:id="a_state" model="stateModel" validate="required"
 value="stateKode" blankOption="ALWAYS" blankLabel="literal:--Please
 Select"/>

 All works okay, except for a test case my business analyst found which
 I can't figure out.

 You fill out a form, pick a country then pick a state and suppose you
 leave city field empty which is required. Validation kicks in. While
 correcting a city error, you decide to switch a country causing state
 list to get repopulated and state be not selected again. Suppose you
 submit the form, I expect the error that state is required, but error
 is not thrown. Only if I resubmit the form a second time, state will
 be flagged in error.

 I am resetting state to null on country change. I have even tried
 setting form state field in error, none of which works.

 -- TML --

 
 Address Information
  
   :
  >>> value="address.line1"/>
  
  
  
   :
  >>> value="address.line2"/>
  
  
  
   :
  >>> value="address.line3"/>
  
  
  
   :
  >>> value="address.city"/>
  
  
  
   :
  >>> value="address.zipCode"/>
  
  
  
   :
  >>> t:id="a_state" model="stateModel" validate="required"
 value="address.stateCode" blankOption="ALWAYS"
 blankLabel="literal:--Please Select"/>
  
  
  
   :
  >>> value="address.countryCode" blankOption="NEVER"
 zone="stateModelZone"/>
  
  
  
  
 

  Page class -

 public class Register extends BasePage {

        @Inject
        private Logger log;

        @Inject
        private UtilityServiceRemote utilityService;

        @Persist
        @Property
        private AddressUiBean address;

        @OnEvent(value=EventConstants.PREPARE)
       

Re: T5: select zone update in a form

2011-04-21 Thread Adam Zimowski
I'm sorry, I am on Tapestry 5.2.5 :-)

On Thu, Apr 21, 2011 at 10:19 AM, Adam Zimowski  wrote:
> @Josh - When I debug Select in 5.2.4 (break on processSubmission(),
> line 166), selectedValue is blank which is expected. So select
> correctly submits without a value, it's just it seems that the
> validator does not recognize that select state was repopulated via
> zone and consequently no value was submitted the 2nd time. It seems to
> me like the form validator somehow things that select has the value
> from the prior submission, but it really doesn't since it was reset
> via zone update.
>
> @Mark - by validation kicks in, I meant that form was submitted and
> validated. I have a debug on state code passed from the state select
> component when form activates, and AddressUiBean comes back with the
> correct value. That is, when I select the state from the dropdown,
> AddressUiBean carries the state as expected. Even when form is in
> error, as I change the country thereby causing state dropdown get
> repopulated, and resubmit the form with blank option for state (did
> not select the state), AddressUiBean shows null state code (as
> expected). Yet the form does not report the error on the required
> state field.
>
> Adam
>
> On Wed, Apr 20, 2011 at 10:25 PM, Mark  wrote:
>> When you say "Validation kicks in" does this occur after a submit?  If so,
>> is it possible that AddressUIBean is remembering the value that was present
>> when the submit occurred and then on the second submit it is getting set to
>> null again?
>>
>> At the point when you would expect an error to occur, what is the value of
>> the state field?  That should give you a good clue as to what is happening.
>>
>> Mark
>>
>> On Tue, Apr 19, 2011 at 5:11 PM, Adam Zimowski  wrote:
>>
>>> I have a typical address form with street, city zip textfields and two
>>> dropdowns: country and state. The state dropdown is wrapped in a zone
>>> so that when country is selected, states are populated:
>>>
>>> >> t:id="a_state" model="stateModel" validate="required"
>>> value="stateKode" blankOption="ALWAYS" blankLabel="literal:--Please
>>> Select"/>
>>>
>>> All works okay, except for a test case my business analyst found which
>>> I can't figure out.
>>>
>>> You fill out a form, pick a country then pick a state and suppose you
>>> leave city field empty which is required. Validation kicks in. While
>>> correcting a city error, you decide to switch a country causing state
>>> list to get repopulated and state be not selected again. Suppose you
>>> submit the form, I expect the error that state is required, but error
>>> is not thrown. Only if I resubmit the form a second time, state will
>>> be flagged in error.
>>>
>>> I am resetting state to null on country change. I have even tried
>>> setting form state field in error, none of which works.
>>>
>>> -- TML --
>>>
>>> 
>>> Address Information
>>>  
>>>   :
>>>  >> value="address.line1"/>
>>>  
>>>  
>>>  
>>>   :
>>>  >> value="address.line2"/>
>>>  
>>>  
>>>  
>>>   :
>>>  >> value="address.line3"/>
>>>  
>>>  
>>>  
>>>   :
>>>  >> value="address.city"/>
>>>  
>>>  
>>>  
>>>   :
>>>  >> value="address.zipCode"/>
>>>  
>>>  
>>>  
>>>   :
>>>  >> t:id="a_state" model="stateModel" validate="required"
>>> value="address.stateCode" blankOption="ALWAYS"
>>> blankLabel="literal:--Please Select"/>
>>>  
>>>  
>>>  
>>>   :
>>>  >> value="address.countryCode" blankOption="NEVER"
>>> zone="stateModelZone"/>
>>>  
>>>  
>>>  
>>>  
>>> 
>>>
>>>  Page class -
>>>
>>> public class Register extends BasePage {
>>>
>>>        @Inject
>>>        private Logger log;
>>>
>>>        @Inject
>>>        private UtilityServiceRemote utilityService;
>>>
>>>        @Persist
>>>        @Property
>>>        private AddressUiBean address;
>>>
>>>        @OnEvent(value=EventConstants.PREPARE)
>>>        void initialize() {
>>>                if(address == null) address = new AddressUiBean();
>>>                if(contact == null) contact = new ContactUiBean();
>>>                if(registration == null) registration = new
>>> RegisterUiBean();
>>>
>>>                String countryCode = address.getCountryCode();
>>>                if(countryCode == null) {
>>>                        Locale locale = getLocale();
>>>                        countryCode = locale.getCountry();
>>>                        address.setCountryCode(countryCode);
>>>                }
>>>
>>>                log.debug("address state code {}", address.getStateCode());
>>>        }
>>>
>>>        @Cached
>>>        public Map getCountryModel() {
>>>                Map model = new LinkedHashMap>> String>();
>>>                List countries =
>>>                        utilityService.getAllCountries(getLocale());
>>>                for(CountryBean country : countries) {
>>>                        String code = country.getCodeIsoAlpha2();
>>>                        String description = country.getShortN

Re: T5: select zone update in a form

2011-04-21 Thread Adam Zimowski
@Josh - When I debug Select in 5.2.4 (break on processSubmission(),
line 166), selectedValue is blank which is expected. So select
correctly submits without a value, it's just it seems that the
validator does not recognize that select state was repopulated via
zone and consequently no value was submitted the 2nd time. It seems to
me like the form validator somehow things that select has the value
from the prior submission, but it really doesn't since it was reset
via zone update.

@Mark - by validation kicks in, I meant that form was submitted and
validated. I have a debug on state code passed from the state select
component when form activates, and AddressUiBean comes back with the
correct value. That is, when I select the state from the dropdown,
AddressUiBean carries the state as expected. Even when form is in
error, as I change the country thereby causing state dropdown get
repopulated, and resubmit the form with blank option for state (did
not select the state), AddressUiBean shows null state code (as
expected). Yet the form does not report the error on the required
state field.

Adam

On Wed, Apr 20, 2011 at 10:25 PM, Mark  wrote:
> When you say "Validation kicks in" does this occur after a submit?  If so,
> is it possible that AddressUIBean is remembering the value that was present
> when the submit occurred and then on the second submit it is getting set to
> null again?
>
> At the point when you would expect an error to occur, what is the value of
> the state field?  That should give you a good clue as to what is happening.
>
> Mark
>
> On Tue, Apr 19, 2011 at 5:11 PM, Adam Zimowski  wrote:
>
>> I have a typical address form with street, city zip textfields and two
>> dropdowns: country and state. The state dropdown is wrapped in a zone
>> so that when country is selected, states are populated:
>>
>> > t:id="a_state" model="stateModel" validate="required"
>> value="stateKode" blankOption="ALWAYS" blankLabel="literal:--Please
>> Select"/>
>>
>> All works okay, except for a test case my business analyst found which
>> I can't figure out.
>>
>> You fill out a form, pick a country then pick a state and suppose you
>> leave city field empty which is required. Validation kicks in. While
>> correcting a city error, you decide to switch a country causing state
>> list to get repopulated and state be not selected again. Suppose you
>> submit the form, I expect the error that state is required, but error
>> is not thrown. Only if I resubmit the form a second time, state will
>> be flagged in error.
>>
>> I am resetting state to null on country change. I have even tried
>> setting form state field in error, none of which works.
>>
>> -- TML --
>>
>> 
>> Address Information
>>  
>>   :
>>  > value="address.line1"/>
>>  
>>  
>>  
>>   :
>>  > value="address.line2"/>
>>  
>>  
>>  
>>   :
>>  > value="address.line3"/>
>>  
>>  
>>  
>>   :
>>  > value="address.city"/>
>>  
>>  
>>  
>>   :
>>  > value="address.zipCode"/>
>>  
>>  
>>  
>>   :
>>  > t:id="a_state" model="stateModel" validate="required"
>> value="address.stateCode" blankOption="ALWAYS"
>> blankLabel="literal:--Please Select"/>
>>  
>>  
>>  
>>   :
>>  > value="address.countryCode" blankOption="NEVER"
>> zone="stateModelZone"/>
>>  
>>  
>>  
>>  
>> 
>>
>>  Page class -
>>
>> public class Register extends BasePage {
>>
>>        @Inject
>>        private Logger log;
>>
>>        @Inject
>>        private UtilityServiceRemote utilityService;
>>
>>        @Persist
>>        @Property
>>        private AddressUiBean address;
>>
>>        @OnEvent(value=EventConstants.PREPARE)
>>        void initialize() {
>>                if(address == null) address = new AddressUiBean();
>>                if(contact == null) contact = new ContactUiBean();
>>                if(registration == null) registration = new
>> RegisterUiBean();
>>
>>                String countryCode = address.getCountryCode();
>>                if(countryCode == null) {
>>                        Locale locale = getLocale();
>>                        countryCode = locale.getCountry();
>>                        address.setCountryCode(countryCode);
>>                }
>>
>>                log.debug("address state code {}", address.getStateCode());
>>        }
>>
>>        @Cached
>>        public Map getCountryModel() {
>>                Map model = new LinkedHashMap> String>();
>>                List countries =
>>                        utilityService.getAllCountries(getLocale());
>>                for(CountryBean country : countries) {
>>                        String code = country.getCodeIsoAlpha2();
>>                        String description = country.getShortName();
>>                        log.debug("code: {}, description: {}", code,
>> description);
>>                        model.put(code, description);
>>                }
>>                return model;
>>        }
>>
>>        @OnEvent(value=EventConstants.VALUE_CH

Re: T5: select zone update in a form

2011-04-20 Thread Mark
When you say "Validation kicks in" does this occur after a submit?  If so,
is it possible that AddressUIBean is remembering the value that was present
when the submit occurred and then on the second submit it is getting set to
null again?

At the point when you would expect an error to occur, what is the value of
the state field?  That should give you a good clue as to what is happening.

Mark

On Tue, Apr 19, 2011 at 5:11 PM, Adam Zimowski  wrote:

> I have a typical address form with street, city zip textfields and two
> dropdowns: country and state. The state dropdown is wrapped in a zone
> so that when country is selected, states are populated:
>
>  t:id="a_state" model="stateModel" validate="required"
> value="stateKode" blankOption="ALWAYS" blankLabel="literal:--Please
> Select"/>
>
> All works okay, except for a test case my business analyst found which
> I can't figure out.
>
> You fill out a form, pick a country then pick a state and suppose you
> leave city field empty which is required. Validation kicks in. While
> correcting a city error, you decide to switch a country causing state
> list to get repopulated and state be not selected again. Suppose you
> submit the form, I expect the error that state is required, but error
> is not thrown. Only if I resubmit the form a second time, state will
> be flagged in error.
>
> I am resetting state to null on country change. I have even tried
> setting form state field in error, none of which works.
>
> -- TML --
>
> 
> Address Information
>  
>   :
>   value="address.line1"/>
>  
>  
>  
>   :
>   value="address.line2"/>
>  
>  
>  
>   :
>   value="address.line3"/>
>  
>  
>  
>   :
>   value="address.city"/>
>  
>  
>  
>   :
>   value="address.zipCode"/>
>  
>  
>  
>   :
>   t:id="a_state" model="stateModel" validate="required"
> value="address.stateCode" blankOption="ALWAYS"
> blankLabel="literal:--Please Select"/>
>  
>  
>  
>   :
>   value="address.countryCode" blankOption="NEVER"
> zone="stateModelZone"/>
>  
>  
>  
>  
> 
>
>  Page class -
>
> public class Register extends BasePage {
>
>@Inject
>private Logger log;
>
>@Inject
>private UtilityServiceRemote utilityService;
>
>@Persist
>@Property
>private AddressUiBean address;
>
>@OnEvent(value=EventConstants.PREPARE)
>void initialize() {
>if(address == null) address = new AddressUiBean();
>if(contact == null) contact = new ContactUiBean();
>if(registration == null) registration = new
> RegisterUiBean();
>
>String countryCode = address.getCountryCode();
>if(countryCode == null) {
>Locale locale = getLocale();
>countryCode = locale.getCountry();
>address.setCountryCode(countryCode);
>}
>
>log.debug("address state code {}", address.getStateCode());
>}
>
>@Cached
>public Map getCountryModel() {
>Map model = new LinkedHashMap String>();
>List countries =
>utilityService.getAllCountries(getLocale());
>for(CountryBean country : countries) {
>String code = country.getCodeIsoAlpha2();
>String description = country.getShortName();
>log.debug("code: {}, description: {}", code,
> description);
>model.put(code, description);
>}
>return model;
>}
>
>@OnEvent(value=EventConstants.VALUE_CHANGED, component="a_country")
>public Object onCountrySelected(String aCountryCode) {
>log.debug("selected country: {}", aCountryCode);
>address.setStateCode(null);
>return stateModelZone.getBody();
>}
>
>@Cached
>public Map getStateModel() {
>Map model = new LinkedHashMap String>();
>String countryCode = address.getCountryCode();
>List states =
>
>  utilityService.getAllStateProvincesForCountry(countryCode, getLocale());
>for(StateProvinceBean state : states) {
>String code = state.getLookupCode();
>String name = state.getLongName();
>log.debug("code: {}, name {}", code, name);
>model.put(code, name);
>}
>return model;
>}
> }
>
> Adam
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: T5: select zone update in a form

2011-04-20 Thread Josh Canfield
I don't have the time now to dive into this, but it sounds like the
select thinks it has a value when it's time to validate. Have you set
a breakpoint in the Select component to see what it thinks that value
is?

Josh

On Wed, Apr 20, 2011 at 1:36 PM, Adam Zimowski  wrote:
> Nobody ran into this? I have a feeling that I'm doing something wrong,
> but then, I'm not sure either if Tapestry is just not working as
> expected.
>
> If I make the stateUpdateZone wrap entire form, then form is aware of
> state value change. But I do not want to refresh entire form, all I
> want to update is my little zone which I want to wrap state select in.
>
> Adam
>
> On Tue, Apr 19, 2011 at 5:11 PM, Adam Zimowski  wrote:
>> I have a typical address form with street, city zip textfields and two
>> dropdowns: country and state. The state dropdown is wrapped in a zone
>> so that when country is selected, states are populated:
>>
>> > t:id="a_state" model="stateModel" validate="required"
>> value="stateKode" blankOption="ALWAYS" blankLabel="literal:--Please
>> Select"/>
>>
>> All works okay, except for a test case my business analyst found which
>> I can't figure out.
>>
>> You fill out a form, pick a country then pick a state and suppose you
>> leave city field empty which is required. Validation kicks in. While
>> correcting a city error, you decide to switch a country causing state
>> list to get repopulated and state be not selected again. Suppose you
>> submit the form, I expect the error that state is required, but error
>> is not thrown. Only if I resubmit the form a second time, state will
>> be flagged in error.
>>
>> I am resetting state to null on country change. I have even tried
>> setting form state field in error, none of which works.
>>
>> -- TML --
>>
>> 
>> Address Information
>>  
>>   :
>>  > value="address.line1"/>
>>  
>>  
>>  
>>   :
>>  > value="address.line2"/>
>>  
>>  
>>  
>>   :
>>  > value="address.line3"/>
>>  
>>  
>>  
>>   :
>>  > value="address.city"/>
>>  
>>  
>>  
>>   :
>>  > value="address.zipCode"/>
>>  
>>  
>>  
>>   :
>>  > t:id="a_state" model="stateModel" validate="required"
>> value="address.stateCode" blankOption="ALWAYS"
>> blankLabel="literal:--Please Select"/>
>>  
>>  
>>  
>>   :
>>  > value="address.countryCode" blankOption="NEVER"
>> zone="stateModelZone"/>
>>  
>>  
>>  
>>  
>> 
>>
>>  Page class -
>>
>> public class Register extends BasePage {
>>
>>        @Inject
>>        private Logger log;
>>
>>        @Inject
>>        private UtilityServiceRemote utilityService;
>>
>>        @Persist
>>        @Property
>>        private AddressUiBean address;
>>
>>        @OnEvent(value=EventConstants.PREPARE)
>>        void initialize() {
>>                if(address == null) address = new AddressUiBean();
>>                if(contact == null) contact = new ContactUiBean();
>>                if(registration == null) registration = new RegisterUiBean();
>>
>>                String countryCode = address.getCountryCode();
>>                if(countryCode == null) {
>>                        Locale locale = getLocale();
>>                        countryCode = locale.getCountry();
>>                        address.setCountryCode(countryCode);
>>                }
>>
>>                log.debug("address state code {}", address.getStateCode());
>>        }
>>
>>        @Cached
>>        public Map getCountryModel() {
>>                Map model = new LinkedHashMap> String>();
>>                List countries =
>>                        utilityService.getAllCountries(getLocale());
>>                for(CountryBean country : countries) {
>>                        String code = country.getCodeIsoAlpha2();
>>                        String description = country.getShortName();
>>                        log.debug("code: {}, description: {}", code, 
>> description);
>>                        model.put(code, description);
>>                }
>>                return model;
>>        }
>>
>>        @OnEvent(value=EventConstants.VALUE_CHANGED, component="a_country")
>>        public Object onCountrySelected(String aCountryCode) {
>>                log.debug("selected country: {}", aCountryCode);
>>                address.setStateCode(null);
>>                return stateModelZone.getBody();
>>        }
>>
>>        @Cached
>>        public Map getStateModel() {
>>                Map model = new LinkedHashMap> String>();
>>                String countryCode = address.getCountryCode();
>>                List states =
>>                        
>> utilityService.getAllStateProvincesForCountry(countryCode, getLocale());
>>                for(StateProvinceBean state : states) {
>>                        String code = state.getLookupCode();
>>                        String name = state.getLongName();
>>                        log.debug("code: {}, name {}", code, name);
>>                        model.put(code, name);
>>                }
>>      

Re: T5: select zone update in a form

2011-04-20 Thread Adam Zimowski
Nobody ran into this? I have a feeling that I'm doing something wrong,
but then, I'm not sure either if Tapestry is just not working as
expected.

If I make the stateUpdateZone wrap entire form, then form is aware of
state value change. But I do not want to refresh entire form, all I
want to update is my little zone which I want to wrap state select in.

Adam

On Tue, Apr 19, 2011 at 5:11 PM, Adam Zimowski  wrote:
> I have a typical address form with street, city zip textfields and two
> dropdowns: country and state. The state dropdown is wrapped in a zone
> so that when country is selected, states are populated:
>
>  t:id="a_state" model="stateModel" validate="required"
> value="stateKode" blankOption="ALWAYS" blankLabel="literal:--Please
> Select"/>
>
> All works okay, except for a test case my business analyst found which
> I can't figure out.
>
> You fill out a form, pick a country then pick a state and suppose you
> leave city field empty which is required. Validation kicks in. While
> correcting a city error, you decide to switch a country causing state
> list to get repopulated and state be not selected again. Suppose you
> submit the form, I expect the error that state is required, but error
> is not thrown. Only if I resubmit the form a second time, state will
> be flagged in error.
>
> I am resetting state to null on country change. I have even tried
> setting form state field in error, none of which works.
>
> -- TML --
>
> 
> Address Information
>  
>   :
>   value="address.line1"/>
>  
>  
>  
>   :
>   value="address.line2"/>
>  
>  
>  
>   :
>   value="address.line3"/>
>  
>  
>  
>   :
>  
>  
>  
>  
>   :
>   value="address.zipCode"/>
>  
>  
>  
>   :
>   t:id="a_state" model="stateModel" validate="required"
> value="address.stateCode" blankOption="ALWAYS"
> blankLabel="literal:--Please Select"/>
>  
>  
>  
>   :
>   value="address.countryCode" blankOption="NEVER"
> zone="stateModelZone"/>
>  
>  
>  
>  
> 
>
>  Page class -
>
> public class Register extends BasePage {
>
>        @Inject
>        private Logger log;
>
>        @Inject
>        private UtilityServiceRemote utilityService;
>
>        @Persist
>        @Property
>        private AddressUiBean address;
>
>        @OnEvent(value=EventConstants.PREPARE)
>        void initialize() {
>                if(address == null) address = new AddressUiBean();
>                if(contact == null) contact = new ContactUiBean();
>                if(registration == null) registration = new RegisterUiBean();
>
>                String countryCode = address.getCountryCode();
>                if(countryCode == null) {
>                        Locale locale = getLocale();
>                        countryCode = locale.getCountry();
>                        address.setCountryCode(countryCode);
>                }
>
>                log.debug("address state code {}", address.getStateCode());
>        }
>
>        @Cached
>        public Map getCountryModel() {
>                Map model = new LinkedHashMap String>();
>                List countries =
>                        utilityService.getAllCountries(getLocale());
>                for(CountryBean country : countries) {
>                        String code = country.getCodeIsoAlpha2();
>                        String description = country.getShortName();
>                        log.debug("code: {}, description: {}", code, 
> description);
>                        model.put(code, description);
>                }
>                return model;
>        }
>
>        @OnEvent(value=EventConstants.VALUE_CHANGED, component="a_country")
>        public Object onCountrySelected(String aCountryCode) {
>                log.debug("selected country: {}", aCountryCode);
>                address.setStateCode(null);
>                return stateModelZone.getBody();
>        }
>
>        @Cached
>        public Map getStateModel() {
>                Map model = new LinkedHashMap String>();
>                String countryCode = address.getCountryCode();
>                List states =
>                        
> utilityService.getAllStateProvincesForCountry(countryCode, getLocale());
>                for(StateProvinceBean state : states) {
>                        String code = state.getLookupCode();
>                        String name = state.getLongName();
>                        log.debug("code: {}, name {}", code, name);
>                        model.put(code, name);
>                }
>                return model;
>        }
> }
>
> Adam
>

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



T5: select zone update in a form

2011-04-19 Thread Adam Zimowski
I have a typical address form with street, city zip textfields and two
dropdowns: country and state. The state dropdown is wrapped in a zone
so that when country is selected, states are populated:



All works okay, except for a test case my business analyst found which
I can't figure out.

You fill out a form, pick a country then pick a state and suppose you
leave city field empty which is required. Validation kicks in. While
correcting a city error, you decide to switch a country causing state
list to get repopulated and state be not selected again. Suppose you
submit the form, I expect the error that state is required, but error
is not thrown. Only if I resubmit the form a second time, state will
be flagged in error.

I am resetting state to null on country change. I have even tried
setting form state field in error, none of which works.

-- TML --


Address Information
 
  :
 
 
 
 
  :
 
 
 
 
  :
 
 
 
 
  :
 
 
 
 
  :
 
 
 
 
  :
 
 
 
 
  :
 
 
 
 
 


 Page class -

public class Register extends BasePage {

@Inject
private Logger log;

@Inject
private UtilityServiceRemote utilityService;

@Persist
@Property
private AddressUiBean address;

@OnEvent(value=EventConstants.PREPARE)
void initialize() {
if(address == null) address = new AddressUiBean();
if(contact == null) contact = new ContactUiBean();
if(registration == null) registration = new RegisterUiBean();

String countryCode = address.getCountryCode();
if(countryCode == null) {
Locale locale = getLocale();
countryCode = locale.getCountry();
address.setCountryCode(countryCode);
}

log.debug("address state code {}", address.getStateCode());
}

@Cached
public Map getCountryModel() {
Map model = new LinkedHashMap();
List countries =
utilityService.getAllCountries(getLocale());
for(CountryBean country : countries) {
String code = country.getCodeIsoAlpha2();
String description = country.getShortName();
log.debug("code: {}, description: {}", code, 
description);
model.put(code, description);
}
return model;
}

@OnEvent(value=EventConstants.VALUE_CHANGED, component="a_country")
public Object onCountrySelected(String aCountryCode) {
log.debug("selected country: {}", aCountryCode);
address.setStateCode(null);
return stateModelZone.getBody();
}

@Cached
public Map getStateModel() {
Map model = new LinkedHashMap();
String countryCode = address.getCountryCode();
List states =

utilityService.getAllStateProvincesForCountry(countryCode, getLocale());
for(StateProvinceBean state : states) {
String code = state.getLookupCode();
String name = state.getLongName();
log.debug("code: {}, name {}", code, name);
model.put(code, name);
}
return model;
}
}

Adam

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



Re: T5 IoC Advice: Inconsistent args_size for opc_invokeinterface

2011-04-17 Thread Adriaan Joubert
Hi Howard,

Sorry, should have included it. I'm running

java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

on Ubuntu 10.10.

I've had the feeling this may be a tough one to pin down. I can work
around it for now by excluding some methods, so can wait for the ASM
implementation and then try again.

Cheers,

Adriaan

On 17 April 2011 22:15, Howard Lewis Ship  wrote:
> What JDK are you compiling for, executing under?
>
> It's very hard to say what the problem really is ... a bug in the
> wrappers around Tapestry or a bug in Javassist.  I'm hoping that the
> 5.3 code, based on wrappers around ASM, will be faster, more
> efficient, and more stable.
>
> On Sun, Apr 17, 2011 at 12:30 AM, Adriaan Joubert  
> wrote:
>>> Which Tapestry-IoC version are you using?
>>
>> I tried with both 5.1.0.5 and 5.2.4.
>>
>> I should also mention that I thought this may have something to do
>> with other advisors (we use them for transaction management as well as
>> checking that a slave database has caught up to a certain point). I've
>> marked all of these to prevent decoration and the specific method
>> where it fails every time is not decorated other than by the timing
>> advice.
>>
>> After more experimentation I can get this to run through with only
>> excluding a handful of methods from the timing advice, all of them in
>> a single service. These methods are always called from methods in
>> other services, so the advice will appear more than once on the call
>> chain. However in many other cases this does not cause any problems. I
>> can't see anything special about any of the methods causing the
>> problems, or the service for that matter, but they do create the
>> problem in a reproducible fashion.
>>
>> A typical signature is
>>
>> public MonthlyStandardReturnsSeries create(TimeSeries timeSeries,
>> MonthRange itv, double[] values);
>>
>> so nothing special. I have methods in the same service that use
>> generic types, e.g. and they cause no problems. Any hint what to look
>> for would be great - seems that this is usually a call out of the
>> javassist generated code, so it is kind-of hard to debug.
>>
>> Cheers,
>>
>> Adriaan
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
>
> --
> 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
>
>

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



Re: Setting contenttype of T5 form

2011-04-17 Thread Fernando Benjamin
ervletRequest request) {
>
>
> try {
>
> return createFileUpload().getItemIterator(request);
>
> } catch (FileUploadException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> } catch (IOException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> }
>
> return null;
>
> }
>
>
> protected ServletFileUpload createFileUpload() {
>
> ServletFileUpload upload = new ServletFileUpload(fileItemFactory);
>
>
> // // set maximum file upload size
>
> // upload.setSizeMax(maxRequestSize);
>
> upload.setFileSizeMax(maxFileSize);
>
>
> return upload;
>
> }
>
>
> protected HttpServletRequest processFileItems(HttpServletRequest request,
> FileItemIterator fileItems) {
>
> if (uploadException == null && (fileItems == null)) {
>
> return request;
>
> }
>
> ParametersServletRequestWrapper wrapper = new
>  ParametersServletRequestWrapper(request);
>
>
> try {
>
> for (FileItemIterator it = fileItems; it.hasNext();) {
>
> FileItemStream item;
>
> item = it.next();
>
> if (item.isFormField()) {
>
> wrapper.addParameter(item.getFieldName(), item.getFieldName());
>
> } else {
>
> logger.debug("" + item.getName());
>
> logger.debug("" + item.getFieldName());
>
> wrapper.addParameter(item.getFieldName(), item.getName());
>
>
>
> }
>
> }
>
> } catch (FileUploadException e) {
>
> e.printStackTrace();
>
> } catch (IOException e) {
>
> e.printStackTrace();
>
> }
>
>
> return wrapper;
>
> }
>
>
> protected void addUploadedFile(String name, Blob file) {
>
> uploads.put(name, file);
>
> }
>
> }
>
>
> #### THIS IS MY FORM
>
> 
> title="${message:title}"
>
>   xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";
>
>   xmlns:p="tapestry:parameter">
>
> Post a new product:
>
>  
>
> 
>
> 
>
> 
>
> 
>
>
> 
>
>  />
>
>
>
> 
>
> 
>
>
>
>
>  THIS IS MY EXCEPTION
>
>-
>   - Triggering event 'action' on personal/AddProduct:upload
>- org.apache.tapestry5.runtime.ComponentEventException
>java.util.zip.ZipException: Not in GZIP format
>
>
> On 9 April 2011 16:31, Taha Hafeez  wrote:
>
>>
>> If you can use an ajax file uploader then you can modify this to meet your
>> needs
>>
>>
>> http://tapestry.1045711.n5.nabble.com/Tapestry-FileUploader-Integration-td4268987.html
>>
>> regards
>> Taha
>>
>> --
>> View this message in context:
>> http://tapestry.1045711.n5.nabble.com/Setting-contenttype-of-T5-form-tp4270175p4292978.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 IoC Advice: Inconsistent args_size for opc_invokeinterface

2011-04-17 Thread Howard Lewis Ship
What JDK are you compiling for, executing under?

It's very hard to say what the problem really is ... a bug in the
wrappers around Tapestry or a bug in Javassist.  I'm hoping that the
5.3 code, based on wrappers around ASM, will be faster, more
efficient, and more stable.

On Sun, Apr 17, 2011 at 12:30 AM, Adriaan Joubert  wrote:
>> Which Tapestry-IoC version are you using?
>
> I tried with both 5.1.0.5 and 5.2.4.
>
> I should also mention that I thought this may have something to do
> with other advisors (we use them for transaction management as well as
> checking that a slave database has caught up to a certain point). I've
> marked all of these to prevent decoration and the specific method
> where it fails every time is not decorated other than by the timing
> advice.
>
> After more experimentation I can get this to run through with only
> excluding a handful of methods from the timing advice, all of them in
> a single service. These methods are always called from methods in
> other services, so the advice will appear more than once on the call
> chain. However in many other cases this does not cause any problems. I
> can't see anything special about any of the methods causing the
> problems, or the service for that matter, but they do create the
> problem in a reproducible fashion.
>
> A typical signature is
>
> public MonthlyStandardReturnsSeries create(TimeSeries timeSeries,
> MonthRange itv, double[] values);
>
> so nothing special. I have methods in the same service that use
> generic types, e.g. and they cause no problems. Any hint what to look
> for would be great - seems that this is usually a call out of the
> javassist generated code, so it is kind-of hard to debug.
>
> Cheers,
>
> Adriaan
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
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: T5 IoC Advice: Inconsistent args_size for opc_invokeinterface

2011-04-17 Thread Adriaan Joubert
> Which Tapestry-IoC version are you using?

I tried with both 5.1.0.5 and 5.2.4.

I should also mention that I thought this may have something to do
with other advisors (we use them for transaction management as well as
checking that a slave database has caught up to a certain point). I've
marked all of these to prevent decoration and the specific method
where it fails every time is not decorated other than by the timing
advice.

After more experimentation I can get this to run through with only
excluding a handful of methods from the timing advice, all of them in
a single service. These methods are always called from methods in
other services, so the advice will appear more than once on the call
chain. However in many other cases this does not cause any problems. I
can't see anything special about any of the methods causing the
problems, or the service for that matter, but they do create the
problem in a reproducible fashion.

A typical signature is

public MonthlyStandardReturnsSeries create(TimeSeries timeSeries,
MonthRange itv, double[] values);

so nothing special. I have methods in the same service that use
generic types, e.g. and they cause no problems. Any hint what to look
for would be great - seems that this is usually a call out of the
javassist generated code, so it is kind-of hard to debug.

Cheers,

Adriaan

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



Re: T5 IoC Advice: Inconsistent args_size for opc_invokeinterface

2011-04-16 Thread Thiago H. de Paula Figueiredo
On Sat, 16 Apr 2011 09:22:52 -0300, Adriaan Joubert   
wrote:



Hi,


Hi!


I tried to build a rough-and-ready timer for service method calls by
using an advisor. We already use these for transaction management etc
and never had an issue. However after many successful calls I suddenly
get:

Exception in thread "Thread-26" java.lang.VerifyError: (class:
Invocation$MonthlyTimeSeriesFactory$create$12f5e314f65, method:
invokeDelegateMethod signature: ()V) Inconsistent args_size for
opc_invokeinterface


Which Tapestry-IoC version are you using?

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, 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: Setting contenttype of T5 form

2011-04-16 Thread Fernando Benjamin
an use an ajax file uploader then you can modify this to meet your
> needs
>
>
> http://tapestry.1045711.n5.nabble.com/Tapestry-FileUploader-Integration-td4268987.html
>
> regards
> Taha
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Setting-contenttype-of-T5-form-tp4270175p4292978.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
>
>


T5 IoC Advice: Inconsistent args_size for opc_invokeinterface

2011-04-16 Thread Adriaan Joubert
Hi,

I tried to build a rough-and-ready timer for service method calls by
using an advisor. We already use these for transaction management etc
and never had an issue. However after many successful calls I suddenly
get:

Exception in thread "Thread-26" java.lang.VerifyError: (class:
Invocation$MonthlyTimeSeriesFactory$create$12f5e314f65, method:
invokeDelegateMethod signature: ()V) Inconsistent args_size for
opc_invokeinterface
at 
$MonthlyTimeSeriesFactory_12f5e31494f.create($MonthlyTimeSeriesFactory_12f5e31494f.java)
at 
$MonthlyTimeSeriesFactory_12f5e31493d.create($MonthlyTimeSeriesFactory_12f5e31493d.java)
at 
com.albourne.db.series.TimeSeriesRetrievalSingleTimeSeriesBuilder.createSeriesFromBuffer(TimeSeriesRetrievalSingleTimeSeriesBuilder.java:122)

Without advice this works fine. Interestingly it also works fine when
using the built-in tapestry logger. The advisor itself could not be
simpler (attached below). Anybody seen this before or any ideas what I
should avoid?

Thanks,

Adriaan

final class MethodTimeAdvice implements MethodAdvice {

private final String simpleName_;
private final MethodTimeCollector methodTimeCollector_;

public MethodTimeAdvice(String simpleName,
MethodTimeCollector methodTimeCollector) {
simpleName_ = simpleName;
methodTimeCollector_ = methodTimeCollector;
}

@Override
public void advise(Invocation invocation) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
try {
invocation.proceed();
} catch (RuntimeException ex) {
logTime(invocation, stopWatch);
throw ex;
}
stopWatch.stop();
logTime(invocation, stopWatch);
}

private void logTime(Invocation invocation, StopWatch stopWatch) {
String methodId = simpleName_ + "." + 
invocation.getMethodName() + "["
+ invocation.getParameterCount() + "]";
methodTimeCollector_.logTime(methodId, stopWatch.getTime());
}
}

Adding the advice is also straigtforward

@PreventServiceDecoration
public class MethodTimeLoggerImpl implements MethodTimeLogger {

private final MethodTimeCollector methodTimeCollector_;

public MethodTimeLoggerImpl(MethodTimeCollector methodTimeCollector) {
methodTimeCollector_ = methodTimeCollector;
}

@Override
public void addMethodLogger(MethodAdviceReceiver methodAdviceReceiver) {
MethodAdvice advice = new MethodTimeAdvice(methodAdviceReceiver
.getInterface().getSimpleName(), 
methodTimeCollector_);
methodAdviceReceiver.adviseAllMethods(advice);
}

}

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



Re: t5: create a record from another table, what is best practice?

2011-04-16 Thread Taha Hafeez
public class MakeProfile {

   @Inject
   private Session session;

   @Property
   private String email;

   @Property
   private String name;

@Property
   @Persist(PersistenceConstants.FLASH)
private Application app;

   void onActivate(String code_ref) {
  if(app == null){
 app = (Applicantion) session().createQuery("from Applicantion where
 code = ?").setString(0, code_ref).uniqueResult();
  }
   }

   void onPrepareForRender(){
  email = app.getEmail();
  name = app.getName();
   }

   @CommitAfter
   Object onSuccess() {
   Profile p = new Profile();
   p.setEmail(email);
   p.setName(name);
   session.save(p);
   }

}

regards
Taha


On Sat, Apr 16, 2011 at 2:31 PM, Angelo C.  wrote:

> Hi,
>
> Thanks, but how to pass a string to prepareForRender?
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/t5-create-a-record-from-another-table-what-is-best-practice-tp4307107p4307173.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: create a record from another table, what is best practice?

2011-04-16 Thread Angelo C.
Hi,

Thanks, but how to pass a string to prepareForRender?

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-create-a-record-from-another-table-what-is-best-practice-tp4307107p4307173.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: create a record from another table, what is best practice?

2011-04-16 Thread Taha Hafeez
Hi

onActivate() is called each time a page is loaded. So if you have a form on
a page, onActivate() will be called on both at the time of rendering and
submit/action phase

So if you have to initialize any variables before showing them in a form do
it in prepareForRender event of the form and if you want to do some thing
after submiting the form do it in prepareForSubmit event of the form. If you
want to do something common in both phases do it in prepare event of the
form.

Please refer to
http://tapestry.apache.org/tapestry5.2-dev/tapestry-core/ref/org/apache/tapestry5/corelib/components/Form.html

regards
taha


On Sat, Apr 16, 2011 at 1:24 PM, Angelo C.  wrote:

> Hi,
>   I have a form with email and name fields, and when the page is activated,
> it will retrieve an existing application, then initialize email and name,
> when submit is clicked,
>   a Profile record is created in onSuccess and persisted, the following
> code seems not working, what is a right practice in this use case?
> Thanks,
>
>
> public class MakeProfile {
>
>@Inject
>private Session session;
>
>@Property
>private String email;
>@Property
>private String name;
>
>private Application app;
>
>void onActivate(String code_ref) {
>app = (Applicantion) session().createQuery("from Applicantion where
> code = ?").setString(0, code_ref).uniqueResult();
>if (app != null) {
>email = app.getEmail();
>name = app.getName();
>  }
>}
>
>@CommitAfter
>Object onSuccess() {
>Profile p = new Profile();
>p.setEmail(email);
>p.setName(name);
>    session.save(p);
>}
>
> }
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/t5-create-a-record-from-another-table-what-is-best-practice-tp4307107p4307107.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
>
>


t5: create a record from another table, what is best practice?

2011-04-16 Thread Angelo C.
Hi,
   I have a form with email and name fields, and when the page is activated,
it will retrieve an existing application, then initialize email and name,
when submit is clicked, 
   a Profile record is created in onSuccess and persisted, the following
code seems not working, what is a right practice in this use case?  
Thanks,
   

public class MakeProfile {

@Inject
private Session session;

@Property
private String email;
@Property
private String name;

private Application app;
 
void onActivate(String code_ref) {
app = (Applicantion) session().createQuery("from Applicantion where
code = ?").setString(0, code_ref).uniqueResult();
if (app != null) {
email = app.getEmail();
name = app.getName();
  }
}

@CommitAfter
Object onSuccess() {
Profile p = new Profile();
p.setEmail(email);
p.setName(name);
session.save(p);
}

}


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-create-a-record-from-another-table-what-is-best-practice-tp4307107p4307107.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: upgrade to 5.1.0.8-SNAPSHOT issue

2011-04-14 Thread Howard Lewis Ship
Yes, the ability to disambiguate parameters in this way has always been present.

On Thu, Apr 14, 2011 at 8:50 AM, Dmitriy Vsekhvalnov
 wrote:
> works like a charm. thanks.
>
> Is it backward compatible with 5.1.0.5 (i mean zoneupdater.zone='whatever')
> ?
>
> On Thu, Apr 14, 2011 at 7:30 PM, Taha Hafeez wrote:
>
>> Hi
>>
>> In 5.1.0.6 a parameter zone was added to Select. So in your case both
>> Select
>> component and mixin ZoneUpdater have 'zone' as parameter.In tapestry, if
>> both component and mixin have the same parameter name, the parameter is
>> assigned to the component and mixin does not get the parameter.
>>
>> As ZoneUpdater does not get any value for 'zone' and 'zone' parameter is
>> required , it complains.
>>
>> You can specify the parameter for zoneupdater as
>> zoneupdater.zone='whatever'
>>
>> http://tapestry.apache.org/component-mixins.html
>>
>> regards
>> Taha
>>
>>
>> On Thu, Apr 14, 2011 at 8:42 PM, Dmitriy Vsekhvalnov <
>> dvsekhval...@gmail.com
>> > wrote:
>>
>> > Hi all,
>> >  just upgraded application to 5.1.0.8-SNAPSHOT, and got weird error for
>> > components that includes ZoneUpdater (
>> > http://tinybits.blogspot.com/2010/03/new-and-better-zoneupdater.html)
>> >
>> > org.apache.tapestry5.ioc.internal.util.TapestryException: Parameter(s)
>> > 'ZoneUpdater.zone' are required for
>> > org.apache.tapestry5.corelib.components.Select, but have not been bound.
>> >
>> > But it bound :)    If i change parameter definition to:
>> >
>> >  @Parameter(defaultPrefix = BindingConstants.LITERAL, required = false)
>> >  private String zone;
>> >
>> >
>> > it works perfectly.
>> >
>> > Is it something known (5.1.0.5 was working as expected) ?
>> >
>>
>



-- 
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: T5: upgrade to 5.1.0.8-SNAPSHOT issue

2011-04-14 Thread Dmitriy Vsekhvalnov
works like a charm. thanks.

Is it backward compatible with 5.1.0.5 (i mean zoneupdater.zone='whatever')
?

On Thu, Apr 14, 2011 at 7:30 PM, Taha Hafeez wrote:

> Hi
>
> In 5.1.0.6 a parameter zone was added to Select. So in your case both
> Select
> component and mixin ZoneUpdater have 'zone' as parameter.In tapestry, if
> both component and mixin have the same parameter name, the parameter is
> assigned to the component and mixin does not get the parameter.
>
> As ZoneUpdater does not get any value for 'zone' and 'zone' parameter is
> required , it complains.
>
> You can specify the parameter for zoneupdater as
> zoneupdater.zone='whatever'
>
> http://tapestry.apache.org/component-mixins.html
>
> regards
> Taha
>
>
> On Thu, Apr 14, 2011 at 8:42 PM, Dmitriy Vsekhvalnov <
> dvsekhval...@gmail.com
> > wrote:
>
> > Hi all,
> >  just upgraded application to 5.1.0.8-SNAPSHOT, and got weird error for
> > components that includes ZoneUpdater (
> > http://tinybits.blogspot.com/2010/03/new-and-better-zoneupdater.html)
> >
> > org.apache.tapestry5.ioc.internal.util.TapestryException: Parameter(s)
> > 'ZoneUpdater.zone' are required for
> > org.apache.tapestry5.corelib.components.Select, but have not been bound.
> >
> > But it bound :)If i change parameter definition to:
> >
> >  @Parameter(defaultPrefix = BindingConstants.LITERAL, required = false)
> >  private String zone;
> >
> >
> > it works perfectly.
> >
> > Is it something known (5.1.0.5 was working as expected) ?
> >
>


Re: T5: upgrade to 5.1.0.8-SNAPSHOT issue

2011-04-14 Thread Taha Hafeez
Hi

In 5.1.0.6 a parameter zone was added to Select. So in your case both Select
component and mixin ZoneUpdater have 'zone' as parameter.In tapestry, if
both component and mixin have the same parameter name, the parameter is
assigned to the component and mixin does not get the parameter.

As ZoneUpdater does not get any value for 'zone' and 'zone' parameter is
required , it complains.

You can specify the parameter for zoneupdater as zoneupdater.zone='whatever'

http://tapestry.apache.org/component-mixins.html

regards
Taha


On Thu, Apr 14, 2011 at 8:42 PM, Dmitriy Vsekhvalnov  wrote:

> Hi all,
>  just upgraded application to 5.1.0.8-SNAPSHOT, and got weird error for
> components that includes ZoneUpdater (
> http://tinybits.blogspot.com/2010/03/new-and-better-zoneupdater.html)
>
> org.apache.tapestry5.ioc.internal.util.TapestryException: Parameter(s)
> 'ZoneUpdater.zone' are required for
> org.apache.tapestry5.corelib.components.Select, but have not been bound.
>
> But it bound :)If i change parameter definition to:
>
>  @Parameter(defaultPrefix = BindingConstants.LITERAL, required = false)
>  private String zone;
>
>
> it works perfectly.
>
> Is it something known (5.1.0.5 was working as expected) ?
>


T5: upgrade to 5.1.0.8-SNAPSHOT issue

2011-04-14 Thread Dmitriy Vsekhvalnov
Hi all,
  just upgraded application to 5.1.0.8-SNAPSHOT, and got weird error for
components that includes ZoneUpdater (
http://tinybits.blogspot.com/2010/03/new-and-better-zoneupdater.html)

org.apache.tapestry5.ioc.internal.util.TapestryException: Parameter(s)
'ZoneUpdater.zone' are required for
org.apache.tapestry5.corelib.components.Select, but have not been bound.

But it bound :)If i change parameter definition to:

  @Parameter(defaultPrefix = BindingConstants.LITERAL, required = false)
  private String zone;


it works perfectly.

Is it something known (5.1.0.5 was working as expected) ?


Re: T5: @Validate on RadioGroup

2011-04-13 Thread Adam Zimowski
Taha -

You are correct, I was wrong. I patched up RadioGroup by adding:

Binding defaultValidate()
{
return defaultProvider.defaultValidatorBinding("value", resources);
}

and now the @Validate annotation on my bean enum property is read in
correctly. So this is the bug in RadioGroup, which is missing the
above as you pointed out.

Adam

On Wed, Apr 13, 2011 at 7:25 AM, Taha Hafeez  wrote:
> Hi Adam
>
> Hi Adam
>
> On Wed, Apr 13, 2011 at 5:19 PM, Adam Zimowski  wrote:
>
>> Hi Taha,
>>
>> > You are still not getting the point...
>>
>> Why so direct, having a bad day? Please tell me how am I not getting
>> the point when I clearly wrote that:
>>
>>
> Sorry if it appeared rude, that was certainly not my intention (In
> my defense, English is not my first language). I think it should have been
> "you are missing the point" :)
>
>
>> 
>>
>> Works. The validate parameter is not null with the above, and the
>> Radio group works as expected, as shown in RadioGroup
>> processSubmission():
>>
>> if (validate != null)
>>  fieldValidationSupport.validate(rawValue, resources, validate);
>>
>>
>> I think you are missing the point. I realized that validate parameter
>> in RadioGroup is null when @Validate on the bean is present and so
>> validation does not get triggered.
>>
>> If this is a bug, which we both seem to agree, rather than stating the
>> obvious, I would be interested (due to lack of expertise in Tapestry)
>> where in the source does Tapestry read a @Validate annotation off a
>> bean field, and interprets it accordingly.
>>
>> That I mentioned in my last mail
>
>
>> The RadioGroup does not seem to be the problem, and the if statement
>> it contains to test nullability of the validate parameter is not the
>> issue, either.
>>
>>
> RadioGroup is the problem as it does not contain
>
> defaultValidate(){
>   return defaultProvider.defaultValidatorBinding("value", resources);
> }
>
> If it was there the defaultProvider(as I already mentioned in my previous
> mail) with indirectly take care of the case where validate @Parameter is
> null
>
>
>> Regards,
>> Adam
>>
>>
>>
> Sorry again
>
> regards
> Taha
>
>
> On Wed, Apr 13, 2011 at 6:30 AM, Taha Hafeez 
>> wrote:
>> > You are still not getting the point...
>> >
>> >
>> > 1. fieldValidationSupport,validate is the service responsible for
>> validating
>> > a field. It requries a FieldValidator which is passed as a parameter to
>> it.
>> > If this @Parameter validate is null, as is the case with RadioGroup,
>> > fieldValidationSupport is never called as the source shows
>> >
>> > if (validate != null)
>> >   fieldValidationSupport.validate(rawValue, resources, validate);
>> >
>> > 2. In other components like Select, if @Parameter validate is not
>> provided a
>> > default is chosen. The default is provided by ComponentDefaultProvider
>> which
>> > in turn calls FieldValidatorDefaultProvider which uses
>> FieldValidatorSource
>> > for creating default validators based on the field annotations and type.
>> >
>> > in case of Select we have default validate like this
>> >
>> > Binding defaultValidate()
>> >    {
>> >        return defaultProvider.defaultValidatorBinding("value",
>> resources);
>> >    }
>> >
>> > so if we don't provide a validate, the default is chosen
>> >
>> >
>> > Now in a RadioGroup as the code does not use a default in case @Parameter
>> > validate is not provided, the field annotations are not taken into
>> > consideration
>> >
>> > regards
>> > Taha
>> >
>> > On Wed, Apr 13, 2011 at 4:24 PM, Adam Zimowski 
>> wrote:
>> >
>> >> Hi Taha -
>> >>
>> >> I agree with you it seems to be a bug, and I (think) I get what you are
>> >> saying.
>> >>
>> >> However, I am having a hard time seeing why the bug would be in
>> >> RadioGroup processSubmission() or anywhere in the RadioGroup class for
>> >> that matter.
>> >>
>> >> Rather, it seems the bug (if exists) is deeper in the chain, where the
>> >> @Validate annotation is read off of a bean and applied to a
>> >> RadioGroup.
>> >>
>> >> I believe this because RadioGroup *does* behave correctly if TML
>> defines:
>> >>
>> >> 
>> >>
>> >> but now when the @Validate("required") is on the bean.
>> >>
>> >> Adam
>> >>
>> >>
>> >> On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez 
>> >> wrote:
>> >> > it is the @Parameter validate in RadioGroup that is required not
>> >> @Validate
>> >> > as that is never checked in case @Parameter validate is not given in a
>> >> > RadioGroup ... Please read my answer again :)
>> >> >
>> >> > It seems to be bug!!
>> >> >
>> >> > regards
>> >> > Taha
>> >> >
>> >> > On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski 
>> >> wrote:
>> >> >
>> >> >> Thanks Taha, but I did supply @Validate("required") annotation and
>> >> >> validation did not happen.
>> >> >>
>> >> >> Adam
>> >> >>
>> >> >> On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez <
>> tawus.tapes...@gmail.com>
>> >> >> wrote:
>> >> >> > Hi
>> >> >> >
>> >> >> > I compared the code from RadioGroup with that of Selec

Re: T5: Select wont find selected value in edit?

2011-04-13 Thread Thiago H. de Paula Figueiredo

On Wed, 13 Apr 2011 09:44:43 -0300, robnangle  wrote:


Ok and this method should be in the getKeepers()?


It should be in the class of the objects used as options.


What do i check if its equal to?


It varies depending on the class itself, what it means and how object  
identity is defined for it.



Apologies for what probably are stupid questions, I just hevnt yet
encountered them..


This is basic Java knowledge. Check this:  
http://www.ibm.com/developerworks/java/library/j-jtp05273/index.html


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, 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: Select wont find selected value in edit?

2011-04-13 Thread robnangle

Thiago H. de Paula Figueiredo wrote:
> 
> On Wed, 13 Apr 2011 09:33:04 -0300, robnangle <robnan...@gmail.com>
> wrote:
> 
>> There is no goalkeepers class, goalkeepers is just a list of players  
>> taken from the database:
>> public List getGoalkeepers() {
>>  gsp = new GenerateSelectPlayers(); // class that generates the 
>> players
>> from the db
>>  return gsp.getGoalkeepers();
>>  }
> 
> Again: to make Select (and any operation in Java collections) work, the  
> object type you're putting in the collection needs to have appropriate  
> equals() and hashCode() methods.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
> and instructor
> Owner, 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
> 

Ok and this method should be in the getKeepers()?

What do i check if its equal to? 

Apologies for what probably are stupid questions, I just hevnt yet
encountered them..


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300494.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: Select wont find selected value in edit?

2011-04-13 Thread Thiago H. de Paula Figueiredo

On Wed, 13 Apr 2011 09:33:04 -0300, robnangle  wrote:

There is no goalkeepers class, goalkeepers is just a list of players  
taken from the database:

public List getGoalkeepers() {
gsp = new GenerateSelectPlayers(); // class that generates the 
players
from the db
return gsp.getGoalkeepers();
}


Again: to make Select (and any operation in Java collections) work, the  
object type you're putting in the collection needs to have appropriate  
equals() and hashCode() methods.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, 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: Select wont find selected value in edit?

2011-04-13 Thread robnangle

Thiago H. de Paula Figueiredo wrote:
> 
> On Wed, 13 Apr 2011 08:30:42 -0300, robnangle <robnan...@gmail.com>
> wrote:
> 
>> t:select t:id="goalkeeper" model="goalkeepers" value="team.keeper"
>> blankOption="never"/
> 
> Make sure you overrode the equals() and hashCode() methods in the  
> Goalkeeper class with a correct implementation.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
> and instructor
> Owner, 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
> 

There is no goalkeepers class, goalkeepers is just a list of players taken
from the database:

public List getGoalkeepers() {
gsp = new GenerateSelectPlayers(); // class that generates the 
players
from the db
    return gsp.getGoalkeepers();
}


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300475.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: Select wont find selected value in edit?

2011-04-13 Thread Thiago H. de Paula Figueiredo

On Wed, 13 Apr 2011 08:30:42 -0300, robnangle  wrote:


t:select t:id="goalkeeper" model="goalkeepers" value="team.keeper"
blankOption="never"/


Make sure you overrode the equals() and hashCode() methods in the  
Goalkeeper class with a correct implementation.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, 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: @Validate on RadioGroup

2011-04-13 Thread Taha Hafeez
Hi Adam

Hi Adam

On Wed, Apr 13, 2011 at 5:19 PM, Adam Zimowski  wrote:

> Hi Taha,
>
> > You are still not getting the point...
>
> Why so direct, having a bad day? Please tell me how am I not getting
> the point when I clearly wrote that:
>
>
Sorry if it appeared rude, that was certainly not my intention (In
my defense, English is not my first language). I think it should have been
"you are missing the point" :)


> 
>
> Works. The validate parameter is not null with the above, and the
> Radio group works as expected, as shown in RadioGroup
> processSubmission():
>
> if (validate != null)
>  fieldValidationSupport.validate(rawValue, resources, validate);
>
>
> I think you are missing the point. I realized that validate parameter
> in RadioGroup is null when @Validate on the bean is present and so
> validation does not get triggered.
>
> If this is a bug, which we both seem to agree, rather than stating the
> obvious, I would be interested (due to lack of expertise in Tapestry)
> where in the source does Tapestry read a @Validate annotation off a
> bean field, and interprets it accordingly.
>
> That I mentioned in my last mail


> The RadioGroup does not seem to be the problem, and the if statement
> it contains to test nullability of the validate parameter is not the
> issue, either.
>
>
RadioGroup is the problem as it does not contain

defaultValidate(){
   return defaultProvider.defaultValidatorBinding("value", resources);
}

If it was there the defaultProvider(as I already mentioned in my previous
mail) with indirectly take care of the case where validate @Parameter is
null


> Regards,
> Adam
>
>
>
Sorry again

regards
Taha


On Wed, Apr 13, 2011 at 6:30 AM, Taha Hafeez 
> wrote:
> > You are still not getting the point...
> >
> >
> > 1. fieldValidationSupport,validate is the service responsible for
> validating
> > a field. It requries a FieldValidator which is passed as a parameter to
> it.
> > If this @Parameter validate is null, as is the case with RadioGroup,
> > fieldValidationSupport is never called as the source shows
> >
> > if (validate != null)
> >   fieldValidationSupport.validate(rawValue, resources, validate);
> >
> > 2. In other components like Select, if @Parameter validate is not
> provided a
> > default is chosen. The default is provided by ComponentDefaultProvider
> which
> > in turn calls FieldValidatorDefaultProvider which uses
> FieldValidatorSource
> > for creating default validators based on the field annotations and type.
> >
> > in case of Select we have default validate like this
> >
> > Binding defaultValidate()
> >{
> >return defaultProvider.defaultValidatorBinding("value",
> resources);
> >}
> >
> > so if we don't provide a validate, the default is chosen
> >
> >
> > Now in a RadioGroup as the code does not use a default in case @Parameter
> > validate is not provided, the field annotations are not taken into
> > consideration
> >
> > regards
> > Taha
> >
> > On Wed, Apr 13, 2011 at 4:24 PM, Adam Zimowski 
> wrote:
> >
> >> Hi Taha -
> >>
> >> I agree with you it seems to be a bug, and I (think) I get what you are
> >> saying.
> >>
> >> However, I am having a hard time seeing why the bug would be in
> >> RadioGroup processSubmission() or anywhere in the RadioGroup class for
> >> that matter.
> >>
> >> Rather, it seems the bug (if exists) is deeper in the chain, where the
> >> @Validate annotation is read off of a bean and applied to a
> >> RadioGroup.
> >>
> >> I believe this because RadioGroup *does* behave correctly if TML
> defines:
> >>
> >> 
> >>
> >> but now when the @Validate("required") is on the bean.
> >>
> >> Adam
> >>
> >>
> >> On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez 
> >> wrote:
> >> > it is the @Parameter validate in RadioGroup that is required not
> >> @Validate
> >> > as that is never checked in case @Parameter validate is not given in a
> >> > RadioGroup ... Please read my answer again :)
> >> >
> >> > It seems to be bug!!
> >> >
> >> > regards
> >> > Taha
> >> >
> >> > On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski 
> >> wrote:
> >> >
> >> >> Thanks Taha, but I did supply @Validate("required") annotation and
> >> >> validation did not happen.
> >> >>
> >> >> Adam
> >> >>
> >> >> On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez <
> tawus.tapes...@gmail.com>
> >> >> wrote:
> >> >> > Hi
> >> >> >
> >> >> > I compared the code from RadioGroup with that of Select and found
> the
> >> >> > following difference
> >> >> >
> >> >> > In Select if parameter 'validate' is not given a default is chosen
> and
> >> so
> >> >> it
> >> >> > is never null. Validation is performed
> >> >> > in processSubmission() method by the line
> >> >> >
> >> >> > fieldValidationSupport.validate(selectedValue, resources,
> validate);
> >> >> >
> >> >> >
> >> >> > In RadioGroup however, there is no defaultValidate(){} and so
> validate
> >> >> can
> >> >> > be null. Now the validation here is done by the line
> >> >> >
> >> >> > if (validate != null)
> >> >> >   fieldV

Re: T5: Select wont find selected value in edit?

2011-04-13 Thread robnangle

Richard Hill-7 wrote:
> 
> It depends. If you have a static list of players then you can store your
> select model in the session. If it's dynamic, you prob want to reload
> from the db each time.
> 
> To be honest I'm not sure that storing stuff like this as an SSO is
> best-practice - it's more for user session state. And you want to limit
> what you store in the session anyway as it contributes to your
> application's overhead - small objects, primitive data types, not huge
> lists of complex objects. These should come from the db.
> 
> Although a more experienced Tapestry dev can confirm.
> 

Yes thats what I thought. What is strange is that it works for editing user
details? But wont for editing the team. Thats why I thought it was to do
with the way im adding the team(keeper...). As i change the string value
when adding it to the database.

prep.setString(3, work(keeper)); // the work method changes the string to
say 'Steven Gerrard'
team.setKeeper(keeper); // this is the whole value 'Liverpool - Steven
Gerrard'

Does this changes things?


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300442.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: Select wont find selected value in edit?

2011-04-13 Thread Richard Hill

It depends. If you have a static list of players then you can store your
select model in the session. If it's dynamic, you prob want to reload
from the db each time.

To be honest I'm not sure that storing stuff like this as an SSO is
best-practice - it's more for user session state. And you want to limit
what you store in the session anyway as it contributes to your
application's overhead - small objects, primitive data types, not huge
lists of complex objects. These should come from the db.

Although a more experienced Tapestry dev can confirm.





On Wed, 2011-04-13 at 04:56 -0700, robnangle wrote:
> Richard Hill-7 wrote:
> > 
> > are "add" and "edit" page classes?
> > 
> > 
> 
> They are yes.. All values are @Persist, @Property
> 
> So is the only way to get the default value up by setting all players as
> sso's?
> 
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300407.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: T5: Select wont find selected value in edit?

2011-04-13 Thread robnangle

Richard Hill-7 wrote:
> 
> are "add" and "edit" page classes?
> 
> 

They are yes.. All values are @Persist, @Property

So is the only way to get the default value up by setting all players as
sso's?


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300407.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: @Property(create=true) ?

2011-04-13 Thread Christophe Cordenier
And what if we allowed to create defaultXxx method for persistent fields as
we do for component parameters, does it make sense ?

2011/4/12 Howard Lewis Ship 

> This wouldn't have to be an extension to the @Property annotation, it
> could be a new annotation, (say) @AutoCreate, perhaps with a value to
> say when (initialize, setup render, etc.).  It could use the same kind
> of logic that the BeanEditForm uses, one that supports the full
> injection mechanism.
>
> On Tue, Apr 12, 2011 at 10:25 AM, Adam Zimowski 
> wrote:
> > You have a point Thiago, I will try other init phases, I suppose just
> > a habit, and it worked :)
> >
> > In regards to your comment on page pool Now that Tap isn't using
> > it, would auto create property instance be an issue? Just curious..
> >
> > Adam
> >
> > On Tue, Apr 12, 2011 at 12:19 PM, Thiago H. de Paula Figueiredo
> >  wrote:
> >> On Tue, 12 Apr 2011 13:34:17 -0300, Adam Zimowski  >
> >> wrote:
> >>
> >>> Maybe I'm over-thinking here... I find a lot of times I have to do
> this:
> >>>
> >>> @Property
> >>> private AddressUiBean address;
> >>>
> >>> @SetupRender
> >>> void init() {
> >>>  if(address == null) address = new AddressUiBean();
> >>> }
> >>
> >> Why not activate instead of @SetupRender? Or one of the prepare* events
> of
> >> Form? Not an easy decision. ;)
> >>
> >> --
> >> Thiago H. de Paula Figueiredo
> >> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and
> >> instructor
> >> Owner, 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
> >>
> >>
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>
>
>
> --
> 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
>
>


-- 
Regards,
Christophe Cordenier.

Committer on Apache Tapestry 5
Co-creator of wooki @wookicentral.com


Re: T5: @Validate on RadioGroup

2011-04-13 Thread Adam Zimowski
Hi Taha,

> You are still not getting the point...

Why so direct, having a bad day? Please tell me how am I not getting
the point when I clearly wrote that:



Works. The validate parameter is not null with the above, and the
Radio group works as expected, as shown in RadioGroup
processSubmission():

if (validate != null)
  fieldValidationSupport.validate(rawValue, resources, validate);


I think you are missing the point. I realized that validate parameter
in RadioGroup is null when @Validate on the bean is present and so
validation does not get triggered.

If this is a bug, which we both seem to agree, rather than stating the
obvious, I would be interested (due to lack of expertise in Tapestry)
where in the source does Tapestry read a @Validate annotation off a
bean field, and interprets it accordingly.

The RadioGroup does not seem to be the problem, and the if statement
it contains to test nullability of the validate parameter is not the
issue, either.

Regards,
Adam


On Wed, Apr 13, 2011 at 6:30 AM, Taha Hafeez  wrote:
> You are still not getting the point...
>
>
> 1. fieldValidationSupport,validate is the service responsible for validating
> a field. It requries a FieldValidator which is passed as a parameter to it.
> If this @Parameter validate is null, as is the case with RadioGroup,
> fieldValidationSupport is never called as the source shows
>
> if (validate != null)
>   fieldValidationSupport.validate(rawValue, resources, validate);
>
> 2. In other components like Select, if @Parameter validate is not provided a
> default is chosen. The default is provided by ComponentDefaultProvider which
> in turn calls FieldValidatorDefaultProvider which uses FieldValidatorSource
> for creating default validators based on the field annotations and type.
>
> in case of Select we have default validate like this
>
> Binding defaultValidate()
>    {
>        return defaultProvider.defaultValidatorBinding("value", resources);
>    }
>
> so if we don't provide a validate, the default is chosen
>
>
> Now in a RadioGroup as the code does not use a default in case @Parameter
> validate is not provided, the field annotations are not taken into
> consideration
>
> regards
> Taha
>
> On Wed, Apr 13, 2011 at 4:24 PM, Adam Zimowski  wrote:
>
>> Hi Taha -
>>
>> I agree with you it seems to be a bug, and I (think) I get what you are
>> saying.
>>
>> However, I am having a hard time seeing why the bug would be in
>> RadioGroup processSubmission() or anywhere in the RadioGroup class for
>> that matter.
>>
>> Rather, it seems the bug (if exists) is deeper in the chain, where the
>> @Validate annotation is read off of a bean and applied to a
>> RadioGroup.
>>
>> I believe this because RadioGroup *does* behave correctly if TML defines:
>>
>> 
>>
>> but now when the @Validate("required") is on the bean.
>>
>> Adam
>>
>>
>> On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez 
>> wrote:
>> > it is the @Parameter validate in RadioGroup that is required not
>> @Validate
>> > as that is never checked in case @Parameter validate is not given in a
>> > RadioGroup ... Please read my answer again :)
>> >
>> > It seems to be bug!!
>> >
>> > regards
>> > Taha
>> >
>> > On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski 
>> wrote:
>> >
>> >> Thanks Taha, but I did supply @Validate("required") annotation and
>> >> validation did not happen.
>> >>
>> >> Adam
>> >>
>> >> On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez 
>> >> wrote:
>> >> > Hi
>> >> >
>> >> > I compared the code from RadioGroup with that of Select and found the
>> >> > following difference
>> >> >
>> >> > In Select if parameter 'validate' is not given a default is chosen and
>> so
>> >> it
>> >> > is never null. Validation is performed
>> >> > in processSubmission() method by the line
>> >> >
>> >> > fieldValidationSupport.validate(selectedValue, resources, validate);
>> >> >
>> >> >
>> >> > In RadioGroup however, there is no defaultValidate(){} and so validate
>> >> can
>> >> > be null. Now the validation here is done by the line
>> >> >
>> >> > if (validate != null)
>> >> >   fieldValidationSupport.validate(rawValue, resources, validate);
>> >> >
>> >> > so when the validate parameter is not supplied, validation does not
>> >> happen.
>> >> >
>> >> > regards
>> >> > Taha
>> >> >
>> >> >
>> >> > On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski 
>> >> wrote:
>> >> >
>> >> >> I have a bean where @Validate("required") does not work on a
>> >> >> radiogroup, but > >> >> @Validate annotated fields (TextField's) work. My companyType is
>> >> >> purposely set to null by default, as I do not want any radio
>> >> >> pre-selected, thus it shall be required.
>> >> >>
>> >> >> Is @Validate in the context I have defined supposed to work on the
>> >> >> radio group as well?
>> >> >>
>> >> >> /**
>> >> >>  * @author Adam Zimowski
>> >> >>  */
>> >> >> public class RegisterUiBean {
>> >> >>
>> >> >>        @Validate("required")
>> >> >>        private String email;
>> >> >>
>> >> >>        @Validate("require

Re: T5: Select wont find selected value in edit?

2011-04-13 Thread Richard Hill

are "add" and "edit" page classes?

If you instantiate an object in one page it won't be set in another,
unless you persist as an SSO

@Persist is only scoped to a particular page, i.e saves values between
requests. An @Persist'd object is not visible to other pages.




On Wed, 2011-04-13 at 04:41 -0700, robnangle wrote:
> Richard Hill-7 wrote:
> > 
> > the value attribute will set (choose) the drop down value from the
> > options defined in goalkeepers. Does this option/value exist in your
> > model?
> > 
> > 
> > 
> > 
> > On Wed, 2011-04-13 at 04:30 -0700, robnangle wrote:
> >> t:select t:id="goalkeeper" model="goalkeepers" value="team.keeper"
> >> blankOption="never"/
> >> 
> >> --
> >> View this message in context:
> >> http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300356.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
> > 
> 
> It does yes, its just a list of all the goalkeepers so there is no way that
> one is missng. It seems to be saying the keeper property is null in the edit
> class, but that shouldn't be as its beeing set when a user creates it in the
> add class?
> 
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300371.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: T5: Select wont find selected value in edit?

2011-04-13 Thread robnangle

Richard Hill-7 wrote:
> 
> the value attribute will set (choose) the drop down value from the
> options defined in goalkeepers. Does this option/value exist in your
> model?
> 
> 
> 
> 
> On Wed, 2011-04-13 at 04:30 -0700, robnangle wrote:
>> t:select t:id="goalkeeper" model="goalkeepers" value="team.keeper"
>> blankOption="never"/
>> 
>> --
>> View this message in context:
>> http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300356.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
> 

It does yes, its just a list of all the goalkeepers so there is no way that
one is missng. It seems to be saying the keeper property is null in the edit
class, but that shouldn't be as its beeing set when a user creates it in the
add class?


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300371.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: Select wont find selected value in edit?

2011-04-13 Thread Richard Hill

the value attribute will set (choose) the drop down value from the
options defined in goalkeepers. Does this option/value exist in your
model?




On Wed, 2011-04-13 at 04:30 -0700, robnangle wrote:
> t:select t:id="goalkeeper" model="goalkeepers" value="team.keeper"
> blankOption="never"/
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300356.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: T5: Select wont find selected value in edit?

2011-04-13 Thread robnangle
t:select t:id="goalkeeper" model="goalkeepers" value="team.keeper"
blankOption="never"/

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300356.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: @Validate on RadioGroup

2011-04-13 Thread Taha Hafeez
You are still not getting the point...


1. fieldValidationSupport,validate is the service responsible for validating
a field. It requries a FieldValidator which is passed as a parameter to it.
If this @Parameter validate is null, as is the case with RadioGroup,
fieldValidationSupport is never called as the source shows

if (validate != null)
   fieldValidationSupport.validate(rawValue, resources, validate);

2. In other components like Select, if @Parameter validate is not provided a
default is chosen. The default is provided by ComponentDefaultProvider which
in turn calls FieldValidatorDefaultProvider which uses FieldValidatorSource
for creating default validators based on the field annotations and type.

in case of Select we have default validate like this

Binding defaultValidate()
{
return defaultProvider.defaultValidatorBinding("value", resources);
}

so if we don't provide a validate, the default is chosen


Now in a RadioGroup as the code does not use a default in case @Parameter
validate is not provided, the field annotations are not taken into
consideration

regards
Taha

On Wed, Apr 13, 2011 at 4:24 PM, Adam Zimowski  wrote:

> Hi Taha -
>
> I agree with you it seems to be a bug, and I (think) I get what you are
> saying.
>
> However, I am having a hard time seeing why the bug would be in
> RadioGroup processSubmission() or anywhere in the RadioGroup class for
> that matter.
>
> Rather, it seems the bug (if exists) is deeper in the chain, where the
> @Validate annotation is read off of a bean and applied to a
> RadioGroup.
>
> I believe this because RadioGroup *does* behave correctly if TML defines:
>
> 
>
> but now when the @Validate("required") is on the bean.
>
> Adam
>
>
> On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez 
> wrote:
> > it is the @Parameter validate in RadioGroup that is required not
> @Validate
> > as that is never checked in case @Parameter validate is not given in a
> > RadioGroup ... Please read my answer again :)
> >
> > It seems to be bug!!
> >
> > regards
> > Taha
> >
> > On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski 
> wrote:
> >
> >> Thanks Taha, but I did supply @Validate("required") annotation and
> >> validation did not happen.
> >>
> >> Adam
> >>
> >> On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez 
> >> wrote:
> >> > Hi
> >> >
> >> > I compared the code from RadioGroup with that of Select and found the
> >> > following difference
> >> >
> >> > In Select if parameter 'validate' is not given a default is chosen and
> so
> >> it
> >> > is never null. Validation is performed
> >> > in processSubmission() method by the line
> >> >
> >> > fieldValidationSupport.validate(selectedValue, resources, validate);
> >> >
> >> >
> >> > In RadioGroup however, there is no defaultValidate(){} and so validate
> >> can
> >> > be null. Now the validation here is done by the line
> >> >
> >> > if (validate != null)
> >> >   fieldValidationSupport.validate(rawValue, resources, validate);
> >> >
> >> > so when the validate parameter is not supplied, validation does not
> >> happen.
> >> >
> >> > regards
> >> > Taha
> >> >
> >> >
> >> > On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski 
> >> wrote:
> >> >
> >> >> I have a bean where @Validate("required") does not work on a
> >> >> radiogroup, but  >> >> @Validate annotated fields (TextField's) work. My companyType is
> >> >> purposely set to null by default, as I do not want any radio
> >> >> pre-selected, thus it shall be required.
> >> >>
> >> >> Is @Validate in the context I have defined supposed to work on the
> >> >> radio group as well?
> >> >>
> >> >> /**
> >> >>  * @author Adam Zimowski
> >> >>  */
> >> >> public class RegisterUiBean {
> >> >>
> >> >>@Validate("required")
> >> >>private String email;
> >> >>
> >> >>@Validate("required")
> >> >>private String emailRetype;
> >> >>
> >> >>@Validate("required")
> >> >>private String password;
> >> >>
> >> >>@Validate("required")
> >> >>private String passwordRetype;
> >> >>
> >> >>@Validate("required")
> >> >>private CompanyType companyType;
> >> >>
> >> >>
> >> >>public RegisterUiBean() {
> >> >>}
> >> >>
> >> >>public String getEmail() {
> >> >>return email;
> >> >>}
> >> >>
> >> >>
> >> >>public void setEmail(String aEmail) {
> >> >>email = aEmail;
> >> >>}
> >> >>
> >> >>
> >> >>public String getEmailRetype() {
> >> >>return emailRetype;
> >> >>}
> >> >>
> >> >>
> >> >>public void setEmailRetype(String aEmailRetype) {
> >> >>emailRetype = aEmailRetype;
> >> >>}
> >> >>
> >> >>
> >> >>public String getPassword() {
> >> >>return password;
> >> >>}
> >> >>
> >> >>
> >> >>public void setPassword(String aPassword) {
> >> >>password = aPassword;
> >> >>}
> >> >>
> >> >>
> >> >>public Stri

Re: T5: Select wont find selected value in edit?

2011-04-13 Thread Richard Hill
no .tml here



On Wed, 2011-04-13 at 03:41 -0700, robnangle wrote:
> Hi I have a problem when I am trying to edit values that the selected value
> does not appear? My code is below and I thought you just put into
> value="team.keeper" which would return the keeper. The two classes both have
> @Property+@Persist annotations.
> 
> tml for edit class:
> 
> 
> 
> insert for creating the values Work method is a regex which replaces part of
> the string value:
> 
> String statement = "INSERT INTO teams(goalkeeper) VALUES(?)";
>   prep = conn.prepareStatement(statement);
>   team = new Team();
>   prep.setString(1, work(keeper));
>   team.setKeeper(keeper);
>  prep.executeUpdate();
>   return index;
> 
> Any help is greatly appreciated as always..
> Cheers
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300292.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: T5: @Validate on RadioGroup

2011-04-13 Thread Adam Zimowski
Hi Taha -

I agree with you it seems to be a bug, and I (think) I get what you are saying.

However, I am having a hard time seeing why the bug would be in
RadioGroup processSubmission() or anywhere in the RadioGroup class for
that matter.

Rather, it seems the bug (if exists) is deeper in the chain, where the
@Validate annotation is read off of a bean and applied to a
RadioGroup.

I believe this because RadioGroup *does* behave correctly if TML defines:



but now when the @Validate("required") is on the bean.

Adam


On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez  wrote:
> it is the @Parameter validate in RadioGroup that is required not @Validate
> as that is never checked in case @Parameter validate is not given in a
> RadioGroup ... Please read my answer again :)
>
> It seems to be bug!!
>
> regards
> Taha
>
> On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski  wrote:
>
>> Thanks Taha, but I did supply @Validate("required") annotation and
>> validation did not happen.
>>
>> Adam
>>
>> On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez 
>> wrote:
>> > Hi
>> >
>> > I compared the code from RadioGroup with that of Select and found the
>> > following difference
>> >
>> > In Select if parameter 'validate' is not given a default is chosen and so
>> it
>> > is never null. Validation is performed
>> > in processSubmission() method by the line
>> >
>> > fieldValidationSupport.validate(selectedValue, resources, validate);
>> >
>> >
>> > In RadioGroup however, there is no defaultValidate(){} and so validate
>> can
>> > be null. Now the validation here is done by the line
>> >
>> > if (validate != null)
>> >   fieldValidationSupport.validate(rawValue, resources, validate);
>> >
>> > so when the validate parameter is not supplied, validation does not
>> happen.
>> >
>> > regards
>> > Taha
>> >
>> >
>> > On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski 
>> wrote:
>> >
>> >> I have a bean where @Validate("required") does not work on a
>> >> radiogroup, but > >> @Validate annotated fields (TextField's) work. My companyType is
>> >> purposely set to null by default, as I do not want any radio
>> >> pre-selected, thus it shall be required.
>> >>
>> >> Is @Validate in the context I have defined supposed to work on the
>> >> radio group as well?
>> >>
>> >> /**
>> >>  * @author Adam Zimowski
>> >>  */
>> >> public class RegisterUiBean {
>> >>
>> >>        @Validate("required")
>> >>        private String email;
>> >>
>> >>        @Validate("required")
>> >>        private String emailRetype;
>> >>
>> >>        @Validate("required")
>> >>        private String password;
>> >>
>> >>        @Validate("required")
>> >>        private String passwordRetype;
>> >>
>> >>        @Validate("required")
>> >>        private CompanyType companyType;
>> >>
>> >>
>> >>        public RegisterUiBean() {
>> >>        }
>> >>
>> >>        public String getEmail() {
>> >>                return email;
>> >>        }
>> >>
>> >>
>> >>        public void setEmail(String aEmail) {
>> >>                email = aEmail;
>> >>        }
>> >>
>> >>
>> >>        public String getEmailRetype() {
>> >>                return emailRetype;
>> >>        }
>> >>
>> >>
>> >>        public void setEmailRetype(String aEmailRetype) {
>> >>                emailRetype = aEmailRetype;
>> >>        }
>> >>
>> >>
>> >>        public String getPassword() {
>> >>                return password;
>> >>        }
>> >>
>> >>
>> >>        public void setPassword(String aPassword) {
>> >>                password = aPassword;
>> >>        }
>> >>
>> >>
>> >>        public String getPasswordRetype() {
>> >>                return passwordRetype;
>> >>        }
>> >>
>> >>
>> >>        public void setPasswordRetype(String aPasswordRetype) {
>> >>                passwordRetype = aPasswordRetype;
>> >>        }
>> >>
>> >>
>> >>        public CompanyType getCompanyType() {
>> >>                return companyType;
>> >>        }
>> >>
>> >>
>> >>        public void setCompanyType(CompanyType aCompanyType) {
>> >>                companyType = aCompanyType;
>> >>        }
>> >>
>> >>        public CompanyType getCorporation() {
>> >>                return CompanyType.Corporation;
>> >>        }
>> >>
>> >>        public CompanyType getFederalGov() {
>> >>                return CompanyType.FederalGovernment;
>> >>        }
>> >>
>> >>        public CompanyType getStateGov() {
>> >>                return CompanyType.StateGovernment;
>> >>        }
>> >>
>> >>        public CompanyType getIndividual() {
>> >>                return CompanyType.Individual;
>> >>        }
>> >> }
>> >>
>> >>  Registration Information
>> >>  
>> >>   :
>> >>  > >> value="registration.email"/>
>> >>  
>> >>  
>> >>  
>> >>   :
>> >>  > >> value="registration.emailRetype"/>
>> >>  
>> >>  
>> >>  
>> >>   :
>> >>  > >> value="registration.password"/>
>> >>  
>> >>  
>> >>  
>> >>   :
>> >>  > >> value="registration.passwordRetype"/>
>> >>  
>> >>  
>> >>  
>> >>   :
>> >>  
>> >>  > >> validate="required">
>> >>        
>

T5: Select wont find selected value in edit?

2011-04-13 Thread robnangle
Hi I have a problem when I am trying to edit values that the selected value
does not appear? My code is below and I thought you just put into
value="team.keeper" which would return the keeper. The two classes both have
@Property+@Persist annotations.

tml for edit class:



insert for creating the values Work method is a regex which replaces part of
the string value:

String statement = "INSERT INTO teams(goalkeeper) VALUES(?)";
prep = conn.prepareStatement(statement);
team = new Team();
prep.setString(1, work(keeper));
team.setKeeper(keeper);
 prep.executeUpdate();
return index;

Any help is greatly appreciated as always..
Cheers

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300292.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: @Validate on RadioGroup

2011-04-13 Thread Taha Hafeez
it is the @Parameter validate in RadioGroup that is required not @Validate
as that is never checked in case @Parameter validate is not given in a
RadioGroup ... Please read my answer again :)

It seems to be bug!!

regards
Taha

On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski  wrote:

> Thanks Taha, but I did supply @Validate("required") annotation and
> validation did not happen.
>
> Adam
>
> On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez 
> wrote:
> > Hi
> >
> > I compared the code from RadioGroup with that of Select and found the
> > following difference
> >
> > In Select if parameter 'validate' is not given a default is chosen and so
> it
> > is never null. Validation is performed
> > in processSubmission() method by the line
> >
> > fieldValidationSupport.validate(selectedValue, resources, validate);
> >
> >
> > In RadioGroup however, there is no defaultValidate(){} and so validate
> can
> > be null. Now the validation here is done by the line
> >
> > if (validate != null)
> >   fieldValidationSupport.validate(rawValue, resources, validate);
> >
> > so when the validate parameter is not supplied, validation does not
> happen.
> >
> > regards
> > Taha
> >
> >
> > On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski 
> wrote:
> >
> >> I have a bean where @Validate("required") does not work on a
> >> radiogroup, but  >> @Validate annotated fields (TextField's) work. My companyType is
> >> purposely set to null by default, as I do not want any radio
> >> pre-selected, thus it shall be required.
> >>
> >> Is @Validate in the context I have defined supposed to work on the
> >> radio group as well?
> >>
> >> /**
> >>  * @author Adam Zimowski
> >>  */
> >> public class RegisterUiBean {
> >>
> >>@Validate("required")
> >>private String email;
> >>
> >>@Validate("required")
> >>private String emailRetype;
> >>
> >>@Validate("required")
> >>private String password;
> >>
> >>@Validate("required")
> >>private String passwordRetype;
> >>
> >>@Validate("required")
> >>private CompanyType companyType;
> >>
> >>
> >>public RegisterUiBean() {
> >>}
> >>
> >>public String getEmail() {
> >>return email;
> >>}
> >>
> >>
> >>public void setEmail(String aEmail) {
> >>email = aEmail;
> >>}
> >>
> >>
> >>public String getEmailRetype() {
> >>return emailRetype;
> >>}
> >>
> >>
> >>public void setEmailRetype(String aEmailRetype) {
> >>emailRetype = aEmailRetype;
> >>}
> >>
> >>
> >>public String getPassword() {
> >>return password;
> >>}
> >>
> >>
> >>public void setPassword(String aPassword) {
> >>password = aPassword;
> >>}
> >>
> >>
> >>public String getPasswordRetype() {
> >>return passwordRetype;
> >>}
> >>
> >>
> >>public void setPasswordRetype(String aPasswordRetype) {
> >>passwordRetype = aPasswordRetype;
> >>}
> >>
> >>
> >>public CompanyType getCompanyType() {
> >>return companyType;
> >>}
> >>
> >>
> >>public void setCompanyType(CompanyType aCompanyType) {
> >>companyType = aCompanyType;
> >>}
> >>
> >>public CompanyType getCorporation() {
> >>return CompanyType.Corporation;
> >>}
> >>
> >>public CompanyType getFederalGov() {
> >>return CompanyType.FederalGovernment;
> >>}
> >>
> >>public CompanyType getStateGov() {
> >>return CompanyType.StateGovernment;
> >>}
> >>
> >>public CompanyType getIndividual() {
> >>return CompanyType.Individual;
> >>}
> >> }
> >>
> >>  Registration Information
> >>  
> >>   :
> >>   >> value="registration.email"/>
> >>  
> >>  
> >>  
> >>   :
> >>   >> value="registration.emailRetype"/>
> >>  
> >>  
> >>  
> >>   :
> >>   >> value="registration.password"/>
> >>  
> >>  
> >>  
> >>   :
> >>   >> value="registration.passwordRetype"/>
> >>  
> >>  
> >>  
> >>   :
> >>  
> >>   >> validate="required">
> >>
> >>
> >> value="registration.federalGov"/>
> >>
> >>
> >>
> >>
> >>
> >>  
> >>  
> >>
> >> Adam
> >>
> >> -
> >> 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: T5: @Validate on RadioGroup

2011-04-13 Thread Adam Zimowski
Thanks Taha, but I did supply @Validate("required") annotation and
validation did not happen.

Adam

On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez  wrote:
> Hi
>
> I compared the code from RadioGroup with that of Select and found the
> following difference
>
> In Select if parameter 'validate' is not given a default is chosen and so it
> is never null. Validation is performed
> in processSubmission() method by the line
>
> fieldValidationSupport.validate(selectedValue, resources, validate);
>
>
> In RadioGroup however, there is no defaultValidate(){} and so validate can
> be null. Now the validation here is done by the line
>
> if (validate != null)
>   fieldValidationSupport.validate(rawValue, resources, validate);
>
> so when the validate parameter is not supplied, validation does not happen.
>
> regards
> Taha
>
>
> On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski  wrote:
>
>> I have a bean where @Validate("required") does not work on a
>> radiogroup, but > @Validate annotated fields (TextField's) work. My companyType is
>> purposely set to null by default, as I do not want any radio
>> pre-selected, thus it shall be required.
>>
>> Is @Validate in the context I have defined supposed to work on the
>> radio group as well?
>>
>> /**
>>  * @author Adam Zimowski
>>  */
>> public class RegisterUiBean {
>>
>>        @Validate("required")
>>        private String email;
>>
>>        @Validate("required")
>>        private String emailRetype;
>>
>>        @Validate("required")
>>        private String password;
>>
>>        @Validate("required")
>>        private String passwordRetype;
>>
>>        @Validate("required")
>>        private CompanyType companyType;
>>
>>
>>        public RegisterUiBean() {
>>        }
>>
>>        public String getEmail() {
>>                return email;
>>        }
>>
>>
>>        public void setEmail(String aEmail) {
>>                email = aEmail;
>>        }
>>
>>
>>        public String getEmailRetype() {
>>                return emailRetype;
>>        }
>>
>>
>>        public void setEmailRetype(String aEmailRetype) {
>>                emailRetype = aEmailRetype;
>>        }
>>
>>
>>        public String getPassword() {
>>                return password;
>>        }
>>
>>
>>        public void setPassword(String aPassword) {
>>                password = aPassword;
>>        }
>>
>>
>>        public String getPasswordRetype() {
>>                return passwordRetype;
>>        }
>>
>>
>>        public void setPasswordRetype(String aPasswordRetype) {
>>                passwordRetype = aPasswordRetype;
>>        }
>>
>>
>>        public CompanyType getCompanyType() {
>>                return companyType;
>>        }
>>
>>
>>        public void setCompanyType(CompanyType aCompanyType) {
>>                companyType = aCompanyType;
>>        }
>>
>>        public CompanyType getCorporation() {
>>                return CompanyType.Corporation;
>>        }
>>
>>        public CompanyType getFederalGov() {
>>                return CompanyType.FederalGovernment;
>>        }
>>
>>        public CompanyType getStateGov() {
>>                return CompanyType.StateGovernment;
>>        }
>>
>>        public CompanyType getIndividual() {
>>                return CompanyType.Individual;
>>        }
>> }
>>
>>  Registration Information
>>  
>>   :
>>  > value="registration.email"/>
>>  
>>  
>>  
>>   :
>>  > value="registration.emailRetype"/>
>>  
>>  
>>  
>>   :
>>  > value="registration.password"/>
>>  
>>  
>>  
>>   :
>>  > value="registration.passwordRetype"/>
>>  
>>  
>>  
>>   :
>>  
>>  > validate="required">
>>        
>>        
>>        
>>        
>>        
>>        
>>        
>>        
>>  
>>  
>>
>> Adam
>>
>> -
>> 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: T5: @Validate on RadioGroup

2011-04-12 Thread Taha Hafeez
Hi

I compared the code from RadioGroup with that of Select and found the
following difference

In Select if parameter 'validate' is not given a default is chosen and so it
is never null. Validation is performed
in processSubmission() method by the line

fieldValidationSupport.validate(selectedValue, resources, validate);


In RadioGroup however, there is no defaultValidate(){} and so validate can
be null. Now the validation here is done by the line

if (validate != null)
   fieldValidationSupport.validate(rawValue, resources, validate);

so when the validate parameter is not supplied, validation does not happen.

regards
Taha


On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski  wrote:

> I have a bean where @Validate("required") does not work on a
> radiogroup, but  @Validate annotated fields (TextField's) work. My companyType is
> purposely set to null by default, as I do not want any radio
> pre-selected, thus it shall be required.
>
> Is @Validate in the context I have defined supposed to work on the
> radio group as well?
>
> /**
>  * @author Adam Zimowski
>  */
> public class RegisterUiBean {
>
>@Validate("required")
>private String email;
>
>@Validate("required")
>private String emailRetype;
>
>@Validate("required")
>private String password;
>
>@Validate("required")
>private String passwordRetype;
>
>@Validate("required")
>private CompanyType companyType;
>
>
>public RegisterUiBean() {
>}
>
>public String getEmail() {
>return email;
>}
>
>
>public void setEmail(String aEmail) {
>email = aEmail;
>}
>
>
>public String getEmailRetype() {
>return emailRetype;
>}
>
>
>public void setEmailRetype(String aEmailRetype) {
>emailRetype = aEmailRetype;
>}
>
>
>public String getPassword() {
>return password;
>}
>
>
>public void setPassword(String aPassword) {
>password = aPassword;
>}
>
>
>public String getPasswordRetype() {
>return passwordRetype;
>}
>
>
>public void setPasswordRetype(String aPasswordRetype) {
>passwordRetype = aPasswordRetype;
>}
>
>
>public CompanyType getCompanyType() {
>return companyType;
>}
>
>
>public void setCompanyType(CompanyType aCompanyType) {
>companyType = aCompanyType;
>}
>
>public CompanyType getCorporation() {
>return CompanyType.Corporation;
>}
>
>public CompanyType getFederalGov() {
>return CompanyType.FederalGovernment;
>}
>
>public CompanyType getStateGov() {
>return CompanyType.StateGovernment;
>}
>
>public CompanyType getIndividual() {
>return CompanyType.Individual;
>}
> }
>
>  Registration Information
>  
>   :
>   value="registration.email"/>
>  
>  
>  
>   :
>   value="registration.emailRetype"/>
>  
>  
>  
>   :
>   value="registration.password"/>
>  
>  
>  
>   :
>   value="registration.passwordRetype"/>
>  
>  
>  
>   :
>  
>   validate="required">
>
>
>
>
>
>
>
>
>  
>  
>
> Adam
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


T5: @Validate on RadioGroup

2011-04-12 Thread Adam Zimowski
I have a bean where @Validate("required") does not work on a
radiogroup, but Registration Information
 
  :
 
 
 
 
  :
 
 
 
 
  :
 
 
 
 
  :
 
 
 
 
  :
 
  








  
 

Adam

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



Re: T5: @Property(create=true) ?

2011-04-12 Thread Howard Lewis Ship
This wouldn't have to be an extension to the @Property annotation, it
could be a new annotation, (say) @AutoCreate, perhaps with a value to
say when (initialize, setup render, etc.).  It could use the same kind
of logic that the BeanEditForm uses, one that supports the full
injection mechanism.

On Tue, Apr 12, 2011 at 10:25 AM, Adam Zimowski  wrote:
> You have a point Thiago, I will try other init phases, I suppose just
> a habit, and it worked :)
>
> In regards to your comment on page pool Now that Tap isn't using
> it, would auto create property instance be an issue? Just curious..
>
> Adam
>
> On Tue, Apr 12, 2011 at 12:19 PM, Thiago H. de Paula Figueiredo
>  wrote:
>> On Tue, 12 Apr 2011 13:34:17 -0300, Adam Zimowski 
>> wrote:
>>
>>> Maybe I'm over-thinking here... I find a lot of times I have to do this:
>>>
>>> @Property
>>> private AddressUiBean address;
>>>
>>> @SetupRender
>>> void init() {
>>>  if(address == null) address = new AddressUiBean();
>>> }
>>
>> Why not activate instead of @SetupRender? Or one of the prepare* events of
>> Form? Not an easy decision. ;)
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
>> instructor
>> Owner, 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
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
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: T5: @Property(create=true) ?

2011-04-12 Thread Thiago H. de Paula Figueiredo
On Tue, 12 Apr 2011 14:25:31 -0300, Adam Zimowski   
wrote:



You have a point Thiago, I will try other init phases, I suppose just
a habit, and it worked :)


It works, but which event to use is a very scenario-specific decision. :)


In regards to your comment on page pool Now that Tap isn't using
it, would auto create property instance be an issue? Just curious..


I don't think so. The generated getter would need to be changed.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, 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: @Property(create=true) ?

2011-04-12 Thread Adam Zimowski
You have a point Thiago, I will try other init phases, I suppose just
a habit, and it worked :)

In regards to your comment on page pool Now that Tap isn't using
it, would auto create property instance be an issue? Just curious..

Adam

On Tue, Apr 12, 2011 at 12:19 PM, Thiago H. de Paula Figueiredo
 wrote:
> On Tue, 12 Apr 2011 13:34:17 -0300, Adam Zimowski 
> wrote:
>
>> Maybe I'm over-thinking here... I find a lot of times I have to do this:
>>
>> @Property
>> private AddressUiBean address;
>>
>> @SetupRender
>> void init() {
>>  if(address == null) address = new AddressUiBean();
>> }
>
> Why not activate instead of @SetupRender? Or one of the prepare* events of
> Form? Not an easy decision. ;)
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, 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
>
>

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



Re: T5: @Property(create=true) ?

2011-04-12 Thread Thiago H. de Paula Figueiredo
On Tue, 12 Apr 2011 13:34:17 -0300, Adam Zimowski   
wrote:



Maybe I'm over-thinking here... I find a lot of times I have to do this:

@Property
private AddressUiBean address;

@SetupRender
void init() {
 if(address == null) address = new AddressUiBean();
}


Why not activate instead of @SetupRender? Or one of the prepare* events of  
Form? Not an easy decision. ;)


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, 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: @Property(create=true) ?

2011-04-12 Thread Thiago H. de Paula Figueiredo
On Tue, 12 Apr 2011 13:52:10 -0300, Christophe Cordenier  
 wrote:



My response is not directly related to your question, by the way... in
previous version of T5 it was possible to initiliaze the value of  
persistent variables at declaration time. And this value was considered  
as the default value. This feature was the cause of session conflicts,  
more precisely, i

think it was javassist that was the root cause,


Javassist wasn't the root cause. It was a problem with the page pool, more  
specifically, the field having its value reset to the initial value. When  
it wasn't an atomic value, one user could see data from other user.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, 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: @Property(create=true) ?

2011-04-12 Thread Christophe Cordenier
My response is not directly related to your question, by the way... in
previous version of T5 it was possible to initiliaze the value of persistent
variables at declaration time. And this value was considered as the default
value. This feature was the cause of session conflicts, more precisely, i
think it was javassist that was the root cause, thus the ability to
initialize variable at declaration time has been forbidden.

Maybe plastic will change the deal, but i currently haven't had the time to
look into this promising project.

Christophe.

2011/4/12 Adam Zimowski 

> Maybe I'm over-thinking here... I find a lot of times I have to do this:
>
> @Property
> private AddressUiBean address;
>
> @SetupRender
> void init() {
>  if(address == null) address = new AddressUiBean();
> }
>
> What would be super nice, following the spirit of @SessionState, is this:
>
> @Property(create=true)
> private AddressUiBean address;
>
> I realize that @Property could be a non-bean in which case there is no
> guarantee for a no-arg constructor, perhaps that's why this isn't
> there, but maybe documentation could explicitly require it?
>
> Maybe I'm off base here...
>
> Adam
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Regards,
Christophe Cordenier.

Committer on Apache Tapestry 5
Co-creator of wooki @wookicentral.com


T5: @Property(create=true) ?

2011-04-12 Thread Adam Zimowski
Maybe I'm over-thinking here... I find a lot of times I have to do this:

@Property
private AddressUiBean address;

@SetupRender
void init() {
 if(address == null) address = new AddressUiBean();
}

What would be super nice, following the spirit of @SessionState, is this:

@Property(create=true)
private AddressUiBean address;

I realize that @Property could be a non-bean in which case there is no
guarantee for a no-arg constructor, perhaps that's why this isn't
there, but maybe documentation could explicitly require it?

Maybe I'm off base here...

Adam

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



Re: T5: BeanEditForm, BeanEditor and

2011-04-09 Thread Taha Hafeez
May be I am wrong but when I needed fields without labels in BeanEditor,
this is what I did

I extended PropertyEditBlocks as

public class PropertyEditBlocksWithoutLabel extends PropertyEditBlocks {
}

and the provided my own template

http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>












and it worked for me. So if I would have added t:errors for individual
fields that would have worked too right ? Isn't this what
Adam needs for now ??

regards
Taha

On Sat, Apr 9, 2011 at 10:10 PM, Howard Lewis Ship  wrote:

> What Adam was getting at is not direclty overridable via block
> parameters; in the BeanEditor and BeanEditForm, the block parameters
> allow you to override the editors for specific properties, but not the
> surrounding content, including the Errors component (in BeanEditForm).
>
> On Sat, Apr 9, 2011 at 8:42 AM, Taha Hafeez 
> wrote:
> > Hi
> >
> > You can provide you own contributions to BeanBlockSource and override the
> > default ones till new release. All you have to
> > do is override the class and use you own template.
> >
> > Checkout http://tapestry.apache.org/beaneditform-guide.html
> >
> > regards
> > taha
> >
> > On Sat, Apr 9, 2011 at 8:57 PM, Adam Zimowski 
> wrote:
> >
> >> Should I then keep my pages backed by BeanEditor and BeanEditForm and
> >> wait for 5.3/5.4 or is this something not on the 2011 horizon?
> >>
> >> Adam
> >>
> >> On Fri, Apr 8, 2011 at 7:28 PM, Howard Lewis Ship 
> >> wrote:
> >> > As we move away from the error bubbles, I think you'll see that errors
> >> > will naturally attach to the fields, and  will just display
> >> > errors not associated with a specific field.
> >> >
> >> > On Fri, Apr 8, 2011 at 5:01 PM, Adam Zimowski 
> >> wrote:
> >> >> By default BeanEditForm includes .
> >> >>
> >> >> BeanEditor seems to expect that t:errors is placed outside if
> >> >> programmer wants it.
> >> >>
> >> >> Intuitively, I would expect a feature for both to support inline
> errors:
> >> >>
> >> >> 
> >> >> 
> >> >>
> >> >> with  rendered next to a field and some CSS class to
> override.
> >> >>
> >> >> That would be nice.
> >> >>
> >> >> -
> >> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > 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
> >> >
> >> >
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>
> >>
> >
>
>
>
> --
> 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: T5: BeanEditForm, BeanEditor and

2011-04-09 Thread Howard Lewis Ship
Sheduling questions are hard ... it's simply a matter of prioritizing
the work and finding a way to do it, and maintain my income stream.
Same goes for the other devs, I'm sure.

On Sat, Apr 9, 2011 at 8:27 AM, Adam Zimowski  wrote:
> Should I then keep my pages backed by BeanEditor and BeanEditForm and
> wait for 5.3/5.4 or is this something not on the 2011 horizon?
>
> Adam
>
> On Fri, Apr 8, 2011 at 7:28 PM, Howard Lewis Ship  wrote:
>> As we move away from the error bubbles, I think you'll see that errors
>> will naturally attach to the fields, and  will just display
>> errors not associated with a specific field.
>>
>> On Fri, Apr 8, 2011 at 5:01 PM, Adam Zimowski  wrote:
>>> By default BeanEditForm includes .
>>>
>>> BeanEditor seems to expect that t:errors is placed outside if
>>> programmer wants it.
>>>
>>> Intuitively, I would expect a feature for both to support inline errors:
>>>
>>> 
>>> 
>>>
>>> with  rendered next to a field and some CSS class to override.
>>>
>>> That would be nice.
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> 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
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
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: T5: BeanEditForm, BeanEditor and

2011-04-09 Thread Howard Lewis Ship
What Adam was getting at is not direclty overridable via block
parameters; in the BeanEditor and BeanEditForm, the block parameters
allow you to override the editors for specific properties, but not the
surrounding content, including the Errors component (in BeanEditForm).

On Sat, Apr 9, 2011 at 8:42 AM, Taha Hafeez  wrote:
> Hi
>
> You can provide you own contributions to BeanBlockSource and override the
> default ones till new release. All you have to
> do is override the class and use you own template.
>
> Checkout http://tapestry.apache.org/beaneditform-guide.html
>
> regards
> taha
>
> On Sat, Apr 9, 2011 at 8:57 PM, Adam Zimowski  wrote:
>
>> Should I then keep my pages backed by BeanEditor and BeanEditForm and
>> wait for 5.3/5.4 or is this something not on the 2011 horizon?
>>
>> Adam
>>
>> On Fri, Apr 8, 2011 at 7:28 PM, Howard Lewis Ship 
>> wrote:
>> > As we move away from the error bubbles, I think you'll see that errors
>> > will naturally attach to the fields, and  will just display
>> > errors not associated with a specific field.
>> >
>> > On Fri, Apr 8, 2011 at 5:01 PM, Adam Zimowski 
>> wrote:
>> >> By default BeanEditForm includes .
>> >>
>> >> BeanEditor seems to expect that t:errors is placed outside if
>> >> programmer wants it.
>> >>
>> >> Intuitively, I would expect a feature for both to support inline errors:
>> >>
>> >> 
>> >> 
>> >>
>> >> with  rendered next to a field and some CSS class to override.
>> >>
>> >> That would be nice.
>> >>
>> >> -
>> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> >> For additional commands, e-mail: users-h...@tapestry.apache.org
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > 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
>> >
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>



-- 
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: T5: BeanEditForm, BeanEditor and

2011-04-09 Thread Taha Hafeez
Hi

You can provide you own contributions to BeanBlockSource and override the
default ones till new release. All you have to
do is override the class and use you own template.

Checkout http://tapestry.apache.org/beaneditform-guide.html

regards
taha

On Sat, Apr 9, 2011 at 8:57 PM, Adam Zimowski  wrote:

> Should I then keep my pages backed by BeanEditor and BeanEditForm and
> wait for 5.3/5.4 or is this something not on the 2011 horizon?
>
> Adam
>
> On Fri, Apr 8, 2011 at 7:28 PM, Howard Lewis Ship 
> wrote:
> > As we move away from the error bubbles, I think you'll see that errors
> > will naturally attach to the fields, and  will just display
> > errors not associated with a specific field.
> >
> > On Fri, Apr 8, 2011 at 5:01 PM, Adam Zimowski 
> wrote:
> >> By default BeanEditForm includes .
> >>
> >> BeanEditor seems to expect that t:errors is placed outside if
> >> programmer wants it.
> >>
> >> Intuitively, I would expect a feature for both to support inline errors:
> >>
> >> 
> >> 
> >>
> >> with  rendered next to a field and some CSS class to override.
> >>
> >> That would be nice.
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>
> >>
> >
> >
> >
> > --
> > 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
> >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: T5: BeanEditForm, BeanEditor and

2011-04-09 Thread Adam Zimowski
Should I then keep my pages backed by BeanEditor and BeanEditForm and
wait for 5.3/5.4 or is this something not on the 2011 horizon?

Adam

On Fri, Apr 8, 2011 at 7:28 PM, Howard Lewis Ship  wrote:
> As we move away from the error bubbles, I think you'll see that errors
> will naturally attach to the fields, and  will just display
> errors not associated with a specific field.
>
> On Fri, Apr 8, 2011 at 5:01 PM, Adam Zimowski  wrote:
>> By default BeanEditForm includes .
>>
>> BeanEditor seems to expect that t:errors is placed outside if
>> programmer wants it.
>>
>> Intuitively, I would expect a feature for both to support inline errors:
>>
>> 
>> 
>>
>> with  rendered next to a field and some CSS class to override.
>>
>> That would be nice.
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
>
> --
> 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
>
>

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



Re: Setting contenttype of T5 form

2011-04-09 Thread Taha Hafeez

If you can use an ajax file uploader then you can modify this to meet your
needs

http://tapestry.1045711.n5.nabble.com/Tapestry-FileUploader-Integration-td4268987.html

regards
Taha

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Setting-contenttype-of-T5-form-tp4270175p4292978.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: BeanEditForm, BeanEditor and

2011-04-08 Thread Howard Lewis Ship
As we move away from the error bubbles, I think you'll see that errors
will naturally attach to the fields, and  will just display
errors not associated with a specific field.

On Fri, Apr 8, 2011 at 5:01 PM, Adam Zimowski  wrote:
> By default BeanEditForm includes .
>
> BeanEditor seems to expect that t:errors is placed outside if
> programmer wants it.
>
> Intuitively, I would expect a feature for both to support inline errors:
>
> 
> 
>
> with  rendered next to a field and some CSS class to override.
>
> That would be nice.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
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



T5: BeanEditForm, BeanEditor and

2011-04-08 Thread Adam Zimowski
By default BeanEditForm includes .

BeanEditor seems to expect that t:errors is placed outside if
programmer wants it.

Intuitively, I would expect a feature for both to support inline errors:




with  rendered next to a field and some CSS class to override.

That would be nice.

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



Re: Setting contenttype of T5 form

2011-04-08 Thread Josh Canfield
You should really take Howard's advice and look at how the upload
component works. You can't just change the content type of the form
because this changes how servlets behave. Try googling for "servlet
multipart/form-data" and find that since the beginning of time people
have been writing libraries to work around the gap in the java
servlet's handling of multipart/form-data...

Essentially getParameter stops working and tapestry can't find it's
hidden form fields. You could grab the source for the upload component
and change the offending bits...

Josh

On Fri, Apr 8, 2011 at 3:52 PM, Fernando Benjamin
 wrote:
> Hi again,
>
> I am still working on the same form!
> I have managed to get my javascript initialized and uploaded to the client!
> Everything works great until I get in the onActivate method.
>
> Then I get an exception, which I can't figure out the problem, I have also
> explicit changed the Form.method to Post!
>
> TapestryModule.RequestExceptionHandler Processing of request failed with
> uncaught exception: Forms require that the request method be POST and that
> the t:formdata query parameter have values.
>
> org.apache.tapestry5.ioc.internal.OperationException: Forms require that the
> request method be POST and that the t:formdata query parameter have values.
> [at classpath:nl/test/web/pages/personal/AddProduct.tml, line 6]
>
>
>
> THIS IS MY PAGE WITH FORM
> #
>
> 
> title="${message:title}"
>
>      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";
>
>      xmlns:p="tapestry:parameter">
>
>    Post a new product:
>
>     
>
>        
>
>        
>
>        
>
>        
>
>
>        
>
>         />
>
>
>
>    
>
> 
>
>
>
> THIS IS MY JAVA PAGE
> #
>
> @Import(library = { "context:javascript/swfupload.js",
> "context:javascript/test.js", "context:javascript/addproduct.js" })
>
> @PluginPageMenu(className = Personal.class, label = "Post a new product")
>
> public class AddProduct {
>
>
>
>  @Inject
>
> private Logger logger;
>
>  @Property
>
> private Product product;
>
>  @Component(id = "upload")
>
> private Form _form;
>
>  /* UPLOAD SERVICE*/
>
> @Inject
>
> private MyFileUploadService uploadService;
>
> /*    ** START JAVASCRIPT  ** */
>
> @Inject
>
> private JavaScriptSupport javaScriptSupport;
>
> /* END JAVASCRIPT */
>
>
>
>
>
> public void afterRender(final MarkupWriter writer) {
>
>  javaScriptSupport.addInitializerCall("upload","");
>
>  }
>
>
>  public void onSuccess() {
>
>  logger.debug("# SUCCES ##");
>
> }
>
>
>  public void onActivate() {
>
>
>  logger.debug("# On Activate  ##");
>
> }
>
>
>
>
> }
>
>
>
> This is my javascript
>
>   Tapestry.Initializer.upload = function(element)
>
> {
>
> document.forms['upload'].enctype = "multipart/form-data";
>
> document.forms['upload'].method = "POST";
>
> }
>
>
>
> I hope someone can help me with this error!
>
> Cheers,
>
> Fernando
>
>
> On 31 March 2011 00:15, Fernando Benjamin wrote:
>
>> Haaa, I overlooked the other option, I'll try with javascript!
>>
>> Thank you!
>>
>>
>> On 31 March 2011 00:14, Fernando Benjamin wrote:
>>
>>> Hi Howard,
>>>
>>> The Upload component requires a UploadFile as a value!
>>> I want to use here a plain html input file and not one of tapestry
>>> components!
>>> If I replace
>>> 
>>> WITH
>>>
>>> 
>>> It does change the contenttype of the form as I wanted, but this means I
>>> have to use UploadedFile, because its value is required in Upload?
>>>
>>> I would like to use tapestry's form and just change the contenttype!
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 30 March 2011 00:04, Howard Lewis Ship  wrote:
>>>
 Look at the Upload component source; you'll see how it does it.

 On Tue, Mar 29, 2011 at 2:07 PM, Fernando Benjamin
  wrote:
 > Hi everybody,
 >
 >
 > I am trying to upload a file to GAE by using a tapestry form, but I
 can't
 > use tapestry 5 Upload component because it depends on a class writing
 to the
 > filesystem!
 > I need to set the contenttype of the form to "multipart/form-data" so I
 can
 > retrieve the file on the servlet(filter).
 >
 > This is my example which does not work!
 >
 >  
 >
 >        
 >
 >        
 >
 >        
 >
 >        
 >
 >
 >        
 >
 >        >>> t:value="message:button-label"
 > />
 >
 >
 >
 >    
 >
 >
 > Is there any other form to change the content type of the  form here
 above?
 >
 > Otherwise I'll have to use normal html form wich does not support:
 errors,
 > beaneditor en etc...
 >
 >
 > Cheers,
 >
 > Fernando
 >



 --
 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 fa

Re: Setting contenttype of T5 form

2011-04-08 Thread Fernando Benjamin
Hi again,

I am still working on the same form!
I have managed to get my javascript initialized and uploaded to the client!
Everything works great until I get in the onActivate method.

Then I get an exception, which I can't figure out the problem, I have also
explicit changed the Form.method to Post!

TapestryModule.RequestExceptionHandler Processing of request failed with
uncaught exception: Forms require that the request method be POST and that
the t:formdata query parameter have values.

org.apache.tapestry5.ioc.internal.OperationException: Forms require that the
request method be POST and that the t:formdata query parameter have values.
[at classpath:nl/test/web/pages/personal/AddProduct.tml, line 6]



THIS IS MY PAGE WITH FORM
#

http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";

  xmlns:p="tapestry:parameter">

Post a new product:

 






















THIS IS MY JAVA PAGE
#

@Import(library = { "context:javascript/swfupload.js",
"context:javascript/test.js", "context:javascript/addproduct.js" })

@PluginPageMenu(className = Personal.class, label = "Post a new product")

public class AddProduct {



 @Inject

private Logger logger;

 @Property

private Product product;

 @Component(id = "upload")

private Form _form;

  /* UPLOAD SERVICE*/

@Inject

private MyFileUploadService uploadService;

/*** START JAVASCRIPT  ** */

@Inject

private JavaScriptSupport javaScriptSupport;

/* END JAVASCRIPT */





public void afterRender(final MarkupWriter writer) {

 javaScriptSupport.addInitializerCall("upload","");

  }


 public void onSuccess() {

 logger.debug("# SUCCES ##");

}


 public void onActivate() {


 logger.debug("# On Activate  ##");

}




}



This is my javascript

   Tapestry.Initializer.upload = function(element)

{

document.forms['upload'].enctype = "multipart/form-data";

document.forms['upload'].method = "POST";

}



I hope someone can help me with this error!

Cheers,

Fernando


On 31 March 2011 00:15, Fernando Benjamin wrote:

> Haaa, I overlooked the other option, I'll try with javascript!
>
> Thank you!
>
>
> On 31 March 2011 00:14, Fernando Benjamin wrote:
>
>> Hi Howard,
>>
>> The Upload component requires a UploadFile as a value!
>> I want to use here a plain html input file and not one of tapestry
>> components!
>> If I replace
>> 
>> WITH
>>
>> 
>> It does change the contenttype of the form as I wanted, but this means I
>> have to use UploadedFile, because its value is required in Upload?
>>
>> I would like to use tapestry's form and just change the contenttype!
>>
>>
>>
>>
>>
>>
>>
>>
>> On 30 March 2011 00:04, Howard Lewis Ship  wrote:
>>
>>> Look at the Upload component source; you'll see how it does it.
>>>
>>> On Tue, Mar 29, 2011 at 2:07 PM, Fernando Benjamin
>>>  wrote:
>>> > Hi everybody,
>>> >
>>> >
>>> > I am trying to upload a file to GAE by using a tapestry form, but I
>>> can't
>>> > use tapestry 5 Upload component because it depends on a class writing
>>> to the
>>> > filesystem!
>>> > I need to set the contenttype of the form to "multipart/form-data" so I
>>> can
>>> > retrieve the file on the servlet(filter).
>>> >
>>> > This is my example which does not work!
>>> >
>>> >  
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >>> t:value="message:button-label"
>>> > />
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > Is there any other form to change the content type of the  form here
>>> above?
>>> >
>>> > Otherwise I'll have to use normal html form wich does not support:
>>> errors,
>>> > beaneditor en etc...
>>> >
>>> >
>>> > Cheers,
>>> >
>>> > Fernando
>>> >
>>>
>>>
>>>
>>> --
>>> 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
>>>
>>>
>>
>


T5: required built-in validator not invoked

2011-04-08 Thread Adam Zimowski
Hi,

I have a form with a required textfield companyName, and a form
fragment which is displayed if one of the radio buttons on the form is
clicked. When form fragment is hidden, companyName is validated by
Tapestry if not provided (required validation), but when form fragment
is visible, Tapestry does not perform required companyName validation,
and if not provided, companyName comes over with null value.

My client side validation is completely disabled.

My expectation is that Tapestry should always validate required field,
if it is not part of a form fragment. Is my expectation wrong?

Here is the TML:


New User
: 



:


   
   



 

: 

 

${message:or}
: 

 





Adam

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



Re: T5: built-in numeric validator

2011-03-31 Thread Adam Zimowski
> I'm wondering what lead you to believe it would be automatically

Because if I define a TextField bound to numeric property without any
validation of my own whatsoever, Tapestry will validate non-numeric
input for me.

Adam

On Thu, Mar 31, 2011 at 1:24 PM, Chris Norris
 wrote:
> Now I'm all curious. After looking through
> FieldValidatorDefaultSource, FieldValidatorSource and the
> ValidationContstraintGenerator implementations, I'm not sure how a
> numeric field would automatically be validated as such. The Regexp
> validator is only reference in TapestryModule, which allows you to
> explicitly use it, but you're talking about something automatic.
>
> I'm wondering what lead you to believe it would be automatically
> generated in the first place? Though Howard's suggestion that it isn't
> working right seems to imply that it should be doing that...
>
> On Thu, Mar 31, 2011 at 11:04 AM, Adam Zimowski  wrote:
>> :) I don't think I'm in position to teach Tapestry to others, I'm
>> still learning myself But, using Eclipse I looked at class
>> hierarchy for:
>>
>> org.apache.tapestry5.AbstractValidator
>>
>> and see that Tapestry provides only the following out of the box:
>>
>> Email, Max, MaxLength, Min, MinLength, None, Regexp and Required
>>
>> So, just by guessing, I'd venture to say that Tapestry uses Regexp
>> validator to test if numeric field contains indeed a numeric value.
>> I'd also suspect that if there is a bug, it's probably in the regular
>> expression passed to Regexp validator on numeric field test, not the
>> validator itself.
>>
>> Again, I'm still learning myself, so somebody that actually knows for
>> sure would have to confirm, but that's be my guess.
>>
>> Adam
>>
>> On Thu, Mar 31, 2011 at 10:59 AM, Chris Norris
>>  wrote:
>>> Well perhaps you can teach me a few things. I'm trying to figure out
>>> by what mechanism tapestry would be validating this. We generally
>>> specify our custom NumericValidator on numeric fields. Is there some
>>> sort of automatic validation that can occur? I don't see much mention
>>> of it on this page: http://tapestry.apache.org/input-validation.html
>>>
>>> On Thu, Mar 31, 2011 at 10:54 AM, Adam Zimowski  
>>> wrote:
>>>> No problem. Howard mentioned this may be a Tapestry bug. I'm in no
>>>> immediate rush as my project isn't going live until next year, so
>>>> hopefully by then it gets fixed.
>>>>
>>>> Adam
>>>>
>>>> On Thu, Mar 31, 2011 at 10:51 AM, Chris Norris
>>>>  wrote:
>>>>> Sorry, I was completely wrong. I was looking at a NumericValidator
>>>>> that we wrote, not a Tapestry one.
>>>>>
>>>>> On Thu, Mar 31, 2011 at 9:43 AM, Adam Zimowski  
>>>>> wrote:
>>>>>> My client side validation is disabled. This happens on my shopping
>>>>>> cart page where I have multiple forms (inside a loop) with indexed
>>>>>> trackers ( Map. You can find complete code
>>>>>> for the ShoppingCart page which exhibits this behavior in another
>>>>>> thread which I posted recently:
>>>>>>
>>>>>> "T5: form validation with pre-existing errors"
>>>>>>
>>>>>> The actual numeric field which exhibits this is defined in the template 
>>>>>> as:
>>>>>>
>>>>>> >>>>> label="prop:quantityLabel" validate="required" size="2"/>
>>>>>>
>>>>>>
>>>>>>       @Component(parameters = {"tracker=tracker"})
>>>>>>       private Form cartForm;
>>>>>>
>>>>>>       @Persist(PersistenceConstants.FLASH)
>>>>>>       private Map indexedTrackers;
>>>>>>
>>>>>> public ValidationTracker getTracker() {
>>>>>>               if(indexedTrackers == null) return new 
>>>>>> ValidationTrackerImpl();
>>>>>>               return indexedTrackers.get(index);
>>>>>>       }
>>>>>>
>>>>>>       public void setTracker(ValidationTracker aTracker) {
>>>>>>
>>>>>>               if(indexedTrackers == null) {
>>>>>>                       if(log.isTraceEnabled())

Re: T5: built-in numeric validator

2011-03-31 Thread Chris Norris
Now I'm all curious. After looking through
FieldValidatorDefaultSource, FieldValidatorSource and the
ValidationContstraintGenerator implementations, I'm not sure how a
numeric field would automatically be validated as such. The Regexp
validator is only reference in TapestryModule, which allows you to
explicitly use it, but you're talking about something automatic.

I'm wondering what lead you to believe it would be automatically
generated in the first place? Though Howard's suggestion that it isn't
working right seems to imply that it should be doing that...

On Thu, Mar 31, 2011 at 11:04 AM, Adam Zimowski  wrote:
> :) I don't think I'm in position to teach Tapestry to others, I'm
> still learning myself But, using Eclipse I looked at class
> hierarchy for:
>
> org.apache.tapestry5.AbstractValidator
>
> and see that Tapestry provides only the following out of the box:
>
> Email, Max, MaxLength, Min, MinLength, None, Regexp and Required
>
> So, just by guessing, I'd venture to say that Tapestry uses Regexp
> validator to test if numeric field contains indeed a numeric value.
> I'd also suspect that if there is a bug, it's probably in the regular
> expression passed to Regexp validator on numeric field test, not the
> validator itself.
>
> Again, I'm still learning myself, so somebody that actually knows for
> sure would have to confirm, but that's be my guess.
>
> Adam
>
> On Thu, Mar 31, 2011 at 10:59 AM, Chris Norris
>  wrote:
>> Well perhaps you can teach me a few things. I'm trying to figure out
>> by what mechanism tapestry would be validating this. We generally
>> specify our custom NumericValidator on numeric fields. Is there some
>> sort of automatic validation that can occur? I don't see much mention
>> of it on this page: http://tapestry.apache.org/input-validation.html
>>
>> On Thu, Mar 31, 2011 at 10:54 AM, Adam Zimowski  wrote:
>>> No problem. Howard mentioned this may be a Tapestry bug. I'm in no
>>> immediate rush as my project isn't going live until next year, so
>>> hopefully by then it gets fixed.
>>>
>>> Adam
>>>
>>> On Thu, Mar 31, 2011 at 10:51 AM, Chris Norris
>>>  wrote:
>>>> Sorry, I was completely wrong. I was looking at a NumericValidator
>>>> that we wrote, not a Tapestry one.
>>>>
>>>> On Thu, Mar 31, 2011 at 9:43 AM, Adam Zimowski  
>>>> wrote:
>>>>> My client side validation is disabled. This happens on my shopping
>>>>> cart page where I have multiple forms (inside a loop) with indexed
>>>>> trackers ( Map. You can find complete code
>>>>> for the ShoppingCart page which exhibits this behavior in another
>>>>> thread which I posted recently:
>>>>>
>>>>> "T5: form validation with pre-existing errors"
>>>>>
>>>>> The actual numeric field which exhibits this is defined in the template 
>>>>> as:
>>>>>
>>>>> >>>> label="prop:quantityLabel" validate="required" size="2"/>
>>>>>
>>>>>
>>>>>       @Component(parameters = {"tracker=tracker"})
>>>>>       private Form cartForm;
>>>>>
>>>>>       @Persist(PersistenceConstants.FLASH)
>>>>>       private Map indexedTrackers;
>>>>>
>>>>> public ValidationTracker getTracker() {
>>>>>               if(indexedTrackers == null) return new 
>>>>> ValidationTrackerImpl();
>>>>>               return indexedTrackers.get(index);
>>>>>       }
>>>>>
>>>>>       public void setTracker(ValidationTracker aTracker) {
>>>>>
>>>>>               if(indexedTrackers == null) {
>>>>>                       if(log.isTraceEnabled()) log.trace("crating
>>>>> indexed trackers map");
>>>>>                       indexedTrackers = new HashMap>>>> ValidationTracker>();
>>>>>               }
>>>>>
>>>>>               if(log.isTraceEnabled()) {
>>>>>                       log.trace("setting tracker for index: " + index);
>>>>>               }
>>>>>
>>>>>               indexedTrackers.put(index, aTracker);
>>>>>       }
>>>>>
>>>>> In addition, this field carries a mixin:
>>>>>
>>>>> @Component

Re: T5: built-in numeric validator

2011-03-31 Thread Adam Zimowski
:) I don't think I'm in position to teach Tapestry to others, I'm
still learning myself But, using Eclipse I looked at class
hierarchy for:

org.apache.tapestry5.AbstractValidator

and see that Tapestry provides only the following out of the box:

Email, Max, MaxLength, Min, MinLength, None, Regexp and Required

So, just by guessing, I'd venture to say that Tapestry uses Regexp
validator to test if numeric field contains indeed a numeric value.
I'd also suspect that if there is a bug, it's probably in the regular
expression passed to Regexp validator on numeric field test, not the
validator itself.

Again, I'm still learning myself, so somebody that actually knows for
sure would have to confirm, but that's be my guess.

Adam

On Thu, Mar 31, 2011 at 10:59 AM, Chris Norris
 wrote:
> Well perhaps you can teach me a few things. I'm trying to figure out
> by what mechanism tapestry would be validating this. We generally
> specify our custom NumericValidator on numeric fields. Is there some
> sort of automatic validation that can occur? I don't see much mention
> of it on this page: http://tapestry.apache.org/input-validation.html
>
> On Thu, Mar 31, 2011 at 10:54 AM, Adam Zimowski  wrote:
>> No problem. Howard mentioned this may be a Tapestry bug. I'm in no
>> immediate rush as my project isn't going live until next year, so
>> hopefully by then it gets fixed.
>>
>> Adam
>>
>> On Thu, Mar 31, 2011 at 10:51 AM, Chris Norris
>>  wrote:
>>> Sorry, I was completely wrong. I was looking at a NumericValidator
>>> that we wrote, not a Tapestry one.
>>>
>>> On Thu, Mar 31, 2011 at 9:43 AM, Adam Zimowski  wrote:
>>>> My client side validation is disabled. This happens on my shopping
>>>> cart page where I have multiple forms (inside a loop) with indexed
>>>> trackers ( Map. You can find complete code
>>>> for the ShoppingCart page which exhibits this behavior in another
>>>> thread which I posted recently:
>>>>
>>>> "T5: form validation with pre-existing errors"
>>>>
>>>> The actual numeric field which exhibits this is defined in the template as:
>>>>
>>>> >>> label="prop:quantityLabel" validate="required" size="2"/>
>>>>
>>>>
>>>>       @Component(parameters = {"tracker=tracker"})
>>>>       private Form cartForm;
>>>>
>>>>       @Persist(PersistenceConstants.FLASH)
>>>>       private Map indexedTrackers;
>>>>
>>>> public ValidationTracker getTracker() {
>>>>               if(indexedTrackers == null) return new 
>>>> ValidationTrackerImpl();
>>>>               return indexedTrackers.get(index);
>>>>       }
>>>>
>>>>       public void setTracker(ValidationTracker aTracker) {
>>>>
>>>>               if(indexedTrackers == null) {
>>>>                       if(log.isTraceEnabled()) log.trace("crating
>>>> indexed trackers map");
>>>>                       indexedTrackers = new HashMap>>> ValidationTracker>();
>>>>               }
>>>>
>>>>               if(log.isTraceEnabled()) {
>>>>                       log.trace("setting tracker for index: " + index);
>>>>               }
>>>>
>>>>               indexedTrackers.put(index, aTracker);
>>>>       }
>>>>
>>>> In addition, this field carries a mixin:
>>>>
>>>> @Component(id=ID_QUANTITY_FIELD, parameters 
>>>> ={"AttachError.message=fieldError"})
>>>> @MixinClasses(value=AttachError.class)
>>>> private TextField quantityField;
>>>>
>>>> @MixinAfter
>>>> public class AttachError {
>>>>
>>>>        @Parameter(required = true, allowNull = true)
>>>>        private String message;
>>>>
>>>>        @Environmental
>>>>        private ValidationTracker tracker;
>>>>
>>>>        @InjectContainer
>>>>        private Field field;
>>>>
>>>>
>>>>        void setupRender() {
>>>>                if (message != null) {
>>>>                        tracker.recordError(field, message);
>>>>                }
>>>>        }
>>>> }
>>>>
>>>>  public String getFieldError() {
>>>>               String error = nul

Re: T5: built-in numeric validator

2011-03-31 Thread Chris Norris
Well perhaps you can teach me a few things. I'm trying to figure out
by what mechanism tapestry would be validating this. We generally
specify our custom NumericValidator on numeric fields. Is there some
sort of automatic validation that can occur? I don't see much mention
of it on this page: http://tapestry.apache.org/input-validation.html

On Thu, Mar 31, 2011 at 10:54 AM, Adam Zimowski  wrote:
> No problem. Howard mentioned this may be a Tapestry bug. I'm in no
> immediate rush as my project isn't going live until next year, so
> hopefully by then it gets fixed.
>
> Adam
>
> On Thu, Mar 31, 2011 at 10:51 AM, Chris Norris
>  wrote:
>> Sorry, I was completely wrong. I was looking at a NumericValidator
>> that we wrote, not a Tapestry one.
>>
>> On Thu, Mar 31, 2011 at 9:43 AM, Adam Zimowski  wrote:
>>> My client side validation is disabled. This happens on my shopping
>>> cart page where I have multiple forms (inside a loop) with indexed
>>> trackers ( Map. You can find complete code
>>> for the ShoppingCart page which exhibits this behavior in another
>>> thread which I posted recently:
>>>
>>> "T5: form validation with pre-existing errors"
>>>
>>> The actual numeric field which exhibits this is defined in the template as:
>>>
>>> >> label="prop:quantityLabel" validate="required" size="2"/>
>>>
>>>
>>>       @Component(parameters = {"tracker=tracker"})
>>>       private Form cartForm;
>>>
>>>       @Persist(PersistenceConstants.FLASH)
>>>       private Map indexedTrackers;
>>>
>>> public ValidationTracker getTracker() {
>>>               if(indexedTrackers == null) return new 
>>> ValidationTrackerImpl();
>>>               return indexedTrackers.get(index);
>>>       }
>>>
>>>       public void setTracker(ValidationTracker aTracker) {
>>>
>>>               if(indexedTrackers == null) {
>>>                       if(log.isTraceEnabled()) log.trace("crating
>>> indexed trackers map");
>>>                       indexedTrackers = new HashMap>> ValidationTracker>();
>>>               }
>>>
>>>               if(log.isTraceEnabled()) {
>>>                       log.trace("setting tracker for index: " + index);
>>>               }
>>>
>>>               indexedTrackers.put(index, aTracker);
>>>       }
>>>
>>> In addition, this field carries a mixin:
>>>
>>> @Component(id=ID_QUANTITY_FIELD, parameters 
>>> ={"AttachError.message=fieldError"})
>>> @MixinClasses(value=AttachError.class)
>>> private TextField quantityField;
>>>
>>> @MixinAfter
>>> public class AttachError {
>>>
>>>        @Parameter(required = true, allowNull = true)
>>>        private String message;
>>>
>>>        @Environmental
>>>        private ValidationTracker tracker;
>>>
>>>        @InjectContainer
>>>        private Field field;
>>>
>>>
>>>        void setupRender() {
>>>                if (message != null) {
>>>                        tracker.recordError(field, message);
>>>                }
>>>        }
>>> }
>>>
>>>  public String getFieldError() {
>>>               String error = null;
>>>               ValidationTracker tracker = getTracker();
>>>               if(tracker != null && tracker.getError(quantityField) != 
>>> null) {
>>>                       return null;
>>>               }
>>>               CartItemBean cib = 
>>> findCartItem(cartDisplayItem.getLineNumber());
>>>
>>>    // look up error in CartItemBean and if found return it, or return null;
>>>
>>>   return error;
>>> }
>>>
>>> Let me know, perhaps I am doing something wrong..
>>>
>>> Adam
>>>
>>> On Thu, Mar 31, 2011 at 9:03 AM, Chris Norris
>>>  wrote:
>>>> The Tapestry NumericValidator seems to rely on whether
>>>> Double.valueOf(String) will throw an exception, which it does for
>>>> '1k'.
>>>>
>>>> How are you configuring and using your validator?
>>>>
>>>> On Tue, Mar 29, 2011 at 5:19 PM, Adam Zimowski  
>>>> wrote:
>>>>> It is server side. Looks like if input starts with a digit, Tapestr

Re: T5: built-in numeric validator

2011-03-31 Thread Adam Zimowski
No problem. Howard mentioned this may be a Tapestry bug. I'm in no
immediate rush as my project isn't going live until next year, so
hopefully by then it gets fixed.

Adam

On Thu, Mar 31, 2011 at 10:51 AM, Chris Norris
 wrote:
> Sorry, I was completely wrong. I was looking at a NumericValidator
> that we wrote, not a Tapestry one.
>
> On Thu, Mar 31, 2011 at 9:43 AM, Adam Zimowski  wrote:
>> My client side validation is disabled. This happens on my shopping
>> cart page where I have multiple forms (inside a loop) with indexed
>> trackers ( Map. You can find complete code
>> for the ShoppingCart page which exhibits this behavior in another
>> thread which I posted recently:
>>
>> "T5: form validation with pre-existing errors"
>>
>> The actual numeric field which exhibits this is defined in the template as:
>>
>> > label="prop:quantityLabel" validate="required" size="2"/>
>>
>>
>>       @Component(parameters = {"tracker=tracker"})
>>       private Form cartForm;
>>
>>       @Persist(PersistenceConstants.FLASH)
>>       private Map indexedTrackers;
>>
>> public ValidationTracker getTracker() {
>>               if(indexedTrackers == null) return new ValidationTrackerImpl();
>>               return indexedTrackers.get(index);
>>       }
>>
>>       public void setTracker(ValidationTracker aTracker) {
>>
>>               if(indexedTrackers == null) {
>>                       if(log.isTraceEnabled()) log.trace("crating
>> indexed trackers map");
>>                       indexedTrackers = new HashMap> ValidationTracker>();
>>               }
>>
>>               if(log.isTraceEnabled()) {
>>                       log.trace("setting tracker for index: " + index);
>>               }
>>
>>               indexedTrackers.put(index, aTracker);
>>       }
>>
>> In addition, this field carries a mixin:
>>
>> @Component(id=ID_QUANTITY_FIELD, parameters 
>> ={"AttachError.message=fieldError"})
>> @MixinClasses(value=AttachError.class)
>> private TextField quantityField;
>>
>> @MixinAfter
>> public class AttachError {
>>
>>        @Parameter(required = true, allowNull = true)
>>        private String message;
>>
>>        @Environmental
>>        private ValidationTracker tracker;
>>
>>        @InjectContainer
>>        private Field field;
>>
>>
>>        void setupRender() {
>>                if (message != null) {
>>                        tracker.recordError(field, message);
>>                }
>>        }
>> }
>>
>>  public String getFieldError() {
>>               String error = null;
>>               ValidationTracker tracker = getTracker();
>>               if(tracker != null && tracker.getError(quantityField) != null) 
>> {
>>                       return null;
>>               }
>>               CartItemBean cib = 
>> findCartItem(cartDisplayItem.getLineNumber());
>>
>>    // look up error in CartItemBean and if found return it, or return null;
>>
>>   return error;
>> }
>>
>> Let me know, perhaps I am doing something wrong..
>>
>> Adam
>>
>> On Thu, Mar 31, 2011 at 9:03 AM, Chris Norris
>>  wrote:
>>> The Tapestry NumericValidator seems to rely on whether
>>> Double.valueOf(String) will throw an exception, which it does for
>>> '1k'.
>>>
>>> How are you configuring and using your validator?
>>>
>>> On Tue, Mar 29, 2011 at 5:19 PM, Adam Zimowski  wrote:
>>>> It is server side. Looks like if input starts with a digit, Tapestry is 
>>>> happy :)
>>>>
>>>> Adam
>>>>
>>>> On Tue, Mar 29, 2011 at 5:05 PM, Howard Lewis Ship  
>>>> wrote:
>>>>> Seems like a bug to me!  Surprising, though. Is this server-side or
>>>>> client-side validation?
>>>>>
>>>>> On Tue, Mar 29, 2011 at 2:49 PM, Adam Zimowski  
>>>>> wrote:
>>>>>> For numeric fields, Tapestry validates correctly non-numeric input.
>>>>>> However, input such as:
>>>>>>
>>>>>> 1k
>>>>>> 1\
>>>>>> etc..
>>>>>>
>>>>>> passes the validation.
>>>>>>
>>>>>> Am I missing something?
>>>>>>
>>>>>

Re: T5: built-in numeric validator

2011-03-31 Thread Chris Norris
Sorry, I was completely wrong. I was looking at a NumericValidator
that we wrote, not a Tapestry one.

On Thu, Mar 31, 2011 at 9:43 AM, Adam Zimowski  wrote:
> My client side validation is disabled. This happens on my shopping
> cart page where I have multiple forms (inside a loop) with indexed
> trackers ( Map. You can find complete code
> for the ShoppingCart page which exhibits this behavior in another
> thread which I posted recently:
>
> "T5: form validation with pre-existing errors"
>
> The actual numeric field which exhibits this is defined in the template as:
>
>  label="prop:quantityLabel" validate="required" size="2"/>
>
>
>       @Component(parameters = {"tracker=tracker"})
>       private Form cartForm;
>
>       @Persist(PersistenceConstants.FLASH)
>       private Map indexedTrackers;
>
> public ValidationTracker getTracker() {
>               if(indexedTrackers == null) return new ValidationTrackerImpl();
>               return indexedTrackers.get(index);
>       }
>
>       public void setTracker(ValidationTracker aTracker) {
>
>               if(indexedTrackers == null) {
>                       if(log.isTraceEnabled()) log.trace("crating
> indexed trackers map");
>                       indexedTrackers = new HashMap ValidationTracker>();
>               }
>
>               if(log.isTraceEnabled()) {
>                       log.trace("setting tracker for index: " + index);
>               }
>
>               indexedTrackers.put(index, aTracker);
>       }
>
> In addition, this field carries a mixin:
>
> @Component(id=ID_QUANTITY_FIELD, parameters 
> ={"AttachError.message=fieldError"})
> @MixinClasses(value=AttachError.class)
> private TextField quantityField;
>
> @MixinAfter
> public class AttachError {
>
>        @Parameter(required = true, allowNull = true)
>        private String message;
>
>        @Environmental
>        private ValidationTracker tracker;
>
>        @InjectContainer
>        private Field field;
>
>
>        void setupRender() {
>                if (message != null) {
>                        tracker.recordError(field, message);
>                }
>        }
> }
>
>  public String getFieldError() {
>               String error = null;
>               ValidationTracker tracker = getTracker();
>               if(tracker != null && tracker.getError(quantityField) != null) {
>                       return null;
>               }
>               CartItemBean cib = 
> findCartItem(cartDisplayItem.getLineNumber());
>
>    // look up error in CartItemBean and if found return it, or return null;
>
>   return error;
> }
>
> Let me know, perhaps I am doing something wrong..
>
> Adam
>
> On Thu, Mar 31, 2011 at 9:03 AM, Chris Norris
>  wrote:
>> The Tapestry NumericValidator seems to rely on whether
>> Double.valueOf(String) will throw an exception, which it does for
>> '1k'.
>>
>> How are you configuring and using your validator?
>>
>> On Tue, Mar 29, 2011 at 5:19 PM, Adam Zimowski  wrote:
>>> It is server side. Looks like if input starts with a digit, Tapestry is 
>>> happy :)
>>>
>>> Adam
>>>
>>> On Tue, Mar 29, 2011 at 5:05 PM, Howard Lewis Ship  wrote:
>>>> Seems like a bug to me!  Surprising, though. Is this server-side or
>>>> client-side validation?
>>>>
>>>> On Tue, Mar 29, 2011 at 2:49 PM, Adam Zimowski  
>>>> wrote:
>>>>> For numeric fields, Tapestry validates correctly non-numeric input.
>>>>> However, input such as:
>>>>>
>>>>> 1k
>>>>> 1\
>>>>> etc..
>>>>>
>>>>> passes the validation.
>>>>>
>>>>> Am I missing something?
>>>>>
>>>>> Adam
>>>>>
>>>>> -
>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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!
>>>

Re: T5: built-in numeric validator

2011-03-31 Thread Adam Zimowski
My client side validation is disabled. This happens on my shopping
cart page where I have multiple forms (inside a loop) with indexed
trackers ( Map. You can find complete code
for the ShoppingCart page which exhibits this behavior in another
thread which I posted recently:

"T5: form validation with pre-existing errors"

The actual numeric field which exhibits this is defined in the template as:




   @Component(parameters = {"tracker=tracker"})
   private Form cartForm;

   @Persist(PersistenceConstants.FLASH)
   private Map indexedTrackers;

public ValidationTracker getTracker() {
   if(indexedTrackers == null) return new ValidationTrackerImpl();
   return indexedTrackers.get(index);
   }

   public void setTracker(ValidationTracker aTracker) {

   if(indexedTrackers == null) {
   if(log.isTraceEnabled()) log.trace("crating
indexed trackers map");
   indexedTrackers = new HashMap();
   }

   if(log.isTraceEnabled()) {
   log.trace("setting tracker for index: " + index);
   }

   indexedTrackers.put(index, aTracker);
   }

In addition, this field carries a mixin:

@Component(id=ID_QUANTITY_FIELD, parameters ={"AttachError.message=fieldError"})
@MixinClasses(value=AttachError.class)
private TextField quantityField;

@MixinAfter
public class AttachError {

@Parameter(required = true, allowNull = true)
private String message;

@Environmental
private ValidationTracker tracker;

@InjectContainer
private Field field;


void setupRender() {
if (message != null) {
tracker.recordError(field, message);
}
}
}

 public String getFieldError() {
   String error = null;
   ValidationTracker tracker = getTracker();
   if(tracker != null && tracker.getError(quantityField) != null) {
   return null;
   }
   CartItemBean cib = findCartItem(cartDisplayItem.getLineNumber());

// look up error in CartItemBean and if found return it, or return null;

   return error;
}

Let me know, perhaps I am doing something wrong..

Adam

On Thu, Mar 31, 2011 at 9:03 AM, Chris Norris
 wrote:
> The Tapestry NumericValidator seems to rely on whether
> Double.valueOf(String) will throw an exception, which it does for
> '1k'.
>
> How are you configuring and using your validator?
>
> On Tue, Mar 29, 2011 at 5:19 PM, Adam Zimowski  wrote:
>> It is server side. Looks like if input starts with a digit, Tapestry is 
>> happy :)
>>
>> Adam
>>
>> On Tue, Mar 29, 2011 at 5:05 PM, Howard Lewis Ship  wrote:
>>> Seems like a bug to me!  Surprising, though. Is this server-side or
>>> client-side validation?
>>>
>>> On Tue, Mar 29, 2011 at 2:49 PM, Adam Zimowski  wrote:
>>>> For numeric fields, Tapestry validates correctly non-numeric input.
>>>> However, input such as:
>>>>
>>>> 1k
>>>> 1\
>>>> etc..
>>>>
>>>> passes the validation.
>>>>
>>>> Am I missing something?
>>>>
>>>> Adam
>>>>
>>>> -
>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> 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
>>>
>>>
>>
>> -
>> 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: T5: built-in numeric validator

2011-03-31 Thread Chris Norris
The Tapestry NumericValidator seems to rely on whether
Double.valueOf(String) will throw an exception, which it does for
'1k'.

How are you configuring and using your validator?

On Tue, Mar 29, 2011 at 5:19 PM, Adam Zimowski  wrote:
> It is server side. Looks like if input starts with a digit, Tapestry is happy 
> :)
>
> Adam
>
> On Tue, Mar 29, 2011 at 5:05 PM, Howard Lewis Ship  wrote:
>> Seems like a bug to me!  Surprising, though. Is this server-side or
>> client-side validation?
>>
>> On Tue, Mar 29, 2011 at 2:49 PM, Adam Zimowski  wrote:
>>> For numeric fields, Tapestry validates correctly non-numeric input.
>>> However, input such as:
>>>
>>> 1k
>>> 1\
>>> etc..
>>>
>>> passes the validation.
>>>
>>> Am I missing something?
>>>
>>> Adam
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> 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
>>
>>
>
> -
> 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: T5: form validation with pre-existing errors

2011-03-30 Thread Taha Hafeez
ValidationTracker !! Thanks for sharing

regards
Taha


On Thu, Mar 31, 2011 at 1:06 AM, Adam Zimowski  wrote:

> Tapestry friends!
>
> Your silence combined with my milestone demo today only motivated me
> to stay up couple of nights in a row, fire off debugger and step into
> Tapestry source to get this solved. And so, amazing what can be done
> under the pressure from management and when your job possibly may be
> on the line...
>
> In any case, my project is about 60% along the way, on target for go
> live in Feb 2012. I now have a fully working advanced shopping cart. I
> am sharing the code below for sake of completness of this thread, but
> since my service layer runs the EJBs, the backend details are left
> out. If there is interest, I can write a wiki page on advanced
> shopping cart, covering the following features:
>
> * pre existing errors (persisted by the ejb)
> * form submission errors
> * multiple form design (vs. single form)
> * integrated use of Josh's (Canfield) AttachError mixin
> * integrated use of indexed trackers
>
> As a reminder, this shopping cart mimics functional behavior of our
> current cart website: www.chdist.com , www.avenuesupply.ca and
> www.industrialsupplies.com
>
> Here is the code:
>
> /**
>  * Controls display and processing of data on the shopping cart page.
> Delegates
>  * all business logic to the service layer.
>  *
>  * @author Adam Zimowski
>  */
> public class ShoppingCart extends BasePage {
>
> // component id's used within this class
>public static final String ID_CART_FORM = "cartForm";
>public static final String ID_QUANTITY_FIELD = "quantity";
>public static final String ID_REMOVE_LINK = "remove";
>
>@Inject
>private Logger log;
>
>@Inject
> private CatalogServiceRemote catalogService;
>
>@Inject
>private ShoppingCartServiceRemote cartService;
>
>@Property
>private CartItemDisplayBean cartDisplayItem;
>
> @Component(id=ID_QUANTITY_FIELD, parameters =
> {"AttachError.message=fieldError"})
>@MixinClasses(value=AttachError.class)
>private TextField quantityField;
>
> @Component(parameters = {"tracker=tracker"})
>private Form cartForm;
>
>@Persist(PersistenceConstants.FLASH)
>private Map indexedTrackers;
>
>@Property
>private int index;
>
>private int submittedQuantity;
>
>private int submittedLineNumber;
>
>private String submittedSku;
>
>
>public ValidationTracker getTracker() {
>if(indexedTrackers == null) return new
> ValidationTrackerImpl();
>return indexedTrackers.get(index);
>}
>
>public void setTracker(ValidationTracker aTracker) {
>
>if(indexedTrackers == null) {
>if(log.isTraceEnabled()) log.trace("crating indexed
> trackers map");
>indexedTrackers = new HashMap ValidationTracker>();
>}
>
>if(log.isTraceEnabled()) {
>log.trace("setting tracker for index: " + index);
>}
>
>indexedTrackers.put(index, aTracker);
> }
>
>public String getFieldError() {
>String error = null;
> ValidationTracker tracker = getTracker();
>if(tracker != null && tracker.getError(quantityField) !=
> null) {
>return null;
>}
>CartItemBean cib =
> findCartItem(cartDisplayItem.getLineNumber());
>if(!cib.isValid()) {
>List lineItemErrors =
> cib.getErrorMessages();
>int counter;
>for(counter = 0; counter < lineItemErrors.size();
> ++counter) {
>MessageHolderBean lineItemError =
> lineItemErrors.get(counter);
>String liErrId =
> lineItemError.getMessageId();
>// for now we only pull out the first error;
> in the future we
>// may need to account for the entire
> collection. As of 4.0,
>// collection always contains only 1 item
>if(counter == 0) {
>String liErrTemplate =
> getMessages().get(liErrId);
>List liErrParams =
> lineItemError.getParameters();
>error =
> MessageFormat.format(liErrTemplate, liErrParams.toArray());
>}
>}
>}
>
>return error;
>}
>
>@OnEvent(value=EventConstants.PREPARE_FOR_SUBMIT,
> component=ID_CART_FORM)
>void beforeFormSubmit(int aIndex, int aLineNumber, String aSku) {
>if(log.isDebugEnabled()) {
>log.deb

Re: Setting contenttype of T5 form

2011-03-30 Thread Fernando Benjamin
Haaa, I overlooked the other option, I'll try with javascript!

Thank you!


On 31 March 2011 00:14, Fernando Benjamin wrote:

> Hi Howard,
>
> The Upload component requires a UploadFile as a value!
> I want to use here a plain html input file and not one of tapestry
> components!
> If I replace
> 
> WITH
>
> 
> It does change the contenttype of the form as I wanted, but this means I
> have to use UploadedFile, because its value is required in Upload?
>
> I would like to use tapestry's form and just change the contenttype!
>
>
>
>
>
>
>
>
> On 30 March 2011 00:04, Howard Lewis Ship  wrote:
>
>> Look at the Upload component source; you'll see how it does it.
>>
>> On Tue, Mar 29, 2011 at 2:07 PM, Fernando Benjamin
>>  wrote:
>> > Hi everybody,
>> >
>> >
>> > I am trying to upload a file to GAE by using a tapestry form, but I
>> can't
>> > use tapestry 5 Upload component because it depends on a class writing to
>> the
>> > filesystem!
>> > I need to set the contenttype of the form to "multipart/form-data" so I
>> can
>> > retrieve the file on the servlet(filter).
>> >
>> > This is my example which does not work!
>> >
>> >  
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >> t:value="message:button-label"
>> > />
>> >
>> >
>> >
>> >
>> >
>> >
>> > Is there any other form to change the content type of the  form here
>> above?
>> >
>> > Otherwise I'll have to use normal html form wich does not support:
>> errors,
>> > beaneditor en etc...
>> >
>> >
>> > Cheers,
>> >
>> > Fernando
>> >
>>
>>
>>
>> --
>> 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: Setting contenttype of T5 form

2011-03-30 Thread Fernando Benjamin
Hi Howard,

The Upload component requires a UploadFile as a value!
I want to use here a plain html input file and not one of tapestry
components!
If I replace

WITH


It does change the contenttype of the form as I wanted, but this means I
have to use UploadedFile, because its value is required in Upload?

I would like to use tapestry's form and just change the contenttype!








On 30 March 2011 00:04, Howard Lewis Ship  wrote:

> Look at the Upload component source; you'll see how it does it.
>
> On Tue, Mar 29, 2011 at 2:07 PM, Fernando Benjamin
>  wrote:
> > Hi everybody,
> >
> >
> > I am trying to upload a file to GAE by using a tapestry form, but I can't
> > use tapestry 5 Upload component because it depends on a class writing to
> the
> > filesystem!
> > I need to set the contenttype of the form to "multipart/form-data" so I
> can
> > retrieve the file on the servlet(filter).
> >
> > This is my example which does not work!
> >
> >  
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > t:value="message:button-label"
> > />
> >
> >
> >
> >
> >
> >
> > Is there any other form to change the content type of the  form here
> above?
> >
> > Otherwise I'll have to use normal html form wich does not support:
> errors,
> > beaneditor en etc...
> >
> >
> > Cheers,
> >
> > Fernando
> >
>
>
>
> --
> 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
>
>


T5 & Tap Ioc (beauty) - kudos!

2011-03-30 Thread Adam Zimowski
Today I'm more in love with Tapestry (5) than ever before. I had a
milestone demo at work which went well, and could actually show a good
portion of a re-written website running and working! I'm at the
heights of my project development. I'm sure there are still few more
of dark evenings loaded with frustration in store for my future, but
I'm going to enjoy today...

>From my daily work with T5 over past few months I can say with
confidence it is a love-hate relationship. I get frustrated trying to
get over the learning curve when things don't work. I don't enjoy
stepping into the framework's guts unless I absolutely have to... But
then...when I finally get things to work, it's like EVERY TIME the
code is so elegant and gorgeous, it just makes me love Tapestry that
much more. It's an amazing feeling, one I haven't had in many years as
a Java dev.

And we love our new SPRING-less world of Tapestry! We love Tap-IOC
painlessly injecting us remote EJB proxies :) LOVE IT !!! Our app
layer is as light as it can be. We literally run only on:

* Tapestry
* Apache commons lang
* And of course EJB client libs

In practice, we are able to concurrently run two completely different teams:

Tapestry Devs and EJB/Hibernate devs. Both are experts within their
own domain, no stepping on each other's toes :) Sure, this could be
done with any framework, it's just that Tapestry makes it so darn easy
and most importantly F-U-N :-)

Thank you for this great framework !

Adam

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



Re: T5: form validation with pre-existing errors

2011-03-30 Thread Adam Zimowski
Tapestry friends!

Your silence combined with my milestone demo today only motivated me
to stay up couple of nights in a row, fire off debugger and step into
Tapestry source to get this solved. And so, amazing what can be done
under the pressure from management and when your job possibly may be
on the line...

In any case, my project is about 60% along the way, on target for go
live in Feb 2012. I now have a fully working advanced shopping cart. I
am sharing the code below for sake of completness of this thread, but
since my service layer runs the EJBs, the backend details are left
out. If there is interest, I can write a wiki page on advanced
shopping cart, covering the following features:

* pre existing errors (persisted by the ejb)
* form submission errors
* multiple form design (vs. single form)
* integrated use of Josh's (Canfield) AttachError mixin
* integrated use of indexed trackers

As a reminder, this shopping cart mimics functional behavior of our
current cart website: www.chdist.com , www.avenuesupply.ca and
www.industrialsupplies.com

Here is the code:

/**
 * Controls display and processing of data on the shopping cart page. Delegates
 * all business logic to the service layer.
 *
 * @author Adam Zimowski
 */
public class ShoppingCart extends BasePage {

// component id's used within this class
public static final String ID_CART_FORM = "cartForm";
public static final String ID_QUANTITY_FIELD = "quantity";
public static final String ID_REMOVE_LINK = "remove";

@Inject
private Logger log;

@Inject
private CatalogServiceRemote catalogService;

@Inject
private ShoppingCartServiceRemote cartService;

@Property
private CartItemDisplayBean cartDisplayItem;

@Component(id=ID_QUANTITY_FIELD, parameters =
{"AttachError.message=fieldError"})
@MixinClasses(value=AttachError.class)
private TextField quantityField;

@Component(parameters = {"tracker=tracker"})
private Form cartForm;

@Persist(PersistenceConstants.FLASH)
private Map indexedTrackers;

@Property
private int index;

private int submittedQuantity;

private int submittedLineNumber;

private String submittedSku;


public ValidationTracker getTracker() {
if(indexedTrackers == null) return new ValidationTrackerImpl();
return indexedTrackers.get(index);
}

public void setTracker(ValidationTracker aTracker) {

if(indexedTrackers == null) {
if(log.isTraceEnabled()) log.trace("crating indexed 
trackers map");
indexedTrackers = new HashMap();
}

if(log.isTraceEnabled()) {
log.trace("setting tracker for index: " + index);
}

indexedTrackers.put(index, aTracker);
}

public String getFieldError() {
String error = null;
ValidationTracker tracker = getTracker();
if(tracker != null && tracker.getError(quantityField) != null) {
return null;
}
CartItemBean cib = 
findCartItem(cartDisplayItem.getLineNumber());
if(!cib.isValid()) {
List lineItemErrors = 
cib.getErrorMessages();
int counter;
for(counter = 0; counter < lineItemErrors.size(); 
++counter) {
MessageHolderBean lineItemError = 
lineItemErrors.get(counter);
String liErrId = lineItemError.getMessageId();
// for now we only pull out the first error; in 
the future we
// may need to account for the entire 
collection. As of 4.0,
// collection always contains only 1 item
if(counter == 0) {
String liErrTemplate = 
getMessages().get(liErrId);
List liErrParams = 
lineItemError.getParameters();
error = 
MessageFormat.format(liErrTemplate, liErrParams.toArray());
}
}
}

return error;
}

@OnEvent(value=EventConstants.PREPARE_FOR_SUBMIT, 
component=ID_CART_FORM)
void beforeFormSubmit(int aIndex, int aLineNumber, String aSku) {
if(log.isDebugEnabled()) {
log.debug("beforeFormSubmit -> aIndex: " + aIndex +
", aLineNumber: " + aLineNumber + ", 
aSku: " + aSku);

Re: T5: built-in numeric validator

2011-03-29 Thread Adam Zimowski
It is server side. Looks like if input starts with a digit, Tapestry is happy :)

Adam

On Tue, Mar 29, 2011 at 5:05 PM, Howard Lewis Ship  wrote:
> Seems like a bug to me!  Surprising, though. Is this server-side or
> client-side validation?
>
> On Tue, Mar 29, 2011 at 2:49 PM, Adam Zimowski  wrote:
>> For numeric fields, Tapestry validates correctly non-numeric input.
>> However, input such as:
>>
>> 1k
>> 1\
>> etc..
>>
>> passes the validation.
>>
>> Am I missing something?
>>
>> Adam
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
>
> --
> 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
>
>

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



Re: T5: built-in numeric validator

2011-03-29 Thread Howard Lewis Ship
Seems like a bug to me!  Surprising, though. Is this server-side or
client-side validation?

On Tue, Mar 29, 2011 at 2:49 PM, Adam Zimowski  wrote:
> For numeric fields, Tapestry validates correctly non-numeric input.
> However, input such as:
>
> 1k
> 1\
> etc..
>
> passes the validation.
>
> Am I missing something?
>
> Adam
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
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: Setting contenttype of T5 form

2011-03-29 Thread Howard Lewis Ship
Look at the Upload component source; you'll see how it does it.

On Tue, Mar 29, 2011 at 2:07 PM, Fernando Benjamin
 wrote:
> Hi everybody,
>
>
> I am trying to upload a file to GAE by using a tapestry form, but I can't
> use tapestry 5 Upload component because it depends on a class writing to the
> filesystem!
> I need to set the contenttype of the form to "multipart/form-data" so I can
> retrieve the file on the servlet(filter).
>
> This is my example which does not work!
>
>  
>
>        
>
>        
>
>        
>
>        
>
>
>        
>
>         />
>
>
>
>    
>
>
> Is there any other form to change the content type of the  form here above?
>
> Otherwise I'll have to use normal html form wich does not support: errors,
> beaneditor en etc...
>
>
> Cheers,
>
> Fernando
>



-- 
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



T5: built-in numeric validator

2011-03-29 Thread Adam Zimowski
For numeric fields, Tapestry validates correctly non-numeric input.
However, input such as:

1k
1\
etc..

passes the validation.

Am I missing something?

Adam

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



Setting contenttype of T5 form

2011-03-29 Thread Fernando Benjamin
Hi everybody,


I am trying to upload a file to GAE by using a tapestry form, but I can't
use tapestry 5 Upload component because it depends on a class writing to the
filesystem!
I need to set the contenttype of the form to "multipart/form-data" so I can
retrieve the file on the servlet(filter).

This is my example which does not work!

 



















Is there any other form to change the content type of the  form here above?

Otherwise I'll have to use normal html form wich does not support: errors,
beaneditor en etc...


Cheers,

Fernando


Re: Runtime configurable Validators in T5... this was easy in T4

2011-03-29 Thread Chris Norris
Ah, thank you for pointing out the obvious. I was still thinking in
terms of Validators, and was trying to make a validator to provide to
a FieldValidatorImpl rather than just implementing FieldValidator
myself. I cannot believe how entrenched in that line of thinking I
was.

On Fri, Mar 25, 2011 at 12:56 PM, Thiago H. de Paula Figueiredo
 wrote:
> On Fri, 25 Mar 2011 13:23:25 -0300, Chris Norris
>  wrote:
>
>> I have a loop which generates form components. Each one needs some
>> very custom validation. I know I can create a validator that will take
>> in a constraint, but the constraint in the template has to be static.
>
> This is not correct. The default validate parameter binding is validate, but
> you can use prop:validator and have a getValidator() method that returns a
> FieldValidator instance.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, 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
>
>

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



T5: form validation with pre-existing errors

2011-03-25 Thread Adam Zimowski
I have a shopping cart. The cart is built with a single form, and a
loop. The basic validation works, such as testing quantity for numeric
input etc. However, I have an additional requirement to display errors
on invalid line items which are part of the cart. An example of
invalid cart item may be wrong quantity (sold in lots of 10, but only
7 added to the cart). For the purposes of this discussion, assume that
quantity can only be odd. It is a business requirement that this check
is not done at the time of adding a product to the cart, but during
cart display.

On this mailing list, I found Josh Canfield's example of AttachError
mixin, which I implemented and it almost works, but with few wrinkles.
Here is my code:

@MixinAfter
public class AttachError {

@Parameter(required = true, allowNull = true)
private String message;

@Environmental
private ValidationTracker tracker;

@InjectContainer
private Field field;


void setupRender() {
if (message != null) {
tracker.recordError(field, message);
}
}
}

public class ShoppingCart extends BasePage {

@Inject
private Logger log;

@Inject
private ShoppingCartServiceRemote cartService;

@Property
private CartItemDisplayBean cartDisplayItem;

@Property
private List cartDisplayItems;

@Environmental
private ValidationTracker tracker;

@Component(id="quantity", parameters = 
{"AttachError.message=fieldError"})
@MixinClasses(value=AttachError.class)
private TextField quantityField;

@Property
private Integer indexer;


public String getFieldError() {
String error = null;
if(tracker.getError(quantityField) != null) return null;
if(cartDisplayItem.getQuantity()%2 == 0) {
// simple example of preexisting error; don't allow 
even quantity
error = "[" + cartDisplayItem.getSku() + "] Quantity 
must be odd";
}

return error;
}

@OnEvent(value=EventConstants.PREPARE, component="cartForm")
void prepareCartData() {
cartDisplayItems = getShoppingCartForDisplay();
}

private List getShoppingCartForDisplay() {
  // retrieve shopping cart (using ShoppingCartServiceRemote EJB)
 }
}

public class CartItemDisplayBean implements Comparable {

private int lineNumber;

private String sku;

private String description;

private String usuallyShipsMessage;

private Integer quantity;

private Double price;

private Double total;

private boolean deleted;

public String getSku() {
return sku;
}

public void setSku(String aSku) {
sku = aSku;
}

public String getDescription() {
return description;
}

public void setDescription(String aDescription) {
description = aDescription;
}

public String getUsuallyShipsMessage() {
return usuallyShipsMessage;
}

public void setUsuallyShipsMessage(String aUsuallyShipsMessage) {
usuallyShipsMessage = aUsuallyShipsMessage;
}

public Integer getQuantity() {
return quantity;
}

public void setQuantity(Integer aQuantity) {
quantity = aQuantity;
}

public Double getPrice() {
return price;
}

public void setPrice(Double aPrice) {
price = aPrice;
}

public Double getTotal() {
return total;
}

public void setTotal(Double aTotal) {
total = aTotal;
}

public int getLineNumber() {
return lineNumber;
}

public void setLineNumber(int aLineNumber) {
lineNumber = aLineNumber;
}

public boolean isDeleted() {
return deleted;
}

public void setDeleted(boolean aDeleted) {
deleted = aDeleted;
}

@Override
public int compareTo(CartItemDisplayBean aAnotherBean) {
return lineNumber - aAnotherBean.getLineNumber();
}
}

http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";
t:title="${pageTitle}" xmlns:p="tapestry:parameter">
Shopping Cart

td.kk-currency-cell {
 text-align: right;
}






${message:lineNumber-label}
${message:sku-label}
${message:description-label}
${message:usuallyShipsMsg-label}
${message:quantity-label}
${message:price-label}
${message:total-label}



 ${cartDisplayItem.lineNumber}
 ${cartDisplayItem.sku}
 ${cartDisplayItem

Re: Runtime configurable Validators in T5... this was easy in T4

2011-03-25 Thread Thiago H. de Paula Figueiredo
On Fri, 25 Mar 2011 13:23:25 -0300, Chris Norris  
 wrote:



I have a loop which generates form components. Each one needs some
very custom validation. I know I can create a validator that will take
in a constraint, but the constraint in the template has to be static.


This is not correct. The default validate parameter binding is validate,  
but you can use prop:validator and have a getValidator() method that  
returns a FieldValidator instance.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, 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



Runtime configurable Validators in T5... this was easy in T4

2011-03-25 Thread Chris Norris
In T4 we could new up a Validator, provide it with whatever
information we wanted, and pass that directly to a form component for
validation. I miss this.

I have a loop which generates form components. Each one needs some
very custom validation. I know I can create a validator that will take
in a constraint, but the constraint in the template has to be static.
I could inject a FieldValidatorSource, but that requires having access
to the Field, which I don't because they are generated in a loop. I
can't just inject them all into the page.

I can accomplish all this with an onValidate method, but then the only
thing I can do is add generic errors to the ValidationTracker. I can't
specify which field is in error because the fields are generated in a
loop and therefore can't be injected into the page.

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



Re: T5: Weird problem with browser cache and component event redirect

2011-03-20 Thread sunmoor007
Hi Felix

Even in our application which is built using Tapestry 5, we are facing the
same issue. This problem occurs when we access our app via a proxy server.
we tried setting appropriate cache-headers but still no luck. Even am
looking out for a way to change all url's to have a dynamic value but i
couldnt find a way to do this. Would appreciate if you can let us know the
way to change all the urls to have a dynamic value.

Thanks
Sundar


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Weird-problem-with-browser-cache-and-component-event-redirect-tp2435089p4189507.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 Page Doctype Causing Application to Hang

2011-03-12 Thread Kartweel
I got it working.

For reference this is the list of DTDs that need to be stored locally and
contributed to the template parser.

-//WAPFORUM//DTD XHTML Mobile 1.0//EN
http://www.wapforum.org/DTD/xhtml-mobile10.dtd

-//W3C//ELEMENTS XHTML Inline Style 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlstyle-1.mod

-//WAPFORUM//ENTITIES XHTML Mobile 1.0 Document Model 1.0//EN
http://www.wapforum.org/DTD/xhtml-mobile10-model-1.mod

-//W3C//ENTITIES XHTML Modular Framework 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-framework-1.mod

-//W3C//ELEMENTS XHTML Text 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-text-1.mod

-//W3C//ELEMENTS XHTML Hypertext 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-hypertext-1.mod

-//W3C//ELEMENTS XHTML Lists 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-list-1.mod

-//W3C//ELEMENTS XHTML Images 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-image-1.mod

-//W3C//ELEMENTS XHTML Basic Tables 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-basic-table-1.mod

-//W3C//ELEMENTS XHTML Basic Forms 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-basic-form-1.mod

-//W3C//ELEMENTS XHTML Link Element 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-link-1.mod

-//W3C//ELEMENTS XHTML Metainformation 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-meta-1.mod

-//W3C//ELEMENTS XHTML Base Element 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-base-1.mod

-//W3C//ELEMENTS XHTML Style Sheets 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-style-1.mod

-//W3C//ELEMENTS XHTML Param Element 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-param-1.mod

-//W3C//ELEMENTS XHTML Embedded Object 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-object-1.mod

-//W3C//ELEMENTS XHTML Document Structure 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-struct-1.mod

-//W3C//ELEMENTS XHTML Block Presentation 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-blkpres-1.mod

-//W3C//ELEMENTS XHTML Inline Presentation 1.0//EN
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlpres-1.mod

-//W3C//ELEMENTS XHTML Base Architecture 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-arch-1.mod

-//W3C//NOTATIONS XHTML Notations 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-notations-1.mod

-//W3C//ENTITIES XHTML Datatypes 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-datatypes-1.mod

-//W3C//ENTITIES XHTML Qualified Names 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-qname-1.mod

-//W3C//ENTITIES XHTML Intrinsic Events 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-events-1.mod

-//W3C//ENTITIES XHTML Common Attributes 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-attribs-1.mod

-//W3C//ENTITIES XHTML Character Entities 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-charent-1.mod

-//W3C//ELEMENTS XHTML Inline Structural 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-inlstruct-1.mod

-//W3C//ELEMENTS XHTML Inline Phrasal 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-inlphras-1.mod

-//W3C//ELEMENTS XHTML Block Structural 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-blkstruct-1.mod

-//W3C//ELEMENTS XHTML Block Phrasal 1.0//EN
http://www.w3.org/MarkUp/DTD/xhtml-blkphras-1.mod

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Page-Doctype-Causing-Application-to-Hang-tp3445827p3555240.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 Page Doctype Causing Application to Hang

2011-03-12 Thread Kartweel

Howard Lewis Ship wrote:
> 
> Looks like you did the correct thing. I'd check with the debugger that
> your contribute method is being invoked, then many put a break point
> inside SaxTemplateParserImpl  as well.
> 

Thanks for the quick reply. I feel honoured talking to the main man! :),

I've checked with the debugger and it all appears to be working as it
should.

The issue seems to be that it is getting stuck when trying to resolve dtd:
-//W3C//ELEMENTS XHTML Inline Style 1.0//EN from URL
http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlstyle-1.mod

So my guess of what is happening is the dtd references other dtds and it is
trying to resolve them also. So I guess I need to download everything and
see how that goes :). +1 vote for adding them all into core jar :)

Thanks!

Ryan





--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Page-Doctype-Causing-Application-to-Hang-tp3445827p3555221.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 Page Doctype Causing Application to Hang

2011-03-12 Thread Howard Lewis Ship
Looks like you did the correct thing. I'd check with the debugger that
your contribute method is being invoked, then many put a break point
inside SaxTemplateParserImpl  as well.

On Fri, Mar 11, 2011 at 10:43 PM, Kartweel  wrote:
> Hi,
>
> I have a mobile web application using the doctype <!DOCTYPE html PUBLIC
> "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
> "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">;. On the first
> page request the application hangs for several hours before it will send a
> response. It used to only take several seconds (about 20 seconds), but I am
> assuming something has happened in the cosmos causing the dtd not to
> download correctly. If I remove this doctype and use a standard one then the
> application works correctly (but doesn't render correctly in a mobile
> browser).
>
> So I have tried contributing to the template parser so it uses a local copy
> of the DTD, but it doesn't seem to make any difference (I am assuming I am
> not contributing it correctly). I am having a hard time finding any
> documentation on this.
>
> My code is:
>
>      public static void
> contributeTemplateParser(MappedConfiguration<String, URL> config)
>      {
>              config.add("-//WAPFORUM//DTD XHTML Mobile 1.0//EN",
> AppModule.class.getResource("xhtml-mobile10.dtd"));
>      }
>
> I have put the dtd in the same folder as the AppModule class.
>
> Any help would be appreciated.
>
> Thanks, Ryan
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/T5-Page-Doctype-Causing-Application-to-Hang-tp3445827p3445827.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
>
>



-- 
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



T5 Page Doctype Causing Application to Hang

2011-03-11 Thread Kartweel
Hi,

I have a mobile web application using the doctype <!DOCTYPE html PUBLIC
"-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">;. On the first
page request the application hangs for several hours before it will send a
response. It used to only take several seconds (about 20 seconds), but I am
assuming something has happened in the cosmos causing the dtd not to
download correctly. If I remove this doctype and use a standard one then the
application works correctly (but doesn't render correctly in a mobile
browser).

So I have tried contributing to the template parser so it uses a local copy
of the DTD, but it doesn't seem to make any difference (I am assuming I am
not contributing it correctly). I am having a hard time finding any
documentation on this.

My code is:

  public static void
contributeTemplateParser(MappedConfiguration<String, URL> config)
  {
  config.add("-//WAPFORUM//DTD XHTML Mobile 1.0//EN",
AppModule.class.getResource("xhtml-mobile10.dtd"));
  }

I have put the dtd in the same folder as the AppModule class.

Any help would be appreciated.

Thanks, Ryan

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Page-Doctype-Causing-Application-to-Hang-tp3445827p3445827.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



<    2   3   4   5   6   7   8   9   10   11   >