You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ea...@gmx.de on 2004/02/29 19:59:32 UTC

Re: Overriding renderComponent Part III

I dont think it needs to be mentioned within the application file, or does
it?
According to the manual, this needs to be a type not a class, in this case
an Insert component.
[type	string		 	A component type to instantiate.]

There are no error messages, but simply nothing appears. I even added the 
isStateful and trigger methods now, methods...although I am not sure whether
they are necessary at all in this case.


public abstract class WeatherBlock extends AbstractComponent implements
IDirect {

	public abstract IActionListener getListener();
	public abstract Object getParameters();

	public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {

		StringBuffer buffer = new StringBuffer();
		buffer.append("<table border=1>");
		buffer.append("<tr>");
		buffer.append("<td>");
		buffer.append("heeellloo");
		buffer.append("</td>");
		buffer.append("</tr>");
		buffer.append("</table>");
		writer.print(buffer.toString());
	}

	public boolean isStateful() {
		return false;
	}
	public void trigger(IRequestCycle cycle) {

		IActionListener listener = getListener();

		if (listener == null)
			throw Tapestry.createRequiredParameterException(this, "listener");

		listener.actionTriggered(this, cycle);

	}

}

Within the html template:

	<span jwcid="WeatherBlock"/>

and witin the page definition:


<page-specification
class="org.apache.tapestry.pets.presentation.pages.HomePage">
<description>Simple Home Page</description>
<component id="WeatherBlock" type="Insert"/>
</page-specification>
											
WeatherBlock jwc

<component-specification 
class="org.apache.tapestry.pets.presentation.components.WeatherBlock"/>

Has anyone ever tried that?



Toby



> 
> > <component id="WeatherBlock" type="Insert"/>
> This line seems to be incorrect. The component type should be some
> "WeatherBlock" (see your .application file what is the name of your
> weather
> component).
> 
> Norbi
> 
> ----- Original Message ----- 
> From: <ea...@gmx.de>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Cc: <ta...@jakarta.apache.org>
> Sent: Sunday, February 29, 2004 9:51 AM
> Subject: Re: Overriding renderComponent Part II
> 
> 
> > Oh, another additional question:
> >
> > In theory, if this block is to appear on 50 pages, how can I avoid
> having
> to
> > add it on every single page specification? Just asking as if it should
> ever
> > change I would only want to edit on file not 50....
> >
> > Thanks!
> >
> > Toby
> >
> > I took the Petshop example and just wanted to enter a tiny little Block
> with
> > some weather information.
> > Even though it is a petshop.... ;-)
> >
> > It should render itself from a database later on, so I would like to get
> > away with no html templates files at all.
> >
> >
> > // WeatherBlock.java
> >
> > public  class WeatherBlock extends AbstractComponent  {
> >
> > public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
> >
> > StringBuffer buffer = new StringBuffer();
> > buffer.append("<table border=1>");
> > buffer.append("<tr>");
> > buffer.append("<td>");
> > buffer.append("heeellloo");
> > buffer.append("</td>");
> > buffer.append("</tr>");
> > buffer.append("</table>");
> > writer.print(buffer.toString());
> > }
> >
> > }
> >
> > // Home.page .... Petshop example
> >
> > <page-specification
> > class="org.apache.tapestry.pets.presentation.pages.HomePage">
> > <description>Simple Home Page</description>
> > <component id="WeatherBlock" type="Insert"/>
> > </page-specification>
> >
> >
> > // within Home.html
> >
> > <span jwcid="WeatherBlock"/>
> >
> >
> > Is there anything missing?
> >
> > Thanks!
> >
> > > Check if you're extending BaseComponent, instead of AbstractComponent.
> > > AFAIK BaseComponents must have a template and AbstractComponents
> don't.
> > >
> > > On Saturday, February 28, 2004, at 06:11  PM, easy-to-remember@gmx.de
> > > wrote:
> > >
> > > > 2. Why does it still want to have a template file even if I render
> the
> > > > html
> > > > myself?
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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


Re: Overriding renderComponent Part III

Posted by ea...@gmx.de.
Thanks!

The jwc file is under web-context/WEB-INF in the petshop example.

What would the specification path be, as it is outside of the directory for
class files?
Can I just write
<component-type type="WeatherBlock"
 specification-path="/WeatherBlock.jwc"> in this case?

Thanks again....



