Re: Page template and class location

2008-04-22 Thread Michael Gerzabek

When you contribute it via

new LibraryMapping( mylib, com.mycompany.package )

you wanna browse it with http://localhost:8080/mylib/x

/M



János Jarecsni schrieb:

no :)
I tried a lot of URLs in the browser, but none worked. What URL did you use
to browse to such a page?
thx
janos


On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:
  

Exactly. Does it work now?

/M

János Jarecsni schrieb:



Hi Michael,

I have the following line in the manifest.mf of my T5 component library
JAR:

Tapestry-Module-Classes: hu.intellynet.mojito.tapestry.LibraryModule

Is it what you mean?

thx
Janos

On 21/04/2008, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:


  

Janos,
You have to provide the full class name of your Module (in your jar
file)
in the MANIFEST.MF file which is located in the META-INF directory.
More
infos on that in the two links I added my last post.



http://www.nabble.com/T5%3A-component-libraries-to12055274.html#a12055580

http://tapestry.apache.org/tapestry5/tapestry-ioc/module.html


Michael

 Original-Nachricht 




Datum: Mon, 21 Apr 2008 13:13:45 +0200
Von: János Jarecsni [EMAIL PROTECTED]
An: Tapestry users users@tapestry.apache.org
Betreff: Re: Page template and class location


  


Hi Michael,

what did you do? I did what I wrote (yes it is a library JAR, I have
the
LibraryModule class I quoted, the library name is mylib, and the


  

quoted




URLs do NOT work. What URL did you use?

thx a lot
Janos

On 21/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:


  

Hi Janos,

if your library is in a jar file read [1], else add the method you




posted


  

in your current Module. Tested it, works like a charm ;)

[1]





http://www.nabble.com/T5%3A-component-libraries-to12055274.html#a12055580




Infos on Modules:
  

http://tapestry.apache.org/tapestry5/tapestry-ioc/module.html

János Jarecsni schrieb:





Yes, but how? :) I tried various ways, none worked. The library


  

contains

  

the


following library module:

  public static void
contributeComponentClassResolver(ConfigurationLibraryMapping
configuration) {
  configuration.add(new LibraryMapping(mylib,
com.mycompany.package));
  }

In the com.mycompany.package.pages package there is the X.tml.
Pointing my browser to

http://localhost:8080/context/mylib/x
http://localhost:8080/context/mylib.x
http://localhost:8080/context/x

doesn't work either.

Thanks in advance!
Janos




  

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






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






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






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



Re: problem with example .TML

2008-04-22 Thread Michael Gerzabek

Hi Janos,

take a look at the upgrade notes. Close to the bottom the change of the 
BeanModel signature is documented. Now you need mode.exlude(..) instead 
of model.remove(..).


Regards,
Michael

[1] http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html

János Jarecsni schrieb:

Hi,

I have upgraded from 5.0.10 to 5.0.11 and a .TML which worked before now
throws this:

An unexpected application exception has occurred.

Render queue error in SetupRender[AddCelebrity:celebrity.editor]: Exception
instantiating instance of com.packtpub.celebrities.model.Celebrity (for
component 'AddCelebrity:celebrity.editor'): Error invoking constructor
com.packtpub.celebrities.model.Celebrity(String, String, Date, Occupation)
(at Celebrity.java:18) (for service 'BeanModelSource'): No service
implements the interface java.util.Date.

The .TML code:

html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
head
titleCelebrity Collector: Adding New Celebrity/title
link rel=stylesheet href=${styles} type=text/css/
/head
body
h1Adding New Celebrity/h1

t:beaneditform t:id=celebrity t:submitLabel=Save
remove=id

reorder=firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography
t:parameter name=biography
table cellpadding=0 cellspacing=0tr
tdt:t5components.editor t:id=biography
t:value=celebrity.biography
t:toolbarSet=Medium t:width=350
t:height=200//td/tr
/table
  /t:parameter
/t:beaneditform
/body
/html
and the model class (Celebrity):

package com.packtpub.celebrities.model;

import java.util.Date;

public class Celebrity {
private Date dateOfBirth;
// some fields omitted

public Celebrity() {
}

public Celebrity(String firstName, String lastName,
Date dateOfBirth, Occupation occupation) {
this.firstName = firstName;
this.lastName = lastName;
this.dateOfBirth = dateOfBirth;
this.occupation = occupation;
}

public Date getDateOfBirth() {
return dateOfBirth;
}

public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
// more methods follow
}


Can you tell me what am I doing wrong?
thx
janos

  



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



Re: problem with example .TML

2008-04-22 Thread János Jarecsni
Hi Michael,

I had a look... but it does not make too much sense for me :) Where do I use
model.remove() now? Or do you mean I should change the remove attribute in

 t:beaneditform t:id=celebrity t:submitLabel=Save
   remove=id

to exclude=id? (I tried even this, but nothing changed).

As far as I see this, there is some complain about no service implementing
java.util.Date (whatever that should mean). It is obviously trying to
instantiate a model class to use for bean editing. This worked so far, now
it can't instantiate.

thx!
janos

On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:

 Hi Janos,

 take a look at the upgrade notes. Close to the bottom the change of the
 BeanModel signature is documented. Now you need mode.exlude(..) instead of
 model.remove(..).

 Regards,
 Michael

 [1] http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html

 János Jarecsni schrieb:

  Hi,
 
  I have upgraded from 5.0.10 to 5.0.11 and a .TML which worked before now
  throws this:
 
  An unexpected application exception has occurred.
 
  Render queue error in SetupRender[AddCelebrity:celebrity.editor]:
  Exception
  instantiating instance of com.packtpub.celebrities.model.Celebrity (for
  component 'AddCelebrity:celebrity.editor'): Error invoking constructor
  com.packtpub.celebrities.model.Celebrity(String, String, Date,
  Occupation)
  (at Celebrity.java:18) (for service 'BeanModelSource'): No service
  implements the interface java.util.Date.
 
  The .TML code:
 
  html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
 head
 titleCelebrity Collector: Adding New Celebrity/title
 link rel=stylesheet href=${styles} type=text/css/
 /head
 body
 h1Adding New Celebrity/h1
 
 t:beaneditform t:id=celebrity t:submitLabel=Save
 remove=id
 
 
  reorder=firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography
 t:parameter name=biography
 table cellpadding=0 cellspacing=0tr
 tdt:t5components.editor t:id=biography
  t:value=celebrity.biography
 t:toolbarSet=Medium t:width=350
  t:height=200//td/tr
 /table
   /t:parameter
 /t:beaneditform
 /body
  /html
  and the model class (Celebrity):
 
  package com.packtpub.celebrities.model;
 
  import java.util.Date;
 
  public class Celebrity {
 private Date dateOfBirth;
 // some fields omitted
 
 public Celebrity() {
 }
 
 public Celebrity(String firstName, String lastName,
 Date dateOfBirth, Occupation occupation) {
 this.firstName = firstName;
 this.lastName = lastName;
 this.dateOfBirth = dateOfBirth;
 this.occupation = occupation;
 }
 
 public Date getDateOfBirth() {
 return dateOfBirth;
 }
 
 public void setDateOfBirth(Date dateOfBirth) {
 this.dateOfBirth = dateOfBirth;
 }
 // more methods follow
  }
 
 
  Can you tell me what am I doing wrong?
  thx
  janos
 
 
 


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




Re: Page template and class location

2008-04-22 Thread János Jarecsni
Hm, does not work. I tried

http://localhost:8080/Celebrities/mylib/SomePage
and
http://localhost:8080/mylib/SomePage

so both with and without a context, but none worked.

cheers,
janos

On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:

 When you contribute it via

 new LibraryMapping( mylib, com.mycompany.package )

 you wanna browse it with http://localhost:8080/mylib/x

 /M



 János Jarecsni schrieb:

  no :)
  I tried a lot of URLs in the browser, but none worked. What URL did you
  use
  to browse to such a page?
  thx
  janos
 
 
  On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:
 
 
   Exactly. Does it work now?
  
   /M
  
   János Jarecsni schrieb:
  
  
  
Hi Michael,
   
I have the following line in the manifest.mf of my T5 component
library
JAR:
   
Tapestry-Module-Classes: hu.intellynet.mojito.tapestry.LibraryModule
   
Is it what you mean?
   
thx
Janos
   
On 21/04/2008, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
   
   
   
   
 Janos,
 You have to provide the full class name of your Module (in your
 jar
 file)
 in the MANIFEST.MF file which is located in the META-INF
 directory.
 More
 infos on that in the two links I added my last post.




 http://www.nabble.com/T5%3A-component-libraries-to12055274.html#a12055580

 http://tapestry.apache.org/tapestry5/tapestry-ioc/module.html


 Michael

  Original-Nachricht 




  Datum: Mon, 21 Apr 2008 13:13:45 +0200
  Von: János Jarecsni [EMAIL PROTECTED]
  An: Tapestry users users@tapestry.apache.org
  Betreff: Re: Page template and class location
 
 
 
 


  Hi Michael,
 
  what did you do? I did what I wrote (yes it is a library JAR, I
  have
  the
  LibraryModule class I quoted, the library name is mylib, and
  the
 
 
 
 
 quoted




  URLs do NOT work. What URL did you use?
 
  thx a lot
  Janos
 
  On 21/04/2008, Michael Gerzabek [EMAIL PROTECTED]
  wrote:
 
 
 
 
   Hi Janos,
  
   if your library is in a jar file read [1], else add the method
   you
  
  
  
  
  posted
 
 
 
 
   in your current Module. Tested it, works like a charm ;)
  
   [1]
  
  
  
  
  
 
 http://www.nabble.com/T5%3A-component-libraries-to12055274.html#a12055580




  Infos on Modules:
 
 
   http://tapestry.apache.org/tapestry5/tapestry-ioc/module.html
  
   János Jarecsni schrieb:
  
  
  
  
  
Yes, but how? :) I tried various ways, none worked. The
library
   
   
   
   
   contains
  
  
 
 
   the
  
  
following library module:
   
 public static void
   
contributeComponentClassResolver(ConfigurationLibraryMapping
configuration) {
 configuration.add(new LibraryMapping(mylib,
com.mycompany.package));
 }
   
In the com.mycompany.package.pages package there is the
X.tml.
Pointing my browser to
   
http://localhost:8080/context/mylib/x
http://localhost:8080/context/mylib.x
http://localhost:8080/context/x
   
doesn't work either.
   
Thanks in advance!
Janos
   
   
   
   
   
   
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail:
   [EMAIL PROTECTED]
  
  
  
  
  
  
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






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

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




Re: problem with example .TML

2008-04-22 Thread János Jarecsni
Hi Michael,

I googled for this problem and found a response to a similar problem from
you. I followed the instructions there, and succeeded. (I had to remove the
constructor which takes arguments! from the Celebrity class - until there
was this ctr besides the no-arg, it still tried to use it, no matter what
the model wanted to do).

Now the beaneditor call is like this:

t:beaneditform t:model=model t:object=celebrity
!--
t:parameter name=biography
table cellpadding=0 cellspacing=0tr
tdt:t5components.editor t:id=biography
t:value=celebrity.biography
t:toolbarSet=Medium t:width=350
t:height=200//td/tr
/table
  /t:parameter
--
/t:beaneditform

Thx!
Janos
PS: I used this info:
http://www.nabble.com/T5.0.11-beanEditForm-td16536531.html



On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:

 Hi Michael,

 I had a look... but it does not make too much sense for me :) Where do I
 use model.remove() now? Or do you mean I should change the remove attribute
 in

  t:beaneditform t:id=celebrity t:submitLabel=Save
remove=id

 to exclude=id? (I tried even this, but nothing changed).

 As far as I see this, there is some complain about no service implementing
 java.util.Date (whatever that should mean). It is obviously trying to
 instantiate a model class to use for bean editing. This worked so far, now
 it can't instantiate.

 thx!
 janos

 On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:
 
  Hi Janos,
 
  take a look at the upgrade notes. Close to the bottom the change of the
  BeanModel signature is documented. Now you need mode.exlude(..) instead of
  model.remove(..).
 
  Regards,
  Michael
 
  [1] http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html
 
  János Jarecsni schrieb:
 
   Hi,
  
   I have upgraded from 5.0.10 to 5.0.11 and a .TML which worked before
   now
   throws this:
  
   An unexpected application exception has occurred.
  
   Render queue error in SetupRender[AddCelebrity:celebrity.editor]:
   Exception
   instantiating instance of com.packtpub.celebrities.model.Celebrity
   (for
   component 'AddCelebrity:celebrity.editor'): Error invoking constructor
   com.packtpub.celebrities.model.Celebrity(String, String, Date,
   Occupation)
   (at Celebrity.java:18) (for service 'BeanModelSource'): No service
   implements the interface java.util.Date.
  
   The .TML code:
  
   html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
  head
  titleCelebrity Collector: Adding New Celebrity/title
  link rel=stylesheet href=${styles} type=text/css/
  /head
  body
  h1Adding New Celebrity/h1
  
  t:beaneditform t:id=celebrity t:submitLabel=Save
  remove=id
  
  
   reorder=firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography
  t:parameter name=biography
  table cellpadding=0 cellspacing=0tr
  tdt:t5components.editor t:id=biography
   t:value=celebrity.biography
  t:toolbarSet=Medium t:width=350
   t:height=200//td/tr
  /table
/t:parameter
  /t:beaneditform
  /body
   /html
   and the model class (Celebrity):
  
   package com.packtpub.celebrities.model;
  
   import java.util.Date;
  
   public class Celebrity {
  private Date dateOfBirth;
  // some fields omitted
  
  public Celebrity() {
  }
  
  public Celebrity(String firstName, String lastName,
  Date dateOfBirth, Occupation occupation) {
  this.firstName = firstName;
  this.lastName = lastName;
  this.dateOfBirth = dateOfBirth;
  this.occupation = occupation;
  }
  
  public Date getDateOfBirth() {
  return dateOfBirth;
  }
  
  public void setDateOfBirth(Date dateOfBirth) {
  this.dateOfBirth = dateOfBirth;
  }
  // more methods follow
   }
  
  
   Can you tell me what am I doing wrong?
   thx
   janos
  
  
  
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



