Browse Source

插入-公式

persist/11.0-arabic
obo 4 months ago
parent
commit
0c37386fed
  1. 41
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  2. 5
      designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java

41
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.ParameterMapNameSpace;
import com.fr.base.TableDataNameSpace; import com.fr.base.TableDataNameSpace;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.i18n.BidiUtils;
import com.fr.base.io.IOFile; import com.fr.base.io.IOFile;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -161,6 +162,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
public FormulaPane() { public FormulaPane() {
initComponents(); initComponents();
BidiUtils.applyOrientationByLocale(this);
} }
private void initFormulaTextAreaKeyListener() { private void initFormulaTextAreaKeyListener() {
@ -225,6 +227,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private void initFormulaTextArea() { private void initFormulaTextArea() {
formulaTextArea = new RSyntaxTextArea(); formulaTextArea = new RSyntaxTextArea();
BidiUtils.setOrientationByLocale(formulaTextArea);
configFormulaArea(); configFormulaArea();
initFormulaTextAreaKeyListener(); initFormulaTextAreaKeyListener();
initFormulaTextAreaMouseListener(); initFormulaTextAreaMouseListener();
@ -259,23 +262,23 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private void initTipsPane() { private void initTipsPane() {
// tipsPane // tipsPane
JPanel containerSPane = new JPanel(new BorderLayout(4, 1)); JPanel containerSPane = new JPanel(new BorderLayout(4, 1));
JPanel labelPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0), true); JPanel labelPane = new JPanel(new FlowLayout(BidiUtils.rtl() ? FlowLayout.RIGHT : FlowLayout.LEFT, 0, 0), true);
JPanel searchPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0), true); JPanel searchPane = new JPanel(new FlowLayout(BidiUtils.rtl() ? FlowLayout.LEFT : FlowLayout.RIGHT, 0, 0), true);
containerSPane.setPreferredSize(new Dimension(892, 23)); containerSPane.setPreferredSize(new Dimension(892, 23));
this.add(containerSPane, BorderLayout.NORTH); this.add(containerSPane, BorderLayout.NORTH);
UIButton searchButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Search")); UIButton searchButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Search"));
UILabel formulaLabel = new UILabel( 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)); 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)); keyWordTextField.setPreferredSize(new Dimension(240, 23));
searchPane.add(keyWordTextField, BorderLayout.EAST); searchPane.add(keyWordTextField, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST);
searchPane.add(searchButton, BorderLayout.EAST); searchPane.add(searchButton, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST);
containerSPane.add(labelPane, BorderLayout.WEST); containerSPane.add(labelPane, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST);
containerSPane.add(searchPane, BorderLayout.EAST); containerSPane.add(searchPane, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST);
initKeyWordTextFieldKeyListener(); initKeyWordTextFieldKeyListener();
tipsList = new JList(listModel); tipsList = new JList(listModel);
@ -313,7 +316,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
// text // text
JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(textPane, BorderLayout.CENTER); this.add(textPane, BorderLayout.CENTER);
JPanel checkBoxandbuttonPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); JPanel checkBoxandbuttonPane = new JPanel(new BorderLayout());
initFormulaTextArea(); initFormulaTextArea();
UIScrollPane formulaTextAreaScrollPane = new UIScrollPane(formulaTextArea); UIScrollPane formulaTextAreaScrollPane = new UIScrollPane(formulaTextArea);
@ -329,12 +332,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
//靠左流式布局 //靠左流式布局
JPanel checkBoxPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); 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(); JPanel buttonPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
buttonPane.add(checkValidButton, BorderLayout.EAST); buttonPane.add(checkValidButton, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST);
buttonPane.add(calButton, BorderLayout.EAST); buttonPane.add(calButton, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST);
checkBoxandbuttonPane.add(buttonPane, BorderLayout.EAST); checkBoxandbuttonPane.add(buttonPane, BidiUtils.rtl() ? BorderLayout.WEST : BorderLayout.EAST);
if (autoCompletionCheck == null) { if (autoCompletionCheck == null) {
autoCompletionCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_AutoCompletion")); autoCompletionCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_AutoCompletion"));
autoCompletionCheck.setSelected(true); 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 = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Before_Closed"));
checkBeforeColse.setSelected(true); checkBeforeColse.setSelected(true);
} }
checkBoxPane.add(autoCompletionCheck, BorderLayout.WEST); checkBoxPane.add(autoCompletionCheck, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST);
checkBoxPane.add(checkBeforeColse, BorderLayout.WEST); checkBoxPane.add(checkBeforeColse, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST);
extendCheckBoxPane(checkBoxPane); extendCheckBoxPane(checkBoxPane);
ParameterTableModel model = new ParameterTableModel(0); ParameterTableModel model = new ParameterTableModel(0);
@ -1073,7 +1076,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
UIScrollPane functionTypeScrollPane = new UIScrollPane(functionTypeList); UIScrollPane functionTypeScrollPane = new UIScrollPane(functionTypeList);
functionTypeScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); functionTypeScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
functionTypeScrollPane.setPreferredSize(new Dimension(140, 200)); 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(); initTypeListCellRenderer();
initGroupTypeModel(); initGroupTypeModel();
initTypeListSelectionListener(); initTypeListSelectionListener();
@ -1188,7 +1191,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
UIScrollPane functionNameScrollPane = new UIScrollPane(functionNameList); UIScrollPane functionNameScrollPane = new UIScrollPane(functionNameList);
functionNameScrollPane.setPreferredSize(new Dimension(140, 200)); functionNameScrollPane.setPreferredSize(new Dimension(140, 200));
functionPane.add( 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); BorderLayout.CENTER);
functionNameScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); functionNameScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
initFunctionNameListCellRenderer(); initFunctionNameListCellRenderer();
@ -1272,7 +1275,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
UIScrollPane variablesTreePane = new UIScrollPane(variablesTree); UIScrollPane variablesTreePane = new UIScrollPane(variablesTree);
variablesTreePane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); variablesTreePane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
panel.add(this.createNamePane( 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.setRootVisible(false);
variablesTree.setShowsRootHandles(true); variablesTree.setShowsRootHandles(true);
variablesTree.addMouseListener(applyTextMouseListener); variablesTree.addMouseListener(applyTextMouseListener);
@ -1282,7 +1285,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
UIScrollPane desScrollPane = new UIScrollPane(descriptionTextArea); UIScrollPane desScrollPane = new UIScrollPane(descriptionTextArea);
desScrollPane.setBorder(null); 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(); initVariablesTreeSelectionListener();
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }

5
designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java

@ -1,6 +1,7 @@
package com.fr.design.formula; package com.fr.design.formula;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.i18n.BidiUtils;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import javax.swing.JPanel; 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 = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Write_Save_Formula"));
reserveCheckBox4Write.setSelected(false); reserveCheckBox4Write.setSelected(false);
checkBoxPane.add(reserveCheckBox4Result, BorderLayout.WEST); checkBoxPane.add(reserveCheckBox4Result, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST);
checkBoxPane.add(reserveCheckBox4Write, BorderLayout.WEST); checkBoxPane.add(reserveCheckBox4Write, BidiUtils.rtl() ? BorderLayout.EAST : BorderLayout.WEST);
} }
@Override @Override

Loading…
Cancel
Save