You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Makundi <ma...@koodaripalvelut.com> on 2010/09/20 11:18:18 UTC
Replacing content in
Hi!
I am making a page that can be opened into office and equivalents.
This seems to require all HTML and CSS is contained within a single
file.
I have a <head> section in my WebPage and I would like to parametrize
some css values "on the fly".
However, the following does not seem to work:
<html>
<head>
<style type="text/css">
.container {
<wicket:container wicket:id="container_specification"/>
}
</style>
</head>
<body>
...
</body>
</html>
I get an exception that such tag cannot be found. How can I achieve this result?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Replacing content in
Posted by Martin Grigorov <mg...@apache.org>.
XmlPullParser has some performance optimizations when dealing with <style>
and <script>.
Check them too.
On Mon, Sep 20, 2010 at 11:21 AM, Bas Gooren <ba...@iswd.nl> wrote:
> Martin,
>
> Wicket tags need to be part of a valid (x)html tree. So what you want can
> be achieved by giving the <style> tag a wicket:id and generating the CSS
> including the ".container { ... }" code.
>
> Sebastian
>
> ----- Original Message ----- From: "Martin Makundi" <
> martin.makundi@koodaripalvelut.com>
> To: <us...@wicket.apache.org>
> Sent: Monday, September 20, 2010 11:18 AM
> Subject: Replacing content in <head>
>
>
>
> Hi!
>>
>> I am making a page that can be opened into office and equivalents.
>> This seems to require all HTML and CSS is contained within a single
>> file.
>>
>> I have a <head> section in my WebPage and I would like to parametrize
>> some css values "on the fly".
>>
>> However, the following does not seem to work:
>>
>> <html>
>> <head>
>>
>> <style type="text/css">
>>
>> .container {
>> <wicket:container wicket:id="container_specification"/>
>> }
>> </style>
>> </head>
>> <body>
>> ...
>> </body>
>> </html>
>>
>> I get an exception that such tag cannot be found. How can I achieve this
>> result?
>>
>> ---------------------------------------------------------------------
>> 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: Replacing content in
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Nah.. I don't want to pull all content from wicket.
Overriding componentTag works nicely.
**
Martin
2010/9/20 Bas Gooren <ba...@iswd.nl>:
> Martin,
>
> I meant that you need to do the following:
>
> HTML:
> <style wicket:id="style-container"></style>
>
> Java:
> IModel<String> styleModel = new AbstractReadOnlyModel<String>() {
> @Override
> public String getObject() {
> return ".date_style {\n" + _get_css_string_here + "\n}";
> };
> };
> Label label = new Label("style-container", styleModel);
> label.setEscapeModelStrings(false);
>
> As you can see I've removed your <wicket:container> tag.
>
> Sebastian
>
> ----- Original Message ----- From: "Martin Makundi"
> <ma...@koodaripalvelut.com>
> To: <us...@wicket.apache.org>
> Sent: Monday, September 20, 2010 1:14 PM
> Subject: Re: Replacing content in <head>
>
>
> Hi!
>
> Sorry, it does not help. I added wicket:id tag:
>
> <style type="text/css" wicket:id="style-container">
> .date_style {
> <wicket:container wicket:id="date_style"/>
> }
> </style>
>
>
> But I get exception:
>
> WicketMessage: The component(s) below failed to render. A common
> problem is that you have added a component in code but forgot to
> reference it in the markup (thus the component will never be
> rendered).
>
> 1. [Component id = date_style]
>
>
> I looked into XmlPullParser and yes it does some magic... how to
> overcome this? Should I rename the style to "dynamic-style" and fix
> tag name at runtime?
>
> add(styleContainer = new WebMarkupContainer("style-container") {
> /**
> * @see
> org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
> */
> @Override
> protected void onComponentTag(ComponentTag tag) {
> tag.setName(STYLE);
> super.onComponentTag(tag);
> }
> });
>
>
> **
> Martin
>
> 2010/9/20 Bas Gooren <ba...@iswd.nl>:
>>
>> Martin,
>>
>> Wicket tags need to be part of a valid (x)html tree. So what you want can
>> be
>> achieved by giving the <style> tag a wicket:id and generating the CSS
>> including the ".container { ... }" code.
>>
>> Sebastian
>>
>> ----- Original Message ----- From: "Martin Makundi"
>> <ma...@koodaripalvelut.com>
>> To: <us...@wicket.apache.org>
>> Sent: Monday, September 20, 2010 11:18 AM
>> Subject: Replacing content in <head>
>>
>>
>>> Hi!
>>>
>>> I am making a page that can be opened into office and equivalents.
>>> This seems to require all HTML and CSS is contained within a single
>>> file.
>>>
>>> I have a <head> section in my WebPage and I would like to parametrize
>>> some css values "on the fly".
>>>
>>> However, the following does not seem to work:
>>>
>>> <html>
>>> <head>
>>>
>>> <style type="text/css">
>>>
>>> .container {
>>> <wicket:container wicket:id="container_specification"/>
>>> }
>>> </style>
>>> </head>
>>> <body>
>>> ...
>>> </body>
>>> </html>
>>>
>>> I get an exception that such tag cannot be found. How can I achieve this
>>> result?
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
> ---------------------------------------------------------------------
> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Replacing content in
Posted by Bas Gooren <ba...@iswd.nl>.
Martin,
I meant that you need to do the following:
HTML:
<style wicket:id="style-container"></style>
Java:
IModel<String> styleModel = new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return ".date_style {\n" + _get_css_string_here + "\n}";
};
};
Label label = new Label("style-container", styleModel);
label.setEscapeModelStrings(false);
As you can see I've removed your <wicket:container> tag.
Sebastian
----- Original Message -----
From: "Martin Makundi" <ma...@koodaripalvelut.com>
To: <us...@wicket.apache.org>
Sent: Monday, September 20, 2010 1:14 PM
Subject: Re: Replacing content in <head>
Hi!
Sorry, it does not help. I added wicket:id tag:
<style type="text/css" wicket:id="style-container">
.date_style {
<wicket:container wicket:id="date_style"/>
}
</style>
But I get exception:
WicketMessage: The component(s) below failed to render. A common
problem is that you have added a component in code but forgot to
reference it in the markup (thus the component will never be
rendered).
1. [Component id = date_style]
I looked into XmlPullParser and yes it does some magic... how to
overcome this? Should I rename the style to "dynamic-style" and fix
tag name at runtime?
add(styleContainer = new WebMarkupContainer("style-container") {
/**
* @see
org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
*/
@Override
protected void onComponentTag(ComponentTag tag) {
tag.setName(STYLE);
super.onComponentTag(tag);
}
});
**
Martin
2010/9/20 Bas Gooren <ba...@iswd.nl>:
> Martin,
>
> Wicket tags need to be part of a valid (x)html tree. So what you want can
> be
> achieved by giving the <style> tag a wicket:id and generating the CSS
> including the ".container { ... }" code.
>
> Sebastian
>
> ----- Original Message ----- From: "Martin Makundi"
> <ma...@koodaripalvelut.com>
> To: <us...@wicket.apache.org>
> Sent: Monday, September 20, 2010 11:18 AM
> Subject: Replacing content in <head>
>
>
>> Hi!
>>
>> I am making a page that can be opened into office and equivalents.
>> This seems to require all HTML and CSS is contained within a single
>> file.
>>
>> I have a <head> section in my WebPage and I would like to parametrize
>> some css values "on the fly".
>>
>> However, the following does not seem to work:
>>
>> <html>
>> <head>
>>
>> <style type="text/css">
>>
>> .container {
>> <wicket:container wicket:id="container_specification"/>
>> }
>> </style>
>> </head>
>> <body>
>> ...
>> </body>
>> </html>
>>
>> I get an exception that such tag cannot be found. How can I achieve this
>> result?
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
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: Replacing content in
Posted by Martin Grigorov <mg...@apache.org>.
I would use PackageTextTemplate for the content of <style>, then use a Label
or a custom WebComponent for <style> and override its onComponenttagBody()
and use the interpolated value of PackageTextTemplate as body.
On Mon, Sep 20, 2010 at 1:14 PM, Martin Makundi <
martin.makundi@koodaripalvelut.com> wrote:
> Hi!
>
> Sorry, it does not help. I added wicket:id tag:
>
> <style type="text/css" wicket:id="style-container">
> .date_style {
> <wicket:container wicket:id="date_style"/>
> }
> </style>
>
>
> But I get exception:
>
> WicketMessage: The component(s) below failed to render. A common
> problem is that you have added a component in code but forgot to
> reference it in the markup (thus the component will never be
> rendered).
>
> 1. [Component id = date_style]
>
>
> I looked into XmlPullParser and yes it does some magic... how to
> overcome this? Should I rename the style to "dynamic-style" and fix
> tag name at runtime?
>
> add(styleContainer = new WebMarkupContainer("style-container") {
> /**
> * @see
> org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
> */
> @Override
> protected void onComponentTag(ComponentTag tag) {
> tag.setName(STYLE);
> super.onComponentTag(tag);
> }
> });
>
>
> **
> Martin
>
> 2010/9/20 Bas Gooren <ba...@iswd.nl>:
> > Martin,
> >
> > Wicket tags need to be part of a valid (x)html tree. So what you want can
> be
> > achieved by giving the <style> tag a wicket:id and generating the CSS
> > including the ".container { ... }" code.
> >
> > Sebastian
> >
> > ----- Original Message ----- From: "Martin Makundi"
> > <ma...@koodaripalvelut.com>
> > To: <us...@wicket.apache.org>
> > Sent: Monday, September 20, 2010 11:18 AM
> > Subject: Replacing content in <head>
> >
> >
> >> Hi!
> >>
> >> I am making a page that can be opened into office and equivalents.
> >> This seems to require all HTML and CSS is contained within a single
> >> file.
> >>
> >> I have a <head> section in my WebPage and I would like to parametrize
> >> some css values "on the fly".
> >>
> >> However, the following does not seem to work:
> >>
> >> <html>
> >> <head>
> >>
> >> <style type="text/css">
> >>
> >> .container {
> >> <wicket:container wicket:id="container_specification"/>
> >> }
> >> </style>
> >> </head>
> >> <body>
> >> ...
> >> </body>
> >> </html>
> >>
> >> I get an exception that such tag cannot be found. How can I achieve this
> >> result?
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Replacing content in
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Hi!
Sorry, it does not help. I added wicket:id tag:
<style type="text/css" wicket:id="style-container">
.date_style {
<wicket:container wicket:id="date_style"/>
}
</style>
But I get exception:
WicketMessage: The component(s) below failed to render. A common
problem is that you have added a component in code but forgot to
reference it in the markup (thus the component will never be
rendered).
1. [Component id = date_style]
I looked into XmlPullParser and yes it does some magic... how to
overcome this? Should I rename the style to "dynamic-style" and fix
tag name at runtime?
add(styleContainer = new WebMarkupContainer("style-container") {
/**
* @see org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
*/
@Override
protected void onComponentTag(ComponentTag tag) {
tag.setName(STYLE);
super.onComponentTag(tag);
}
});
**
Martin
2010/9/20 Bas Gooren <ba...@iswd.nl>:
> Martin,
>
> Wicket tags need to be part of a valid (x)html tree. So what you want can be
> achieved by giving the <style> tag a wicket:id and generating the CSS
> including the ".container { ... }" code.
>
> Sebastian
>
> ----- Original Message ----- From: "Martin Makundi"
> <ma...@koodaripalvelut.com>
> To: <us...@wicket.apache.org>
> Sent: Monday, September 20, 2010 11:18 AM
> Subject: Replacing content in <head>
>
>
>> Hi!
>>
>> I am making a page that can be opened into office and equivalents.
>> This seems to require all HTML and CSS is contained within a single
>> file.
>>
>> I have a <head> section in my WebPage and I would like to parametrize
>> some css values "on the fly".
>>
>> However, the following does not seem to work:
>>
>> <html>
>> <head>
>>
>> <style type="text/css">
>>
>> .container {
>> <wicket:container wicket:id="container_specification"/>
>> }
>> </style>
>> </head>
>> <body>
>> ...
>> </body>
>> </html>
>>
>> I get an exception that such tag cannot be found. How can I achieve this
>> result?
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Replacing content in
Posted by Bas Gooren <ba...@iswd.nl>.
Martin,
Wicket tags need to be part of a valid (x)html tree. So what you want can be
achieved by giving the <style> tag a wicket:id and generating the CSS
including the ".container { ... }" code.
Sebastian
----- Original Message -----
From: "Martin Makundi" <ma...@koodaripalvelut.com>
To: <us...@wicket.apache.org>
Sent: Monday, September 20, 2010 11:18 AM
Subject: Replacing content in <head>
> Hi!
>
> I am making a page that can be opened into office and equivalents.
> This seems to require all HTML and CSS is contained within a single
> file.
>
> I have a <head> section in my WebPage and I would like to parametrize
> some css values "on the fly".
>
> However, the following does not seem to work:
>
> <html>
> <head>
>
> <style type="text/css">
>
> .container {
> <wicket:container wicket:id="container_specification"/>
> }
> </style>
> </head>
> <body>
> ...
> </body>
> </html>
>
> I get an exception that such tag cannot be found. How can I achieve this
> result?
>
> ---------------------------------------------------------------------
> 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