Re: Problem using BeanEditForm with a POJO

2009-05-07 Thread Otho
It will work if you use legacy mode, aka a ContextLoaderListener as in 5.0.
If you use the new 5.1 mode, Spring beans are no longer exposed as services.
As far as I understood that was necessary to enable the injection of
Tapestry services into spring beans. But it really only pops up on type
conflicts as described.  You won't see the conflicin the givenexampe t if
you have a distinct service layer (as appfuse does if I recall correctly).
You just

@Inject
UserService userService,

and don't even need the @Service annotation anymore.

Btw. the docs with changes are here:
http://tapestry.formos.com/nightly/tapestry5/tapestry-spring/

2009/5/6 mraible m...@raibledesigns.com


 With 5.0.x, I was able to solve this by adding an @Service(beanName)
 annotation. Will this not work in 5.1?


 Otho wrote:
 
  Nice :)
 
  But I would suggest you start using Tapestry 5.1. The new spring
  integration
  is very convenient and enables you for example to inject tapestry
 services
  into spring beans. The only thing which you should look for is that if
 you
  have two beans which can be assigned to the same type, you cannot inject
  them the simple way but need to inject ApplicationContext to be able to
  get
  the bean by name.
 
  What I mean by this: I have two beans like this:
 
  bean id=dao parent=baseTransactionProxy
  property name=target
  ref local=daoImpl/
  /property
  /bean
 
  bean id=daoImpl class=my.company.dao.DaoImpl /
 
  Since both are assignable to Dao interface I can't just @Inject Dao dao;
  but
  have to use
 
  @Inject
  ApplicationContext appContext;
 
  private Dao dao;
 
  ...
 
  Object onSomeActionFromSomeComponent()
  {
 dao = (Dao) appContext.getBean(dao);
 ListSomeType = dao.findAll(SomeType.class);
 ...
 return null;
  }
 
  Also you have some minor deprecations which should be updated to the new
  way. For example you don't use ComponentResources anymore to create
  pagelinks, but PageRenderLinkSource . Otherwise the transition is very
  smooth and the additional features in Tapestry 5.1 are well worth the
  small
  effort.
 
  2009/5/6 mraible m...@raibledesigns.com
 
 
  That worked - thanks!
 
  Matt
 
 
  Otho wrote:
  
   Hi,
  
   1) Turn production mode to false in AppModule.java. You get much
 better
   exception reporting then.
  
   The exception you mentioned is caused by:
  
   org.apache.tapestry5.internal.services.TransformationExceptionUnable
 to
   add
   new method public final void setFrom(java.lang.String) as it already
   exists.
  
   If you set the @Property annotation you don't write primitive setters
   anymore. Commenting this out gives thes next problem:
  
   org.apache.tapestry5.internal.services.RenderQueueExceptionRender
 queue
   error in BeginRender[Login:outputraw]: Failure reading parameter
  'value'
   of
   component Login:outputraw: Embedded component(s) form are defined
  within
   component class com.company.webapp.components.UserForm (or a
  super-class
   of
   UserForm), but are not present in the component template
   (classpath:com/company/webapp/components/UserForm.tml).
  
   If you explicitly define a @Component in the class you need to use the
   implicit (variable name) id or assign a descriptive id.
  
   In UserForm.tml change t:form to t:form t:id=form and it works.
  
   2) Something in your setup, I suspect the aspectj compile stage,
   successfully defeats tapestry live class reloading via mvn compile.
  This
   is
   a nuisance you should look into when you got the time.
  
   Regards,
   Otho
  
  
  
  
  
  
   2009/5/4 mraible m...@raibledesigns.com
  
  
   Should be fixed now. Sorry about that.
  
   Matt
  
  
   Robert Zeigler wrote:
   
Tried dl'ing and running and received the following error:
[ERROR] BUILD ERROR
[INFO]
   
  
  
[INFO] Failed to resolve artifact.
   
GroupId: org.appfuse.plugins
ArtifactId: appfuse-maven-plugin
Version: 2.1-SNAPSHOT
   
Reason: Unable to download the artifact from any repository
   
   org.appfuse.plugins:appfuse-maven-plugin:pom:2.1-SNAPSHOT
   
