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. 47
      designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java
  3. 6
      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.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;
@ -273,8 +272,11 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
JPanel sqlSplitPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(4, 4));
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);
mainSplitPane.setOneTouchExpandable(true);

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

@ -1,7 +1,6 @@
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;
@ -22,9 +21,7 @@ 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;
/**
@ -50,11 +47,6 @@ 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();
@ -118,10 +110,7 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
this.creators = this.createNameableCreators();
initCardPane();
// SplitPane
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);
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, getLeftPane(), cardPane);
mainSplitPane.setOneTouchExpandable(true);
this.add(mainSplitPane, BorderLayout.CENTER);
@ -134,12 +123,11 @@ 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();
initCardPaneWithMinSize();
cardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
cardPane.setLayout(this.cardLayout);
// p:选择的Label
UILabel selectLabel = new UILabel();
@ -147,29 +135,6 @@ 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);
}
@ -247,10 +212,10 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
}
/**
* 刷新 NameableCreator
*
* @param creators 生成器
*/
* 刷新 NameableCreator
*
* @param creators 生成器
*/
public void refreshNameableCreator(NameableCreator[] creators) {
this.creators = creators;
shorts = this.createShortcuts();

6
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
mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPaneWrapper, rightPaneWrapper);
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPaneWrapper, rightPaneWrapper);
mainSplitPane.setOneTouchExpandable(true);
this.add(mainSplitPane, BorderLayout.CENTER);
mainSplitPane.setDividerLocation(getLeftPreferredSize());
@ -243,8 +243,8 @@ public abstract class UIControlPane extends JControlPane {
}
/**
* 是否需要隐藏popupEditDialog
*/
* 是否需要隐藏popupEditDialog
*/
protected boolean needToHidePopupEditDialog() {
// 检查是否有子弹窗,如果有,则不隐藏
for (Window window : popupEditDialog.getOwnedWindows()) {

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.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

Loading…
Cancel
Save