You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by shetc <sh...@bellsouth.net> on 2008/11/09 23:16:37 UTC
How to use TextTemplateHeaderContributor.forCss method?
Hi All,
I've had success using the TextTemplateHeaderContributor.forJavaScript
method but can't get the equivalent TextTemplateHeaderContributor.forCss
method to work. Here are some snippets:
>From CSS:
.someClass {
background: #fff url('${brand}/someImage.jpg') 100% 100% no-repeat;
}
>From Java:
IModel skinModel = new AbstractReadOnlyModel() {
private static final long serialVersionUID = 1L;
@Override
public Map getObject() {
Map<String, CharSequence> variables =
new HashMap<String, CharSequence>(1);
variables.put("brand", getStyle());
return variables;
}
};
add(TextTemplateHeaderContributor.forCss(
MyApplication.class, "skins/style.css", skinModel));
The problem is that the substitution seems to fail and the someImage.jpg
file is not drawn. Any ideas on what I am doing wrong?
Thanks,
Steve
--
View this message in context: http://www.nabble.com/How-to-use-TextTemplateHeaderContributor.forCss-method--tp20411565p20411565.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to use TextTemplateHeaderContributor.forCss method?
Posted by shetc <sh...@bellsouth.net>.
Thank you, sir!
I arrived at a similar result but I am not sure if it is the correct
solution or if it's a work-around for something missing from
TextTemplateHeaderContributor.forCss code.
--
View this message in context: http://www.nabble.com/How-to-use-TextTemplateHeaderContributor.forCss-method--tp20411565p20466790.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to use TextTemplateHeaderContributor.forCss method?
Posted by "Srikanth.NT" <nt...@gmail.com>.
Try...
IModel skinModel = new AbstractReadOnlyModel() {
private static final long serialVersionUID = 1L;
@Override
public Map getObject() {
Map<String, CharSequence> variables = new HashMap<String,
CharSequence>(1);
variables.put("brand", urlFor(new ResourceReference(HomePage.class, ""))
+ "brandxx");
return variables;
}
};
add(TextTemplateHeaderContributor.forCss(HomePage.class, "style.css",
skinModel));
shetc wrote:
>
> There is a style and it still doesn't work.
>
-----
http://ntsrikanth.blogspot.com/
--
View this message in context: http://www.nabble.com/How-to-use-TextTemplateHeaderContributor.forCss-method--tp20411565p20463802.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to use TextTemplateHeaderContributor.forCss method?
Posted by shetc <sh...@bellsouth.net>.
There is a style and it still doesn't work.
--
View this message in context: http://www.nabble.com/How-to-use-TextTemplateHeaderContributor.forCss-method--tp20411565p20463348.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to use TextTemplateHeaderContributor.forCss method?
Posted by "Srikanth.NT" <nt...@gmail.com>.
Check whether you get some value from getStyle() method. If it is null, then
the variable ${brand} wont be substituted.
shetc wrote:
>
> I created a QuickStart project and TextTemplateHeaderContributor.forCss
> doesn't work in there either.
>
-----
http://ntsrikanth.blogspot.com/
--
View this message in context: http://www.nabble.com/How-to-use-TextTemplateHeaderContributor.forCss-method--tp20411565p20463240.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to use TextTemplateHeaderContributor.forCss method?
Posted by shetc <sh...@bellsouth.net>.
I created a QuickStart project and TextTemplateHeaderContributor.forCss
doesn't work in there either.
--
View this message in context: http://www.nabble.com/How-to-use-TextTemplateHeaderContributor.forCss-method--tp20411565p20460548.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to use TextTemplateHeaderContributor.forCss method?
Posted by shetc <sh...@bellsouth.net>.
Been looking into this issue in more detail via my QuickStart application:
If HeaderContributor.forCss is used then the HTML output is:
<link rel="stylesheet" type="text/css"
href="resources/com.mycompany.WicketApplication/skins/style.css" />
If TextTemplateHeaderContributor.forCss is used then the HTML output is:
<style type="text/css"><!--
#someDiv {
width: 100px;
height: 100px;
background: #fff url('brandX/image.jpg') 100% 100% no-repeat;
}--></style>
The second case 'fails' since brandX/image.jpg is kept under
resources/com.mycompany.WicketApplication/skins.
Shouldn't the output be as follows?
<style type="text/css"><!--
#someDiv {
width: 100px;
height: 100px;
background: #fff
url('resources/com.mycompany.WicketApplication/skins/brandX/image.jpg') 100%
100% no-repeat;
}--></style>
--
View this message in context: http://www.nabble.com/How-to-use-TextTemplateHeaderContributor.forCss-method--tp20411565p20462410.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to use TextTemplateHeaderContributor.forCss method?
Posted by shetc <sh...@bellsouth.net>.
ERROR SharedResourceRequestTarget:185 - shared resource
com.test.wicket.MyApplication/skins/${brand}/someImage.jpg not found
--
View this message in context: http://www.nabble.com/How-to-use-TextTemplateHeaderContributor.forCss-method--tp20411565p20446152.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to use TextTemplateHeaderContributor.forCss method?
Posted by Eelco Hillenius <ee...@gmail.com>.
The substitution doesn't happen at all? Any errors you see in the logs?
Eelco
On Sun, Nov 9, 2008 at 2:16 PM, shetc <sh...@bellsouth.net> wrote:
>
> Hi All,
>
> I've had success using the TextTemplateHeaderContributor.forJavaScript
> method but can't get the equivalent TextTemplateHeaderContributor.forCss
> method to work. Here are some snippets:
>
> From CSS:
> .someClass {
> background: #fff url('${brand}/someImage.jpg') 100% 100% no-repeat;
> }
>
> From Java:
> IModel skinModel = new AbstractReadOnlyModel() {
> private static final long serialVersionUID = 1L;
> @Override
> public Map getObject() {
> Map<String, CharSequence> variables =
> new HashMap<String, CharSequence>(1);
> variables.put("brand", getStyle());
> return variables;
> }
> };
> add(TextTemplateHeaderContributor.forCss(
> MyApplication.class, "skins/style.css", skinModel));
>
> The problem is that the substitution seems to fail and the someImage.jpg
> file is not drawn. Any ideas on what I am doing wrong?
>
> Thanks,
> Steve
> --
> View this message in context: http://www.nabble.com/How-to-use-TextTemplateHeaderContributor.forCss-method--tp20411565p20411565.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to use TextTemplateHeaderContributor.forCss method?
Posted by shetc <sh...@bellsouth.net>.
bump
--
View this message in context: http://www.nabble.com/How-to-use-TextTemplateHeaderContributor.forCss-method--tp20411565p20439494.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org