from the specified remote repositories:
   central (http://repo1.maven.org/maven2),
   appfuse (http://oss.sonatype.org/content/groups/appfuse)
   
   
Robert
   
On May 2, 2009, at 5/211:25 PM , mraible wrote:
   
   
I'm using Tapestry 5.0.14. You can download the project from
http://static.raibledesigns.com/downloads/basic-tapestry.zip.
   
Matt
   
   
Robert Zeigler wrote:
   
Hi Matt,
   
Hm, that's an odd exception.
The way BeanEditForm works is to lookup an editor block for
 each
property, based on the datatype for that property (datatype is
determined by the DataTypeAnalyzer service; lookup of the block
 is
the
job of the BeanBlockSource service).  The information needed for
  each
of the editor blocks to function is 

Re: Problem using BeanEditForm with a POJO

2009-05-06 Thread mraible

That worked - thanks!

Matt


Otho wrote:
 
 Hi,
 
 1) Turn production mode to false in AppModule.java. You get much better
 exception reporting then.
 
 The exception you mentioned is caused by:
 
 org.apache.tapestry5.internal.services.TransformationExceptionUnable to
 add
 new method public final void setFrom(java.lang.String) as it already
 exists.
 
 If you set the @Property annotation you don't write primitive setters
 anymore. Commenting this out gives thes next problem:
 
 org.apache.tapestry5.internal.services.RenderQueueExceptionRender queue
 error in BeginRender[Login:outputraw]: Failure reading parameter 'value'
 of
 component Login:outputraw: Embedded component(s) form are defined within
 component class com.company.webapp.components.UserForm (or a super-class
 of
 UserForm), but are not present in the component template
 (classpath:com/company/webapp/components/UserForm.tml).
 
 If you explicitly define a @Component in the class you need to use the
 implicit (variable name) id or assign a descriptive id.
 
 In UserForm.tml change t:form to t:form t:id=form and it works.
 
 2) Something in your setup, I suspect the aspectj compile stage,
 successfully defeats tapestry live class reloading via mvn compile. This
 is
 a nuisance you should look into when you got the time.
 
 Regards,
 Otho
 
 
 
 
 
 
 2009/5/4 mraible m...@raibledesigns.com
 

 Should be fixed now. Sorry about that.

 Matt


 Robert Zeigler wrote:
 
  Tried dl'ing and running and received the following error:
  [ERROR] BUILD ERROR
  [INFO]
 
 
  [INFO] Failed to resolve artifact.
 
  GroupId: org.appfuse.plugins
  ArtifactId: appfuse-maven-plugin
  Version: 2.1-SNAPSHOT
 
  Reason: Unable to download the artifact from any repository
 
 org.appfuse.plugins:appfuse-maven-plugin:pom:2.1-SNAPSHOT
 
  from the specified remote repositories:
 central (http://repo1.maven.org/maven2),
 appfuse (http://oss.sonatype.org/content/groups/appfuse)
 
 
  Robert
 
  On May 2, 2009, at 5/211:25 PM , mraible wrote:
 
 
  I'm using Tapestry 5.0.14. You can download the project from
  http://static.raibledesigns.com/downloads/basic-tapestry.zip.
 
  Matt
 
 
  Robert Zeigler wrote:
 
  Hi Matt,
 
  Hm, that's an odd exception.
  The way BeanEditForm works is to lookup an editor block for each
  property, based on the datatype for that property (datatype is
  determined by the DataTypeAnalyzer service; lookup of the block is
  the
  job of the BeanBlockSource service).  The information needed for each
  of the editor blocks to function is stashed in a
  PropertyEditContext, which is made available to the blocks by the
  BeanEditor component via the Enviromental service.  Which is why I'm
  saying your exception looks weird: it's saying that the
  PropertyEditContext wasn't available from the environment.  Since
  this
  presumably happens while rendering the bean editor, it's weird,
  because property edit context /should/ be available!
 
  The mailing list strips attachments; can you post the project
  elsewhere?
  Also, what version of t5?
 
  Robert
 
  On May 2, 2009, at 5/210:46 PM , mraible wrote:
 
 
  I was able to fix the problem by commenting out field.isRequired()
  in the
  following method:
 
 
public void insideLabel(Field field, Element labelElement) {
if (inError(field)) {
addErrorClassToCurrentElement(error);
}/*
if (field.isRequired()) {
labelElement.raw( *);
}*/
 
}
 
  Is there a way to use similar logic and prevent the exception from
  happening?
 
  Thanks,
 
  Matt
 
 
  mraible wrote:
 
  I tried using your hint by changing my template to the following:
 
  t:layout title=message:personDetail.title
  heading=message:personDetail.heading
  menu=literal:PersonMenu
  xmlns:t=
 http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
  
 
t:messagebanner t:id=message type=type/
 
form t:id=personForm clientValidation=true
t:errors/
 
div class=t-beaneditor
t:beaneditor t:id=person object=person
  exclude=id/
 
div class=t-beaneditor-row style=text-align: center
input type=submit id=save
  value=message:button.save/
input t:type=submit t:id=delete id=delete
  value=message:button.delete/
input t:type=submit t:id=cancel id=cancel
  value=message:button.cancel/
/div
/div
/form
 
script type=text/javascript
Form.focusFirstElement($(personForm));
/script
 
  /t:layout
 
  Unfortunately, I still get the same error when trying to view this
  page:
 
 [exec] ERROR [btpool0-3] PersonForm.run(78) | Render queue
  error in
  AfterRender[PersonForm:person.loop]: Failure reading parameter
  'validate'
  of component core/PropertyEditBlocks:datefield: No object of type
  org.apache.tapestry5.services.PropertyEditContext is available from
  the
  

Re: Problem using BeanEditForm with a POJO

2009-05-06 Thread Otho
Nice :)

But I would suggest you start using Tapestry 5.1. The new spring integration
is very convenient and enables you for example to inject tapestry services
into spring beans. The only thing which you should look for is that if you
have two beans which can be assigned to the same type, you cannot inject
them the simple way but need to inject ApplicationContext to be able to get
the bean by name.

What I mean by this: I have two beans like this:

bean id=dao parent=baseTransactionProxy
property name=target
ref local=daoImpl/
/property
/bean

bean id=daoImpl class=my.company.dao.DaoImpl /

Since both are assignable to Dao interface I can't just @Inject Dao dao; but
have to use

@Inject
ApplicationContext appContext;

private Dao dao;

...

Object onSomeActionFromSomeComponent()
{
   dao = (Dao) appContext.getBean(dao);
   ListSomeType = dao.findAll(SomeType.class);
   ...
   return null;
}

Also you have some minor deprecations which should be updated to the new
way. For example you don't use ComponentResources anymore to create
pagelinks, but PageRenderLinkSource . Otherwise the transition is very
smooth and the additional features in Tapestry 5.1 are well worth the small
effort.

2009/5/6 mraible m...@raibledesigns.com


 That worked - thanks!

 Matt


 Otho wrote:
 
  Hi,
 
  1) Turn production mode to false in AppModule.java. You get much better
  exception reporting then.
 
  The exception you mentioned is caused by:
 
  org.apache.tapestry5.internal.services.TransformationExceptionUnable to
  add
  new method public final void setFrom(java.lang.String) as it already
  exists.
 
  If you set the @Property annotation you don't write primitive setters
  anymore. Commenting this out gives thes next problem:
 
  org.apache.tapestry5.internal.services.RenderQueueExceptionRender queue
  error in BeginRender[Login:outputraw]: Failure reading parameter 'value'
  of
  component Login:outputraw: Embedded component(s) form are defined within
  component class com.company.webapp.components.UserForm (or a super-class
  of
  UserForm), but are not present in the component template
  (classpath:com/company/webapp/components/UserForm.tml).
 
  If you explicitly define a @Component in the class you need to use the
  implicit (variable name) id or assign a descriptive id.
 
  In UserForm.tml change t:form to t:form t:id=form and it works.
 
  2) Something in your setup, I suspect the aspectj compile stage,
  successfully defeats tapestry live class reloading via mvn compile. This
  is
  a nuisance you should look into when you got the time.
 
  Regards,
  Otho
 
 
 
 
 
 
  2009/5/4 mraible m...@raibledesigns.com
 
 
  Should be fixed now. Sorry about that.
 
  Matt
 
 
  Robert Zeigler wrote:
  
   Tried dl'ing and running and received the following error:
   [ERROR] BUILD ERROR
   [INFO]
  
  
   [INFO] Failed to resolve artifact.
  
   GroupId: org.appfuse.plugins
   ArtifactId: appfuse-maven-plugin
   Version: 2.1-SNAPSHOT
  
   Reason: Unable to download the artifact from any repository
  
  org.appfuse.plugins:appfuse-maven-plugin:pom:2.1-SNAPSHOT
  
   from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  appfuse (http://oss.sonatype.org/content/groups/appfuse)
  
  
   Robert
  
   On May 2, 2009, at 5/211:25 PM , mraible wrote:
  
  
   I'm using Tapestry 5.0.14. You can download the project from
   http://static.raibledesigns.com/downloads/basic-tapestry.zip.
  
   Matt
  
  
   Robert Zeigler wrote:
  
   Hi Matt,
  
   Hm, that's an odd exception.
   The way BeanEditForm works is to lookup an editor block for each
   property, based on the datatype for that property (datatype is
   determined by the DataTypeAnalyzer service; lookup of the block is
   the
   job of the BeanBlockSource service).  The information needed for
 each
   of the editor blocks to function is stashed in a
   PropertyEditContext, which is made available to the blocks by the
   BeanEditor component via the Enviromental service.  Which is why I'm
   saying your exception looks weird: it's saying that the
   PropertyEditContext wasn't available from the environment.  Since
   this
   presumably happens while rendering the bean editor, it's weird,
   because property edit context /should/ be available!
  
   The mailing list strips attachments; can you post the project
   elsewhere?
   Also, what version of t5?
  
   Robert
  
   On May 2, 2009, at 5/210:46 PM , mraible wrote:
  
  
   I was able to fix the problem by commenting out field.isRequired()
   in the
   following method:
  
  
 public void insideLabel(Field field, Element labelElement) {
 if (inError(field)) {
 addErrorClassToCurrentElement(error);
 }/*
 if (field.isRequired()) {
 labelElement.raw( *);
 }*/
  
 }
  
   Is there a way to use similar logic and prevent the 

Re: Problem using BeanEditForm with a POJO

2009-05-06 Thread mraible

With 5.0.x, I was able to solve this by adding an @Service(beanName)
annotation. Will this not work in 5.1?


Otho wrote:
 
 Nice :)
 
 But I would suggest you start using Tapestry 5.1. The new spring
 integration
 is very convenient and enables you for example to inject tapestry services
 into spring beans. The only thing which you should look for is that if you
 have two beans which can be assigned to the same type, you cannot inject
 them the simple way but need to inject ApplicationContext to be able to
 get
 the bean by name.
 
 What I mean by this: I have two beans like this:
 
 bean id=dao parent=baseTransactionProxy
 property name=target
 ref local=daoImpl/
 /property
 /bean
 
 bean id=daoImpl class=my.company.dao.DaoImpl /
 
 Since both are assignable to Dao interface I can't just @Inject Dao dao;
 but
 have to use
 
 @Inject
 ApplicationContext appContext;
 
 private Dao dao;
 
 ...
 
 Object onSomeActionFromSomeComponent()
 {
dao = (Dao) appContext.getBean(dao);
ListSomeType = dao.findAll(SomeType.class);
...
return null;
 }
 
 Also you have some minor deprecations which should be updated to the new
 way. For example you don't use ComponentResources anymore to create
 pagelinks, but PageRenderLinkSource . Otherwise the transition is very
 smooth and the additional features in Tapestry 5.1 are well worth the
 small
 effort.
 
 2009/5/6 mraible m...@raibledesigns.com
 

 That worked - thanks!

 Matt


 Otho wrote:
 
  Hi,
 
  1) Turn production mode to false in AppModule.java. You get much better
  exception reporting then.
 
  The exception you mentioned is caused by:
 
  org.apache.tapestry5.internal.services.TransformationExceptionUnable to
  add
  new method public final void setFrom(java.lang.String) as it already
  exists.
 
  If you set the @Property annotation you don't write primitive setters
  anymore. Commenting this out gives thes next problem:
 
  org.apache.tapestry5.internal.services.RenderQueueExceptionRender queue
  error in BeginRender[Login:outputraw]: Failure reading parameter
 'value'
  of
  component Login:outputraw: Embedded component(s) form are defined
 within
  component class com.company.webapp.components.UserForm (or a
 super-class
  of
  UserForm), but are not present in the component template
  (classpath:com/company/webapp/components/UserForm.tml).
 
  If you explicitly define a @Component in the class you need to use the
  implicit (variable name) id or assign a descriptive id.
 
  In UserForm.tml change t:form to t:form t:id=form and it works.
 
  2) Something in your setup, I suspect the aspectj compile stage,
  successfully defeats tapestry live class reloading via mvn compile.
 This
  is
  a nuisance you should look into when you got the time.
 
  Regards,
  Otho
 
 
 
 
 
 
  2009/5/4 mraible m...@raibledesigns.com
 
 
  Should be fixed now. Sorry about that.
 
  Matt
 
 
  Robert Zeigler wrote:
  
   Tried dl'ing and running and received the following error:
   [ERROR] BUILD ERROR
   [INFO]
  
 
 
   [INFO] Failed to resolve artifact.
  
   GroupId: org.appfuse.plugins
   ArtifactId: appfuse-maven-plugin
   Version: 2.1-SNAPSHOT
  
   Reason: Unable to download the artifact from any repository
  
  org.appfuse.plugins:appfuse-maven-plugin:pom:2.1-SNAPSHOT
  
   from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  appfuse (http://oss.sonatype.org/content/groups/appfuse)
  
  
   Robert
  
   On May 2, 2009, at 5/211:25 PM , mraible wrote:
  
  
   I'm using Tapestry 5.0.14. You can download the project from
   http://static.raibledesigns.com/downloads/basic-tapestry.zip.
  
   Matt
  
  
   Robert Zeigler wrote:
  
   Hi Matt,
  
   Hm, that's an odd exception.
   The way BeanEditForm works is to lookup an editor block for each
   property, based on the datatype for that property (datatype is
   determined by the DataTypeAnalyzer service; lookup of the block is
   the
   job of the BeanBlockSource service).  The information needed for
 each
   of the editor blocks to function is stashed in a
   PropertyEditContext, which is made available to the blocks by
 the
   BeanEditor component via the Enviromental service.  Which is why
 I'm
   saying your exception looks weird: it's saying that the
   PropertyEditContext wasn't available from the environment.  Since
   this
   presumably happens while rendering the bean editor, it's weird,
   because property edit context /should/ be available!
  
   The mailing list strips attachments; can you post the project
   elsewhere?
   Also, what version of t5?
  
   Robert
  
   On May 2, 2009, at 5/210:46 PM , mraible wrote:
  
  
   I was able to fix the problem by commenting out
 field.isRequired()
   in the
   following method:
  
  
 public void insideLabel(Field field, Element labelElement) {
 if (inError(field)) {
 

Re: Problem using BeanEditForm with a POJO

2009-05-05 Thread Otho
Hi,

1) Turn production mode to false in AppModule.java. You get much better
exception reporting then.

The exception you mentioned is caused by:

org.apache.tapestry5.internal.services.TransformationExceptionUnable to add
new method public final void setFrom(java.lang.String) as it already exists.

If you set the @Property annotation you don't write primitive setters
anymore. Commenting this out gives thes next problem:

org.apache.tapestry5.internal.services.RenderQueueExceptionRender queue
error in BeginRender[Login:outputraw]: Failure reading parameter 'value' of
component Login:outputraw: Embedded component(s) form are defined within
component class com.company.webapp.components.UserForm (or a super-class of
UserForm), but are not present in the component template
(classpath:com/company/webapp/components/UserForm.tml).

If you explicitly define a @Component in the class you need to use the
implicit (variable name) id or assign a descriptive id.

In UserForm.tml change t:form to t:form t:id=form and it works.

2) Something in your setup, I suspect the aspectj compile stage,
successfully defeats tapestry live class reloading via mvn compile. This is
a nuisance you should look into when you got the time.

Regards,
Otho






2009/5/4 mraible m...@raibledesigns.com


 Should be fixed now. Sorry about that.

 Matt


 Robert Zeigler wrote:
 
  Tried dl'ing and running and received the following error:
  [ERROR] BUILD ERROR
  [INFO]
  
  [INFO] Failed to resolve artifact.
 
  GroupId: org.appfuse.plugins
  ArtifactId: appfuse-maven-plugin
  Version: 2.1-SNAPSHOT
 
  Reason: Unable to download the artifact from any repository
 
 org.appfuse.plugins:appfuse-maven-plugin:pom:2.1-SNAPSHOT
 
  from the specified remote repositories:
 central (http://repo1.maven.org/maven2),
 appfuse (http://oss.sonatype.org/content/groups/appfuse)
 
 
  Robert
 
  On May 2, 2009, at 5/211:25 PM , mraible wrote:
 
 
  I'm using Tapestry 5.0.14. You can download the project from
  http://static.raibledesigns.com/downloads/basic-tapestry.zip.
 
  Matt
 
 
  Robert Zeigler wrote:
 
  Hi Matt,
 
  Hm, that's an odd exception.
  The way BeanEditForm works is to lookup an editor block for each
  property, based on the datatype for that property (datatype is
  determined by the DataTypeAnalyzer service; lookup of the block is
  the
  job of the BeanBlockSource service).  The information needed for each
  of the editor blocks to function is stashed in a
  PropertyEditContext, which is made available to the blocks by the
  BeanEditor component via the Enviromental service.  Which is why I'm
  saying your exception looks weird: it's saying that the
  PropertyEditContext wasn't available from the environment.  Since
  this
  presumably happens while rendering the bean editor, it's weird,
  because property edit context /should/ be available!
 
  The mailing list strips attachments; can you post the project
  elsewhere?
  Also, what version of t5?
 
  Robert
 
  On May 2, 2009, at 5/210:46 PM , mraible wrote:
 
 
  I was able to fix the problem by commenting out field.isRequired()
  in the
  following method:
 
 
public void insideLabel(Field field, Element labelElement) {
if (inError(field)) {
addErrorClassToCurrentElement(error);
}/*
if (field.isRequired()) {
labelElement.raw( *);
}*/
 
}
 
  Is there a way to use similar logic and prevent the exception from
  happening?
 
  Thanks,
 
  Matt
 
 
  mraible wrote:
 
  I tried using your hint by changing my template to the following:
 
  t:layout title=message:personDetail.title
  heading=message:personDetail.heading
  menu=literal:PersonMenu
  xmlns:t=
 http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
  
 
t:messagebanner t:id=message type=type/
 
form t:id=personForm clientValidation=true
t:errors/
 
div class=t-beaneditor
t:beaneditor t:id=person object=person
  exclude=id/
 
div class=t-beaneditor-row style=text-align: center
input type=submit id=save
  value=message:button.save/
input t:type=submit t:id=delete id=delete
  value=message:button.delete/
input t:type=submit t:id=cancel id=cancel
  value=message:button.cancel/
/div
/div
/form
 
script type=text/javascript
Form.focusFirstElement($(personForm));
/script
 
  /t:layout
 
  Unfortunately, I still get the same error when trying to view this
  page:
 
 [exec] ERROR [btpool0-3] PersonForm.run(78) | Render queue
  error in
  AfterRender[PersonForm:person.loop]: Failure reading parameter
  'validate'
  of component core/PropertyEditBlocks:datefield: No object of type
  org.apache.tapestry5.services.PropertyEditContext is available from
  the
  Environment.  Available types are
  org.apache.tapestry5.RenderSupport,
  

Re: Problem using BeanEditForm with a POJO

2009-05-04 Thread Robert Zeigler

Tried dl'ing and running and received the following error:
[ERROR] BUILD ERROR
[INFO]  


[INFO] Failed to resolve artifact.

GroupId: org.appfuse.plugins
ArtifactId: appfuse-maven-plugin
Version: 2.1-SNAPSHOT

Reason: Unable to download the artifact from any repository

  org.appfuse.plugins:appfuse-maven-plugin:pom:2.1-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  appfuse (http://oss.sonatype.org/content/groups/appfuse)


Robert

On May 2, 2009, at 5/211:25 PM , mraible wrote:



I'm using Tapestry 5.0.14. You can download the project from
http://static.raibledesigns.com/downloads/basic-tapestry.zip.

Matt


Robert Zeigler wrote:


Hi Matt,

Hm, that's an odd exception.
The way BeanEditForm works is to lookup an editor block for each
property, based on the datatype for that property (datatype is
determined by the DataTypeAnalyzer service; lookup of the block is  
the

job of the BeanBlockSource service).  The information needed for each
of the editor blocks to function is stashed in a
PropertyEditContext, which is made available to the blocks by the
BeanEditor component via the Enviromental service.  Which is why I'm
saying your exception looks weird: it's saying that the
PropertyEditContext wasn't available from the environment.  Since  
this

presumably happens while rendering the bean editor, it's weird,
because property edit context /should/ be available!

The mailing list strips attachments; can you post the project  
elsewhere?

Also, what version of t5?

Robert

On May 2, 2009, at 5/210:46 PM , mraible wrote:



I was able to fix the problem by commenting out field.isRequired()
in the
following method:


  public void insideLabel(Field field, Element labelElement) {
  if (inError(field)) {
  addErrorClassToCurrentElement(error);
  }/*
  if (field.isRequired()) {
  labelElement.raw( *);
  }*/

  }

Is there a way to use similar logic and prevent the exception from
happening?

Thanks,

Matt


mraible wrote:


I tried using your hint by changing my template to the following:

t:layout title=message:personDetail.title
heading=message:personDetail.heading
menu=literal:PersonMenu
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd


  t:messagebanner t:id=message type=type/

  form t:id=personForm clientValidation=true
  t:errors/

  div class=t-beaneditor
  t:beaneditor t:id=person object=person  
exclude=id/


  div class=t-beaneditor-row style=text-align: center
  input type=submit id=save
value=message:button.save/
  input t:type=submit t:id=delete id=delete
value=message:button.delete/
  input t:type=submit t:id=cancel id=cancel
value=message:button.cancel/
  /div
  /div
  /form

  script type=text/javascript
  Form.focusFirstElement($(personForm));
  /script

/t:layout

Unfortunately, I still get the same error when trying to view this
page:

   [exec] ERROR [btpool0-3] PersonForm.run(78) | Render queue
error in
AfterRender[PersonForm:person.loop]: Failure reading parameter
'validate'
of component core/PropertyEditBlocks:datefield: No object of type
org.apache.tapestry5.services.PropertyEditContext is available from
the
Environment.  Available types are  
org.apache.tapestry5.RenderSupport,

org.apache.tapestry5.ValidationDecorator,
org.apache.tapestry5.ValidationTracker,
org.apache.tapestry5.internal.services.ClientBehaviorSupport,
org.apache.tapestry5.services.FormSupport,
org.apache.tapestry5.services.Heartbeat.
   [exec] org.apache.tapestry5.ioc.internal.util.TapestryException:
Failure reading parameter 'validate' of component
core/PropertyEditBlocks:datefield: No object of type
org.apache.tapestry5.services.PropertyEditContext is available from
the
Environment.  Available types are  
org.apache.tapestry5.RenderSupport,

org.apache.tapestry5.ValidationDecorator,
org.apache.tapestry5.ValidationTracker,
org.apache.tapestry5.internal.services.ClientBehaviorSupport,
org.apache.tapestry5.services.FormSupport,
org.apache.tapestry5.services.Heartbeat. [at
classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml,
line 3,
column 47]
   [exec] at
org
.apache
.tapestry5
.internal
.structure
.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:909)
   [exec] at
org
.apache 
.tapestry5.internal.structure.ComponentPageElementImpl.access

$200(ComponentPageElementImpl.java:50)
   [exec] at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl
$6.render(ComponentPageElementImpl.java:189)
   [exec] at
org
.apache
.tapestry5
.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:68)
   [exec] at
org
.apache
.tapestry5
.internal
.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:108)
   [exec] at
$
PageRenderQueue_12104869ca2 
.render($PageRenderQueue_12104869ca2.java)

   [exec] at
$

Re: Problem using BeanEditForm with a POJO

2009-05-04 Thread mraible

Should be fixed now. Sorry about that.

Matt


Robert Zeigler wrote:
 
 Tried dl'ing and running and received the following error:
 [ERROR] BUILD ERROR
 [INFO]  
 
 [INFO] Failed to resolve artifact.
 
 GroupId: org.appfuse.plugins
 ArtifactId: appfuse-maven-plugin
 Version: 2.1-SNAPSHOT
 
 Reason: Unable to download the artifact from any repository
 
org.appfuse.plugins:appfuse-maven-plugin:pom:2.1-SNAPSHOT
 
 from the specified remote repositories:
central (http://repo1.maven.org/maven2),
appfuse (http://oss.sonatype.org/content/groups/appfuse)
 
 
 Robert
 
 On May 2, 2009, at 5/211:25 PM , mraible wrote:
 

 I'm using Tapestry 5.0.14. You can download the project from
 http://static.raibledesigns.com/downloads/basic-tapestry.zip.

 Matt


 Robert Zeigler wrote:

 Hi Matt,

 Hm, that's an odd exception.
 The way BeanEditForm works is to lookup an editor block for each
 property, based on the datatype for that property (datatype is
 determined by the DataTypeAnalyzer service; lookup of the block is  
 the
 job of the BeanBlockSource service).  The information needed for each
 of the editor blocks to function is stashed in a
 PropertyEditContext, which is made available to the blocks by the
 BeanEditor component via the Enviromental service.  Which is why I'm
 saying your exception looks weird: it's saying that the
 PropertyEditContext wasn't available from the environment.  Since  
 this
 presumably happens while rendering the bean editor, it's weird,
 because property edit context /should/ be available!

 The mailing list strips attachments; can you post the project  
 elsewhere?
 Also, what version of t5?

 Robert

 On May 2, 2009, at 5/210:46 PM , mraible wrote:


 I was able to fix the problem by commenting out field.isRequired()
 in the
 following method:


   public void insideLabel(Field field, Element labelElement) {
   if (inError(field)) {
   addErrorClassToCurrentElement(error);
   }/*
   if (field.isRequired()) {
   labelElement.raw( *);
   }*/

   }

 Is there a way to use similar logic and prevent the exception from
 happening?

 Thanks,

 Matt


 mraible wrote:

 I tried using your hint by changing my template to the following:

 t:layout title=message:personDetail.title
 heading=message:personDetail.heading
 menu=literal:PersonMenu
 xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
 

   t:messagebanner t:id=message type=type/

   form t:id=personForm clientValidation=true
   t:errors/

   div class=t-beaneditor
   t:beaneditor t:id=person object=person  
 exclude=id/

   div class=t-beaneditor-row style=text-align: center
   input type=submit id=save
 value=message:button.save/
   input t:type=submit t:id=delete id=delete
 value=message:button.delete/
   input t:type=submit t:id=cancel id=cancel
 value=message:button.cancel/
   /div
   /div
   /form

   script type=text/javascript
   Form.focusFirstElement($(personForm));
   /script

 /t:layout

 Unfortunately, I still get the same error when trying to view this
 page:

[exec] ERROR [btpool0-3] PersonForm.run(78) | Render queue
 error in
 AfterRender[PersonForm:person.loop]: Failure reading parameter
 'validate'
 of component core/PropertyEditBlocks:datefield: No object of type
 org.apache.tapestry5.services.PropertyEditContext is available from
 the
 Environment.  Available types are  
 org.apache.tapestry5.RenderSupport,
 org.apache.tapestry5.ValidationDecorator,
 org.apache.tapestry5.ValidationTracker,
 org.apache.tapestry5.internal.services.ClientBehaviorSupport,
 org.apache.tapestry5.services.FormSupport,
 org.apache.tapestry5.services.Heartbeat.
[exec] org.apache.tapestry5.ioc.internal.util.TapestryException:
 Failure reading parameter 'validate' of component
 core/PropertyEditBlocks:datefield: No object of type
 org.apache.tapestry5.services.PropertyEditContext is available from
 the
 Environment.  Available types are  
 org.apache.tapestry5.RenderSupport,
 org.apache.tapestry5.ValidationDecorator,
 org.apache.tapestry5.ValidationTracker,
 org.apache.tapestry5.internal.services.ClientBehaviorSupport,
 org.apache.tapestry5.services.FormSupport,
 org.apache.tapestry5.services.Heartbeat. [at
 classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml,
 line 3,
 column 47]
[exec] at
 org
 .apache
 .tapestry5
 .internal
 .structure
 .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:909)
[exec] at
 org
 .apache 
 .tapestry5.internal.structure.ComponentPageElementImpl.access
 $200(ComponentPageElementImpl.java:50)
[exec] at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl
 $6.render(ComponentPageElementImpl.java:189)
[exec] at
 org
 .apache
 .tapestry5
 .internal.services.RenderQueueImpl.run(RenderQueueImpl.java:68)
[exec] at
 org
 

Re: Problem using BeanEditForm with a POJO

2009-05-03 Thread Thiago H. de Paula Figueiredo
Em Sun, 03 May 2009 01:25:04 -0300, mraible m...@raibledesigns.com  
escreveu:



I'm using Tapestry 5.0.14. You can download the project from
http://static.raibledesigns.com/downloads/basic-tapestry.zip.


Why 5.0.14? It's quite old. The last stable version is 5.0.18 and many  
improvements were made since 5.0.14. 5.1.0.5 is almost 100%  
backward-compatible with 5.0.18.


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

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



Re: Problem using BeanEditForm with a POJO

2009-05-03 Thread mraible

Are there instructions for upgrading to 5.0.18. I tried and I see the
following error when I try to run integration tests with Canoo WebTest:

[INFO] [talledLocalContainer] DEBUG [btpool0-0] ServiceFacade.create(234) |
Creating service 'ServiceFacade'.
[INFO] [talledLocalContainer] ERROR [btpool0-0] Login.run(82) | Render queue
error in BeginRender[Login:outputraw]: Failure reading parameter 'value' of
component Login:outputraw: Could not convert 'type' into a component
parameter binding: java.lang.NoClassDefFoundError:
org/appfuse/webapp/components/UserForm
[INFO] [talledLocalContainer]
org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading
parameter 'value' of component Login:outputraw: Could not convert 'type'
into a component parameter binding: java.lang.NoClassDefFoundError:
org/appfuse/webapp/components/UserForm [at context:Login.tml, line 41,
column 57]
[INFO] [talledLocalContainer]   at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:932)
[INFO] [talledLocalContainer]   at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$200(ComponentPageElementImpl.java:50)
[INFO] [talledLocalContainer]   at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$11.render(ComponentPageElementImpl.java:356)
[INFO] [talledLocalContainer]   at
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
[INFO] [talledLocalContainer]   at
org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)
[INFO] [talledLocalContainer]   at
$PageRenderQueue_121073ab475.render($PageRenderQueue_121073ab475.java)

