From 93e8f7c81fc4c35a4d75a6dd98101904257234be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Wed, 10 Jan 2024 21:06:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-111995=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=3D>=E6=95=B0=E6=8D=AE=E5=88=97=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=B8=83=E5=B1=80=E9=87=8D=E7=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/core/ReactiveCardPane.java | 1 + .../light/ui/laf/FineLightLaf.properties | 5 +- .../dscolumn/ResultSetGroupDockingPane.java | 133 +++----- .../dscolumn/SelectedDataColumnPane.java | 28 +- .../cell/AbstractDSCellEditorPane.java | 8 + .../design/sort/common/AbstractSortPane.java | 2 +- .../cellquick/CellDSColumnEditor.java | 309 +++++------------- 7 files changed, 156 insertions(+), 330 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/core/ReactiveCardPane.java b/designer-base/src/main/java/com/fr/design/gui/core/ReactiveCardPane.java index 9c05fb461f..8e2897c2b1 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/ReactiveCardPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/ReactiveCardPane.java @@ -65,6 +65,7 @@ public class ReactiveCardPane extends JPanel { } removeAll(); add(cardFactory.get(selectKey).get(), BorderLayout.CENTER); + setVisible(true); revalidate(); repaint(); } diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index d3a8bc0066..a6d558281f 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -223,11 +223,8 @@ CombinationButton.borderColor = $Component.borderColor CombinationButton.arc = $Button.arc #---- CheckBox ---- - -CheckBox.border = com.formdev.flatlaf.ui.FlatMarginBorder -CheckBox.icon = com.formdev.flatlaf.icons.FlatCheckBoxIcon CheckBox.arc = 4 -CheckBox.margin = 2,2,2,2 +CheckBox.margin = 2,0,2,0 CheckBox.iconTextGap = 4 CheckBox.rollover = true 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 3a51af2844..afc76a1a44 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 @@ -1,14 +1,13 @@ package com.fr.design.dscolumn; +import com.fine.swing.ui.layout.Layouts; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.FunctionComboBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -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.design.widget.FRWidgetFactory; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; @@ -21,13 +20,15 @@ import com.fr.stable.Constants; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Component; import java.awt.Dimension; -import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; + /** * 这个pane是选中数据列后,在上方QuickRegion处显示的pane * @@ -39,13 +40,11 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { private static final int BIND_GROUP = 0; private static final int BIND_SELECTED = 1; private static final int BIND_SUMMARY = 2; - private static final int DATA_SET_LABEL_WIDTH = 60; private UIButton advancedButton; + private JPanel advancedButtonRow; private FunctionComboBox functionComboBox; - private JPanel contentPane; - private JPanel cardPane; - private CardLayout cardLayout; + private ReactiveCardPane cardPane; private UIComboBox goBox; private ItemListener listener; @@ -56,70 +55,52 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { } public void initComponents() { - goBox = new UIComboBox(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Group"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Select"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Summary")}); + goBox = new UIComboBox(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Group"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Select"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bind_Column_Summary")}); initCardPane(); - contentPane = layoutPane(); this.setLayout(new BorderLayout()); - this.add(contentPane, BorderLayout.CENTER); + this.add(layoutPane(), BorderLayout.CENTER); } private JPanel layoutPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; UILabel dataSetLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Setting")); - Component[][] components = new Component[][] - { - new Component[]{dataSetLabel, UIComponentUtils.wrapWithBorderLayoutPane(goBox)}, - new Component[]{null, cardPane} - }; - goBox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent ee) { - int i = goBox.getSelectedIndex(); - if (i == BIND_GROUP) { - cardLayout.show(cardPane, "groupPane"); - cardPane.setPreferredSize(new Dimension(158, 20)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 10); - } else if (i == BIND_SELECTED) { - cardLayout.show(cardPane, "listPane"); - cardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); - } else if (i == BIND_SUMMARY) { - cardLayout.show(cardPane, "summaryPane"); - cardPane.setPreferredSize(new Dimension(158, 20)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 10); - CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); - cellExpandAttr.setDirection(Constants.NONE); - } - checkButtonEnabled(); + goBox.addItemListener(ee -> { + int i = goBox.getSelectedIndex(); + if (i == BIND_GROUP) { + cardPane.select("groupPane").populate(); + } else if (i == BIND_SELECTED) { + cardPane.setVisible(false); + } else if (i == BIND_SUMMARY) { + cardPane.select("summaryPane").populate(); + CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); + cellExpandAttr.setDirection(Constants.NONE); } + checkButtonEnabled(); }); - - double[] columnSize = {DATA_SET_LABEL_WIDTH, f}; - double[] rowSize = {p, p}; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 8, 10); + return Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(dataSetLabel).weight(1.2), cell(goBox).weight(3) + ), + cell(cardPane) + ).getComponent(); } private void initCardPane() { - cardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - cardLayout = new CardLayout(); - cardPane.setLayout(cardLayout); - - groupComboBox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - checkButtonEnabled(); - } - }); + groupComboBox.addItemListener(e -> checkButtonEnabled()); advancedButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")); advancedButton.addActionListener(groupAdvancedListener); - - JPanel pane = new JPanel(new BorderLayout(0, 10)); - pane.add(groupComboBox, BorderLayout.NORTH); - pane.add(advancedButton, BorderLayout.CENTER); - cardPane.add(pane, "groupPane"); - - cardPane.add(new JPanel(), "listPane"); - - cardPane.add(functionComboBox = new FunctionComboBox(GUICoreUtils.getFunctionArray()), "summaryPane"); + advancedButtonRow = row(flex(1.2), cell(advancedButton).weight(3)).getComponent(); + functionComboBox = new FunctionComboBox(GUICoreUtils.getFunctionArray()); + + cardPane = ReactiveCardPane.create() + .addSupplier("groupPane", () -> column(LayoutConstants.VERTICAL_GAP, + row(flex(1.2), cell(groupComboBox).weight(3)), + cell(advancedButtonRow) + ).getComponent()) + .addSupplier("summaryPane", () -> row( + flex(1.2), cell(functionComboBox).weight(3) + ).getComponent()); } @Override @@ -135,29 +116,29 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { if (recordGrouper instanceof FunctionGrouper && !((FunctionGrouper) recordGrouper).isCustom()) { int mode = recordGrouper.getDivideMode(); if (mode == FunctionGrouper.GROUPING_MODE) { - cardLayout.show(cardPane, "groupPane"); + cardPane.select("groupPane").populate(); this.goBox.setSelectedIndex(BIND_GROUP); this.groupComboBox.setSelectedIndex(COMMON); } else if (mode == FunctionGrouper.CONTINUUM_MODE) { - cardLayout.show(cardPane, "groupPane"); + cardPane.select("groupPane").populate(); this.goBox.setSelectedIndex(BIND_GROUP); this.groupComboBox.setSelectedIndex(CONTINUUM); } else if (mode == FunctionGrouper.LIST_MODE) { - cardLayout.show(cardPane, "listPane"); + cardPane.setVisible(false); this.goBox.setSelectedIndex(BIND_SELECTED); } } else if (recordGrouper instanceof FunctionGrouper && ((FunctionGrouper) recordGrouper).isCustom()) { // 这种情况也放到自定义分组里面 - cardLayout.show(cardPane, "groupPane"); + cardPane.select("groupPane").populate(); this.goBox.setSelectedIndex(BIND_GROUP); this.groupComboBox.setSelectedIndex(ADVANCED); } else if (recordGrouper instanceof SummaryGrouper) { - cardLayout.show(cardPane, "summaryPane"); + cardPane.select("summaryPane").populate(); this.goBox.setSelectedIndex(BIND_SUMMARY); this.functionComboBox.setFunction(((SummaryGrouper) recordGrouper).getFunction()); } else if (recordGrouper instanceof CustomGrouper) { // 自定义分组 or 高级分组 - cardLayout.show(cardPane, "groupPane"); + cardPane.select("groupPane").populate(); this.goBox.setSelectedIndex(BIND_GROUP); this.groupComboBox.setSelectedIndex(ADVANCED); } @@ -206,21 +187,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { advancedButton.setEnabled(true); } } - if (advancedButton.isEnabled()) { - cardPane.setPreferredSize(new Dimension(158, 50)); - cardPane.revalidate(); - cardPane.repaint(); - return; - } - if (groupComboBox.isEnabled() || functionComboBox.isEnabled()) { - cardPane.setPreferredSize(new Dimension(158, 20)); - cardPane.revalidate(); - cardPane.repaint(); - return; - } - cardPane.setPreferredSize(new Dimension(158, 0)); - cardPane.revalidate(); - cardPane.repaint(); + advancedButtonRow.setVisible(advancedButton.isEnabled()); } 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 052fba9046..969946908d 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 @@ -1,8 +1,10 @@ package com.fr.design.dscolumn; +import com.fine.swing.ui.layout.Layouts; import com.fr.base.Parameter; import com.fr.data.SimpleDSColumn; import com.fr.data.TableDataSource; +import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; @@ -18,7 +20,6 @@ import com.fr.design.layout.TableLayout; 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.design.widget.FRWidgetFactory; import com.fr.general.data.TableDataColumn; import com.fr.report.cell.CellElement; @@ -41,6 +42,9 @@ import java.util.List; import java.util.Objects; import java.util.regex.Pattern; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 数据集列动态参数设置组件 * @@ -192,20 +196,21 @@ public class SelectedDataColumnPane extends BasicPane { } }; columnNameComboBox.setEditable(true); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; UILabel dsLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_TableData")); UILabel dpLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Dynamic_Parameter")); UILabel dcLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Data_Column")); - double[] rowSize = new double[]{p, p, p}; - double[] colSize = new double[]{60, f}; - Component[][] components = { - {dsLabel, UIComponentUtils.wrapWithBorderLayoutPane(tableNameComboBox)}, - {dpLabel, UIComponentUtils.wrapWithBorderLayoutPane(paramButton)}, - {dcLabel, UIComponentUtils.wrapWithBorderLayoutPane(columnNameComboBox)} - }; this.setLayout(new BorderLayout()); - this.add(TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, 8, 10)); + this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(dsLabel).weight(1.2), cell(tableNameComboBox).weight(3) + ), + row( + cell(dpLabel).weight(1.2), cell(paramButton).weight(3) + ), + row( + cell(dcLabel).weight(1.2), cell(columnNameComboBox).weight(3) + ) + ).getComponent()); } @@ -331,7 +336,6 @@ public class SelectedDataColumnPane extends BasicPane { protected void initTableNameComboBox() { tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); - tableNameComboBox.setPreferredSize(new Dimension(100, 20)); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java index dd7d3608c8..530d6b70fa 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java @@ -3,6 +3,8 @@ package com.fr.design.mainframe.cell; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.AbstractAttrPane; +import java.awt.BorderLayout; + /** * 右侧单元格元素面板抽象类 * @@ -24,6 +26,12 @@ public abstract class AbstractDSCellEditorPane extends AbstractAttrPane { */ public abstract void populate(); + protected void initContentPane() { + leftContentPane = createContentPane(); + if (leftContentPane != null) { + this.add(leftContentPane, BorderLayout.CENTER); + } + } /** * 释放tc diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java index df56f188c5..db93fda4de 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/AbstractSortPane.java @@ -4,7 +4,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.sort.header.SortHeaderPane; import com.fr.report.cell.TemplateCellElement; import com.fr.report.core.sort.common.CellSortAttr; -import com.fr.report.core.sort.sortexpression.CellSortExpression; import com.fr.report.core.sort.sortexpression.SortExpression; import com.fr.report.core.sort.header.SortHeader; import com.fr.stable.ColumnRow; @@ -33,6 +32,7 @@ public abstract class AbstractSortPane extends JPanel { public AbstractSortPane(int sortPaneWidth, int sortPaneRightWidth) { this.sortPaneWidth = sortPaneWidth; this.sortPaneRightWidth = sortPaneRightWidth; + this.setLayout(new BorderLayout()); initComponents(); } 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 c8f813a4e7..092e536190 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 @@ -1,6 +1,9 @@ package com.fr.quickeditor.cellquick; import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; import com.fr.design.actions.columnrow.DSColumnConditionAction; import com.fr.design.actions.core.ActionFactory; @@ -17,6 +20,7 @@ import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.formula.CustomVariableResolver; import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.UIFormula; +import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIHeadGroup; @@ -28,13 +32,9 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; 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.sort.celldscolumn.CellDSColumnSortPane; -import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; -import com.fr.general.IOUtils; import com.fr.grid.selection.CellSelection; import com.fr.quickeditor.CellQuickEditor; import com.fr.report.cell.CellElement; @@ -45,15 +45,12 @@ import com.fr.report.cell.cellattr.core.group.FilterTypeEnum; import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -63,6 +60,9 @@ import java.util.Arrays; import java.util.Set; import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.EVEN; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.ODD; @@ -79,9 +79,6 @@ import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.UNDEFINE; * @since 9.0 */ public class CellDSColumnEditor extends CellQuickEditor { - private static final double P = TableLayout.PREFERRED, F = TableLayout.FILL; - private static final Color TIP_FONT_COLOR = new Color(0x7F333334, true); - /** * 基本和高级设置 @@ -275,13 +272,6 @@ public class CellDSColumnEditor extends CellQuickEditor { ).getComponent(); } - protected void initContentPane() { - leftContentPane = createContentPane(); - if (leftContentPane != null) { - this.add(leftContentPane, BorderLayout.CENTER); - } - } - private void initComponents(){ dataPane = new SelectedDataColumnPane(true, true); groupPane = new ResultSetGroupDockingPane(); @@ -295,7 +285,7 @@ public class CellDSColumnEditor extends CellQuickEditor { condition.setSmallIcon(UIConstants.EMPTY_ICON); condition.setName(Toolkit.i18nText("Fine-Design_Basic_Edit")); conditionUIButton = new UIButton(condition); - conditionPane = Layouts.row(cell(uiLabel).weight(1.2),cell(conditionUIButton).weight(3)).getComponent(); + conditionPane = row(cell(uiLabel).weight(1.2),cell(conditionUIButton).weight(3)).getComponent(); } private void initListener() { @@ -411,10 +401,8 @@ public class CellDSColumnEditor extends CellQuickEditor { public DSColumnAdvancedEditorPane() { - this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); } - @Override public String getIconPath() { return Toolkit.i18nText("Fine-Design_Report_Advanced"); @@ -425,8 +413,6 @@ public class CellDSColumnEditor extends CellQuickEditor { return Toolkit.i18nText("Fine-Design_Report_Advanced"); } - - @Override public void update() { if (cellElement != null) { @@ -548,49 +534,33 @@ public class CellDSColumnEditor extends CellQuickEditor { */ @Override protected JPanel createContentPane() { - JPanel contentPane = new JPanel(new BorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel contentPane = new JPanel(new BorderLayout()); //结果筛选 filterPane = new ResultSetFilterConfigPane(); - //自定义值显示 valuePane = new CustomValuePane(); - - //可扩展性 - JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); - extendableDirectionPane.add(heCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Horizontal_Extendable"))); - extendableDirectionPane.add(veCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Vertical_Extendable"))); - //补充空白数据 - JPanel multiNumPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); useMultiNumCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Fill_Blank_Data")); - JPanel checkBoxPane = new JPanel(new BorderLayout()); - checkBoxPane.add(useMultiNumCheckBox, BorderLayout.WEST); - multiNumPane.add(checkBoxPane); multiNumSpinner = new UISpinner(1, 10000, 1, 1); - //数据倍数 UILabel multipleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Column_Multiple")); - multiPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{ - multipleLabel, multiNumSpinner - } - }, new double[]{P}, new double[]{P, F}, HGAP, VGAP - ); - multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - multiNumPane.add(multiPane); - - Component[][] components = new Component[][]{ - {filterPane}, - {valuePane}, - {extendableDirectionPane}, - {multiNumPane} - }; - - double[] rowSize = new double[components.length]; - Arrays.fill(rowSize, P); - double[] columnSize = {F}; - JPanel advancePropertyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); + multiPane = Layouts.row( + cell(multipleLabel).weight(1.2), cell(multiNumSpinner).weight(3) + ).getComponent(); + JPanel multiNumPane = Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(useMultiNumCheckBox), + cell(multiPane) + ).getComponent(); + + // 核心面板 + JPanel advancePropertyPane = Layouts.column(LayoutConstants.VERTICAL_GAP, + cell(filterPane), + cell(valuePane), + cell(heCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Horizontal_Extendable"))), + cell(veCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_ExpandD_Vertical_Extendable"))), + cell(multiNumPane) + ).getComponent(); contentPane.add(advancePropertyPane, BorderLayout.NORTH); UIExpandablePane sortUIExpandablePane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Sort_Data_Column_Sort"), @@ -619,8 +589,7 @@ public class CellDSColumnEditor extends CellQuickEditor { private JPanel contentPane; private UIComboBox rsComboBox; - private JPanel setCardPane; - private JPanel tipCardPane; + private ReactiveCardPane setTipCardPane; private UITextField serialTextField; private JFormulaField topFormulaPane; private JFormulaField bottomFormulaPane; @@ -629,63 +598,7 @@ public class CellDSColumnEditor extends CellQuickEditor { @Override public void actionPerformed(ActionEvent evt) { int selectIndex = rsComboBox.getSelectedIndex(); - CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout(); - CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout(); - if (selectIndex == TOP.getValue()) { - //前N个 - setCardPaneLayout.show(setCardPane, TOP.name()); - tipCardPaneLayout.show(tipCardPane, TOP.name()); - //隐藏tip 显示set - setCardPane.setPreferredSize(new Dimension(156, 20)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); - tipCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); - } else if (selectIndex == BOTTOM.getValue()) { - //后N个 - setCardPaneLayout.show(setCardPane, BOTTOM.name()); - tipCardPaneLayout.show(tipCardPane, BOTTOM.name()); - //隐藏tip 显示set - setCardPane.setPreferredSize(new Dimension(156, 20)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); - tipCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); - } else if (selectIndex == ODD.getValue()) { - //奇数 - setCardPaneLayout.show(setCardPane, ODD.name()); - tipCardPaneLayout.show(tipCardPane, ODD.name()); - //隐藏set 显示tip - setCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); - tipCardPane.setPreferredSize(new Dimension(224, 40)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); - } else if (selectIndex == EVEN.getValue()) { - //偶数 - setCardPaneLayout.show(setCardPane, EVEN.name()); - tipCardPaneLayout.show(tipCardPane, EVEN.name()); - //隐藏set 显示tip - setCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); - tipCardPane.setPreferredSize(new Dimension(224, 40)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); - } else if (selectIndex == SPECIFY.getValue()) { - //指定 - setCardPaneLayout.show(setCardPane, SPECIFY.name()); - tipCardPaneLayout.show(tipCardPane, SPECIFY.name()); - //显示set和tip - setCardPane.setPreferredSize(new Dimension(156, 20)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); - tipCardPane.setPreferredSize(new Dimension(224, 50)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); - } else { - //未定义 - setCardPaneLayout.show(setCardPane, UNDEFINE.name()); - tipCardPaneLayout.show(tipCardPane, UNDEFINE.name()); - //隐藏set和tip - setCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); - tipCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); - } + changeSetTipCardPane(selectIndex); } }; @@ -702,50 +615,47 @@ public class CellDSColumnEditor extends CellQuickEditor { Toolkit.i18nText("Fine-Design_Report_Specify") }); rsComboBox.addActionListener(actionListener); - //配置展示CardLayout - setCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - //提示信息展示CardLayout - tipCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); + initSetTipCardPane(); + contentPane = Layouts.column(LayoutConstants.VERTICAL_GAP, + row( + cell(filterLabel).weight(1.2), cell(rsComboBox).weight(3) + ), + cell(setTipCardPane) + ).getComponent(); + this.add(contentPane, BorderLayout.CENTER); + } + private void initSetTipCardPane() { //前N个 topFormulaPane = new JFormulaField(DEFAULT_VALUE); - setCardPane.add(topFormulaPane, TOP.name()); - tipCardPane.add(new JPanel(), TOP.name()); - //后N个 bottomFormulaPane = new JFormulaField(DEFAULT_VALUE); - setCardPane.add(bottomFormulaPane, BOTTOM.name()); - tipCardPane.add(new JPanel(), BOTTOM.name()); - - //自定义值下方没有提示信息,也没有输入框 - setCardPane.add(new JPanel(), UNDEFINE.name()); - tipCardPane.add(new JPanel(), UNDEFINE.name()); + //自定义 + serialTextField = new UITextField(16); - //奇数 UILabel 占一行作为提示信息 - setCardPane.add(new JPanel(), ODD.name()); MultilineLabel oddTip = new MultilineLabel(Toolkit.i18nText("Fine-Design_Report_DS_Filter_Odd_Tip")); - oddTip.setForeground(TIP_FONT_COLOR); - tipCardPane.add(oddTip, ODD.name()); - - //偶数 UILabel 占一行作为提示信息 - setCardPane.add(new JPanel(), EVEN.name()); MultilineLabel evenTip = new MultilineLabel(Toolkit.i18nText("Fine-Design_Report_DS_Filter_Even_Tip")); - evenTip.setForeground(TIP_FONT_COLOR); - tipCardPane.add(evenTip, EVEN.name()); - - //输入框占用右半边,提示信息占一行 - serialTextField = new UITextField(16); - setCardPane.add(serialTextField, SPECIFY.name()); MultilineLabel specifyTip = new MultilineLabel(Toolkit.i18nText("Fine-Design_Report_DS_Filter_Specify_Tip")); - specifyTip.setForeground(TIP_FONT_COLOR); - tipCardPane.add(specifyTip, SPECIFY.name()); - contentPane = TableLayoutHelper.createDiffVGapTableLayoutPane(new Component[][]{ - {filterLabel, rsComboBox}, - {null, setCardPane}, - {tipCardPane, null} - }, new double[]{P, P, P}, new double[]{P, F}, HGAP, new double[]{VGAP, VGAP_INNER}); - - this.add(contentPane, BorderLayout.CENTER); + Color tipColor = FlatUIUtils.getUIColor("Label.tipColor", Color.GRAY); + Arrays.asList(oddTip, evenTip, specifyTip).forEach(it -> it.setForeground(tipColor)); + + setTipCardPane = ReactiveCardPane.create() + .addSupplier(TOP.name(), () -> row(flex(1.2), cell(topFormulaPane).weight(3)).getComponent()) + .addSupplier(BOTTOM.name(), () -> row(flex(1.2), cell(bottomFormulaPane).weight(3)).getComponent()) + .addSupplier(ODD.name(), () -> row( + flex(1.2), + cell(oddTip).weight(3) + ).getComponent()) + .addSupplier(EVEN.name(), () -> row( + flex(1.2), + cell(evenTip).weight(3) + ).getComponent()) + .addSupplier(SPECIFY.name(), () -> column(LayoutConstants.VERTICAL_GAP, + row(flex(1.2), cell(serialTextField).weight(3)), + row(flex(1.2), cell(specifyTip).weight(3)) + ).getComponent()); + // 未定义不显示 + setTipCardPane.setVisible(false); } public void populate(CellElement cellElement) { @@ -757,8 +667,6 @@ public class CellDSColumnEditor extends CellQuickEditor { SelectCount selectCount = dSColumn.getSelectCount(); this.topFormulaPane.populateElement(cellElement); this.bottomFormulaPane.populateElement(cellElement); - CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout(); - CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout(); // 重置默认值 this.topFormulaPane.populate(DEFAULT_VALUE); this.bottomFormulaPane.populate(DEFAULT_VALUE); @@ -767,86 +675,28 @@ public class CellDSColumnEditor extends CellQuickEditor { if (selectCount != null) { int selectCountType = selectCount.getType(); this.rsComboBox.setSelectedIndex(selectCountType); - switch (FilterTypeEnum.getFilterByValue(selectCountType)) { - case TOP: - this.topFormulaPane.populate(selectCount.getFormulaCount()); - //前N个 - setCardPaneLayout.show(setCardPane, TOP.name()); - tipCardPaneLayout.show(tipCardPane, TOP.name()); - //隐藏tip 显示set - setCardPane.setPreferredSize(new Dimension(156, 20)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); - tipCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); - break; - case BOTTOM: - this.bottomFormulaPane.populate(selectCount.getFormulaCount()); - //后N个 - setCardPaneLayout.show(setCardPane, BOTTOM.name()); - tipCardPaneLayout.show(tipCardPane, BOTTOM.name()); - //隐藏tip 显示set - setCardPane.setPreferredSize(new Dimension(156, 20)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); - tipCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); - break; - case SPECIFY: - this.serialTextField.setText(selectCount.getSerial()); - //指定 - setCardPaneLayout.show(setCardPane, SPECIFY.name()); - tipCardPaneLayout.show(tipCardPane, SPECIFY.name()); - //显示set和tip - setCardPane.setPreferredSize(new Dimension(156, 20)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); - tipCardPane.setPreferredSize(new Dimension(224, 50)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); - break; - case EVEN: - //偶数 - setCardPaneLayout.show(setCardPane, EVEN.name()); - tipCardPaneLayout.show(tipCardPane, EVEN.name()); - //隐藏set 显示tip - setCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); - tipCardPane.setPreferredSize(new Dimension(224, 40)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); - break; - case ODD: - //奇数 - setCardPaneLayout.show(setCardPane, ODD.name()); - tipCardPaneLayout.show(tipCardPane, ODD.name()); - //隐藏set 显示tip - setCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); - tipCardPane.setPreferredSize(new Dimension(224, 40)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); - break; - default: - //未定义 - setCardPaneLayout.show(setCardPane, UNDEFINE.name()); - tipCardPaneLayout.show(tipCardPane, UNDEFINE.name()); - //隐藏set和tip - setCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); - tipCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); - } + this.topFormulaPane.populate(selectCount.getFormulaCount()); + this.bottomFormulaPane.populate(selectCount.getFormulaCount()); + this.serialTextField.setText(selectCount.getSerial()); + changeSetTipCardPane(selectCountType); } else { this.rsComboBox.setSelectedIndex(0); - //未定义 - setCardPaneLayout.show(setCardPane, UNDEFINE.name()); - tipCardPaneLayout.show(tipCardPane, UNDEFINE.name()); - //隐藏set和tip - setCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0); - tipCardPane.setPreferredSize(new Dimension(0, 0)); - TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); + setTipCardPane.setVisible(false); } } } rsComboBox.addActionListener(actionListener); } + private void changeSetTipCardPane(int index) { + FilterTypeEnum type = FilterTypeEnum.getFilterByValue(index); + if (type == UNDEFINE) { + setTipCardPane.setVisible(false); + } else { + setTipCardPane.select(type.name()).populate(); + } + } + public void update(CellElement cellElement) { if (cellElement != null) { Object value = cellElement.getValue(); @@ -912,10 +762,9 @@ public class CellDSColumnEditor extends CellQuickEditor { formulaTextField.setText(defaultValue); JPanel textFieldPane = new JPanel(new BorderLayout()); textFieldPane.add(formulaTextField, BorderLayout.CENTER); - textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); + textFieldPane.setBorder(new ScaledEmptyBorder(0, 0, 0, 5)); + UIButton formulaButton = new UIButton(new LazyIcon("formula")); formulaButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Formula") + "..."); - formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height)); formulaButton.addActionListener(formulaButtonActionListener); JPanel pane = new JPanel(new BorderLayout()); @@ -1000,11 +849,11 @@ public class CellDSColumnEditor extends CellQuickEditor { public CustomValuePane() { this.setLayout(new BorderLayout()); UILabel customValueLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Display_Value")); - customValueLabel.setPreferredSize(LABEL_DIMENSION); formulaField = new JFormulaField(DEFAULT_VALUE); - this.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{customValueLabel, formulaField}, - }, new double[]{P}, new double[]{P, F}, HGAP, VGAP), BorderLayout.CENTER); + this.add(Layouts.row( + cell(customValueLabel).weight(1.2), + cell(formulaField).weight(3) + ).getComponent()); } public void populate(CellElement cellElement) { From 8046a7668fe57143b262c7562754a1108635a001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Wed, 10 Jan 2024 21:14:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-111995=20=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/server/PlatformManagerAction.java | 2 ++ .../dscolumn/ResultSetGroupDockingPane.java | 34 +++++++++++-------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java index d1e2f6f52d..18a73cbbe9 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java @@ -1,9 +1,11 @@ package com.fr.design.actions.server; +import com.fine.theme.icon.LazyIcon; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.DesignUtils; +import javax.swing.KeyStroke; import java.awt.event.ActionEvent; public class PlatformManagerAction extends UpdateAction { 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 afc76a1a44..f1c6f3d826 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 @@ -113,7 +113,25 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { } DSColumn dSColumn = (DSColumn) cellElement.getValue(); recordGrouper = dSColumn.getGrouper(); - if (recordGrouper instanceof FunctionGrouper && !((FunctionGrouper) recordGrouper).isCustom()) { + if (recordGrouper instanceof FunctionGrouper) { + populateFunctionGrouper(); + } else if (recordGrouper instanceof SummaryGrouper) { + cardPane.select("summaryPane").populate(); + this.goBox.setSelectedIndex(BIND_SUMMARY); + this.functionComboBox.setFunction(((SummaryGrouper) recordGrouper).getFunction()); + } else if (recordGrouper instanceof CustomGrouper) { + // 自定义分组 or 高级分组 + cardPane.select("groupPane").populate(); + this.goBox.setSelectedIndex(BIND_GROUP); + this.groupComboBox.setSelectedIndex(ADVANCED); + } + checkButtonEnabled(); + //加上面板组件的交互事件监听 + this.addListener(); + } + + private void populateFunctionGrouper() { + if (!((FunctionGrouper) recordGrouper).isCustom()) { int mode = recordGrouper.getDivideMode(); if (mode == FunctionGrouper.GROUPING_MODE) { cardPane.select("groupPane").populate(); @@ -127,24 +145,12 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { cardPane.setVisible(false); this.goBox.setSelectedIndex(BIND_SELECTED); } - } else if (recordGrouper instanceof FunctionGrouper && ((FunctionGrouper) recordGrouper).isCustom()) { + } else { // 这种情况也放到自定义分组里面 cardPane.select("groupPane").populate(); this.goBox.setSelectedIndex(BIND_GROUP); this.groupComboBox.setSelectedIndex(ADVANCED); - } else if (recordGrouper instanceof SummaryGrouper) { - cardPane.select("summaryPane").populate(); - this.goBox.setSelectedIndex(BIND_SUMMARY); - this.functionComboBox.setFunction(((SummaryGrouper) recordGrouper).getFunction()); - } else if (recordGrouper instanceof CustomGrouper) { - // 自定义分组 or 高级分组 - cardPane.select("groupPane").populate(); - this.goBox.setSelectedIndex(BIND_GROUP); - this.groupComboBox.setSelectedIndex(ADVANCED); } - checkButtonEnabled(); - //加上面板组件的交互事件监听 - this.addListener(); } @Override