|
|
@ -2,27 +2,26 @@ package com.fr.design.present.dict; |
|
|
|
|
|
|
|
|
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
|
|
|
import com.fr.data.impl.FormulaDictionary; |
|
|
|
import com.fr.data.impl.FormulaDictionary; |
|
|
|
import com.fr.design.beans.FurtherBasicBeanPane; |
|
|
|
import com.fr.design.beans.FurtherBasicBeanPane; |
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
import com.fr.design.editor.editor.FormulaEditor; |
|
|
|
import com.fr.design.editor.editor.FormulaEditor; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
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 com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
import javax.swing.JLabel; |
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
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> { |
|
|
|
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 keyFormulaEditor; |
|
|
|
private FormulaEditor valueFormulaEditor; |
|
|
|
private FormulaEditor valueFormulaEditor; |
|
|
|
|
|
|
|
|
|
|
@ -32,45 +31,27 @@ public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> { |
|
|
|
|
|
|
|
|
|
|
|
private void initComponents() { |
|
|
|
private void initComponents() { |
|
|
|
keyFormulaEditor = new FormulaEditor(); |
|
|
|
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 = 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")); |
|
|
|
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)); |
|
|
|
tag.setForeground(new Color(143, 143, 146)); |
|
|
|
JPanel t = new JPanel(new BorderLayout()); |
|
|
|
|
|
|
|
t.add(tag, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BaseFormula vf = BaseFormula.createFormulaBuilder().build("$$$"); |
|
|
|
BaseFormula vf = BaseFormula.createFormulaBuilder().build("$$$"); |
|
|
|
valueFormulaEditor = new FormulaEditor(StringUtils.EMPTY, vf); |
|
|
|
valueFormulaEditor = new FormulaEditor(StringUtils.EMPTY, vf); |
|
|
|
|
|
|
|
JPanel panel = column(LayoutConstants.VERTICAL_GAP, |
|
|
|
JPanel valueFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0)); |
|
|
|
row( |
|
|
|
valueFormulaContainer.setBorder(BorderFactory.createEmptyBorder(0, -LEFT_BORDER, 0, -LEFT_BORDER)); |
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"))).weight(1), |
|
|
|
valueFormulaContainer.add(new JLabel(icon)); |
|
|
|
row(cell(new JLabel(new LazyIcon("formula"))), fix(4), cell(keyFormulaEditor).weight(1)).weight(2) |
|
|
|
valueFormulaContainer.add(valueFormulaEditor); |
|
|
|
), |
|
|
|
|
|
|
|
row( |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"))).weight(1), |
|
|
|
new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Actual_Value"), MAX_WIDTH, UILabel.LEFT), keyFormulaContainer}, |
|
|
|
row(cell(new JLabel(new LazyIcon("formula"))), fix(4), cell(valueFormulaEditor).weight(1)).weight(2) |
|
|
|
new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Display_Value"), MAX_WIDTH, UILabel.LEFT), valueFormulaContainer}, |
|
|
|
), |
|
|
|
new Component[]{tag, null} |
|
|
|
cell(tag) |
|
|
|
}; |
|
|
|
).getComponent(); |
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.add(panel, BorderLayout.CENTER); |
|
|
|
this.add(panel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void addChangeListener(DocumentListener l) { |
|
|
|
public void addChangeListener(DocumentListener l) { |
|
|
|