|
|
@ -1,5 +1,10 @@ |
|
|
|
package com.fr.design.formula; |
|
|
|
package com.fr.design.formula; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fine.swing.ui.layout.Layouts; |
|
|
|
|
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
|
|
|
|
import com.fine.theme.light.ui.FineRoundBorder; |
|
|
|
|
|
|
|
import com.fine.theme.utils.FineUIScale; |
|
|
|
|
|
|
|
import com.formdev.flatlaf.ui.FlatUIUtils; |
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.Parameter; |
|
|
|
import com.fr.base.Parameter; |
|
|
@ -10,6 +15,7 @@ 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; |
|
|
|
import com.fr.design.border.UIRoundedBorder; |
|
|
|
import com.fr.design.border.UIRoundedBorder; |
|
|
|
|
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
@ -66,7 +72,7 @@ import com.fr.stable.script.Tiny; |
|
|
|
import com.fr.stable.script.TinyHunter; |
|
|
|
import com.fr.stable.script.TinyHunter; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.Window; |
|
|
|
import java.awt.Window; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.SwingConstants; |
|
|
|
import javax.swing.DefaultListCellRenderer; |
|
|
|
import javax.swing.DefaultListCellRenderer; |
|
|
|
import javax.swing.DefaultListModel; |
|
|
|
import javax.swing.DefaultListModel; |
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.Icon; |
|
|
@ -92,7 +98,6 @@ import java.awt.BorderLayout; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Component; |
|
|
|
import java.awt.Component; |
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.FlowLayout; |
|
|
|
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.FocusEvent; |
|
|
|
import java.awt.event.FocusEvent; |
|
|
@ -120,6 +125,10 @@ import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.row; |
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.flex; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 公式编辑面板 |
|
|
|
* 公式编辑面板 |
|
|
|
* |
|
|
|
* |
|
|
@ -128,13 +137,11 @@ import java.util.Set; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@EnableMetrics |
|
|
|
@EnableMetrics |
|
|
|
public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
public static final int DEFUAL_FOMULA_LENGTH = 103; |
|
|
|
public static final int DEFUAL_FOMULA_LENGTH = FineUIScale.scale(103); |
|
|
|
public static final String ELLIPSIS = "..."; |
|
|
|
public static final String ELLIPSIS = "..."; |
|
|
|
public static final char KEY_CODE_A = 'A'; |
|
|
|
public static final char KEY_CODE_A = 'A'; |
|
|
|
public static final char KEY_CODE_Z = 'z'; |
|
|
|
public static final char KEY_CODE_Z = 'z'; |
|
|
|
public static final String NEWLINE = "\n"; |
|
|
|
public static final String NEWLINE = "\n"; |
|
|
|
public static final String FORMULA_ICON = "/com/fr/design/images/m_file/formula.png"; |
|
|
|
|
|
|
|
public static final String PARAM_ICON = "/com/fr/design/images/m_file/param.png"; |
|
|
|
|
|
|
|
private VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; |
|
|
|
private VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; |
|
|
|
private RSyntaxTextArea formulaTextArea; |
|
|
|
private RSyntaxTextArea formulaTextArea; |
|
|
|
private UITextField keyWordTextField = new UITextField(18); |
|
|
|
private UITextField keyWordTextField = new UITextField(18); |
|
|
@ -156,8 +163,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
private DefaultCompletionProvider completionProvider; |
|
|
|
private DefaultCompletionProvider completionProvider; |
|
|
|
private static final Map<String, String> PARAM_PREFIX_MAP = new HashMap<>(); |
|
|
|
private static final Map<String, String> PARAM_PREFIX_MAP = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
public static final int DESCRIPTION_TEXT_AREA_ROW = 16, DESCRIPTION_TEXT_AREA_COLUMN = 27; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FormulaPane() { |
|
|
|
public FormulaPane() { |
|
|
|
initComponents(); |
|
|
|
initComponents(); |
|
|
|
} |
|
|
|
} |
|
|
@ -255,26 +260,17 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initTipsPane() { |
|
|
|
private JPanel initTipsPane() { |
|
|
|
// tipsPane
|
|
|
|
// 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); |
|
|
|
|
|
|
|
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")); |
|
|
|
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") + ":"); |
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Input_Formula_In_The_Text_Area_Below") + ":", SwingConstants.LEFT); |
|
|
|
formulaLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); |
|
|
|
JPanel containerSPane = row( |
|
|
|
|
|
|
|
cell(formulaLabel), |
|
|
|
labelPane.add(formulaLabel, BorderLayout.WEST); |
|
|
|
flex(), |
|
|
|
keyWordTextField.setPreferredSize(new Dimension(240, 23)); |
|
|
|
cell(keyWordTextField), |
|
|
|
searchPane.add(keyWordTextField, BorderLayout.EAST); |
|
|
|
cell(searchButton) |
|
|
|
searchPane.add(searchButton, BorderLayout.EAST); |
|
|
|
).getComponent(); |
|
|
|
|
|
|
|
|
|
|
|
containerSPane.add(labelPane, BorderLayout.WEST); |
|
|
|
|
|
|
|
containerSPane.add(searchPane, BorderLayout.EAST); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initKeyWordTextFieldKeyListener(); |
|
|
|
initKeyWordTextFieldKeyListener(); |
|
|
|
tipsList = new JList(listModel); |
|
|
|
tipsList = new JList(listModel); |
|
|
@ -288,14 +284,22 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
fixFunctionNameList(tipsList.getSelectedValue().toString()); |
|
|
|
fixFunctionNameList(tipsList.getSelectedValue().toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return containerSPane; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void initComponents() { |
|
|
|
protected void initComponents() { |
|
|
|
this.setLayout(new BorderLayout(4, 4)); |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
|
|
|
|
|
|
|
initTextPane(); |
|
|
|
JPanel textPane = initTextPane(); |
|
|
|
initTipsPane(); |
|
|
|
JPanel tipsPane = initTipsPane(); |
|
|
|
initVariableTreeAndDescriptionArea(); |
|
|
|
JPanel variablePane = initVariableTreeAndDescriptionArea(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, |
|
|
|
|
|
|
|
cell(tipsPane), |
|
|
|
|
|
|
|
cell(textPane).weight(1), |
|
|
|
|
|
|
|
cell(variablePane).weight(2) |
|
|
|
|
|
|
|
).getComponent()); |
|
|
|
refocusInWindow(); |
|
|
|
refocusInWindow(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -303,37 +307,31 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
SwingUtilities.invokeLater(() -> formulaTextArea.requestFocusInWindow()); |
|
|
|
SwingUtilities.invokeLater(() -> formulaTextArea.requestFocusInWindow()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initVariableTreeAndDescriptionArea() { |
|
|
|
private JPanel initVariableTreeAndDescriptionArea() { |
|
|
|
variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); |
|
|
|
variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); |
|
|
|
this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH); |
|
|
|
return variableTreeAndDescriptionArea; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initTextPane() { |
|
|
|
private JPanel initTextPane() { |
|
|
|
|
|
|
|
JPanel textPane = new JPanel(new BorderLayout(0, LayoutConstants.VERTICAL_GAP)); |
|
|
|
|
|
|
|
JPanel checkBoxAndButtonPane = new JPanel(new BorderLayout()); |
|
|
|
|
|
|
|
|
|
|
|
// text
|
|
|
|
// text
|
|
|
|
JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
this.add(textPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
JPanel checkBoxandbuttonPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); |
|
|
|
|
|
|
|
initFormulaTextArea(); |
|
|
|
initFormulaTextArea(); |
|
|
|
|
|
|
|
|
|
|
|
UIScrollPane formulaTextAreaScrollPane = new UIScrollPane(formulaTextArea); |
|
|
|
UIScrollPane formulaTextAreaScrollPane = new UIScrollPane(formulaTextArea); |
|
|
|
formulaTextAreaScrollPane.setBorder(null); |
|
|
|
formulaTextAreaScrollPane.setBorder(new FineRoundBorder()); |
|
|
|
textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// buttonPane
|
|
|
|
|
|
|
|
JPanel buttonPane = row(8).getComponent(); |
|
|
|
UIButton checkValidButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Check_Valid")); |
|
|
|
UIButton checkValidButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Check_Valid")); |
|
|
|
UIButton calButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Button")); |
|
|
|
UIButton calButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Button")); |
|
|
|
checkValidButton.addActionListener(checkValidActionListener); |
|
|
|
checkValidButton.addActionListener(checkValidActionListener); |
|
|
|
calButton.addActionListener(calculateActionListener); |
|
|
|
calButton.addActionListener(calculateActionListener); |
|
|
|
|
|
|
|
buttonPane.add(checkValidButton); |
|
|
|
|
|
|
|
buttonPane.add(calButton); |
|
|
|
|
|
|
|
|
|
|
|
//靠左流式布局
|
|
|
|
// checkBoxPane
|
|
|
|
JPanel checkBoxPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
|
|
|
JPanel checkBoxPane = row(8).getComponent(); |
|
|
|
checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST); |
|
|
|
|
|
|
|
//靠右流式布局
|
|
|
|
|
|
|
|
JPanel buttonPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
|
|
|
|
buttonPane.add(checkValidButton, BorderLayout.EAST); |
|
|
|
|
|
|
|
buttonPane.add(calButton, BorderLayout.EAST); |
|
|
|
|
|
|
|
checkBoxandbuttonPane.add(buttonPane, 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); |
|
|
@ -342,10 +340,16 @@ 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); |
|
|
|
checkBoxPane.add(checkBeforeColse, BorderLayout.WEST); |
|
|
|
checkBoxPane.add(checkBeforeColse); |
|
|
|
extendCheckBoxPane(checkBoxPane); |
|
|
|
extendCheckBoxPane(checkBoxPane); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// layout
|
|
|
|
|
|
|
|
checkBoxAndButtonPane.add(checkBoxPane, BorderLayout.WEST); |
|
|
|
|
|
|
|
checkBoxAndButtonPane.add(buttonPane, BorderLayout.EAST); |
|
|
|
|
|
|
|
textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
textPane.add(checkBoxAndButtonPane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
ParameterTableModel model = new ParameterTableModel(0); |
|
|
|
ParameterTableModel model = new ParameterTableModel(0); |
|
|
|
editor4CalPane = new UITableEditorPane<>(model); |
|
|
|
editor4CalPane = new UITableEditorPane<>(model); |
|
|
|
formulaTextArea.addFocusListener(new FocusListener() { |
|
|
|
formulaTextArea.addFocusListener(new FocusListener() { |
|
|
@ -363,6 +367,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
uninstallAutoCompletion(); |
|
|
|
uninstallAutoCompletion(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return textPane; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private CompletionProvider createCompletionProvider() { |
|
|
|
private CompletionProvider createCompletionProvider() { |
|
|
@ -370,7 +375,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
completionProvider = new DefaultCompletionProvider(); |
|
|
|
completionProvider = new DefaultCompletionProvider(); |
|
|
|
NameAndDescription[] nameAndDescriptions = FunctionConstants.ALL.getDescriptions(); |
|
|
|
NameAndDescription[] nameAndDescriptions = FunctionConstants.ALL.getDescriptions(); |
|
|
|
for (NameAndDescription nameAndDescription : nameAndDescriptions) { |
|
|
|
for (NameAndDescription nameAndDescription : nameAndDescriptions) { |
|
|
|
completionProvider.addCompletion(new FormulaCompletion(completionProvider, nameAndDescription.getName(), BaseUtils.readIcon(FORMULA_ICON))); |
|
|
|
completionProvider.addCompletion(new FormulaCompletion(completionProvider, nameAndDescription.getName(), new LazyIcon("formula"))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
VariableResolver variableResolver = VariableResolver.DEFAULT; |
|
|
|
VariableResolver variableResolver = VariableResolver.DEFAULT; |
|
|
@ -394,7 +399,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
paramWithoutPre = parameter; |
|
|
|
paramWithoutPre = parameter; |
|
|
|
PARAM_PREFIX_MAP.put(paramWithoutPre, StringUtils.EMPTY); |
|
|
|
PARAM_PREFIX_MAP.put(paramWithoutPre, StringUtils.EMPTY); |
|
|
|
} |
|
|
|
} |
|
|
|
completionProvider.addCompletion(new FormulaCompletion(completionProvider, paramWithoutPre, BaseUtils.readIcon(PARAM_ICON))); |
|
|
|
completionProvider.addCompletion(new FormulaCompletion(completionProvider, paramWithoutPre, new LazyIcon("param"))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return completionProvider; |
|
|
|
return completionProvider; |
|
|
@ -645,7 +650,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
popupMenu = new JPopupMenu(); |
|
|
|
popupMenu = new JPopupMenu(); |
|
|
|
JScrollPane tipsScrollPane = new JScrollPane(tipsList); |
|
|
|
JScrollPane tipsScrollPane = new JScrollPane(tipsList); |
|
|
|
popupMenu.add(tipsScrollPane); |
|
|
|
popupMenu.add(tipsScrollPane); |
|
|
|
tipsScrollPane.setPreferredSize(new Dimension(240, 146)); |
|
|
|
tipsScrollPane.setPreferredSize(new Dimension(FineUIScale.scale(240), FineUIScale.scale(146))); |
|
|
|
tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); |
|
|
|
tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); |
|
|
|
popupMenu.show(keyWordTextField, 0, 23); |
|
|
|
popupMenu.show(keyWordTextField, 0, 23); |
|
|
|
} |
|
|
|
} |
|
|
@ -742,8 +747,10 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public BasicDialog showLargeWindow(Window window, DialogActionListener l) { |
|
|
|
public BasicDialog showLargeWindow(Window window, DialogActionListener l) { |
|
|
|
BasicDialog basicDialog = super.showWindowWithCustomSize(window, l, new Dimension(900, 600)); |
|
|
|
int width = FineUIScale.scale(900); |
|
|
|
basicDialog.setMinimumSize(new Dimension(900, 600)); |
|
|
|
int height = FineUIScale.scale(600); |
|
|
|
|
|
|
|
BasicDialog basicDialog = super.showWindowWithCustomSize(window, l, new Dimension(width, height)); |
|
|
|
|
|
|
|
basicDialog.setMinimumSize(new Dimension(width, height)); |
|
|
|
basicDialog.setResizable(true); |
|
|
|
basicDialog.setResizable(true); |
|
|
|
return basicDialog; |
|
|
|
return basicDialog; |
|
|
|
} |
|
|
|
} |
|
|
@ -1066,15 +1073,15 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
this.initComponents(); |
|
|
|
this.initComponents(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initFunctionTypeList(JPanel functionPane) { |
|
|
|
private JPanel initFunctionTypeList() { |
|
|
|
functionTypeList = new QuickList(functionTypeListModel); |
|
|
|
functionTypeList = new QuickList(functionTypeListModel); |
|
|
|
UIScrollPane functionTypeScrollPane = new UIScrollPane(functionTypeList); |
|
|
|
UIScrollPane functionTypeScrollPane = new UIScrollPane(functionTypeList); |
|
|
|
functionTypeScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); |
|
|
|
functionTypeScrollPane.setBorder(new FineRoundBorder()); |
|
|
|
functionTypeScrollPane.setPreferredSize(new Dimension(140, 200)); |
|
|
|
functionTypeList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); |
|
|
|
functionPane.add(this.createNamePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Function_Category") + ":", functionTypeScrollPane), BorderLayout.WEST); |
|
|
|
|
|
|
|
initTypeListCellRenderer(); |
|
|
|
initTypeListCellRenderer(); |
|
|
|
initGroupTypeModel(); |
|
|
|
initGroupTypeModel(); |
|
|
|
initTypeListSelectionListener(); |
|
|
|
initTypeListSelectionListener(); |
|
|
|
|
|
|
|
return this.createNamePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Function_Category"), functionTypeScrollPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initTypeListCellRenderer() { |
|
|
|
private void initTypeListCellRenderer() { |
|
|
@ -1181,23 +1188,21 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initFunctionNameList(JPanel functionPane) { |
|
|
|
private JPanel initFunctionNameList() { |
|
|
|
functionNameList = new JList(new DefaultListModel()); |
|
|
|
functionNameList = new JList(new DefaultListModel()); |
|
|
|
UIScrollPane functionNameScrollPane = new UIScrollPane(functionNameList); |
|
|
|
UIScrollPane functionNameScrollPane = new UIScrollPane(functionNameList); |
|
|
|
functionNameScrollPane.setPreferredSize(new Dimension(140, 200)); |
|
|
|
functionNameScrollPane.setBorder(new FineRoundBorder()); |
|
|
|
functionPane.add( |
|
|
|
functionNameList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); |
|
|
|
this.createNamePane(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(); |
|
|
|
initFunctionNameListCellRenderer(); |
|
|
|
initFunctionNameListSelectionListener(); |
|
|
|
initFunctionNameListSelectionListener(); |
|
|
|
initFunctionNameListMouseListener(); |
|
|
|
initFunctionNameListMouseListener(); |
|
|
|
|
|
|
|
return this.createNamePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Function_Name"), functionNameScrollPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initDescriptionTextArea() { |
|
|
|
private void initDescriptionTextArea() { |
|
|
|
// Description
|
|
|
|
// Description
|
|
|
|
descriptionTextArea = new UITextArea(DESCRIPTION_TEXT_AREA_ROW,DESCRIPTION_TEXT_AREA_COLUMN); |
|
|
|
descriptionTextArea = new UITextArea(); |
|
|
|
descriptionTextArea.setBackground(Color.white); |
|
|
|
descriptionTextArea.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); |
|
|
|
descriptionTextArea.setLineWrap(true); |
|
|
|
descriptionTextArea.setLineWrap(true); |
|
|
|
descriptionTextArea.setWrapStyleWord(true); |
|
|
|
descriptionTextArea.setWrapStyleWord(true); |
|
|
|
descriptionTextArea.setEditable(false); |
|
|
|
descriptionTextArea.setEditable(false); |
|
|
@ -1263,14 +1268,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initVariablesTree() { |
|
|
|
private JPanel initVariablesTree() { |
|
|
|
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
// variable
|
|
|
|
// vairable.
|
|
|
|
|
|
|
|
variablesTree = new JTree(); |
|
|
|
variablesTree = new JTree(); |
|
|
|
UIScrollPane variablesTreePane = new UIScrollPane(variablesTree); |
|
|
|
UIScrollPane variablesTreePane = new UIScrollPane(variablesTree); |
|
|
|
variablesTreePane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); |
|
|
|
variablesTreePane.setBorder(new FineRoundBorder()); |
|
|
|
panel.add(this.createNamePane( |
|
|
|
variablesTree.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); |
|
|
|
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); |
|
|
@ -1280,23 +1283,34 @@ 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); |
|
|
|
|
|
|
|
initVariablesTreeSelectionListener(); |
|
|
|
initVariablesTreeSelectionListener(); |
|
|
|
this.add(panel,BorderLayout.CENTER); |
|
|
|
return Layouts.row(LayoutConstants.HORIZONTAL_GAP, |
|
|
|
|
|
|
|
cell(this.createNamePane( |
|
|
|
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables"), variablesTreePane) |
|
|
|
|
|
|
|
).weight(1), |
|
|
|
|
|
|
|
cell(this.createNamePane( |
|
|
|
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Formula_Description"), desScrollPane) |
|
|
|
|
|
|
|
).weight(1) |
|
|
|
|
|
|
|
).getComponent(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initComponents() { |
|
|
|
private void initComponents() { |
|
|
|
this.setLayout(new BorderLayout(4, 4)); |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
initVariablesTree(); |
|
|
|
JPanel variablesTreePane = initVariablesTree(); |
|
|
|
initFunctionPane(); |
|
|
|
JPanel functionPane = initFunctionPane(); |
|
|
|
} |
|
|
|
this.add(Layouts.row(LayoutConstants.HORIZONTAL_GAP, |
|
|
|
|
|
|
|
cell(functionPane).weight(1), |
|
|
|
private void initFunctionPane() { |
|
|
|
cell(variablesTreePane).weight(2) |
|
|
|
JPanel functionPane = new JPanel(new BorderLayout(4, 4)); |
|
|
|
).getComponent()); |
|
|
|
this.add(functionPane, BorderLayout.WEST); |
|
|
|
} |
|
|
|
initFunctionTypeList(functionPane); |
|
|
|
|
|
|
|
initFunctionNameList(functionPane); |
|
|
|
private JPanel initFunctionPane() { |
|
|
|
|
|
|
|
JPanel functionTypePane = initFunctionTypeList(); |
|
|
|
|
|
|
|
JPanel functionNamePane = initFunctionNameList(); |
|
|
|
functionTypeList.setSelectedIndex(0); |
|
|
|
functionTypeList.setSelectedIndex(0); |
|
|
|
|
|
|
|
return Layouts.row(LayoutConstants.HORIZONTAL_GAP, |
|
|
|
|
|
|
|
cell(functionTypePane).weight(1), cell(functionNamePane).weight(1) |
|
|
|
|
|
|
|
).getComponent(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -1312,7 +1326,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
public LookDetailAction() { |
|
|
|
public LookDetailAction() { |
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Function_Detail")); |
|
|
|
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Function_Detail")); |
|
|
|
this.setMnemonic('L'); |
|
|
|
this.setMnemonic('L'); |
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); |
|
|
|
this.setSmallIcon(new LazyIcon("preview")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 弹出的窗口中显示函数的用法明细
|
|
|
|
// 弹出的窗口中显示函数的用法明细
|
|
|
@ -1345,7 +1359,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel createNamePane(String name, JComponent comp) { |
|
|
|
private JPanel createNamePane(String name, JComponent comp) { |
|
|
|
JPanel namePane = new JPanel(new BorderLayout(4, 4)); |
|
|
|
JPanel namePane = new JPanel(new BorderLayout(0, 4)); |
|
|
|
namePane.add(new UILabel(name), BorderLayout.NORTH); |
|
|
|
namePane.add(new UILabel(name), BorderLayout.NORTH); |
|
|
|
namePane.add(comp, BorderLayout.CENTER); |
|
|
|
namePane.add(comp, BorderLayout.CENTER); |
|
|
|
return namePane; |
|
|
|
return namePane; |
|
|
@ -1419,7 +1433,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
DefaultMutableTreeNode bindCellNode = new DefaultMutableTreeNode(new TextUserObject("$$$")); |
|
|
|
DefaultMutableTreeNode bindCellNode = new DefaultMutableTreeNode(new TextUserObject("$$$")); |
|
|
|
rootNode.add(bindCellNode); |
|
|
|
rootNode.add(bindCellNode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// todo: 缺一些icon
|
|
|
|
rootNode.add(new TextFolderUserObject(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Data_Fields"), |
|
|
|
rootNode.add(new TextFolderUserObject(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Data_Fields"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/dialog/table.png"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/dialog/table.png"), |
|
|
|
variableResolver.resolveColumnNames()).createMutableTreeNode()); |
|
|
|
variableResolver.resolveColumnNames()).createMutableTreeNode()); |
|
|
@ -1434,7 +1448,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
variableResolver.resolveTableDataParameterVariables()).createMutableTreeNode()); |
|
|
|
variableResolver.resolveTableDataParameterVariables()).createMutableTreeNode()); |
|
|
|
|
|
|
|
|
|
|
|
rootNode.add(new TextFolderUserObject(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ParameterD_Report_Parameter"), |
|
|
|
rootNode.add(new TextFolderUserObject(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ParameterD_Report_Parameter"), |
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_report/p.gif"), |
|
|
|
new LazyIcon("param"), |
|
|
|
variableResolver.resolveReportParameterVariables()).createMutableTreeNode()); |
|
|
|
variableResolver.resolveReportParameterVariables()).createMutableTreeNode()); |
|
|
|
|
|
|
|
|
|
|
|
rootNode.add(new TextFolderUserObject(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Server_Global_Parameters"), |
|
|
|
rootNode.add(new TextFolderUserObject(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Server_Global_Parameters"), |
|
|
|