Matt


Thiago H. de Paula Figueiredo wrote:
 
 Em Sun, 03 May 2009 01:25:04 -0300, mraible m...@raibledesigns.com  
 escreveu:
 
 I'm using Tapestry 5.0.14. You can download the project from
 http://static.raibledesigns.com/downloads/basic-tapestry.zip.
 
 Why 5.0.14? It's quite old. The last stable version is 5.0.18 and many  
 improvements were made since 5.0.14. 5.1.0.5 is almost 100%  
 backward-compatible with 5.0.18.
 
 -- 
 Thiago H. de Paula Figueiredo
 Independent Java consultant, developer, and instructor
 http://www.arsmachina.com.br/thiago
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-using-BeanEditForm-with-a-POJO-tp23349016p23357071.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: Problem using BeanEditForm with a POJO

2009-05-03 Thread mraible

FWIW, The error seems to happen in my Login.java class in the following
method:

public String getSignup() {
String link = resources.createPageLink(Signup,
false).toAbsoluteURI();
return MessageFormat.format(messages.get(login.signup), link);
}

Full source for Login.java is at:

http://source.appfuse.org/browse/appfuse/trunk/web/tapestry/src/main/java/org/appfuse/webapp/pages/Login.java?r=trunk

Matt


mraible wrote:
 
 Are there instructions for upgrading to 5.0.18. I tried and I see the
 following error when I try to run integration tests with Canoo WebTest:
 
 [INFO] [talledLocalContainer] DEBUG [btpool0-0] ServiceFacade.create(234)
 | Creating service 'ServiceFacade'.
 [INFO] [talledLocalContainer] ERROR [btpool0-0] Login.run(82) | Render
 queue error in BeginRender[Login:outputraw]: Failure reading parameter
 'value' of component Login:outputraw: Could not convert 'type' into a
 component parameter binding: java.lang.NoClassDefFoundError:
 org/appfuse/webapp/components/UserForm
 [INFO] [talledLocalContainer]
 org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading
 parameter 'value' of component Login:outputraw: Could not convert 'type'
 into a component parameter binding: java.lang.NoClassDefFoundError:
 org/appfuse/webapp/components/UserForm [at context:Login.tml, line 41,
 column 57]
 [INFO] [talledLocalContainer]   at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:932)
 [INFO] [talledLocalContainer]   at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$200(ComponentPageElementImpl.java:50)
 [INFO] [talledLocalContainer]   at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl$11.render(ComponentPageElementImpl.java:356)
 [INFO] [talledLocalContainer]   at
 org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
 [INFO] [talledLocalContainer]   at
 org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)
 [INFO] [talledLocalContainer]   at
 $PageRenderQueue_121073ab475.render($PageRenderQueue_121073ab475.java)
 
 Matt
 
 
 Thiago H. de Paula Figueiredo wrote:
 
 Em Sun, 03 May 2009 01:25:04 -0300, mraible m...@raibledesigns.com  
 escreveu:
 
 I'm using Tapestry 5.0.14. You can download the project from
 http://static.raibledesigns.com/downloads/basic-tapestry.zip.
 
 Why 5.0.14? It's quite old. The last stable version is 5.0.18 and many  
 improvements were made since 5.0.14. 5.1.0.5 is almost 100%  
 backward-compatible with 5.0.18.
 
 -- 
 Thiago H. de Paula Figueiredo
 Independent Java consultant, developer, and instructor
 http://www.arsmachina.com.br/thiago
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-using-BeanEditForm-with-a-POJO-tp23349016p23358003.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: Problem using BeanEditForm with a POJO

