Re: T5: 5.2.4 and assets protection

2011-01-09 Thread Christian Riedel
You shouldn't need an asset dispatcher in T5.2. Directory listings and access 
to WEB-INF is denied.. at least in my apps ;-)


Am 09.01.2011 um 07:50 schrieb Angelo C.:

 
 Hi,
 
 Seems to me there is no change in the assets protection from 5.1.0.5 to
 5.2.4, we still need AssetProtectionDispatcher to protect. and is there a
 new version for 5.2.4? this still works for 5.2.4:
 
 groupIdcom.saiwaisolutions /groupId
 artifactIdAssetProtectionDispatcher/artifactId
 version1.0.0/version
 am I right? Thanks,
 
 Angelo
 
 -- 
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/T5-5-2-4-and-assets-protection-tp637p637.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: 5.2.4 and assets protection

2011-01-09 Thread Christian Riedel
can't reproduce that... I just took the quickstart[1] app and a request to 
assets/  shows me the index page. I think you've got some other problem :-)

[1] http://tapestry.apache.org/getting-started.html 

Am 09.01.2011 um 11:03 schrieb Angelo C.:

 
 but assets/ shows all the tml files
 -- 
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/T5-5-2-4-and-assets-protection-tp637p710.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: 5.2.4 and assets protection

2011-01-09 Thread Angelo C.

you can try that with the hotel booking demo:

http://tapestry.zones.apache.org:8180/tapestry5-hotel-booking/assets/1.2-SNAPSHOT/ctx/

at lest two files are listed:
Book.tml
favi

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-5-2-4-and-assets-protection-tp637p763.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] Complexity for simple things, where is the documentation?

2011-01-09 Thread Borut Bolčina
Thanks!

2011/1/8 Taha Hafeez tawus.tapes...@gmail.com

 Hi Borut..

 With pleasure.

 var PeriodicAjaxUpdater = Class.create({
   initialize:function(params){
  this.element = $(params.element);
  this.url = params.url;
  this.period = params.period;
  $T(this.element).zoneId = params.zone;
  var self = this;
  new PeriodicalExecuter(function(){
 self.updateZone();
 }, this.period);
   },

   updateZone:function(){
  var zoneManager = Tapestry.findZoneManager(this.element);
  if(!zoneManager){
 return;
  }

  zoneManager.updateFromURL(this.url);
   }
 });

 Had to search it using 'find' command on my laptop ... Seriously need to
 update my work at http://code.google.com/p/tapestry-addons

 regards
 Taha


 On Sat, Jan 8, 2011 at 12:41 PM, Borut Bolčina borut.bolc...@gmail.com
 wrote:

  Taha,
 
  can you please post the PeriodicAjaxUpdater.js also?
 
  Cheers,
  Borut
 
  2010/10/17 Taha Hafeez tawus.tapes...@gmail.com
 
   May be this helps!
  
   //
   // Mixin
   //
   package tapestrydemo.mixins;
  
   import org.apache.tapestry5.ComponentResources;
   import org.apache.tapestry5.BindingConstants;
   import org.apache.tapestry5.services.javascript.JavaScriptSupport;
   import org.apache.tapestry5.ClientElement;
   import org.apache.tapestry5.annotations.Import;
   import org.apache.tapestry5.annotations.Environmental;
   import org.apache.tapestry5.annotations.InjectContainer;
   import org.apache.tapestry5.annotations.Parameter;
   import org.apache.tapestry5.ioc.annotations.Inject;
   import org.apache.tapestry5.json.JSONObject;
  
   @Import(library=PeriodicAjaxUpdater.js)
   public class PeriodicAjaxUpdater {
 @Inject
 private ComponentResources _componentResources;
  
 @Environmental
 private JavaScriptSupport _javaScriptSupport;
  
 @Parameter(required=true, defaultPrefix=BindingConstants.LITERAL)
 private String _event;
  
 @Parameter
 private Object[] _context;
  
 @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true)
 private String _zone;
  
 @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true)
 private int _period;
  
 @InjectContainer
 private ClientElement _container;
  
 void afterRender(){
String url = _componentResources.createEventLink(_event,
   _context).toAbsoluteURI();
JSONObject params = new JSONObject();
params.put(url, url);
params.put(element, _container.getClientId());
params.put(zone, _zone);
params.put(period, _period);
_javaScriptSupport.addScript(new PeriodicAjaxUpdater(%s);,
   params.toString());
 }
   }
  
   //A simple page
   t:zone t:mixins='periodicAjaxUpdater' t:zone='timeZone' t:period='4'
   t:event='refresh' t:id='timeZone'${today}/t:zone
  
   //Page java
   public class Index {
 @Component(id=timeZone)
 private Zone _zone;
  
 public java.util.Date getToday(){
return new java.util.Date();
 }
  
 Object onRefresh(){
return _zone.getBody();
 }
   }
  
   regards
   Taha
  
  
  
   On Sun, Oct 17, 2010 at 3:09 AM, Thiago H. de Paula Figueiredo 
   thiag...@gmail.com wrote:
  
On Sat, 16 Oct 2010 18:30:15 -0300, iberck ibe...@gmail.com wrote:
   
 In this example,
what happend if I want to learn mixins for create my own, where is
 the
official documentation?
   
   
http://tapestry.apache.org/tapestry5.2-dev/guide/mixins.html. I just
   went
to the T5.2 front page and searched for mixin.
   
   
 Must I necessarily download and understand the source code of
Autocompletemixin for learn?
   
   
No, but it's a good thing to do. :)
   
   
 I think not all users are used to download the source code of the
frameworks for learning
   
   
I agree, but you can learn a lot from reading source code. ;)
   
--
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: 5.2.4 and assets protection

2011-01-09 Thread Thiago H. de Paula Figueiredo
On Sun, 09 Jan 2011 09:32:28 -0200, Angelo C. angelochen...@gmail.com  
wrote:



you can try that with the hotel booking demo:
http://tapestry.zones.apache.org:8180/tapestry5-hotel-booking/assets/1.2-SNAPSHOT/ctx/
at lest two files are listed:
Book.tml
favi


They're listed, but .tml files can't be downloaded:  
http://tapestry.zones.apache.org:8180/tapestry5-hotel-booking/assets/1.2-SNAPSHOT/ctx/Book.tml


--
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: upgrading from 5.1.0.5 to 5.2.4

2011-01-08 Thread Angelo C.

Hi Thiago,

so T5 uses Hibernate 3.6? here is a dependency tree I got from my pom.xml,
T5.2.4 pulls out hibernate 3.6:

[INFO] +- org.apache.tapestry:tapestry-hibernate:jar:5.2.4:compile
[INFO] |  \- org.apache.tapestry:tapestry-hibernate-core:jar:5.2.4:compile
[INFO] | +- org.hibernate:hibernate-core:jar:3.6.0.Final:compile
[INFO] | |  +- antlr:antlr:jar:2.7.6:compile
[INFO] | |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | |  +-
org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] | |  \-
org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
[INFO] | +- geronimo-spec:geronimo-spec-jta:jar:1.0-M1:compile
[INFO] | \- org.hibernate:hibernate-c3p0:jar:3.6.0.Final:compile
[INFO] |\- c3p0:c3p0:jar:0.9.1:compile
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-upgrading-from-5-1-0-5-to-5-2-4-tp3331829p3332965.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: something learned from upgrading from 5.1.0.5 to 5.2.4

2011-01-08 Thread Angelo C.

Hi,

was able to upgrade a mid size t5 app from 5.1.0.5 to 5.2.4, still testing
every aspect, something learned so far:

1) Hibernate 3.6 will be used, so two changes:
   use  http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd; 
in hibernate.cfg.xml
   if there is a mappedBy, you should no include @JoinColumn, following
is not accepted, but accepted in 3.2.x which is used in Tapestry 5.1.0.5:
@OneToMany(cascade=CascadeType.REMOVE, fetch= FetchType.LAZY, mappedBy =
detail)
@JoinColumn(name=detail_fk)
   you have to remove the @Join... which i believe it's correct

2) if you use ArrayList with Model for grid, 5.1.0.5 will have one column
'empty', but 5.2.4 will have an extra column 'size':
model = beanModelSource.createDisplayModel(ArrayList.class,
_messages);
model.exclude(size);  // you don't have to do this in 5.1.0.5
model.get(empty).sortable(false).label(Items);

that's the things I changed up to now to make the upgrade works.

Angelo
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-something-learned-from-upgrading-from-5-1-0-5-to-5-2-4-tp160p160.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: upgrading from 5.1.0.5 to 5.2.4

2011-01-08 Thread Josh Canfield
I haven't done any research, but are we actually using features from 3.6?
Shouldn't tapestry depend on the oldest forward compatible version possible,
and let the app developer override it?
On Jan 8, 2011 2:28 AM, Angelo C. angelochen...@gmail.com wrote:

 Hi Thiago,

 so T5 uses Hibernate 3.6? here is a dependency tree I got from my pom.xml,
 T5.2.4 pulls out hibernate 3.6:

 [INFO] +- org.apache.tapestry:tapestry-hibernate:jar:5.2.4:compile
 [INFO] | \- org.apache.tapestry:tapestry-hibernate-core:jar:5.2.4:compile
 [INFO] | +- org.hibernate:hibernate-core:jar:3.6.0.Final:compile
 [INFO] | | +- antlr:antlr:jar:2.7.6:compile
 [INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
 [INFO] | | +-
 org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
 [INFO] | | \-

org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
 [INFO] | +- geronimo-spec:geronimo-spec-jta:jar:1.0-M1:compile
 [INFO] | \- org.hibernate:hibernate-c3p0:jar:3.6.0.Final:compile
 [INFO] | \- c3p0:c3p0:jar:0.9.1:compile
 --
 View this message in context:
http://tapestry.1045711.n5.nabble.com/t5-upgrading-from-5-1-0-5-to-5-2-4-tp3331829p3332965.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: upgrading from 5.1.0.5 to 5.2.4

2011-01-08 Thread Thiago H. de Paula Figueiredo
On Sat, 08 Jan 2011 08:27:46 -0200, Angelo C. angelochen...@gmail.com  
wrote:



Hi Thiago,


Hi!


so T5 uses Hibernate 3.6?


Tapestry(-core) doesn't use Hibernate at all. Tapestry-Hibernate does. As  
far as I can remember, the dependency scope is provided, i.e, it will  
use the Hibernate version you choose. If you don't specify one,  
Tapestry-Hibernate uses the version it wants. For Tapestry-Hibernate  
5.2.4, it's 3.6.0.Final.


--
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: something learned from upgrading from 5.1.0.5 to 5.2.4

2011-01-08 Thread Thiago H. de Paula Figueiredo
On Sat, 08 Jan 2011 12:54:25 -0200, Angelo C. angelochen...@gmail.com  
wrote:



Hi,


Hi!

was able to upgrade a mid size t5 app from 5.1.0.5 to 5.2.4, still  
testing every aspect, something learned so far:


1) Hibernate 3.6 will be used, so two changes:
   use   
http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd;

in hibernate.cfg.xml
   if there is a mappedBy, you should no include @JoinColumn,  
following is not accepted, but accepted in 3.2.x which is used in  
Tapestry 5.1.0.5:
@OneToMany(cascade=CascadeType.REMOVE, fetch= FetchType.LAZY,  
mappedBy =

detail) @JoinColumn(name=detail_fk)
   you have to remove the @Join... which i believe it's correct


If a field is mappedBy, you should never use other mapping annotations in  
the same field. It doesn't make sense. It seems that 3.6 started checking  
that and throwing exceptions. That's a good thing. Tapestry does this a  
lot.


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



T5: 5.2.4 and memory

2011-01-08 Thread Angelo C.

Hi,

I start jvm with  -Xms256m -Xmx1024m, and tested my 5.2.4 upgraded app, ran
into this error several times, does that mean 5.2.4 need bigger PermGen
space?

[ERROR] Registry PermGen space
[ERROR] Registry Operations trace:
[ERROR] Registry [ 1] Triggering event 'activate' on m1/Analytics
[ERROR] Registry Exception invoking method
org.sample.t5.services.AppModule.decorateRequestExceptionHandler(Logger,
ResponseRenderer, ComponentSource, boolean, Object) (at AppModule.java:513):
PermGen space
[ERROR] Registry Operations trace:
[ERROR] Registry [ 1] Realizing service RequestExceptionHandler
[ERROR] Registry [ 2] Invoking
org.sample.t5.services.AppModule.decorateRequestExceptionHandler(Logger,
ResponseRenderer, ComponentSource, boolean, Object) (at AppModule.java:513) 
2011-01-09 13:54:52.354 java[1093:903] JavaNativeFoundation error occurred
obtaining Java exception description
2011-01-09 13:54:52.357 java[1093:903] Internal JNF Error: failed calling
Throwable.toString()


-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-5-2-4-and-memory-tp624p624.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: 5.2.4 and assets protection

2011-01-08 Thread Angelo C.

Hi,

Seems to me there is no change in the assets protection from 5.1.0.5 to
5.2.4, we still need AssetProtectionDispatcher to protect. and is there a
new version for 5.2.4? this still works for 5.2.4:

groupIdcom.saiwaisolutions /groupId
  artifactIdAssetProtectionDispatcher/artifactId
  version1.0.0/version
am I right? Thanks,

Angelo

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-5-2-4-and-assets-protection-tp637p637.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: 5.2.4 and assets protection

2011-01-08 Thread Alex Kotchnev
Angelo,
   the AssetProtectionDispatcher still works fine.

Cheers,

Alex K

On Sun, Jan 9, 2011 at 1:50 AM, Angelo C. angelochen...@gmail.com wrote:


 Hi,

 Seems to me there is no change in the assets protection from 5.1.0.5 to
 5.2.4, we still need AssetProtectionDispatcher to protect. and is there a
 new version for 5.2.4? this still works for 5.2.4:

 groupIdcom.saiwaisolutions /groupId
  artifactIdAssetProtectionDispatcher/artifactId
  version1.0.0/version
 am I right? Thanks,

 Angelo

 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/T5-5-2-4-and-assets-protection-tp637p637.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: 5.2.4 and memory

2011-01-08 Thread Alex Kotchnev
Angelo,
   I think that w/ the changes that were introduced in 5.2 there is indeed
more class generation as a replacement for the javassist usage.. Hence, your
app might need more permgen, which would hopefully be outweighed by the
removal of page pooling in 5.2.

Cheers,

Alex K

