Browse Source

Pull request #15175: REPORT-138297 & REPORT-138273 fix: 懒加载面板保存事件问题统一修复

Merge in DESIGN/design from ~LEVY.XIE/design:fbp/master to fbp/master

* commit 'ed51311d80249fea1fe6e928a2f3d71d9950911e':
  REPORT-138297 & REPORT-138273 fix: 懒加载面板保存事件问题统一修复
fbp/master
Levy.Xie-解安森 4 months ago
parent
commit
497fba7f41
  1. 77
      designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java
  2. 74
      designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java
  3. 2
      designer-base/src/main/java/com/fr/design/gui/core/ReactiveCardPane.java
  4. 44
      designer-base/src/main/java/com/fr/design/gui/core/SimpleCardPane.java
  5. 38
      designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java
  6. 47
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  7. 34
      designer-realize/src/main/java/com/fr/design/dscolumn/ResultSetGroupDockingPane.java
  8. 175
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  9. 43
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

77
designer-base/src/main/java/com/fr/design/data/datapane/connect/SshPane.java

@ -1,6 +1,5 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.fr.data.impl.JDBCDatabaseConnection; 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.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.NotNegativeIntegerEditor; 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.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; 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.stable.StringUtils;
import com.fr.third.guava.collect.HashBiMap; import com.fr.third.guava.collect.HashBiMap;
import javax.swing.JPanel;
import javax.swing.JPasswordField; import javax.swing.JPasswordField;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -35,9 +35,10 @@ import java.awt.event.KeyEvent;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; 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.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; 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 password = new UIPasswordFieldWithFixedLength(20);
private final JPasswordField secret = new UIPasswordFieldWithFixedLength(20); private final JPasswordField secret = new UIPasswordFieldWithFixedLength(20);
private final KeyFileUITextField keyPath = new KeyFileUITextField(18); private final KeyFileUITextField keyPath = new KeyFileUITextField(18);
private ReactiveCardPane coreCardPane; private JPanel sshSettingPane;
private ReactiveCardPane verifyCardPane; private SimpleCardPane verifyCardPane;
private final UIButton fileChooserButton = new UIButton(); 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_PASSWORD = "usePassword";
private static final String USE_KEY = "useKey"; 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")); type.setSelectedItem(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key"));
initVerifyCardPane(); initVerifyCardPane();
initCoreCardPane(); initSshSettingPane();
initListeners(); 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(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Settings"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
cell(coreCardPane) row(cell(usingSsh)),
cell(sshSettingPane)
).getComponent()); ).getComponent());
} }
@ -112,10 +112,8 @@ public class SshPane extends BasicPane {
}); });
} }
private void initCoreCardPane() { private void initSshSettingPane() {
coreCardPane = ReactiveCardPane.create() sshSettingPane = column(LayoutConstants.VERTICAL_GAP,
.addSupplier(NOT_USE_SSH, () -> cell(usingSsh).getComponent())
.addSupplier(USE_SSH, () -> Layouts.column(LayoutConstants.VERTICAL_GAP,
row(cell(usingSsh)), row(cell(usingSsh)),
row( row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host"))).weight(1), cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host"))).weight(1),
@ -138,47 +136,46 @@ public class SshPane extends BasicPane {
flex(6) flex(6)
), ),
cell(verifyCardPane) cell(verifyCardPane)
).getComponent()); ).getComponent();
coreCardPane.select(USE_SSH).populate();
} }
private void initVerifyCardPane() { private void initVerifyCardPane() {
verifyCardPane = ReactiveCardPane.create() verifyCardPane = new SimpleCardPane();
.addSupplier(USE_PASSWORD, () -> Layouts.row( verifyCardPane.add(USE_PASSWORD, row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password"))).weight(1), cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password"))).weight(1),
cell(password).weight(5), 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) flex(6)
).getComponent()) ),
.addSupplier(USE_KEY, () -> Layouts.column(LayoutConstants.VERTICAL_GAP, row(
row( cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Secret"))).weight(1),
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssh_Private_Key"))).weight(1), cell(secret).weight(5),
cell(keyPath).weight(4.5), flex(6)
flex(0.1), )
cell(fileChooserButton).weight(0.4), ).getComponent());
flex(6)
),
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() { private void changePane() {
coreCardPane.select(usingSsh.isSelected() ? USE_SSH: NOT_USE_SSH).populate(); sshSettingPane.setVisible(usingSsh.isSelected());
} }
private void changePaneForType() { private void changePaneForType() {
switch (typeMap.get(type.getSelectedItem())) { switch (typeMap.get(type.getSelectedItem())) {
case NORMAL: case NORMAL:
verifyCardPane.select(USE_PASSWORD).populate(); verifyCardPane.show(USE_PASSWORD);
break; break;
case KEY: case KEY:
verifyCardPane.select(USE_KEY).populate(); verifyCardPane.show(USE_KEY);
break; break;
default: default:
throw new SshException("un support ssh type"); throw new SshException("un support ssh type");

74
designer-base/src/main/java/com/fr/design/data/datapane/connect/SslPane.java

@ -1,18 +1,15 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fine.swing.ui.layout.Layouts;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.security.ssl.Ssl; import com.fr.data.security.ssl.Ssl;
import com.fr.data.security.ssl.SslException; import com.fr.data.security.ssl.SslException;
import com.fr.data.security.ssl.SslType; 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.data.security.ssl.impl.NormalSsl;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.data.datapane.connect.SshPane.KeyFileUITextField; import com.fr.design.data.datapane.connect.SshPane.KeyFileUITextField;
import com.fr.design.dialog.BasicPane; 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.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; 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.file.filter.ChooseFileFilter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; 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.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; 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 KeyFileUITextField keyPathClientKey = new KeyFileUITextField(18);
private final UIButton fileChooserButtonClientKey = new UIButton(); private final UIButton fileChooserButtonClientKey = new UIButton();
private final UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca")); private final UICheckBox verifyCa = new UICheckBox(i18nText("Fine-Design_Basic_Ssl_Verify_Ca"));
private final ReactiveCardPane cardPane; private final JPanel sslSettingPane;
public SslPane() { public SslPane() {
initDotButtons(); initDotButtons();
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
usingSsl.setSelected(true); usingSsl.setSelected(true);
cardPane = ReactiveCardPane.create() sslSettingPane = column(10,
.addSupplier("notUseSSL", () -> cell(usingSsl).getComponent()) cell(usingSsl),
.addSupplier("useSSL", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, row(
cell(usingSsl), cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Ca"), SwingConstants.LEFT)).weight(1),
row( cell(keyPathCa).weight(1.3),
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Ca"), SwingConstants.LEFT)).weight(1), flex(0.05),
cell(keyPathCa).weight(1.3), cell(fileChooserButtonCa).weight(0.15),
flex(0.05), flex(2)
cell(fileChooserButtonCa).weight(0.15), ),
flex(2) cell(verifyCa),
), row(
cell(verifyCa), cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Key"), SwingConstants.LEFT)).weight(1),
row( cell(keyPathClientKey).weight(1.3),
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Key"), SwingConstants.LEFT)).weight(1), flex(0.05),
cell(keyPathClientKey).weight(1.3), cell(fileChooserButtonClientKey).weight(0.15),
flex(0.05), flex(2)
cell(fileChooserButtonClientKey).weight(0.15), ),
flex(2) row(
), cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Cert"), SwingConstants.LEFT)).weight(1),
row( cell(keyPathClientCert).weight(1.3),
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Client_Cert"), SwingConstants.LEFT)).weight(1), flex(0.05),
cell(keyPathClientCert).weight(1.3), cell(fileChooserButtonClientCert).weight(0.15),
flex(0.05), flex(2)
cell(fileChooserButtonClientCert).weight(0.15), )
flex(2) ).getComponent();
)
).getComponent() this.add(column(LayoutConstants.VERTICAL_GAP,
);
cardPane.select("useSSL").populate();
this.add(Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Settings"))).with(FineUIUtils::wrapBoldLabelWithUnderline), cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Ssl_Settings"))).with(FineUIUtils::wrapBoldLabelWithUnderline),
cell(cardPane) cell(usingSsl),
cell(sslSettingPane)
).getComponent()); ).getComponent());
usingSsl.addActionListener(e -> changePane()); usingSsl.addActionListener(e -> changePane());
} }
@ -99,7 +97,7 @@ public class SslPane extends BasicPane {
} }
private void changePane() { private void changePane() {
cardPane.select(usingSsl.isSelected() ? "useSSL" : "notUseSSL").populate(); sslSettingPane.setVisible(usingSsl.isSelected());
} }

