RE: T5: equivelent of c:set ?

2008-10-06 Thread Russell Brown
I get it. Thanks. 

-Original Message-
From: Thiago H. de Paula Figueiredo [mailto:[EMAIL PROTECTED] 
Sent: 06 October 2008 15:28
To: Tapestry users
Subject: Re: T5: equivelent of c:set ?

Em Mon, 06 Oct 2008 11:01:34 -0300, Russell Brown
<[EMAIL PROTECTED]>  
escreveu:

> In jsp
>
>   varStatus="counter">
>
> 
>   
> 
> 
>
> 
>
> 

You don't need to create a component from that, just stop thinking JSP  
when coding Tapestry. :)
In Tapestry, all the logic is implemented in pages classes, with no
logic  
in templates. And this is a very good thing, as the logic is easily
tested  
when implemented in classes. ;)

Not tested, but hopefully it will give you an idea on how to do that:

YourClass.java:

private ItemType item;

@Property /* so we don't need to provide the getter and setter, as they

don't have any logic */
private ItemType lastItem;

public ItemType getItem() {
return item;
}

public void ItemType setItem(ItemType item) {
lastItem = this.item;
this.item = item;
}

public List getList() {
return ...; // list to be iterated
}

public boolean isNotEmpty() {
return lastItem != null; // or any other logic
}

YourTemplate.tml:



 




If you don't get it, tell us. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
Consultor, desenvolvedor e instrutor em Java
http://www.arsmachina.com.br/thiago

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



Re: T5: equivelent of c:set ?

2008-10-06 Thread Thiago H. de Paula Figueiredo
Em Mon, 06 Oct 2008 11:01:34 -0300, Russell Brown <[EMAIL PROTECTED]>  
escreveu:



In jsp













You don't need to create a component from that, just stop thinking JSP  
when coding Tapestry. :)
In Tapestry, all the logic is implemented in pages classes, with no logic  
in templates. And this is a very good thing, as the logic is easily tested  
when implemented in classes. ;)


Not tested, but hopefully it will give you an idea on how to do that:

YourClass.java:

private ItemType item;

@Property /* so we don't need to provide the getter and setter, as they  
don't have any logic */

private ItemType lastItem;

public ItemType getItem() {
return item;
}

public void ItemType setItem(ItemType item) {
lastItem = this.item;
this.item = item;
}

public List getList() {
return ...; // list to be iterated
}

public boolean isNotEmpty() {
return lastItem != null; // or any other logic
}

YourTemplate.tml:



 




If you don't get it, tell us. :)

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
Consultor, desenvolvedor e instrutor em Java
http://www.arsmachina.com.br/thiago

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



RE: T5: equivelent of c:set ?

2008-10-06 Thread Russell Brown
Ok...an example

In jsp












So in the above example I have a variable available called "someVar"
that is set to the value of the previous myItem's myProperty value. But
with T5 and the var binding I get THIS iterations value. The SCOPE of
the VAR binding is not wide enough for me. So is there an equivalent in
Tapestry or do I have to create a component and call it like this













And then have code like 

@Component(id="someVar")
Private MySetComponentType someVar;


And the MySetComponentType is just 

Public class MySetComponentType {
@Parameter
@Property
Private String value;

}


But there just has to be a better way. Right?

Cheers for taking the time

Russell

-Original Message-
From: Kristian Marinkovic [mailto:[EMAIL PROTECTED] 
Sent: 06 October 2008 14:22
To: Tapestry users
Subject: Re: T5: equivelent of c:set ?

if you use the "var:" prefix in your template you do not need a
corresponding property in your page/component. and you 
can use this variable in your template multiple times (as in the
loop example). tapestry will generate a property on the fly
during rendering for this variable.

if you declare your components purley in your template
you can also pass in the parameters it accepts as well. 
 and it should work with var: variables as well.

eg.


link



AFAIK you cannot access the value of the "var:" variables in your
pages or components.

hope this helps... maybe you can post an example... as posted by thiago

g,
kris




"Thiago H. de Paula Figueiredo" <[EMAIL PROTECTED]> 
06.10.2008 15:10
Bitte antworten an
"Tapestry users" 


An
"Tapestry users" 
Kopie

Thema
Re: T5: equivelent of c:set ?







Em Mon, 06 Oct 2008 09:01:48 -0300, Russell Brown
<[EMAIL PROTECTED]> 
 
escreveu:

> As far as I can see it is only of use in a loop in which case it is
set
> at the start of the iteration. How about iteration idioms that involve
> setting a value at the end of the iteration to be used by the next
> iteration? It is fairly common to see and trivial in struts, jsps,
> spring mvc etc, etc.

You can do that in Tapestry, but you just do it in a different way. 
Remember that the page class properties are always available to the 
template.

Please post a JSP example of what you're trying to accomplish so we'll
can 
 
help you better. ;)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
Consultor, desenvolvedor e instrutor em Java
http://www.arsmachina.com.br/thiago

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