validation feedback: it rocks :D

2008-04-22 Thread János Jarecsni
Just want to say I love the way the validation errors are shown now: IT IS
BEAUTIFUL!!!
:)

cheers
janos


Re: validation feedback: it rocks :D

2008-04-22 Thread Joshua Jackson
You mean the event bubbling?

On 4/22/08, János Jarecsni [EMAIL PROTECTED] wrote:
 Just want to say I love the way the validation errors are shown now: IT IS
 BEAUTIFUL!!!
 :)

 cheers
 janos



-- 
Let's show the world what we've got.

Blog: http://joshuajava.wordpress.com/

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



Re: validation feedback: it rocks :D

2008-04-22 Thread János Jarecsni
in deed :) it is much neater than the previous version (with all errors
cumulated in one place).

On 22/04/2008, Joshua Jackson [EMAIL PROTECTED] wrote:

 You mean the event bubbling?


 On 4/22/08, János Jarecsni [EMAIL PROTECTED] wrote:
  Just want to say I love the way the validation errors are shown now: IT
 IS
  BEAUTIFUL!!!
  :)
 
  cheers
  janos
 



 --
 Let's show the world what we've got.

 Blog: http://joshuajava.wordpress.com/

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




Re: validation feedback: it rocks :D

2008-04-22 Thread Joshua Jackson
On 4/22/08, János Jarecsni [EMAIL PROTECTED] wrote:
 in deed :) it is much neater than the previous version (with all errors
 cumulated in one place).

 On 22/04/2008, Joshua Jackson [EMAIL PROTECTED] wrote:
 
  You mean the event bubbling?

That feature has been around quite along time as far as I remember :-)
Did you just updated your T5 library?

-- 
Let's show the world what we've got.

Blog: http://joshuajava.wordpress.com/

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



Re: validation feedback: it rocks :D

2008-04-22 Thread János Jarecsni
yes, from 5.0.10 to 5.0.11

On 22/04/2008, Joshua Jackson [EMAIL PROTECTED] wrote:

 On 4/22/08, János Jarecsni [EMAIL PROTECTED] wrote:
  in deed :) it is much neater than the previous version (with all errors
  cumulated in one place).
 
  On 22/04/2008, Joshua Jackson [EMAIL PROTECTED] wrote:
  
   You mean the event bubbling?


 That feature has been around quite along time as far as I remember :-)
 Did you just updated your T5 library?


 --

 Let's show the world what we've got.

 Blog: http://joshuajava.wordpress.com/

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




Re: Tapestry Start

2008-04-22 Thread Filip S. Adamsen

Hi,

That feature is far from new. I'm using it on several sites in 
production and it works perfectly. :)


-Filip

zack1403 skrev:

Using T5 Components.  I was able to get rid of the error when I renamed my
classes back to what they were.  I.e: pages.project.ProjectAdd went back to
pages.project.Add etc.  I know the feature is pretty new, maybe a bug?

Zack 




Hi Zack.

By chance are you using any 3rd party component libs?

chris



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



Re: T5 actionlink, ajax zone and user onclick handler

2008-04-22 Thread Chris Lewis
I don't understand - it uses the modern DOM events system, abstracted
(partially) by tapestry.js, and further abstracted by the underlying
prototype.js library. What is it you are asking?

zack1403 wrote:
 Why doesnt tapestry attach events to the DOM instead of using onClick?

 Zack


 Chris Lewis-5 wrote:
   
 Hi Lucca,

 I'd been looking for a good example to use to write a wiki explaining
 the integration javascript by Tapestry, and your request gave me what I
 was looking for. Check out the article here:
 http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained (project
 source: http://thegodcode.net/tapestry5/jsclarity-project.zip). Apart
 from discussing in detail how T5 integrates JS, it shows how to create a
 mixin that can be added to link components. The mixin attaches js code
 to the component, so that when the link is clicked the user is presented
 with a confirmation box. Canceling the box cancels the click, while OK
 allows it to proceed as normal. This should be useful for those looking
 to add click confirmation functionality, but in your case I'm not sure
 if it will help. I ask you to try and see, but the problem will be how
 T5 attaches the js handlers for the ajax code (that is, they may fire
 before the confirmation code).

 Anyway, I think it will be helpful to those looking for such an
 explanation, and I hope it helps you.

 chris

 Luca Fossato wrote:
 
 Hi all,

 I'm playing with actionlink and zones to understand T5 ajax functions
 (Tapestry 5.0.11).
 I'd like to define an actionlink like this one:

 t:actionlink t:id=deleteLink context=myContext
 t:zone=zoneToUpdate onclick=confirm('are you sure to delete this
 record ?');delete/t:actionlink

 where the onclick handler uses a javascript confirmation dialog to ask
 to the user if he/she wants to delete the selected record.
 It seems to me the Tapestry.linkZone js function eats the user
 onclick handler and set its own - so it is not possible to execute any
 js code prior to invoke the ajax call.

 Is it correct or am I missing something ?

 I tried to fix this behaviour, modifying a bit the Tapestry.linkZone
 function (just an experiment):

 --- cut here ---

 /** Convert a form or link into a trigger of an Ajax update that
  * updates the indicated Zone.
  */
 linkZone : function(element, zoneDiv)
 {
   // ... original code until Otherwise, assume it's just an ordinary
 link. comment...

   // Otherwise, assume it's just an ordinary link.
   var onClickValue = element.getAttribute(onclick);
   if (onClickValue != null)
   {
 element.setAttribute(tapestry5_onbeforeajax,  onClickValue);
   }

   var handler = function(event)
   {
   var onBeforeAjaxRes = true;
   var onBeforeAjaxValue =
 element.getAttribute(tapestry5_onbeforeajax);
   if (onBeforeAjaxValue != null)
   {
 onBeforeAjaxRes = eval(onBeforeAjaxValue);
   }

   // execute the Ajax request only if the original onclick
 attribute was not set or if the evaluation
   // of the related function returned true;
   if (onBeforeAjaxRes === undefined || onBeforeAjaxRes)
 new Ajax.Request(element.href, { onSuccess : successHandler });

   return false;
   };

   element.onclick = handler;
 },  // end of linkZone function

 --- cut here ---

 that is a 10 minutes fix, so probably it's not the best solution.
 Anyway it seems to work fine for my experiment ;^)
 To block the execution of the ajax call, do NOT use a return statement
 inside the onclick handler. Example:

 t:actionlink t:id=deleteLink t:zone=zoneToUpdate onclick=return
 myFunction(myParam);delete/t:actionlink

 use this instead:

 t:actionlink t:id=deleteLink t:zone=zoneToUpdate
 onclick=myFunction(myParam);delete/t:actionlink

 because eval() returns the value of the last expression evaluated.
 http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:eval

 Does this stuff make sense for you ?? ;^)

 Thank you,
 Luca Fossato

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


   
   
 -- 
 http://thegodcode.net


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



 

   

-- 
http://thegodcode.net



Re: T5 actionlink, ajax zone and user onclick handler

2008-04-22 Thread Filip S. Adamsen

Umm, that's exactly what Tapestry does...

-Filip

zack1403 skrev:

Why doesnt tapestry attach events to the DOM instead of using onClick?

Zack


Chris Lewis-5 wrote:

Hi Lucca,

I'd been looking for a good example to use to write a wiki explaining
the integration javascript by Tapestry, and your request gave me what I
was looking for. Check out the article here:
http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained (project
source: http://thegodcode.net/tapestry5/jsclarity-project.zip). Apart
from discussing in detail how T5 integrates JS, it shows how to create a
mixin that can be added to link components. The mixin attaches js code
to the component, so that when the link is clicked the user is presented
with a confirmation box. Canceling the box cancels the click, while OK
allows it to proceed as normal. This should be useful for those looking
to add click confirmation functionality, but in your case I'm not sure
if it will help. I ask you to try and see, but the problem will be how
T5 attaches the js handlers for the ajax code (that is, they may fire
before the confirmation code).

Anyway, I think it will be helpful to those looking for such an
explanation, and I hope it helps you.

chris

Luca Fossato wrote:

Hi all,

I'm playing with actionlink and zones to understand T5 ajax functions
(Tapestry 5.0.11).
I'd like to define an actionlink like this one:

t:actionlink t:id=deleteLink context=myContext
t:zone=zoneToUpdate onclick=confirm('are you sure to delete this
record ?');delete/t:actionlink

where the onclick handler uses a javascript confirmation dialog to ask
to the user if he/she wants to delete the selected record.
It seems to me the Tapestry.linkZone js function eats the user
onclick handler and set its own - so it is not possible to execute any
js code prior to invoke the ajax call.

Is it correct or am I missing something ?

I tried to fix this behaviour, modifying a bit the Tapestry.linkZone
function (just an experiment):

--- cut here ---

/** Convert a form or link into a trigger of an Ajax update that
 * updates the indicated Zone.
 */
linkZone : function(element, zoneDiv)
{
  // ... original code until Otherwise, assume it's just an ordinary
link. comment...

  // Otherwise, assume it's just an ordinary link.
  var onClickValue = element.getAttribute(onclick);
  if (onClickValue != null)
  {
element.setAttribute(tapestry5_onbeforeajax,  onClickValue);
  }

  var handler = function(event)
  {
  var onBeforeAjaxRes = true;
  var onBeforeAjaxValue =
element.getAttribute(tapestry5_onbeforeajax);
  if (onBeforeAjaxValue != null)
  {
onBeforeAjaxRes = eval(onBeforeAjaxValue);
  }

  // execute the Ajax request only if the original onclick
attribute was not set or if the evaluation
  // of the related function returned true;
  if (onBeforeAjaxRes === undefined || onBeforeAjaxRes)
new Ajax.Request(element.href, { onSuccess : successHandler });

  return false;
  };

  element.onclick = handler;
},  // end of linkZone function

--- cut here ---

that is a 10 minutes fix, so probably it's not the best solution.
Anyway it seems to work fine for my experiment ;^)
To block the execution of the ajax call, do NOT use a return statement
inside the onclick handler. Example:

t:actionlink t:id=deleteLink t:zone=zoneToUpdate onclick=return
myFunction(myParam);delete/t:actionlink

use this instead:

t:actionlink t:id=deleteLink t:zone=zoneToUpdate
onclick=myFunction(myParam);delete/t:actionlink

because eval() returns the value of the last expression evaluated.
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:eval

Does this stuff make sense for you ?? ;^)

Thank you,
Luca Fossato

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


  

--
http://thegodcode.net


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







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



Re: T5 actionlink, ajax zone and user onclick handler

2008-04-22 Thread Chris Lewis
Andy,

Thanks for that, and I hope you'll find it helpful. I'd been wanting to
write it for a while, but it takes a good chunk of time to write decent
documentation/tutorials. This is why I encourage those out there who
have knowledge of specific aspects of T5 to write articles. There are
some fine ones available now, and they make using Tapestry so much easier.

Chris

Blower, Andy wrote:
 Chris,

 Just wanted to say that's a very well written wiki page which seems to pull 
 together all relevant points without being too verbose. Bravo.

 Hope you get the urge to write more.

 Andy.

   
 -Original Message-
 From: Luca Fossato [mailto:[EMAIL PROTECTED]
 Sent: 19 April 2008 22:30
 To: Tapestry users
 Subject: Re: T5 actionlink, ajax zone and user onclick handler

 Hi Chris,

 thank you !

 I will read your article and I will try to use the mixin to implement
 the confirmation dialog for my delete actionLink.
 Give me some days to digest all this stuff and to implement it into my
 test application ;^)

 Regards,
 Luca

 Chris Lewis wrote:
 
 Hi Lucca,

 I'd been looking for a good example to use to write a wiki explaining
 the integration javascript by Tapestry, and your request gave me what
   
 I
 
 was looking for. Check out the article here:
 http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained
   
 (project
 
 source: http://thegodcode.net/tapestry5/jsclarity-project.zip). Apart
 from discussing in detail how T5 integrates JS, it shows how to
   
 create a
 
 mixin that can be added to link components. The mixin attaches js
   
 code
 
 to the component, so that when the link is clicked the user is
   
 presented
 
 with a confirmation box. Canceling the box cancels the click, while
   
 OK
 
 allows it to proceed as normal. This should be useful for those
   
 looking
 
 to add click confirmation functionality, but in your case I'm not
   
 sure
 
 if it will help. I ask you to try and see, but the problem will be
   
 how
 
 T5 attaches the js handlers for the ajax code (that is, they may fire
 before the confirmation code).

 Anyway, I think it will be helpful to those looking for such an
 explanation, and I hope it helps you.

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


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


   

-- 
http://thegodcode.net



Re: problem with example .TML

2008-04-22 Thread Filip S. Adamsen

Hi,

You can also put an @Inject annotation on the constructor you want 
Tapestry to use when auto-instantiating your class. This way you can 
have multiple constructors.


-Filip

János Jarecsni skrev:

Hi Michael,

I googled for this problem and found a response to a similar problem from
you. I followed the instructions there, and succeeded. (I had to remove the
constructor which takes arguments! from the Celebrity class - until there
was this ctr besides the no-arg, it still tried to use it, no matter what
the model wanted to do).

Now the beaneditor call is like this:

t:beaneditform t:model=model t:object=celebrity
!--
t:parameter name=biography
table cellpadding=0 cellspacing=0tr
tdt:t5components.editor t:id=biography
t:value=celebrity.biography
t:toolbarSet=Medium t:width=350
t:height=200//td/tr
/table
  /t:parameter
--
/t:beaneditform

Thx!
Janos
PS: I used this info:
http://www.nabble.com/T5.0.11-beanEditForm-td16536531.html



On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:

Hi Michael,

I had a look... but it does not make too much sense for me :) Where do I
use model.remove() now? Or do you mean I should change the remove attribute
in

 t:beaneditform t:id=celebrity t:submitLabel=Save
   remove=id

to exclude=id? (I tried even this, but nothing changed).

As far as I see this, there is some complain about no service implementing
java.util.Date (whatever that should mean). It is obviously trying to
instantiate a model class to use for bean editing. This worked so far, now
it can't instantiate.

thx!
janos

On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:

Hi Janos,

take a look at the upgrade notes. Close to the bottom the change of the
BeanModel signature is documented. Now you need mode.exlude(..) instead of
model.remove(..).