On Sun, Jan 9, 2011 at 1:03 AM, Angelo C. angelochen...@gmail.com wrote:


 Hi,

 I start jvm with  -Xms256m -Xmx1024m, and tested my 5.2.4 upgraded app, ran
 into this error several times, does that mean 5.2.4 need bigger PermGen
 space?

 [ERROR] Registry PermGen space
 [ERROR] Registry Operations trace:
 [ERROR] Registry [ 1] Triggering event 'activate' on m1/Analytics
 [ERROR] Registry Exception invoking method
 org.sample.t5.services.AppModule.decorateRequestExceptionHandler(Logger,
 ResponseRenderer, ComponentSource, boolean, Object) (at
 AppModule.java:513):
 PermGen space
 [ERROR] Registry Operations trace:
 [ERROR] Registry [ 1] Realizing service RequestExceptionHandler
 [ERROR] Registry [ 2] Invoking
 org.sample.t5.services.AppModule.decorateRequestExceptionHandler(Logger,
 ResponseRenderer, ComponentSource, boolean, Object) (at AppModule.java:513)
 2011-01-09 13:54:52.354 java[1093:903] JavaNativeFoundation error occurred
 obtaining Java exception description
 2011-01-09 13:54:52.357 java[1093:903] Internal JNF Error: failed calling
 Throwable.toString()


 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/T5-5-2-4-and-memory-tp624p624.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: 5.2.4 and memory

2011-01-08 Thread Yohan Yudanara
From this link:
http://www.mail-archive.com/users@tapestry.apache.org/msg47526.html,
Yes, it seems that Tapestry 5.2 needs bigger PermGen space than
tapestry 5.1
But, tapestry 5.2 use less memory in heap space because no more page pooling.

From this link http://tapestry.apache.org/specific-errors.html and
from hlship tweet, It looks like recommended PermGen space is 512 MB.

Hope it helps.

On 1/9/11, Angelo C. angelochen...@gmail.com wrote:

 Hi,

 I start jvm with  -Xms256m -Xmx1024m, and tested my 5.2.4 upgraded app, ran
 into this error several times, does that mean 5.2.4 need bigger PermGen
 space?

 [ERROR] Registry PermGen space
 [ERROR] Registry Operations trace:
 [ERROR] Registry [ 1] Triggering event 'activate' on m1/Analytics
 [ERROR] Registry Exception invoking method
 org.sample.t5.services.AppModule.decorateRequestExceptionHandler(Logger,
 ResponseRenderer, ComponentSource, boolean, Object) (at AppModule.java:513):
 PermGen space
 [ERROR] Registry Operations trace:
 [ERROR] Registry [ 1] Realizing service RequestExceptionHandler
 [ERROR] Registry [ 2] Invoking
 org.sample.t5.services.AppModule.decorateRequestExceptionHandler(Logger,
 ResponseRenderer, ComponentSource, boolean, Object) (at AppModule.java:513)
 2011-01-09 13:54:52.354 java[1093:903] JavaNativeFoundation error occurred
 obtaining Java exception description
 2011-01-09 13:54:52.357 java[1093:903] Internal JNF Error: failed calling
 Throwable.toString()


 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/T5-5-2-4-and-memory-tp624p624.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: zone, blocks, and form - simple question

2011-01-07 Thread Sergio Esteves
No, it is not an ajax request (tested with the isXHR). The form can't 
find the specified zone on its parameter, and I don't know why. I have 
something like zone0(block0( zone1(block1(...) block2(form-zone1(...) 
block3(....


On 06-01-2011 23:38, Thiago H. de Paula Figueiredo wrote:
On Thu, 06 Jan 2011 21:29:08 -0200, Josh Canfield 
joshcanfi...@gmail.com wrote:



Are you sure that your request was coming via ajax? There is an event
result processor for BlockImpl when the request is ajax, but not if
it's a traditional request.


Good point. Inject Request and use its isXHR() method to check if the 
request is really an AJAX one. It's recommended to do that anyway.





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



Re: t5: zone, blocks, and form - simple question

2011-01-07 Thread Sergio Esteves

Ok, I used the zone0 and it worked.

On 07-01-2011 10:51, Sergio Esteves wrote:
No, it is not an ajax request (tested with the isXHR). The form can't 
find the specified zone on its parameter, and I don't know why. I have 
something like zone0(block0( zone1(block1(...) block2(form-zone1(...) 
block3(....


On 06-01-2011 23:38, Thiago H. de Paula Figueiredo wrote:
On Thu, 06 Jan 2011 21:29:08 -0200, Josh Canfield 
joshcanfi...@gmail.com wrote:



Are you sure that your request was coming via ajax? There is an event
result processor for BlockImpl when the request is ajax, but not if
it's a traditional request.


Good point. Inject Request and use its isXHR() method to check if the 
request is really an AJAX one. It's recommended to do that anyway.





-
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: upgrading from 5.1.0.5 to 5.2.4

2011-01-07 Thread Angelo C.

Hi,

got quite a lot of errors after running, looks like from Hibernate, here is
what I have now, what needs to be changed? THanks,


 dependency
  groupIdorg.hibernate/groupId
  artifactIdhibernate/artifactId
  version3.2.2.ga/version
/dependency

dependency
  groupIdc3p0/groupId
  artifactIdc3p0/artifactId
  version0.9.1.2/version
/dependency

dependency
  groupIdgeronimo-spec/groupId
  artifactIdgeronimo-spec-jta/artifactId
  version1.0-M1/version
  scopetest/scope
/dependency

dependency
  groupIdorg.hibernate/groupId
  artifactIdhibernate-annotations/artifactId
  version3.2.1.ga/version
/dependency

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-upgrading-from-5-1-0-5-to-5-2-4-tp3331829p3331829.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: upgrading from 5.1.0.5 to 5.2.4

2011-01-07 Thread Josh Canfield
Without actual errors its hard to tell. What tapestry modules are you
including?
On Jan 7, 2011 5:23 AM, Angelo C. angelochen...@gmail.com wrote:

 Hi,

 got quite a lot of errors after running, looks like from Hibernate, here
is
 what I have now, what needs to be changed? THanks,


 dependency
 groupIdorg.hibernate/groupId
 artifactIdhibernate/artifactId
 version3.2.2.ga/version
 /dependency

 dependency
 groupIdc3p0/groupId
 artifactIdc3p0/artifactId
 version0.9.1.2/version
 /dependency

 dependency
 groupIdgeronimo-spec/groupId
 artifactIdgeronimo-spec-jta/artifactId
 version1.0-M1/version
 scopetest/scope
 /dependency

 dependency
 groupIdorg.hibernate/groupId
 artifactIdhibernate-annotations/artifactId
 version3.2.1.ga/version
 /dependency

 --
 View this message in context:
http://tapestry.1045711.n5.nabble.com/t5-upgrading-from-5-1-0-5-to-5-2-4-tp3331829p3331829.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: upgrading from 5.1.0.5 to 5.2.4

2011-01-07 Thread Angelo C.

I just replaced the version number from 5.1.0.5 to 5.2.4 and compile, run,
the first error is:

[WARN] DTDEntityResolver recognized obsolete hibernate namespace
http://hibernate.sourceforge.net/. Use namespace
http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration
Guide!
[WARN] AnnotationBinder Package not found or wo package-info.java:
sample.t5.entities
[ERROR] Registry Error invoking service builder method
org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
'HibernateSessionSource'): Associations marked as mappedBy must not define
database mappings like @JoinTable or @JoinColumn:
sample.t5.entities.User.details

but the same app runs in 5.1.0.5
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-upgrading-from-5-1-0-5-to-5-2-4-tp3331829p3332001.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: upgrading from 5.1.0.5 to 5.2.4

2011-01-07 Thread Thiago H. de Paula Figueiredo
All the information you'll need is in the error messages. Your project had  
the Hibernate dependency upgraded to 3.6.


On Fri, 07 Jan 2011 13:44:08 -0200, Angelo C. angelochen...@gmail.com  
wrote:


I just replaced the version number from 5.1.0.5 to 5.2.4 and compile,  
run, the first error is:


[WARN] DTDEntityResolver recognized obsolete hibernate namespace
http://hibernate.sourceforge.net/. Use namespace
http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration
Guide!
[WARN] AnnotationBinder Package not found or wo package-info.java:
sample.t5.entities
[ERROR] Registry Error invoking service builder method
org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
'HibernateSessionSource'): Associations marked as mappedBy must not  
define

database mappings like @JoinTable or @JoinColumn:
sample.t5.entities.User.details

but the same app runs in 5.1.0.5



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

Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
Coordenador e professor da Especialização em Engenharia de Software com  
Ênfase em Java da Faculdade Pitágoras

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] Complexity for simple things, where is the documentation?

2011-01-07 Thread Borut Bolčina
Taha,

can you please post the PeriodicAjaxUpdater.js also?

Cheers,
Borut

2010/10/17 Taha Hafeez tawus.tapes...@gmail.com

 May be this helps!

 //
 // Mixin
 //
 package tapestrydemo.mixins;

 import org.apache.tapestry5.ComponentResources;
 import org.apache.tapestry5.BindingConstants;
 import org.apache.tapestry5.services.javascript.JavaScriptSupport;
 import org.apache.tapestry5.ClientElement;
 import org.apache.tapestry5.annotations.Import;
 import org.apache.tapestry5.annotations.Environmental;
 import org.apache.tapestry5.annotations.InjectContainer;
 import org.apache.tapestry5.annotations.Parameter;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.json.JSONObject;

 @Import(library=PeriodicAjaxUpdater.js)
 public class PeriodicAjaxUpdater {
   @Inject
   private ComponentResources _componentResources;

   @Environmental
   private JavaScriptSupport _javaScriptSupport;

   @Parameter(required=true, defaultPrefix=BindingConstants.LITERAL)
   private String _event;

   @Parameter
   private Object[] _context;

   @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true)
   private String _zone;

   @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true)
   private int _period;

   @InjectContainer
   private ClientElement _container;

   void afterRender(){
  String url = _componentResources.createEventLink(_event,
 _context).toAbsoluteURI();
  JSONObject params = new JSONObject();
  params.put(url, url);
  params.put(element, _container.getClientId());
  params.put(zone, _zone);
  params.put(period, _period);
  _javaScriptSupport.addScript(new PeriodicAjaxUpdater(%s);,
 params.toString());
   }
 }

 //A simple page
 t:zone t:mixins='periodicAjaxUpdater' t:zone='timeZone' t:period='4'
 t:event='refresh' t:id='timeZone'${today}/t:zone

 //Page java
 public class Index {
   @Component(id=timeZone)
   private Zone _zone;

   public java.util.Date getToday(){
  return new java.util.Date();
   }

   Object onRefresh(){
  return _zone.getBody();
   }
 }

 regards
 Taha



 On Sun, Oct 17, 2010 at 3:09 AM, Thiago H. de Paula Figueiredo 
 thiag...@gmail.com wrote:

  On Sat, 16 Oct 2010 18:30:15 -0300, iberck ibe...@gmail.com wrote:
 
   In this example,
  what happend if I want to learn mixins for create my own, where is the
  official documentation?
 
 
  http://tapestry.apache.org/tapestry5.2-dev/guide/mixins.html. I just
 went
  to the T5.2 front page and searched for mixin.
 
 
   Must I necessarily download and understand the source code of
  Autocompletemixin for learn?
 
 
  No, but it's a good thing to do. :)
 
 
   I think not all users are used to download the source code of the
  frameworks for learning
 
 
  I agree, but you can learn a lot from reading source code. ;)
 
  --
  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] Complexity for simple things, where is the documentation?

2011-01-07 Thread Taha Hafeez
Hi Borut..

With pleasure.

var PeriodicAjaxUpdater = Class.create({
   initialize:function(params){
  this.element = $(params.element);
  this.url = params.url;
  this.period = params.period;
  $T(this.element).zoneId = params.zone;
  var self = this;
  new PeriodicalExecuter(function(){
 self.updateZone();
 }, this.period);
   },

   updateZone:function(){
  var zoneManager = Tapestry.findZoneManager(this.element);
  if(!zoneManager){
 return;
  }

  zoneManager.updateFromURL(this.url);
   }
});

Had to search it using 'find' command on my laptop ... Seriously need to
update my work at http://code.google.com/p/tapestry-addons

regards
Taha


On Sat, Jan 8, 2011 at 12:41 PM, Borut Bolčina borut.bolc...@gmail.comwrote:

 Taha,

 can you please post the PeriodicAjaxUpdater.js also?

 Cheers,
 Borut

 2010/10/17 Taha Hafeez tawus.tapes...@gmail.com

  May be this helps!
 
  //
  // Mixin
  //
  package tapestrydemo.mixins;
 
  import org.apache.tapestry5.ComponentResources;
  import org.apache.tapestry5.BindingConstants;
  import org.apache.tapestry5.services.javascript.JavaScriptSupport;
  import org.apache.tapestry5.ClientElement;
  import org.apache.tapestry5.annotations.Import;
  import org.apache.tapestry5.annotations.Environmental;
  import org.apache.tapestry5.annotations.InjectContainer;
  import org.apache.tapestry5.annotations.Parameter;
  import org.apache.tapestry5.ioc.annotations.Inject;
  import org.apache.tapestry5.json.JSONObject;
 
  @Import(library=PeriodicAjaxUpdater.js)
  public class PeriodicAjaxUpdater {
@Inject
private ComponentResources _componentResources;
 
@Environmental
private JavaScriptSupport _javaScriptSupport;
 
@Parameter(required=true, defaultPrefix=BindingConstants.LITERAL)
private String _event;
 
@Parameter
private Object[] _context;
 
@Parameter(defaultPrefix=BindingConstants.LITERAL, required=true)
private String _zone;
 
@Parameter(defaultPrefix=BindingConstants.LITERAL, required=true)
private int _period;
 
@InjectContainer
private ClientElement _container;
 
void afterRender(){
   String url = _componentResources.createEventLink(_event,
  _context).toAbsoluteURI();
   JSONObject params = new JSONObject();
   params.put(url, url);
   params.put(element, _container.getClientId());
   params.put(zone, _zone);
   params.put(period, _period);
   _javaScriptSupport.addScript(new PeriodicAjaxUpdater(%s);,
  params.toString());
}
  }
 
  //A simple page
  t:zone t:mixins='periodicAjaxUpdater' t:zone='timeZone' t:period='4'
  t:event='refresh' t:id='timeZone'${today}/t:zone
 
  //Page java
  public class Index {
@Component(id=timeZone)
private Zone _zone;
 
public java.util.Date getToday(){
   return new java.util.Date();
}
 
Object onRefresh(){
   return _zone.getBody();
}
  }
 
  regards
  Taha
 
 
 
  On Sun, Oct 17, 2010 at 3:09 AM, Thiago H. de Paula Figueiredo 
  thiag...@gmail.com wrote:
 
   On Sat, 16 Oct 2010 18:30:15 -0300, iberck ibe...@gmail.com wrote:
  
In this example,
   what happend if I want to learn mixins for create my own, where is the
   official documentation?
  
  
   http://tapestry.apache.org/tapestry5.2-dev/guide/mixins.html. I just
  went
   to the T5.2 front page and searched for mixin.
  
  
Must I necessarily download and understand the source code of
   Autocompletemixin for learn?
  
  
   No, but it's a good thing to do. :)
  
  
I think not all users are used to download the source code of the
   frameworks for learning
  
  
   I agree, but you can learn a lot from reading source code. ;)
  
   --
   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
  
  
 



t5: trigger a shell script from t5 app

2011-01-06 Thread Angelo C.

Hi,

This might not be a t5 related question, how to trigger a shell script from
t5 app? Thanks,

Angelo
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-trigger-a-shell-script-from-t5-app-tp3330203p3330203.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: trigger a shell script from t5 app

2011-01-06 Thread Paul Stanton
just like any other java program, you can do java.lang.Runtime.exec or 
download apache commons-exec and use 
org.apache.commons.exec.DefaultExecutor.


p.

On 6/01/2011 8:56 PM, Angelo C. wrote:

Hi,

This might not be a t5 related question, how to trigger a shell script from
t5 app? Thanks,

Angelo


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



t5: zone, blocks, and form - simple question

2011-01-06 Thread Sergio Esteves

Hi all,

I have the following code:

div t:type=Zone t:id=theZone
t:delegate to=block:firstBlock /

t:block id=firstBlock
...
/t:block

t:block id=secondBlock
form t:type=form t:zone=theZone
...
/form
/t:block

t:block id=thirdBlock
...
/t:block
/div

The problem is I can't return thirdBlock when I submit the form in the 
secondBlock ( Return type 
org.apache.tapestry5.internal.structure.BlockImpl can not be handled.). 
Am I doing something wrong?


Thanks.

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



Re: t5: zone, blocks, and form - simple question

2011-01-06 Thread Sergio Esteves
OK, I have one more zone with a block that contains the code I posted 
bellow.


On 06-01-2011 17:02, Sergio Esteves wrote:

Hi all,

I have the following code:

div t:type=Zone t:id=theZone
t:delegate to=block:firstBlock /

t:block id=firstBlock
...
/t:block

t:block id=secondBlock
form t:type=form t:zone=theZone
...
/form
/t:block

t:block id=thirdBlock
...
/t:block
/div

The problem is I can't return thirdBlock when I submit the form in the 
secondBlock ( Return type 
org.apache.tapestry5.internal.structure.BlockImpl can not be 
handled.). Am I doing something wrong?


Thanks.

-
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: zone, blocks, and form - simple question

2011-01-06 Thread Thiago H. de Paula Figueiredo
On Thu, 06 Jan 2011 21:29:08 -0200, Josh Canfield joshcanfi...@gmail.com  
wrote:



Are you sure that your request was coming via ajax? There is an event
result processor for BlockImpl when the request is ajax, but not if
it's a traditional request.


Good point. Inject Request and use its isXHR() method to check if the  
request is really an AJAX one. It's recommended to do that anyway.


--
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] Removing project name and port number from URL

2010-12-31 Thread Michal Gruca

http://wiki.eclipse.org/Jetty/Howto/Deploy_Web_Applications
If the webapp is called root.war or the directory is called root/ then it
will be deployed at the / context.

So yes, it should help.
As for port, changing that in jetty also will help, but take a look into
secure port number. By default it is 8443, change that to 443 in order to
avoid adding port number to https connections

Regards
Michał Gruca
-- 
View this message in context: 
http://tapestry-users.832.n2.nabble.com/T5-Removing-project-name-and-port-number-from-URL-tp5876705p5877869.html
Sent from the Tapestry Users 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: archiving a page

2010-12-31 Thread Joost Schouten (ml)
 htmlContent;
}