> In your .application file create a line:
> 
>     <component-type type="WeatherBlock"
> specification-path="/com/mysite/presentation/components/WeatherBlock.jwc"
> />
> 
> 
> 
> 
> In the HTML code you should write
>     <span jwcid="@WeatherBlock" />
> 
> OR
> 
> if you want to define in the .page file
>     <component id="weatherBlockId" type="WeatherBlock"/>
> and in your HTML file
>     <span jwcid="weatherBlockId" />
> 
> I hope I wrote it correctly.
> Norbi
> 
> ----- Original Message ----- 
> From: <ea...@gmx.de>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Sunday, February 29, 2004 8:57 PM
> Subject: Re: Overriding renderComponent Part III
> 
> 
> > When I do that I get:
> >
> > 'com.mysite.presentation.components.WeatherBlock' is not a valid
> component
> > type.
> >
> >
> > If I enter Insert, at least it does not complain ;-)
> >
> >
> > Does anyone know an example of a component that does insert html but
> that
> > does not require a template?
> >
> > Thanks!
> >
> >
> > > You most definitely need to say type="WeatherBlock".... you want to
> use
> > > the WeatherBlock component, not the Insert component.  Right?
> > >
> > > I'm surprised the Insert component is not complaining for lack of a
> > > 'value', actually.  Is it not required?  Shouldn't it be?
> > >
> > > jwcid is *not* the type of component you are using, it is just a made
> > > up name.  Change it to 'xyz', and work from there :)
> > >
> > > Erik
> > >
> > >
> > > On Feb 29, 2004, at 1:59 PM, easy-to-remember@gmx.de wrote:
> > >
> > > > I dont think it needs to be mentioned within the application file,
> or
> > > > does
> > > > it?
> > > > According to the manual, this needs to be a type not a class, in
> this
> > > > case
> > > > an Insert component.
> > > > [type string A component type to instantiate.]
> > > >
> > > > There are no error messages, but simply nothing appears. I even
> added
> > > > the
> > > > isStateful and trigger methods now, methods...although I am not sure
> > > > whether
> > > > they are necessary at all in this case.
> > > >
> > > >
> > > > public abstract class WeatherBlock extends AbstractComponent
> implements
> > > > IDirect {
> > > >
> > > > public abstract IActionListener getListener();
> > > > public abstract Object getParameters();
> > > >
> > > > public void renderComponent(IMarkupWriter writer, IRequestCycle
> > > > cycle) {
> > > >
> > > > StringBuffer buffer = new StringBuffer();
> > > > buffer.append("<table border=1>");
> > > > buffer.append("<tr>");
> > > > buffer.append("<td>");
> > > > buffer.append("heeellloo");
> > > > buffer.append("</td>");
> > > > buffer.append("</tr>");
> > > > buffer.append("</table>");
> > > > writer.print(buffer.toString());
> > > > }
> > > >
> > > > public boolean isStateful() {
> > > > return false;
> > > > }
> > > > public void trigger(IRequestCycle cycle) {
> > > >
> > > > IActionListener listener = getListener();
> > > >
> > > > if (listener == null)
> > > > throw Tapestry.createRequiredParameterException(this, "listener");
> > > >
> > > > listener.actionTriggered(this, cycle);
> > > >
> > > > }
> > > >
> > > > }
> > > >
> > > > Within the html template:
> > > >
> > > > <span jwcid="WeatherBlock"/>
> > > >
> > > > and witin the page definition:
> > > >
> > > >
> > > > <page-specification
> > > > class="org.apache.tapestry.pets.presentation.pages.HomePage">
> > > > <description>Simple Home Page</description>
> > > > <component id="WeatherBlock" type="Insert"/>
> > > > </page-specification>
> > > >
> > > > WeatherBlock jwc
> > > >
> > > > <component-specification
> > > >
> class="org.apache.tapestry.pets.presentation.components.WeatherBlock"/>
> > > >
> > > > Has anyone ever tried that?
> > > >
> > > >
> > > >
> > > > Toby
> > > >
> > > >
> > > >
> > > >>
> > > >>> <component id="WeatherBlock" type="Insert"/>
> > > >> This line seems to be incorrect. The component type should be some
> > > >> "WeatherBlock" (see your .application file what is the name of your
> > > >> weather
> > > >> component).
> > > >>
> > > >> Norbi
> > > >>
> > > >> ----- Original Message -----
> > > >> From: <ea...@gmx.de>
> > > >> To: "Tapestry users" <ta...@jakarta.apache.org>
> > > >> Cc: <ta...@jakarta.apache.org>
> > > >> Sent: Sunday, February 29, 2004 9:51 AM
> > > >> Subject: Re: Overriding renderComponent Part II
> > > >>
> > > >>
> > > >>> Oh, another additional question:
> > > >>>
> > > >>> In theory, if this block is to appear on 50 pages, how can I avoid
> > > >> having
> > > >> to
> > > >>> add it on every single page specification? Just asking as if it
> > > >>> should
> > > >> ever
> > > >>> change I would only want to edit on file not 50....
> > > >>>
> > > >>> Thanks!
> > > >>>
> > > >>> Toby
> > > >>>
> > > >>> I took the Petshop example and just wanted to enter a tiny little
> > > >>> Block
> > > >> with
> > > >>> some weather information.
> > > >>> Even though it is a petshop.... ;-)
> > > >>>
> > > >>> It should render itself from a database later on, so I would like
> to
> > > >>> get
> > > >>> away with no html templates files at all.
> > > >>>
> > > >>>
> > > >>> // WeatherBlock.java
> > > >>>
> > > >>> public  class WeatherBlock extends AbstractComponent  {
> > > >>>
> > > >>> public void renderComponent(IMarkupWriter writer, IRequestCycle
> > > >>> cycle) {
> > > >>>
> > > >>> StringBuffer buffer = new StringBuffer();
> > > >>> buffer.append("<table border=1>");
> > > >>> buffer.append("<tr>");
> > > >>> buffer.append("<td>");
> > > >>> buffer.append("heeellloo");
> > > >>> buffer.append("</td>");
> > > >>> buffer.append("</tr>");
> > > >>> buffer.append("</table>");
> > > >>> writer.print(buffer.toString());
> > > >>> }
> > > >>>
> > > >>> }
> > > >>>
> > > >>> // Home.page .... Petshop example
> > > >>>
> > > >>> <page-specification
> > > >>> class="org.apache.tapestry.pets.presentation.pages.HomePage">
> > > >>> <description>Simple Home Page</description>
> > > >>> <component id="WeatherBlock" type="Insert"/>
> > > >>> </page-specification>
> > > >>>
> > > >>>
> > > >>> // within Home.html
> > > >>>
> > > >>> <span jwcid="WeatherBlock"/>
> > > >>>
> > > >>>
> > > >>> Is there anything missing?
> > > >>>
> > > >>> Thanks!
> > > >>>
> > > >>>> Check if you're extending BaseComponent, instead of
> > > >>>> AbstractComponent.
> > > >>>> AFAIK BaseComponents must have a template and AbstractComponents
> > > >> don't.
> > > >>>>
> > > >>>> On Saturday, February 28, 2004, at 06:11  PM,
> > > >>>> easy-to-remember@gmx.de
> > > >>>> wrote:
> > > >>>>
> > > >>>>> 2. Why does it still want to have a template file even if I
> render
> > > >> the
> > > >>>>> html
> > > >>>>> myself?
> > > >>>>
> > > >>>>
> > >
> >>>> -------------------------------------------------------------------- 
> > > >>>> -
> > > >>>> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > > >>>> For additional commands, e-mail:
> > > >>>> tapestry-user-help@jakarta.apache.org
> > > >>>>
> > > >>>
> > > >>>
> > >
> >>> ---------------------------------------------------------------------
> > > >>> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > > >>> For additional commands, e-mail:
> > > >>> tapestry-user-help@jakarta.apache.org
> > > >>>
> > > >>>
> > > >>
> > > >>
> ---------------------------------------------------------------------
> > > >> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > > >> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> > > >>
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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


