From ed51311d80249fea1fe6e928a2f3d71d9950911e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 24 Oct 2024 09:24:29 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-138297=20&=20REPORT-138273=20fix:=20?= =?UTF-8?q?=E6=87=92=E5=8A=A0=E8=BD=BD=E9=9D=A2=E6=9D=BF=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E9=97=AE=E9=A2=98=E7=BB=9F=E4=B8=80=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/SshPane.java | 77 ++++---- .../design/data/datapane/connect/SslPane.java | 74 ++++---- .../fr/design/gui/core/ReactiveCardPane.java | 2 + .../fr/design/gui/core/SimpleCardPane.java | 44 +++++ .../com/fr/design/gui/frpane/RegPane.java | 38 ++-- .../fr/design/gui/style/AlignmentPane.java | 47 ++--- .../dscolumn/ResultSetGroupDockingPane.java | 34 ++-- .../cell/settingpane/CellOtherSetPane.java | 175 +++++++----------- .../cellquick/CellDSColumnEditor.java | 43 ++--- 9 files changed, 270 insertions(+), 264 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/core/SimpleCardPane.java diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java index 1d31b1a5ab..12b173779e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java @@ -1,6 +1,5 @@ package com.fr.design.data.datapane.connect; -import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIUtils; import com.fr.data.impl.JDBCDatabaseConnection; @@ -14,7 +13,7 @@ import com.fr.data.security.ssl.SslUtils; import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.editor.editor.NotNegativeIntegerEditor; -import com.fr.design.gui.core.ReactiveCardPane; +import com.fr.design.gui.core.SimpleCardPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; @@ -28,6 +27,7 @@ import com.fr.file.filter.ChooseFileFilter; import com.fr.stable.StringUtils; import com.fr.third.guava.collect.HashBiMap; +import javax.swing.JPanel; import javax.swing.JPasswordField; import java.awt.BorderLayout; import java.awt.event.KeyAdapter; @@ -35,9 +35,10 @@ import java.awt.event.KeyEvent; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static com.fine.swing.ui.layout.Layouts.row; -import static com.fine.swing.ui.layout.Layouts.flex; import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; import static com.fr.design.i18n.Toolkit.i18nText; /** @@ -62,12 +63,10 @@ public class SshPane extends BasicPane { private final JPasswordField password = new UIPasswordFieldWithFixedLength(20); private final JPasswordField secret = new UIPasswordFieldWithFixedLength(20); private final KeyFileUITextField keyPath = new KeyFileUITextField(18); - private ReactiveCardPane coreCardPane; - private ReactiveCardPane verifyCardPane; + private JPanel sshSettingPane; + private SimpleCardPane verifyCardPane; private final UIButton fileChooserButton = new UIButton(); - private static final String USE_SSH = "useSSH"; - private static final String NOT_USE_SSH = "notUseSSH"; private static final String USE_PASSWORD = "usePassword"; private static final String USE_KEY = "useKey"; @@ -82,13 +81,14 @@ public class SshPane extends BasicPane { type.setSelectedItem(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key")); initVerifyCardPane(); - initCoreCardPane(); + initSshSettingPane(); initListeners(); - this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + this.add(column(LayoutConstants.VERTICAL_GAP, cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Settings"))).with(FineUIUtils::wrapBoldLabelWithUnderline), - cell(coreCardPane) + row(cell(usingSsh)), + cell(sshSettingPane) ).getComponent()); } @@ -112,10 +112,8 @@ public class SshPane extends BasicPane { }); } - private void initCoreCardPane() { - coreCardPane = ReactiveCardPane.create() - .addSupplier(NOT_USE_SSH, () -> cell(usingSsh).getComponent()) - .addSupplier(USE_SSH, () -> Layouts.column(LayoutConstants.VERTICAL_GAP, + private void initSshSettingPane() { + sshSettingPane = column(LayoutConstants.VERTICAL_GAP, row(cell(usingSsh)), row( cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host"))).weight(1), @@ -138,47 +136,46 @@ public class SshPane extends BasicPane { flex(6) ), cell(verifyCardPane) - ).getComponent()); - coreCardPane.select(USE_SSH).populate(); + ).getComponent(); } private void initVerifyCardPane() { - verifyCardPane = ReactiveCardPane.create() - .addSupplier(USE_PASSWORD, () -> Layouts.row( - cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password"))).weight(1), - cell(password).weight(5), + verifyCardPane = new SimpleCardPane(); + verifyCardPane.add(USE_PASSWORD, row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password"))).weight(1), + cell(password).weight(5), + flex(6) + ).getComponent()); + verifyCardPane.add(USE_KEY, column(LayoutConstants.VERTICAL_GAP, + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key"))).weight(1), + cell(keyPath).weight(4.5), + flex(0.1), + cell(fileChooserButton).weight(0.4), flex(6) - ).getComponent()) - .addSupplier(USE_KEY, () -> Layouts.column(LayoutConstants.VERTICAL_GAP, - row( - cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key"))).weight(1), - cell(keyPath).weight(4.5), - flex(0.1), - cell(fileChooserButton).weight(0.4), - flex(6) - ), - row( - cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Secret"))).weight(1), - cell(secret).weight(5), - flex(6) - ) - ).getComponent()); + ), + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Secret"))).weight(1), + cell(secret).weight(5), + flex(6) + ) + ).getComponent()); - verifyCardPane.select(USE_KEY).populate(); + verifyCardPane.show(USE_KEY); } private void changePane() { - coreCardPane.select(usingSsh.isSelected() ? USE_SSH: NOT_USE_SSH).populate(); + sshSettingPane.setVisible(usingSsh.isSelected()); } private void changePaneForType() { switch (typeMap.get(type.getSelectedItem())) { case NORMAL: - verifyCardPane.select(USE_PASSWORD).populate(); + verifyCardPane.show(USE_PASSWORD); break; case KEY: - verifyCardPane.select(USE_KEY).populate(); + verifyCardPane.show(USE_KEY); break; default: throw new SshException("un support ssh type"); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java index 62e6666acd..8fc59ba7a0 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java @@ -1,18 +1,15 @@ package com.fr.design.data.datapane.connect; -import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIUtils; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.security.ssl.Ssl; import com.fr.data.security.ssl.SslException; import com.fr.data.security.ssl.SslType; -import com.fr.data.security.ssl.SslUtils; import com.fr.data.security.ssl.impl.NormalSsl; import com.fr.design.constants.LayoutConstants; import com.fr.design.data.datapane.connect.SshPane.KeyFileUITextField; import com.fr.design.dialog.BasicPane; -import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -23,14 +20,16 @@ import com.fr.file.FILEChooserPane; import com.fr.file.filter.ChooseFileFilter; import com.fr.stable.StringUtils; +import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import static com.fine.swing.ui.layout.Layouts.row; -import static com.fine.swing.ui.layout.Layouts.flex; import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; import static com.fr.design.i18n.Toolkit.i18nText; /** @@ -47,45 +46,44 @@ public class SslPane extends BasicPane { private final KeyFileUITextField keyPathClientKey = new KeyFileUITextField(18); private final UIButton fileChooserButtonClientKey = new UIButton(); private final UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca")); - private final ReactiveCardPane cardPane; + private final JPanel sslSettingPane; public SslPane() { initDotButtons(); this.setLayout(new BorderLayout()); usingSsl.setSelected(true); - cardPane = ReactiveCardPane.create() - .addSupplier("notUseSSL", () -> cell(usingSsl).getComponent()) - .addSupplier("useSSL", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, - cell(usingSsl), - row( - cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Ca"), SwingConstants.LEFT)).weight(1), - cell(keyPathCa).weight(1.3), - flex(0.05), - cell(fileChooserButtonCa).weight(0.15), - flex(2) - ), - cell(verifyCa), - row( - cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Key"), SwingConstants.LEFT)).weight(1), - cell(keyPathClientKey).weight(1.3), - flex(0.05), - cell(fileChooserButtonClientKey).weight(0.15), - flex(2) - ), - row( - cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Cert"), SwingConstants.LEFT)).weight(1), - cell(keyPathClientCert).weight(1.3), - flex(0.05), - cell(fileChooserButtonClientCert).weight(0.15), - flex(2) - ) - ).getComponent() - ); - cardPane.select("useSSL").populate(); - this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, + sslSettingPane = column(10, + cell(usingSsl), + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Ca"), SwingConstants.LEFT)).weight(1), + cell(keyPathCa).weight(1.3), + flex(0.05), + cell(fileChooserButtonCa).weight(0.15), + flex(2) + ), + cell(verifyCa), + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Key"), SwingConstants.LEFT)).weight(1), + cell(keyPathClientKey).weight(1.3), + flex(0.05), + cell(fileChooserButtonClientKey).weight(0.15), + flex(2) + ), + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Cert"), SwingConstants.LEFT)).weight(1), + cell(keyPathClientCert).weight(1.3), + flex(0.05), + cell(fileChooserButtonClientCert).weight(0.15), + flex(2) + ) + ).getComponent(); + + this.add(column(LayoutConstants.VERTICAL_GAP, cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Settings"))).with(FineUIUtils::wrapBoldLabelWithUnderline), - cell(cardPane) + cell(usingSsl), + cell(sslSettingPane) ).getComponent()); + usingSsl.addActionListener(e -> changePane()); } @@ -99,7 +97,7 @@ public class SslPane extends BasicPane { } private void changePane() { - cardPane.select(usingSsl.isSelected() ? "useSSL" : "notUseSSL").populate(); + sslSettingPane.setVisible(usingSsl.isSelected()); } 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 8e2897c2b1..a0d53ae12c 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 @@ -9,11 +9,13 @@ import java.util.function.Supplier; /** * 简单的响应式面板容器,提供切换布局的功能 + *

懒加载无法兼容事件初始化,如需实现类似功能可考虑 {@link SimpleCardPane} * * @author Levy.Xie * @since 11.0 * Created on 2023/12/25 */ +@Deprecated public class ReactiveCardPane extends JPanel { String selectKey; diff --git a/designer-base/src/main/java/com/fr/design/gui/core/SimpleCardPane.java b/designer-base/src/main/java/com/fr/design/gui/core/SimpleCardPane.java new file mode 100644 index 0000000000..269b2234e7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/core/SimpleCardPane.java @@ -0,0 +1,44 @@ +package com.fr.design.gui.core; + +import javax.swing.JPanel; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; + +/** + * 自适应尺寸大小变更的Card面板 + * + * @author Levy.Xie + * @since 11.0 + * Created on 2024/10/22 + */ +public class SimpleCardPane extends JPanel { + + private final CardLayout cardLayout; + + public SimpleCardPane() { + cardLayout = new CardLayout(); + setLayout(cardLayout); + } + + /** + * 显示卡片 + * @param key 卡片名 + */ + public void show(String key) { + setVisible(true); + cardLayout.show(this, key); + } + + @Override + public Dimension getPreferredSize() { + for (Component comp : getComponents()) { + if (comp.isVisible()) { + return comp.getPreferredSize(); + } + } + setVisible(false); + return new Dimension(0, 0); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java index e378100567..6159e01c6d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java @@ -2,20 +2,34 @@ package com.fr.design.gui.frpane; import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; -import com.fr.design.gui.core.ReactiveCardPane; +import com.fr.design.gui.core.SimpleCardPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.form.ui.reg.*; +import com.fr.form.ui.reg.CustomReg; +import com.fr.form.ui.reg.IDCardReg; +import com.fr.form.ui.reg.LengthReg; +import com.fr.form.ui.reg.MailReg; +import com.fr.form.ui.reg.MobileReg; +import com.fr.form.ui.reg.NoneReg; +import com.fr.form.ui.reg.PhoneReg; +import com.fr.form.ui.reg.PostCardReg; +import com.fr.form.ui.reg.RegExp; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.ListCellRenderer; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; import java.awt.event.ItemEvent; import java.util.EventListener; import java.util.EventObject; @@ -86,10 +100,10 @@ public class RegPane extends BasicPane { regPhonePane = new RegPhonePane(); customRegRexPane = new CustomRegRexPane(); - final ReactiveCardPane cardPane = ReactiveCardPane.create() - .addSupplier("Length", () -> regLengthPane) - .addSupplier("Phone", () -> regPhonePane) - .addSupplier("Custom", () -> customRegRexPane); + final SimpleCardPane cardPane = new SimpleCardPane(); + cardPane.add(regLengthPane, "Length"); + cardPane.add(regPhonePane, "Phone"); + cardPane.add(customRegRexPane, "Custom"); cardPane.setVisible(false); corePane.add(comboPane); @@ -97,19 +111,19 @@ public class RegPane extends BasicPane { initComboListener(cardPane); } - private void initComboListener(ReactiveCardPane cardPane) { + private void initComboListener(SimpleCardPane cardPane) { regComboBox.addActionListener(e -> { RegExp regExp = (RegExp)regComboBox.getSelectedItem(); if(regExp instanceof PhoneReg) { Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem(); String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString(); firePhoneRegAction(regString); - cardPane.select("Phone").populate(); + cardPane.show("Phone"); } else { if (regExp instanceof LengthReg){ - cardPane.select("Length").populate(); + cardPane.show("Length"); } else if (regExp instanceof CustomReg){ - cardPane.select("Custom").populate(); + cardPane.show("Custom"); } else { cardPane.setVisible(false); } diff --git a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java index 4ba5c9aa5b..175d642b0d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java @@ -4,7 +4,7 @@ package com.fr.design.gui.style; * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. */ -import com.fine.swing.ui.layout.Layouts; +import com.fine.swing.ui.layout.Row; import com.fine.theme.icon.LazyIcon; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; @@ -15,7 +15,6 @@ import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameObserver; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.IndentationUnitProcessor; -import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; @@ -25,7 +24,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.event.EventDispatcher; import com.fr.general.ComparatorUtils; -import com.fr.general.IOUtils; import com.fr.plugin.ExtraClassManager; import com.fr.plugin.context.PluginContext; import com.fr.plugin.manage.PluginFilter; @@ -46,9 +44,10 @@ import java.util.ArrayList; import java.util.Arrays; 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.flex; +import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.fix; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; /** * Pane to edit cell alignment. @@ -61,7 +60,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO private static final String[] LAYOUT = {Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Default"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Titled"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Extend"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Layout_Image_Adjust")}; - private ReactiveCardPane rotationBarPane; + private JPanel rotationBarPane; private UIComboBox textComboBox; private UIComboBox textRotationComboBox; @@ -91,7 +90,6 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO imageLayoutComboBox = new UIComboBox(LAYOUT); initTextRotationComboBox(); - // todo: 换新图标及反白问题 Icon[][] hAlignmentIconArray = {{new LazyIcon("h_left"), new LazyIcon("h_left").white()}, {new LazyIcon("h_center"), new LazyIcon("h_center").white()}, {new LazyIcon("h_right"), new LazyIcon("h_right").white()}, @@ -177,7 +175,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO private JPanel createPane() { JPanel basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 290, 24, basicPane()); JPanel seniorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Basic_Advanced"), 290, 24, seniorPane()); - return Layouts.column( + return column( cell(basicPane), fix(1).with(it -> it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")))), cell(seniorPane) @@ -189,7 +187,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO UILabel verticalLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical") + " ", SwingConstants.LEFT); UIComponentUtils.setLineWrap(horizontalLabel); UIComponentUtils.setLineWrap(verticalLabel); - return Layouts.column(LayoutConstants.VERTICAL_GAP, + return column(LayoutConstants.VERTICAL_GAP, row( cell(horizontalLabel).weight(1.2), cell(hAlignmentPane).weight(3)), @@ -201,7 +199,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } private JPanel seniorPane() { - return Layouts.column(LayoutConstants.VERTICAL_GAP, + return column(LayoutConstants.VERTICAL_GAP, cell(seniorUpPane()), cell(seniorMiddlePane()), cell(seniorDownPane()) @@ -210,7 +208,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } private JPanel seniorUpPane() { - return Layouts.column(LayoutConstants.VERTICAL_GAP, + return column(LayoutConstants.VERTICAL_GAP, row( cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Image_Layout"), SwingConstants.LEFT)) .with(it -> it.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Image_Layout"))).weight(1.2), @@ -224,28 +222,19 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } private JPanel seniorMiddlePane() { - rotationBarPane = ReactiveCardPane.create() - .addSupplier("hide", () -> Layouts.row( + Row rotationRow = row(flex(1.2),cell(rotationPane).weight(3)).getComponent(); + + rotationBarPane = column(10, + row( cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"), SwingConstants.LEFT)) .with(it -> it.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"))).weight(1.2), cell(textRotationComboBox).weight(3) - ).getComponent()) - .addSupplier("show", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, - row( - cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"), SwingConstants.LEFT)) - .with(it -> it.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"))).weight(1.2), - cell(textRotationComboBox).weight(3) - ), - row( - flex(1.2), - cell(rotationPane).weight(3) - ) - ).getComponent()); - rotationBarPane.select("show").populate(); + ), + cell(rotationRow) + ).getComponent(); textRotationComboBox.addItemListener(e -> { - String key = (textRotationComboBox.getSelectedIndex() == 0) ? "show" : "hide"; - rotationBarPane.select(key).populate(); + rotationRow.setVisible(textRotationComboBox.getSelectedIndex() == 0); }); return rotationBarPane; } @@ -257,7 +246,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO partSpacingLabel.setToolTipText(partSpacingLabel.getText()); UILabel spacingLabel = new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Line_Spacing")), SwingConstants.LEFT); spacingLabel.setToolTipText(spacingLabel.getText()); - return Layouts.column( + return column( row( cell(indentationLabel).weight(1.2), cell(leftIndentSpinner).weight(1.4), 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 f1c6f3d826..bd6de4606b 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 @@ -2,7 +2,7 @@ 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.core.SimpleCardPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.FunctionComboBox; import com.fr.design.gui.icombobox.UIComboBox; @@ -44,7 +44,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { private UIButton advancedButton; private JPanel advancedButtonRow; private FunctionComboBox functionComboBox; - private ReactiveCardPane cardPane; + private SimpleCardPane cardPane; private UIComboBox goBox; private ItemListener listener; @@ -68,11 +68,11 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { goBox.addItemListener(ee -> { int i = goBox.getSelectedIndex(); if (i == BIND_GROUP) { - cardPane.select("groupPane").populate(); + cardPane.show("groupPane"); } else if (i == BIND_SELECTED) { cardPane.setVisible(false); } else if (i == BIND_SUMMARY) { - cardPane.select("summaryPane").populate(); + cardPane.show("summaryPane"); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); cellExpandAttr.setDirection(Constants.NONE); } @@ -93,14 +93,14 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { 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()); + cardPane = new SimpleCardPane(); + cardPane.add("groupPane", column(LayoutConstants.VERTICAL_GAP, + row(flex(1.2), cell(groupComboBox).weight(3)), + cell(advancedButtonRow) + ).getComponent()); + cardPane.add("summaryPane", row( + flex(1.2), cell(functionComboBox).weight(3) + ).getComponent()); } @Override @@ -116,12 +116,12 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { if (recordGrouper instanceof FunctionGrouper) { populateFunctionGrouper(); } else if (recordGrouper instanceof SummaryGrouper) { - cardPane.select("summaryPane").populate(); + cardPane.show("summaryPane"); this.goBox.setSelectedIndex(BIND_SUMMARY); this.functionComboBox.setFunction(((SummaryGrouper) recordGrouper).getFunction()); } else if (recordGrouper instanceof CustomGrouper) { // 自定义分组 or 高级分组 - cardPane.select("groupPane").populate(); + cardPane.show("groupPane"); this.goBox.setSelectedIndex(BIND_GROUP); this.groupComboBox.setSelectedIndex(ADVANCED); } @@ -134,11 +134,11 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { if (!((FunctionGrouper) recordGrouper).isCustom()) { int mode = recordGrouper.getDivideMode(); if (mode == FunctionGrouper.GROUPING_MODE) { - cardPane.select("groupPane").populate(); + cardPane.show("groupPane"); this.goBox.setSelectedIndex(BIND_GROUP); this.groupComboBox.setSelectedIndex(COMMON); } else if (mode == FunctionGrouper.CONTINUUM_MODE) { - cardPane.select("groupPane").populate(); + cardPane.show("groupPane"); this.goBox.setSelectedIndex(BIND_GROUP); this.groupComboBox.setSelectedIndex(CONTINUUM); } else if (mode == FunctionGrouper.LIST_MODE) { @@ -147,7 +147,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { } } else { // 这种情况也放到自定义分组里面 - cardPane.select("groupPane").populate(); + cardPane.show("groupPane"); this.goBox.setSelectedIndex(BIND_GROUP); this.groupComboBox.setSelectedIndex(ADVANCED); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 09e6ee22bb..dad2f6cc93 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.cell.settingpane; import com.fine.swing.ui.layout.Layouts; +import com.fine.swing.ui.layout.Row; import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; @@ -11,7 +12,6 @@ import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.core.ReactiveCardPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -74,14 +74,14 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private UIComboBox showContent; //内容提示 - private ReactiveCardPane showContentPane; + private JPanel showContentPane; private UIButtonGroup tooltipButtonGroup; - private ReactiveCardPane tooltipPane; + private JPanel tooltipPane; private UITextField tooltipTextField; private UITextField fileNameTextField; //文本超出时隐藏 - private ReactiveCardPane overflowPane; + private JPanel overflowPane; private UICheckBox textOverflowCheckBox; private int curSelectedIndex; private UIComboBox showPartComboBox; @@ -112,7 +112,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { // 插入行策略 private UIButtonGroup insertRowPolicyButtonGroup; private ValueEditorPane valueEditor; - private ReactiveCardPane insertRowPolicyPane; + private JPanel insertRowPolicyPane; private UILabel insertRowPolicyLabel; private UIRadioButton exportButton; @@ -220,6 +220,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane { initInsertRowPolicyPane(); return Layouts.column(LayoutConstants.VERTICAL_GAP, cell(seniorUpPane()), + row( + cell(insertRowPolicyLabel).weight(1.2), + cell(insertRowPolicyButtonGroup).weight(3) + ), cell(insertRowPolicyPane) ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, LayoutConstants.VERTICAL_GAP, 0)) ).getComponent(); @@ -236,29 +240,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane { insertRowPolicyLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy", SwingConstants.LEFT)); UIComponentUtils.setLineWrap(insertRowPolicyLabel); - insertRowPolicyPane = ReactiveCardPane.create() - .addSupplier("empty", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, - row( - cell(insertRowPolicyLabel).weight(1.2), - cell(insertRowPolicyButtonGroup).weight(3) - ) - ).getComponent()) - .addSupplier("default", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, - row( - cell(insertRowPolicyLabel).weight(1.2), - cell(insertRowPolicyButtonGroup).weight(3) - ), - row( - flex(1.2), - cell(valueEditor).weight(3) - ) - ).getComponent() - ); - insertRowPolicyPane.select("empty").populate(); + insertRowPolicyPane = row( flex(1.2), cell(valueEditor).weight(3)).getComponent(); + insertRowPolicyPane.setVisible(false); insertRowPolicyButtonGroup.addChangeListener(e -> { - String key = insertRowPolicyButtonGroup.getSelectedIndex() == 1 ? "default" : "empty"; - insertRowPolicyPane.select(key).populate(); + insertRowPolicyPane.setVisible(insertRowPolicyButtonGroup.getSelectedIndex() == 1); }); } @@ -284,32 +270,24 @@ public class CellOtherSetPane extends AbstractCellAttrPane { UILabel showContentLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Content"), SwingConstants.LEFT); UIComponentUtils.setLineWrap(showContentLabel); + Row downloadRow = row( + cell(downloadLabel).weight(1.2), cell(fileNameTextField).weight(3.0) + ).getComponent(); + downloadRow.setVisible(false); + initTooltipPane(); - showContentPane = ReactiveCardPane.create() - .addSupplier("default", () -> column(LayoutConstants.VERTICAL_GAP, - row( - cell(showContentLabel).weight(1.2), cell(showContent).weight(3.0) - ), - cell(tooltipPane) - ).getComponent()) - .addSupplier("download", () -> column(LayoutConstants.VERTICAL_GAP, - row( - cell(showContentLabel).weight(1.2), cell(showContent).weight(3.0) - ), - row( - cell(downloadLabel).weight(1.2), cell(fileNameTextField).weight(3.0) - ), - cell(tooltipPane) - ).getComponent()); - showContentPane.select("default").populate(); + + showContentPane = column(10, + row( + cell(showContentLabel).weight(1.2), cell(showContent).weight(3.0) + ), + cell(downloadRow), + cell(tooltipPane) + ).getComponent(); showContent.addItemListener(e -> { if (e.getStateChange() == ItemEvent.SELECTED) { - if (showContent.getSelectedIndex() == DOWNLOAD_INDEX) { - showContentPane.select("download").populate(); - } else { - showContentPane.select("default").populate(); - } + downloadRow.setVisible(showContent.getSelectedIndex() == DOWNLOAD_INDEX); handleCellShowStyleChange(e); } }); @@ -320,28 +298,19 @@ public class CellOtherSetPane extends AbstractCellAttrPane { tooltipButtonGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Custom"), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_CellValue")}); tooltipTextField = new UITextField(); - tooltipPane = ReactiveCardPane.create() - .addSupplier("define", () -> column(LayoutConstants.VERTICAL_GAP, - row( - cell(toolTipLabel).weight(1.2), cell(tooltipButtonGroup).weight(3.0) - ), - row( - flex(1.2), cell(tooltipTextField).weight(3.0) - ) - ).getComponent()) - .addSupplier("cellValue", () -> column(LayoutConstants.VERTICAL_GAP, - row( - cell(toolTipLabel).weight(1.2), cell(tooltipButtonGroup).weight(3.0) - ) - ).getComponent()); - tooltipPane.select("define").populate(); + Row tooltipTextRow = row( + flex(1.2), cell(tooltipTextField).weight(3.0) + ).getComponent(); + + tooltipPane = column(10, + row( + cell(toolTipLabel).weight(1.2), cell(tooltipButtonGroup).weight(3.0) + ), + cell(tooltipTextRow) + ).getComponent(); tooltipButtonGroup.addChangeListener(e -> { - if (tooltipButtonGroup.getSelectedIndex() == 0) { - tooltipPane.select("define").populate(); - } else { - tooltipPane.select("cellValue").populate(); - } + tooltipTextRow.setVisible(tooltipButtonGroup.getSelectedIndex() == 0); }); } @@ -354,35 +323,40 @@ public class CellOtherSetPane extends AbstractCellAttrPane { UILabel hideTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType")); textOverflowCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); - overflowPane = ReactiveCardPane.create() - .addSupplier("empty", () -> column(LayoutConstants.VERTICAL_GAP, - row(cell(textOverflowCheckBox)) - ).getComponent()) - .addSupplier("showChar", () -> column(LayoutConstants.VERTICAL_GAP, - row(cell(textOverflowCheckBox)), - row(cell(showPartLabel).weight(1.2), cell(showPartComboBox).weight(1.4), flex(0.1), cell(numberLabel).weight(0.5), cell(showCharNums).weight(1.0)), - row(cell(hideTypeLabel).weight(1.2), cell(textOverflowTypeComboBox).weight(3.0)) - ).getComponent()) - .addSupplier("showCell", () -> column(LayoutConstants.VERTICAL_GAP, - row(cell(textOverflowCheckBox)), - row(cell(showPartLabel).weight(1.2), cell(showPartComboBox).weight(3.0)), - row(cell(hideTypeLabel).weight(1.2), cell(textOverflowTypeComboBox).weight(3.0)) - ).getComponent()); - overflowPane.select("empty").populate(); + // 字符长度-数量 + Row numPane = row(flex(0.1), cell(numberLabel).weight(0.5), cell(showCharNums).weight(1.0)).getComponent(); + + // 显示部分 & 隐藏方式 + JPanel overflowPolicyPane = column(10, + row( + cell(showPartLabel).weight(1.2), + row( + cell(showPartComboBox).weight(1.4), + cell(numPane).weight(1.6) + ).weight(3) + ), + row( + cell(hideTypeLabel).weight(1.2), + cell(textOverflowTypeComboBox).weight(3.0) + ) + ).getComponent(); + + overflowPane = column(10, + row(cell(textOverflowCheckBox)), + cell(overflowPolicyPane) + ).getComponent(); + + overflowPolicyPane.setVisible(false); + showPartComboBox.addItemListener(e -> { - if (showPartComboBox.getSelectedIndex() == 0) { - overflowPane.select("showChar").populate(); - } else { - overflowPane.select("showCell").populate(); - } + numPane.setVisible(showPartComboBox.getSelectedIndex() == 0); }); + textOverflowCheckBox.addItemListener(e -> { if (e.getStateChange() == ItemEvent.SELECTED) { - if (showPartComboBox.getSelectedIndex() == 0) { - overflowPane.select("showChar").populate(); - } else { - overflowPane.select("showCell").populate(); - } + overflowPolicyPane.setVisible(true); + numPane.setVisible(showPartComboBox.getSelectedIndex() == 0); + // 记录目前自动调整哪个被选中 for (int i = 0; i < adjustRadioButtons.length; i++) { if (adjustRadioButtons[i].isSelected()) { @@ -392,7 +366,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } noAutoRadioButton.setSelected(true); } else { - overflowPane.select("empty").populate(); + overflowPolicyPane.setVisible(false); adjustRadioButtons[curSelectedIndex].setSelected(true); } }); @@ -557,12 +531,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } else { tooltipButtonGroup.setSelectedIndex(1); } - if (tooltipButtonGroup.getSelectedIndex() == 0) { - tooltipPane.select("define").populate(); - } else { - tooltipPane.select("cellValue").populate(); - } - tooltipPane.setVisible(true); + tooltipPane.setVisible(tooltipButtonGroup.getSelectedIndex() == 0); if (cellGUIAttr.isHideTextWhenOverflow()) { textOverflowCheckBox.setSelected(true); if (cellGUIAttr.isShowCharNum()) { @@ -607,12 +576,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane { insertRowPolicyButtonGroup.setSelectedIndex(0); this.valueEditor.populate(StringUtils.EMPTY); } - String key = insertRowPolicyButtonGroup.getSelectedIndex() == 1 ? "default" : "empty"; - insertRowPolicyPane.select(key).populate(); - insertRowPolicyPane.setVisible(true); + insertRowPolicyPane.setVisible(insertRowPolicyButtonGroup.getSelectedIndex() == 1); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略 - insertRowPolicyPane.select("empty").populate(); + insertRowPolicyPane.setVisible(false); } populateDesensitizationBean(cellElement); } 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 092e536190..add76e0744 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 @@ -20,7 +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.core.SimpleCardPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIHeadGroup; @@ -121,9 +121,9 @@ public class CellDSColumnEditor extends CellQuickEditor { this.createPanes(); this.createSwitchTab(); return Layouts.column(10, - cell(tabsHeaderIconPane), - cell(cardContainer) - ).getComponent(); + cell(tabsHeaderIconPane), + cell(cardContainer) + ).getComponent(); } @Override @@ -268,8 +268,8 @@ public class CellDSColumnEditor extends CellQuickEditor { protected JPanel createContentPane() { initComponents(); return Layouts.column(LayoutConstants.VERTICAL_GAP, - cell(dataPane), cell(groupPane), cell(conditionPane) - ).getComponent(); + cell(dataPane), cell(groupPane), cell(conditionPane) + ).getComponent(); } private void initComponents(){ @@ -589,7 +589,7 @@ public class CellDSColumnEditor extends CellQuickEditor { private JPanel contentPane; private UIComboBox rsComboBox; - private ReactiveCardPane setTipCardPane; + private SimpleCardPane setTipCardPane; private UITextField serialTextField; private JFormulaField topFormulaPane; private JFormulaField bottomFormulaPane; @@ -618,7 +618,7 @@ public class CellDSColumnEditor extends CellQuickEditor { initSetTipCardPane(); contentPane = Layouts.column(LayoutConstants.VERTICAL_GAP, row( - cell(filterLabel).weight(1.2), cell(rsComboBox).weight(3) + cell(filterLabel).weight(1.2), cell(rsComboBox).weight(3) ), cell(setTipCardPane) ).getComponent(); @@ -639,21 +639,15 @@ public class CellDSColumnEditor extends CellQuickEditor { 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 = new SimpleCardPane(); + setTipCardPane.add(TOP.name(), row(flex(1.2), cell(topFormulaPane).weight(3)).getComponent()); + setTipCardPane.add(BOTTOM.name(), row(flex(1.2), cell(bottomFormulaPane).weight(3)).getComponent()); + setTipCardPane.add(ODD.name(), row(flex(1.2), cell(oddTip).weight(3)).getComponent()); + setTipCardPane.add(EVEN.name(), row(flex(1.2), cell(evenTip).weight(3)).getComponent()); + setTipCardPane.add(SPECIFY.name(), column(10, + row(flex(1.2), cell(serialTextField).weight(3)), + row(flex(1.2), cell(specifyTip).weight(3)) + ).getComponent()); // 未定义不显示 setTipCardPane.setVisible(false); } @@ -693,7 +687,8 @@ public class CellDSColumnEditor extends CellQuickEditor { if (type == UNDEFINE) { setTipCardPane.setVisible(false); } else { - setTipCardPane.select(type.name()).populate(); + setTipCardPane.setVisible(true); + setTipCardPane.show(type.name()); } }