On 31/12/10 12:54 AM, Angelo C. wrote:

Hi Joost,

This is a good solution, is there any maven dependencies I can directly
specify to pull down the Flying Saucer? or some codes that I can directly
use in a T5 app?

Thanks,

Angelo


Joost Schouten (mailing lists) wrote:

Another option is to use Flying Saucer [1] to render the html in pure
java. I use it with iText [2] to create pdf's from any xhtml page.
This is a nice combination as it basically allows you to template your
pdf's with tapestry pages. So from within a Tapestry page you retreive
any html with the use of an URLConnection (in my case another page in
my own app) and return it in the form of an pdf.

I'm sure there are ways to render to images i n Flying Saucer as well.

Good luck,
Joost

[1] https://xhtmlrenderer.dev.java.net/
[2]
http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html

On Thu, Dec 30, 2010 at 5:19 PM, Donny Nadolnydonny.nado...@gmail.com
wrote:

Kind of. You can run it using xvfb (assuming linux), so you don't need a
full x server.

Selenium is a remote control tool for browsers, mainly used for writing
tests for webapps. It starts up firefox (or ie, chrome, or safari) and
controls the browser, telling it to click on links / type things, and you
can make assertions on the output. Usually it's only run on developer/CI
machines, not on your production machine, although I've seen it done.

On Thu, Dec 30, 2010 at 11:12 AM, Angelo C.angelochen...@gmail.com
wrote:


Thanks for the quick answer, not so familiar with selenium, can it be
run
headless in the server?
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/T5-archiving-a-page-tp3322541p3322591.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






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



[T5] Removing project name and port number from URL

2010-12-30 Thread niksami

Hi guys,

I have the following problem. I'm developing application in Tapestry
5.1.0.5, and now when I deploy the app to the server I access it in this
way: http://myApp.com:8080/myApp

However, now I have to deploy it on the root domain name. So now I need to
access home page of the application in this way: http://myApp.com

I suppose that changing Jetty's port number from 8080 to 80 would remove it
from URL. But, I don't want to have url look like:
http://myApp.com/myApp/about , it would be much better to look like:
http://myApp.com/about .

I read some topics here, and in one 
http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=user_nodesuser=90748
Steve Shucker  says that (on Tomcat server) I only need to rename my WAR
file to ROOT.war and to add 
welcome-file-list
  welcome-filemyApp/welcome-file
  /welcome-file-list 
in web.xml.

Will that work on Jetty too? Is this the best way to resolve my problem?

Regards.

-
Niksa Mijanovic
Java developer, jr.
www.fleka.me
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Removing-project-name-and-port-number-from-URL-tp3322312p3322312.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] Removing project name and port number from URL

2010-12-30 Thread Donny Nadolny
Yes, that will work on jetty too. Also, you don't need to add anything
to the web.xml, it will work as-is.

I believe there are other ways of doing it (I think there's some xml
config you can add to tell it to treat a certain application as the
root), but renaming it to ROOT.war is how I've done it.

On Thu, Dec 30, 2010 at 5:50 AM, niksami ni...@fleka.me wrote:

 Hi guys,

 I have the following problem. I'm developing application in Tapestry
 5.1.0.5, and now when I deploy the app to the server I access it in this
 way: http://myApp.com:8080/myApp

 However, now I have to deploy it on the root domain name. So now I need to
 access home page of the application in this way: http://myApp.com

 I suppose that changing Jetty's port number from 8080 to 80 would remove it
 from URL. But, I don't want to have url look like:
 http://myApp.com/myApp/about , it would be much better to look like:
 http://myApp.com/about .

 I read some topics here, and in one
 http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=user_nodesuser=90748
 Steve Shucker  says that (on Tomcat server) I only need to rename my WAR
 file to ROOT.war and to add
 welcome-file-list
      welcome-filemyApp/welcome-file
  /welcome-file-list
 in web.xml.

 Will that work on Jetty too? Is this the best way to resolve my problem?

 Regards.

 -
 Niksa Mijanovic
 Java developer, jr.
 www.fleka.me
 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/T5-Removing-project-name-and-port-number-from-URL-tp3322312p3322312.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] Removing project name and port number from URL

2010-12-30 Thread niksami

Thanks, I'll try that. :)

-
Niksa Mijanovic
Java developer, jr.
www.fleka.me
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Removing-project-name-and-port-number-from-URL-tp3322312p3322495.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: archiving a page

2010-12-30 Thread Angelo C.

Hi,

Is there a way to archive a page? say render it into a jpeg or a pdf ?

Angelo
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-archiving-a-page-tp3322541p3322541.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: archiving a page

2010-12-30 Thread Donny Nadolny
You could use selenium to capture a screenshot of the page, as it looks in
the browser. See
http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/java/com/thoughtworks/selenium/DefaultSelenium.html#captureScreenshot%28java.lang.String%29

On Thu, Dec 30, 2010 at 10:23 AM, Angelo C. angelochen...@gmail.com wrote:

 Hi,

 Is there a way to archive a page? say render it into a jpeg or a pdf ?

 Angelo
 --
 View this message in context:
http://tapestry.1045711.n5.nabble.com/T5-archiving-a-page-tp3322541p3322541.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: archiving a page

2010-12-30 Thread Angelo C.

Thanks for the quick answer, not so familiar with selenium, can it be run
headless in the server?
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-archiving-a-page-tp3322541p3322591.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: archiving a page

2010-12-30 Thread Donny Nadolny
Kind of. You can run it using xvfb (assuming linux), so you don't need a
full x server.

Selenium is a remote control tool for browsers, mainly used for writing
tests for webapps. It starts up firefox (or ie, chrome, or safari) and
controls the browser, telling it to click on links / type things, and you
can make assertions on the output. Usually it's only run on developer/CI
machines, not on your production machine, although I've seen it done.

On Thu, Dec 30, 2010 at 11:12 AM, Angelo C. angelochen...@gmail.com wrote:


 Thanks for the quick answer, not so familiar with selenium, can it be run
 headless in the server?
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/T5-archiving-a-page-tp3322541p3322591.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: archiving a page

2010-12-30 Thread Joost Schouten (mailing lists)
Another option is to use Flying Saucer [1] to render the html in pure
java. I use it with iText [2] to create pdf's from any xhtml page.
This is a nice combination as it basically allows you to template your
pdf's with tapestry pages. So from within a Tapestry page you retreive
any html with the use of an URLConnection (in my case another page in
my own app) and return it in the form of an pdf.

I'm sure there are ways to render to images in Flying Saucer as well.

Good luck,
Joost

[1] https://xhtmlrenderer.dev.java.net/
[2] 
http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html

On Thu, Dec 30, 2010 at 5:19 PM, Donny Nadolny donny.nado...@gmail.com wrote:
 Kind of. You can run it using xvfb (assuming linux), so you don't need a
 full x server.

 Selenium is a remote control tool for browsers, mainly used for writing
 tests for webapps. It starts up firefox (or ie, chrome, or safari) and
 controls the browser, telling it to click on links / type things, and you
 can make assertions on the output. Usually it's only run on developer/CI
 machines, not on your production machine, although I've seen it done.

 On Thu, Dec 30, 2010 at 11:12 AM, Angelo C. angelochen...@gmail.com wrote:


 Thanks for the quick answer, not so familiar with selenium, can it be run
 headless in the server?
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/T5-archiving-a-page-tp3322541p3322591.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: archiving a page

2010-12-30 Thread Markus Feindler
Have a look at https://xhtmlrenderer.dev.java.net/ , it's exactly what 
you need.


Selenium is neither suitable nor made for your use case.

Hi,

Is there a way to archive a page? say render it into a jpeg or a pdf ?

Angelo



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



Re: T5: archiving a page

2010-12-30 Thread Donny Nadolny
As long as your pages don't contain javascript that alter the page / any
ajax, or if you don't care if the result of those scripts is included in the
archived version. The other posters are right though, depending on your use
case, you probably want some other way to render the page to create an
image. You don't need something tapestry specific though, you just need
something that can render html/css/javascript if necessary.

On Thu, Dec 30, 2010 at 11:33 AM, Joost Schouten (mailing lists) 
joost...@jsportal.com wrote:

 Another option is to use Flying Saucer [1] to render the html in pure
 java. I use it with iText [2] to create pdf's from any xhtml page.
 This is a nice combination as it basically allows you to template your
 pdf's with tapestry pages. So from within a Tapestry page you retreive
 any html with the use of an URLConnection (in my case another page in
 my own app) and return it in the form of an pdf.

 I'm sure there are ways to render to images in Flying Saucer as well.

 Good luck,
 Joost

 [1] https://xhtmlrenderer.dev.java.net/
 [2]
 http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html

 On Thu, Dec 30, 2010 at 5:19 PM, Donny Nadolny donny.nado...@gmail.com
 wrote:
  Kind of. You can run it using xvfb (assuming linux), so you don't need a
  full x server.
 
  Selenium is a remote control tool for browsers, mainly used for writing
  tests for webapps. It starts up firefox (or ie, chrome, or safari) and
  controls the browser, telling it to click on links / type things, and you
  can make assertions on the output. Usually it's only run on developer/CI
  machines, not on your production machine, although I've seen it done.
 
  On Thu, Dec 30, 2010 at 11:12 AM, Angelo C. angelochen...@gmail.com
 wrote:
 
 
  Thanks for the quick answer, not so familiar with selenium, can it be
 run
  headless in the server?
  --
  View this message in context:
 
 http://tapestry.1045711.n5.nabble.com/T5-archiving-a-page-tp3322541p3322591.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: archiving a page

2010-12-30 Thread Martin Strand

If Java is not required, you could use CutyCapt to render the page:
http://cutycapt.sourceforge.net/

It supports jpeg, pdf and more.

On Thu, 30 Dec 2010 16:23:15 +0100, Angelo C. angelochen...@gmail.com  
wrote:




Hi,

Is there a way to archive a page? say render it into a jpeg or a pdf ?

Angelo


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



Re: T5: archiving a page

2010-12-30 Thread Angelo C.

Hi Joost,

This is a good solution, is there any maven dependencies I can directly
specify to pull down the Flying Saucer? or some codes that I can directly
use in a T5 app? 

Thanks,

Angelo