Re: Overriding renderComponent Part V

Posted by ea...@gmx.de.
Hm.....ok, I solved the bit with the path now....but here again comes the
problem that it needs
to have an html template file that corresponds to the WeatherBlock. :-(

I already added allow-body="no" to the component specification....





"Could not find template for component Home/$WeatherBlock in locale de."

> In your .application file create a line:
> 
>     <component-type type="WeatherBlock"
> specification-path="/com/mysite/presentation/components/WeatherBlock.jwc"
> />
> 
> 
> 
> 
> In the HTML code you should write
>     <span jwcid="@WeatherBlock" />
> 
> OR
> 
> if you want to define in the .page file
>     <component id="weatherBlockId" type="WeatherBlock"/>
> and in your HTML file
>     <span jwcid="weatherBlockId" />
> 
> I hope I wrote it correctly.
> Norbi
> 
> ----- Original Message ----- 
> From: <ea...@gmx.de>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Sunday, February 29, 2004 8:57 PM
> Subject: Re: Overriding renderComponent Part III
> 
> 
> > When I do that I get:
> >
> > 'com.mysite.presentation.components.WeatherBlock' is not a valid
> component
> > type.
> >
> >
> > If I enter Insert, at least it does not complain ;-)
> >
> >
> > Does anyone know an example of a component that does insert html but
> that
> > does not require a template?
> >
> > Thanks!
> >
> >
> > > You most definitely need to say type="WeatherBlock".... you want to
> use
> > > the WeatherBlock component, not the Insert component.  Right?
> > >
> > > I'm surprised the Insert component is not complaining for lack of a
> > > 'value', actually.  Is it not required?  Shouldn't it be?
> > >
> > > jwcid is *not* the type of component you are using, it is just a made
> > > up name.  Change it to 'xyz', and work from there :)
> > >
> > > Erik
> > >
> > >
> > > On Feb 29, 2004, at 1:59 PM, easy-to-remember@gmx.de wrote:
> > >
> > > > I dont think it needs to be mentioned within the application file,
> or
> > > > does
> > > > it?
> > > > According to the manual, this needs to be a type not a class, in
> this
> > > > case
> > > > an Insert component.
> > > > [type string A component type to instantiate.]
> > > >
> > > > There are no error messages, but simply nothing appears. I even
> added
> > > > the
> > > > isStateful and trigger methods now, methods...although I am not sure
> > > > whether
> > > > they are necessary at all in this case.
> > > >
> > > >
> > > > public abstract class WeatherBlock extends AbstractComponent
> implements
> > > > IDirect {
> > > >
> > > > public abstract IActionListener getListener();
> > > > public abstract Object getParameters();
> > > >
> > > > public void renderComponent(IMarkupWriter writer, IRequestCycle
> > > > cycle) {
> > > >
> > > > StringBuffer buffer = new StringBuffer();
> > > > buffer.append("<table border=1>");
> > > > buffer.append("<tr>");
> > > > buffer.append("<td>");
> > > > buffer.append("heeellloo");
> > > > buffer.append("</td>");
> > > > buffer.append("</tr>");
> > > > buffer.append("</table>");
> > > > writer.print(buffer.toString());
> > > > }
> > > >
> > > > public boolean isStateful() {
> > > > return false;
> > > > }
> > > > public void trigger(IRequestCycle cycle) {
> > > >
> > > > IActionListener listener = getListener();
> > > >
> > > > if (listener == null)
> > > > throw Tapestry.createRequiredParameterException(this, "listener");
> > > >
> > > > listener.actionTriggered(this, cycle);
> > > >
> > > > }
> > > >
> > > > }
> > > >
> > > > Within the html template:
> > > >
> > > > <span jwcid="WeatherBlock"/>
> > > >
> > > > and witin the page definition:
> > > >
> > > >
> > > > <page-specification
> > > > class="org.apache.tapestry.pets.presentation.pages.HomePage">
> > > > <description>Simple Home Page</description>
> > > > <component id="WeatherBlock" type="Insert"/>
> > > > </page-specification>
> > > >
> > > > WeatherBlock jwc
> > > >
> > > > <component-specification
> > > >
> class="org.apache.tapestry.pets.presentation.components.WeatherBlock"/>
> > > >
> > > > Has anyone ever tried that?
> > > >
> > > >
> > > >
> > > > Toby
> > > >
> > > >
> > > >
> > > >>
> > > >>> <component id="WeatherBlock" type="Insert"/>
> > > >> This line seems to be incorrect. The component type should be some
> > > >> "WeatherBlock" (see your .application file what is the name of your
> > > >> weather
> > > >> component).
> > > >>
> > > >> Norbi
> > > >>
> > > >> ----- Original Message -----
> > > >> From: <ea...@gmx.de>
> > > >> To: "Tapestry users" <ta...@jakarta.apache.org>
> > > >> Cc: <ta...@jakarta.apache.org>
> > > >> Sent: Sunday, February 29, 2004 9:51 AM
> > > >> Subject: Re: Overriding renderComponent Part II
> > > >>
> > > >>
> > > >>> Oh, another additional question:
> > > >>>
> > > >>> In theory, if this block is to appear on 50 pages, how can I avoid
> > > >> having
> > > >> to
> > > >>> add it on every single page specification? Just asking as if it
> > > >>> should
> > > >> ever
> > > >>> change I would only want to edit on file not 50....
> > > >>>
> > > >>> Thanks!
> > > >>>
> > > >>> Toby
> > > >>>
> > > >>> I took the Petshop example and just wanted to enter a tiny little
> > > >>> Block
> > > >> with
> > > >>> some weather information.
> > > >>> Even though it is a petshop.... ;-)
> > > >>>
> > > >>> It should render itself from a database later on, so I would like
> to
> > > >>> get
> > > >>> away with no html templates files at all.
> > > >>>
> > > >>>
> > > >>> // WeatherBlock.java
> > > >>>
> > > >>> public  class WeatherBlock extends AbstractComponent  {
> > > >>>
> > > >>> public void renderComponent(IMarkupWriter writer, IRequestCycle
> > > >>> cycle) {
> > > >>>
> > > >>> StringBuffer buffer = new StringBuffer();
> > > >>> buffer.append("<table border=1>");
> > > >>> buffer.append("<tr>");
> > > >>> buffer.append("<td>");
> > > >>> buffer.append("heeellloo");
> > > >>> buffer.append("</td>");
> > > >>> buffer.append("</tr>");
> > > >>> buffer.append("</table>");
> > > >>> writer.print(buffer.toString());
> > > >>> }
> > > >>>
> > > >>> }
> > > >>>
> > > >>> // Home.page .... Petshop example
> > > >>>
> > > >>> <page-specification
> > > >>> class="org.apache.tapestry.pets.presentation.pages.HomePage">
> > > >>> <description>Simple Home Page</description>
> > > >>> <component id="WeatherBlock" type="Insert"/>
> > > >>> </page-specification>
> > > >>>
> > > >>>
> > > >>> // within Home.html
> > > >>>
> > > >>> <span jwcid="WeatherBlock"/>
> > > >>>
> > > >>>
> > > >>> Is there anything missing?
> > > >>>
> > > >>> Thanks!
> > > >>>
> > > >>>> Check if you're extending BaseComponent, instead of
> > > >>>> AbstractComponent.
> > > >>>> AFAIK BaseComponents must have a template and AbstractComponents
> > > >> don't.
> > > >>>>
> > > >>>> On Saturday, February 28, 2004, at 06:11  PM,
> > > >>>> easy-to-remember@gmx.de
> > > >>>> wrote:
> > > >>>>
> > > >>>>> 2. Why does it still want to have a template file even if I
> render
> > > >> the
> > > >>>>> html
> > > >>>>> myself?
> > > >>>>
> > > >>>>
> > >
> >>>> -------------------------------------------------------------------- 
> > > >>>> -
> > > >>>> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > > >>>> For additional commands, e-mail:
> > > >>>> tapestry-user-help@jakarta.apache.org
> > > >>>>
> > > >>>
> > > >>>
> > >
> >>> ---------------------------------------------------------------------
> > > >>> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > > >>> For additional commands, e-mail:
> > > >>> tapestry-user-help@jakarta.apache.org
> > > >>>
> > > >>>
> > > >>
> > > >>
> ---------------------------------------------------------------------
> > > >> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > > >> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> > > >>
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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