Regards,
Michael

[1] http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html

János Jarecsni schrieb:


Hi,

I have upgraded from 5.0.10 to 5.0.11 and a .TML which worked before
now
throws this:

An unexpected application exception has occurred.

Render queue error in SetupRender[AddCelebrity:celebrity.editor]:
Exception
instantiating instance of com.packtpub.celebrities.model.Celebrity
(for
component 'AddCelebrity:celebrity.editor'): Error invoking constructor
com.packtpub.celebrities.model.Celebrity(String, String, Date,
Occupation)
(at Celebrity.java:18) (for service 'BeanModelSource'): No service
implements the interface java.util.Date.

The .TML code:

html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
   head
   titleCelebrity Collector: Adding New Celebrity/title
   link rel=stylesheet href=${styles} type=text/css/
   /head
   body
   h1Adding New Celebrity/h1

   t:beaneditform t:id=celebrity t:submitLabel=Save
   remove=id


reorder=firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography
   t:parameter name=biography
   table cellpadding=0 cellspacing=0tr
   tdt:t5components.editor t:id=biography
t:value=celebrity.biography
   t:toolbarSet=Medium t:width=350
t:height=200//td/tr
   /table
 /t:parameter
   /t:beaneditform
   /body
/html
and the model class (Celebrity):

package com.packtpub.celebrities.model;

import java.util.Date;

public class Celebrity {
   private Date dateOfBirth;
   // some fields omitted

   public Celebrity() {
   }

   public Celebrity(String firstName, String lastName,
   Date dateOfBirth, Occupation occupation) {
   this.firstName = firstName;
   this.lastName = lastName;
   this.dateOfBirth = dateOfBirth;
   this.occupation = occupation;
   }

   public Date getDateOfBirth() {
   return dateOfBirth;
   }

   public void setDateOfBirth(Date dateOfBirth) {
   this.dateOfBirth = dateOfBirth;
   }
   // more methods follow
}


Can you tell me what am I doing wrong?
thx
janos





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




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



Re: problem with example .TML

2008-04-22 Thread János Jarecsni
hi Filip,
and how to do that? could you include (inject :P) an example for that?
thx!
Janos

On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:

 Hi,

 You can also put an @Inject annotation on the constructor you want
 Tapestry to use when auto-instantiating your class. This way you can have
 multiple constructors.

 -Filip

 János Jarecsni skrev:

  Hi Michael,
 
  I googled for this problem and found a response to a similar problem
  from
  you. I followed the instructions there, and succeeded. (I had to remove
  the
  constructor which takes arguments! from the Celebrity class - until
  there
  was this ctr besides the no-arg, it still tried to use it, no matter
  what
  the model wanted to do).
 
  Now the beaneditor call is like this:
 
 t:beaneditform t:model=model t:object=celebrity
 !--
 t:parameter name=biography
 table cellpadding=0 cellspacing=0tr
 tdt:t5components.editor t:id=biography
  t:value=celebrity.biography
 t:toolbarSet=Medium t:width=350
  t:height=200//td/tr
 /table
   /t:parameter
 --
 /t:beaneditform
 
  Thx!
  Janos
  PS: I used this info:
  http://www.nabble.com/T5.0.11-beanEditForm-td16536531.html
 
 
 
  On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:
 
   Hi Michael,
  
   I had a look... but it does not make too much sense for me :) Where do
   I
   use model.remove() now? Or do you mean I should change the remove
   attribute
   in
  
t:beaneditform t:id=celebrity t:submitLabel=Save
 remove=id
  
   to exclude=id? (I tried even this, but nothing changed).
  
   As far as I see this, there is some complain about no service
   implementing
   java.util.Date (whatever that should mean). It is obviously trying to
   instantiate a model class to use for bean editing. This worked so far,
   now
   it can't instantiate.
  
   thx!
   janos
  
   On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:
  
Hi Janos,
   
take a look at the upgrade notes. Close to the bottom the change of
the
BeanModel signature is documented. Now you need mode.exlude(..)
instead of
model.remove(..).
   
Regards,
Michael
   
[1] http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html
   
János Jarecsni schrieb:
   
 Hi,

 I have upgraded from 5.0.10 to 5.0.11 and a .TML which worked
 before
 now
 throws this:

 An unexpected application exception has occurred.

 Render queue error in SetupRender[AddCelebrity:celebrity.editor]:
 Exception
 instantiating instance of com.packtpub.celebrities.model.Celebrity
 (for
 component 'AddCelebrity:celebrity.editor'): Error invoking
 constructor
 com.packtpub.celebrities.model.Celebrity(String, String, Date,
 Occupation)
 (at Celebrity.java:18) (for service 'BeanModelSource'): No service
 implements the interface java.util.Date.

 The .TML code:

 html xmlns:t=
 http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
   head
   titleCelebrity Collector: Adding New Celebrity/title
   link rel=stylesheet href=${styles} type=text/css/
   /head
   body
   h1Adding New Celebrity/h1

   t:beaneditform t:id=celebrity t:submitLabel=Save
   remove=id



 reorder=firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography
   t:parameter name=biography
   table cellpadding=0 cellspacing=0tr
   tdt:t5components.editor t:id=biography
 t:value=celebrity.biography
   t:toolbarSet=Medium t:width=350
 t:height=200//td/tr
   /table
 /t:parameter
   /t:beaneditform
   /body
 /html
 and the model class (Celebrity):

 package com.packtpub.celebrities.model;

 import java.util.Date;

 public class Celebrity {
   private Date dateOfBirth;
   // some fields omitted

   public Celebrity() {
   }

   public Celebrity(String firstName, String lastName,
   Date dateOfBirth, Occupation occupation) {
   this.firstName = firstName;
   this.lastName = lastName;
   this.dateOfBirth = dateOfBirth;
   this.occupation = occupation;
   }

   public Date getDateOfBirth() {
   return dateOfBirth;
   }

   public void setDateOfBirth(Date dateOfBirth) {
   this.dateOfBirth = dateOfBirth;
   }
   // more methods follow
 }


 Can you tell me what am I doing wrong?
 thx
 janos




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

Problem with select and beanEditForm

2008-04-22 Thread Tomasz Dziurko
There is a beanEditForm component

t:beanEditForm t:id=profile t:submitLabel=Utwórz profil
   exclude=id,isPerson
   reorder=name, surname, companyName, nip, sex, birthday, email,
password, phone, street, countryid


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



Re: Problem with select and beanEditForm

2008-04-22 Thread Tomasz Dziurko
Comment: Sorry for two-post-question

continuation from previous post:

and inside beanEditForm there is:

t:parameter name=countryid
t:label for=countryid/
t:select t:id=countryid t:model=countryModel t:encoder=countryEncoder
   t:value=selectedCountry t:blankOption=never/
/t:parameter

to change some default behaviour of beanEditForm.

All models, encoders are implemented as in examples in Tapestry 5,
Bulding Web Applications book.

When I run page I get message:
Render queue error in BeforeRenderTemplate[Register:countryid]: Not
supported yet.
And I have no idea what could be wrong in my code. Anyone could give any clue?

Regards,
Tomasz Dziurko

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



Re: problem with example .TML

2008-04-22 Thread Filip S. Adamsen

Hi János,

Sure can:

public class MyClass {
  ...

  @Inject
  public MyClass() {
  }

  public MyClass(Date date) {
...
  }

  ...
}

Something like that.

-Filip

János Jarecsni skrev:

hi Filip,
and how to do that? could you include (inject :P) an example for that?
thx!
Janos

On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:

Hi,

You can also put an @Inject annotation on the constructor you want
Tapestry to use when auto-instantiating your class. This way you can have
multiple constructors.

-Filip

János Jarecsni skrev:


Hi Michael,

I googled for this problem and found a response to a similar problem
from
you. I followed the instructions there, and succeeded. (I had to remove
the
constructor which takes arguments! from the Celebrity class - until
there
was this ctr besides the no-arg, it still tried to use it, no matter
what
the model wanted to do).

Now the beaneditor call is like this:

   t:beaneditform t:model=model t:object=celebrity
   !--
   t:parameter name=biography
   table cellpadding=0 cellspacing=0tr
   tdt:t5components.editor t:id=biography
t:value=celebrity.biography
   t:toolbarSet=Medium t:width=350
t:height=200//td/tr
   /table
 /t:parameter
   --
   /t:beaneditform

Thx!
Janos
PS: I used this info:
http://www.nabble.com/T5.0.11-beanEditForm-td16536531.html



On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:


Hi Michael,

I had a look... but it does not make too much sense for me :) Where do
I
use model.remove() now? Or do you mean I should change the remove
attribute
in

 t:beaneditform t:id=celebrity t:submitLabel=Save
  remove=id

to exclude=id? (I tried even this, but nothing changed).

As far as I see this, there is some complain about no service
implementing
java.util.Date (whatever that should mean). It is obviously trying to
instantiate a model class to use for bean editing. This worked so far,
now
it can't instantiate.

thx!
janos

On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:


Hi Janos,

take a look at the upgrade notes. Close to the bottom the change of
the
BeanModel signature is documented. Now you need mode.exlude(..)
instead of
model.remove(..).

Regards,
Michael

[1] http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html

János Jarecsni schrieb:

 Hi,

I have upgraded from 5.0.10 to 5.0.11 and a .TML which worked
before
now
throws this:

An unexpected application exception has occurred.

Render queue error in SetupRender[AddCelebrity:celebrity.editor]:
Exception
instantiating instance of com.packtpub.celebrities.model.Celebrity
(for
component 'AddCelebrity:celebrity.editor'): Error invoking
constructor
com.packtpub.celebrities.model.Celebrity(String, String, Date,
Occupation)
(at Celebrity.java:18) (for service 'BeanModelSource'): No service
implements the interface java.util.Date.

The .TML code:

html xmlns:t=
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
  head
  titleCelebrity Collector: Adding New Celebrity/title
  link rel=stylesheet href=${styles} type=text/css/
  /head
  body
  h1Adding New Celebrity/h1

  t:beaneditform t:id=celebrity t:submitLabel=Save
  remove=id



reorder=firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography
  t:parameter name=biography
  table cellpadding=0 cellspacing=0tr
  tdt:t5components.editor t:id=biography
t:value=celebrity.biography
  t:toolbarSet=Medium t:width=350
t:height=200//td/tr
  /table
/t:parameter
  /t:beaneditform
  /body
/html
and the model class (Celebrity):

package com.packtpub.celebrities.model;

import java.util.Date;

public class Celebrity {
  private Date dateOfBirth;
  // some fields omitted

  public Celebrity() {
  }

  public Celebrity(String firstName, String lastName,
  Date dateOfBirth, Occupation occupation) {
  this.firstName = firstName;
  this.lastName = lastName;
  this.dateOfBirth = dateOfBirth;
  this.occupation = occupation;
  }

  public Date getDateOfBirth() {
  return dateOfBirth;
  }

  public void setDateOfBirth(Date dateOfBirth) {
  this.dateOfBirth = dateOfBirth;
  }
  // more methods follow
}


Can you tell me what am I doing wrong?
thx
janos





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




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




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



Re: Problem with select and beanEditForm

2008-04-22 Thread Tomasz Dziurko
hmm... no exception in Tomcat logs nor application log. Where should I
put e.printStackTrace() method to get some more info?

-- 
Tomasz Dziurko

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



Re: Problem with select and beanEditForm

2008-04-22 Thread dhning
Isn't there any stacktrack message in the exception report page or tomcat 
console?
Maybe Filip mean this.

If there is, copy and share here.

Thanks!

DH


- Original Message - 
From: Tomasz Dziurko [EMAIL PROTECTED]
To: Tapestry users users@tapestry.apache.org
Sent: Tuesday, April 22, 2008 6:48 PM
Subject: Re: Problem with select and beanEditForm


 hmm... no exception in Tomcat logs nor application log. Where should I
 put e.printStackTrace() method to get some more info?
 
 -- 
 Tomasz Dziurko
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


Re: problem with example .TML

2008-04-22 Thread János Jarecsni
thanks, I wasn't aware of such a usage of @Inject. I thought it is for IoC
to inject some objects into the class. I will try this. And thanks!
cheers
janos

On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:

 Hi János,

 Sure can:

 public class MyClass {
  ...

  @Inject
  public MyClass() {
  }

  public MyClass(Date date) {
...
  }

  ...
 }

 Something like that.

 -Filip

 János Jarecsni skrev:

  hi Filip,
  and how to do that? could you include (inject :P) an example for that?
  thx!
  Janos
 
  On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:
 
   Hi,
  
   You can also put an @Inject annotation on the constructor you want
   Tapestry to use when auto-instantiating your class. This way you can
   have
   multiple constructors.
  
   -Filip
  
   János Jarecsni skrev:
  
Hi Michael,
   
I googled for this problem and found a response to a similar problem
from
you. I followed the instructions there, and succeeded. (I had to
remove
the
constructor which takes arguments! from the Celebrity class - until
there
was this ctr besides the no-arg, it still tried to use it, no matter
what
the model wanted to do).
   
Now the beaneditor call is like this:
   
  t:beaneditform t:model=model t:object=celebrity
  !--
  t:parameter name=biography
  table cellpadding=0 cellspacing=0tr
  tdt:t5components.editor t:id=biography
t:value=celebrity.biography
  t:toolbarSet=Medium t:width=350
t:height=200//td/tr
  /table
/t:parameter
  --
  /t:beaneditform
   
Thx!
Janos
PS: I used this info:
http://www.nabble.com/T5.0.11-beanEditForm-td16536531.html
   
   
   
