You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2010/07/28 22:02:20 UTC

renderInformalParameters not working in my component

Hi All,

I'm writing my own component which creates an image tag. I've used 
pagelink as a reference point for this.

I'd like to allow informal parameters, however I can't seem to access 
the informal parameters within my component...

for example,

    <img t:type="myImageComponent" type="prop" cl="cl" width="390" 
height="285" style="border:2px solid green;" />

the parameters 'type', 'cl', 'width' and 'height' are all formal 
required parameters

    @Parameter(required = true, allowNull = false, defaultPrefix = 
BindingConstants.PROP)
    private MyObject cl;
    @Parameter(required = true, allowNull = false, defaultPrefix = 
BindingConstants.LITERAL)
    private String type;
    @Parameter(required = true, allowNull = false, defaultPrefix = 
BindingConstants.LITERAL)
    private Integer width;
    @Parameter(required = true, allowNull = false, defaultPrefix = 
BindingConstants.LITERAL)
    private Integer height;

I then write the tag like so:

    private void beginRender(MarkupWriter writer)
    {
       ... // some processing
        link = ... // link creation

        element = writer.element("img", "src", link.toURI());
        writer.attributes("width", width, "height", height);
        resources.renderInformalParameters(writer);
        log.debug(resources.isBound("style") + " " + 
resources.getInformalParameterNames());

        writer.end();
    }

Therefore I'd expect the resulting image tag to have four parameters:
1. 'src' - writer.element("img", "src", link.toURI());
2 & 3. 'width' and 'height' - writer.attributes("width", width, 
"height", height);
4. 'style' - resources.renderInformalParameters(writer);

However apparently there are no informal parameters as my log statement 
produces "false []" and the style attribute is not rendered.

What am I missing?

Thanks, p.

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


Re: renderInformalParameters not working in my component

Posted by Paul Stanton <pa...@mapshed.com.au>.
i knew it would be something simple like that !

thanks thiago.

Thiago H. de Paula Figueiredo wrote:
> On Wed, 28 Jul 2010 17:02:20 -0300, Paul Stanton <pa...@mapshed.com.au> 
> wrote:
>
>> Hi All,
>
> Hi!
>
>> I'd like to allow informal parameters, however I can't seem to access 
>> the informal parameters within my component...
>
> Have you annotated your component class with @SupportsInformalParameters?
>

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


Re: renderInformalParameters not working in my component

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 28 Jul 2010 17:02:20 -0300, Paul Stanton <pa...@mapshed.com.au>  
wrote:

> Hi All,

Hi!

> I'd like to allow informal parameters, however I can't seem to access  
> the informal parameters within my component...

Have you annotated your component class with @SupportsInformalParameters?

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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