2009-05-03 Thread Otho
The error seems to be in your template.

[INFO] [talledLocalContainer]
org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading
parameter 'value' of component Login:outputraw: Could not convert 'type'
into a component parameter binding: java.lang.NoClassDefFoundError:
org/appfuse/webapp/components/UserForm [at context:Login.tml, line 41,
column 57]

Would you mind sharing that also?



2009/5/3 mraible m...@raibledesigns.com


 FWIW, The error seems to happen in my Login.java class in the following
 method:

public String getSignup() {
String link = resources.createPageLink(Signup,
 false).toAbsoluteURI();
return MessageFormat.format(messages.get(login.signup), link);
}

 Full source for Login.java is at:


 http://source.appfuse.org/browse/appfuse/trunk/web/tapestry/src/main/java/org/appfuse/webapp/pages/Login.java?r=trunk

 Matt


 mraible wrote:
 
  Are there instructions for upgrading to 5.0.18. I tried and I see the
  following error when I try to run integration tests with Canoo WebTest:
 
  [INFO] [talledLocalContainer] DEBUG [btpool0-0] ServiceFacade.create(234)
  | Creating service 'ServiceFacade'.
  [INFO] [talledLocalContainer] ERROR [btpool0-0] Login.run(82) | Render
  queue error in BeginRender[Login:outputraw]: Failure reading parameter
  'value' of component Login:outputraw: Could not convert 'type' into a
  component parameter binding: java.lang.NoClassDefFoundError:
  org/appfuse/webapp/components/UserForm
  [INFO] [talledLocalContainer]
  org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading
  parameter 'value' of component Login:outputraw: Could not convert 'type'
  into a component parameter binding: java.lang.NoClassDefFoundError:
  org/appfuse/webapp/components/UserForm [at context:Login.tml, line 41,
  column 57]
  [INFO] [talledLocalContainer]   at
 
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:932)
  [INFO] [talledLocalContainer]   at
 
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$200(ComponentPageElementImpl.java:50)
  [INFO] [talledLocalContainer]   at
 
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl$11.render(ComponentPageElementImpl.java:356)
  [INFO] [talledLocalContainer]   at
 
 org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
  [INFO] [talledLocalContainer]   at
 
 org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)
  [INFO] [talledLocalContainer]   at
  $PageRenderQueue_121073ab475.render($PageRenderQueue_121073ab475.java)
 
  Matt
 
 
  Thiago H. de Paula Figueiredo wrote:
 
  Em Sun, 03 May 2009 01:25:04 -0300, mraible m...@raibledesigns.com
  escreveu:
 
  I'm using Tapestry 5.0.14. You can download the project from
  http://static.raibledesigns.com/downloads/basic-tapestry.zip.
 
  Why 5.0.14? It's quite old. The last stable version is 5.0.18 and many
  improvements were made since 5.0.14. 5.1.0.5 is almost 100%
  backward-compatible with 5.0.18.
 
  --
  Thiago H. de Paula Figueiredo
  Independent Java consultant, developer, and instructor
  http://www.arsmachina.com.br/thiago
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 
 

 --
 View this message in context:
 http://www.nabble.com/Problem-using-BeanEditForm-with-a-POJO-tp23349016p23358003.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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