On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:
   
 Hi Michael,

 I had a look... but it does not make too much sense for me :)
 Where do
 I
 use model.remove() now? Or do you mean I should change the remove
 attribute
 in

  t:beaneditform t:id=celebrity t:submitLabel=Save
  remove=id

 to exclude=id? (I tried even this, but nothing changed).

 As far as I see this, there is some complain about no service
 implementing
 java.util.Date (whatever that should mean). It is obviously trying
 to
 instantiate a model class to use for bean editing. This worked so
 far,
 now
 it can't instantiate.

 thx!
 janos

 On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:

  Hi Janos,
 
  take a look at the upgrade notes. Close to the bottom the change
  of
  the
  BeanModel signature is documented. Now you need mode.exlude(..)
  instead of
  model.remove(..).
 
  Regards,
  Michael
 
  [1]
  http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html
 
  János Jarecsni schrieb:
 
   Hi,
 
   I have upgraded from 5.0.10 to 5.0.11 and a .TML which worked
   before
   now
   throws this:
  
   An unexpected application exception has occurred.
  
   Render queue error in
   SetupRender[AddCelebrity:celebrity.editor]:
   Exception
   instantiating instance of
   com.packtpub.celebrities.model.Celebrity
   (for
   component 'AddCelebrity:celebrity.editor'): Error invoking
   constructor
   com.packtpub.celebrities.model.Celebrity(String, String, Date,
   Occupation)
   (at Celebrity.java:18) (for service 'BeanModelSource'): No
   service
   implements the interface java.util.Date.
  
   The .TML code:
  
   html xmlns:t=
   http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
head
titleCelebrity Collector: Adding New Celebrity/title
link rel=stylesheet href=${styles} type=text/css/
/head
body
h1Adding New Celebrity/h1
  
t:beaneditform t:id=celebrity t:submitLabel=Save
remove=id
  
  
  
  
   reorder=firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography
t:parameter name=biography
table cellpadding=0 cellspacing=0tr
tdt:t5components.editor t:id=biography
   t:value=celebrity.biography
t:toolbarSet=Medium t:width=350
   t:height=200//td/tr
/table
  /t:parameter
/t:beaneditform
/body
   /html
   and the model class (Celebrity):
  
   package com.packtpub.celebrities.model;
  
   import java.util.Date;
  
   public class Celebrity {
private Date dateOfBirth;
// some fields omitted
  
public Celebrity() {
}
  
public Celebrity(String firstName, String lastName,
Date 

T5 equivalent for T4 PageBeginRenderListener.pageBeginRender

2008-04-22 Thread Jan Vissers
Just out of curiosity;

What is T5's alternative for:
PageBeginRenderListener public void pageBeginRender(PageEvent event)

Thx,
-J.


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



T5 equivalent for T4 IExternalPage.activateExternalPage

2008-04-22 Thread Jan Vissers
Hi,

Just out of curiosity. What's T5 designated alternative for T4's
IExternalPage public void activateExternalPage(Object[] parameters,
IRequestCycle cycle)

Thx,
-J.



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



Re: Problem with select and beanEditForm

2008-04-22 Thread Tomasz Dziurko
I checked all logs in Tomcat dir and nothing at all.
I posted whole error message from error page in first/second post.
Maybe I should try call printStackTrace() at some methon invoked at
page render cycle?

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



Re: T5 equivalent for T4 PageBeginRenderListener.pageBeginRender

2008-04-22 Thread Chris Lewis
I think you want the pageLoaded event. Don't take my word for it:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/lifecycle.html

chris

Jan Vissers wrote:
 Just out of curiosity;

 What is T5's alternative for:
 PageBeginRenderListener public void pageBeginRender(PageEvent event)

 Thx,
 -J.


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


   

-- 
http://thegodcode.net


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



Re: Problem with select and beanEditForm

2008-04-22 Thread Filip S. Adamsen

Hi,

Sounds like production mode is on.

See Configuration Symbols and look for tapestry.production-mode at 
http://tapestry.apache.org/tapestry5/tapestry-core/guide/conf.html.


Then try again. A full stacktrace should be printed then along with lots 
of other useful information.


-Filip

On 2008-04-22 14:00, Tomasz Dziurko wrote:

I checked all logs in Tomcat dir and nothing at all.
I posted whole error message from error page in first/second post.
Maybe I should try call printStackTrace() at some methon invoked at
page render cycle?

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



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



Re: Problem with select and beanEditForm

2008-04-22 Thread Tomasz Dziurko
Yea, it helped. Just added method below into AppModule

public static void
contributeApplicationDefaults(MappedConfigurationString, String
configuration)
{
configuration.add(TapestryConstants.PRODUCTION_MODE_SYMBOL, false);
}

And it also solved my problem showing which my method caused problem
completely not connected with tapestry :)

Thank you for help, again community at users@tapestry.apache.org
showed its power and potential :)

PS: What about adding it to WIki Pages? I don't see it clearly written
in any of wiki articles. I could do it, but I am not sure is it good
idea :)

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



Re: problem with example .TML

2008-04-22 Thread János Jarecsni
Hi Filip,

the compiler (Netbeans 6) complains about @Inject that annotation type not
available for this kind of declaration.

cheers,
janos

On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:

 Hi János,

 Sure can:

 public class MyClass {
  ...

  @Inject
  public MyClass() {
  }

  public MyClass(Date date) {
...
  }

  ...
 }

 Something like that.

 -Filip

 János Jarecsni skrev:

  hi Filip,
  and how to do that? could you include (inject :P) an example for that?
  thx!
  Janos
 
  On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:
 
   Hi,
  
   You can also put an @Inject annotation on the constructor you want
   Tapestry to use when auto-instantiating your class. This way you can
   have
   multiple constructors.
  
   -Filip
  
   János Jarecsni skrev:
  
Hi Michael,
   
I googled for this problem and found a response to a similar problem
from
you. I followed the instructions there, and succeeded. (I had to
remove
the
constructor which takes arguments! from the Celebrity class - until
there
was this ctr besides the no-arg, it still tried to use it, no matter
what
the model wanted to do).
   
Now the beaneditor call is like this:
   
  t:beaneditform t:model=model t:object=celebrity
  !--
  t:parameter name=biography
  table cellpadding=0 cellspacing=0tr
  tdt:t5components.editor t:id=biography
t:value=celebrity.biography
  t:toolbarSet=Medium t:width=350
t:height=200//td/tr
  /table
/t:parameter
  --
  /t:beaneditform
   
Thx!
Janos
PS: I used this info:
http://www.nabble.com/T5.0.11-beanEditForm-td16536531.html
   
   
   
On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:
   
 Hi Michael,

 I had a look... but it does not make too much sense for me :)
 Where do
 I
 use model.remove() now? Or do you mean I should change the remove
 attribute
 in

  t:beaneditform t:id=celebrity t:submitLabel=Save
  remove=id

 to exclude=id? (I tried even this, but nothing changed).

 As far as I see this, there is some complain about no service
 implementing
 java.util.Date (whatever that should mean). It is obviously trying
 to
 instantiate a model class to use for bean editing. This worked so
 far,
 now
 it can't instantiate.

 thx!
 janos

 On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED] wrote:

  Hi Janos,
 
  take a look at the upgrade notes. Close to the bottom the change
  of
  the
  BeanModel signature is documented. Now you need mode.exlude(..)
  instead of
  model.remove(..).
 
  Regards,
  Michael
 
  [1]
  http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html
 
  János Jarecsni schrieb:
 
   Hi,
 
   I have upgraded from 5.0.10 to 5.0.11 and a .TML which worked
   before
   now
   throws this:
  
   An unexpected application exception has occurred.
  
   Render queue error in
   SetupRender[AddCelebrity:celebrity.editor]:
   Exception
   instantiating instance of
   com.packtpub.celebrities.model.Celebrity
   (for
   component 'AddCelebrity:celebrity.editor'): Error invoking
   constructor
   com.packtpub.celebrities.model.Celebrity(String, String, Date,
   Occupation)
   (at Celebrity.java:18) (for service 'BeanModelSource'): No
   service
   implements the interface java.util.Date.
  
   The .TML code:
  
   html xmlns:t=
   http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
head
titleCelebrity Collector: Adding New Celebrity/title
link rel=stylesheet href=${styles} type=text/css/
/head
body
h1Adding New Celebrity/h1
  
t:beaneditform t:id=celebrity t:submitLabel=Save
remove=id
  
  
  
  
   reorder=firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography
t:parameter name=biography
table cellpadding=0 cellspacing=0tr
tdt:t5components.editor t:id=biography
   t:value=celebrity.biography
t:toolbarSet=Medium t:width=350
   t:height=200//td/tr
/table
  /t:parameter
/t:beaneditform
/body
   /html
   and the model class (Celebrity):
  
   package com.packtpub.celebrities.model;
  
   import java.util.Date;
  
   public class Celebrity {
private Date dateOfBirth;
// some fields omitted
  
public Celebrity() {
}
  
public Celebrity(String firstName, String lastName,
Date dateOfBirth, Occupation 

Re: problem with example .TML

2008-04-22 Thread János Jarecsni
The compiler is not so much interesting, Tapestry is 5.0.11 :)

On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:

 Hi Filip,

 the compiler (Netbeans 6) complains about @Inject that annotation type
 not available for this kind of declaration.

 cheers,
 janos

 On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:
 
  Hi János,
 
  Sure can:
 
  public class MyClass {
   ...
 
   @Inject
   public MyClass() {
   }
 
   public MyClass(Date date) {
 ...
   }
 
   ...
  }
 
  Something like that.
 
  -Filip
 
  János Jarecsni skrev:
 
   hi Filip,
   and how to do that? could you include (inject :P) an example for that?
   thx!
   Janos
  
   On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:
  
Hi,
   
You can also put an @Inject annotation on the constructor you want
Tapestry to use when auto-instantiating your class. This way you can
have
multiple constructors.
   
-Filip
   
János Jarecsni skrev:
   
 Hi Michael,

 I googled for this problem and found a response to a similar
 problem
 from
 you. I followed the instructions there, and succeeded. (I had to
 remove
 the
 constructor which takes arguments! from the Celebrity class -
 until
 there
 was this ctr besides the no-arg, it still tried to use it, no
 matter
 what
 the model wanted to do).

 Now the beaneditor call is like this:

   t:beaneditform t:model=model t:object=celebrity
   !--
   t:parameter name=biography
   table cellpadding=0 cellspacing=0tr
   tdt:t5components.editor t:id=biography
 t:value=celebrity.biography
   t:toolbarSet=Medium t:width=350
 t:height=200//td/tr
   /table
 /t:parameter
   --
   /t:beaneditform

 Thx!
 Janos
 PS: I used this info:
 http://www.nabble.com/T5.0.11-beanEditForm-td16536531.html



 On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:

  Hi Michael,
 
  I had a look... but it does not make too much sense for me :)
  Where do
  I
  use model.remove() now? Or do you mean I should change the
  remove
  attribute
  in
 
   t:beaneditform t:id=celebrity t:submitLabel=Save
   remove=id
 
  to exclude=id? (I tried even this, but nothing changed).
 
  As far as I see this, there is some complain about no service
  implementing
  java.util.Date (whatever that should mean). It is obviously
  trying to
  instantiate a model class to use for bean editing. This worked
  so far,
  now
  it can't instantiate.
 
  thx!
  janos
 
  On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED]
  wrote:
 
   Hi Janos,
  
   take a look at the upgrade notes. Close to the bottom the
   change of
   the
   BeanModel signature is documented. Now you need
   mode.exlude(..)
   instead of
   model.remove(..).
  
   Regards,
   Michael
  
   [1]
   http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html
  
   János Jarecsni schrieb:
  
Hi,
  
I have upgraded from 5.0.10 to 5.0.11 and a .TML which
worked
before
now
throws this:
   
An unexpected application exception has occurred.
   
Render queue error in
SetupRender[AddCelebrity:celebrity.editor]:
Exception
instantiating instance of
com.packtpub.celebrities.model.Celebrity
(for
component 'AddCelebrity:celebrity.editor'): Error invoking
constructor
com.packtpub.celebrities.model.Celebrity(String, String,
Date,
Occupation)
(at Celebrity.java:18) (for service 'BeanModelSource'): No
service
implements the interface java.util.Date.
   
The .TML code:
   
html xmlns:t=
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
 head
 titleCelebrity Collector: Adding New
Celebrity/title
 link rel=stylesheet href=${styles}
type=text/css/
 /head
 body
 h1Adding New Celebrity/h1
   
 t:beaneditform t:id=celebrity t:submitLabel=Save
 remove=id
   
   
   
   
reorder=firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography
 t:parameter name=biography
 table cellpadding=0 cellspacing=0tr
 tdt:t5components.editor t:id=biography
t:value=celebrity.biography
 t:toolbarSet=Medium t:width=350
t:height=200//td/tr
 /table
   /t:parameter
 /t:beaneditform
 /body
/html
and the model class 

5.0.11 logging

2008-04-22 Thread János Jarecsni
Hi,

from the T5 book example app formerly I got some logging for the
TimingFilter, now I get this:

log4j:WARN No appenders could be found for logger
(org.apache.tapestry.services.TapestryModule.ServletApplicationInitializer).
log4j:WARN Please initialize the log4j system properly.

Where shall I put the log4j.conf ?

thanks
janos


Wrapping a grid

2008-04-22 Thread Andreas Pardeike

Hi,

I want to wrap a grid by putting it into a custom component. But I can't
get parameter blocks to work:

In my page I have:

t:table.Table t:source=data name=artiklar
t:parameter name=firstnamecell!/t:parameter
/t:table.Table

and in Table.tml:

t:container xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd 


t:grid source=source row=column
t:body /
/t:grid
/t:container

If I replace t:body / with t:parameter name=firstnamecell!/ 
t:parameter
it works fine, but not via the body tag. Is this a limitation, and if  
so, how

do I create a workaround?

Thnx,
Andreas Pardeike

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



RE: Problem with select and beanEditForm

2008-04-22 Thread Blower, Andy
It's already mentioned in this page:

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


 -Original Message-
 From: Tomasz Dziurko [mailto:[EMAIL PROTECTED]
 Sent: 22 April 2008 14:50
 To: Tapestry users
 Subject: Re: Problem with select and beanEditForm

 Yea, it helped. Just added method below into AppModule

 public static void
 contributeApplicationDefaults(MappedConfigurationString, String
 configuration)
 {
 configuration.add(TapestryConstants.PRODUCTION_MODE_SYMBOL,
 false);
 }

 And it also solved my problem showing which my method caused problem
 completely not connected with tapestry :)

 Thank you for help, again community at users@tapestry.apache.org
 showed its power and potential :)

 PS: What about adding it to WIki Pages? I don't see it clearly written
 in any of wiki articles. I could do it, but I am not sure is it good
 idea :)

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


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