2
designer-base/src/main/java/com/fr/design/gui/core/ReactiveCardPane.java

@ -9,11 +9,13 @@ import java.util.function.Supplier;
/** /**
* 简单的响应式面板容器提供切换布局的功能 * 简单的响应式面板容器提供切换布局的功能
* <p> 懒加载无法兼容事件初始化如需实现类似功能可考虑 {@link SimpleCardPane} </>
* *
* @author Levy.Xie * @author Levy.Xie
* @since 11.0 * @since 11.0
* Created on 2023/12/25 * Created on 2023/12/25
*/ */
@Deprecated
public class ReactiveCardPane extends JPanel { public class ReactiveCardPane extends JPanel {
String selectKey; String selectKey;

44
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);
}
}

38
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.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane; 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.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; 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.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.DefaultComboBoxModel;
import java.awt.*; 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.awt.event.ItemEvent;
import java.util.EventListener; import java.util.EventListener;
import java.util.EventObject; import java.util.EventObject;
@ -86,10 +100,10 @@ public class RegPane extends BasicPane {
regPhonePane = new RegPhonePane(); regPhonePane = new RegPhonePane();
customRegRexPane = new CustomRegRexPane(); customRegRexPane = new CustomRegRexPane();
final ReactiveCardPane cardPane = ReactiveCardPane.create() final SimpleCardPane cardPane = new SimpleCardPane();
.addSupplier("Length", () -> regLengthPane) cardPane.add(regLengthPane, "Length");
.addSupplier("Phone", () -> regPhonePane) cardPane.add(regPhonePane, "Phone");
.addSupplier("Custom", () -> customRegRexPane); cardPane.add(customRegRexPane, "Custom");
cardPane.setVisible(false); cardPane.setVisible(false);
corePane.add(comboPane); corePane.add(comboPane);
@ -97,19 +111,19 @@ public class RegPane extends BasicPane {
initComboListener(cardPane); initComboListener(cardPane);
} }
private void initComboListener(ReactiveCardPane cardPane) { private void initComboListener(SimpleCardPane cardPane) {
regComboBox.addActionListener(e -> { regComboBox.addActionListener(e -> {
RegExp regExp = (RegExp)regComboBox.getSelectedItem(); RegExp regExp = (RegExp)regComboBox.getSelectedItem();
if(regExp instanceof PhoneReg) { if(regExp instanceof PhoneReg) {
Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem(); Object selectItem = regPhonePane.dataTypeComboBox.getSelectedItem();
String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString(); String regString = selectItem == null ? StringUtils.EMPTY : selectItem.toString();
firePhoneRegAction(regString); firePhoneRegAction(regString);
cardPane.select("Phone").populate(); cardPane.show("Phone");
} else { } else {
if (regExp instanceof LengthReg){ if (regExp instanceof LengthReg){
cardPane.select("Length").populate(); cardPane.show("Length");
} else if (regExp instanceof CustomReg){ } else if (regExp instanceof CustomReg){
cardPane.select("Custom").populate(); cardPane.show("Custom");
} else { } else {
cardPane.setVisible(false); cardPane.setVisible(false);
} }

47
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. * 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.fine.theme.icon.LazyIcon;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils; 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.event.GlobalNameObserver;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.IndentationUnitProcessor; 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.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox; 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.design.utils.gui.UIComponentUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.plugin.ExtraClassManager; import com.fr.plugin.ExtraClassManager;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
@ -46,9 +44,10 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import static com.fine.swing.ui.layout.Layouts.cell; 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.fine.swing.ui.layout.Layouts.fix; 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. * 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"), 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")}; 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 textComboBox;
private UIComboBox textRotationComboBox; private UIComboBox textRotationComboBox;
@ -91,7 +90,6 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
imageLayoutComboBox = new UIComboBox(LAYOUT); imageLayoutComboBox = new UIComboBox(LAYOUT);
initTextRotationComboBox(); initTextRotationComboBox();
// todo: 换新图标及反白问题
Icon[][] hAlignmentIconArray = {{new LazyIcon("h_left"), new LazyIcon("h_left").white()}, Icon[][] hAlignmentIconArray = {{new LazyIcon("h_left"), new LazyIcon("h_left").white()},
{new LazyIcon("h_center"), new LazyIcon("h_center").white()}, {new LazyIcon("h_center"), new LazyIcon("h_center").white()},
{new LazyIcon("h_right"), new LazyIcon("h_right").white()}, {new LazyIcon("h_right"), new LazyIcon("h_right").white()},
@ -177,7 +175,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
private JPanel createPane() { private JPanel createPane() {
JPanel basicPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), 290, 24, basicPane()); 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()); JPanel seniorPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Basic_Advanced"), 290, 24, seniorPane());
return Layouts.column( return column(
cell(basicPane), cell(basicPane),
fix(1).with(it -> it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")))), fix(1).with(it -> it.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("defaultBorderColor")))),
cell(seniorPane) 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); UILabel verticalLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Vertical") + " ", SwingConstants.LEFT);
UIComponentUtils.setLineWrap(horizontalLabel); UIComponentUtils.setLineWrap(horizontalLabel);
UIComponentUtils.setLineWrap(verticalLabel); UIComponentUtils.setLineWrap(verticalLabel);
return Layouts.column(LayoutConstants.VERTICAL_GAP, return column(LayoutConstants.VERTICAL_GAP,
row( row(
cell(horizontalLabel).weight(1.2), cell(horizontalLabel).weight(1.2),
cell(hAlignmentPane).weight(3)), cell(hAlignmentPane).weight(3)),
@ -201,7 +199,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
} }
private JPanel seniorPane() { private JPanel seniorPane() {
return Layouts.column(LayoutConstants.VERTICAL_GAP, return column(LayoutConstants.VERTICAL_GAP,
cell(seniorUpPane()), cell(seniorUpPane()),
cell(seniorMiddlePane()), cell(seniorMiddlePane()),
cell(seniorDownPane()) cell(seniorDownPane())
@ -210,7 +208,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
} }
private JPanel seniorUpPane() { private JPanel seniorUpPane() {
return Layouts.column(LayoutConstants.VERTICAL_GAP, return column(LayoutConstants.VERTICAL_GAP,
row( row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Image_Layout"), SwingConstants.LEFT)) 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), .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() { private JPanel seniorMiddlePane() {
rotationBarPane = ReactiveCardPane.create() Row rotationRow = row(flex(1.2),cell(rotationPane).weight(3)).getComponent();
.addSupplier("hide", () -> Layouts.row(
rotationBarPane = column(10,
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"), SwingConstants.LEFT)) 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), .with(it -> it.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"))).weight(1.2),
cell(textRotationComboBox).weight(3) cell(textRotationComboBox).weight(3)
).getComponent()) ),
.addSupplier("show", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, cell(rotationRow)
row( ).getComponent();
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();
textRotationComboBox.addItemListener(e -> { textRotationComboBox.addItemListener(e -> {
String key = (textRotationComboBox.getSelectedIndex() == 0) ? "show" : "hide"; rotationRow.setVisible(textRotationComboBox.getSelectedIndex() == 0);
rotationBarPane.select(key).populate();
}); });
return rotationBarPane; return rotationBarPane;
} }
@ -257,7 +246,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
partSpacingLabel.setToolTipText(partSpacingLabel.getText()); partSpacingLabel.setToolTipText(partSpacingLabel.getText());
UILabel spacingLabel = new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Line_Spacing")), SwingConstants.LEFT); UILabel spacingLabel = new UILabel((Toolkit.i18nText("Fine-Design_Basic_Style_Line_Spacing")), SwingConstants.LEFT);
spacingLabel.setToolTipText(spacingLabel.getText()); spacingLabel.setToolTipText(spacingLabel.getText());
return Layouts.column( return column(
row( row(
cell(indentationLabel).weight(1.2), cell(indentationLabel).weight(1.2),
cell(leftIndentSpinner).weight(1.4), cell(leftIndentSpinner).weight(1.4),

34
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.fine.swing.ui.layout.Layouts;
import com.fr.design.constants.LayoutConstants; 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.ibutton.UIButton;
import com.fr.design.gui.icombobox.FunctionComboBox; import com.fr.design.gui.icombobox.FunctionComboBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
@ -44,7 +44,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
private UIButton advancedButton; private UIButton advancedButton;
private JPanel advancedButtonRow; private JPanel advancedButtonRow;
private FunctionComboBox functionComboBox; private FunctionComboBox functionComboBox;
private ReactiveCardPane cardPane; private SimpleCardPane cardPane;
private UIComboBox goBox; private UIComboBox goBox;
private ItemListener listener; private ItemListener listener;
@ -68,11 +68,11 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
goBox.addItemListener(ee -> { goBox.addItemListener(ee -> {
int i = goBox.getSelectedIndex(); int i = goBox.getSelectedIndex();
if (i == BIND_GROUP) { if (i == BIND_GROUP) {
cardPane.select("groupPane").populate(); cardPane.show("groupPane");
} else if (i == BIND_SELECTED) { } else if (i == BIND_SELECTED) {
cardPane.setVisible(false); cardPane.setVisible(false);
} else if (i == BIND_SUMMARY) { } else if (i == BIND_SUMMARY) {
cardPane.select("summaryPane").populate(); cardPane.show("summaryPane");
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
cellExpandAttr.setDirection(Constants.NONE); cellExpandAttr.setDirection(Constants.NONE);
} }
@ -93,14 +93,14 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
advancedButtonRow = row(flex(1.2), cell(advancedButton).weight(3)).getComponent(); advancedButtonRow = row(flex(1.2), cell(advancedButton).weight(3)).getComponent();
functionComboBox = new FunctionComboBox(GUICoreUtils.getFunctionArray()); functionComboBox = new FunctionComboBox(GUICoreUtils.getFunctionArray());
cardPane = ReactiveCardPane.create() cardPane = new SimpleCardPane();
.addSupplier("groupPane", () -> column(LayoutConstants.VERTICAL_GAP, cardPane.add("groupPane", column(LayoutConstants.VERTICAL_GAP,
row(flex(1.2), cell(groupComboBox).weight(3)), row(flex(1.2), cell(groupComboBox).weight(3)),
cell(advancedButtonRow) cell(advancedButtonRow)
).getComponent()) ).getComponent());
.addSupplier("summaryPane", () -> row( cardPane.add("summaryPane", row(
flex(1.2), cell(functionComboBox).weight(3) flex(1.2), cell(functionComboBox).weight(3)
).getComponent()); ).getComponent());
} }
@Override @Override
@ -116,12 +116,12 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
if (recordGrouper instanceof FunctionGrouper) { if (recordGrouper instanceof FunctionGrouper) {
populateFunctionGrouper(); populateFunctionGrouper();
} else if (recordGrouper instanceof SummaryGrouper) { } else if (recordGrouper instanceof SummaryGrouper) {
cardPane.select("summaryPane").populate(); cardPane.show("summaryPane");
this.goBox.setSelectedIndex(BIND_SUMMARY); this.goBox.setSelectedIndex(BIND_SUMMARY);
this.functionComboBox.setFunction(((SummaryGrouper) recordGrouper).getFunction()); this.functionComboBox.setFunction(((SummaryGrouper) recordGrouper).getFunction());
} else if (recordGrouper instanceof CustomGrouper) { } else if (recordGrouper instanceof CustomGrouper) {
// 自定义分组 or 高级分组 // 自定义分组 or 高级分组
cardPane.select("groupPane").populate(); cardPane.show("groupPane");
this.goBox.setSelectedIndex(BIND_GROUP); this.goBox.setSelectedIndex(BIND_GROUP);
this.groupComboBox.setSelectedIndex(ADVANCED); this.groupComboBox.setSelectedIndex(ADVANCED);
} }
@ -134,11 +134,11 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
if (!((FunctionGrouper) recordGrouper).isCustom()) { if (!((FunctionGrouper) recordGrouper).isCustom()) {
int mode = recordGrouper.getDivideMode(); int mode = recordGrouper.getDivideMode();
if (mode == FunctionGrouper.GROUPING_MODE) { if (mode == FunctionGrouper.GROUPING_MODE) {
cardPane.select("groupPane").populate(); cardPane.show("groupPane");
this.goBox.setSelectedIndex(BIND_GROUP); this.goBox.setSelectedIndex(BIND_GROUP);
this.groupComboBox.setSelectedIndex(COMMON); this.groupComboBox.setSelectedIndex(COMMON);
} else if (mode == FunctionGrouper.CONTINUUM_MODE) { } else if (mode == FunctionGrouper.CONTINUUM_MODE) {
cardPane.select("groupPane").populate(); cardPane.show("groupPane");
this.goBox.setSelectedIndex(BIND_GROUP); this.goBox.setSelectedIndex(BIND_GROUP);
this.groupComboBox.setSelectedIndex(CONTINUUM); this.groupComboBox.setSelectedIndex(CONTINUUM);
} else if (mode == FunctionGrouper.LIST_MODE) { } else if (mode == FunctionGrouper.LIST_MODE) {
@ -147,7 +147,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane {
} }
} else { } else {
// 这种情况也放到自定义分组里面 // 这种情况也放到自定义分组里面
cardPane.select("groupPane").populate(); cardPane.show("groupPane");
this.goBox.setSelectedIndex(BIND_GROUP); this.goBox.setSelectedIndex(BIND_GROUP);
this.groupComboBox.setSelectedIndex(ADVANCED); this.groupComboBox.setSelectedIndex(ADVANCED);
} }

175
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.cell.settingpane; package com.fr.design.mainframe.cell.settingpane;
import com.fine.swing.ui.layout.Layouts; 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.FineUIStyle;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder; 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.editor.ValueEditorPaneFactory;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.foldablepane.UIExpandablePane; 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.UIButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
@ -74,14 +74,14 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private UIComboBox showContent; private UIComboBox showContent;
//内容提示 //内容提示
private ReactiveCardPane showContentPane; private JPanel showContentPane;
private UIButtonGroup tooltipButtonGroup; private UIButtonGroup tooltipButtonGroup;
private ReactiveCardPane tooltipPane; private JPanel tooltipPane;
private UITextField tooltipTextField; private UITextField tooltipTextField;
private UITextField fileNameTextField; private UITextField fileNameTextField;
//文本超出时隐藏 //文本超出时隐藏
private ReactiveCardPane overflowPane; private JPanel overflowPane;
private UICheckBox textOverflowCheckBox; private UICheckBox textOverflowCheckBox;
private int curSelectedIndex; private int curSelectedIndex;
private UIComboBox showPartComboBox; private UIComboBox showPartComboBox;
@ -112,7 +112,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
// 插入行策略 // 插入行策略
private UIButtonGroup insertRowPolicyButtonGroup; private UIButtonGroup insertRowPolicyButtonGroup;
private ValueEditorPane valueEditor; private ValueEditorPane valueEditor;
private ReactiveCardPane insertRowPolicyPane; private JPanel insertRowPolicyPane;
private UILabel insertRowPolicyLabel; private UILabel insertRowPolicyLabel;
private UIRadioButton exportButton; private UIRadioButton exportButton;
@ -220,6 +220,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
initInsertRowPolicyPane(); initInsertRowPolicyPane();
return Layouts.column(LayoutConstants.VERTICAL_GAP, return Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(seniorUpPane()), cell(seniorUpPane()),
row(
cell(insertRowPolicyLabel).weight(1.2),
cell(insertRowPolicyButtonGroup).weight(3)
),
cell(insertRowPolicyPane) cell(insertRowPolicyPane)
).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, LayoutConstants.VERTICAL_GAP, 0)) ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, LayoutConstants.VERTICAL_GAP, 0))
).getComponent(); ).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)); insertRowPolicyLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy", SwingConstants.LEFT));
UIComponentUtils.setLineWrap(insertRowPolicyLabel); UIComponentUtils.setLineWrap(insertRowPolicyLabel);
insertRowPolicyPane = ReactiveCardPane.create() insertRowPolicyPane = row( flex(1.2), cell(valueEditor).weight(3)).getComponent();
.addSupplier("empty", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, insertRowPolicyPane.setVisible(false);
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();
insertRowPolicyButtonGroup.addChangeListener(e -> { insertRowPolicyButtonGroup.addChangeListener(e -> {
String key = insertRowPolicyButtonGroup.getSelectedIndex() == 1 ? "default" : "empty"; insertRowPolicyPane.setVisible(insertRowPolicyButtonGroup.getSelectedIndex() == 1);
insertRowPolicyPane.select(key).populate();
}); });
} }
@ -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); UILabel showContentLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Content"), SwingConstants.LEFT);
UIComponentUtils.setLineWrap(showContentLabel); UIComponentUtils.setLineWrap(showContentLabel);
Row downloadRow = row(
cell(downloadLabel).weight(1.2), cell(fileNameTextField).weight(3.0)
).getComponent();
downloadRow.setVisible(false);
initTooltipPane(); initTooltipPane();
showContentPane = ReactiveCardPane.create()
.addSupplier("default", () -> column(LayoutConstants.VERTICAL_GAP, showContentPane = column(10,
row( row(
cell(showContentLabel).weight(1.2), cell(showContent).weight(3.0) cell(showContentLabel).weight(1.2), cell(showContent).weight(3.0)
), ),
cell(tooltipPane) cell(downloadRow),
).getComponent()) cell(tooltipPane)
.addSupplier("download", () -> column(LayoutConstants.VERTICAL_GAP, ).getComponent();
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();
showContent.addItemListener(e -> { showContent.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) { if (e.getStateChange() == ItemEvent.SELECTED) {
if (showContent.getSelectedIndex() == DOWNLOAD_INDEX) { downloadRow.setVisible(showContent.getSelectedIndex() == DOWNLOAD_INDEX);
showContentPane.select("download").populate();
} else {
showContentPane.select("default").populate();
}
handleCellShowStyleChange(e); handleCellShowStyleChange(e);
} }
}); });
@ -320,28 +298,19 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
tooltipButtonGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Custom"), tooltipButtonGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Custom"),
Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_CellValue")}); Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_CellValue")});
tooltipTextField = new UITextField(); 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 -> { tooltipButtonGroup.addChangeListener(e -> {
if (tooltipButtonGroup.getSelectedIndex() == 0) { tooltipTextRow.setVisible(tooltipButtonGroup.getSelectedIndex() == 0);
tooltipPane.select("define").populate();
} else {
tooltipPane.select("cellValue").populate();
}
}); });
} }
@ -354,35 +323,40 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
UILabel hideTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType")); UILabel hideTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType"));
textOverflowCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); textOverflowCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow"));
overflowPane = ReactiveCardPane.create() // 字符长度-数量
.addSupplier("empty", () -> column(LayoutConstants.VERTICAL_GAP, Row numPane = row(flex(0.1), cell(numberLabel).weight(0.5), cell(showCharNums).weight(1.0)).getComponent();
row(cell(textOverflowCheckBox))
).getComponent()) // 显示部分 & 隐藏方式
.addSupplier("showChar", () -> column(LayoutConstants.VERTICAL_GAP, JPanel overflowPolicyPane = column(10,
row(cell(textOverflowCheckBox)), row(
row(cell(showPartLabel).weight(1.2), cell(showPartComboBox).weight(1.4), flex(0.1), cell(numberLabel).weight(0.5), cell(showCharNums).weight(1.0)), cell(showPartLabel).weight(1.2),
row(cell(hideTypeLabel).weight(1.2), cell(textOverflowTypeComboBox).weight(3.0)) row(
).getComponent()) cell(showPartComboBox).weight(1.4),
.addSupplier("showCell", () -> column(LayoutConstants.VERTICAL_GAP, cell(numPane).weight(1.6)
row(cell(textOverflowCheckBox)), ).weight(3)
row(cell(showPartLabel).weight(1.2), cell(showPartComboBox).weight(3.0)), ),
row(cell(hideTypeLabel).weight(1.2), cell(textOverflowTypeComboBox).weight(3.0)) row(
).getComponent()); cell(hideTypeLabel).weight(1.2),
overflowPane.select("empty").populate(); cell(textOverflowTypeComboBox).weight(3.0)
)
).getComponent();
overflowPane = column(10,
row(cell(textOverflowCheckBox)),
cell(overflowPolicyPane)
).getComponent();
overflowPolicyPane.setVisible(false);
showPartComboBox.addItemListener(e -> { showPartComboBox.addItemListener(e -> {
if (showPartComboBox.getSelectedIndex() == 0) { numPane.setVisible(showPartComboBox.getSelectedIndex() == 0);
overflowPane.select("showChar").populate();
} else {
overflowPane.select("showCell").populate();
}
}); });
textOverflowCheckBox.addItemListener(e -> { textOverflowCheckBox.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) { if (e.getStateChange() == ItemEvent.SELECTED) {
if (showPartComboBox.getSelectedIndex() == 0) { overflowPolicyPane.setVisible(true);
overflowPane.select("showChar").populate(); numPane.setVisible(showPartComboBox.getSelectedIndex() == 0);
} else {
overflowPane.select("showCell").populate();
}
// 记录目前自动调整哪个被选中 // 记录目前自动调整哪个被选中
for (int i = 0; i < adjustRadioButtons.length; i++) { for (int i = 0; i < adjustRadioButtons.length; i++) {
if (adjustRadioButtons[i].isSelected()) { if (adjustRadioButtons[i].isSelected()) {
@ -392,7 +366,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} }
noAutoRadioButton.setSelected(true); noAutoRadioButton.setSelected(true);
} else { } else {
overflowPane.select("empty").populate(); overflowPolicyPane.setVisible(false);
adjustRadioButtons[curSelectedIndex].setSelected(true); adjustRadioButtons[curSelectedIndex].setSelected(true);
} }
}); });
@ -557,12 +531,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} else { } else {
tooltipButtonGroup.setSelectedIndex(1); tooltipButtonGroup.setSelectedIndex(1);
} }
if (tooltipButtonGroup.getSelectedIndex() == 0) { tooltipPane.setVisible(tooltipButtonGroup.getSelectedIndex() == 0);
tooltipPane.select("define").populate();
} else {
tooltipPane.select("cellValue").populate();
}
tooltipPane.setVisible(true);
if (cellGUIAttr.isHideTextWhenOverflow()) { if (cellGUIAttr.isHideTextWhenOverflow()) {
textOverflowCheckBox.setSelected(true); textOverflowCheckBox.setSelected(true);
if (cellGUIAttr.isShowCharNum()) { if (cellGUIAttr.isShowCharNum()) {
@ -607,12 +576,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
insertRowPolicyButtonGroup.setSelectedIndex(0); insertRowPolicyButtonGroup.setSelectedIndex(0);
this.valueEditor.populate(StringUtils.EMPTY); this.valueEditor.populate(StringUtils.EMPTY);
} }
String key = insertRowPolicyButtonGroup.getSelectedIndex() == 1 ? "default" : "empty"; insertRowPolicyPane.setVisible(insertRowPolicyButtonGroup.getSelectedIndex() == 1);
insertRowPolicyPane.select(key).populate();
insertRowPolicyPane.setVisible(true);
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略 if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略
insertRowPolicyPane.select("empty").populate(); insertRowPolicyPane.setVisible(false);
} }
populateDesensitizationBean(cellElement); populateDesensitizationBean(cellElement);
} }

