You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Denis Souza <ds...@sti.com.br> on 2005/04/18 19:57:28 UTC

Problem with form component

Hello,

 

            I'm trying to write a new Foreach component that allows you to
safely add/remove entries from the provided list of objects during the
rewind cycle (to make it easier to create pages such as the todo listing
show in "Tapestry in Action"). I do this by caching the list during the
render cycle so that the same elements will be used during rewind. I got it
to work fine when it appears only once in a page, however, In order to make
this work with when it appears more than once in a page or nested inside
another Foreach component, I found that had to extend AbstractFormComponent
instead of BaseComponent, since I can then obtain a unique ID for each
occurrence. Once I did that, I started to get this exception:

 

org.apache.tapestry.ApplicationRuntimeException

Method 'public abstract java.lang.String
org.apache.tapestry.form.AbstractFormComponent.getName()' (declared in class
org.apache.tapestry.form.AbstractFormComponent) has no implementation in
class app.internal.component.form.SafeForeach (or enhanced subclass
app.internal.component.form.SafeForeach$Enhance_73).

 

If I create do-nothing get/setName methods, Tapestry is satisfied and starts
asking for the implementation of isDisabled() and after that for the
implementation of getForm(). I'm afraid it's asking for every abstract
method present in AbstractFormComponent. Shouldn't Tapestry automatically
create them in the enhanced subclass? I looked at code from various other
form components and I couldn't find out what is it I'm doing wrong. I'm
pretty sure Tapestry does not require the component class to implement these
methods. This is not the first form component I've written, but it's the
first one that gave me trouble.

 

I'm using Tapestry 3.0.3 (but I had the same problem in 3.0.2).

 

 

Here's some of the stack trace in case it might be useful:

 


Stack Trace:


*
org.apache.tapestry.enhance.DefaultComponentClassEnhancer.validateEnhancedCl
ass(DefaultComponentClassEnhancer.java:203) 

*
org.apache.tapestry.enhance.DefaultComponentClassEnhancer.constructComponent
Class(DefaultComponentClassEnhancer.java:146) 

*
org.apache.tapestry.enhance.DefaultComponentClassEnhancer.getEnhancedClass(D
efaultComponentClassEnhancer.java:97) 

*
org.apache.tapestry.pageload.PageLoader.instantiateComponent(PageLoader.java
:603) 

*
org.apache.tapestry.pageload.PageLoader.createImplicitComponent(PageLoader.j
ava:569) 

*
org.apache.tapestry.BaseComponentTemplateLoader.createImplicitComponent(Base
ComponentTemplateLoader.java:295) 

*
org.apache.tapestry.BaseComponentTemplateLoader.process(BaseComponentTemplat
eLoader.java:237) 

*
org.apache.tapestry.BaseComponentTemplateLoader.process(BaseComponentTemplat
eLoader.java:172) 

*
org.apache.tapestry.BaseComponent.readTemplate(BaseComponent.java:100) 

*
org.apache.tapestry.BaseComponent.finishLoad(BaseComponent.java:135) 

*
org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:5
19) 

*
org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:764) 

*
org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:152) 

*
org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:195) 

 

Any ideas?

 

Denis Souza

 


Re: Problem with form component

Posted by Ivano <i....@mclink.it>.
No need for apologies, I'm glad to be of any help.
I had the same problem trying to extend the Form component myself.
Have a nice day =)

Ivano.

Denis Souza wrote:

>Hi Ivano,
>
>I feel really stupid now. Looking again at the implementation in other form
>components, I found two lines at the bottom of every component
>specification:
>
><property-specification name="name" type="java.lang.String"/>
><property-specification name="form" type="org.apache.tapestry.IForm"/>
>
>I guess I didn't see them from looking at the code for so long. My component
>is now finally working. Thanks for getting my attention to this!
>
>Denis Souza
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Problem with form component

Posted by Denis Souza <ds...@sti.com.br>.
Hi Ivano,

I feel really stupid now. Looking again at the implementation in other form
components, I found two lines at the bottom of every component
specification:

<property-specification name="name" type="java.lang.String"/>
<property-specification name="form" type="org.apache.tapestry.IForm"/>

I guess I didn't see them from looking at the code for so long. My component
is now finally working. Thanks for getting my attention to this!

Denis Souza


-----Original Message-----
From: Ivano Pagano [mailto:i.pagano@mclink.it] 
Sent: terça-feira, 19 de abril de 2005 06:54
To: Tapestry users
Subject: Re: Problem with form component

Hi Denis,
I guess the abstract getters/setters in the AbstractFormComponent are 
not intended as "Tapestry Properties" for the component.
I think you need to implement them to make your form actually work 
consistently with your specific design.

For the framework to generate abstract method "automagically" you should 
also declare the properties in the component descriptor (i.e. 
"SafeForeach.jwc" or something alike).

If anyone knows better, I would gladly receive a confirmation of my guess.

Ivano.

Denis Souza wrote:

