You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Imants Firsts <im...@inbox.lv> on 2008/04/02 01:25:38 UTC

Render element and block using one method

Is it possible for component to render it's tag from
parent component with informal parameters and return a
block to render inside it?

The following code throws an exception while tapestry
modifies the component class.

Object beginRender(MarkupWriter writer) {
	writer.element(resources.getElementName("div"));
	resources.renderInformalParameters(writer);

	return myBlock;
}

Method which returns void with writer.element() inside
it works. And returning block without writer.element()
works. Both of them together do not work. The problem
seems to be with accessing ComponentResources.

Is it a tapestry bug, or such combination is not
supported? What are the alternatives?

Thanks in advance,
Imants Firsts


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


Re: Render element and block using one method

Posted by Imants Firsts <im...@inbox.lv>.
Thanks!

Changing the return type from Object to Block solved
the problem.

Imants

Quoting Josh Canfield <jo...@thedailytube.com>:
> What version of Tapestry are you using? This works in
5.0.11. Do you
> have the matching afterRender block to close the div?
> 
> 	public Block beginRender(MarkupWriter writer) {
> 		writer.write("Something else");
> 		String elementName = _resources.getElementName("div");
> 		writer.element(elementName);
> 		_resources.renderInformalParameters(writer);
> 		return _blockParam;
> 	}
> 	
> 	public void afterRender(MarkupWriter writer) {
> 		writer.end();
> 	}
> Josh
> 
> On Tue, Apr 1, 2008 at 4:25 PM, Imants Firsts
<im...@inbox.lv> wrote:
> > Is it possible for component to render it's tag from
> > parent component with informal parameters and return a
> > block to render inside it?
> >
> > The following code throws an exception while tapestry
> > modifies the component class.
> >
> > Object beginRender(MarkupWriter writer) {
> >        writer.element(resources.getElementName("div"));
> >        resources.renderInformalParameters(writer);
> >
> >        return myBlock;
> > }
> >
> > Method which returns void with writer.element() inside
> > it works. And returning block without writer.element()
> > works. Both of them together do not work. The problem
> > seems to be with accessing ComponentResources.
> >
> > Is it a tapestry bug, or such combination is not
> > supported? What are the alternatives?
> >
> > Thanks in advance,
> > Imants Firsts
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail:
users-help@tapestry.apache.org
> >
> >
> 
> 
> 
> -- 
> --
> TheDailyTube.com. Sign up and get the best new videos
on the internet
> delivered fresh to your inbox.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
users-help@tapestry.apache.org


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


Re: Render element and block using one method

Posted by Josh Canfield <jo...@thedailytube.com>.
What version of Tapestry are you using? This works in 5.0.11. Do you
have the matching afterRender block to close the div?

	public Block beginRender(MarkupWriter writer) {
		writer.write("Something else");
		String elementName = _resources.getElementName("div");
		writer.element(elementName);
		_resources.renderInformalParameters(writer);
		return _blockParam;
	}
	
	public void afterRender(MarkupWriter writer) {
		writer.end();
	}
Josh

On Tue, Apr 1, 2008 at 4:25 PM, Imants Firsts <im...@inbox.lv> wrote:
> Is it possible for component to render it's tag from
> parent component with informal parameters and return a
> block to render inside it?
>
> The following code throws an exception while tapestry
> modifies the component class.
>
> Object beginRender(MarkupWriter writer) {
>        writer.element(resources.getElementName("div"));
>        resources.renderInformalParameters(writer);
>
>        return myBlock;
> }
>
> Method which returns void with writer.element() inside
> it works. And returning block without writer.element()
> works. Both of them together do not work. The problem
> seems to be with accessing ComponentResources.
>
> Is it a tapestry bug, or such combination is not
> supported? What are the alternatives?
>
> Thanks in advance,
> Imants Firsts
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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