43
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.CustomVariableResolver;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; 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.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
@ -121,9 +121,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
this.createPanes(); this.createPanes();
this.createSwitchTab(); this.createSwitchTab();
return Layouts.column(10, return Layouts.column(10,
cell(tabsHeaderIconPane), cell(tabsHeaderIconPane),
cell(cardContainer) cell(cardContainer)
).getComponent(); ).getComponent();
} }
@Override @Override
@ -268,8 +268,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
protected JPanel createContentPane() { protected JPanel createContentPane() {
initComponents(); initComponents();
return Layouts.column(LayoutConstants.VERTICAL_GAP, return Layouts.column(LayoutConstants.VERTICAL_GAP,
cell(dataPane), cell(groupPane), cell(conditionPane) cell(dataPane), cell(groupPane), cell(conditionPane)
).getComponent(); ).getComponent();
} }
private void initComponents(){ private void initComponents(){
@ -589,7 +589,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
private JPanel contentPane; private JPanel contentPane;
private UIComboBox rsComboBox; private UIComboBox rsComboBox;
private ReactiveCardPane setTipCardPane; private SimpleCardPane setTipCardPane;
private UITextField serialTextField; private UITextField serialTextField;
private JFormulaField topFormulaPane; private JFormulaField topFormulaPane;
private JFormulaField bottomFormulaPane; private JFormulaField bottomFormulaPane;
@ -618,7 +618,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
initSetTipCardPane(); initSetTipCardPane();
contentPane = Layouts.column(LayoutConstants.VERTICAL_GAP, contentPane = Layouts.column(LayoutConstants.VERTICAL_GAP,
row( row(
cell(filterLabel).weight(1.2), cell(rsComboBox).weight(3) cell(filterLabel).weight(1.2), cell(rsComboBox).weight(3)
), ),
cell(setTipCardPane) cell(setTipCardPane)
).getComponent(); ).getComponent();
@ -639,21 +639,15 @@ public class CellDSColumnEditor extends CellQuickEditor {
Color tipColor = FlatUIUtils.getUIColor("Label.tipColor", Color.GRAY); Color tipColor = FlatUIUtils.getUIColor("Label.tipColor", Color.GRAY);
Arrays.asList(oddTip, evenTip, specifyTip).forEach(it -> it.setForeground(tipColor)); Arrays.asList(oddTip, evenTip, specifyTip).forEach(it -> it.setForeground(tipColor));
setTipCardPane = ReactiveCardPane.create() setTipCardPane = new SimpleCardPane();
.addSupplier(TOP.name(), () -> row(flex(1.2), cell(topFormulaPane).weight(3)).getComponent()) setTipCardPane.add(TOP.name(), row(flex(1.2), cell(topFormulaPane).weight(3)).getComponent());
.addSupplier(BOTTOM.name(), () -> row(flex(1.2), cell(bottomFormulaPane).weight(3)).getComponent()) setTipCardPane.add(BOTTOM.name(), row(flex(1.2), cell(bottomFormulaPane).weight(3)).getComponent());
.addSupplier(ODD.name(), () -> row( setTipCardPane.add(ODD.name(), row(flex(1.2), cell(oddTip).weight(3)).getComponent());
flex(1.2), setTipCardPane.add(EVEN.name(), row(flex(1.2), cell(evenTip).weight(3)).getComponent());
cell(oddTip).weight(3) setTipCardPane.add(SPECIFY.name(), column(10,
).getComponent()) row(flex(1.2), cell(serialTextField).weight(3)),
.addSupplier(EVEN.name(), () -> row( row(flex(1.2), cell(specifyTip).weight(3))
flex(1.2), ).getComponent());
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); setTipCardPane.setVisible(false);
} }
@ -693,7 +687,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
if (type == UNDEFINE) { if (type == UNDEFINE) {
setTipCardPane.setVisible(false); setTipCardPane.setVisible(false);
} else { } else {
setTipCardPane.select(type.name()).populate(); setTipCardPane.setVisible(true);
setTipCardPane.show(type.name());
} }
} }

Loading…
Cancel
Save