|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.fr.base.i18n; |
|
|
|
|
|
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
|
|
|
|
|
|
import javax.swing.border.TitledBorder; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.ComponentOrientation; |
|
|
|
@ -15,9 +17,7 @@ import java.util.Locale;
|
|
|
|
|
*/ |
|
|
|
|
public class BidiUtils { |
|
|
|
|
|
|
|
|
|
//private static final Locale ar = new Locale("ar", "SA");
|
|
|
|
|
private static final Locale ar = true ? new Locale("ar", "SA") : Locale.CHINA; |
|
|
|
|
//private static final Locale ar = Locale.CHINA;
|
|
|
|
|
private static final Locale LOCALE = DesignerEnvManager.getEnvManager().getLanguage(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -25,33 +25,33 @@ public class BidiUtils {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static ComponentOrientation getOrientationByLocale() { |
|
|
|
|
return ComponentOrientation.getOrientation(ar); |
|
|
|
|
return ComponentOrientation.getOrientation(LOCALE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static <T extends Component> T applyOrientationByLocale(T component) { |
|
|
|
|
component.applyComponentOrientation(ComponentOrientation.getOrientation(ar)); |
|
|
|
|
component.applyComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
|
|
|
|
return component; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static <T extends Component> T setOrientationByLocale(T component) { |
|
|
|
|
component.setComponentOrientation(ComponentOrientation.getOrientation(ar)); |
|
|
|
|
component.setComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
|
|
|
|
return component; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void setOrientationByLocale(Component... components) { |
|
|
|
|
for (Component component : components) { |
|
|
|
|
component.setComponentOrientation(ComponentOrientation.getOrientation(ar)); |
|
|
|
|
component.setComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void applyOrientationByLocale(Component... components) { |
|
|
|
|
for (Component component : components) { |
|
|
|
|
component.applyComponentOrientation(ComponentOrientation.getOrientation(ar)); |
|
|
|
|
component.applyComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static boolean rtl() { |
|
|
|
|
return ComponentOrientation.getOrientation(ar) == ComponentOrientation.RIGHT_TO_LEFT; |
|
|
|
|
return ComponentOrientation.getOrientation(LOCALE) == ComponentOrientation.RIGHT_TO_LEFT; |
|
|
|
|
} |
|
|
|
|
public static String reverseConcatenateStrings(String... strs) { |
|
|
|
|
StringBuilder result = new StringBuilder(); |
|
|
|
|