Re: Problem using BeanEditForm with a POJO

2009-05-02 Thread Thiago H. de Paula Figueiredo
Em Sat, 02 May 2009 15:31:15 -0300, mraible m...@raibledesigns.com  
escreveu:



I have the a Person.java object that I'm trying to use the BeanEditForm
component with. It has no Tapestry annotations in it. Is it possible to  
use the BeanEditForm component with it?


Yes. By the way, I've never used any Tapestry annotation in my POJOs.


t:layout title=message:personDetail.title
  heading=message:personDetail.heading  
menu=literal:PersonMenu

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

t:beaneditform object=person id=personForm exclude=id
t:parameter name=buttons


You're trying to override the edition block of a non-existent BeanModel  
property. Try adding add=buttons to the BeanEditForm.


Hint: instead of using BeanEditForm in this case, use a Form, an Errors  
and a BeanEditor. You'll have complete control on how to add the submit  
input (and any other thing you need). BeanEditForm = Form + Errors +  
BeanEditor + submit input.


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

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



Re: Problem using BeanEditForm with a POJO

2009-05-02 Thread mraible

I tried using your hint by changing my template to the following:

t:layout title=message:personDetail.title
  heading=message:personDetail.heading menu=literal:PersonMenu
  xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;

t:messagebanner t:id=message type=type/