Re: Problem with select and beanEditForm

2008-04-22 Thread Filip S. Adamsen

Ah, there it was. I was looking for that earlier.

Anyhow, glad it was solved. :)

-Filip

On 2008-04-22 16:17, Blower, Andy wrote:

It's already mentioned in this page:

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



-Original Message-
From: Tomasz Dziurko [mailto:[EMAIL PROTECTED]
Sent: 22 April 2008 14:50
To: Tapestry users
Subject: Re: Problem with select and beanEditForm

Yea, it helped. Just added method below into AppModule

public static void
contributeApplicationDefaults(MappedConfigurationString, String
configuration)
{
configuration.add(TapestryConstants.PRODUCTION_MODE_SYMBOL,
false);
}

And it also solved my problem showing which my method caused problem
completely not connected with tapestry :)

Thank you for help, again community at users@tapestry.apache.org
showed its power and potential :)

PS: What about adding it to WIki Pages? I don't see it clearly written
in any of wiki articles. I could do it, but I am not sure is it good
idea :)

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



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



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



Re: 5.0.11 logging

2008-04-22 Thread Filip S. Adamsen
I belive you want log4j.properties, not log4j.conf. You should put it in 
the root of your classpath, so src/main/resources/log4j.properties if 
you're using Maven.


-Filip

On 2008-04-22 15:59, János Jarecsni wrote:

Hi,

from the T5 book example app formerly I got some logging for the
TimingFilter, now I get this:

log4j:WARN No appenders could be found for logger
(org.apache.tapestry.services.TapestryModule.ServletApplicationInitializer).
log4j:WARN Please initialize the log4j system properly.

Where shall I put the log4j.conf ?

thanks
janos



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



Re: problem with example .TML

2008-04-22 Thread Filip S. Adamsen
Hmm, looks like this was added in 5.0.12 which hasn't been released yet. 
Sorry about that.


Not quite sure how to solve your problem, then.

-Filip

On 2008-04-22 15:43, János Jarecsni wrote:

The compiler is not so much interesting, Tapestry is 5.0.11 :)

On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:

Hi Filip,

the compiler (Netbeans 6) complains about @Inject that annotation type
not available for this kind of declaration.

cheers,
janos

On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:

Hi János,

Sure can:

public class MyClass {
 ...

 @Inject
 public MyClass() {
 }

 public MyClass(Date date) {
   ...
 }

 ...
}

Something like that.

-Filip

János Jarecsni skrev:


hi Filip,
and how to do that? could you include (inject :P) an example for that?
thx!
Janos

On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:


Hi,

You can also put an @Inject annotation on the constructor you want
Tapestry to use when auto-instantiating your class. This way you can
have
multiple constructors.

-Filip

János Jarecsni skrev:

 Hi Michael,

I googled for this problem and found a response to a similar
problem
from
you. I followed the instructions there, and succeeded. (I had to
remove
the
constructor which takes arguments! from the Celebrity class -
until
there
was this ctr besides the no-arg, it still tried to use it, no
matter
what
the model wanted to do).

Now the beaneditor call is like this:

  t:beaneditform t:model=model t:object=celebrity
  !--
  t:parameter name=biography
  table cellpadding=0 cellspacing=0tr
  tdt:t5components.editor t:id=biography
t:value=celebrity.biography
  t:toolbarSet=Medium t:width=350
t:height=200//td/tr
  /table
/t:parameter
  --
  /t:beaneditform

Thx!
Janos
PS: I used this info:
http://www.nabble.com/T5.0.11-beanEditForm-td16536531.html



On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:

 Hi Michael,

I had a look... but it does not make too much sense for me :)
Where do
I
use model.remove() now? Or do you mean I should change the
remove
attribute
in

 t:beaneditform t:id=celebrity t:submitLabel=Save
 remove=id

to exclude=id? (I tried even this, but nothing changed).

As far as I see this, there is some complain about no service
implementing
java.util.Date (whatever that should mean). It is obviously
trying to
instantiate a model class to use for bean editing. This worked
so far,
now
it can't instantiate.

thx!
janos

On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED]
wrote:

 Hi Janos,

take a look at the upgrade notes. Close to the bottom the
change of
the
BeanModel signature is documented. Now you need
mode.exlude(..)
instead of
model.remove(..).

Regards,
Michael

[1]
http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html

János Jarecsni schrieb:

 Hi,


I have upgraded from 5.0.10 to 5.0.11 and a .TML which
worked
before
now
throws this:

An unexpected application exception has occurred.

Render queue error in
SetupRender[AddCelebrity:celebrity.editor]:
Exception
instantiating instance of
com.packtpub.celebrities.model.Celebrity
(for
component 'AddCelebrity:celebrity.editor'): Error invoking
constructor
com.packtpub.celebrities.model.Celebrity(String, String,
Date,
Occupation)
(at Celebrity.java:18) (for service 'BeanModelSource'): No
service
implements the interface java.util.Date.

The .TML code:

html xmlns:t=
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
 head
 titleCelebrity Collector: Adding New
Celebrity/title
 link rel=stylesheet href=${styles}
type=text/css/
 /head
 body
 h1Adding New Celebrity/h1

 t:beaneditform t:id=celebrity t:submitLabel=Save
 remove=id




reorder=firstName,lastName,dateOfBirth,birthDateVerified,occupation,biography
 t:parameter name=biography
 table cellpadding=0 cellspacing=0tr
 tdt:t5components.editor t:id=biography
t:value=celebrity.biography
 t:toolbarSet=Medium t:width=350
t:height=200//td/tr
 /table
   /t:parameter
 /t:beaneditform
 /body
/html
and the model class (Celebrity):

package com.packtpub.celebrities.model;

import java.util.Date;

public class Celebrity {
 private Date dateOfBirth;
 // some fields omitted

 public Celebrity() {
 }

 public Celebrity(String firstName, String lastName,
 Date dateOfBirth, Occupation occupation) {
 this.firstName = firstName;
 this.lastName = lastName;
 this.dateOfBirth = dateOfBirth;
 this.occupation = occupation;
 }

 public Date getDateOfBirth() {
 return dateOfBirth;
 }

 public void setDateOfBirth(Date dateOfBirth) {
 this.dateOfBirth = dateOfBirth;
 }
 // more methods follow
}


Can you tell me what am I doing wrong?
thx
janos




-

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




Re: problem with example .TML

2008-04-22 Thread János Jarecsni
thx for the info, I can live with this for now :)
cheers,
janos

On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:

 Hmm, looks like this was added in 5.0.12 which hasn't been released yet.
 Sorry about that.

 Not quite sure how to solve your problem, then.

 -Filip

 On 2008-04-22 15:43, János Jarecsni wrote:

  The compiler is not so much interesting, Tapestry is 5.0.11 :)
 
  On 22/04/2008, János Jarecsni [EMAIL PROTECTED] wrote:
 
   Hi Filip,
  
   the compiler (Netbeans 6) complains about @Inject that annotation
   type
   not available for this kind of declaration.
  
   cheers,
   janos
  
   On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:
  
Hi János,
   
Sure can:
   
public class MyClass {
 ...
   
 @Inject
 public MyClass() {
 }
   
 public MyClass(Date date) {
  ...
 }
   
 ...
}
   
Something like that.
   
-Filip
   
János Jarecsni skrev:
   
 hi Filip,
 and how to do that? could you include (inject :P) an example for
 that?
 thx!
 Janos

 On 22/04/2008, Filip S. Adamsen [EMAIL PROTECTED] wrote:

  Hi,
 
  You can also put an @Inject annotation on the constructor you
  want
  Tapestry to use when auto-instantiating your class. This way you
  can
  have
  multiple constructors.
 
  -Filip
 
  János Jarecsni skrev:
 
   Hi Michael,
 
   I googled for this problem and found a response to a similar
   problem
   from
   you. I followed the instructions there, and succeeded. (I had
   to
   remove
   the
   constructor which takes arguments! from the Celebrity class -
   until
   there
   was this ctr besides the no-arg, it still tried to use it, no
   matter
   what
   the model wanted to do).
  
   Now the beaneditor call is like this:
  
t:beaneditform t:model=model t:object=celebrity
!--
t:parameter name=biography
table cellpadding=0 cellspacing=0tr
tdt:t5components.editor t:id=biography
   t:value=celebrity.biography
t:toolbarSet=Medium t:width=350
   t:height=200//td/tr
/table
  /t:parameter
--
/t:beaneditform
  
   Thx!
   Janos
   PS: I used this info:
   http://www.nabble.com/T5.0.11-beanEditForm-td16536531.html
  
  
  
   On 22/04/2008, János Jarecsni [EMAIL PROTECTED]
   wrote:
  
Hi Michael,
  
I had a look... but it does not make too much sense for me
:)
Where do
I
use model.remove() now? Or do you mean I should change the
remove
attribute
in
   
 t:beaneditform t:id=celebrity t:submitLabel=Save
remove=id
   
to exclude=id? (I tried even this, but nothing changed).
   
As far as I see this, there is some complain about no
service
implementing
java.util.Date (whatever that should mean). It is obviously
trying to
instantiate a model class to use for bean editing. This
worked
so far,
now
it can't instantiate.
   
thx!
janos
   
On 22/04/2008, Michael Gerzabek [EMAIL PROTECTED]
wrote:
   
 Hi Janos,
   
 take a look at the upgrade notes. Close to the bottom the
 change of
 the
 BeanModel signature is documented. Now you need
 mode.exlude(..)
 instead of
 model.remove(..).

 Regards,
 Michael

 [1]

 http://tapestry.apache.org/tapestry5/tapestry-core/upgrade.html

 János Jarecsni schrieb:

  Hi,

  I have upgraded from 5.0.10 to 5.0.11 and a .TML which
  worked
  before
  now
  throws this:
 
  An unexpected application exception has occurred.
 
  Render queue error in
  SetupRender[AddCelebrity:celebrity.editor]:
  Exception
  instantiating instance of
  com.packtpub.celebrities.model.Celebrity
  (for
  component 'AddCelebrity:celebrity.editor'): Error
  invoking
  constructor
  com.packtpub.celebrities.model.Celebrity(String, String,
  Date,
  Occupation)
  (at Celebrity.java:18) (for service 'BeanModelSource'):
  No
  service
  implements the interface java.util.Date.
 
  The .TML code:
 
  html xmlns:t=
  http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
   head
  titleCelebrity Collector: Adding New
  Celebrity/title
  link rel=stylesheet 

Re: T5: question about onValidate and form reset

2008-04-22 Thread Kevin C. Dorff

Thanks for these suggestions. First Robert Zeigler, onValidateForm is exactly
what I needed, also I found the null-safe comparison was important.

Second, your suggest about disabling the submit javascript handler was right
on. The missing piece I put together was that my onValidateForm is always
going to be called but when I added the onSelectedFromResetButton()
handler for my reset button, I just did a registrationForm.clearErrors(); to
clear any errors - as after a reset there shouldn't be any errors.

NOW, to help with some future questions: With T3/T4 it was pretty easy to
determine what methods to use for what, just look at the objects I was
extending or implementing and I could see what method to implement or
override to get what functionality. But since T5 uses POJO's, I am left
trying to discover methods like

   onSubmit
   onValidateForm
   onValidateFromPassword
   onSelectedFromResetButton

some of these are intuitive, some are absolutely not. Is there a source that
just talks about for Pages, Services, Forms, Form Buttons, etc. all the
method names (format of method names) Tapestry will try to evoke, their
order, when, etc? Sometimes it seem that the component reference is explicit
on this, often (such as onValidate) it seems the component reference doesn't
mention these at all - or maybe I just am missing something.

Thanks! Loving Tapestry5 so far (when I am not stumped).
Kevin
-- 
View this message in context: 
http://www.nabble.com/T5%3A-question-about-onValidate-and-form-reset-tp16809659p16824702.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: T5 equivalent for T4 IExternalPage.activateExternalPage

2008-04-22 Thread Davor Hrg
I think it is:
public void onActivate(String param1, int param2, Entity param3...){
}



On Tue, Apr 22, 2008 at 1:58 PM, Jan Vissers [EMAIL PROTECTED] wrote:

 Hi,

 Just out of curiosity. What's T5 designated alternative for T4's
 IExternalPage public void activateExternalPage(Object[] parameters,
 IRequestCycle cycle)

 Thx,
 -J.



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




Threading issues with DB operations on OS X

2008-04-22 Thread Moritz Gmelin

Hi,

There seems to be some threading issues when doing database updates  
from page to page.
E.G. we have a page that displays a list of elements in a Database  
table and a button that you can click to add a new entry.
The button is a ActionLink. Its method handler adds an element to the  
database table and returns the user to the same page.
Normally, for each click of the button, I can see one row added to the  
database and visible in the grid on the page. But sometimes if I click  
the button, the content of the grid does not change although I can see  
that an element was added to the database.
From other similar problems we have with the application, I would  
guess, that the display of the new page happens with a new database  
session, where the old session's transaction (to add the element) is  
not yet finished.
The environment we use is OS X with Java 1.5.0 and a PostgreSQL  
Database.

Has anybody else seen this behaviour?
Is there somewhere  I can for a transaction to be completely finished  
before the new page is activated ?


Thanks

Moritz

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



Re: T5 equivalent for T4 IExternalPage.activateExternalPage

2008-04-22 Thread nicholas Krul
technically*, I think that all you need to do is set the page up so that its
onPassivate() call is 'correct' (and so will become input to the onActivate
call). Then return the page object (or page class). Tapesty should wrap it
up in passivate/activate calls automatically.

Personally, I think String[] should be supported, but in 5.11 it isn't.
Hmm... Is there any way to request this?

Thanks

--nK

*I'm a user, not a dev.


On Tue, Apr 22, 2008 at 4:09 PM, Davor Hrg [EMAIL PROTECTED] wrote:

 I think it is:
 public void onActivate(String param1, int param2, Entity param3...){
 }



 On Tue, Apr 22, 2008 at 1:58 PM, Jan Vissers [EMAIL PROTECTED]
 wrote:

  Hi,
 
  Just out of curiosity. What's T5 designated alternative for T4's
  IExternalPage public void activateExternalPage(Object[] parameters,
  IRequestCycle cycle)
 
  Thx,
  -J.
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: Threading issues with DB operations on OS X