Re: Overriding renderComponent Part III

Posted by Programozás <pr...@hotmail.com>.
In your .application file create a line:

    <component-type type="WeatherBlock"
specification-path="/com/mysite/presentation/components/WeatherBlock.jwc" />




In the HTML code you should write
    <span jwcid="@WeatherBlock" />

OR

if you want to define in the .page file
    <component id="weatherBlockId" type="WeatherBlock"/>
and in your HTML file
    <span jwcid="weatherBlockId" />

I hope I wrote it correctly.
Norbi

----- Original Message ----- 
From: <ea...@gmx.de>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Sunday, February 29, 2004 8:57 PM
Subject: Re: Overriding renderComponent Part III


> When I do that I get:
>
> 'com.mysite.presentation.components.WeatherBlock' is not a valid component
> type.
>
>
> If I enter Insert, at least it does not complain ;-)
>
>
> Does anyone know an example of a component that does insert html but that
> does not require a template?
>
> Thanks!
>
>
> > You most definitely need to say type="WeatherBlock".... you want to use
> > the WeatherBlock component, not the Insert component.  Right?
> >
> > I'm surprised the Insert component is not complaining for lack of a
> > 'value', actually.  Is it not required?  Shouldn't it be?
> >
> > jwcid is *not* the type of component you are using, it is just a made
> > up name.  Change it to 'xyz', and work from there :)
> >
> > Erik
> >
> >
> > On Feb 29, 2004, at 1:59 PM, easy-to-remember@gmx.de wrote:
> >
> > > I dont think it needs to be mentioned within the application file, or
> > > does
> > > it?
> > > According to the manual, this needs to be a type not a class, in this
> > > case
> > > an Insert component.
> > > [type string A component type to instantiate.]
> > >
> > > There are no error messages, but simply nothing appears. I even added
> > > the
> > > isStateful and trigger methods now, methods...although I am not sure
> > > whether
> > > they are necessary at all in this case.
> > >
> > >
> > > public abstract class WeatherBlock extends AbstractComponent
implements
> > > IDirect {
> > >
> > > public abstract IActionListener getListener();
> > > public abstract Object getParameters();
> > >
> > > public void renderComponent(IMarkupWriter writer, IRequestCycle
> > > cycle) {
> > >
> > > StringBuffer buffer = new StringBuffer();
> > > buffer.append("<table border=1>");
> > > buffer.append("<tr>");
> > > buffer.append("<td>");
> > > buffer.append("heeellloo");
> > > buffer.append("</td>");
> > > buffer.append("</tr>");
> > > buffer.append("</table>");
> > > writer.print(buffer.toString());
> > > }
> > >
> > > public boolean isStateful() {
> > > return false;
> > > }
> > > public void trigger(IRequestCycle cycle) {
> > >
> > > IActionListener listener = getListener();
> > >
> > > if (listener == null)
> > > throw Tapestry.createRequiredParameterException(this, "listener");
> > >
> > > listener.actionTriggered(this, cycle);
> > >
> > > }
> > >
> > > }
> > >
> > > Within the html template:
> > >
> > > <span jwcid="WeatherBlock"/>
> > >
> > > and witin the page definition:
> > >
> > >
> > > <page-specification
> > > class="org.apache.tapestry.pets.presentation.pages.HomePage">
> > > <description>Simple Home Page</description>
> > > <component id="WeatherBlock" type="Insert"/>
> > > </page-specification>
> > >
> > > WeatherBlock jwc
> > >
> > > <component-specification
> > >
class="org.apache.tapestry.pets.presentation.components.WeatherBlock"/>
> > >
> > > Has anyone ever tried that?
> > >
> > >
> > >
> > > Toby
> > >
> > >
> > >
> > >>
> > >>> <component id="WeatherBlock" type="Insert"/>
> > >> This line seems to be incorrect. The component type should be some
> > >> "WeatherBlock" (see your .application file what is the name of your
> > >> weather
> > >> component).
> > >>
> > >> Norbi
> > >>
> > >> ----- Original Message -----
> > >> From: <ea...@gmx.de>
> > >> To: "Tapestry users" <ta...@jakarta.apache.org>
> > >> Cc: <ta...@jakarta.apache.org>
> > >> Sent: Sunday, February 29, 2004 9:51 AM
> > >> Subject: Re: Overriding renderComponent Part II
> > >>
> > >>
> > >>> Oh, another additional question:
> > >>>
> > >>> In theory, if this block is to appear on 50 pages, how can I avoid
> > >> having
> > >> to
> > >>> add it on every single page specification? Just asking as if it
> > >>> should
> > >> ever
> > >>> change I would only want to edit on file not 50....
> > >>>
> > >>> Thanks!
> > >>>
> > >>> Toby
> > >>>
> > >>> I took the Petshop example and just wanted to enter a tiny little
> > >>> Block
> > >> with
> > >>> some weather information.
> > >>> Even though it is a petshop.... ;-)
> > >>>
> > >>> It should render itself from a database later on, so I would like to
> > >>> get
> > >>> away with no html templates files at all.
> > >>>
> > >>>
> > >>> // WeatherBlock.java
> > >>>
> > >>> public  class WeatherBlock extends AbstractComponent  {
> > >>>
> > >>> public void renderComponent(IMarkupWriter writer, IRequestCycle
> > >>> cycle) {
> > >>>
> > >>> StringBuffer buffer = new StringBuffer();
> > >>> buffer.append("<table border=1>");
> > >>> buffer.append("<tr>");
> > >>> buffer.append("<td>");
> > >>> buffer.append("heeellloo");
> > >>> buffer.append("</td>");
> > >>> buffer.append("</tr>");
> > >>> buffer.append("</table>");
> > >>> writer.print(buffer.toString());
> > >>> }
> > >>>
> > >>> }
> > >>>
> > >>> // Home.page .... Petshop example
> > >>>
> > >>> <page-specification
> > >>> class="org.apache.tapestry.pets.presentation.pages.HomePage">
> > >>> <description>Simple Home Page</description>
> > >>> <component id="WeatherBlock" type="Insert"/>
> > >>> </page-specification>
> > >>>
> > >>>
> > >>> // within Home.html
> > >>>
> > >>> <span jwcid="WeatherBlock"/>
> > >>>
> > >>>
> > >>> Is there anything missing?
> > >>>
> > >>> Thanks!
> > >>>
> > >>>> Check if you're extending BaseComponent, instead of
> > >>>> AbstractComponent.
> > >>>> AFAIK BaseComponents must have a template and AbstractComponents
> > >> don't.
> > >>>>
> > >>>> On Saturday, February 28, 2004, at 06:11  PM,
> > >>>> easy-to-remember@gmx.de
> > >>>> wrote:
> > >>>>
> > >>>>> 2. Why does it still want to have a template file even if I render
> > >> the
> > >>>>> html
> > >>>>> myself?
> > >>>>
> > >>>>
> >
>>>> -------------------------------------------------------------------- 
> > >>>> -
> > >>>> To unsubscribe, e-mail:
tapestry-user-unsubscribe@jakarta.apache.org
> > >>>> For additional commands, e-mail:
> > >>>> tapestry-user-help@jakarta.apache.org
> > >>>>
> > >>>
> > >>>
> >
>>> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > >>> For additional commands, e-mail:
> > >>> tapestry-user-help@jakarta.apache.org
> > >>>
> > >>>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > >> For additional commands, e-mail:
tapestry-user-help@jakarta.apache.org
> > >>
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

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