form t:id=personForm clientValidation=true
t:errors/

div class=t-beaneditor
t:beaneditor t:id=person object=person exclude=id/

div class=t-beaneditor-row style=text-align: center
input type=submit id=save value=message:button.save/
input t:type=submit t:id=delete id=delete
value=message:button.delete/
input t:type=submit t:id=cancel id=cancel
value=message:button.cancel/
/div
/div
/form

script type=text/javascript
Form.focusFirstElement($(personForm));
/script

/t:layout

Unfortunately, I still get the same error when trying to view this page:

 [exec] ERROR [btpool0-3] PersonForm.run(78) | Render queue error in
AfterRender[PersonForm:person.loop]: Failure reading parameter 'validate' of
component core/PropertyEditBlocks:datefield: No object of type
org.apache.tapestry5.services.PropertyEditContext is available from the
Environment.  Available types are org.apache.tapestry5.RenderSupport,
org.apache.tapestry5.ValidationDecorator,
org.apache.tapestry5.ValidationTracker,
org.apache.tapestry5.internal.services.ClientBehaviorSupport,
org.apache.tapestry5.services.FormSupport,
org.apache.tapestry5.services.Heartbeat.
 [exec] org.apache.tapestry5.ioc.internal.util.TapestryException:
Failure reading parameter 'validate' of component
core/PropertyEditBlocks:datefield: No object of type
org.apache.tapestry5.services.PropertyEditContext is available from the
Environment.  Available types are org.apache.tapestry5.RenderSupport,
org.apache.tapestry5.ValidationDecorator,
org.apache.tapestry5.ValidationTracker,
org.apache.tapestry5.internal.services.ClientBehaviorSupport,
org.apache.tapestry5.services.FormSupport,
org.apache.tapestry5.services.Heartbeat. [at
classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml, line 3,
column 47]
 [exec] at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:909)
 [exec] at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$200(ComponentPageElementImpl.java:50)
 [exec] at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$6.render(ComponentPageElementImpl.java:189)
 [exec] at
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:68)
 [exec] at
org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:108)
 [exec] at
