From 2cd5514923ff976c1b72e5776f8a66670e0b9f78 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 21 Oct 2024 15:27:10 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-137646=20&=20REPORT-137829=20fix?= =?UTF-8?q?=EF=BC=9A=E5=88=A0=E9=99=A4=E2=80=9C=E6=B2=A1=E6=9C=89=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E2=80=9D=20&=20=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E5=B8=83=E5=B1=80=E8=B0=83=E6=95=B4=EF=BC=8Csplit=20p?= =?UTF-8?q?anel=20=E8=AE=BE=E7=BD=AE=E6=8B=96=E6=8B=BD=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledatapane/DBTableDataPane.java | 8 ++-- .../design/gui/controlpane/JControlPane.java | 39 ++++++++++++++++- .../design/gui/controlpane/UIControlPane.java | 2 +- .../popup/MobilePopupRegularPane.java | 4 +- .../hyperlink/popup/StyleSettingPane.java | 14 +++--- .../background/impl/NullBackgroundPane.java | 40 ------------------ .../light/ui/laf/FineLightLaf.properties | 2 + .../images/background/null_background.png | Bin 349 -> 0 bytes 8 files changed, 52 insertions(+), 57 deletions(-) delete mode 100644 designer-chart/src/main/resources/com/fr/design/images/background/null_background.png diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index dbe45885cc..937e4ec62c 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -3,6 +3,7 @@ package com.fr.design.data.tabledata.tabledatapane; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; +import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.Parameter; import com.fr.base.ParameterHelper; @@ -272,11 +273,8 @@ public class DBTableDataPane extends AbstractTableDataPane implemen JPanel sqlSplitPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(4, 4)); sqlSplitPane.add(box, BorderLayout.CENTER); - - box.setMinimumSize(FineUIScale.scale(new Dimension(300, 400))); - - this.connectionTableProcedurePane.setMinimumSize(FineUIScale.scale(new Dimension(230, 400))); - this.connectionTableProcedurePane.setMaximumSize(FineUIScale.scale(new Dimension(500, 400))); + int leftComponentMin = FineUIUtils.getAndScaleInt("SplitPane.leftComponent.minimumSize", 120); + this.connectionTableProcedurePane.setMinimumSize(FineUIScale.scale(new Dimension(leftComponentMin, 400))); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, this.connectionTableProcedurePane, sqlSplitPane); mainSplitPane.setOneTouchExpandable(true); diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java index b957a1370d..c0da6e502f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java @@ -1,6 +1,7 @@ package com.fr.design.gui.controlpane; import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.border.FineBorderFactory; @@ -21,7 +22,9 @@ import javax.swing.JSplitPane; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; +import java.awt.Dimension; import java.util.Arrays; +import java.util.Objects; import java.util.stream.Stream; /** @@ -47,6 +50,11 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S protected JPanel cardPane; protected AbstractShortCutFactory shortCutFactory; + protected JSplitPane mainSplitPane; + // split pane 左边组件最小宽度 + protected int leftComponentMin; + // split pane 左边组件最大宽度 + protected int leftComponentMax; JControlPane() { this.initShortCutFactory(); @@ -110,7 +118,10 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S this.creators = this.createNameableCreators(); initCardPane(); // SplitPane - JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane); + JPanel leftComponentPane = getLeftPane(); + leftComponentMin = FineUIUtils.getAndScaleInt("SplitPane.leftComponent.minimumSize", 120); + leftComponentPane.setMinimumSize(FineUIScale.createScaleDimension(leftComponentMin, 0)); + mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftComponentPane, cardPane); mainSplitPane.setOneTouchExpandable(true); this.add(mainSplitPane, BorderLayout.CENTER); @@ -123,11 +134,12 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S } protected void initCardPane() { + leftComponentMax = FineUIUtils.getAndScaleInt("SplitPane.leftComponent.maximumSize", 240); this.controlUpdatePane = createControlUpdatePane(); // p: edit card layout this.cardLayout = new CardLayout(); - cardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); + initCardPaneWithMinSize(); cardPane.setLayout(this.cardLayout); // p:选择的Label UILabel selectLabel = new UILabel(); @@ -135,6 +147,29 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S cardPane.add(controlUpdatePane, EDIT); } + /** + * 初始化一个 rightComponent,且指定 minimumSize + * + * {@link javax.swing.plaf.basic.BasicSplitPaneDivider#DragController} 拖拽的时候会调用 getMinimumSize 方法 + * split pane driver 拖拽范围取自 leftComponent 的 minimumSize 和 rightComponent 的 minimumSize + */ + private void initCardPaneWithMinSize() { + cardPane = new JPanel(new CardLayout()) { + @Override + public Dimension getMinimumSize() { + Dimension size = super.getMinimumSize(); + if (mainSplitPane == null) { + return size; + } + Dimension parentSize = mainSplitPane.getSize(); + if (parentSize.width != 0 && Objects.equals(JSplitPane.HORIZONTAL_SPLIT, mainSplitPane.getOrientation())) { + size.width = parentSize.width - FineUIScale.scale(leftComponentMax); + } + return size; + } + }; + } + public void showEditPane() { this.cardLayout.show(cardPane, EDIT); } diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 814e52848b..551c05a0bf 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -91,7 +91,7 @@ public abstract class UIControlPane extends JControlPane { rightPaneWrapper.add(cardPane, BorderLayout.CENTER); rightPaneWrapper.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); // SplitPane - JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPaneWrapper, rightPaneWrapper); + mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPaneWrapper, rightPaneWrapper); mainSplitPane.setOneTouchExpandable(true); this.add(mainSplitPane, BorderLayout.CENTER); mainSplitPane.setDividerLocation(getLeftPreferredSize()); diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java index 7978159c1c..293d2893e6 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java @@ -45,7 +45,7 @@ public class MobilePopupRegularPane extends BasicPane { spinnerGroupPane = this.createSpinnerPane(); this.add(column(LayoutConstants.VERTICAL_GAP, cell(this.createRadioButtonGroupPane()), - row(flex(1), cell(spinnerGroupPane).weight(3)) + row(flex(1.5), cell(spinnerGroupPane).weight(3)) ).getComponent()); } @@ -62,7 +62,7 @@ public class MobilePopupRegularPane extends BasicPane { radioButtons.add(autoRadio); radiosPane.add(row(30, cell(customRadio), cell(autoRadio), flex()).getComponent()); - return row(cell(new UILabel(this.label, FineUIStyle.LABEL_SECONDARY)).weight(1), cell(radiosPane).weight(3)).getComponent(); + return row(cell(new UILabel(this.label, FineUIStyle.LABEL_SECONDARY)).weight(1.5), cell(radiosPane).weight(3)).getComponent(); } private ActionListener radioActionListener = new ActionListener() { diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java index 701594bf12..3cd58ca51d 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java @@ -83,9 +83,9 @@ public class StyleSettingPane extends BasicBeanPane { UILabel borderLabel = new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Border")); borderPane.add(column(LayoutConstants.VERTICAL_GAP, - row(cell(borderLabel).weight(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Line"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderType).weight(2), flex(3)), - row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderColor).weight(2), flex(3)), - row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Radius"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderRadiusSpinner).weight(2), flex(3)) + row(cell(borderLabel).weight(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Line"), FineUIStyle.LABEL_SECONDARY)).weight(1.5), cell(borderType).weight(2), flex(2.5)), + row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), FineUIStyle.LABEL_SECONDARY)).weight(1.5), cell(borderColor).weight(2), flex(2.5)), + row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Radius"), FineUIStyle.LABEL_SECONDARY)).weight(1.5), cell(borderRadiusSpinner).weight(2), flex(2.5)) ).getComponent()); return borderPane; } @@ -102,8 +102,8 @@ public class StyleSettingPane extends BasicBeanPane { JLabel bgLabel = new JLabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Background")); bgPane.add(column(LayoutConstants.VERTICAL_GAP, - row(cell(bgLabel).weight(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(bgColor).weight(2), flex(3)), - row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Opacity"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(transparencyPane).weight(3), flex(2)) + row(cell(bgLabel).weight(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), FineUIStyle.LABEL_SECONDARY)).weight(1.5), cell(bgColor).weight(2), flex(2.5)), + row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Opacity"), FineUIStyle.LABEL_SECONDARY)).weight(1.5), cell(transparencyPane).weight(3), flex(1.5)) ).getComponent()); return bgPane; } @@ -117,9 +117,9 @@ public class StyleSettingPane extends BasicBeanPane { sizePane.add(column(LayoutConstants.VERTICAL_GAP, row( column(LayoutConstants.VERTICAL_GAP, cell(sizeLabel), flex()).weight(1), - cell(mobileRegularPane).weight(4), flex(2) + cell(mobileRegularPane).weight(4.5), flex(1.5) ), - row(flex(1), cell(padRegularPane).weight(4), flex(2)) + row(flex(1), cell(padRegularPane).weight(4.5), flex(1.5)) ).getComponent()); return sizePane; } diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java index 976744e3b3..9f7ef617e3 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java @@ -1,20 +1,15 @@ package com.fr.design.style.background.impl; -import com.fine.theme.utils.FineUIScale; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.BackgroundDetailPane; import com.fr.general.Background; -import com.fr.general.locale.image.I18nImage; import javax.swing.*; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Image; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.column; @@ -25,23 +20,14 @@ import static com.fine.swing.ui.layout.Layouts.flex; */ public class NullBackgroundPane extends BackgroundDetailPane { - private static final String NULL_BACKGROUND = "/com/fr/design/images/background/null_background.png"; - private static final Image DEFAULT_NULL_BACKGROUND_IMAGE; - - static { - DEFAULT_NULL_BACKGROUND_IMAGE = I18nImage.getImage(NULL_BACKGROUND); - } - public NullBackgroundPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); UILabel centerLabel = new UILabel( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Background_Is_Null")); - ImagePanel imagePane = new ImagePanel(); JPanel pane = column( 10, flex(), - cell(imagePane), cell(centerLabel), flex() ).getComponent(); @@ -60,30 +46,4 @@ public class NullBackgroundPane extends BackgroundDetailPane { public void addChangeListener(ChangeListener changeListener) { // do nothing. } - - /** - * 水平居中绘制 Image - */ - public class ImagePanel extends JPanel { - - public ImagePanel() { - } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); - if (DEFAULT_NULL_BACKGROUND_IMAGE != null) { - int x = (this.getWidth() - DEFAULT_NULL_BACKGROUND_IMAGE.getWidth(null)) / 2; - g.drawImage(DEFAULT_NULL_BACKGROUND_IMAGE, x, 0, this); - } - } - - @Override - public Dimension getPreferredSize() { - if (DEFAULT_NULL_BACKGROUND_IMAGE == null) { - return super.getPreferredSize(); - } - return FineUIScale.scale(new Dimension(DEFAULT_NULL_BACKGROUND_IMAGE.getWidth(null), DEFAULT_NULL_BACKGROUND_IMAGE.getHeight(null))); - } - } } diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index 0adc8cf686..aab414e72f 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -794,6 +794,8 @@ FormulaPane.buttonHeight=$Component.defaultHeight SplitPane.dividerSize = 5 SplitPane.continuousLayout = true SplitPane.border = null +SplitPane.leftComponent.minimumSize = 120 +SplitPane.leftComponent.maximumSize = 240 # \u5F71\u54CD\u89C6\u89C9\u6548\u679C\uFF0C\u4E34\u65F6\u5148\u5173\u6389 SplitPane.supportsOneTouchButtons = false SplitPane.centerOneTouchButtons = true diff --git a/designer-chart/src/main/resources/com/fr/design/images/background/null_background.png b/designer-chart/src/main/resources/com/fr/design/images/background/null_background.png deleted file mode 100644 index 617860181278c14cbd9bd9d114956b1a715a5733..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 349 zcmeAS@N?(olHy`uVBq!ia0vp^DIm``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eB{wGft$B+ufw-*f=859H<7GAIO`*wbjX`#w BVQ&Bc