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/14 15:39:14 UTC
How can I switch page direction (LTR-RTL)?
Hi all,
I would like to be able to set the page direction: right-to-left or
left-to-right.
This can be done via the browser's view -> switch page direction
menu-option,
but I need to be able to set this dynamically (i.e. by the application),
based on the locale.
Is this supported in Wicket?
Thanks,
Naaman
--
View this message in context: http://www.nabble.com/How-can-I-switch-page-direction-%28LTR-RTL%29--tf4805391.html#a13747743
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
Thanks, but I can't get this to work...
Posted by 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
Re: How can I switch page direction (LTR-RTL)?
Posted by Dipu Seminlal <di...@googlemail.com>.
Its a class that allows a tag attribute of a wicket component to be
modified on the fly with the value supplied.
We can do something like this, hope this makes sense
WebMarkupContainer myImage = new WebMarkupContainer("image");
String url =image.getThumbnailURL()==null?image.getURL():image.getThumbnailURL();
if(url == null || url.equals(""))
{
myImage.setVisible(false);
}
else
{
AttributeModifier am = new AttributeModifier("src", new Model(url));
myImage.add(am);
}
cheers
-dipu
On Nov 15, 2007 7:29 AM, nlif <na...@dbnet.co.il> wrote:
>
> Thanks. What is the "attribute modifier"?
>
> Naaman
>
>
>
>
> alshamsi wrote:
> >
> > In your html page you can use the set the dir attribute of the html tag
> > to the direction you want
> >
> > <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
> >
> > I believe you can do so automatically using the new attribute modifier.
> >
> > Regards
> > Alshamsi
> >
> >
> > nlif wrote:
> >> Hi all,
> >>
> >> I would like to be able to set the page direction: right-to-left or
> >> left-to-right.
> >> This can be done via the browser's view -> switch page direction
> >> menu-option,
> >> but I need to be able to set this dynamically (i.e. by the application),
> >> based on the locale.
> >> Is this supported in Wicket?
> >>
> >>
> >> Thanks,
> >> Naaman
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > 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#a13762990
> 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 can I switch page direction (LTR-RTL)?
Posted by nlif <na...@dbnet.co.il>.
Thanks. What is the "attribute modifier"?
Naaman
alshamsi wrote:
>
> In your html page you can use the set the dir attribute of the html tag
> to the direction you want
>
> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
>
> I believe you can do so automatically using the new attribute modifier.
>
> Regards
> Alshamsi
>
>
> nlif wrote:
>> Hi all,
>>
>> I would like to be able to set the page direction: right-to-left or
>> left-to-right.
>> This can be done via the browser's view -> switch page direction
>> menu-option,
>> but I need to be able to set this dynamically (i.e. by the application),
>> based on the locale.
>> Is this supported in Wicket?
>>
>>
>> Thanks,
>> Naaman
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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#a13762990
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 can I switch page direction (LTR-RTL)?
Posted by Suad AlShamsi <su...@gmail.com>.
In your html page you can use the set the dir attribute of the html tag
to the direction you want
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
I believe you can do so automatically using the new attribute modifier.
Regards
Alshamsi
nlif wrote:
> Hi all,
>
> I would like to be able to set the page direction: right-to-left or
> left-to-right.
> This can be done via the browser's view -> switch page direction
> menu-option,
> but I need to be able to set this dynamically (i.e. by the application),
> based on the locale.
> Is this supported in Wicket?
>
>
> Thanks,
> Naaman
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org