Browse Source

REPORT-80251 英文设计器国际化显示问题

问题原因:
1、部分功能模块的label显示文字未做自动换行设置。
2、原先开始界面右键弹出框宽度被固定,未考虑不同语言的适配问题。
改动思路:
1、更改label为自动换行。
2、局部微调UI(横排组件变竖排,已与产品沟通无问题)。
3、设置右键弹出框前,根据当前语言环境确定弹出框宽度。
newui
levy 2 years ago
parent
commit
6285908bd8
  1. 19
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 3
      designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java
  3. 1
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java
  4. 14
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

19
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -119,6 +119,7 @@ public class PreferencePane extends BasicPane {
private static final int CACHING_DEFAULT = 5; private static final int CACHING_DEFAULT = 5;
private static final int CACHING_GAP = 5; private static final int CACHING_GAP = 5;
private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230; private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230;
private static final int PREFERENCE_LABEL_MAX_WIDTH = 460;
private static final int OFFSET_HEIGHT = 60; private static final int OFFSET_HEIGHT = 60;
private static final String TYPE = "pressed"; private static final String TYPE = "pressed";
@ -423,22 +424,20 @@ public class PreferencePane extends BasicPane {
private void createFunctionPane(JPanel generalPane) { private void createFunctionPane(JPanel generalPane) {
JPanel topVerticalTitledBorderPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Function")); JPanel topVerticalTitledBorderPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Function"));
JPanel upper = new JPanel(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout()); JPanel supportUndoPanel = new JPanel(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout());
JPanel lower = new JPanel(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout()); topVerticalTitledBorderPane.add(supportUndoPanel);
topVerticalTitledBorderPane.add(upper);
topVerticalTitledBorderPane.add(lower);
generalPane.add(topVerticalTitledBorderPane); generalPane.add(topVerticalTitledBorderPane);
//添加supportUndo选择项 //添加supportUndo选择项
supportUndoCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Support_Undo")); supportUndoCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Support_Undo"));
upper.add(supportUndoCheckBox); supportUndoPanel.add(supportUndoCheckBox);
//添加maxUndoLimit //添加maxUndoLimit
//String[] undoTimes = {"最大撤销次数","5次","10次","15次","20次","50次"}; //String[] undoTimes = {"最大撤销次数","5次","10次","15次","20次","50次"};
String[] undoTimes = {i18nText("Fine-Design_Basic_Max_Undo_Limit"), MAX_UNDO_LIMIT_5 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_10 + i18nText("Fine-Design_Basic_Time(s)") String[] undoTimes = {i18nText("Fine-Design_Basic_Max_Undo_Limit"), MAX_UNDO_LIMIT_5 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_10 + i18nText("Fine-Design_Basic_Time(s)")
, MAX_UNDO_LIMIT_15 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_20 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_50 + i18nText("Fine-Design_Basic_Time(s)")}; , MAX_UNDO_LIMIT_15 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_20 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_50 + i18nText("Fine-Design_Basic_Time(s)")};
maxUndoLimit = new UIComboBox(undoTimes); maxUndoLimit = new UIComboBox(undoTimes);
upper.add(maxUndoLimit); supportUndoPanel.add(maxUndoLimit);
//不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数 //不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数
supportUndoCheckBox.addActionListener(new ActionListener() { supportUndoCheckBox.addActionListener(new ActionListener() {
@ -452,14 +451,14 @@ public class PreferencePane extends BasicPane {
//添加supportDefaultParentCalculate选择项 //添加supportDefaultParentCalculate选择项
supportDefaultParentCalculateCheckBox = new UICheckBox( supportDefaultParentCalculateCheckBox = new UICheckBox(
i18nText("Fine-Design_Basic_Preference_Support_Default_Parent_Calculate")); i18nText("Fine-Design_Basic_Preference_Support_Default_Parent_Calculate"));
upper.add(supportDefaultParentCalculateCheckBox); topVerticalTitledBorderPane.add(supportDefaultParentCalculateCheckBox);
//添加是否展示打开模板提示缺少插件选择项 //添加是否展示打开模板提示缺少插件选择项
showTemplateMissingPlugin = new UICheckBox( showTemplateMissingPlugin = new UICheckBox(
i18nText("Fine-Design_Basic_Preference_Show-Template-Missing-Plugin")); i18nText("Fine-Design_Basic_Preference_Show-Template-Missing-Plugin"));
upper.add(showTemplateMissingPlugin); topVerticalTitledBorderPane.add(showTemplateMissingPlugin);
startWithEmptyFile = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Start_Empty_File")); startWithEmptyFile = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Start_Empty_File"));
lower.add(startWithEmptyFile); topVerticalTitledBorderPane.add(startWithEmptyFile);
} }
private void createEditPane(JPanel generalPane) { private void createEditPane(JPanel generalPane) {
@ -661,7 +660,7 @@ public class PreferencePane extends BasicPane {
startupPageEnabledCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Startup_Page_Config_Check_Text")); startupPageEnabledCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Startup_Page_Config_Check_Text"));
startupPane.add(startupPageEnabledCheckBox); startupPane.add(startupPageEnabledCheckBox);
UILabel descLabel = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Config_Desc")); UILabel descLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Startup_Page_Config_Desc"), PREFERENCE_LABEL_MAX_WIDTH);
descLabel.setForeground(new Color(51, 51, 52, (int)Math.round(0.5 * 255))); descLabel.setForeground(new Color(51, 51, 52, (int)Math.round(0.5 * 255)));
startupPane.add(descLabel); startupPane.add(descLabel);
} }

