From 0703562439dd39729908757d7f9d7ee54f68d51f Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 17:50:34 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-55089=20=E7=BB=84=E4=BB=B6=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6=E5=A4=8D?= =?UTF-8?q?=E7=94=A8-=E7=8E=B0=E5=9C=A8=E9=94=81=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=9C=A8=E5=AE=BD=E9=AB=98=E5=80=BC=E4=B9=8B=E9=97=B4=EF=BC=8C?= =?UTF-8?q?=E9=94=81=E5=AE=9A=E6=97=B6=EF=BC=8C=E6=8B=96=E6=8B=BD=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E7=BB=84=E4=BB=B6=E5=A4=A7=E5=B0=8F=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E5=80=BC=E4=BC=9A=E5=8F=98=E5=8C=96=E6=88=90?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=BE=88=E9=95=BF=E7=9A=84=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 因为尺寸比例锁定,所以宽度设置控件和高度设置控件的显示内容做了关联:当宽度设置控件发生变化后,会自动修改高度控制的显示只, 反之亦然。因为上述关联,导致拖拽结束后,重新设置面板上尺寸显示值时,高度设置控件的值后更细,联动宽度控件的值,所以宽度控件 的值被修改,显示错误 【改动思路】 populate中设置宽度和高度值时,先临时关闭比例锁定 【review建议】 --- .../design/widget/ui/designer/component/WidgetBoundPane.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index e963bf713..bfcaeb60e 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -104,6 +104,10 @@ public class WidgetBoundPane extends BasicPane { public void populate() { Rectangle bounds = new Rectangle(creator.getBounds()); + if (ratioLockedButton != null) { + // 临时禁止尺寸比例锁定,关掉widthSpinner/heightSpinner之间的数值关联,以更新其高度和宽度值 + ratioLockedButton.setLocked(false); + } width.setValue(bounds.width); height.setValue(bounds.height); if (ratioLockedButton != null) { From 5cfbe3fec415f92f2c3044f0bdc1d1d1ea3b6dbb Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 18:45:33 +0800 Subject: [PATCH 2/4] =?UTF-8?q?REPORT-55071=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E6=A0=87=E9=A2=98=E5=A1=AB=E5=85=85?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=B8=90=E5=8F=98=E8=89=B2=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E5=87=BA=E7=8E=B0=E7=BA=B5?= =?UTF-8?q?=E5=90=91=E6=BB=9A=E5=8A=A8=E6=9D=A1=EF=BC=8C=E9=81=AE=E6=8C=A1?= =?UTF-8?q?=E4=BD=8F=E4=BA=86=E6=B8=90=E5=8F=98=E8=89=B2=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E9=80=89=E6=8B=A9=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 渐变条的默认宽度超过了右侧栏设置项的宽度,导致渐变条右侧被截断 【改动思路】 提供可继承的方法,使得右侧栏实例化渐变条时能控制其宽度 【review建议】 --- .../fr/design/gui/style/BackgroundSpecialPane.java | 7 ++++++- .../design/gui/xpane/BorderLineAndImagePane.java | 2 +- .../com/fr/design/gui/xpane/LayoutStylePane.java | 14 +++++++++++--- .../fr/design/gui/xpane/TitleInsetImagePane.java | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java index 7fa266423..ee05a8b59 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java @@ -39,7 +39,7 @@ public class BackgroundSpecialPane extends BackgroundPane{ fireStateChanged(); } }); - GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane(); + GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane(); gradientPane.registerChangeListener(new UIObserverListener() { @Override public void doChange() { @@ -68,4 +68,9 @@ public class BackgroundSpecialPane extends BackgroundPane{ return kinds.toArray(new BackgroundQuickPane[kinds.size()]); } + + protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() { + // 使用默认的150宽度构建渐变条 + return new GradientBackgroundQuickPane(); + } } diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index 9444ec1f8..27c045459 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -62,7 +62,7 @@ import java.net.URISyntaxException; * 可配置图片类型边框的样式设置面板 */ public class BorderLineAndImagePane extends JPanel implements UIObserver { - private final int SETTING_LABEL_WIDTH = 60; + private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH; private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); private final String TWEAK_NINE_POINT_HELP_URL = ""; diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index 265de1aba..ee1de8f7e 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -24,6 +24,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.WidgetTitle; import com.fr.general.Background; @@ -51,7 +52,7 @@ public class LayoutStylePane extends BasicBeanPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Shadow") }; private static final Dimension BUTTON_SIZE = new Dimension(20, 20); - private static final int SETTING_LABEL_WIDTH = 60; + public static final int SETTING_LABEL_WIDTH = 60; protected LayoutBorderStyle style = new LayoutBorderStyle(); @@ -124,7 +125,7 @@ public class LayoutStylePane extends BasicBeanPane { borderStyleCombo = new UIComboBox(BORDER_STYLE); borderLineAndImagePane = new BorderLineAndImagePane(); cornerSpinner = new UISpinner(0,1000,1,0); - backgroundPane = new BackgroundSpecialPane(); + backgroundPane = new LayoutBackgroundSpecialPane(); backgroundOpacityPane = new UIPercentDragPane(); } @@ -229,7 +230,7 @@ public class LayoutStylePane extends BasicBeanPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right") }); - titleBackgroundPane = new BackgroundSpecialPane(); + titleBackgroundPane = new LayoutBackgroundSpecialPane(); titleBackgroundOpacityPane = new UIPercentDragPane(); } @@ -499,4 +500,11 @@ public class LayoutStylePane extends BasicBeanPane { g2d.setColor(oldColor); } } + + protected static class LayoutBackgroundSpecialPane extends BackgroundSpecialPane { + @Override + protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() { + return new GradientBackgroundQuickPane(140); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java index 1a207a0b3..e3b3c00f4 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java @@ -40,7 +40,7 @@ import java.awt.event.ActionListener; * Created by Starryi on 2021/7/3 */ public class TitleInsetImagePane extends JPanel implements UIObserver { - private final int SETTING_LABEL_WIDTH = 60; + private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH; private final int DELETE_BUTTON_SIZE = 24; private final int IMAGE_PREVIEW_SIZE = 145; private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); From 4bad4e373444e6929240285dd45f3937f927cbba Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 19:17:14 +0800 Subject: [PATCH 3/4] =?UTF-8?q?REPORT-55090=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E6=A0=87=E9=A2=98=E5=9B=BE=E6=A1=88?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88=E5=9B=BE=EF=BC=8C?= =?UTF-8?q?=E5=92=8C=E4=BA=A4=E4=BA=92=E6=96=87=E6=A1=A3=E9=87=8C=E5=AE=9A?= =?UTF-8?q?=E7=9A=84=E6=82=AC=E6=B5=AE=E6=97=B6=E5=87=BA=E7=8E=B0=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=8C=89=E9=92=AE=E5=92=8C=E4=B8=8D=E9=80=8F=E6=98=8E?= =?UTF-8?q?=E9=81=AE=E7=BD=A9=E9=A2=84=E6=9C=9F=E6=95=88=E6=9E=9C=E4=B8=8D?= =?UTF-8?q?=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 插图图片按钮的交互和样式不对,需要重新实现 【改动思路】 【review建议】 --- .../design/gui/xpane/TitleInsetImagePane.java | 69 ++++++++++++++++--- 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java index e3b3c00f4..b7161cbfb 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java @@ -33,6 +33,10 @@ import javax.swing.plaf.basic.BasicButtonUI; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.geom.RoundRectangle2D; /** * @author Starryi @@ -89,6 +93,28 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { deletableImagePreviewPane.add(imageDeleteButton, 0); deletableImagePreviewPane.add(imagePreviewPane, 1); + imageDeleteButton.setVisible(false); + imageDeleteButton.setEnabled(false); + deletableImagePreviewPane.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + super.mouseEntered(e); + imageDeleteButton.setVisible(true); + imageDeleteButton.setEnabled(true); + } + + @Override + public void mouseExited(MouseEvent e) { + super.mouseExited(e); + int x = e.getX(); + int y = e.getY(); + if (x <= 0 || getWidth() <= x || y <= 0 || y >= getHeight()) { + imageDeleteButton.setVisible(false); + imageDeleteButton.setEnabled(false); + } + } + }); + return TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{ {null, deletableImagePreviewPane}, @@ -110,15 +136,11 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { private void initComponents() { imageChooseButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_choose_inset.png")); - imageDeleteButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png")); - imageDeleteButton.setUI(new BasicButtonUI()); - imageDeleteButton.setOpaque(true); - imageDeleteButton.setBorderPainted(false); - imageDeleteButton.setBorder(null); - imageDeleteButton.setFocusPainted(false); - imageDeleteButton.setContentAreaFilled(true); + imageDeleteButton = new OpaqueColorButton( + IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"), + new Color(51, 51, 52, 178), + 2); imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE)); - imageDeleteButton.setBackground(new Color(51, 51, 51)); imagePreviewPane = new ImagePreviewPane(); imagePreviewPane.setImageStyle(DEFAULT_IMAGE_LAYOUT_STYLE); @@ -255,4 +277,35 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { public boolean shouldResponseChangeListener() { return true; } + + private static class OpaqueColorButton extends UIButton { + private final Color color; + private final int radius; + + public OpaqueColorButton(Icon icon, Color color, int radius) { + super(icon); + setUI(new BasicButtonUI()); + setOpaque(true); + setBorderPainted(false); + setBorder(null); + setFocusPainted(false); + setContentAreaFilled(false); + this.color = color; + this.radius = radius; + } + + @Override + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + Color oldColor = g2d.getColor(); + + Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), radius, radius); + g2d.clip(shape); + g2d.setColor(color); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + g2d.setColor(oldColor); + super.paint(g); + } + } } From 43efd3c46f5b152362ffdb70f5b68abb704054fa Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 19:26:02 +0800 Subject: [PATCH 4/4] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子功能: 设计器绝对布局内可锁定组件宽高比例 绝对布局未锁定尺寸比例,但其内部子组件锁定了尺寸比例,此时 改变绝对布局的尺寸,其内部组件应该保持原有的尺寸比例. 根据规则, 其内部组件选择宽度和高度中较小的缩放比例,缩放其尺寸. --- .../java/com/fr/design/designer/creator/XWAbsoluteLayout.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 60197ba12..72bb2cb03 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -203,6 +203,10 @@ public class XWAbsoluteLayout extends XLayoutContainer { double percentH = ((double) backupBound.height / (double) currentBound.height); for (int index = 0, n = this.getComponentCount(); index < n; index++) { XCreator creator = (XCreator) this.getComponent(index); + if (creator.toData().isAspectRatioLocked()) { + double percent = Math.min(percentW, percentH); + percentW = percentH = percent; + } BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData()); // 用当前的显示大小计算后调正具体位置 Rectangle wgtBound = creator.getBounds();