$PageRenderQueue_12104869ca2.render($PageRenderQueue_12104869ca2.java)
 [exec] at
$PageRenderQueue_12104869c9b.render($PageRenderQueue_12104869c9b.java)
 [exec] at
org.apache.tapestry5.services.TapestryModule$15.renderMarkup(TapestryModule.java:1128)
 [exec] at
com.company.webapp.services.AppModule$1.renderMarkup(AppModule.java:138)

Here is my PersonForm.java class:

package com.company.webapp.pages;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Service;
import org.apache.tapestry5.corelib.components.EventLink;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.PersistenceConstants;

import org.appfuse.service.GenericManager;
import com.company.model.Person;

import org.slf4j.Logger;

import java.util.List;

public class PersonForm extends BasePage {
@Inject
private Logger log;

@Inject
@Service(personManager)
private GenericManagerPerson, Long personManager;

@Persist @Property
private Person person;

public Person getPerson() {
return person;
}

/**
 * Allows setting person object from another class (i.e. PersonList)
 *
 * @param person an initialized instance
 */
public void setPerson(Person person) {
this.person = person;
}

@InjectPage
private PersonList personList;

@Component(id = personForm)
private Form form;

private boolean cancel;
private boolean delete;

void onValidateForm() {
if (!delete  !cancel) {
// manually validate required fields or annotate the Person
object
/*if (foo.getProperty() == null ||
user.getProperty().trim().equals()) {
form.recordError(Property is a required field.);
}*/
}
}

void onActivate(Long id) {
if (id != null) {
person = personManager.get(id);
}
}

Object onSuccess() {
if 

Re: Problem using BeanEditForm with a POJO

2009-05-02 Thread mraible

I was able to fix the problem by commenting out field.isRequired() in the
following method:


public void insideLabel(Field field, Element labelElement) {
if (inError(field)) {
addErrorClassToCurrentElement(error);
}/*
if (field.isRequired()) {
labelElement.raw( *);
}*/

}

Is there a way to use similar logic and prevent the exception from
happening?

Thanks,

Matt


mraible wrote:
 
 I tried using your hint by changing my template to the following:
 
 t:layout title=message:personDetail.title
   heading=message:personDetail.heading menu=literal:PersonMenu
   xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
 
 t:messagebanner t:id=message type=type/
 
 form t:id=personForm clientValidation=true
 t:errors/
 
 div class=t-beaneditor
 t:beaneditor t:id=person object=person exclude=id/
 
 div class=t-beaneditor-row style=text-align: center
 input type=submit id=save
 value=message:button.save/
 input t:type=submit t:id=delete id=delete
 value=message:button.delete/
 input t:type=submit t:id=cancel id=cancel
 value=message:button.cancel/
 /div
 /div
 /form
 
 script type=text/javascript
 Form.focusFirstElement($(personForm));
 /script
 
 /t:layout
 
 Unfortunately, I still get the same error when trying to view this page:
 
  [exec] ERROR [btpool0-3] PersonForm.run(78) | Render queue error in
 AfterRender[PersonForm:person.loop]: Failure reading parameter 'validate'
 of component core/PropertyEditBlocks:datefield: No object of type
 org.apache.tapestry5.services.PropertyEditContext is available from the
 Environment.  Available types are org.apache.tapestry5.RenderSupport,
 org.apache.tapestry5.ValidationDecorator,
 org.apache.tapestry5.ValidationTracker,
 org.apache.tapestry5.internal.services.ClientBehaviorSupport,
 org.apache.tapestry5.services.FormSupport,
 org.apache.tapestry5.services.Heartbeat.
  [exec] org.apache.tapestry5.ioc.internal.util.TapestryException:
 Failure reading parameter 'validate' of component
 core/PropertyEditBlocks:datefield: No object of type
 org.apache.tapestry5.services.PropertyEditContext is available from the
 Environment.  Available types are org.apache.tapestry5.RenderSupport,
 org.apache.tapestry5.ValidationDecorator,
 org.apache.tapestry5.ValidationTracker,
 org.apache.tapestry5.internal.services.ClientBehaviorSupport,
 org.apache.tapestry5.services.FormSupport,
 org.apache.tapestry5.services.Heartbeat. [at
 classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml, line 3,
 column 47]
  [exec] at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:909)
  [exec] at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$200(ComponentPageElementImpl.java:50)
  [exec] at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl$6.render(ComponentPageElementImpl.java:189)
  [exec] at
 org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:68)
  [exec] at
 org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:108)
  [exec] at
 $PageRenderQueue_12104869ca2.render($PageRenderQueue_12104869ca2.java)
  [exec] at
 $PageRenderQueue_12104869c9b.render($PageRenderQueue_12104869c9b.java)
  [exec] at
 org.apache.tapestry5.services.TapestryModule$15.renderMarkup(TapestryModule.java:1128)
  [exec] at
 com.company.webapp.services.AppModule$1.renderMarkup(AppModule.java:138)
 
 Here is my PersonForm.java class:
 
 package com.company.webapp.pages;
 
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.annotations.Component;
 import org.apache.tapestry5.annotations.InjectPage;
 import org.apache.tapestry5.annotations.Property;
 import org.apache.tapestry5.annotations.Persist;
 import org.apache.tapestry5.annotations.Service;
 import org.apache.tapestry5.corelib.components.EventLink;
 import org.apache.tapestry5.corelib.components.Form;
 import org.apache.tapestry5.PersistenceConstants;
 
 import org.appfuse.service.GenericManager;
 import com.company.model.Person;
 
 import org.slf4j.Logger;
 
 import java.util.List;
 
 public class PersonForm extends BasePage {
 @Inject
 private Logger log;
 
 @Inject
 @Service(personManager)
 private GenericManagerPerson, Long personManager;
 
 @Persist @Property
 private Person person;
 
 public Person getPerson() {
 return person;
 }
 
 /**
  * Allows setting person object from another class (i.e. PersonList)
  *
  * @param person an initialized instance
  */
 public void setPerson(Person person) {
 this.person = person;
 }
 
 @InjectPage
 private PersonList personList;
 
 @Component(id = 

Re: Problem using BeanEditForm with a POJO

2009-05-02 Thread Robert Zeigler

Hi Matt,

Hm, that's an odd exception.
The way BeanEditForm works is to lookup an editor block for each  
property, based on the datatype for that property (datatype is  
determined by the DataTypeAnalyzer service; lookup of the block is the  
job of the BeanBlockSource service).  The information needed for each  
of the editor blocks to function is stashed in a  
PropertyEditContext, which is made available to the blocks by the  
BeanEditor component via the Enviromental service.  Which is why I'm  
saying your exception looks weird: it's saying that the  
PropertyEditContext wasn't available from the environment.  Since this  
presumably happens while rendering the bean editor, it's weird,  
because property edit context /should/ be available!


The mailing list strips attachments; can you post the project elsewhere?
Also, what version of t5?

Robert

On May 2, 2009, at 5/210:46 PM , mraible wrote:



I was able to fix the problem by commenting out field.isRequired()  
in the

following method:


   public void insideLabel(Field field, Element labelElement) {
   if (inError(field)) {
   addErrorClassToCurrentElement(error);
   }/*
   if (field.isRequired()) {
   labelElement.raw( *);
   }*/

   }

Is there a way to use similar logic and prevent the exception from
happening?

Thanks,

Matt


mraible wrote:


I tried using your hint by changing my template to the following:

t:layout title=message:personDetail.title
 heading=message:personDetail.heading  
menu=literal:PersonMenu
 xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd 



   t:messagebanner t:id=message type=type/

   form t:id=personForm clientValidation=true
   t:errors/

   div class=t-beaneditor
   t:beaneditor t:id=person object=person exclude=id/

   div class=t-beaneditor-row style=text-align: center
   input type=submit id=save
value=message:button.save/
   input t:type=submit t:id=delete id=delete
value=message:button.delete/
   input t:type=submit t:id=cancel id=cancel
value=message:button.cancel/
   /div
   /div
   /form

   script type=text/javascript
   Form.focusFirstElement($(personForm));
   /script

/t:layout

Unfortunately, I still get the same error when trying to view this  
page:


[exec] ERROR [btpool0-3] PersonForm.run(78) | Render queue  
error in
AfterRender[PersonForm:person.loop]: Failure reading parameter  
'validate'

of component core/PropertyEditBlocks:datefield: No object of type
org.apache.tapestry5.services.PropertyEditContext is available from  
the

Environment.  Available types are org.apache.tapestry5.RenderSupport,
org.apache.tapestry5.ValidationDecorator,
org.apache.tapestry5.ValidationTracker,
org.apache.tapestry5.internal.services.ClientBehaviorSupport,
org.apache.tapestry5.services.FormSupport,
org.apache.tapestry5.services.Heartbeat.
[exec] org.apache.tapestry5.ioc.internal.util.TapestryException:
Failure reading parameter 'validate' of component
core/PropertyEditBlocks:datefield: No object of type
org.apache.tapestry5.services.PropertyEditContext is available from  
the

Environment.  Available types are org.apache.tapestry5.RenderSupport,
org.apache.tapestry5.ValidationDecorator,
org.apache.tapestry5.ValidationTracker,
org.apache.tapestry5.internal.services.ClientBehaviorSupport,
org.apache.tapestry5.services.FormSupport,
org.apache.tapestry5.services.Heartbeat. [at
classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml,  
line 3,

column 47]
[exec] at
org 
.apache 
.tapestry5 
.internal 
.structure 
.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:909)

[exec] at
org 
.apache.tapestry5.internal.structure.ComponentPageElementImpl.access 
$200(ComponentPageElementImpl.java:50)

[exec] at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl 
$6.render(ComponentPageElementImpl.java:189)

[exec] at
org 
.apache 
.tapestry5 
.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:68)