Joost Schouten (mailing lists) wrote:
 
 Another option is to use Flying Saucer [1] to render the html in pure
 java. I use it with iText [2] to create pdf's from any xhtml page.
 This is a nice combination as it basically allows you to template your
 pdf's with tapestry pages. So from within a Tapestry page you retreive
 any html with the use of an URLConnection (in my case another page in
 my own app) and return it in the form of an pdf.
 
 I'm sure there are ways to render to images i n Flying Saucer as well.
 
 Good luck,
 Joost
 
 [1] https://xhtmlrenderer.dev.java.net/
 [2]
 http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html
 
 On Thu, Dec 30, 2010 at 5:19 PM, Donny Nadolny donny.nado...@gmail.com
 wrote:
 Kind of. You can run it using xvfb (assuming linux), so you don't need a
 full x server.

 Selenium is a remote control tool for browsers, mainly used for writing
 tests for webapps. It starts up firefox (or ie, chrome, or safari) and
 controls the browser, telling it to click on links / type things, and you
 can make assertions on the output. Usually it's only run on developer/CI
 machines, not on your production machine, although I've seen it done.

 On Thu, Dec 30, 2010 at 11:12 AM, Angelo C. angelochen...@gmail.com
 wrote:


 Thanks for the quick answer, not so familiar with selenium, can it be
 run
 headless in the server?
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/T5-archiving-a-page-tp3322541p3322591.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
 
 
 

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-archiving-a-page-tp3322541p3323061.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: building injected objects

2010-12-29 Thread Sergio Esteves

Hi all,

If I have a class with this:
�...@inject
@OfflineJob engine;»

and my project class:

«OfflineJob buildFoo(@InjectService(EjbContext) Context ejbContext) 
throws NamingException { ... }
OfflineJob buildBar(@InjectService(EjbContext) Context ejbContext) 
throws NamingException { ... }»


Which method will it use to build the engine object?

Thanks.

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



Re: t5: building injected objects

2010-12-29 Thread Robert Zeigler
Both could be built, but you'll get an exception at runtime because Tapestry 
can't disambiguate which service you want injected.
You would need to either specify the service id of (foo or bar) of the service 
you want injected, or else mark the two services in some way and use said 
marker annotation to uniquely identify the service that you want injected.
See also: 
http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/ioc/annotations/Marker.html

Robert

On Dec 29, 2010, at 12/299:33 AM , Sergio Esteves wrote:

 Hi all,
 
 If I have a class with this:
 �...@inject
 @OfflineJob engine;»
 
 and my project class:
 
 «OfflineJob buildFoo(@InjectService(EjbContext) Context ejbContext) throws 
 NamingException { ... }
 OfflineJob buildBar(@InjectService(EjbContext) Context ejbContext) throws 
 NamingException { ... }»
 
 Which method will it use to build the engine object?
 
 Thanks.
 
 -
 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: building injected objects

2010-12-29 Thread Sergio Esteves
The service id is the word that appears after the build? Like, if I do 
this:


«OfflineJob buildFoo(@InjectService(EjbContext) Context ejbContext) throws 
NamingException { ... }
OfflineJob buildBar(@InjectService(EjbContext) Context ejbContext) throws 
NamingException { ... }»

Will I be able to do

�...@inject
private OfflineJob foo;

@Inject
private OfflineJob bar;»

?

Thanks.



On 29-12-2010 15:42, Robert Zeigler wrote:

Both could be built, but you'll get an exception at runtime because Tapestry 
can't disambiguate which service you want injected.
You would need to either specify the service id of (foo or bar) of the service 
you want injected, or else mark the two services in some way and use said 
marker annotation to uniquely identify the service that you want injected.
See also: 
http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/ioc/annotations/Marker.html

Robert

On Dec 29, 2010, at 12/299:33 AM , Sergio Esteves wrote:


Hi all,

If I have a class with this:
�...@inject
@OfflineJob engine;»

and my project class:

«OfflineJob buildFoo(@InjectService(EjbContext) Context ejbContext) throws 
NamingException { ... }
OfflineJob buildBar(@InjectService(EjbContext) Context ejbContext) throws 
NamingException { ... }»

Which method will it use to build the engine object?

Thanks.

-
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: very basic question - how do I call a code-side function in a tml

2010-12-26 Thread Thiago H. de Paula Figueiredo
On Sat, 25 Dec 2010 14:54:17 -0200, Sergio Esteves  
sergio.este...@xpand-it.com wrote:



Hi,


Hi!


I have tried to do this:
tml:
«... ${foo} ...»
java:
«... public void foo() { count++; } ...» (I tried with void getFoo()  
too)


With all due respect, this is a very bad idea. Please post what you're  
trying to implement so we can suggest a better way of doing that.


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



T5: very basic question - how do I call a code-side function in a tml

2010-12-25 Thread Sergio Esteves

Hi,

I have tried to do this:
tml:
«... ${foo} ...»
java:
«... public void foo() { count++; } ...» (I tried with void getFoo() too)

But without success. The thing is the returning type of void.

Thanks.



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



Re: T5: very basic question - how do I call a code-side function in a tml

2010-12-25 Thread Taha Hafeez
You can't in T5. May I ask what are you trying to do ?

regards
Taha


On Sat, Dec 25, 2010 at 10:24 PM, Sergio Esteves 
sergio.este...@xpand-it.com wrote:

 Hi,

 I have tried to do this:
 tml:
 «... ${foo} ...»
 java:
 «... public void foo() { count++; } ...» (I tried with void getFoo() too)

 But without success. The thing is the returning type of void.

 Thanks.



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




Re: T5: very basic question - how do I call a code-side function in a tml

2010-12-25 Thread Sergio Esteves
I'm using an ajaxformloop and I'm trying to simulate the index of the 
component loop, without making a new component.
So, in each iteration of the loop I increment a variable that I use 
after in the components within the loop.


Regards.

On 25-12-2010 16:59, Taha Hafeez wrote:

You can't in T5. May I ask what are you trying to do ?

regards
Taha


On Sat, Dec 25, 2010 at 10:24 PM, Sergio Esteves
sergio.este...@xpand-it.com  wrote:


Hi,

I have tried to do this:
tml:
«... ${foo} ...»
java:
«... public void foo() { count++; } ...» (I tried with void getFoo() too)

But without success. The thing is the returning type of void.

Thanks.



-
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: very basic question - how do I call a code-side function in a tml

2010-12-25 Thread Taha Hafeez
Sorry! I didn't see 'AJAXFORM' :). Can you share the code ?

regards
Taha

On Sat, Dec 25, 2010 at 10:39 PM, Sergio Esteves 
sergio.este...@xpand-it.com wrote:

  But for what I want to do is easier to use the component ajaxformloop, as
 I will need to add and remove rows.


 On 25-12-2010 17:07, Taha Hafeez wrote:

 Loop already has an index parameter. Can't you use that


 http://tapestry.apache.org/tapestry5.2-dev/tapestry-core/ref/org/apache/tapestry5/corelib/components/Loop.html

  regards
 Taha


  On Sat, Dec 25, 2010 at 10:32 PM, Sergio Esteves 
 sergio.este...@xpand-it.com wrote:

 I'm using an ajaxformloop and I'm trying to simulate the index of the
 component loop, without making a new component.
 So, in each iteration of the loop I increment a variable that I use after
 in the components within the loop.

 Regards.


 On 25-12-2010 16:59, Taha Hafeez wrote:

 You can't in T5. May I ask what are you trying to do ?

 regards
 Taha


 On Sat, Dec 25, 2010 at 10:24 PM, Sergio Esteves
 sergio.este...@xpand-it.com  wrote:

  Hi,

 I have tried to do this:
 tml:
 «... ${foo} ...»
 java:
 «... public void foo() { count++; } ...» (I tried with void getFoo()
 too)

 But without success. The thing is the returning type of void.

 Thanks.



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








Re: T5: very basic question - how do I call a code-side function in a tml

2010-12-25 Thread Sergio Esteves
I'm just doing this inside the loop body: ${foo} and the method foo 
isn't called if the returning type is void. It's just that. I wonder if 
there is another way, but, if not, a workaround is to return a null object.


Regards.

On 25-12-2010 17:16, Taha Hafeez wrote:

Sorry! I didn't see 'AJAXFORM' :). Can you share the code ?

regards
Taha

On Sat, Dec 25, 2010 at 10:39 PM, Sergio Esteves
sergio.este...@xpand-it.com  wrote:


  But for what I want to do is easier to use the component ajaxformloop, as
I will need to add and remove rows.


On 25-12-2010 17:07, Taha Hafeez wrote:

Loop already has an index parameter. Can't you use that


http://tapestry.apache.org/tapestry5.2-dev/tapestry-core/ref/org/apache/tapestry5/corelib/components/Loop.html

  regards
Taha


  On Sat, Dec 25, 2010 at 10:32 PM, Sergio Esteves
sergio.este...@xpand-it.com  wrote:


I'm using an ajaxformloop and I'm trying to simulate the index of the
component loop, without making a new component.
So, in each iteration of the loop I increment a variable that I use after
in the components within the loop.

Regards.


On 25-12-2010 16:59, Taha Hafeez wrote:


You can't in T5. May I ask what are you trying to do ?

regards
Taha


On Sat, Dec 25, 2010 at 10:24 PM, Sergio Esteves
sergio.este...@xpand-it.com   wrote:

  Hi,

I have tried to do this:
tml:
«... ${foo} ...»
java:
«... public void foo() { count++; } ...» (I tried with void getFoo()
too)

But without success. The thing is the returning type of void.

Thanks.



-
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: very basic question - how do I call a code-side function in a tml

2010-12-25 Thread Taha Hafeez
Apologies Sergio.

Hi Josh,

But isn't calling a function in a template awkward ? Shouldn't there be a
better way of doing it ?

regards
Taha


On Sat, Dec 25, 2010 at 11:56 PM, Josh Canfield joshcanfi...@gmail.comwrote:

 Try foo()
 On Dec 25, 2010 9:26 AM, Sergio Esteves sergio.este...@xpand-it.com
 wrote:
  I'm just doing this inside the loop body: ${foo} and the method foo
  isn't called if the returning type is void. It's just that. I wonder if
  there is another way, but, if not, a workaround is to return a null
 object.
 
  Regards.
 
  On 25-12-2010 17:16, Taha Hafeez wrote:
  Sorry! I didn't see 'AJAXFORM' :). Can you share the code ?
 
  regards
  Taha
 
  On Sat, Dec 25, 2010 at 10:39 PM, Sergio Esteves
  sergio.este...@xpand-it.com wrote:
 
  But for what I want to do is easier to use the component ajaxformloop,
 as
  I will need to add and remove rows.
 
 
  On 25-12-2010 17:07, Taha Hafeez wrote:
 
  Loop already has an index parameter. Can't you use that
 
 
 

 http://tapestry.apache.org/tapestry5.2-dev/tapestry-core/ref/org/apache/tapestry5/corelib/components/Loop.html
 
  regards
  Taha
 
 
  On Sat, Dec 25, 2010 at 10:32 PM, Sergio Esteves
  sergio.este...@xpand-it.com wrote:
 
  I'm using an ajaxformloop and I'm trying to simulate the index of the
  component loop, without making a new component.
  So, in each iteration of the loop I increment a variable that I use
 after
  in the components within the loop.
 
  Regards.
 
 
  On 25-12-2010 16:59, Taha Hafeez wrote:
 
  You can't in T5. May I ask what are you trying to do ?
 
  regards
  Taha
 
 
  On Sat, Dec 25, 2010 at 10:24 PM, Sergio Esteves
  sergio.este...@xpand-it.com wrote:
 
  Hi,
  I have tried to do this:
  tml:
  «... ${foo} ...»
  java:
  «... public void foo() { count++; } ...» (I tried with void
 getFoo()
  too)
 
  But without success. The thing is the returning type of void.
 
  Thanks.
 
 
 
 
 -
  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: very basic question - how do I call a code-side function in a tml

2010-12-25 Thread Josh Canfield
Actually, that probably wouldn't work either since it's not returning
anything. Re-reading your email, why can't you use the index parameter of
the loop?
On Dec 25, 2010 10:35 AM, Taha Hafeez tawus.tapes...@gmail.com wrote:
 Apologies Sergio.

 Hi Josh,

 But isn't calling a function in a template awkward ? Shouldn't there be a
 better way of doing it ?

 regards
 Taha


 On Sat, Dec 25, 2010 at 11:56 PM, Josh Canfield joshcanfi...@gmail.com
wrote:

 Try foo()
 On Dec 25, 2010 9:26 AM, Sergio Esteves sergio.este...@xpand-it.com
 wrote:
  I'm just doing this inside the loop body: ${foo} and the method foo
  isn't called if the returning type is void. It's just that. I wonder if
  there is another way, but, if not, a workaround is to return a null
 object.
 
  Regards.
 
  On 25-12-2010 17:16, Taha Hafeez wrote:
  Sorry! I didn't see 'AJAXFORM' :). Can you share the code ?
 
  regards
  Taha
 
  On Sat, Dec 25, 2010 at 10:39 PM, Sergio Esteves
  sergio.este...@xpand-it.com wrote:
 
  But for what I want to do is easier to use the component
ajaxformloop,
 as
  I will need to add and remove rows.
 
 
  On 25-12-2010 17:07, Taha Hafeez wrote:
 
  Loop already has an index parameter. Can't you use that
 
 
 


http://tapestry.apache.org/tapestry5.2-dev/tapestry-core/ref/org/apache/tapestry5/corelib/components/Loop.html
 
  regards
  Taha
 
 
  On Sat, Dec 25, 2010 at 10:32 PM, Sergio Esteves
  sergio.este...@xpand-it.com wrote:
 
  I'm using an ajaxformloop and I'm trying to simulate the index of
the
  component loop, without making a new component.
  So, in each iteration of the loop I increment a variable that I use
 after
  in the components within the loop.
 
  Regards.
 
 
  On 25-12-2010 16:59, Taha Hafeez wrote:
 
  You can't in T5. May I ask what are you trying to do ?
 
  regards
  Taha
 
 
  On Sat, Dec 25, 2010 at 10:24 PM, Sergio Esteves
  sergio.este...@xpand-it.com wrote:
 
  Hi,
  I have tried to do this:
  tml:
  «... ${foo} ...»
  java:
  «... public void foo() { count++; } ...» (I tried with void
 getFoo()
  too)
 
  But without success. The thing is the returning type of void.
 
  Thanks.
 
 
 
 
 -
  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: using Tapestry with Memcached

2010-12-23 Thread Dmitry Gusev
Here is a few scenarios I when used memcached with T5:

http://dmitrygusev.blogspot.com/2010/09/tapestry5-caching-method-results.html
http://dmitrygusev.blogspot.com/2010/09/tapestry5-caching-method-results.html
http://dmitrygusev.blogspot.com/2010/09/gae-and-tapestry5-data-access-layer.html

