Browse Source
Merge in DESIGN/design from ~OBO/design:persist/11.0-arabic to persist/11.0-arabic * commit '199f38fa48b70014055924d3d07a320d563e766f': (92 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方法优化 ...persist/11.0-arabic
Obo-王学仁
4 months ago
249 changed files with 1028 additions and 499 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,126 @@
|
||||
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); |
||||
} |
||||
|
||||
/** |
||||
* 把当前设计器国际化的组件方向应用到组件,影响子组件 |
||||
* |
||||
* @param component 组件 |
||||
* @return 组件对象 |
||||
* @param <T> Component子类 |
||||
*/ |
||||
public static <T extends Component> T applyOrientationByLocale(T component) { |
||||
component.applyComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
||||
return component; |
||||
} |
||||
|
||||
/** |
||||
* 把当前设计器国际化的组件方向设置到组件,不影响子组件 |
||||
* |
||||
* @param component 组件 |
||||
* @return 组件对象 |
||||
* @param <T> Component子类 |
||||
*/ |
||||
public static <T extends Component> T setOrientationByLocale(T component) { |
||||
component.setComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
||||
return component; |
||||
} |
||||
|
||||
/** |
||||
* 设置设计器国际化组件方向到多个组件,不影响子组件 |
||||
* |
||||
* @param components 组件数组 |
||||
*/ |
||||
public static void setOrientationByLocale(Component... components) { |
||||
for (Component component : components) { |
||||
component.setComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 应用设计器国际化组件方向到多个组件,影响子组件 |
||||
* |
||||
* @param components 组件数组 |
||||
*/ |
||||
public static void applyOrientationByLocale(Component... components) { |
||||
for (Component component : components) { |
||||
component.applyComponentOrientation(ComponentOrientation.getOrientation(LOCALE)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 判断当前设计器组件方向是否为rtl |
||||
*/ |
||||
public static boolean rtl() { |
||||
return ComponentOrientation.getOrientation(LOCALE) == ComponentOrientation.RIGHT_TO_LEFT; |
||||
} |
||||
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(); |
||||
} |
||||
|
||||
/** |
||||
* 根据组件方向调整titleBorder的标题位置 |
||||
* @param titledBorder |
||||
* @return |
||||
* @param <T> |
||||
*/ |
||||
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