Browse Source
Merge in ~OBO/design from arabic to persist/11.0-arabic * commit '4c9714dd0e0572de855b1315340e454c311b090e': (91 commits) 补一下JListControlPane的展示 数据库查询、存储过程代码回滚,后面统一处理SplitPane MenuKeySet拼接顺序修复 UILabel空指针bug修复 com.fr.base.i18n.BidiUtils.concatenateStrings方法名改一下,加注释 标签创建方式重构还原-designer-realize部分 标签创建方式重构还原-designer-chart部分 标签创建方式重构还原-designer-base部分 PreferencePane标签创建方式重构,布局生成方式还原 FRGUIPaneFactory方法名还原一下,不新增方法,注释写明支持RTL 调整下JDBCDefPane,顺便把FRGUIPaneFactory漏的改动提交 漏了TreeTableDataDictPane,处理一下 重构FRLeftFlowLayout、TreeRootPane 绝对位置替换为相对位置,第三批 绝对位置替换为相对位置,第二批 绝对位置替换为相对位置,第一批 简化titleBorder生成方式 换一下方法调用方式 getMenuKeySetName和getMenuKeySetNameWithDot方法优化 去除多余import ...persist/11.0-arabic
Obo-王学仁
4 months ago
250 changed files with 936 additions and 468 deletions
@ -0,0 +1,23 @@ |
|||||||
|
package com.fr.base.i18n; |
||||||
|
|
||||||
|
import com.fr.stable.fun.I18nProvider; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Locale; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* description |
||||||
|
* |
||||||
|
* @author obo |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2024/08/06 |
||||||
|
*/ |
||||||
|
public class ArabicI18nImpl implements I18nProvider { |
||||||
|
@Override |
||||||
|
public Map<Locale, String> obtainAll() { |
||||||
|
Map<Locale, String> map = new HashMap<>(); |
||||||
|
map.put(new Locale("ar", "SA"), "Fine-Core_Arabic_Language"); |
||||||
|
return map; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,91 @@ |
|||||||
|
package com.fr.base.i18n; |
||||||
|
|
||||||
|
import com.fr.design.DesignerEnvManager; |
||||||
|
|
||||||
|
import javax.swing.border.TitledBorder; |
||||||
|
import java.awt.Component; |
||||||
|
import java.awt.ComponentOrientation; |
||||||
|
import java.awt.Container; |
||||||
|
import java.util.Locale; |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据国际化获取组件方向 |
||||||
|
* |
||||||
|
* @author obo |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2024/07/17 |
||||||
|
*/ |
||||||
|
public class BidiUtils { |
||||||
|
|
||||||
|
private static final Locale LOCALE = DesignerEnvManager.getEnvManager().getLanguage(); |
||||||
|
|
||||||
|
private BidiUtils() { |
||||||
|
} |
||||||
|
|
||||||
|
public static ComponentOrientation getOrientationByLocale() { |
||||||
|
return ComponentOrientation.getOrientation(LOCALE); |
||||||
|
} |
||||||
|
|
||||||
|
public static <T extends Component> T applyOrientationByLocale(T component) { |
||||||
|
component.applyComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
||||||
|
return component; |
||||||
|
} |
||||||
|
|
||||||
|
public static <T extends Component> T setOrientationByLocale(T component) { |
||||||
|
component.setComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
||||||
|
return component; |
||||||
|
} |
||||||
|
|
||||||
|
public static void setOrientationByLocale(Component... components) { |
||||||
|
for (Component component : components) { |
||||||
|
component.setComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static void applyOrientationByLocale(Component... components) { |
||||||
|
for (Component component : components) { |
||||||
|
component.applyComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean rtl() { |
||||||
|
return ComponentOrientation.getOrientation(LOCALE) == ComponentOrientation.RIGHT_TO_LEFT; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 拼接字符数组,有的组件名是多段字符串拼接起来的,如果是rtl的话需要反向拼接 |
||||||
|
*/ |
||||||
|
public static String concatenateStrings(String... strs) { |
||||||
|
StringBuilder result = new StringBuilder(); |
||||||
|
|
||||||
|
if (rtl()) { |
||||||
|
for (int i = strs.length - 1; i >= 0; i--) { |
||||||
|
result.append(strs[i]); |
||||||
|
} |
||||||
|
} else { |
||||||
|
for (int i = 0; i <= strs.length - 1; i++) { |
||||||
|
result.append(strs[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
return result.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public static <T extends TitledBorder> T applyTitledBorderJustification(T titledBorder) { |
||||||
|
titledBorder.setTitleJustification(BidiUtils.rtl() ? TitledBorder.RIGHT : TitledBorder.LEFT); |
||||||
|
return titledBorder; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 镜像BoxLayout布局组件 |
||||||
|
*/ |
||||||
|
public static void mirrorBoxLayout(Container container) { |
||||||
|
Component[] components = container.getComponents(); |
||||||
|
for (int i = components.length - 1; i >= 0; i--) { |
||||||
|
Component component = components[i]; |
||||||
|
container.remove(i); |
||||||
|
container.add(component); |
||||||
|
} |
||||||
|
container.revalidate(); |
||||||
|
container.repaint(); |
||||||
|
} |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue