From f5352552c959ff25563a8459e187fd7db524c7d8 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 15 Jan 2019 12:49:53 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-14057=2010.0=E6=97=A5=E6=96=87=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86=3D>48=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=97=E5=B1=9E=E6=80=A7=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/utils/gui/UIComponentUtils.java | 7 +++++ .../dscolumn/ResultSetGroupDockingPane.java | 6 ++-- .../dscolumn/SelectedDataColumnPane.java | 17 ++++++----- .../com/fr/quickeditor/CellQuickEditor.java | 30 +++++++++---------- .../cellquick/CellDSColumnEditor.java | 6 ++-- 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java index a0dde09416..2f60567248 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java @@ -7,6 +7,7 @@ import com.fr.stable.StringUtils; import javax.swing.JComponent; import javax.swing.JPanel; import java.awt.BorderLayout; +import java.awt.Dimension; /** * 包含 UI 组件相关的工具方法 @@ -74,4 +75,10 @@ public class UIComponentUtils { public static JPanel wrapWithBorderLayoutPane(JComponent comp) { return wrapWithBorderLayoutPane(comp, BorderLayout.NORTH); } + + public static void setPreferedWidth(JComponent comp, int width) { + Dimension dim = comp.getPreferredSize(); + dim.setSize(width, dim.getHeight()); + comp.setPreferredSize(dim); + } } diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/ResultSetGroupDockingPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/ResultSetGroupDockingPane.java index 3f66a65502..4be09ba39e 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/ResultSetGroupDockingPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/ResultSetGroupDockingPane.java @@ -9,6 +9,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.core.group.*; @@ -58,9 +59,10 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { double f = TableLayout.FILL; UILabel dataSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Setting")); dataSetLabel.setPreferredSize(new Dimension(60, 20)); + UIComponentUtils.setLineWrap(dataSetLabel); Component[][] components = new Component[][] { - new Component[]{dataSetLabel, goBox}, + new Component[]{dataSetLabel, UIComponentUtils.wrapWithBorderLayoutPane(goBox)}, new Component[]{null, cardPane} }; goBox.addItemListener(new ItemListener() { @@ -85,7 +87,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { } }); - double[] columnSize = {p, f}; + double[] columnSize = {60, f}; double[] rowSize = {p, p}; return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 8, 10); } diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java index f94b4a74e6..fb4de30259 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -19,6 +19,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.general.data.TableDataColumn; import com.fr.report.cell.CellElement; import com.fr.report.cell.TemplateCellElement; @@ -196,16 +197,18 @@ public class SelectedDataColumnPane extends BasicPane { UILabel dsLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_TableData")); UILabel dpLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Dynamic_Parameter")); UILabel dcLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Data_Column")); - dsLabel.setPreferredSize(new Dimension(60, 20)); - dpLabel.setPreferredSize(new Dimension(60, 20)); - dcLabel.setPreferredSize(new Dimension(60, 20)); + UIComponentUtils.setLineWrap(dsLabel); + UIComponentUtils.setLineWrap(dpLabel); + UIComponentUtils.setLineWrap(dcLabel); + double[] rowSize = new double[]{p, p, p}; + double[] colSize = new double[]{60, f}; Component[][] components = { - {dsLabel, tableNameComboBox}, - {dpLabel, paramButton}, - {dcLabel, columnNameComboBox} + {dsLabel, UIComponentUtils.wrapWithBorderLayoutPane(tableNameComboBox)}, + {dpLabel, UIComponentUtils.wrapWithBorderLayoutPane(paramButton)}, + {dcLabel, UIComponentUtils.wrapWithBorderLayoutPane(columnNameComboBox)} }; this.setLayout(new BorderLayout()); - this.add(TableLayoutHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f}, 8, 10)); + this.add(TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, 8, 10)); } diff --git a/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java index cd1f5d9a2d..e2edc89528 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java @@ -17,6 +17,7 @@ import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.ShortCut; import com.fr.design.selection.QuickEditor; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.grid.selection.CellSelection; import com.fr.quickeditor.cellquick.layout.CellElementBarLayout; import com.fr.report.cell.TemplateCellElement; @@ -46,20 +47,9 @@ import java.util.ArrayList; */ public abstract class CellQuickEditor extends QuickEditor { - - /** - * 面板配置 - */ - protected UITextField columnRowTextField; - protected TemplateCellElement cellElement; - /** - * 占位label - */ - protected final Dimension LABEL_DIMENSION = new Dimension(60, 20); - protected final UILabel EMPTY_LABEL = new UILabel(); + protected static final Dimension LABEL_DIMENSION = new Dimension(60, 20); protected static final int VGAP = 10, HGAP = 8, VGAP_INNER = 3; - /** * 滚动条相关配置 */ @@ -70,6 +60,15 @@ public abstract class CellQuickEditor extends QuickEditor { private int maxHeight = 280; private static final int TITLE_HEIGHT = 50; + /** + * 面板配置 + */ + protected UITextField columnRowTextField; + protected TemplateCellElement cellElement; + + // 占位label + protected final UILabel EMPTY_LABEL = new UILabel(); + private UIComboBox comboBox; private UpdateAction[] cellInsertActions; private int selectedIndex; @@ -207,16 +206,15 @@ public abstract class CellQuickEditor extends QuickEditor { private JPanel initTopContent() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] columnSize = {p, f}; + double[] columnSize = {60, f}; double[] rowSize = {p, p}; UILabel cellLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell")); - cellLabel.setPreferredSize(LABEL_DIMENSION); UILabel insertContentLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Insert_Cell_Element")); - insertContentLabel.setPreferredSize(LABEL_DIMENSION); + UIComponentUtils.setLineWrap(insertContentLabel); initCellElementEditComboBox(); Component[][] components = new Component[][]{ new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()}, - new Component[]{insertContentLabel, comboBox}, + new Component[]{insertContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(comboBox)}, }; return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); } diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 98e89738ee..881dabb2d6 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -26,8 +26,8 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.cell.AbstractDSCellEditorPane; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.general.IOUtils; - import com.fr.quickeditor.CellQuickEditor; import com.fr.report.cell.CellElement; import com.fr.report.cell.TemplateCellElement; @@ -252,7 +252,7 @@ public class CellDSColumnEditor extends CellQuickEditor { double[] rowSize = {P}, columnSize = {P, F}; UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Filter_Conditions")); - uiLabel.setPreferredSize(LABEL_DIMENSION); + UIComponentUtils.setLineWrap(uiLabel); condition = new DSColumnConditionAction(); if (tc != null) { condition.setEditingComponent(tc); @@ -262,7 +262,7 @@ public class CellDSColumnEditor extends CellQuickEditor { condition.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); conditionUIButton = new UIButton(condition); Component[][] components = new Component[][]{ - new Component[]{uiLabel, conditionUIButton} + new Component[]{uiLabel, UIComponentUtils.wrapWithBorderLayoutPane(conditionUIButton)} }; conditionPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); this.createScrollPane();