|
|
|
@ -2,27 +2,26 @@ package com.fr.design.present.dict;
|
|
|
|
|
|
|
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
import com.fr.data.impl.FormulaDictionary; |
|
|
|
|
import com.fr.design.beans.FurtherBasicBeanPane; |
|
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
|
import com.fr.design.editor.editor.FormulaEditor; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
|
|
|
|
|
import com.fr.design.widget.FRWidgetFactory; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.JLabel; |
|
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.fix; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.row; |
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.column; |
|
|
|
|
|
|
|
|
|
public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> { |
|
|
|
|
|
|
|
|
|
private static final int EDITOR_COLUMN = 15; |
|
|
|
|
private static final int LEFT_BORDER = 5; |
|
|
|
|
private static final int MAX_WIDTH = 30; |
|
|
|
|
private FormulaEditor keyFormulaEditor; |
|
|
|
|
private FormulaEditor valueFormulaEditor; |
|
|
|
|
|
|
|
|
@ -32,45 +31,27 @@ public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> {
|
|
|
|
|
|
|
|
|
|
private void initComponents() { |
|
|
|
|
keyFormulaEditor = new FormulaEditor(); |
|
|
|
|
keyFormulaEditor.setColumns(EDITOR_COLUMN); |
|
|
|
|
JPanel keyFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0)); |
|
|
|
|
keyFormulaContainer.setBorder(BorderFactory.createEmptyBorder(0, -LEFT_BORDER, 0, -LEFT_BORDER)); |
|
|
|
|
Icon icon = new LazyIcon("formula"); |
|
|
|
|
keyFormulaContainer.add(new JLabel(icon)); |
|
|
|
|
keyFormulaContainer.add(keyFormulaEditor); |
|
|
|
|
|
|
|
|
|
valueFormulaEditor = new FormulaEditor(); |
|
|
|
|
valueFormulaEditor.setColumns(EDITOR_COLUMN); |
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double[] columnSize = {p, f}; |
|
|
|
|
double[] rowSize = {p, p, p}; |
|
|
|
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
|
|
|
|
|
|
|
|
|
// html多行提示待优化
|
|
|
|
|
UILabel tag = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Dictionary_Display_Examples_Html")); |
|
|
|
|
tag.setForeground(new Color(143, 143, 146)); |
|
|
|
|
JPanel t = new JPanel(new BorderLayout()); |
|
|
|
|
t.add(tag, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
BaseFormula vf = BaseFormula.createFormulaBuilder().build("$$$"); |
|
|
|
|
valueFormulaEditor = new FormulaEditor(StringUtils.EMPTY, vf); |
|
|
|
|
|
|
|
|
|
JPanel valueFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0)); |
|
|
|
|
valueFormulaContainer.setBorder(BorderFactory.createEmptyBorder(0, -LEFT_BORDER, 0, -LEFT_BORDER)); |
|
|
|
|
valueFormulaContainer.add(new JLabel(icon)); |
|
|
|
|
valueFormulaContainer.add(valueFormulaEditor); |
|
|
|
|
|
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"), MAX_WIDTH, UILabel.LEFT), keyFormulaContainer}, |
|
|
|
|
new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"), MAX_WIDTH, UILabel.LEFT), valueFormulaContainer}, |
|
|
|
|
new Component[]{tag, null} |
|
|
|
|
}; |
|
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); |
|
|
|
|
|
|
|
|
|
JPanel panel = column(LayoutConstants.VERTICAL_GAP, |
|
|
|
|
row( |
|
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"))).weight(1), |
|
|
|
|
row(cell(new JLabel(new LazyIcon("formula"))), fix(4), cell(keyFormulaEditor).weight(1)).weight(2) |
|
|
|
|
), |
|
|
|
|
row( |
|
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"))).weight(1), |
|
|
|
|
row(cell(new JLabel(new LazyIcon("formula"))), fix(4), cell(valueFormulaEditor).weight(1)).weight(2) |
|
|
|
|
), |
|
|
|
|
cell(tag) |
|
|
|
|
).getComponent(); |
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
this.add(panel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void addChangeListener(DocumentListener l) { |
|
|
|
|