Re: Overriding renderComponent Part III

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Feb 29, 2004, at 2:57 PM, easy-to-remember@gmx.de wrote:
> When I do that I get:
>
> 'com.mysite.presentation.components.WeatherBlock' is not a valid 
> component
> type.

type="WeatherBlock", not the fully qualified classname.  The classname 
comes (if needed) from the .jwc file that maps to WeatherBlock.  Put 
WeatherBlock.jwc/.html in /WEB-INF (for now) and forget about 
specifying it in .application.

> If I enter Insert, at least it does not complain ;-)

And neither does it work nor is it correct.

> Does anyone know an example of a component that does insert html but 
> that
> does not require a template?

Of course.  The core is full of them.  Your favorite, the Insert 
component, is one of them.  Have a look at how Insert.java/.jwc are 
built.

	Erik


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


Re: Overriding renderComponent Part III

Posted by ea...@gmx.de.
When I do that I get:

'com.mysite.presentation.components.WeatherBlock' is not a valid component
type.


If I enter Insert, at least it does not complain ;-)


Does anyone know an example of a component that does insert html but that
does not require a template?

Thanks!


> You most definitely need to say type="WeatherBlock".... you want to use  
> the WeatherBlock component, not the Insert component.  Right?
> 
> I'm surprised the Insert component is not complaining for lack of a  
> 'value', actually.  Is it not required?  Shouldn't it be?
> 
> jwcid is *not* the type of component you are using, it is just a made  
> up name.  Change it to 'xyz', and work from there :)
> 
> 	Erik
> 
> 
> On Feb 29, 2004, at 1:59 PM, easy-to-remember@gmx.de wrote:
> 
> > I dont think it needs to be mentioned within the application file, or  
> > does
> > it?
> > According to the manual, this needs to be a type not a class, in this  
> > case
> > an Insert component.
> > [type	string		 	A component type to instantiate.]
> >
> > There are no error messages, but simply nothing appears. I even added  
> > the
> > isStateful and trigger methods now, methods...although I am not sure  
> > whether
> > they are necessary at all in this case.
> >
> >
> > public abstract class WeatherBlock extends AbstractComponent implements
> > IDirect {
> >
> > 	public abstract IActionListener getListener();
> > 	public abstract Object getParameters();
> >
> > 	public void renderComponent(IMarkupWriter writer, IRequestCycle  
> > cycle) {
> >
> > 		StringBuffer buffer = new StringBuffer();
> > 		buffer.append("<table border=1>");
> > 		buffer.append("<tr>");
> > 		buffer.append("<td>");
> > 		buffer.append("heeellloo");
> > 		buffer.append("</td>");
> > 		buffer.append("</tr>");
> > 		buffer.append("</table>");
> > 		writer.print(buffer.toString());
> > 	}
> >
> > 	public boolean isStateful() {
> > 		return false;
> > 	}
> > 	public void trigger(IRequestCycle cycle) {
> >
> > 		IActionListener listener = getListener();
> >
> > 		if (listener == null)
> > 			throw Tapestry.createRequiredParameterException(this, "listener");
> >
> > 		listener.actionTriggered(this, cycle);
> >
> > 	}
> >
> > }
> >
> > Within the html template:
> >
> > 	<span jwcid="WeatherBlock"/>
> >
> > and witin the page definition:
> >
> >
> > <page-specification
> > class="org.apache.tapestry.pets.presentation.pages.HomePage">
> > <description>Simple Home Page</description>
> > <component id="WeatherBlock" type="Insert"/>
> > </page-specification>
> > 											
> > WeatherBlock jwc
> >
> > <component-specification
> > class="org.apache.tapestry.pets.presentation.components.WeatherBlock"/>
> >
> > Has anyone ever tried that?
> >
> >
> >
> > Toby
> >
> >
> >
> >>
> >>> <component id="WeatherBlock" type="Insert"/>
> >> This line seems to be incorrect. The component type should be some
> >> "WeatherBlock" (see your .application file what is the name of your
> >> weather
> >> component).
> >>
> >> Norbi
> >>
> >> ----- Original Message -----
> >> From: <ea...@gmx.de>
> >> To: "Tapestry users" <ta...@jakarta.apache.org>
> >> Cc: <ta...@jakarta.apache.org>
> >> Sent: Sunday, February 29, 2004 9:51 AM
> >> Subject: Re: Overriding renderComponent Part II
> >>
> >>
> >>> Oh, another additional question:
> >>>
> >>> In theory, if this block is to appear on 50 pages, how can I avoid
> >> having
> >> to
> >>> add it on every single page specification? Just asking as if it  
> >>> should
> >> ever
> >>> change I would only want to edit on file not 50....
> >>>
> >>> Thanks!
> >>>
> >>> Toby
> >>>
> >>> I took the Petshop example and just wanted to enter a tiny little  
> >>> Block
> >> with
> >>> some weather information.
> >>> Even though it is a petshop.... ;-)
> >>>
> >>> It should render itself from a database later on, so I would like to  
> >>> get
> >>> away with no html templates files at all.
> >>>
> >>>
> >>> // WeatherBlock.java
> >>>
> >>> public  class WeatherBlock extends AbstractComponent  {
> >>>
> >>> public void renderComponent(IMarkupWriter writer, IRequestCycle  
> >>> cycle) {
> >>>
> >>> StringBuffer buffer = new StringBuffer();
> >>> buffer.append("<table border=1>");
> >>> buffer.append("<tr>");
> >>> buffer.append("<td>");
> >>> buffer.append("heeellloo");
> >>> buffer.append("</td>");
> >>> buffer.append("</tr>");
> >>> buffer.append("</table>");
> >>> writer.print(buffer.toString());
> >>> }
> >>>
> >>> }
> >>>
> >>> // Home.page .... Petshop example
> >>>
> >>> <page-specification
> >>> class="org.apache.tapestry.pets.presentation.pages.HomePage">
> >>> <description>Simple Home Page</description>
> >>> <component id="WeatherBlock" type="Insert"/>
> >>> </page-specification>
> >>>
> >>>
> >>> // within Home.html
> >>>
> >>> <span jwcid="WeatherBlock"/>
> >>>
> >>>
> >>> Is there anything missing?
> >>>
> >>> Thanks!
> >>>
> >>>> Check if you're extending BaseComponent, instead of  
> >>>> AbstractComponent.
> >>>> AFAIK BaseComponents must have a template and AbstractComponents
> >> don't.
> >>>>
> >>>> On Saturday, February 28, 2004, at 06:11  PM,  
> >>>> easy-to-remember@gmx.de
> >>>> wrote:
> >>>>
> >>>>> 2. Why does it still want to have a template file even if I render
> >> the
> >>>>> html
> >>>>> myself?
> >>>>
> >>>>
> >>>> -------------------------------------------------------------------- 
> >>>> -
> >>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>>> For additional commands, e-mail:  
> >>>> tapestry-user-help@jakarta.apache.org
> >>>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail:  
> >>> tapestry-user-help@jakarta.apache.org
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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


