From 0c37386fed27cee02adf61f7da04cc0cec298d1f Mon Sep 17 00:00:00 2001 From: obo Date: Tue, 6 Aug 2024 16:20:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E5=85=A5-=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 41 ++++++++++--------- .../FormulaPaneWhenReserveFormula.java | 5 ++- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index f41c044b74..543776c5ff 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -6,6 +6,7 @@ import com.fr.base.Parameter; import com.fr.base.ParameterMapNameSpace; import com.fr.base.TableDataNameSpace; import com.fr.base.Utils; +import com.fr.base.i18n.BidiUtils; import com.fr.base.io.IOFile; import com.fr.data.TableDataSource; import com.fr.design.actions.UpdateAction; @@ -161,6 +162,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public FormulaPane() { initComponents(); + BidiUtils.applyOrientationByLocale(this); } private void initFormulaTextAreaKeyListener() { @@ -225,6 +227,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initFormulaTextArea() { formulaTextArea = new RSyntaxTextArea(); + BidiUtils.setOrientationByLocale(formulaTextArea); configFormulaArea(); initFormulaTextAreaKeyListener(); initFormulaTextAreaMouseListener(); @@ -259,23 +262,23 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initTipsPane() { // tipsPane JPanel containerSPane = new JPanel(new BorderLayout(4, 1)); - JPanel labelPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0), true); - JPanel searchPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0), true); + JPanel labelPane = new JPanel(new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT, 0, 0), true); + JPanel searchPane = new JPanel(new FlowLayout(BidiUtils.rtl() ? FlowLayout.LEFT : FlowLayout.RIGHT, 0, 0), true); containerSPane.setPreferredSize(new Dimension(892, 23)); this.add(containerSPane, BorderLayout.NORTH); UIButton searchButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Search")); UILabel formulaLabel = new UILabel( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Input_Formula_In_The_Text_Area_Below") + ":"); + BidiUtils.reverseConcatenateStrings(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Input_Formula_In_The_Text_Area_Below"), ":")); formulaLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); - labelPane.add(formulaLabel, BorderLayout.WEST); + labelPane.add(formulaLabel, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); keyWordTextField.setPreferredSize(new Dimension(240, 23)); - searchPane.add(keyWordTextField, BorderLayout.EAST); - searchPane.add(searchButton, BorderLayout.EAST); + searchPane.add(keyWordTextField, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); + searchPane.add(searchButton, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); - containerSPane.add(labelPane, BorderLayout.WEST); - containerSPane.add(searchPane, BorderLayout.EAST); + containerSPane.add(labelPane, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); + containerSPane.add(searchPane, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); initKeyWordTextFieldKeyListener(); tipsList = new JList(listModel); @@ -313,7 +316,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { // text JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.add(textPane, BorderLayout.CENTER); - JPanel checkBoxandbuttonPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); + JPanel checkBoxandbuttonPane = new JPanel(new BorderLayout()); initFormulaTextArea(); UIScrollPane formulaTextAreaScrollPane = new UIScrollPane(formulaTextArea); @@ -329,12 +332,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { //靠左流式布局 JPanel checkBoxPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST); + checkBoxandbuttonPane.add(checkBoxPane, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); //靠右流式布局 JPanel buttonPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); - buttonPane.add(checkValidButton, BorderLayout.EAST); - buttonPane.add(calButton, BorderLayout.EAST); - checkBoxandbuttonPane.add(buttonPane, BorderLayout.EAST); + buttonPane.add(checkValidButton, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); + buttonPane.add(calButton, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); + checkBoxandbuttonPane.add(buttonPane, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST); if (autoCompletionCheck == null) { autoCompletionCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_AutoCompletion")); autoCompletionCheck.setSelected(true); @@ -343,8 +346,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { checkBeforeColse = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Before_Closed")); checkBeforeColse.setSelected(true); } - checkBoxPane.add(autoCompletionCheck, BorderLayout.WEST); - checkBoxPane.add(checkBeforeColse, BorderLayout.WEST); + checkBoxPane.add(autoCompletionCheck, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); + checkBoxPane.add(checkBeforeColse, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); extendCheckBoxPane(checkBoxPane); ParameterTableModel model = new ParameterTableModel(0); @@ -1073,7 +1076,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { UIScrollPane functionTypeScrollPane = new UIScrollPane(functionTypeList); functionTypeScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); functionTypeScrollPane.setPreferredSize(new Dimension(140, 200)); - functionPane.add(this.createNamePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Function_Category") + ":", functionTypeScrollPane), BorderLayout.WEST); + functionPane.add(this.createNamePane(BidiUtils.reverseConcatenateStrings(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Function_Category"), ":"), functionTypeScrollPane), BorderLayout.WEST); initTypeListCellRenderer(); initGroupTypeModel(); initTypeListSelectionListener(); @@ -1188,7 +1191,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { UIScrollPane functionNameScrollPane = new UIScrollPane(functionNameList); functionNameScrollPane.setPreferredSize(new Dimension(140, 200)); functionPane.add( - this.createNamePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Function_Name") + ":", functionNameScrollPane), + this.createNamePane(BidiUtils.reverseConcatenateStrings(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Function_Name"), ":"), functionNameScrollPane), BorderLayout.CENTER); functionNameScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); initFunctionNameListCellRenderer(); @@ -1272,7 +1275,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { UIScrollPane variablesTreePane = new UIScrollPane(variablesTree); variablesTreePane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); panel.add(this.createNamePane( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables") + ":", variablesTreePane), BorderLayout.WEST); + BidiUtils.reverseConcatenateStrings(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables"), ":"), variablesTreePane), BorderLayout.WEST); variablesTree.setRootVisible(false); variablesTree.setShowsRootHandles(true); variablesTree.addMouseListener(applyTextMouseListener); @@ -1282,7 +1285,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { UIScrollPane desScrollPane = new UIScrollPane(descriptionTextArea); desScrollPane.setBorder(null); - panel.add(this.createNamePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Formula_Description") + ":", desScrollPane), BorderLayout.CENTER); + panel.add(this.createNamePane(BidiUtils.reverseConcatenateStrings(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Formula_Description"), ":"), desScrollPane), BorderLayout.CENTER); initVariablesTreeSelectionListener(); this.add(panel, BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index ab49b605d4..f40dd41be4 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -1,6 +1,7 @@ package com.fr.design.formula; import com.fr.base.BaseFormula; +import com.fr.base.i18n.BidiUtils; import com.fr.design.gui.icheckbox.UICheckBox; import javax.swing.JPanel; @@ -40,8 +41,8 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { reserveCheckBox4Write = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Write_Save_Formula")); reserveCheckBox4Write.setSelected(false); - checkBoxPane.add(reserveCheckBox4Result, BorderLayout.WEST); - checkBoxPane.add(reserveCheckBox4Write, BorderLayout.WEST); + checkBoxPane.add(reserveCheckBox4Result, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); + checkBoxPane.add(reserveCheckBox4Write, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST); } @Override