Browse Source

REPORT-137646 & REPORT-137829 fix:删除“没有背景” & 移动端弹窗布局调整,split panel 设置拖拽范围

fbp/master
lemon 1 month ago
parent
commit
2cd5514923
  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. 4
      designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java
  5. 14
      designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java
  6. 40
      designer-base/src/main/java/com/fr/design/style/background/impl/NullBackgroundPane.java
  7. 2
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  8. BIN
      designer-chart/src/main/resources/com/fr/design/images/background/null_background.png

8
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<DBTableData> 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);

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

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.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());

4
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() {

14
designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java

@ -83,9 +83,9 @@ public class StyleSettingPane extends BasicBeanPane<MobilePopupHyperlink> {
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<MobilePopupHyperlink> {
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<MobilePopupHyperlink> {
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;
}

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

2
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

BIN
designer-chart/src/main/resources/com/fr/design/images/background/null_background.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 349 B

Loading…
Cancel
Save