You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken nashua <nh...@hotmail.com> on 2007/10/01 15:14:37 UTC

Combined Component Model - Is it supported ?

Folks... per doc text that follows...

1. Components that inherit from BaseComponent will use an HTML template.

2. Components that inherit from AbstractComponent will render output in Java code, by implementing method renderComponent() .

I would like to build a component that operates combined semantics... or at least option 2 supporting the manipulation/usage of templates within JAVA. Option 1 only supports handlers not necessarily rendering + JSON.

WHY? Some component templates are lengthy and I would not like to implement all that rendering in the JAVA as it is too cluttered/cumbersome. Plus some components are best fit in just a template and others are better fit in JAVA... I have a component anatomy a bit complex that requires everything and I want to distribute the implementation efficiently across both models.

Can tapestry-4.1.2 deliver?

If I commit to model #1 then I end up missing what I need. Same if I commit to model #2. I need both.

Your feedback is appreciated.

Best regards
Ken in nashua
_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE

Re: Combined Component Model - Is it supported ?

Posted by Martino Piccinato <ma...@gmail.com>.
don't know if it's what you are looking for but you can always
override renderComponent also in BaseComponent decorating the
component template with some additional html e.g.

    /* (non-Javadoc)
     * @see org.apache.tapestry.BaseComponent#renderComponent(org.apache.tapestry.IMarkupWriter,
org.apache.tapestry.IRequestCycle)
     */
    public void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {

      	if (showComponent) {
    		writer.begin("div");
            renderIdAttribute(writer, cycle);
            writer.appendAttribute("class", getMyCSSClass());
            renderInformalParameters(writer, cycle);
            super.renderComponent(writer, cycle);
    	} else {
    		writer.begin("span");
            renderIdAttribute(writer, cycle);
    	}

        writer.end();
    }


in this example, if the component is inheriting from BaseComponent ,
        super.renderComponent(writer, cycle) , wil render the template
part of the component within
some other directly java manipulated html.

But it's not 100% clear to me what you mean with "manipulation/usage
of templates within JAVA" as in tapestry templates are "manipulated"
within java, meaning that you can change a template output quite a lot
using existing or custom components and ognl parameters binding.

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