[exec] at
org 
.apache 
.tapestry5 
.internal 
.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:108)

[exec] at
$ 
PageRenderQueue_12104869ca2.render($PageRenderQueue_12104869ca2.java)

[exec] at
$ 
PageRenderQueue_12104869c9b.render($PageRenderQueue_12104869c9b.java)

[exec] at
org.apache.tapestry5.services.TapestryModule 
$15.renderMarkup(TapestryModule.java:1128)

[exec] at
com.company.webapp.services.AppModule$1.renderMarkup(AppModule.java: 
138)


Here is my PersonForm.java class:

package com.company.webapp.pages;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Service;
import 

Re: Problem using BeanEditForm with a POJO

2009-05-02 Thread mraible

I'm using Tapestry 5.0.14. You can download the project from
http://static.raibledesigns.com/downloads/basic-tapestry.zip.

Matt


Robert Zeigler wrote:
 
 Hi Matt,
 
 Hm, that's an odd exception.
 The way BeanEditForm works is to lookup an editor block for each  
 property, based on the datatype for that property (datatype is  
 determined by the DataTypeAnalyzer service; lookup of the block is the  
 job of the BeanBlockSource service).  The information needed for each  
 of the editor blocks to function is stashed in a  
 PropertyEditContext, which is made available to the blocks by the  
 BeanEditor component via the Enviromental service.  Which is why I'm  
 saying your exception looks weird: it's saying that the  
 PropertyEditContext wasn't available from the environment.  Since this  
 presumably happens while rendering the bean editor, it's weird,  
 because property edit context /should/ be available!
 
 The mailing list strips attachments; can you post the project elsewhere?
 Also, what version of t5?
 
 Robert
 
 On May 2, 2009, at 5/210:46 PM , mraible wrote:
 

 I was able to fix the problem by commenting out field.isRequired()  
 in the
 following method:


public void insideLabel(Field field, Element labelElement) {
if (inError(field)) {
addErrorClassToCurrentElement(error);
}/*
if (field.isRequired()) {
labelElement.raw( *);
}*/

}

 Is there a way to use similar logic and prevent the exception from
 happening?

 Thanks,

 Matt


 mraible wrote:

 I tried using your hint by changing my template to the following:

 t:layout title=message:personDetail.title
  heading=message:personDetail.heading  
 menu=literal:PersonMenu
  xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd 
 

t:messagebanner t:id=message type=type/

form t:id=personForm clientValidation=true
t:errors/

div class=t-beaneditor
t:beaneditor t:id=person object=person exclude=id/

div class=t-beaneditor-row style=text-align: center
input type=submit id=save
 value=message:button.save/
input t:type=submit t:id=delete id=delete
 value=message:button.delete/
input t:type=submit t:id=cancel id=cancel
 value=message:button.cancel/
/div
/div
/form

script type=text/javascript
Form.focusFirstElement($(personForm));
/script

 /t:layout

 Unfortunately, I still get the same error when trying to view this  
 page:

 [exec] ERROR [btpool0-3] PersonForm.run(78) | Render queue  
 error in
 AfterRender[PersonForm:person.loop]: Failure reading parameter  
 'validate'
 of component core/PropertyEditBlocks:datefield: No object of type
 org.apache.tapestry5.services.PropertyEditContext is available from  
 the
 Environment.  Available types are org.apache.tapestry5.RenderSupport,
 org.apache.tapestry5.ValidationDecorator,
 org.apache.tapestry5.ValidationTracker,
 org.apache.tapestry5.internal.services.ClientBehaviorSupport,
 org.apache.tapestry5.services.FormSupport,
 org.apache.tapestry5.services.Heartbeat.
 [exec] org.apache.tapestry5.ioc.internal.util.TapestryException:
 Failure reading parameter 'validate' of component
 core/PropertyEditBlocks:datefield: No object of type
 org.apache.tapestry5.services.PropertyEditContext is available from  
 the
 Environment.  Available types are org.apache.tapestry5.RenderSupport,
 org.apache.tapestry5.ValidationDecorator,
 org.apache.tapestry5.ValidationTracker,
 org.apache.tapestry5.internal.services.ClientBehaviorSupport,
 org.apache.tapestry5.services.FormSupport,
 org.apache.tapestry5.services.Heartbeat. [at
 classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml,  
 line 3,
 column 47]
 [exec] at
 org 
 .apache 
 .tapestry5 
 .internal 
 .structure 
 .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:909)
 [exec] at
 org 
 .apache.tapestry5.internal.structure.ComponentPageElementImpl.access 
 $200(ComponentPageElementImpl.java:50)
 [exec] at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl 
 $6.render(ComponentPageElementImpl.java:189)
 [exec] at
 org 
 .apache 
 .tapestry5 
 .internal.services.RenderQueueImpl.run(RenderQueueImpl.java:68)
 [exec] at
 org 
 .apache 
 .tapestry5 
 .internal 
 .services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:108)
 [exec] at
 $ 
 PageRenderQueue_12104869ca2.render($PageRenderQueue_12104869ca2.java)
 [exec] at
 $ 
 PageRenderQueue_12104869c9b.render($PageRenderQueue_12104869c9b.java)
 [exec] at
 org.apache.tapestry5.services.TapestryModule 
 $15.renderMarkup(TapestryModule.java:1128)
 [exec] at
 com.company.webapp.services.AppModule$1.renderMarkup(AppModule.java: 
 138)

 Here is my PersonForm.java class:

 package com.company.webapp.pages;

 import org.apache.tapestry5.ioc.annotations.Inject;
 import