>Hello,
>
> 
>
>            I'm trying to write a new Foreach component that allows you to
>safely add/remove entries from the provided list of objects during the
>rewind cycle (to make it easier to create pages such as the todo listing
>show in "Tapestry in Action"). I do this by caching the list during the
>render cycle so that the same elements will be used during rewind. I got it
>to work fine when it appears only once in a page, however, In order to make
>this work with when it appears more than once in a page or nested inside
>another Foreach component, I found that had to extend AbstractFormComponent
>instead of BaseComponent, since I can then obtain a unique ID for each
>occurrence. Once I did that, I started to get this exception:
>
> 
>
>org.apache.tapestry.ApplicationRuntimeException
>
>Method 'public abstract java.lang.String
>org.apache.tapestry.form.AbstractFormComponent.getName()' (declared in
class
>org.apache.tapestry.form.AbstractFormComponent) has no implementation in
>class app.internal.component.form.SafeForeach (or enhanced subclass
>app.internal.component.form.SafeForeach$Enhance_73).
>
> 
>
>If I create do-nothing get/setName methods, Tapestry is satisfied and
starts
>asking for the implementation of isDisabled() and after that for the
>implementation of getForm(). I'm afraid it's asking for every abstract
>method present in AbstractFormComponent. Shouldn't Tapestry automatically
>create them in the enhanced subclass? I looked at code from various other
>form components and I couldn't find out what is it I'm doing wrong. I'm
>pretty sure Tapestry does not require the component class to implement
these
>methods. This is not the first form component I've written, but it's the
>first one that gave me trouble.
>
>  
>






---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Problem with form component

Posted by Denis Souza <ds...@sti.com.br>.
Hi Ivano,

> I guess the abstract getters/setters in the AbstractFormComponent are 
> not intended as "Tapestry Properties" for the component.

I understand that. Just to make things clear, I am NOT using using them as
properties for the component. I'd prefer to ignore them, but when I get to
the page that contains the component, Tapestry keeps complaining that
they're not implemented.

> I think you need to implement them to make your form actually work 
> consistently with your specific design.
> For the framework to generate abstract method "automagically" you should 
> also declare the properties in the component descriptor (i.e. 
> "SafeForeach.jwc" or something alike).

That's what I don't get. All my component really does is implement a
renderComponent method and essentially it does the same as a regular Foreach
component except for some additional functionality during rewind. It
shouldn't have to implement any of the abstract getters/setter from
AbstractFormComponent. If you look at Tapestry's source code, most form
components don't implement them either, nor do they declare such methods in
their .jwc file. I assume it is because Tapestry takes care of it for you.
The question is: Why is it complaining now? I'm pretty sure I must be doing
something wrong, but whatever it is, it's very subtle because I can't find
it, and the error message I'm getting is not being so helpful.

Thanks, for your reply, Ivano. I did get some ideas from it. I'll keep
trying to figure out what's wrong or to find a different solution. If I find
out more, I'll let you know.

Denis Souza




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Problem with form component

Posted by Ivano Pagano <i....@mclink.it>.
Hi Denis,
I guess the abstract getters/setters in the AbstractFormComponent are 
not intended as "Tapestry Properties" for the component.
I think you need to implement them to make your form actually work 
consistently with your specific design.

For the framework to generate abstract method "automagically" you should 
also declare the properties in the component descriptor (i.e. 
"SafeForeach.jwc" or something alike).

If anyone knows better, I would gladly receive a confirmation of my guess.

Ivano.

Denis Souza wrote:

>Hello,
>
> 
>
>            I'm trying to write a new Foreach component that allows you to
>safely add/remove entries from the provided list of objects during the
>rewind cycle (to make it easier to create pages such as the todo listing
>show in "Tapestry in Action"). I do this by caching the list during the
>render cycle so that the same elements will be used during rewind. I got it
>to work fine when it appears only once in a page, however, In order to make
>this work with when it appears more than once in a page or nested inside
>another Foreach component, I found that had to extend AbstractFormComponent
>instead of BaseComponent, since I can then obtain a unique ID for each
>occurrence. Once I did that, I started to get this exception:
>
> 
>
>org.apache.tapestry.ApplicationRuntimeException
>
>Method 'public abstract java.lang.String
>org.apache.tapestry.form.AbstractFormComponent.getName()' (declared in class
>org.apache.tapestry.form.AbstractFormComponent) has no implementation in
>class app.internal.component.form.SafeForeach (or enhanced subclass
>app.internal.component.form.SafeForeach$Enhance_73).
>
> 
>
>If I create do-nothing get/setName methods, Tapestry is satisfied and starts
>asking for the implementation of isDisabled() and after that for the
>implementation of getForm(). I'm afraid it's asking for every abstract
>method present in AbstractFormComponent. Shouldn't Tapestry automatically
>create them in the enhanced subclass? I looked at code from various other
>form components and I couldn't find out what is it I'm doing wrong. I'm
>pretty sure Tapestry does not require the component class to implement these
>methods. This is not the first form component I've written, but it's the
>first one that gave me trouble.
>
>  
>