Re: Overriding renderComponent Part III

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
You most definitely need to say type="WeatherBlock".... you want to use  
the WeatherBlock component, not the Insert component.  Right?

I'm surprised the Insert component is not complaining for lack of a  
'value', actually.  Is it not required?  Shouldn't it be?

jwcid is *not* the type of component you are using, it is just a made  
up name.  Change it to 'xyz', and work from there :)

	Erik


On Feb 29, 2004, at 1:59 PM, easy-to-remember@gmx.de wrote:

> I dont think it needs to be mentioned within the application file, or  
> does
> it?
> According to the manual, this needs to be a type not a class, in this  
> case
> an Insert component.
> [type	string		 	A component type to instantiate.]
>
> There are no error messages, but simply nothing appears. I even added  
> the
> isStateful and trigger methods now, methods...although I am not sure  
> whether
> they are necessary at all in this case.
>
>
> public abstract class WeatherBlock extends AbstractComponent implements
> IDirect {
>
> 	public abstract IActionListener getListener();
> 	public abstract Object getParameters();
>
> 	public void renderComponent(IMarkupWriter writer, IRequestCycle  
> cycle) {
>
> 		StringBuffer buffer = new StringBuffer();
> 		buffer.append("<table border=1>");
> 		buffer.append("<tr>");
> 		buffer.append("<td>");
> 		buffer.append("heeellloo");
> 		buffer.append("</td>");
> 		buffer.append("</tr>");
> 		buffer.append("</table>");
> 		writer.print(buffer.toString());
> 	}
>
> 	public boolean isStateful() {
> 		return false;
> 	}
> 	public void trigger(IRequestCycle cycle) {
>
> 		IActionListener listener = getListener();
>
> 		if (listener == null)
> 			throw Tapestry.createRequiredParameterException(this, "listener");
>
> 		listener.actionTriggered(this, cycle);
>
> 	}
>
> }
>
> Within the html template:
>
> 	<span jwcid="WeatherBlock"/>
>
> and witin the page definition:
>
>
> <page-specification
> class="org.apache.tapestry.pets.presentation.pages.HomePage">
> <description>Simple Home Page</description>
> <component id="WeatherBlock" type="Insert"/>
> </page-specification>
> 											
> WeatherBlock jwc
>
> <component-specification
> class="org.apache.tapestry.pets.presentation.components.WeatherBlock"/>
>
> Has anyone ever tried that?
>
>
>
> Toby
>
>
>
>>
>>> <component id="WeatherBlock" type="Insert"/>
>> This line seems to be incorrect. The component type should be some
>> "WeatherBlock" (see your .application file what is the name of your
>> weather
>> component).
>>
>> Norbi
>>
>> ----- Original Message -----
>> From: <ea...@gmx.de>
>> To: "Tapestry users" <ta...@jakarta.apache.org>
>> Cc: <ta...@jakarta.apache.org>
>> Sent: Sunday, February 29, 2004 9:51 AM
>> Subject: Re: Overriding renderComponent Part II
>>
>>
>>> Oh, another additional question:
>>>
>>> In theory, if this block is to appear on 50 pages, how can I avoid
>> having
>> to
>>> add it on every single page specification? Just asking as if it  
>>> should
>> ever
>>> change I would only want to edit on file not 50....
>>>
>>> Thanks!
>>>
>>> Toby
>>>
>>> I took the Petshop example and just wanted to enter a tiny little  
>>> Block
>> with
>>> some weather information.
>>> Even though it is a petshop.... ;-)
>>>
>>> It should render itself from a database later on, so I would like to  
>>> get
>>> away with no html templates files at all.
>>>
>>>
>>> // WeatherBlock.java
>>>
>>> public  class WeatherBlock extends AbstractComponent  {
>>>
>>> public void renderComponent(IMarkupWriter writer, IRequestCycle  
>>> cycle) {
>>>
>>> StringBuffer buffer = new StringBuffer();
>>> buffer.append("<table border=1>");
>>> buffer.append("<tr>");
>>> buffer.append("<td>");
>>> buffer.append("heeellloo");
>>> buffer.append("</td>");
>>> buffer.append("</tr>");
>>> buffer.append("</table>");
>>> writer.print(buffer.toString());
>>> }
>>>
>>> }
>>>
>>> // Home.page .... Petshop example
>>>
>>> <page-specification
>>> class="org.apache.tapestry.pets.presentation.pages.HomePage">
>>> <description>Simple Home Page</description>
>>> <component id="WeatherBlock" type="Insert"/>
>>> </page-specification>
>>>
>>>
>>> // within Home.html
>>>
>>> <span jwcid="WeatherBlock"/>
>>>
>>>
>>> Is there anything missing?
>>>
>>> Thanks!
>>>
>>>> Check if you're extending BaseComponent, instead of  
>>>> AbstractComponent.
>>>> AFAIK BaseComponents must have a template and AbstractComponents
>> don't.
>>>>
>>>> On Saturday, February 28, 2004, at 06:11  PM,  
>>>> easy-to-remember@gmx.de
>>>> wrote:
>>>>
>>>>> 2. Why does it still want to have a template file even if I render
>> the
>>>>> html
>>>>> myself?
>>>>
>>>>
>>>> -------------------------------------------------------------------- 
>>>> -
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail:  
>>>> tapestry-user-help@jakarta.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:  
>>> tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


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