From a9863134a5a8c4848c8f9d151065bfd1ca016217 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 31 Aug 2017 12:17:14 +0800 Subject: [PATCH] REPORT-3348 --- .../com/fr/quickeditor/CellQuickEditor.java | 23 +++++++++++-------- .../cellquick/CellBiasTextPainterEditor.java | 2 +- .../cellquick/CellDSColumnEditor.java | 16 ++++++------- .../cellquick/CellFormulaQuickEditor.java | 2 +- .../cellquick/CellImageQuickEditor.java | 2 +- .../cellquick/CellRichTextEditor.java | 2 +- .../cellquick/CellSubReportEditor.java | 2 +- .../src/com/fr/file/FILEChooserPane.java | 1 - 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/designer/src/com/fr/quickeditor/CellQuickEditor.java b/designer/src/com/fr/quickeditor/CellQuickEditor.java index 6f0530a70..683f17bc7 100644 --- a/designer/src/com/fr/quickeditor/CellQuickEditor.java +++ b/designer/src/com/fr/quickeditor/CellQuickEditor.java @@ -43,6 +43,15 @@ public abstract class CellQuickEditor extends QuickEditor { /*面板配置*/ protected UITextField columnRowTextField; protected TemplateCellElement cellElement; + /*占位label*/ + protected static final Dimension LABEL_DIMENSION = new Dimension(60, 20); + protected static final UILabel EMPTY_LABEL = new UILabel(); + + static { + EMPTY_LABEL.setPreferredSize(LABEL_DIMENSION); + } + + protected static final int VGAP = 10, HGAP = 8, VGAP_INNER = 3; private UIComboBox comboBox; private UpdateAction[] cellInsertActions; private int selectedIndex; @@ -53,12 +62,6 @@ public abstract class CellQuickEditor extends QuickEditor { private int currentSelectedIndex; - static { - emptyLabel.setPreferredSize(new Dimension(60, 20)); - } - - protected static final int VGAP = 10, HGAP = 8, VGAP_INNER = 3; - public CellQuickEditor() { scrollBar = new UIScrollBar(UIScrollBar.VERTICAL) { @@ -117,10 +120,10 @@ public abstract class CellQuickEditor extends QuickEditor { double f = TableLayout.FILL; double[] columnSize = {p, f}; double[] rowSize = {p, p}; - UILabel cellLabel = new UILabel(Inter.getLocText("Cell")); - cellLabel.setPreferredSize(new Dimension(60, 20)); - UILabel insertContentLabel = new UILabel(Inter.getLocText("HF-Insert_Content")); - insertContentLabel.setPreferredSize(new Dimension(60, 20)); + UILabel cellLabel = new UILabel(Inter.getLocText("FR-Designer_Cell")); + cellLabel.setPreferredSize(LABEL_DIMENSION); + UILabel insertContentLabel = new UILabel(Inter.getLocText("FR-Designer_Insert_Cell_Element")); + insertContentLabel.setPreferredSize(LABEL_DIMENSION); UIComboBox cellElementEditComboBox = initCellElementEditComboBox(); Component[][] components = new Component[][]{ new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()}, diff --git a/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java index c17ac8678..d5d8e1f80 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java @@ -35,7 +35,7 @@ public class CellBiasTextPainterEditor extends CellQuickEditor { }); editButton.setOpaque(false); content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{emptyLabel, editButton}}, + new Component[]{EMPTY_LABEL, editButton}}, new double[]{TableLayout.PREFERRED}, new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER); return content; diff --git a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 2c1a30c11..d7c6ddbd4 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -217,7 +217,7 @@ public class CellDSColumnEditor extends CellQuickEditor { double[] rowSize = {P}, columnSize = {P, F}; UILabel uiLabel = new UILabel(Inter.getLocText("FR-Designer_Filter_Conditions")); - uiLabel.setPreferredSize(new Dimension(60, 20)); + uiLabel.setPreferredSize(LABEL_DIMENSION); UIButton uiButton = new UIButton(); if (tc != null) { //第一次初始化时tc为空,会引发NullPointerException @@ -481,14 +481,13 @@ public class CellDSColumnEditor extends CellQuickEditor { multiNumSpinner = new UISpinner(1, 10000, 1, 1); //数据倍数 UILabel multipleLabel = new UILabel(Inter.getLocText("Column_Multiple")); - multipleLabel.setPreferredSize(new Dimension(60, 20)); multiPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ new Component[]{ multipleLabel, multiNumSpinner } }, new double[]{P}, new double[]{P, F}, HGAP, VGAP ); - multiPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); multiNumPane.add(multiPane); useMultiplyNumCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -563,7 +562,7 @@ public class CellDSColumnEditor extends CellQuickEditor { centerPane.add(new JPanel(), "none"); centerPane.add(formulaField, "content"); UILabel sortLabel = new UILabel(Inter.getLocText("Sort-Sort_Order")); - sortLabel.setPreferredSize(new Dimension(60, 20)); + sortLabel.setPreferredSize(LABEL_DIMENSION); sortTypePane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -982,7 +981,7 @@ public class CellDSColumnEditor extends CellQuickEditor { public CustomValuePane() { this.setLayout(new BorderLayout()); UILabel customValueLabel = new UILabel(Inter.getLocText("FR-Designer_Display_Value")); - customValueLabel.setPreferredSize(new Dimension(60, 20)); + customValueLabel.setPreferredSize(LABEL_DIMENSION); formulaField = new JFormulaField(DEFAULT_VALUE); this.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ new Component[]{customValueLabel, formulaField}, @@ -994,14 +993,13 @@ public class CellDSColumnEditor extends CellQuickEditor { Object value = cellElement.getValue(); if (value != null && value instanceof DSColumn) { DSColumn dSColumn = (DSColumn) value; - //formula String valueFormula = dSColumn.getResult(); - if (valueFormula == null) { - valueFormula = DEFAULT_VALUE; + if (valueFormula != null) { + formulaField.populate(valueFormula); } formulaField.populateElement(cellElement); - formulaField.populate(valueFormula); + } } } diff --git a/designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java index fcd16a676..7429b146e 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java @@ -121,7 +121,7 @@ public class CellFormulaQuickEditor extends CellQuickEditor { content.add(pane, BorderLayout.NORTH); return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{emptyLabel, content}}, + new Component[]{EMPTY_LABEL, content}}, new double[]{TableLayout.PREFERRED}, new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP); } diff --git a/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java index 51b7417ac..25818e79f 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java @@ -43,7 +43,7 @@ public class CellImageQuickEditor extends CellQuickEditor { }); editButton.setOpaque(false); content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{emptyLabel, editButton}}, + new Component[]{EMPTY_LABEL, editButton}}, new double[]{TableLayout.PREFERRED}, new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER); return content; diff --git a/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java index 8f8afbeed..75ef442da 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java @@ -30,7 +30,7 @@ public class CellRichTextEditor extends CellQuickEditor { richTextButton = new UIButton(); richTextButton.setOpaque(false); content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{emptyLabel, richTextButton}}, + new Component[]{EMPTY_LABEL, richTextButton}}, new double[]{TableLayout.PREFERRED}, new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER); return content; diff --git a/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java index e28bdbf39..70d8c51ea 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java @@ -31,7 +31,7 @@ public class CellSubReportEditor extends CellQuickEditor { subReportButton = new UIButton(); subReportButton.setOpaque(false); content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{emptyLabel, subReportButton}}, + new Component[]{EMPTY_LABEL, subReportButton}}, new double[]{TableLayout.PREFERRED}, new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER); return content; diff --git a/designer_base/src/com/fr/file/FILEChooserPane.java b/designer_base/src/com/fr/file/FILEChooserPane.java index 02c92f646..09e911421 100644 --- a/designer_base/src/com/fr/file/FILEChooserPane.java +++ b/designer_base/src/com/fr/file/FILEChooserPane.java @@ -475,7 +475,6 @@ public class FILEChooserPane extends BasicPane { this.type = type; this.suffix = suffix; - dialog = showWindow(parent instanceof DesignerFrame ? (Window) parent : SwingUtilities.getWindowAncestor(parent), false); JPanel contentPane = (JPanel) dialog.getContentPane(); contentPane.setLayout(FRGUIPaneFactory.createM_BorderLayout());