On Thu, Dec 23, 2010 at 09:06, Borut Bolčina borut.bolc...@gmail.comwrote:

 Yes, we have used memcached, but it has nothing to do with T5. Are you
 asking for memcached performance?

 -borut

 2010/12/23 Angelo C. angelochen...@gmail.com

 
  Hi,
 
  Anybody tried T5 with Memcached? has good performance? any wiki on this?
  Thanks,
 
  Angelo
  --
  View this message in context:
 
 http://tapestry.1045711.n5.nabble.com/t5-using-Tapestry-with-Memcached-tp3315939p3315939.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
 
 




-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


t5: using Tapestry with Memcached

2010-12-22 Thread Angelo C.

Hi,

Anybody tried T5 with Memcached? has good performance? any wiki on this?
Thanks,

Angelo
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-using-Tapestry-with-Memcached-tp3315939p3315939.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: using Tapestry with Memcached

2010-12-22 Thread Borut Bolčina
Yes, we have used memcached, but it has nothing to do with T5. Are you
asking for memcached performance?

-borut

2010/12/23 Angelo C. angelochen...@gmail.com


 Hi,

 Anybody tried T5 with Memcached? has good performance? any wiki on this?
 Thanks,

 Angelo
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/t5-using-Tapestry-with-Memcached-tp3315939p3315939.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 disable loading specified module

2010-12-21 Thread LLTYK

There is a tapestry.disable-default-modules. Took me a while to find it in
the source code. Then you specify the modules you want to use manually with
tapestry.modules
(org.apache.tapestry5.upload.services.UploadModule,org.apache.tapestry5.spring.SpringModule).
-- 
View this message in context: 
http://tapestry-users.832.n2.nabble.com/T5-disable-loading-specified-module-tp3127241p5855485.html
Sent from the Tapestry Users 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: getting locale in a page class

2010-12-17 Thread Angelo C.

hi,

How to get the locale in a page class? I have this code:

public Object onActivate(EventContext ec) {
  System.out.println(request.getLocale().getLanguage());
  return null;
  }


this url returns 'en':

http://localhost

this url returns 'en' too, despite the page is already in Chinese:

http://localhist/zh

?

Angelo
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-getting-locale-in-a-page-class-tp3310211p3310211.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: getting locale in a page class

2010-12-17 Thread Angelo C.

looks like I did not search enough, turned out, should use:
 @Inject
private ThreadLocale locale;
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-getting-locale-in-a-page-class-tp3310211p3310214.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: getting locale in a page class

2010-12-17 Thread Howard Lewis Ship
Actually, just:

@Inject
private Locale locale;

That's all you need.  Tapestry finds or builds a page for the locale
specified in the request, so by the time your code gets invoked, the locale
is locked down.

On Fri, Dec 17, 2010 at 7:37 PM, Angelo C. angelochen...@gmail.com wrote:


 looks like I did not search enough, turned out, should use:
  @Inject
private ThreadLocale locale;
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/t5-getting-locale-in-a-page-class-tp3310211p3310214.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


Re: T5: Javascript problem

2010-12-16 Thread Andreas Andreou
I dont like this way of refering to nodes (  document.entryForm.oosComment )
i'm not sure how many browsers fully support this but it looks like
this can work
when nodes have the name attribute set.

If i remember correctly, T5.1 used to include a name in each form but
this was removed
in 5.2 - see https://issues.apache.org/jira/browse/TAP5-796

So, anyway, see if your nodes have id, and just reference them in that
way using either
document.getElementById or prototype's $$

On Thu, Dec 16, 2010 at 10:51, Newham, Cameron cameron.new...@bl.uk wrote:
 Hi!



 Another simple question.



 I had an application running under T5.1 and I've now moved to 5.2. I
 notice my Javascript is now broken. I have this function in my .tml
 file:



 SCRIPT type=text/JavaScript LANGUAGE=JavaScript



 function checkOOS(myCheck)

 {

   if(myCheck.checked)

   {

      document.entryForm.oosComment.disabled = false;

      document.entryForm.oosComment.focus();

   }

   else

   {

      document.entryForm.oosComment.disabled = true;

   }

 }



 /SCRIPT



 Which turns a select on and off by clicking a checkbox via onclick.
 While the JavaScript function is called, it no longer updates the
 disabled attribute of oosComment.



 Should I be adding my JavaScript with JavaScriptSupport (and if so,
 where is documentation or an example? The only mention of JavaScript I
 can find is in the HOW-TOs which show it being added to the .tml file
 directly in a script block).



 Also, why is this now partially non-functioning in 5.2? It seems that
 document.entryForm.oosComment.disabled is incorrect for referring to
 component oosComment. Yet this works fine under 5.1. My Form is called
 entryForm and oosComment is inside that. The page hasn't changed since
 it worked under 5.1 but, in that case, it seems I've been doing
 something wrong all along even though it worked.



 c.







-- 
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting

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



RE: T5: Javascript problem

2010-12-16 Thread Newham, Cameron

Thanks Andreas.

Yes, name attribute was the problem. I've changed to using getElementById and 
it's working again.

c.


-Original Message-
From: andre...@gmail.com [mailto:andre...@gmail.com] On Behalf Of Andreas 
Andreou
Sent: 16 December 2010 10:12
To: Tapestry users
Subject: Re: T5: Javascript problem

I dont like this way of refering to nodes (  document.entryForm.oosComment )
i'm not sure how many browsers fully support this but it looks like
this can work
when nodes have the name attribute set.

If i remember correctly, T5.1 used to include a name in each form but
this was removed
in 5.2 - see https://issues.apache.org/jira/browse/TAP5-796

So, anyway, see if your nodes have id, and just reference them in that
way using either
document.getElementById or prototype's $$

On Thu, Dec 16, 2010 at 10:51, Newham, Cameron cameron.new...@bl.uk wrote:
 Hi!



 Another simple question.



 I had an application running under T5.1 and I've now moved to 5.2. I
 notice my Javascript is now broken. I have this function in my .tml
 file:



 SCRIPT type=text/JavaScript LANGUAGE=JavaScript



 function checkOOS(myCheck)

 {

   if(myCheck.checked)

   {

      document.entryForm.oosComment.disabled = false;

      document.entryForm.oosComment.focus();

   }

   else

   {

      document.entryForm.oosComment.disabled = true;

   }

 }



 /SCRIPT



 Which turns a select on and off by clicking a checkbox via onclick.
 While the JavaScript function is called, it no longer updates the
 disabled attribute of oosComment.



 Should I be adding my JavaScript with JavaScriptSupport (and if so,
 where is documentation or an example? The only mention of JavaScript I
 can find is in the HOW-TOs which show it being added to the .tml file
 directly in a script block).



 Also, why is this now partially non-functioning in 5.2? It seems that
 document.entryForm.oosComment.disabled is incorrect for referring to
 component oosComment. Yet this works fine under 5.1. My Form is called
 entryForm and oosComment is inside that. The page hasn't changed since
 it worked under 5.1 but, in that case, it seems I've been doing
 something wrong all along even though it worked.



 c.







-- 
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting

-
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: Javascript problem

2010-12-16 Thread Nicolas Barrera
Hi Cameron,

On Thu, Dec 16, 2010 at 8:03 AM, Newham, Cameron cameron.new...@bl.ukwrote:

  Should I be adding my JavaScript with JavaScriptSupport (and if so,
  where is documentation or an example? The only mention of JavaScript I
  can find is in the HOW-TOs which show it being added to the .tml file
  directly in a script block).
 


I haven't read precisely your mail but I think I can answer that part...

I 've been reading the mailing list for a while and I think adding
javascript blocks is not recommended, instead you should write javascript in
.js files and add them by means of annotations in the Java class.

About t5/js documentation I can tell you about this link I found useful:

http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained

please take into account that annotation's names may vary between version
5.1.x.x and 5.2.x.x... I don't remember quite well about that.

finally you can browse mailing list archives:

http://tapestry.1045711.n5.nabble.com/Tapestry-User-f2375125.html

hope that helps

cheers.

Nicolas.-


Re: T5: Javascript problem

2010-12-16 Thread Nicolas Barrera
Yes, it's true it might not be the fastest or easiest way, but
I think it's good that Tapestry forces you to things the right way.

Nicolás.-


Re: T5: Javascript problem

2010-12-16 Thread Richard Hill

One use case I have for putting javascript in .tml is to get a function
to execute after a zone update. Due to Tapestry attaching onclick event
handlers to actionlinks (as opposed to using onclick attribute), it's
not that easy afaik to guarantee your own method will get called
afterwards (the DOM standard does not specify in which order attached
events should be fired). So at the bottom of my zone I have a
scriptmyFunction();/script block.

Seems to work, although is probably a horrible hack and not the right
way to do things... :)

R.



On Thu, 2010-12-16 at 11:45 -0300, Nicolas Barrera wrote:
 Yes, it's true it might not be the fastest or easiest way, but
 I think it's good that Tapestry forces you to things the right way.
 
 Nicolás.-



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



T5 Guide: Building T5.2.4 Application Using Netbeans 6.9.1

2010-12-16 Thread ael

1. File-New Project
2. Choose-Maven-Maven Project
3. Maven Archetype-Click Add
4. Specify Archetype Detail
a. group id: org.apache.tapestry
b. artifact id: quickstart
c. version: 5.2.4
d. repository: http://repo1.maven.org/maven2
5. Select your created Archetype-Next
6. Project Name-Finish.
7. Wait for the Application to be created. (Processing Archetype)

Wait for the libraries to be downloaded. ^_^

You have a working Tapestry Application... 

Thank Guys GOOD JOB :)
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Guide-Building-T5-2-4-Application-Using-Netbeans-6-9-1-tp3308754p3308754.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: Progress indicator and AJAX example?

2010-12-14 Thread Newham, Cameron
Thanks Taha for going to the trouble of providing source.

 It is very simple.

LOL. When people say this it usually isn't! And I'm afraid my knowledge of AJAX 
and Javascript make your code fairly impenetrable to me. When I use your code I 
just get a dialogue box tell me that the page says {} was returned and the 
value on the page is printed as undefined.

I've read your follow-up below and looked at the code and understand the gist 
of how it works but I'm afraid I don't understand what is wrong.

Thanks,
c.


-Original Message-
From: Taha Hafeez [mailto:tawus.tapes...@gmail.com] 
Sent: 12 December 2010 01:35
To: Tapestry users
Subject: Re: T5: Progress indicator and AJAX example?

Hi

It is very simple. In ProgressBar#afterRender an event timer is created
which is passed on to javascript. Javascript is a periodicExecuter
with period passed as a parameter. For each period it calls the event url
with the previous value of percentage as a parameter.

When the event is called onTimer() method is invoked in ProgressBar which
triggers an update event and expects a percentage value.
It then returns this percentage as a JSON object to the javascript ajax
call.

Finally javascript calls the method passed as clientFunc parameter of the
ProgressBar. In case the percentage has reached 100, it stops the
PeriodicExecuter

regards
Taha