3
designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java

@ -94,8 +94,7 @@ public class FeedbackToolboxDialog extends JDialog {
private JPanel createInfoPane() { private JPanel createInfoPane() {
JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 10); JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 10);
UILabel title = new UILabel(); UILabel title = new UILabel();
//空格布局会好看一点 title.setText(Toolkit.i18nText("Fine-Design_Basic_Carton_Record_Lag_Time") + ": ");
title.setText(" " + Toolkit.i18nText("Fine-Design_Basic_Carton_Record_Lag_Time") + ": ");
//判断一下当天是否有卡顿日志记录,如果有将日期设置为当天,如果没有设置为空 //判断一下当天是否有卡顿日志记录,如果有将日期设置为当天,如果没有设置为空
boolean cartonExists = SwitchForSwingChecker.isCartonExists(); boolean cartonExists = SwitchForSwingChecker.isCartonExists();
if (cartonExists) { if (cartonExists) {

1
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java

@ -27,7 +27,6 @@ public class HistoryTemplateListPane implements CallbackEvent {
synchronized (HistoryTemplateListPane.class) { synchronized (HistoryTemplateListPane.class) {
if (THIS == null) { if (THIS == null) {
THIS = new HistoryTemplateListPane(); THIS = new HistoryTemplateListPane();
int a = 111;
} }
} }
} }

14
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -24,6 +24,7 @@ import com.fr.design.utils.TemplateUtils;
import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -67,6 +68,7 @@ import java.awt.geom.Line2D;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
import java.util.List; import java.util.List;
import java.util.Locale;
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
@ -197,7 +199,17 @@ public class MutilTempalteTabPane extends JComponent {
height += 25; height += 25;
} }
} }
menu.setPreferredSize(new Dimension(170, height)); //当前i18n适配中英日,其中英日字符串长度较长,需调整popupMenu的宽度
//后续版本可考虑读取字符串像素宽度,以自适应调整menu
int popupMenuWidth;
if(ComparatorUtils.equals(GeneralContext.getLocale(), Locale.US)){
popupMenuWidth = 350;
}else if(ComparatorUtils.equals(GeneralContext.getLocale(), Locale.JAPAN)){
popupMenuWidth = 240;
}else {
popupMenuWidth = 170;
}
menu.setPreferredSize(new Dimension(popupMenuWidth, height));
GUICoreUtils.showPopupMenu(menu, MutilTempalteTabPane.getInstance(), e.getX(), MutilTempalteTabPane.getInstance().getY() - 1 + MutilTempalteTabPane.getInstance().getHeight()); GUICoreUtils.showPopupMenu(menu, MutilTempalteTabPane.getInstance(), e.getX(), MutilTempalteTabPane.getInstance().getY() - 1 + MutilTempalteTabPane.getInstance().getHeight());
} }
} }

Loading…
Cancel
Save