2008-04-22 Thread Davor Hrg
what version of tapestry is it ?

there has been a recent fix that changes the way trasactions are handled.
before that database connections were on autocommit and sometimes that
caused
the problems you describe.
if you commit explicitely the problem will most likely be gone ...

Davor Hrg


On Tue, Apr 22, 2008 at 5:26 PM, Moritz Gmelin [EMAIL PROTECTED] wrote:

 Hi,

 There seems to be some threading issues when doing database updates from
 page to page.
 E.G. we have a page that displays a list of elements in a Database table
 and a button that you can click to add a new entry.
 The button is a ActionLink. Its method handler adds an element to the
 database table and returns the user to the same page.
 Normally, for each click of the button, I can see one row added to the
 database and visible in the grid on the page. But sometimes if I click the
 button, the content of the grid does not change although I can see that an
 element was added to the database.
 From other similar problems we have with the application, I would guess,
 that the display of the new page happens with a new database session, where
 the old session's transaction (to add the element) is not yet finished.
 The environment we use is OS X with Java 1.5.0 and a PostgreSQL Database.
 Has anybody else seen this behaviour?
 Is there somewhere  I can for a transaction to be completely finished
 before the new page is activated ?

 Thanks

 Moritz

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




Re: Threading issues with DB operations on OS X

2008-04-22 Thread Robert Zeigler
I assume that you are using Hibernate; there was a Jira issue filed  
(and fixed) on this recently.
Sorry, I don't recall offhand which jira issue; I don't personally use  
hibernate, so I don't pay the hibernate-related jiras much attention.


Robert

On Apr 22, 2008, at 4/2210:26 AM , Moritz Gmelin wrote:

Hi,

There seems to be some threading issues when doing database updates  
from page to page.
E.G. we have a page that displays a list of elements in a Database  
table and a button that you can click to add a new entry.
The button is a ActionLink. Its method handler adds an element to  
the database table and returns the user to the same page.
Normally, for each click of the button, I can see one row added to  
the database and visible in the grid on the page. But sometimes if I  
click the button, the content of the grid does not change although I  
can see that an element was added to the database.
From other similar problems we have with the application, I would  
guess, that the display of the new page happens with a new database  
session, where the old session's transaction (to add the element) is  
not yet finished.
The environment we use is OS X with Java 1.5.0 and a PostgreSQL  
Database.

Has anybody else seen this behaviour?
Is there somewhere  I can for a transaction to be completely  
finished before the new page is activated ?


Thanks

Moritz

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



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



Re: Threading issues with DB operations on OS X

2008-04-22 Thread Howard Lewis Ship
Yes, it does sound like

https://issues.apache.org/jira/browse/TAPESTRY-2247

which is fixed in the nightly snapshots.

On Tue, Apr 22, 2008 at 8:26 AM, Moritz Gmelin [EMAIL PROTECTED] wrote:
 Hi,

  There seems to be some threading issues when doing database updates from
 page to page.
  E.G. we have a page that displays a list of elements in a Database table
 and a button that you can click to add a new entry.
  The button is a ActionLink. Its method handler adds an element to the
 database table and returns the user to the same page.
  Normally, for each click of the button, I can see one row added to the
 database and visible in the grid on the page. But sometimes if I click the
 button, the content of the grid does not change although I can see that an
 element was added to the database.
  From other similar problems we have with the application, I would guess,
 that the display of the new page happens with a new database session, where
 the old session's transaction (to add the element) is not yet finished.
  The environment we use is OS X with Java 1.5.0 and a PostgreSQL Database.
  Has anybody else seen this behaviour?
  Is there somewhere  I can for a transaction to be completely finished
 before the new page is activated ?

  Thanks

  Moritz

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





-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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



RE: T5: Form in a loop with PropertyEditor and custom type editor

2008-04-22 Thread Jonathan Barker
Bill,

If I understand correctly what you are trying to do, you probably want to
use the context parameter on your Form element.  For example, you might
have:

t:grid source=source row=rowObject
t:parameter name=editCell
form t:type=Form t:id=editForm context=rowObject.id
!-- your select goes here --
/form
/t:parameter
/t:grid

You would then have 
public void onSuccessFromEditForm(Long id){
}

Jonathan



 -Original Message-
 From: Bill Holloway [mailto:[EMAIL PROTECTED]
 Sent: Monday, April 21, 2008 9:44 PM
 To: Tapestry users
 Subject: T5: Form in a loop with PropertyEditor and custom type editor
 
 This is kind of a reprise of an earlier e-mail, but it's more narrowed
 down
 and easy to reproduce.
 
 I have a form in a loop (in a cell parameter basically).  The form is very
 simple.  It has a propertyeditor component which edits a custom data type.
 I have defined a custom component which inherits from AbstractField to
 edit
 that type -- this custom component implements processSubmission.
 
 Looking at the parameter names coming from the submission of the form, I
 notice that the field in the looped-over form always has a _n tacked
 onto
 its parameter name.  This makes perfect sense since the form is in a loop.
 
 However, the elementName argument to process submission does not have this
 integer tacked on, and there's no way to know which parameter to pull out.
 
 Any thoughts on how to solve this dilemma?  I.e., how to capture the
 integer
 value in my custom editor so I can grab the right parameter?
 
 --
 Bill @ PeoplePad


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



T5: Zones and dojo Dialog

2008-04-22 Thread Kristina B. Taylor

Hi all,

I'm trying to use the new zone capabilities in Tapestry 5 to dynamically 
update a dojo dialog box, but so far I have been unable to get it to 
work properly.  For starters, I generate a whole bunch of actionlinks 
inside of a loop:


t:loop source=crystalSource value=currentCrystal
   t:actionlink t:id=select id=${currentCrystal?.id} 
zone=dialogZone context=${currentCrystal?.id} show=show

   ${currentCrystal?.name}
   /t:actionlink
/t:loop

Then I declare a dojo dialog inside of a zone:

t:zone t:id=dialogZone
   div id=dialog dojo11type=dijit11.Dialog style=overflow: 
auto;max-height: 300px; title=${currentCrystal?.name}

   // more content here
   /div
/t:zone

with the updated content relying on the value of currentCrystal.  I have 
a DOM event (as suggested by previous posts) injected into the page that 
watches for the click on the actionlink to launch the dialog, as well as 
an update method:


@Component
private Zone dialogZone;

public Zone onActionFromSelect(int id) {
   this.currentCrystal = crystalDAO.attach(id);
   return dialogZone;
}

void afterRender(MarkupWriter writer) {
   pageRenderSupport.addScript(Event.observe('select_7', 'click', 
function(event) {dijit11.byId('dialog').show();}););

}

Clicking this link launches the dialog box but it has the information 
for the last value of currentCrystal instead of the updated version, and 
the updated version appears directly on the page when I just want it in 
the dialog.  After analyzing the problem, I found why this is 
happening.  There are actually two dialogs declared on the page (with 
the same id).  One is outside the zone, not being updated, but is 
transformed by dojo into an actual dialog:


div id=dialog class=dijitDialog 
dijitContentPane waistate=labelledby-dialog_title wairole=dialog tabindex=-1 role=wairole:dialog aaa:labelledby=dialog_title style=overflow: 
auto; max-height: 300px; visibility: hidden; position: absolute; top: 
-px; widgetid=dialog title=


The other dialog is inside the zone but dojo is not transforming it 
into the code above.  I'm not sure whether this is because of the t-zone 
classes surrounding the zone or what.  I tried using the zone id to call 
the dialog, but I can't correctly get that id from 
dialogZone.getClientId() when I inject the script, and dojo still won't 
transform the code into a dialog.


Has anyone ever tried this with Tapestry and Dojo?  Would it be better 
to use JSON data (which I've never used)?  I'm using Tapestry 5.0.11 and 
Dojo 1.1.0.


Thanks in advance,

Kristina

--
Kristina B. Taylor

Masters Graduate Student
Department of Computer Science
Iowa State University
Email: [EMAIL PROTECTED]


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



Re: Threading issues with DB operations on OS X

2008-04-22 Thread Moritz Gmelin

Looks like my issue.
I'll give it a try.

Thanks

Am 22.04.2008 um 17:46 schrieb Howard Lewis Ship:


Yes, it does sound like

https://issues.apache.org/jira/browse/TAPESTRY-2247

which is fixed in the nightly snapshots.

On Tue, Apr 22, 2008 at 8:26 AM, Moritz Gmelin  
[EMAIL PROTECTED] wrote:

Hi,

There seems to be some threading issues when doing database updates  
from

page to page.
E.G. we have a page that displays a list of elements in a Database  
table

and a button that you can click to add a new entry.
The button is a ActionLink. Its method handler adds an element to the
database table and returns the user to the same page.
Normally, for each click of the button, I can see one row added to  
the
database and visible in the grid on the page. But sometimes if I  
click the
button, the content of the grid does not change although I can see  
that an

element was added to the database.
From other similar problems we have with the application, I would  
guess,
that the display of the new page happens with a new database  
session, where
the old session's transaction (to add the element) is not yet  
finished.
The environment we use is OS X with Java 1.5.0 and a PostgreSQL  
Database.

Has anybody else seen this behaviour?
Is there somewhere  I can for a transaction to be completely finished
before the new page is activated ?

Thanks

Moritz

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






--
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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



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



[T5] Colons in element ids?

2008-04-22 Thread Julian Wood

5.0.12-SNAP

If I make a form and put a form label combo in it:

form t:type=Form
 div
  label t:type=Label t:for=username /
  input t:type=TextField t:id=username type=text  
maxlength=15/

 /div
/form

It is rendered out like this:

label for=username id=username:labelUsername:/label
input id=username maxlength=15 name=username type=text

How can I target the the label id with a css rule?

#username:label {
color: red;
}

is illegal - well it is a pseudo-class, like a:hover. I realize there  
are other ways to get around this - my point is shouldn't tapestry be  
using something other than a colon in the identifier?


J

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



Re: [T5] Colons in element ids?

2008-04-22 Thread Peter Beshai
You could just give the label an id or a class:

form t:type=Form
 div
 label t:type=Label t:for=username id=username-label /
 input t:type=TextField t:id=username type=text maxlength=15/
 /div
/form

and use #username-label

or

form t:type=Form
 div
 label t:type=Label t:for=username  class=labelClass /
 input t:type=TextField t:id=username type=text maxlength=15/
 /div
/form

and use label.labelClass

or even something like

form t:type=Form t:id=myform
 div
 label t:type=Label t:for=username/
 input t:type=TextField t:id=username type=text maxlength=15/
 /div
/form

and use form#myform label


There are tons of ways! :-)

Peter Beshai

On Tue, Apr 22, 2008 at 1:31 PM, Julian Wood [EMAIL PROTECTED] wrote:

 5.0.12-SNAP

 If I make a form and put a form label combo in it:

 form t:type=Form
  div
  label t:type=Label t:for=username /
  input t:type=TextField t:id=username type=text maxlength=15/
  /div
 /form

 It is rendered out like this:

 label for=username id=username:labelUsername:/label
 input id=username maxlength=15 name=username type=text

 How can I target the the label id with a css rule?

 #username:label {
color: red;
 }

 is illegal - well it is a pseudo-class, like a:hover. I realize there are
 other ways to get around this - my point is shouldn't tapestry be using
 something other than a colon in the identifier?

 J

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




Re: [T5] Colons in element ids?

2008-04-22 Thread Howard Lewis Ship
That is a valid point. At the core of this issue is the way Tapestry
is responsible for doling out *unique* ids to elements of the page, as
the page is rendered. This is necessary because you may have nested
components that end up with conflicting ids very easily.

The convention of appending a suffix, seperated by a colon, was taken
on because colons are not valid component id characters, so there's no
chance of conflict.

We'll have to look into an alternative; perhaps . will work, or $.

Please add an issue to JIRA.

On Tue, Apr 22, 2008 at 10:31 AM, Julian Wood [EMAIL PROTECTED] wrote:
 5.0.12-SNAP

  If I make a form and put a form label combo in it:

  form t:type=Form
   div
   label t:type=Label t:for=username /
   input t:type=TextField t:id=username type=text maxlength=15/
   /div
  /form

  It is rendered out like this:

  label for=username id=username:labelUsername:/label
  input id=username maxlength=15 name=username type=text

  How can I target the the label id with a css rule?

  #username:label {
 color: red;
  }

  is illegal - well it is a pseudo-class, like a:hover. I realize there are
 other ways to get around this - my point is shouldn't tapestry be using
 something other than a colon in the identifier?

  J

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





-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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



Re: [T5] Colons in element ids?

2008-04-22 Thread Julian Wood

https://issues.apache.org/jira/browse/TAPESTRY-2377

I checked a bunch of alternatives, and I think the best option is one  
or more hyphens. Every other char I tried either has a purpose or is  
ignored.


J

On Apr 22, 2008, at 11:42 AM, Howard Lewis Ship wrote:


That is a valid point. At the core of this issue is the way Tapestry
is responsible for doling out *unique* ids to elements of the page, as
the page is rendered. This is necessary because you may have nested
components that end up with conflicting ids very easily.

The convention of appending a suffix, seperated by a colon, was taken
on because colons are not valid component id characters, so there's no
chance of conflict.

We'll have to look into an alternative; perhaps . will work, or $.

Please add an issue to JIRA.

On Tue, Apr 22, 2008 at 10:31 AM, Julian Wood [EMAIL PROTECTED]  
wrote:

5.0.12-SNAP

If I make a form and put a form label combo in it:

form t:type=Form
 div
 label t:type=Label t:for=username /
 input t:type=TextField t:id=username type=text  
maxlength=15/

 /div
/form

It is rendered out like this:

label for=username id=username:labelUsername:/label
input id=username maxlength=15 name=username type=text

How can I target the the label id with a css rule?

#username:label {
   color: red;
}

is illegal - well it is a pseudo-class, like a:hover. I realize  
there are
other ways to get around this - my point is shouldn't tapestry be  
using

something other than a colon in the identifier?

J

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






--
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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





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



Re: [T5] Colons in element ids?

