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 a0dde0941..2f6056724 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 3f66a6550..4be09ba39 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 f94b4a74e..fb4de3025 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 cd1f5d9a2..e2edc8952 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 98e89738e..881dabb2d 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();