Re: T5: Loop with variables

2007-11-06 Thread Howard Lewis Ship
The x...y syntax is limited to constant values for x and y.  I think a
future release of Tapestry will increase the power of the built-in
expression language, but for the moment, there you go.

The x..y syntax is ultimately converted into an instance of
IntegerRange, so one way would be to create a getter method that
created and returned an instance of IntegerRange directly, then change
the source parameter of the Loop component to point to this property.

However, IntegerRange is an internal class, so be aware that it is
free to change at any time.

Or you could return a ListInteger or int[] of the desired values
from the method.

On Nov 6, 2007 9:02 AM, Tobias Wehrum [EMAIL PROTECTED] wrote:
 Hi all,

 I am currently working with the tutorial 1 at the Tapestry 5 homepage (
 http://tapestry.apache.org/tapestry5/tutorial1/hilo.html ).

 Now, one of the further tasks there is As we guess, we're identifying
 ranges of valid and invalid numbers. Can you only show valid guesses to
 the user?
 ...so, setting a loop (which counted before simply from 1 to 10) to
 count from one variable to another variable.

 My guess was that I just have to replace
 t:loop source=1..10 value=guess
 (which works) with
 t:loop source=${rangeStart}..${rangeEnd} value=guess

 Well, seems to be wrong. I get the following application exception:

 org.apache.tapestry.ioc.internal.util.TapestryException
 Failure writing parameter value of component Guess:loop: Coercion of
 1..10 to type int (via String -- Long, Long -- Integer) failed: For
 input string: 1..10
 (marked is the line shown above).

 So, he DOES replace the variables right, but that doesn't seem to be the
 same as 1..10 anymore.

 How can I solve this problem?

 Thanks in advance,
 Tobias

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





-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

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



Re: T5: Loop with variables

2007-11-06 Thread Tobias Wehrum

Hi Howard,

thanks for the fast answer, IntegerRange solved the problem. Maybe you 
could suggest this in your tutorial.


Keep up the great work,
Tobias

Howard Lewis Ship schrieb:

The x...y syntax is limited to constant values for x and y.  I think a
future release of Tapestry will increase the power of the built-in
expression language, but for the moment, there you go.

The x..y syntax is ultimately converted into an instance of
IntegerRange, so one way would be to create a getter method that
created and returned an instance of IntegerRange directly, then change
the source parameter of the Loop component to point to this property.

However, IntegerRange is an internal class, so be aware that it is
free to change at any time.

Or you could return a ListInteger or int[] of the desired values
from the method.

On Nov 6, 2007 9:02 AM, Tobias Wehrum [EMAIL PROTECTED] wrote:
  

Hi all,

I am currently working with the tutorial 1 at the Tapestry 5 homepage (
http://tapestry.apache.org/tapestry5/tutorial1/hilo.html ).

Now, one of the further tasks there is As we guess, we're identifying
ranges of valid and invalid numbers. Can you only show valid guesses to
the user?
...so, setting a loop (which counted before simply from 1 to 10) to
count from one variable to another variable.

My guess was that I just have to replace
t:loop source=1..10 value=guess
(which works) with
t:loop source=${rangeStart}..${rangeEnd} value=guess

Well, seems to be wrong. I get the following application exception:

org.apache.tapestry.ioc.internal.util.TapestryException
Failure writing parameter value of component Guess:loop: Coercion of
1..10 to type int (via String -- Long, Long -- Integer) failed: For
input string: 1..10
(marked is the line shown above).

So, he DOES replace the variables right, but that doesn't seem to be the
same as 1..10 anymore.

How can I solve this problem?

Thanks in advance,
Tobias

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







  



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