2010/12/11 françois facon fra.fa...@gmail.com

 Hi Taha,

 Thanks for sharing your code.

 It make me discover the CaptureResultCallback (new in 5.2).

 If I understand well your sample, to get progress value
 the progressBar component raise a server side event called 'update' and
 get the value from this callback.

 is it right?




 2010/12/11 Taha Hafeez tawus.tapes...@gmail.com

  Hi,
 
  Here is a simple example
 
  Java Code :-
 
  import org.apache.tapestry5.BindingConstants;
  import org.apache.tapestry5.ComponentResources;
  import org.apache.tapestry5.Link;
  import org.apache.tapestry5.MarkupWriter;
  import org.apache.tapestry5.annotations.AfterRender;
  import org.apache.tapestry5.annotations.Environmental;
  import org.apache.tapestry5.annotations.Import;
  import org.apache.tapestry5.annotations.Parameter;
  import org.apache.tapestry5.internal.util.CaptureResultCallback;
  import org.apache.tapestry5.ioc.annotations.Inject;
  import org.apache.tapestry5.json.JSONObject;
  import org.apache.tapestry5.services.Request;
  import org.apache.tapestry5.services.javascript.JavaScriptSupport;
 
  @Import(library = progressbar.js)
  public class ProgressBar {
@Parameter(value = 1, defaultPrefix=BindingConstants.LITERAL)
private int period;
 
@Parameter(defaultPrefix = BindingConstants.LITERAL)
private String clientFunc;
 
@Inject
private ComponentResources resources;
 
@Environmental
private JavaScriptSupport javaScriptSupport;
 
@Inject
private Request request;
 
@AfterRender
void afterRender(MarkupWriter writer){
   Link link = resources.createEventLink(timer);
   JSONObject spec = new JSONObject();
   spec.put(url, link.toAbsoluteURI());
   spec.put(period, period);
   spec.put(clientFunc, clientFunc);
   javaScriptSupport.addScript(new ProgressBar(%s);, spec);
}
 
Object onTimer(){
   JSONObject spec = new JSONObject();
   double value = 0.0;
   try {
  value = Double.parseDouble(request.getParameter(value));
   }catch(NumberFormatException nfe){
  return spec;
   }
 
   CaptureResultCallbackDouble callback = new
  CaptureResultCallbackDouble();
   resources.triggerEvent(update, new Object[]{value}, callback);
   value = callback.getResult();
   System.out.println(Value =  + value);
   spec.put(value, value);
   return  spec;
}
  }
 
  JavaScript Code :-
 
  ProgressBar = Class.create({
initialize:function(spec){
   this.value = 0;
   this.url = spec.url;
   this.clientFunc = spec.clientFunc;
   this.executer = new PeriodicalExecuter(this.execute.bind(this),
  spec.period);
},
 
execute:function(transport){
   new Ajax.Request(this.url + ?value= + this.value, {
  method:get,
  onSuccess:function(transport){
  this.onSuccess(transport);
  }.bind(this)
   }, this.period);
},
 
onSuccess:function(transport){
   var json = transport.responseText.evalJSON();
   if(typeof(json.value) == undefined){
   alert(transport.responseText + : returned)
   this.stopExecuter();
   }
   this.value = json.value;
   if(this.clientFunc){
   var func = this.clientFunc +( + json.value+);
   eval(func);
   }
 
   if(json.value = 100){
  this.stopExecuter();
   }
},
 
stopExecuter:function(){
this.executer.stop();
}
  });
 
 
  Usage :-
 
   t:progressbar clientFunc=updateFunc/
   div id='progressBar'
   /div
   script
  updateFunc = function(percentage){
 $(progressBar).update

RE: T5: Progress indicator and AJAX example?

2010-12-14 Thread Newham, Cameron
Further to this.

The part I think I am not understanding that is critical to the operation of 
this is:

resources.triggerEvent(update, new Object[]{value}, callback);
value = callback.getResult();

getResult() is always null. So I'm failing to understand how you are getting 
value set (it triggers an event - but...?)  Sorry if this seems obvious, but it 
unfortunately isn't to me.

c.


-Original Message-
From: Newham, Cameron [mailto:cameron.new...@bl.uk] 
Sent: 14 December 2010 09:35
To: Tapestry users
Subject: RE: T5: Progress indicator and AJAX example?

Thanks Taha for going to the trouble of providing source.

 It is very simple.

LOL. When people say this it usually isn't! And I'm afraid my knowledge of AJAX 
and Javascript make your code fairly impenetrable to me. When I use your code I 
just get a dialogue box tell me that the page says {} was returned and the 
value on the page is printed as undefined.

I've read your follow-up below and looked at the code and understand the gist 
of how it works but I'm afraid I don't understand what is wrong.

Thanks,
c.


-Original Message-
From: Taha Hafeez [mailto:tawus.tapes...@gmail.com] 
Sent: 12 December 2010 01:35
To: Tapestry users
Subject: Re: T5: Progress indicator and AJAX example?

Hi

It is very simple. In ProgressBar#afterRender an event timer is created
which is passed on to javascript. Javascript is a periodicExecuter
with period passed as a parameter. For each period it calls the event url
with the previous value of percentage as a parameter.

When the event is called onTimer() method is invoked in ProgressBar which
triggers an update event and expects a percentage value.
It then returns this percentage as a JSON object to the javascript ajax
call.

Finally javascript calls the method passed as clientFunc parameter of the
ProgressBar. In case the percentage has reached 100, it stops the
PeriodicExecuter

regards
Taha

2010/12/11 françois facon fra.fa...@gmail.com

 Hi Taha,

 Thanks for sharing your code.

 It make me discover the CaptureResultCallback (new in 5.2).

 If I understand well your sample, to get progress value
 the progressBar component raise a server side event called 'update' and
 get the value from this callback.

 is it right?




 2010/12/11 Taha Hafeez tawus.tapes...@gmail.com

  Hi,
 
  Here is a simple example
 
  Java Code :-
 
  import org.apache.tapestry5.BindingConstants;
  import org.apache.tapestry5.ComponentResources;
  import org.apache.tapestry5.Link;
  import org.apache.tapestry5.MarkupWriter;
  import org.apache.tapestry5.annotations.AfterRender;
  import org.apache.tapestry5.annotations.Environmental;
  import org.apache.tapestry5.annotations.Import;
  import org.apache.tapestry5.annotations.Parameter;
  import org.apache.tapestry5.internal.util.CaptureResultCallback;
  import org.apache.tapestry5.ioc.annotations.Inject;
  import org.apache.tapestry5.json.JSONObject;
  import org.apache.tapestry5.services.Request;
  import org.apache.tapestry5.services.javascript.JavaScriptSupport;
 
  @Import(library = progressbar.js)
  public class ProgressBar {
@Parameter(value = 1, defaultPrefix=BindingConstants.LITERAL)
private int period;
 
@Parameter(defaultPrefix = BindingConstants.LITERAL)
private String clientFunc;
 
@Inject
private ComponentResources resources;
 
@Environmental
private JavaScriptSupport javaScriptSupport;
 
@Inject
private Request request;
 
@AfterRender
void afterRender(MarkupWriter writer){
   Link link = resources.createEventLink(timer);
   JSONObject spec = new JSONObject();
   spec.put(url, link.toAbsoluteURI());
   spec.put(period, period);
   spec.put(clientFunc, clientFunc);
   javaScriptSupport.addScript(new ProgressBar(%s);, spec);
}
 
Object onTimer(){
   JSONObject spec = new JSONObject();
   double value = 0.0;
   try {
  value = Double.parseDouble(request.getParameter(value));
   }catch(NumberFormatException nfe){
  return spec;
   }
 
   CaptureResultCallbackDouble callback = new
  CaptureResultCallbackDouble();
   resources.triggerEvent(update, new Object[]{value}, callback);
   value = callback.getResult();
   System.out.println(Value =  + value);
   spec.put(value, value);
   return  spec;
}
  }
 
  JavaScript Code :-
 
  ProgressBar = Class.create({
initialize:function(spec){
   this.value = 0;
   this.url = spec.url;
   this.clientFunc = spec.clientFunc;
   this.executer = new PeriodicalExecuter(this.execute.bind(this),
  spec.period);
},
 
execute:function(transport){
   new Ajax.Request(this.url + ?value= + this.value, {
  method:get,
  onSuccess:function(transport){
  this.onSuccess(transport);
  }.bind(this)
   }, this.period);
},
 
onSuccess:function(transport){
   var json = transport.responseText.evalJSON();
   if(typeof(json.value

Re: T5: Progress indicator and AJAX example?

2010-12-14 Thread Thiago H. de Paula Figueiredo
On Tue, 14 Dec 2010 07:35:22 -0200, Newham, Cameron cameron.new...@bl.uk  
wrote:



Thanks Taha for going to the trouble of providing source.


It is very simple.


LOL. When people say this it usually isn't! And I'm afraid my knowledge  
of AJAX and Javascript make your code fairly impenetrable to me.


Let's rephrase that. It is very simple as long as you know JavaScript  
well. :) The JavaScript-Tapestry interfacing is easy. ;)


--
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: Progress indicator and AJAX example?

2010-12-14 Thread Taha Hafeez
Hi,

The reason that it did not work is because you have to handle the event
onUpdate in your page otherwise it throws a NPE. I have modified that and
indicated that in bold.

The alert that you saw was a debug alert...(Oops!!).

Java

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.internal.util.CaptureResultCallback;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;

@Import(library = progressbar.js)
public class ProgressBar {
   @Parameter(value = 1, defaultPrefix=BindingConstants.LITERAL)
   private int period;

   @Parameter(defaultPrefix = BindingConstants.LITERAL)
   private String clientFunc;

   @Inject
   private ComponentResources resources;

   @Environmental
   private JavaScriptSupport javaScriptSupport;

   @Inject
   private Request request;

   @AfterRender
   void afterRender(MarkupWriter writer){
  Link link = resources.createEventLink(timer);
  JSONObject spec = new JSONObject();
  spec.put(url, link.toAbsoluteURI());
  spec.put(period, period);
  spec.put(clientFunc, clientFunc);
  javaScriptSupport.addScript(new ProgressBar(%s);, spec);
   }

   Object onTimer(){
  JSONObject spec = new JSONObject();
  double value = 0.0;
  try {
 value = Double.parseDouble(request.getParameter(value));
  }catch(NumberFormatException nfe){
 return spec;
  }

  CaptureResultCallbackDouble callback = new
CaptureResultCallbackDouble();
  resources.triggerEvent(update, new Object[]{value}, callback);
*  if(callback.getResult() == null){*
* return spec;*
*  }*

  value = callback.getResult();
  spec.put(value, value);
  return  spec;
   }
}


Javascript

ProgressBar = Class.create({
   initialize:function(spec){
  this.value = 0;
  this.url = spec.url;
  this.clientFunc = spec.clientFunc;
  this.executer = new PeriodicalExecuter(this.execute.bind(this),
spec.period);
   },

   execute:function(transport){
  new Ajax.Request(this.url + ?value= + this.value, {
 method:get,
 onSuccess:function(transport){
   this.onSuccess(transport);
 }.bind(this)
  }, this.period);
   },

   onSuccess:function(transport){
  var json = transport.responseText.evalJSON();
  if(typeof(json.value) == undefined){
*this.stopExecuter();*
*return;*
*  }*
  this.value = json.value;
  if(this.clientFunc){
var func = this.clientFunc +( + json.value+);
eval(func);
  }

  if(json.value = 100){
this.stopExecuter();
 }
   },

   stopExecuter:function(){
  this.executer.stop();
   }
});


Usage :-
Template File

  t:progressbar t:id='progressBar' clientFunc='updateFunc'/
  div id='updateDiv'/div
  script
 var updateFunc = function(percentage){
$(updateDiv).update(percentage + %);
 }
  /script


   double onUpdateFromProgressBar(double percentage){
  return percentage + 10.0;
   }


I tested it on Firefox and Chrome and it works fine...


On Tue, Dec 14, 2010 at 4:24 PM, Newham, Cameron cameron.new...@bl.ukwrote:

 Further to this.

 The part I think I am not understanding that is critical to the operation
 of this is:

 resources.triggerEvent(update, new Object[]{value}, callback);
 value = callback.getResult();


It returns null because you did not create an event handler in your page for
update event triggered from ProgressBar component.
What is happening here is that the component is triggering an event and
tries to handle the result value from the handler but if
no handler is called the result will be null.(This case is now handled)



 getResult() is always null. So I'm failing to understand how you are
 getting value set (it triggers an event - but...?)  Sorry if this seems
 obvious, but it unfortunately isn't to me.


triggerEvent triggers an event which has to be handled by the container
event handler. This event handler's return value is
callback.getResult(). If there is not handler, it returns null.


 c.

 Hope it helps
regards
Taha




 -Original Message-
 From: Newham, Cameron [mailto:cameron.new...@bl.uk]
 Sent: 14 December 2010 09:35
 To: Tapestry users
 Subject: RE: T5: Progress indicator and AJAX example?

 Thanks Taha for going to the trouble of providing source.

  It is very simple.

 LOL. When people say this it usually isn't! And I'm afraid my knowledge of
 AJAX and Javascript make your code fairly impenetrable to me. When I use

Re: T5: Progress indicator and AJAX example?

2010-12-14 Thread Taha Hafeez
That is exactly what i meant..!

regards
Taha


On Tue, Dec 14, 2010 at 5:55 PM, Thiago H. de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Tue, 14 Dec 2010 07:35:22 -0200, Newham, Cameron cameron.new...@bl.uk
 wrote:

  Thanks Taha for going to the trouble of providing source.

  It is very simple.


 LOL. When people say this it usually isn't! And I'm afraid my knowledge of
 AJAX and Javascript make your code fairly impenetrable to me.


 Let's rephrase that. It is very simple as long as you know JavaScript well.
 :) The JavaScript-Tapestry interfacing is easy. ;)

 --
 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: Progress indicator and AJAX example?

2010-12-14 Thread Newham, Cameron

Thanks Taha.

Now it all makes sense. I don't know why I didn't see the alert() - duh!

c.


-Original Message-
From: Taha Hafeez [mailto:tawus.tapes...@gmail.com] 
Sent: 14 December 2010 17:31
To: Tapestry users
Subject: Re: T5: Progress indicator and AJAX example?

Hi,

The reason that it did not work is because you have to handle the event
onUpdate in your page otherwise it throws a NPE. I have modified that
and
indicated that in bold.

The alert that you saw was a debug alert...(Oops!!).



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



RE: T5: Progress indicator and AJAX example?

2010-12-13 Thread Newham, Cameron
Thank you Thiago and Richard.



-Original Message-
From: Thiago H. de Paula Figueiredo [mailto:thiag...@gmail.com] 
Sent: 10 December 2010 11:14
To: Tapestry users
Subject: Re: T5: Progress indicator and AJAX example?

On Fri, 10 Dec 2010 09:04:49 -0200, Newham, Cameron cameron.new...@bl.uk  
wrote:

 Hi,

Hi!

 I imagine that if I wanted just a simple field on a page that updated
 with a % then I would have Javascript make an AJAX get and obtain a
 value from the server. However, as I'm a complete newbie to AJAX, an
 example of how to do this would be extremely helpful.

The AJAX part itself is completely Tapestry-unrelated and there are many  
examples in the Internet, maybe even in this mailing list archives. I  
answered something similar yesterday. The AJAX Prototype documentation is  
here: http://api.prototypejs.org/ajax/Ajax/Request/.

 Example silly
 questions: does my field have to be in a Zone?

No, as long as you write your own JavaScript code to do and handle an AJAX  
request and then update the page DOM.

 Also, would the % value updated by my process just be held in a @Persist
 field?

Absolutely no. Just get the % value when handling the request. You don't  
even need a field for that.

-- 
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: Progress indicator and AJAX example?

2010-12-12 Thread Thiago H. de Paula Figueiredo

High quality explanation, Taha! :) Thanks for it and the example!

On Sat, 11 Dec 2010 23:34:47 -0200, Taha Hafeez tawus.tapes...@gmail.com  
wrote:



Hi

It is very simple. In ProgressBar#afterRender an event timer is created
which is passed on to javascript. Javascript is a periodicExecuter
with period passed as a parameter. For each period it calls the event url
with the previous value of percentage as a parameter.

When the event is called onTimer() method is invoked in ProgressBar which
triggers an update event and expects a percentage value.
It then returns this percentage as a JSON object to the javascript ajax
call.

Finally javascript calls the method passed as clientFunc parameter of the
ProgressBar. In case the percentage has reached 100, it stops the
PeriodicExecuter

regards
Taha

2010/12/11 françois facon fra.fa...@gmail.com


Hi Taha,

Thanks for sharing your code.

It make me discover the CaptureResultCallback (new in 5.2).

If I understand well your sample, to get progress value
the progressBar component raise a server side event called 'update' and
get the value from this callback.

is it right?




2010/12/11 Taha Hafeez tawus.tapes...@gmail.com

 Hi,

 Here is a simple example

 Java Code :-

 import org.apache.tapestry5.BindingConstants;
 import org.apache.tapestry5.ComponentResources;
 import org.apache.tapestry5.Link;
 import org.apache.tapestry5.MarkupWriter;
 import org.apache.tapestry5.annotations.AfterRender;
 import org.apache.tapestry5.annotations.Environmental;
 import org.apache.tapestry5.annotations.Import;
 import org.apache.tapestry5.annotations.Parameter;
 import org.apache.tapestry5.internal.util.CaptureResultCallback;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.json.JSONObject;
 import org.apache.tapestry5.services.Request;
 import org.apache.tapestry5.services.javascript.JavaScriptSupport;

 @Import(library = progressbar.js)
 public class ProgressBar {
   @Parameter(value = 1, defaultPrefix=BindingConstants.LITERAL)
   private int period;

   @Parameter(defaultPrefix = BindingConstants.LITERAL)
   private String clientFunc;

   @Inject
   private ComponentResources resources;

   @Environmental
   private JavaScriptSupport javaScriptSupport;

   @Inject
   private Request request;

   @AfterRender
   void afterRender(MarkupWriter writer){
  Link link = resources.createEventLink(timer);
  JSONObject spec = new JSONObject();
  spec.put(url, link.toAbsoluteURI());
  spec.put(period, period);
  spec.put(clientFunc, clientFunc);
  javaScriptSupport.addScript(new ProgressBar(%s);, spec);
   }

   Object onTimer(){
  JSONObject spec = new JSONObject();
  double value = 0.0;
  try {
 value = Double.parseDouble(request.getParameter(value));
  }catch(NumberFormatException nfe){
 return spec;
  }

  CaptureResultCallbackDouble callback = new
 CaptureResultCallbackDouble();
  resources.triggerEvent(update, new Object[]{value}, callback);
  value = callback.getResult();
  System.out.println(Value =  + value);
  spec.put(value, value);
  return  spec;
   }
 }

 JavaScript Code :-

 ProgressBar = Class.create({
   initialize:function(spec){
  this.value = 0;
  this.url = spec.url;
  this.clientFunc = spec.clientFunc;
  this.executer = new PeriodicalExecuter(this.execute.bind(this),
 spec.period);
   },

   execute:function(transport){
  new Ajax.Request(this.url + ?value= + this.value, {
 method:get,
 onSuccess:function(transport){
 this.onSuccess(transport);
 }.bind(this)
  }, this.period);
   },

   onSuccess:function(transport){
  var json = transport.responseText.evalJSON();
  if(typeof(json.value) == undefined){
  alert(transport.responseText + : returned)
  this.stopExecuter();
  }
  this.value = json.value;
  if(this.clientFunc){
  var func = this.clientFunc +( + json.value+);
  eval(func);
  }

  if(json.value = 100){
 this.stopExecuter();
  }
   },

   stopExecuter:function(){
   this.executer.stop();
   }
 });


 Usage :-

  t:progressbar clientFunc=updateFunc/
  div id='progressBar'
  /div
  script
 updateFunc = function(percentage){
$(progressBar).update(percentage + %);
 };
  /script


 Hope it helps
 regards
 Taha

 On Fri, Dec 10, 2010 at 6:55 PM, Richard Hill r...@su3analytics.com
 wrote:

  Hi Cameron,
 
  For an example of how to make an ajax call from your own js see the
mail
  I sent yesterday.
 
  Richard.
 
 
 
  On Fri, 2010-12-10 at 09:14 -0200, Thiago H. de Paula Figueiredo  
wrote:

   On Fri, 10 Dec 2010 09:04:49 -0200, Newham, Cameron 
  cameron.new...@bl.uk
   wrote:
  
Hi,
  
   Hi!
  
I imagine that if I wanted just a simple field on a page that
updated
with a % then I would have Javascript make an AJAX get and  
obtain a
value from the server. However, as I'm a complete 

Re: T5: Progress indicator and AJAX example?

2010-12-11 Thread françois facon
Hi Taha,

Thanks for sharing your code.

It make me discover the CaptureResultCallback (new in 5.2).

If I understand well your sample, to get progress value
the progressBar component raise a server side event called 'update' and
get the value from this callback.

is it right?




2010/12/11 Taha Hafeez tawus.tapes...@gmail.com

 Hi,

 Here is a simple example

 Java Code :-

 import org.apache.tapestry5.BindingConstants;
 import org.apache.tapestry5.ComponentResources;
 import org.apache.tapestry5.Link;
 import org.apache.tapestry5.MarkupWriter;
 import org.apache.tapestry5.annotations.AfterRender;
 import org.apache.tapestry5.annotations.Environmental;
 import org.apache.tapestry5.annotations.Import;
 import org.apache.tapestry5.annotations.Parameter;
 import org.apache.tapestry5.internal.util.CaptureResultCallback;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.json.JSONObject;
 import org.apache.tapestry5.services.Request;
 import org.apache.tapestry5.services.javascript.JavaScriptSupport;

 @Import(library = progressbar.js)
 public class ProgressBar {
   @Parameter(value = 1, defaultPrefix=BindingConstants.LITERAL)
   private int period;

   @Parameter(defaultPrefix = BindingConstants.LITERAL)
   private String clientFunc;

   @Inject
   private ComponentResources resources;

   @Environmental
   private JavaScriptSupport javaScriptSupport;

   @Inject
   private Request request;

   @AfterRender
   void afterRender(MarkupWriter writer){
  Link link = resources.createEventLink(timer);
  JSONObject spec = new JSONObject();
  spec.put(url, link.toAbsoluteURI());
  spec.put(period, period);
  spec.put(clientFunc, clientFunc);
  javaScriptSupport.addScript(new ProgressBar(%s);, spec);
   }

   Object onTimer(){
  JSONObject spec = new JSONObject();
  double value = 0.0;
  try {
 value = Double.parseDouble(request.getParameter(value));
  }catch(NumberFormatException nfe){
 return spec;
  }

  CaptureResultCallbackDouble callback = new
 CaptureResultCallbackDouble();
  resources.triggerEvent(update, new Object[]{value}, callback);
  value = callback.getResult();
  System.out.println(Value =  + value);
  spec.put(value, value);
  return  spec;
   }
 }

 JavaScript Code :-

 ProgressBar = Class.create({
   initialize:function(spec){
  this.value = 0;
  this.url = spec.url;
  this.clientFunc = spec.clientFunc;
  this.executer = new PeriodicalExecuter(this.execute.bind(this),
 spec.period);
   },

   execute:function(transport){
  new Ajax.Request(this.url + ?value= + this.value, {
 method:get,
 onSuccess:function(transport){
 this.onSuccess(transport);
 }.bind(this)
  }, this.period);
   },

   onSuccess:function(transport){
  var json = transport.responseText.evalJSON();
  if(typeof(json.value) == undefined){
  alert(transport.responseText + : returned)
  this.stopExecuter();
  }
  this.value = json.value;
  if(this.clientFunc){
  var func = this.clientFunc +( + json.value+);
  eval(func);
  }

  if(json.value = 100){
 this.stopExecuter();
  }
   },

   stopExecuter:function(){
   this.executer.stop();
   }
 });


 Usage :-

  t:progressbar clientFunc=updateFunc/
  div id='progressBar'
  /div
  script
 updateFunc = function(percentage){
$(progressBar).update(percentage + %);
 };
  /script


 Hope it helps
 regards
 Taha

 On Fri, Dec 10, 2010 at 6:55 PM, Richard Hill r...@su3analytics.com
 wrote:

  Hi Cameron,
 
  For an example of how to make an ajax call from your own js see the mail
  I sent yesterday.
 
  Richard.
 
 
 
  On Fri, 2010-12-10 at 09:14 -0200, Thiago H. de Paula Figueiredo wrote:
   On Fri, 10 Dec 2010 09:04:49 -0200, Newham, Cameron 
  cameron.new...@bl.uk
   wrote:
  
Hi,
  
   Hi!
  
I imagine that if I wanted just a simple field on a page that updated
with a % then I would have Javascript make an AJAX get and obtain a
value from the server. However, as I'm a complete newbie to AJAX, an
example of how to do this would be extremely helpful.
  
   The AJAX part itself is completely Tapestry-unrelated and there are
 many
   examples in the Internet, maybe even in this mailing list archives. I
   answered something similar yesterday. The AJAX Prototype documentation
 is
   here: http://api.prototypejs.org/ajax/Ajax/Request/.
  
Example silly
questions: does my field have to be in a Zone?
  
   No, as long as you write your own JavaScript code to do and handle an
  AJAX
   request and then update the page DOM.
  
Also, would the % value updated by my process just be held in a
  @Persist
field?
  
   Absolutely no. Just get the % value when handling the request. You
 don't
   even need a field for that.
  
 
 
 
  -
  To unsubscribe, 

Re: T5: t:errors not displaying when form has a zone

2010-12-11 Thread Thiago H. de Paula Figueiredo
On Sat, 11 Dec 2010 05:50:28 -0200, Angelo C. angelochen...@gmail.com  
wrote:



Hi,


Hi!

	I got a form like this, t:errors got displayed, but if I put a zone in  
the form, errors are not shown, why?


You're not updating the form. If you had a Zone surrounding the Form, the  
errors would be shown, because it would be updated.



t:form t:id=myform  zone=myzone
t:errors/
/t:form
 t:zone t:id=myzone 
/t:zone



t:block id=preview
/t:block




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



T5: Progress indicator and AJAX example?

2010-12-10 Thread Newham, Cameron
Hi,

 

Can anyone point me to an example of a progress indicator or, more
simply, how one would go about having a page with a % complete field? I
have a process that ingests a file and takes quite a long time and I
would like to indicate to the user how much of it has been done.

 

I recall from research I did a few months ago that there is a progress
bar in one of the T5 component archives but there are no examples as to
how to use it and I'm not even sure if it works.

 

I imagine that if I wanted just a simple field on a page that updated
with a % then I would have Javascript make an AJAX get and obtain a
value from the server. However, as I'm a complete newbie to AJAX, an
example of how to do this would be extremely helpful. Example silly
questions: does my field have to be in a Zone? Or aren't Zones relevant
seeing as I would be making the AJAX get in my own Javascript. Also,
would the % value updated by my process just be held in a @Persist
field?

 

Anyway - some pointers or hints would be greatly appreciated.

 

Regards,

c.

 

 



Re: T5: Progress indicator and AJAX example?

2010-12-10 Thread Thiago H. de Paula Figueiredo
On Fri, 10 Dec 2010 09:04:49 -0200, Newham, Cameron cameron.new...@bl.uk  
wrote:



Hi,


Hi!


I imagine that if I wanted just a simple field on a page that updated
with a % then I would have Javascript make an AJAX get and obtain a
value from the server. However, as I'm a complete newbie to AJAX, an
example of how to do this would be extremely helpful.


The AJAX part itself is completely Tapestry-unrelated and there are many  
examples in the Internet, maybe even in this mailing list archives. I  
answered something similar yesterday. The AJAX Prototype documentation is  
here: http://api.prototypejs.org/ajax/Ajax/Request/.



Example silly
questions: does my field have to be in a Zone?


No, as long as you write your own JavaScript code to do and handle an AJAX  
request and then update the page DOM.



Also, would the % value updated by my process just be held in a @Persist
field?


Absolutely no. Just get the % value when handling the request. You don't  
even need a field for that.


--
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: Progress indicator and AJAX example?

2010-12-10 Thread Richard Hill
Hi Cameron,

For an example of how to make an ajax call from your own js see the mail
I sent yesterday.

Richard.



On Fri, 2010-12-10 at 09:14 -0200, Thiago H. de Paula Figueiredo wrote:
 On Fri, 10 Dec 2010 09:04:49 -0200, Newham, Cameron cameron.new...@bl.uk  
 wrote:
 
  Hi,
 
 Hi!
 
  I imagine that if I wanted just a simple field on a page that updated
  with a % then I would have Javascript make an AJAX get and obtain a
  value from the server. However, as I'm a complete newbie to AJAX, an
  example of how to do this would be extremely helpful.
 
 The AJAX part itself is completely Tapestry-unrelated and there are many  
 examples in the Internet, maybe even in this mailing list archives. I  
 answered something similar yesterday. The AJAX Prototype documentation is  
 here: http://api.prototypejs.org/ajax/Ajax/Request/.
 
  Example silly
  questions: does my field have to be in a Zone?
 
 No, as long as you write your own JavaScript code to do and handle an AJAX  
 request and then update the page DOM.
 
  Also, would the % value updated by my process just be held in a @Persist
  field?
 
 Absolutely no. Just get the % value when handling the request. You don't  
 even need a field for that.
 



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



T5: When Flash persisted values are cleared?

2010-12-10 Thread Dmitriy Vsekhvalnov
Hi all, i'm slightly confused with @Persist(flash) and XHR requests.

I have a Message component which used to show alert/warn/info messages on
the page, it has a message property, which is flash persisted:

@Persisted(flash)
private String msg;   //+ getter and setter

On several pages it wrapped to Zone, like this:

t:zone t:id=messageZone id=messageZone show=show
update=show
span t:type=messages t:id=messages /
/t:zone


And the page event handler doing something like:

public Object onActionFromCopy()
{
messages.setMsg(Complete);
return new MultiZoneUpdate(toolZone,
toolZone).add(messageZone,messages);
}


if actionFromCopy() called via XHR request message is shown, but if i then
refresh page (non-XHR) the message is shown once more and i don't see
that FlashPersistentFieldStrategy.didReadChange(..) is called during first
XHR.

I'd like to use messages component with both XHR and non-XHR requests.

What i'm doing wrong?

Thanks.


Re: T5: When Flash persisted values are cleared?

2010-12-10 Thread Thiago H. de Paula Figueiredo
On Fri, 10 Dec 2010 12:18:22 -0200, Dmitriy Vsekhvalnov  
dvsekhval...@gmail.com wrote:



Hi all, i'm slightly confused with @Persist(flash) and XHR requests.


Hi!

A flash persisted value is cleared when it's read from the session,  
something that happens once per request AFAIK. What you see it that AJAX  
requests are processed in one request, while non-AJAX action (including  
form submission) requests are handled in two (redirect-after-post, one for  
handling the action, another for rendering a response). I guess we need  
something like a renderflash persistence, that removes the object from  
the session after a render request, AJAX or not, is finished. Meanwhile,  
try setting your field to null in a @PageDetached method.


--
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: When Flash persisted values are cleared?

2010-12-10 Thread Dmitriy Vsekhvalnov
Does @PageDetached  works with components?

On Fri, Dec 10, 2010 at 9:20 PM, Thiago H. de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Fri, 10 Dec 2010 12:18:22 -0200, Dmitriy Vsekhvalnov 
 dvsekhval...@gmail.com wrote:

  Hi all, i'm slightly confused with @Persist(flash) and XHR requests.


 Hi!

 A flash persisted value is cleared when it's read from the session,
 something that happens once per request AFAIK. What you see it that AJAX
 requests are processed in one request, while non-AJAX action (including form
 submission) requests are handled in two (redirect-after-post, one for
 handling the action, another for rendering a response). I guess we need
 something like a renderflash persistence, that removes the object from the
 session after a render request, AJAX or not, is finished. Meanwhile, try
 setting your field to null in a @PageDetached method.

 --
 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: When Flash persisted values are cleared?

2010-12-10 Thread Thiago H. de Paula Figueiredo
On Fri, 10 Dec 2010 18:55:06 -0200, Dmitriy Vsekhvalnov  
dvsekhval...@gmail.com wrote:



Does @PageDetached  works with components?


No, but you can use @CleanupRender or @AfterRender for that.

--
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: Progress indicator and AJAX example?

2010-12-10 Thread Taha Hafeez
Hi,

Here is a simple example

Java Code :-

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.internal.util.CaptureResultCallback;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;

@Import(library = progressbar.js)
public class ProgressBar {
   @Parameter(value = 1, defaultPrefix=BindingConstants.LITERAL)
   private int period;

   @Parameter(defaultPrefix = BindingConstants.LITERAL)
   private String clientFunc;

   @Inject
   private ComponentResources resources;

   @Environmental
   private JavaScriptSupport javaScriptSupport;

   @Inject
   private Request request;

   @AfterRender
   void afterRender(MarkupWriter writer){
  Link link = resources.createEventLink(timer);
  JSONObject spec = new JSONObject();
  spec.put(url, link.toAbsoluteURI());
  spec.put(period, period);
  spec.put(clientFunc, clientFunc);
  javaScriptSupport.addScript(new ProgressBar(%s);, spec);
   }

   Object onTimer(){
  JSONObject spec = new JSONObject();
  double value = 0.0;
  try {
 value = Double.parseDouble(request.getParameter(value));
  }catch(NumberFormatException nfe){
 return spec;
  }

  CaptureResultCallbackDouble callback = new
CaptureResultCallbackDouble();
  resources.triggerEvent(update, new Object[]{value}, callback);
  value = callback.getResult();
  System.out.println(Value =  + value);
  spec.put(value, value);
  return  spec;
   }
}

JavaScript Code :-

ProgressBar = Class.create({
   initialize:function(spec){
  this.value = 0;
  this.url = spec.url;
  this.clientFunc = spec.clientFunc;
  this.executer = new PeriodicalExecuter(this.execute.bind(this),
spec.period);
   },

   execute:function(transport){
  new Ajax.Request(this.url + ?value= + this.value, {
 method:get,
 onSuccess:function(transport){
 this.onSuccess(transport);
 }.bind(this)
  }, this.period);
   },

   onSuccess:function(transport){
  var json = transport.responseText.evalJSON();
  if(typeof(json.value) == undefined){
  alert(transport.responseText + : returned)
  this.stopExecuter();
  }
  this.value = json.value;
  if(this.clientFunc){
  var func = this.clientFunc +( + json.value+);
  eval(func);
  }

  if(json.value = 100){
 this.stopExecuter();
  }
   },

   stopExecuter:function(){
   this.executer.stop();
   }
});


Usage :-

  t:progressbar clientFunc=updateFunc/
  div id='progressBar'
  /div
  script
 updateFunc = function(percentage){
$(progressBar).update(percentage + %);
 };
  /script


Hope it helps
regards
Taha

On Fri, Dec 10, 2010 at 6:55 PM, Richard Hill r...@su3analytics.com wrote:

 Hi Cameron,

 For an example of how to make an ajax call from your own js see the mail
 I sent yesterday.

 Richard.



 On Fri, 2010-12-10 at 09:14 -0200, Thiago H. de Paula Figueiredo wrote:
  On Fri, 10 Dec 2010 09:04:49 -0200, Newham, Cameron 
 cameron.new...@bl.uk
  wrote:
 
   Hi,
 
  Hi!
 
   I imagine that if I wanted just a simple field on a page that updated
   with a % then I would have Javascript make an AJAX get and obtain a
   value from the server. However, as I'm a complete newbie to AJAX, an
   example of how to do this would be extremely helpful.
 
  The AJAX part itself is completely Tapestry-unrelated and there are many
  examples in the Internet, maybe even in this mailing list archives. I
  answered something similar yesterday. The AJAX Prototype documentation is
  here: http://api.prototypejs.org/ajax/Ajax/Request/.
 
   Example silly
   questions: does my field have to be in a Zone?
 
  No, as long as you write your own JavaScript code to do and handle an
 AJAX
  request and then update the page DOM.
 
   Also, would the % value updated by my process just be held in a
 @Persist
   field?
 
  Absolutely no. Just get the % value when handling the request. You don't
  even need a field for that.
 



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




T5: t:errors not displaying when form has a zone

2010-12-10 Thread Angelo C.

Hi,

I got a form like this, t:errors got displayed, but if I put a zone in 
the
form, errors are not shown, why?


t:form t:id=myform  zone=myzone

input t:type=textarea t:id=msg t:value=msg 
input t:type=submit name=Post t:id=Post /
input t:type=submit name=Preview t:id=Preview/

t:errors/

/t:form

 t:zone t:id=myzone 
/t:zone



t:block id=preview
  
/t:block

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-t-errors-not-displaying-when-form-has-a-zone-tp3301313p3301313.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: t:errors not displaying when form has a zone

2010-12-10 Thread Angelo C.

Hi,

I got a form like this, t:errors got displayed, but if I put a zone in 
the
form, errors are not shown, why?


t:form t:id=myform  zone=myzone

input t:type=textarea t:id=msg t:value=msg 
input t:type=submit name=Post t:id=Post /
input t:type=submit name=Preview t:id=Preview/

t:errors/

/t:form

 t:zone t:id=myzone 
/t:zone



t:block id=preview
  
/t:block

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-t-errors-not-displaying-when-form-has-a-zone-tp3301312p3301312.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 portuguese message for minimum-string-length

2010-12-08 Thread Ulrich Stärk

http://tapestry.apache.org/input-validation.html#InputValidation-CustomizingValidationMessages

Uli

On 07.12.2010 13:16, Sergio Esteves wrote:

Sorry for the previous email, the correct message is: 'Tem de inserir pelo 
menos %d characteres para
%s.'

On 07-12-2010 12:14, Sergio Esteves wrote:

Hi,

The portuguese message for 'minimum-string-length' was defined here
http://www.mail-archive.com/comm...@tapestry.apache.org/msg02541.html as 'Tem 
de inserir pelo meno
%d characteres para %s.'.
But there is an orthohraphic error in that message, and it should be like 'Tem 
de inserir pelo
meno %d characteres para %s.' (meno - menos).
How can I override that message in T5?

I tried with minLength=3[My message] but it didn't work out.

Thanks.




-
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 Auto Generated Picture Gallery (Intranet)

2010-12-08 Thread ael

This code will get pictures from the file server then put it in the template
automatically.

.tml



t:loop t:source=Imagepath t:value=imagepath1
 [img src=file:${imagepath1.filename} /]
/t:loop



.java



/**
 * Start page of application TapestryAutoLoadPictures.
 */
public class Index
{

@Inject
private AssetSource assetSource;

private File file;
private File[] listOfFiles;
private int j;
private ListImagepath listImages;
private Imagepath imagepath2;
private ListImagepath temp = new ArrayListImagepath();

@Property
private Imagepath imagepath1;

public ListImagepath getImagepath(){

listImages = temp;
return listImages;
}

public void setupRender(){

String path = //fileserver/pictures;
file = new File(path);
listOfFiles = file.listFiles();

// Clear Loaded Pictures
temp.clear();

if(listOfFiles.length  0){

for (j = 0; j  listOfFiles.length; j++) {
if (listOfFiles[j].isFile()) {

// Check for JPG Extension
if(listOfFiles[j].getName().contains(.jpg) ||
listOfFiles[j].getName().contains(.JPG)){

imagepath2 = new Imagepath(path + / +
listOfFiles[j].getName());

temp.add(imagepath2);

// Clear
imagepath2 = null;
this.imagepath2 = null;
}
}
}
}
}
}



.class (Custom Imagepath Class)



/**
 *
 * @author alan
 */
public class Imagepath implements java.io.Serializable {

private String filename;

public Imagepath(){

}

public Imagepath(String filename){
this.filename = filename;
}

public String getFilename() {
return filename;
}

public void setFilename(String filename) {
this.filename = filename;
}

}





Note: For documentation purpose only...
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Auto-Generated-Picture-Gallery-Intranet-tp3298328p3298328.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 portuguese message for minimum-string-length

2010-12-07 Thread Sergio Esteves

Hi,

The portuguese message for 'minimum-string-length' was defined here 
http://www.mail-archive.com/comm...@tapestry.apache.org/msg02541.html as 
'Tem de inserir pelo meno %d characteres para %s.'.
But there is an orthohraphic/**/error in that message, and it should be 
like 'Tem de inserir pelo meno %d characteres para %s.' (meno - menos).

How can I override that message in T5?

I tried with minLength=3[My message] but it didn't work out.

Thanks.


Re: T5 portuguese message for minimum-string-length

2010-12-07 Thread Sergio Esteves
Sorry for the previous email, the correct message is: 'Tem de inserir 
pelo menos %d characteres para %s.'


On 07-12-2010 12:14, Sergio Esteves wrote:

Hi,

The portuguese message for 'minimum-string-length' was defined here 
http://www.mail-archive.com/comm...@tapestry.apache.org/msg02541.html 
as 'Tem de inserir pelo meno %d characteres para %s.'.
But there is an orthohraphic error in that message, and it should be 
like 'Tem de inserir pelo meno %d characteres para %s.' (meno - menos).

How can I override that message in T5?

I tried with minLength=3[My message] but it didn't work out.

Thanks.




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



Re: T5: scripting

2010-12-07 Thread Werner Keil
I got some great results from the Java 6 Scripting JSR with Groovy as its
implementation in a T5 app.

We used it mainly for templating, but if you prefer simple scripting, that
would also work.

I may add some simple snippets for those who wish to see.

Werner

On Fri, Dec 3, 2010 at 8:42 PM, Angelo C. angelochen...@gmail.com wrote:


 Hi,

 I need some scripting functions in t5 app, what are the options available?
 looks like Groovy is easier, I have included the groovy-all-minimal into
 the
 app, but how to use it? looking for a sample usage, say just a service
 class
 in Groovy returning a string 'Hello', and how to call this from a page
 class
 so that it could be rendered to the browser? thanks,

 Angelo
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/T5-scripting-tp3291002p3291002.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: scripting

2010-12-07 Thread Angelo C.

Please do, that will be of great help! Thanks.


Werner Keil wrote:
 
 I got some great results from the Java 6 Scripting JSR with Groovy as its
 implementation in a T5 app.
 
 We used it mainly for templating, but if you prefer simple scripting, that
 would also work.
 
 I may add some simple snippets for those who wish to see.
 
 Werner
 
 On Fri, Dec 3, 2010 at 8:42 PM, Angelo C. angelochen...@gmail.com wrote:
 
 
 

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-scripting-tp3291002p3296689.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: scripting

2010-12-06 Thread Thiago H. de Paula Figueiredo
On Mon, 06 Dec 2010 00:54:46 -0200, Angelo C. angelochen...@gmail.com  
wrote:


was thinking of trying out GRails, now with Groovy in T5, seems that's a  
good use. so far got some services and page class up and running  
already, not

sure about any difference in performance, I presume they are more or less
same as java classes, as they are compiled into .class first.


All the performance comparisons I've seen show Java performance to be 10x  
of the Groovy one. Being a dynamic-typed language has its cost.


--
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 capture keyboard events?

2010-12-06 Thread wesleywj2

hi,

thks for reply, i've never used custom javascript and load into tapestry
before,
most of the time just use the Annotation @IncludeJavaScriptLibrary, is that
the way? 
perhaps if i have a javascript written my own, how do i include it? please
advice
-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-capture-keyboard-events-tp3293142p3293942.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 capture keyboard events?

2010-12-06 Thread Thiago H. de Paula Figueiredo
On Mon, 06 Dec 2010 10:46:08 -0200, wesleywj2 wesley...@yahoo.co.uk  
wrote:



hi,


Hi!


thks for reply, i've never used custom javascript and load into tapestry
before, most of the time just use the Annotation  
@IncludeJavaScriptLibrary, is that the way? perhaps if i have a  
javascript written my own, how do i include it? please advice


Take a look at this:  
http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained


--
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 capture keyboard events?

2010-12-06 Thread Howard Lewis Ship
That would be a function of the JavaScript running on the client-side;
JavaScript, the JS DOM, and Prototype layer ways of tracking, via events,
what keys the users has typed.  From there on, its up to your JS skills to
collect that information and, perhaps, communicate it in some form back to
the application running on the server.

On Sun, Dec 5, 2010 at 10:50 AM, wesleywj2 wesley...@yahoo.co.uk wrote:


 hi,

 i would like to know if Tapestry 5 can accept keyboard input such as CRTL
 and SHIFT and some other key like 'M' etc?

 please advice,
 wesleywj2
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/T5-capture-keyboard-events-tp3293142p3293142.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


Re: T5: scripting

2010-12-06 Thread Angelo C.

if that's the case, probably Groovy is for scripting and test code for now.


Thiago H. de Paula Figueiredo wrote:
 
 On Mon, 06 Dec 2010 00:54:46 -0200, Angelo C. angelochen...@gmail.com  
 wrote:
 
 
 All the performance comparisons I've seen show Java performance to be 10x  
 of the Groovy one. Being a dynamic-typed language has its cost.
 
 -- 
 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
 
 
 

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-scripting-tp3291002p3295149.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: scripting

2010-12-06 Thread Paul Stanton

groovy is for hippies ;)