2008-04-22 Thread Andreas Andreou
AFAIK, jsf uses colons

On Tue, Apr 22, 2008 at 10:17 PM, Julian Wood [EMAIL PROTECTED] wrote:
 https://issues.apache.org/jira/browse/TAPESTRY-2377

  I checked a bunch of alternatives, and I think the best option is one or
 more hyphens. Every other char I tried either has a purpose or is ignored.

  J



  On Apr 22, 2008, at 11:42 AM, Howard Lewis Ship wrote:


  That is a valid point. At the core of this issue is the way Tapestry
  is responsible for doling out *unique* ids to elements of the page, as
  the page is rendered. This is necessary because you may have nested
  components that end up with conflicting ids very easily.
 
  The convention of appending a suffix, seperated by a colon, was taken
  on because colons are not valid component id characters, so there's no
  chance of conflict.
 
  We'll have to look into an alternative; perhaps . will work, or $.
 
  Please add an issue to JIRA.
 
  On Tue, Apr 22, 2008 at 10:31 AM, Julian Wood [EMAIL PROTECTED] wrote:
 
   5.0.12-SNAP
  
   If I make a form and put a form label combo in it:
  
   form t:type=Form
div
label t:type=Label t:for=username /
input t:type=TextField t:id=username type=text maxlength=15/
/div
   /form
  
   It is rendered out like this:
  
   label for=username id=username:labelUsername:/label
   input id=username maxlength=15 name=username type=text
  
   How can I target the the label id with a css rule?
  
   #username:label {
 color: red;
   }
  
   is illegal - well it is a pseudo-class, like a:hover. I realize there
 are
   other ways to get around this - my point is shouldn't tapestry be using
   something other than a colon in the identifier?
  
   J
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
 
 
  --
  Howard M. Lewis Ship
 
  Creator Apache Tapestry and Apache HiveMind
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


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





-- 
Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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



Is calling IValidationDelegate.record() in pageBeginRender a good idea?

2008-04-22 Thread Gord Turner
I have question about setting an 'error state' prior to landing on a
page.

 

The requirement is that that, under certain conditions, when landing on
the page 

an error message appear and input element highlighted.

 

My attempt was to get the delegate and record an error in
pageBeginRender, as if

the user had already submitted the page and the validation delegate
caught the error.

 

The page has an input element (password) and a delegate (delegate) and I
have removed

the condition so that all pages would render with the error.

 

My original attempt resulted in:

 

Caused by: java.lang.NullPointerException: Parameter fieldName must not
be null.

 

Which after digging around the source code, I fixed by adding before the
record():

 

passwordIFormComponent.setName( password );

 

This solution works, sort of, but I can't help but wonder if there is
something I 

am missing?

 

Should I be using another tapestry life cycle 'hook'?

 

We are using Tapestry 4.0.3.

 

Thanks for any suggestions,

Gord Turner.

 

...  

  public void pageBeginRender( PageEvent event )

  {

/*

 * Get delegate.

 */

IValidationDelegate delegate = (IValidationDelegate)
getBeans().getBean(

delegate );

 

/*

 * Get password form component.

 */

IFormComponent passwordIFormComponent = (IFormComponent)
getComponent( password );

 

/*

 * Record error.

 */

//passwordIFormComponent.setName( password ); // Uncommenting this
will prevent exception

delegate.record( passwordIFormComponent,
MESSAGE_FROM_PAGE_BEGIN_RENDER );

  }

...

 

 

at
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java
:123)

at
org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:115)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)

at
com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChai
n.java:99)

at
net.exchangesolutions.loyalty.ui.session.CallSessionFilter.doFilter(Call
SessionFilter.java:41)

at
com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.
java:70)

at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.ja
va:163)

at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.j
ava:208)

at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)

at
com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)

at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)

at com.caucho.util.ThreadPool.run(ThreadPool.java:423)

at java.lang.Thread.run(Thread.java:595)

Caused by: java.lang.NullPointerException: Parameter fieldName must not
be null.

at org.apache.hivemind.util.Defense.notNull(Defense.java:41)

at
org.apache.tapestry.valid.FieldTracking.init(FieldTracking.java:59)

at
org.apache.tapestry.valid.ValidationDelegate.findCurrentTracking(Validat
ionDelegate.java:279)

at
org.apache.tapestry.valid.ValidationDelegate.record(ValidationDelegate.j
ava:225)

at
org.apache.tapestry.valid.ValidationDelegate.record(ValidationDelegate.j
ava:207)

at
org.apache.tapestry.valid.ValidationDelegate.record(ValidationDelegate.j
ava:240)

at
net.exchangesolutions.loyalty.ui.pages.cssc.CsscLogin.pageBeginRender(Cs
scLogin.java:72)

at
org.apache.tapestry.AbstractPage.firePageBeginRender(AbstractPage.java:4
78)

at
org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:268)

at
org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:366
)

... 48 more



Re: [T5] Colons in element ids?

2008-04-22 Thread Jason Lea
or you could try looking at the css spec... 
http://www.w3.org/TR/CSS21/syndata.html#escaped-characters

and use the escape character \  :)

example:

html
head
style type=text/css
   #foo\:bar { color: red;}
/style
/head
body
p id=foo:barfubar/p
/body
/html

Julian Wood wrote:

5.0.12-SNAP

If I make a form and put a form label combo in it:

form t:type=Form
  div
   label t:type=Label t:for=username /
   input t:type=TextField t:id=username type=text  
maxlength=15/

  /div
/form

It is rendered out like this:

label for=username id=username:labelUsername:/label
input id=username maxlength=15 name=username type=text

How can I target the the label id with a css rule?

#username:label {
color: red;
}

is illegal - well it is a pseudo-class, like a:hover. I realize there  
are other ways to get around this - my point is shouldn't tapestry be  
using something other than a colon in the identifier?


J

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


  


--
Jason Lea



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



Re: [T5] Colons in element ids?

2008-04-22 Thread Julian Wood

Sweet! That is a good solution.

J

On Apr 22, 2008, at 1:57 PM, Jason Lea wrote:


or you could try looking at the css spec... 
http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
and use the escape character \  :)

example:

html
head
style type=text/css
  #foo\:bar { color: red;}
/style
/head
body
p id=foo:barfubar/p
/body
/html

Julian Wood wrote:

5.0.12-SNAP

If I make a form and put a form label combo in it:

form t:type=Form
 div
  label t:type=Label t:for=username /
  input t:type=TextField t:id=username type=text   
maxlength=15/

 /div
/form

It is rendered out like this:

label for=username id=username:labelUsername:/label
input id=username maxlength=15 name=username type=text

How can I target the the label id with a css rule?

#username:label {
color: red;
}

is illegal - well it is a pseudo-class, like a:hover. I realize  
there  are other ways to get around this - my point is shouldn't  
tapestry be  using something other than a colon in the identifier?


J

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





--
Jason Lea



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





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



T5: Forms - Best Practice

2008-04-22 Thread Christoph Jäger

Hi,

Sorry for this long post. I spent quite some time now to try to figure  
out how to use forms to edit/update objects the right way (you know,  
simple, stable, elegant, easy to read, easy add things, ...). I use  
Tapestry 5.0.11. I am almost satisfied with what I came up with now,  
but some improvements need to be done. Maybe someone on this list can  
help with some ideas.


As an example, lets have a PersonEdit page, with a PersonDao injected.  
You can create new Person entries or edit existing ones. To edit an  
existing person, there is a PageLink on a PersonSearch page, which has  
the Person's primary id as context. To create a new Person, a PageLink  
with 0 as context is used. To make this work, we have onActivate() and  
onPassivate() methods in PersonEdit:


void onActivate(int id)
{
  _id = id;
  if (id == 0)
  {
_person = new Person();
  }
  else
  {
_person=personDao.get(id);
  }
}

int onPassivate()
{
  return _id;
}

This way we can avoid using @Persist on the Person property (because,  
for instance, we want a user to be able to open two browser windows,  
viewing two different Person entries side by side and edit and save  
both of them. I think this would be problematic if we use @Persist,  
but please correct me if I am wrong).


Now, editing an existing user works like this:

- click the edit user XYZ PageLink on the PersonSearch page
- in onActivate(), the personDao is used to query the Person from the  
database

- an HTML form is rendered to let the user edit the values

Up to here everything looks perfect.

- the user edits the Person's data and hits the save button

- onActivate() is called, a fresh Person is loaded from the database
- for each field in the HTML form, validation is done (if defined),  
and a property in the fresh Person instance is set if the validation  
was successful
- onValidateForm() is called if existing to allow for cross-field  
validation
- if all validations were successful, onSuccess() is called. Here we  
call _person=personDao.save(_person). This save method returns a new  
Person instance, exactly as it was written to the database (primary id  
may be generated by the database, time stamps or version numbers  
updated, ...). We use this new Person's id : _id=_person.getId() to  
make sure we have the correct if for the next onPassivate()

- onPassivate() is called
- result sent to browser, redirect
- onActivate() loads Person again
- new form is rendered

This is good, but I think it could be improved.

1. The Person is loaded from the database twice (using  
personDao.get()), and saved once. The save() method of personDao  
already gives us a new, fresh instance of Person, it seems like a  
waste to load it again after the redirect.


2. During validation, we check if there is already a Person with the  
same userid (in onValidateForm(), or in onValidateFromUserId()) and  
warn the user if this is the case. But what happens if a new Person  
with this userId is added just after onValidateForm() is called, but  
before onSuccess() is called, where we want to save? To make our  
program solid, we have to take this into account. In case save() does  
not work, we do not want to see some exception page, but the form, as  
it was filled, with a hint what might have gone wrong, so the user can  
try again. To make this possible, we have to move the save() to  
onValidateForm(), because there we can still record form errors (I  
think there is a JIRA for an improvement to this situation).


3. We want to give the user feedback of what happened. After clicking  
the save button, we want to show a message like Successfully saved  
new person information above the form (at the same place you would  
see error messages like: The first name is mandatory). The only  
thing that comes to my mind is to use @Persist to save the message  
from the onSuccess() or onValidateForm() through the redirect to the  
next page render. But now I have problems to make sure this  
@Persist'ed message is cleared and is only presented to the user  
directly after the save button was clicked.



I think to find a nice solution for these issues (you know, easy  
things should be easy to do, and a form like this does not sound very  
complex to me, so there should be an easy solution), a @Persist, which  
persists values just through the redirect would be very helpful. The  
problem is, I have no idea how this could work. But maybe an option  
like this already exists (I am sure I am not the first to have  
problems like this), and I just didn't find it.


Any ideas are welcome,

Thanks,

Christoph Jäger



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



Re: T5: Forms - Best Practice

2008-04-22 Thread nicholas Krul
@Persist(flash)
http://tapestry.apache.org/tapestry5/tapestry-core/guide/persist.html

and, since I can peddle my own wares
@Persist(flashcookie)
http://wiki.apache.org/tapestry/Tapestry5HowToUsePersistentFieldStrategy

I've had one (or two) too many glasses of wine. May your night be as good as
mine  :)

--nK

On Tue, Apr 22, 2008 at 9:54 PM, Christoph Jäger 
[EMAIL PROTECTED] wrote:

 Hi,

 Sorry for this long post. I spent quite some time now to try to figure out
 how to use forms to edit/update objects the right way (you know, simple,
 stable, elegant, easy to read, easy add things, ...). I use Tapestry
 5.0.11. I am almost satisfied with what I came up with now, but some
 improvements need to be done. Maybe someone on this list can help with some
 ideas.

 As an example, lets have a PersonEdit page, with a PersonDao injected. You
 can create new Person entries or edit existing ones. To edit an existing
 person, there is a PageLink on a PersonSearch page, which has the Person's
 primary id as context. To create a new Person, a PageLink with 0 as context
 is used. To make this work, we have onActivate() and onPassivate() methods
 in PersonEdit:

 void onActivate(int id)
 {
  _id = id;
  if (id == 0)
  {
_person = new Person();
  }
  else
  {
_person=personDao.get(id);
  }
 }

 int onPassivate()
 {
  return _id;
 }

 This way we can avoid using @Persist on the Person property (because, for
 instance, we want a user to be able to open two browser windows, viewing two
 different Person entries side by side and edit and save both of them. I
 think this would be problematic if we use @Persist, but please correct me if
 I am wrong).

 Now, editing an existing user works like this:

 - click the edit user XYZ PageLink on the PersonSearch page
 - in onActivate(), the personDao is used to query the Person from the
 database
 - an HTML form is rendered to let the user edit the values

 Up to here everything looks perfect.

 - the user edits the Person's data and hits the save button

 - onActivate() is called, a fresh Person is loaded from the database
 - for each field in the HTML form, validation is done (if defined), and a
 property in the fresh Person instance is set if the validation was
 successful
 - onValidateForm() is called if existing to allow for cross-field
 validation
 - if all validations were successful, onSuccess() is called. Here we call
 _person=personDao.save(_person). This save method returns a new Person
 instance, exactly as it was written to the database (primary id may be
 generated by the database, time stamps or version numbers updated, ...). We
 use this new Person's id : _id=_person.getId() to make sure we have the
 correct if for the next onPassivate()
 - onPassivate() is called
 - result sent to browser, redirect
 - onActivate() loads Person again
 - new form is rendered

 This is good, but I think it could be improved.

 1. The Person is loaded from the database twice (using personDao.get()),
 and saved once. The save() method of personDao already gives us a new, fresh
 instance of Person, it seems like a waste to load it again after the
 redirect.

 2. During validation, we check if there is already a Person with the same
 userid (in onValidateForm(), or in onValidateFromUserId()) and warn the user
 if this is the case. But what happens if a new Person with this userId is
 added just after onValidateForm() is called, but before onSuccess() is
 called, where we want to save? To make our program solid, we have to take
 this into account. In case save() does not work, we do not want to see some
 exception page, but the form, as it was filled, with a hint what might have
 gone wrong, so the user can try again. To make this possible, we have to
 move the save() to onValidateForm(), because there we can still record form
 errors (I think there is a JIRA for an improvement to this situation).

 3. We want to give the user feedback of what happened. After clicking the
 save button, we want to show a message like Successfully saved new person
 information above the form (at the same place you would see error messages
 like: The first name is mandatory). The only thing that comes to my mind
 is to use @Persist to save the message from the onSuccess() or
 onValidateForm() through the redirect to the next page render. But now I
 have problems to make sure this @Persist'ed message is cleared and is only
 presented to the user directly after the save button was clicked.


 I think to find a nice solution for these issues (you know, easy things
 should be easy to do, and a form like this does not sound very complex to
 me, so there should be an easy solution), a @Persist, which persists values
 just through the redirect would be very helpful. The problem is, I have no
 idea how this could work. But maybe an option like this already exists (I am
 sure I am not the first to have problems like this), and I just didn't find
 it.

 Any ideas are welcome,

 Thanks,

 Christoph Jäger



 

