RTL (Right To Left) Support


#1

Hi Beni,

I would like to add Hebrew and Arabic language support which means the components need to be in Right To Left alignment (rather than Left to Right).

In my JFrame I do:

if (ComponentOrientation.getOrientation(Locale.getDefault()).isLeftToRight())
   applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
else
   applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

this.setVisible(true);

The Java/Swing components respect this but none of the DockingFrame components respect this setting.

I cannot find which class has the setComponentOrientation method. Also, the DockingFrame toolbar does not respect the setting either.

CToolbarAreaLocation tbPos = ctcArea.getNorthToolbar().getStationLocation();

With the above code, the toolbar is set to the upper-left but I want it to be upper-right.

Any help with this would be appreciated.

Regards,
Roger


#2

I never built support for right-to-left orientation into DockingFrames.

It’s a feature that I will not implement, because of the amount of time required to do so (I would estimate at least 5 full working days). Also I have very little experience in this area. Basically the entire layout would need to be mirrored? Every placement of tabs, titles, buttons, popup-menus, etc?

If you would like to create your own branch, and add support for some components, then please do so. I would be happy to assist e.g. by telling you which classes might need to be updated, or by explaining how some of the layouts are created.


#3

Hi Beni,

What about at least handling the toolbar?

If I could figure out how to have the toolbar fill completely across the window and make the icon buttons align right then I could add the icon buttons in reverse order.

Any thoughts.

Regards,
Roger


#4

Sorry Roger, I have to decline doing that myself.

But here are a few classes that would need to be updated for right-sided toolbars. It’s certainly not the complete list, but it would be a good start.

  • ToolbarContainerLayoutManager: update to move the entire set of toolbars to the right side (toolbar-container is the root Component for a set of toolbars)
  • ToolbarGridLayoutManager: update to right align toolbars that are part of the same column
  • DisplayerContentPane: to move all titles to the right side
  • ToolbarGroupTitle: moved from left to right, painting code must be updated
  • SpanToolbarLayoutManager?: probably needs an update too