On 7/12/2010 12:45 PM, Angelo C. wrote:

if that's the case, probably Groovy is for scripting and test code for now.


Thiago H. de Paula Figueiredo wrote:

On Mon, 06 Dec 2010 00:54:46 -0200, Angelo C.angelochen...@gmail.com
wrote:


All the performance comparisons I've seen show Java performance to be 10x
of the Groovy one. Being a dynamic-typed language has its cost.

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

2010-12-05 Thread Angelo C.

looks like not for T5, probably for an earlier version?


Wilson Ikeda wrote:
 
 I believe that this is something that should be added to tapestry site (if
 it's not already): Tapestry - Groovy integration
 
 http://groovestry.sourceforge.net/
 
 

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-scripting-tp3291002p3292772.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:scripting

2010-12-05 Thread Wilson Ikeda
Oh, sorry it was something i spotted some time ago and didnt have time to look 
more close, but found Howards blog about it : 

http://tapestryjava.blogspot.com/2007/02/tapestry-5-and-groovy.html

and looks like he is using groovy on t5 trunk integration tests :

http://comments.gmane.org/gmane.comp.jakarta.tapestry.devel/38496

But as he says, these are groovy compiled classes... don't know about using 
.groovy scripts

On Dec 5, 2010, at 8:59 AM, users-digest-h...@tapestry.apache.org wrote:

 From: Angelo C. angelochen...@gmail.com
 Date: December 4, 2010 12:12:15 AM GMT+09:00
 To: users@tapestry.apache.org
 Subject: T5: scripting
 
 looks like not for T5, probably for an earlier version? 



<    4   5   6   7   8   9   10   11   12   13   >