Re: T5: equivelent of c:set ?

2008-10-06 Thread Kristian Marinkovic
if you use the "var:" prefix in your template you do not need a
corresponding property in your page/component. and you 
can use this variable in your template multiple times (as in the
loop example). tapestry will generate a property on the fly
during rendering for this variable.

if you declare your components purley in your template
you can also pass in the parameters it accepts as well. 
 and it should work with var: variables as well.

eg.


link



AFAIK you cannot access the value of the "var:" variables in your
pages or components.

hope this helps... maybe you can post an example... as posted by thiago

g,
kris




"Thiago H. de Paula Figueiredo" <[EMAIL PROTECTED]> 
06.10.2008 15:10
Bitte antworten an
"Tapestry users" 


An
"Tapestry users" 
Kopie

Thema
Re: T5: equivelent of c:set ?







Em Mon, 06 Oct 2008 09:01:48 -0300, Russell Brown <[EMAIL PROTECTED]> 
 
escreveu:

> As far as I can see it is only of use in a loop in which case it is set
> at the start of the iteration. How about iteration idioms that involve
> setting a value at the end of the iteration to be used by the next
> iteration? It is fairly common to see and trivial in struts, jsps,
> spring mvc etc, etc.

You can do that in Tapestry, but you just do it in a different way. 
Remember that the page class properties are always available to the 
template.

Please post a JSP example of what you're trying to accomplish so we'll can 
 
help you better. ;)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
Consultor, desenvolvedor e instrutor em Java
http://www.arsmachina.com.br/thiago

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




Re: T5: equivelent of c:set ?

2008-10-06 Thread Thiago H. de Paula Figueiredo
Em Mon, 06 Oct 2008 09:01:48 -0300, Russell Brown <[EMAIL PROTECTED]>  
escreveu:



As far as I can see it is only of use in a loop in which case it is set
at the start of the iteration. How about iteration idioms that involve
setting a value at the end of the iteration to be used by the next
iteration? It is fairly common to see and trivial in struts, jsps,
spring mvc etc, etc.


You can do that in Tapestry, but you just do it in a different way.  
Remember that the page class properties are always available to the  
template.


Please post a JSP example of what you're trying to accomplish so we'll can  
help you better. ;)


--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
Consultor, desenvolvedor e instrutor em Java
http://www.arsmachina.com.br/thiago

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



RE: T5: equivelent of c:set ?

2008-10-06 Thread Russell Brown
Thanks. I have already.

The docs say "Allows a render variable of the component to be read or
updated." Updated how, when? What is a render variable? A variable in a
template without a corresponding property? But I want to SET a property
of my component from the template...

As far as I can see it is only of use in a loop in which case it is set
at the start of the iteration. How about iteration idioms that involve
setting a value at the end of the iteration to be used by the next
iteration? It is fairly common to see and trivial in struts, jsps,
spring mvc etc, etc.

Is there a way to do this in T5?

Cheers

Russell

-Original Message-
From: Kristian Marinkovic [mailto:[EMAIL PROTECTED] 
Sent: 06 October 2008 11:57
To: Tapestry users
Subject: Re: T5: equivelent of c:set ?

hi Russell,

take a look at the "var:" binding 
http://tapestry.apache.org/tapestry5/guide/parameters.html


g,
kris




"Russell Brown" <[EMAIL PROTECTED]> 
06.10.2008 12:07
Bitte antworten an
"Tapestry users" 


An
"Tapestry users" 
Kopie

Thema
T5: equivelent of c:set ?






Hi,

If I want to set some property from within the component template is
that possible in Tapestry 5? Something like the c:set tag is JSP jstl?
Or do you just write a set component and have it as a property of the
containing component?

 

Cheers

 

Russell



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



Re: T5: equivelent of c:set ?

2008-10-06 Thread Kristian Marinkovic
hi Russell,

take a look at the "var:" binding 
http://tapestry.apache.org/tapestry5/guide/parameters.html


g,
kris




"Russell Brown" <[EMAIL PROTECTED]> 
06.10.2008 12:07
Bitte antworten an
"Tapestry users" 


An
"Tapestry users" 
Kopie

Thema
T5: equivelent of c:set ?






Hi,

If I want to set some property from within the component template is
that possible in Tapestry 5? Something like the c:set tag is JSP jstl?
Or do you just write a set component and have it as a property of the
containing component?

 

Cheers

 

Russell




T5: equivelent of c:set ?

2008-10-06 Thread Russell Brown
Hi,

If I want to set some property from within the component template is
that possible in Tapestry 5? Something like the c:set tag is JSP jstl?
Or do you just write a set component and have it as a property of the
containing component?

 

Cheers

 

Russell