You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by nlif <na...@dbnet.co.il> on 2007/11/18 10:10:42 UTC
Thanks, but I can't get this to work...
I tried adding an attributeModifier to the Page class, and it doesn't work
(the "dir" attribute is not added to the html element).
I then tried creating a WebMarkupContainer (and adding wicket:id to the html
element in my html file), but this throws an exception. I think it's because
I did it in my base-page class, and there are classes that extend it, and
their components are not added to my webMarkupContainer.
Last, I tried using a MarkupFilter, like this:
getApplication().getMarkupSettings().setMarkupParserFactory(new
IMarkupParserFactory()
{
public MarkupParser newMarkupParser(MarkupResourceStream
resource)
{
MarkupParser parser = new MarkupParser(new
XmlPullParser(), resource);
parser.appendMarkupFilter(new AbstractMarkupFilter()
{
public MarkupElement nextTag()
throws ParseException
{
// Get the next tag. If null, no more tags
are available
final ComponentTag tag = (ComponentTag)
getParent().nextTag();
if (tag == null)
{
return tag;
}
if ("html".equals(tag.getName()))
{
tag.addBehavior(new
AttributeModifier("dir", true, new Model("rtl")));
}
return tag;
}
});
return parser;
}
});
I used a debugger to verify it indeed executes the addBehavior() line, but
still - no "dir" attribute is added to the html.
I cannot seem to find anywhere in the forum a specific example. There are
only general suggestions, such as "use MarkupFilter" or "add an
AttributeModifier"... I guess an code-sample would be helpful.
Thanks again,
Naaman
--
View this message in context: http://www.nabble.com/How-can-I-switch-page-direction-%28LTR-RTL%29--tf4805391.html#a13817345
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: Thanks, but I can't get this to work...
Posted by Franklin Antony <fr...@gmail.com>.
Thanks jan a million. Its working now!!!
Just to add for more information sake
The wicket:id attribute should be as follows
<html wicket:id="html">
</html>
Also I used a SimpleAttributeModifier and its working!!!
Thanks,
Franklin.
Jan Kriesten wrote:
>
>
> hi,
>
> just add a wicket:id to <html> and then within your page:
>
> ---
> MarkupContainer html, container;
> html = new WebMarkupContainer( "html" )
> {
> private static final long serialVersionUID = 1L;
>
> @Override
> public boolean isTransparentResolver()
> {
> return true;
> }
> };
>
> html.add( new AttributeModifier( "xml:lang", lang ) );
> html.add( new AttributeModifier( "lang", lang ) );
> add( html );
> ---
>
> all other elements can then added directly to the page as well.
>
> best regards, --- jan.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/How-can-I-switch-page-direction-%28LTR-RTL%29--tf4805391.html#a14028129
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: Thanks, but I can't get this to work...
Posted by Jan Kriesten <ja...@renitence.de>.
hi,
just add a wicket:id to <html> and then within your page:
---
MarkupContainer html, container;
html = new WebMarkupContainer( "html" )
{
private static final long serialVersionUID = 1L;
@Override
public boolean isTransparentResolver()
{
return true;
}
};
html.add( new AttributeModifier( "xml:lang", lang ) );
html.add( new AttributeModifier( "lang", lang ) );
add( html );
---
all other elements can then added directly to the page as well.
best regards, --- jan.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Thanks, but I can't get this to work...
Posted by Franklin Antony <fr...@gmail.com>.
Hi Naaman ,
I am also in the same boat. If it did work at your end, could you please
let me know.
Thanks,
Franklin.
Johan Compagner wrote:
>
> Wat you could try to do is make that markup container a
> transparantresolver. Then the components can be added to the page
> itself
>
> 2007/11/18, nlif <na...@dbnet.co.il>:
>>
>> I tried adding an attributeModifier to the Page class, and it doesn't
>> work
>> (the "dir" attribute is not added to the html element).
>>
>> I then tried creating a WebMarkupContainer (and adding wicket:id to the
>> html
>> element in my html file), but this throws an exception. I think it's
>> because
>> I did it in my base-page class, and there are classes that extend it, and
>> their components are not added to my webMarkupContainer.
>>
>> Last, I tried using a MarkupFilter, like this:
>>
>> getApplication().getMarkupSettings().setMarkupParserFactory(new
>> IMarkupParserFactory()
>> {
>> public MarkupParser newMarkupParser(MarkupResourceStream
>> resource)
>> {
>> MarkupParser parser = new MarkupParser(new
>> XmlPullParser(), resource);
>> parser.appendMarkupFilter(new AbstractMarkupFilter()
>> {
>> public MarkupElement nextTag()
>> throws ParseException
>> {
>> // Get the next tag. If null, no more
>> tags
>> are available
>> final ComponentTag tag = (ComponentTag)
>> getParent().nextTag();
>>
>> if (tag == null)
>> {
>> return tag;
>> }
>>
>> if ("html".equals(tag.getName()))
>> {
>> tag.addBehavior(new
>> AttributeModifier("dir", true, new Model("rtl")));
>> }
>>
>> return tag;
>> }
>> });
>>
>> return parser;
>> }
>> });
>>
>>
>> I used a debugger to verify it indeed executes the addBehavior() line,
>> but
>> still - no "dir" attribute is added to the html.
>>
>> I cannot seem to find anywhere in the forum a specific example. There are
>> only general suggestions, such as "use MarkupFilter" or "add an
>> AttributeModifier"... I guess an code-sample would be helpful.
>>
>> Thanks again,
>> Naaman
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-can-I-switch-page-direction-%28LTR-RTL%29--tf4805391.html#a13817345
>> 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
>
>
>
--
View this message in context: http://www.nabble.com/How-can-I-switch-page-direction-%28LTR-RTL%29--tf4805391.html#a14025007
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: Thanks, but I can't get this to work...
Posted by Johan Compagner <jc...@gmail.com>.
Wat you could try to do is make that markup container a
transparantresolver. Then the components can be added to the page
itself
2007/11/18, nlif <na...@dbnet.co.il>:
>
> I tried adding an attributeModifier to the Page class, and it doesn't work
> (the "dir" attribute is not added to the html element).
>
> I then tried creating a WebMarkupContainer (and adding wicket:id to the html
> element in my html file), but this throws an exception. I think it's because
> I did it in my base-page class, and there are classes that extend it, and
> their components are not added to my webMarkupContainer.
>
> Last, I tried using a MarkupFilter, like this:
>
> getApplication().getMarkupSettings().setMarkupParserFactory(new
> IMarkupParserFactory()
> {
> public MarkupParser newMarkupParser(MarkupResourceStream
> resource)
> {
> MarkupParser parser = new MarkupParser(new
> XmlPullParser(), resource);
> parser.appendMarkupFilter(new AbstractMarkupFilter()
> {
> public MarkupElement nextTag()
> throws ParseException
> {
> // Get the next tag. If null, no more tags
> are available
> final ComponentTag tag = (ComponentTag)
> getParent().nextTag();
>
> if (tag == null)
> {
> return tag;
> }
>
> if ("html".equals(tag.getName()))
> {
> tag.addBehavior(new
> AttributeModifier("dir", true, new Model("rtl")));
> }
>
> return tag;
> }
> });
>
> return parser;
> }
> });
>
>
> I used a debugger to verify it indeed executes the addBehavior() line, but
> still - no "dir" attribute is added to the html.
>
> I cannot seem to find anywhere in the forum a specific example. There are
> only general suggestions, such as "use MarkupFilter" or "add an
> AttributeModifier"... I guess an code-sample would be helpful.
>
> Thanks again,
> Naaman
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/How-can-I-switch-page-direction-%28LTR-RTL%29--tf4805391.html#a13817345
> 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