Browse Source

fix:回退 拖拽范围修改

fbp/master
lemon 2 months ago
parent
commit
406b9f89b3
  1. 8
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  2. 39
      designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java
  3. 2
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  4. 2
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

8
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -3,7 +3,6 @@ package com.fr.design.data.tabledata.tabledatapane;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ParameterHelper; import com.fr.base.ParameterHelper;
@ -273,8 +272,11 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
JPanel sqlSplitPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(4, 4)); JPanel sqlSplitPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(4, 4));
sqlSplitPane.add(box, BorderLayout.CENTER); sqlSplitPane.add(box, BorderLayout.CENTER);
int leftComponentMin = FineUIUtils.getAndScaleInt("SplitPane.leftComponent.minimumSize", 120);
this.connectionTableProcedurePane.setMinimumSize(FineUIScale.scale(new Dimension(leftComponentMin, 400))); 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)));
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, this.connectionTableProcedurePane, sqlSplitPane); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, this.connectionTableProcedurePane, sqlSplitPane);
mainSplitPane.setOneTouchExpandable(true); mainSplitPane.setOneTouchExpandable(true);

39
designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java

@ -1,7 +1,6 @@
package com.fr.design.gui.controlpane; package com.fr.design.gui.controlpane;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.border.FineBorderFactory; import com.fr.design.border.FineBorderFactory;
@ -22,9 +21,7 @@ import javax.swing.JSplitPane;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension;
import java.util.Arrays; import java.util.Arrays;
import java.util.Objects;
import java.util.stream.Stream; import java.util.stream.Stream;
/** /**
@ -50,11 +47,6 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
protected JPanel cardPane; protected JPanel cardPane;
protected AbstractShortCutFactory shortCutFactory; protected AbstractShortCutFactory shortCutFactory;
protected JSplitPane mainSplitPane;
// split pane 左边组件最小宽度
protected int leftComponentMin;
// split pane 左边组件最大宽度
protected int leftComponentMax;
JControlPane() { JControlPane() {
this.initShortCutFactory(); this.initShortCutFactory();
@ -118,10 +110,7 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
this.creators = this.createNameableCreators(); this.creators = this.createNameableCreators();
initCardPane(); initCardPane();
// SplitPane // SplitPane
JPanel leftComponentPane = getLeftPane(); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane);
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); mainSplitPane.setOneTouchExpandable(true);
this.add(mainSplitPane, BorderLayout.CENTER); this.add(mainSplitPane, BorderLayout.CENTER);
@ -134,12 +123,11 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
} }
protected void initCardPane() { protected void initCardPane() {
leftComponentMax = FineUIUtils.getAndScaleInt("SplitPane.leftComponent.maximumSize", 240);
this.controlUpdatePane = createControlUpdatePane(); this.controlUpdatePane = createControlUpdatePane();
// p: edit card layout // p: edit card layout
this.cardLayout = new CardLayout(); this.cardLayout = new CardLayout();
initCardPaneWithMinSize(); cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
cardPane.setLayout(this.cardLayout); cardPane.setLayout(this.cardLayout);
// p:选择的Label // p:选择的Label
UILabel selectLabel = new UILabel(); UILabel selectLabel = new UILabel();
@ -147,29 +135,6 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
cardPane.add(controlUpdatePane, EDIT); 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() { public void showEditPane() {
this.cardLayout.show(cardPane, EDIT); this.cardLayout.show(cardPane, EDIT);
} }

2
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.add(cardPane, BorderLayout.CENTER);
rightPaneWrapper.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); rightPaneWrapper.setBorder(new ScaledEmptyBorder(0, 10, 0, 0));
// SplitPane // SplitPane
mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPaneWrapper, rightPaneWrapper); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPaneWrapper, rightPaneWrapper);
mainSplitPane.setOneTouchExpandable(true); mainSplitPane.setOneTouchExpandable(true);
this.add(mainSplitPane, BorderLayout.CENTER); this.add(mainSplitPane, BorderLayout.CENTER);
mainSplitPane.setDividerLocation(getLeftPreferredSize()); mainSplitPane.setDividerLocation(getLeftPreferredSize());

2
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -794,8 +794,6 @@ FormulaPane.buttonHeight=$Component.defaultHeight
SplitPane.dividerSize = 5 SplitPane.dividerSize = 5
SplitPane.continuousLayout = true SplitPane.continuousLayout = true
SplitPane.border = null SplitPane.border = null
SplitPane.leftComponent.minimumSize = 120
SplitPane.leftComponent.maximumSize = 240
# \u5F71\u54CD\u89C6\u89C9\u6548\u679C\uFF0C\u4E34\u65F6\u5148\u5173\u6389 # \u5F71\u54CD\u89C6\u89C9\u6548\u679C\uFF0C\u4E34\u65F6\u5148\u5173\u6389
SplitPane.supportsOneTouchButtons = false SplitPane.supportsOneTouchButtons = false
SplitPane.centerOneTouchButtons = true SplitPane.centerOneTouchButtons = true

Loading…
Cancel
Save