Thanks for the reply. That works perfect, my fault. I think that add 
(...) belongs to 1.x, and no that is a IBehavior.
One detail about add(TextTemplateHeaderContributor.forCss 
( Spinner.class,"Spinner.css", new Model( (Serializable) cssMap ) ));  
is that the code is incorporated in the head of the html writing the  
code.
I create an alternative

new StyleSheetReference( this, "spinnerCSS",
        new ResourceReference( Spinner.css, "spinnerCSS.css" ) {

                    private static final long serialVersionUID =  
-5001445753978421349L;

                    @Override
                    protected Resource newResource() {

                                final PackagedTextTemplate template = new  
PackagedTextTemplate( Spinner.class, "Spinner.css" );
                                template.interpolate( cssMap );

                                final Resource oResult = new Resource() {

                                        private static final long 
serialVersionUID = 0L;

                                        @Override
                                        public IResourceStream 
getResourceStream() {
                                                return new StringResourceStream 
( template.asString() );
                                        }
                                };

                 return oResult;
             }
}

and

<wicket:head>
        <link type="text/css" wicket:id="spinnerCSS"></link>
</wicket:head>

in the markup.

Is not simple like TextTemplateHeaderContributor, but in the renderer  
html is more clean.

Again, thanks for the reply.

On 19-11-2006, at 2:10, Eelco Hillenius wrote:

> Did you add that to your page or component?
>
> add(TextTemplateHeaderContributor.forCss( Spinner.class,
> "Spinner.css", new Model( (Serializable) cssMap ) ));
>
> (notice the add call)
>
> If you want to see this in action, take a look at
> wicket-contrib-yui(-examples) in the wicket-stuff repo
> (https://svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket- 
> contrib-yui)
> and check out the Slider component.
>
> Eelc
>
>
> On 11/17/06, Manuel Alejandro de Brito Fontes
> <[EMAIL PROTECTED]> wrote:
>>
>> Hi, I'm trying to do something similar like this
>> (http://chillenious.wordpress.com/tag/wicket/page/2/) but
>> instead of a "dynamic" javascript, i want to modify a css style.
>> The next code is similar to the previous page:
>>
>> Map<String, CharSequence> cssMap = new MiniMap<String,  
>> CharSequence>( 1 );
>> cssMap.put( "fieldWidth", txtWidth );
>>
>> TextTemplateHeaderContributor.forCss( Spinner.class,
>> "Spinner.css", new Model( (Serializable) cssMap ) );
>>
>> That works perfect, because if I print the content of the  
>> template, the
>> ${fieldWidth} is replaced by 12.
>> System.out.println(TextTemplateHeaderContributor.forCss(
>> Spinner.class, "Spinner.css", new Model( (Serializable) cssMap ) ));
>>
>>
>>
>>
>> But I don't see the code in the header. I'm missing something?.
>>
>> I'm using 2.0-SNAPSHOT (checkout from today)
>>
>>
>>
>>
>> Thanks in advice.
>>
>>
>>
>>
>>
>>
>>
>> --------------------------------------------------------------------- 
>> ----
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to  
>> share your
>> opinions on IT & business topics through brief surveys - and earn  
>> cash
>> http://www.techsay.com/default.php? 
>> page=join.php&p=sourceforge&CID=DEVDEV
>>
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>>
>>
>
> ---------------------------------------------------------------------- 
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to  
> share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php? 
> page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user

Manuel Alejandro de Brito Fontes
[EMAIL PROTECTED]

Any fool can write code that a computer can understand.
Good programmers write code that humans can understand."

                   --- Martin Fowler, Refactoring: Improving the  
Design of Existing Code





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to