Tapestry and OSGi

2008-04-22 Thread Robert Binna

Hi

I have a question towards using tapestry and OSGi. Has any one of you  
done something with Tapestry and OSGi till now?  Does anyone know  of  
some best practices, pitfalls?


Thanks a lot in advance,
Best regards, Robert

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



Re: T5: Forms - Best Practice

2008-04-22 Thread Sven Homburg
good question, waiting for the answer too.

PS: if you attach the Autocomplete mixin  to a textfield,
the onActivate called once more, if user put some data into this field.

2008/4/22, Christoph Jäger [EMAIL PROTECTED]:

 Hi,

 Sorry for this long post. I spent quite some time now to try to figure out
 how to use forms to edit/update objects the right way (you know, simple,
 stable, elegant, easy to read, easy add things, ...). I use Tapestry
 5.0.11. I am almost satisfied with what I came up with now, but some
 improvements need to be done. Maybe someone on this list can help with some
 ideas.

 As an example, lets have a PersonEdit page, with a PersonDao injected. You
 can create new Person entries or edit existing ones. To edit an existing
 person, there is a PageLink on a PersonSearch page, which has the Person's
 primary id as context. To create a new Person, a PageLink with 0 as context
 is used. To make this work, we have onActivate() and onPassivate() methods
 in PersonEdit:

 void onActivate(int id)
 {
  _id = id;
  if (id == 0)
  {
_person = new Person();
  }
  else
  {
_person=personDao.get(id);
  }
 }

 int onPassivate()
 {
  return _id;
 }

 This way we can avoid using @Persist on the Person property (because, for
 instance, we want a user to be able to open two browser windows, viewing two
 different Person entries side by side and edit and save both of them. I
 think this would be problematic if we use @Persist, but please correct me if
 I am wrong).

 Now, editing an existing user works like this:

 - click the edit user XYZ PageLink on the PersonSearch page
 - in onActivate(), the personDao is used to query the Person from the
 database
 - an HTML form is rendered to let the user edit the values

 Up to here everything looks perfect.

 - the user edits the Person's data and hits the save button

 - onActivate() is called, a fresh Person is loaded from the database
 - for each field in the HTML form, validation is done (if defined), and a
 property in the fresh Person instance is set if the validation was
 successful
 - onValidateForm() is called if existing to allow for cross-field
 validation
 - if all validations were successful, onSuccess() is called. Here we call
 _person=personDao.save(_person). This save method returns a new Person
 instance, exactly as it was written to the database (primary id may be
 generated by the database, time stamps or version numbers updated, ...). We
 use this new Person's id : _id=_person.getId() to make sure we have the
 correct if for the next onPassivate()
 - onPassivate() is called
 - result sent to browser, redirect
 - onActivate() loads Person again
 - new form is rendered

 This is good, but I think it could be improved.

 1. The Person is loaded from the database twice (using personDao.get()),
 and saved once. The save() method of personDao already gives us a new, fresh
 instance of Person, it seems like a waste to load it again after the
 redirect.

 2. During validation, we check if there is already a Person with the same
 userid (in onValidateForm(), or in onValidateFromUserId()) and warn the user
 if this is the case. But what happens if a new Person with this userId is
 added just after onValidateForm() is called, but before onSuccess() is
 called, where we want to save? To make our program solid, we have to take
 this into account. In case save() does not work, we do not want to see some
 exception page, but the form, as it was filled, with a hint what might have
 gone wrong, so the user can try again. To make this possible, we have to
 move the save() to onValidateForm(), because there we can still record form
 errors (I think there is a JIRA for an improvement to this situation).

 3. We want to give the user feedback of what happened. After clicking the
 save button, we want to show a message like Successfully saved new person
 information above the form (at the same place you would see error messages
 like: The first name is mandatory). The only thing that comes to my mind
 is to use @Persist to save the message from the onSuccess() or
 onValidateForm() through the redirect to the next page render. But now I
 have problems to make sure this @Persist'ed message is cleared and is only
 presented to the user directly after the save button was clicked.


 I think to find a nice solution for these issues (you know, easy things
 should be easy to do, and a form like this does not sound very complex to
 me, so there should be an easy solution), a @Persist, which persists values
 just through the redirect would be very helpful. The problem is, I have no
 idea how this could work. But maybe an option like this already exists (I am
 sure I am not the first to have problems like this), and I just didn't find
 it.

 Any ideas are welcome,

 Thanks,

 Christoph Jäger



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




-- 

T5: ajax component ids with namespaces

2008-04-22 Thread buckofive

Hi All,

I recently updated to Tapestry 5.0.11 from 5.0.10 and unfortunately my
custom javascript calls are broken because component id's returned from ajax
calls now have a :# next to them.  For example when I try to get a
reference to an object say $('foo') it doesn't exist because it is now
$('foo:12234') and this id changes on every ajax refresh.I read the post
from Howard about this being a namespace for ajax requests
(http://thread.gmane.org/gmane.comp.java.tapestry.user/59677/focus=59697)
but I'm a little confused as to how I get access to these nodes with scripts
now? Can the AJAX namespacing be turned off (globally or at the component
level)?  Does anyone have a workaround for this?  

Much thanks in adavanced,
B

-- 
View this message in context: 
http://www.nabble.com/T5%3A-ajax-component-ids-with-namespaces-tp16826268p16826268.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: T5: T5 and EJB3

2008-04-22 Thread Geoff Callender

Have a look at JumpStart.

http://files.doublenegative.com.au/jumpstart/

It injects a business services locator rather than the proxies, but  
it's pretty resilient.
If you develop improvements then please contribute them back for  
everyone.


Cheers,

Geoff

On 22/04/2008, at 12:48 AM, CG wrote:


Hi all,
 I am a newbie in Java Web Application programming. I am now plan to
use Tapestry 5 + EJB3 to write a web application.
After googling , I found that T4 does not support EJB3 due to
Hivemind's EJBProxyFactory service does not support EJB3 .

Therefore, I try to search again in Google for EJB3 support in T5.
I found an old mail(2006) in this mailing list which stated that T5
may wrap the EJBProxyFactory as a workaround.
I do try to find whether the new Hivemind already supported EJB3 or
not but no luck , I can't find any useful info.

I am totally new to Hivemind or Tapestry, I would like to know whether
T5 already support EJB3 or not , if yes, is there any example that can
I refer , to learn how to get my stateless bean and stateful bean work
in Tapestry UI.

Any guidance is appreciated. Thanks.

CG

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




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



Re: T5: Forms - Best Practice

2008-04-22 Thread Geoff Callender

Totally agree!  See https://issues.apache.org/jira/browse/TAPESTRY-2138

Workaround is @Persist combined with nullifying the persisted object  
in cleanupRender().


Geoff
http://files.doublenegative.com.au/jumpstart/

On 23/04/2008, at 6:54 AM, Christoph Jäger wrote:


Hi,

Sorry for this long post. I spent quite some time now to try to  
figure out how to use forms to edit/update objects the right way  
(you know, simple, stable, elegant, easy to read, easy add  
things, ...). I use Tapestry 5.0.11. I am almost satisfied with what  
I came up with now, but some improvements need to be done. Maybe  
someone on this list can help with some ideas.


As an example, lets have a PersonEdit page, with a PersonDao  
injected. You can create new Person entries or edit existing ones.  
To edit an existing person, there is a PageLink on a PersonSearch  
page, which has the Person's primary id as context. To create a new  
Person, a PageLink with 0 as context is used. To make this work, we  
have onActivate() and onPassivate() methods in PersonEdit:


void onActivate(int id)
{
 _id = id;
 if (id == 0)
 {
   _person = new Person();
 }
 else
 {
   _person=personDao.get(id);
 }
}

int onPassivate()
{
 return _id;
}

This way we can avoid using @Persist on the Person property  
(because, for instance, we want a user to be able to open two  
browser windows, viewing two different Person entries side by side  
and edit and save both of them. I think this would be problematic if  
we use @Persist, but please correct me if I am wrong).


Now, editing an existing user works like this:

- click the edit user XYZ PageLink on the PersonSearch page
- in onActivate(), the personDao is used to query the Person from  
the database

- an HTML form is rendered to let the user edit the values

Up to here everything looks perfect.

- the user edits the Person's data and hits the save button

- onActivate() is called, a fresh Person is loaded from the database
- for each field in the HTML form, validation is done (if defined),  
and a property in the fresh Person instance is set if the validation  
was successful
- onValidateForm() is called if existing to allow for cross-field  
validation
- if all validations were successful, onSuccess() is called. Here we  
call _person=personDao.save(_person). This save method returns a new  
Person instance, exactly as it was written to the database (primary  
id may be generated by the database, time stamps or version numbers  
updated, ...). We use this new Person's id : _id=_person.getId() to  
make sure we have the correct if for the next onPassivate()

- onPassivate() is called
- result sent to browser, redirect
- onActivate() loads Person again
- new form is rendered

This is good, but I think it could be improved.

1. The Person is loaded from the database twice (using  
personDao.get()), and saved once. The save() method of personDao  
already gives us a new, fresh instance of Person, it seems like a  
waste to load it again after the redirect.


2. During validation, we check if there is already a Person with the  
same userid (in onValidateForm(), or in onValidateFromUserId()) and  
warn the user if this is the case. But what happens if a new Person  
with this userId is added just after onValidateForm() is called, but  
before onSuccess() is called, where we want to save? To make our  
program solid, we have to take this into account. In case save()  
does not work, we do not want to see some exception page, but the  
form, as it was filled, with a hint what might have gone wrong, so  
the user can try again. To make this possible, we have to move the  
save() to onValidateForm(), because there we can still record form  
errors (I think there is a JIRA for an improvement to this situation).


3. We want to give the user feedback of what happened. After  
clicking the save button, we want to show a message like  
Successfully saved new person information above the form (at the  
same place you would see error messages like: The first name is  
mandatory). The only thing that comes to my mind is to use @Persist  
to save the message from the onSuccess() or onValidateForm() through  
the redirect to the next page render. But now I have problems to  
make sure this @Persist'ed message is cleared and is only presented  
to the user directly after the save button was clicked.



I think to find a nice solution for these issues (you know, easy  
things should be easy to do, and a form like this does not sound  
very complex to me, so there should be an easy solution), a  
@Persist, which persists values just through the redirect would be  
very helpful. The problem is, I have no idea how this could work.  
But maybe an option like this already exists (I am sure I am not the  
first to have problems like this), and I just didn't find it.


Any ideas are welcome,

Thanks,

Christoph Jäger



-
To unsubscribe, e-mail: [EMAIL 

[T4]hivemind variables in components

2008-04-22 Thread Patrick Moore
Hi there --

O.k. I feel silly -- but how do I use hivemind variables directly in a
component. I know how to pass hivemind variables to services. But how to use
those values in the components? For example, I would like to use the
hivemind variable 'amplafi.production' as the condition in a @If

for example,:

span jwcid=@If condition=amplafi.production
hey there amplafi.production is true!
/span

-Pat


Tapestry 5.0.12

2008-04-22 Thread Howard Lewis Ship
People have been leaving messages on my blog that they want Tapestry 5.0.12.

I don't think it's time yet.  I'm using T5 for a client project with a
fair amount of DHTML (fancy hiding and revealing menus) and a chunk of
Ajax.  This is giving me a chance to nail down some limitations and
omissions, and tackle some nasty InternetExplorer-is-brain-dead
issues.  Given how easy it is to get a nightly build, or build
locally, I don't think there's that much advantage to cranking out an
official release -- a process that requires several days to vote, and
an hour or two of my time to perform the builds and uploads.

A new feature about to roll out is a client-side JavaScript console
which will make debugging (especially on IE) a lot easier.

I've also been developing for my app an AjaxFormLoop, a way of
combining Loop, FormInjector and a few other bits and pieces to allow
dynamic addition and removal of items from a list; basically, the kind
of thing you do for master/detail relationships.

Anyway, please be patient or use the nightlies.  Tapestry 5 is getting
very close to a next release (which I think may even be a release
candidate), but that's no reason to ship it early.  Let me continue to
use it in anger and find the rough spots.

-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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



Re: T5: Forms - Best Practice

2008-04-22 Thread César Lesc
Personally i never used but may be you can use the UUID (
http://en.wikipedia.org/wiki/Universally_Unique_Identifier ) for yours
employees primary key or alternate key. They are very hard to guess.

and if you get very paranoid you can encrypt them.

César.

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



Re: Tapestry and OSGi

2008-04-22 Thread Michael Gerzabek

Hi Robert,

No I've no experience in using T5 with OSGi. Sounds very interesting 
though. Recently I stepped into this topic and found Sling [1], another 
Apache incubator project that deals with OSGi. Sling is based on Felix 
[2] an OSGi implementation of ASF. It further uses Jackrabbit [3] as 
JCR. In the documentation they provide infos on how to include servlet 
filters into their framework.


I also was wondering how much effort it would be to make the T5 IoC 
mechanism OSGi conform? Would there be extra value of hot-deployment of 
modules? Is there a need for such a thing? Or what would be the value of 
getting strong interfaces on service layer? What would be the benefit at 
all?


Michael

[1] http://incubator.apache.org/sling/site/index.html
[2] http://felix.apache.org/site/index.html
[3] http://jackrabbit.apache.org/

Robert Binna schrieb:

Hi

I have a question towards using tapestry and OSGi. Has any one of you 
done something with Tapestry and OSGi till now? Does anyone know of 
some best practices, pitfalls?


Thanks a lot in advance,
Best regards, Robert

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




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