From 7adbd182e63c61039399ebc4a5bb6cb182c744c4 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 27 Jul 2021 11:45:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-55757=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=9B=BE=E6=A1=88?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E5=9B=BE=EF=BC=8C=E6=82=AC=E6=B5=AE=E6=97=B6?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E7=9A=84=E9=81=AE=E7=BD=A9=E5=92=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=9B=BE=E6=A0=87=EF=BC=8C=E9=BC=A0=E6=A0=87=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E4=BB=8E=E5=B7=A6=E8=BE=B9/=E4=B8=8A=E8=BE=B9?= =?UTF-8?q?=E6=BB=91=E5=87=BA=EF=BC=8C=E5=88=99=E5=88=A0=E9=99=A4=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E6=B6=88=E5=A4=B1=EF=BC=9B=E4=BD=86=E4=BB=8E=E5=8F=B3?= =?UTF-8?q?=E8=BE=B9/=E4=B8=8B=E8=BE=B9=E6=BB=91=E5=87=BA=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=9B=BE=E6=A0=87=E8=BF=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 新建一个透明面板监听鼠标移入移除和点击手势,避免监听移入移除 和点击的手势处理冲突 【改动思路】 同上 --- .../design/gui/xpane/TitleInsetImagePane.java | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 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 48d1028e64..3671259a20 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 @@ -35,7 +35,6 @@ 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; /** @@ -96,14 +95,21 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { imagePreviewPane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE); imagePreviewOverlayPane.setBounds(1, 1, IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2); imageDeleteButton.setBounds(IMAGE_PREVIEW_SIZE - DELETE_BUTTON_SIZE, 0, DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE); - deletableImagePreviewPane.add(imageDeleteButton, 0); - deletableImagePreviewPane.add(imagePreviewOverlayPane, 1); - deletableImagePreviewPane.add(imagePreviewPane, 2); + + JPanel mousePane = new JPanel(); + mousePane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE); + mousePane.setOpaque(false); + mousePane.setBackground(null); + + deletableImagePreviewPane.add(mousePane, 0); + deletableImagePreviewPane.add(imageDeleteButton, 1); + deletableImagePreviewPane.add(imagePreviewOverlayPane, 2); + deletableImagePreviewPane.add(imagePreviewPane, 3); imagePreviewOverlayPane.setVisible(false); imageDeleteButton.setVisible(false); imageDeleteButton.setEnabled(false); - deletableImagePreviewPane.addMouseListener(new MouseAdapter() { + mousePane.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { super.mouseEntered(e); @@ -115,12 +121,27 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { @Override public void mouseExited(MouseEvent e) { super.mouseExited(e); + imagePreviewOverlayPane.setVisible(false); + imageDeleteButton.setVisible(false); + imageDeleteButton.setEnabled(false); + } + + @Override + public void mouseClicked(MouseEvent e) { + super.mouseClicked(e); int x = e.getX(); int y = e.getY(); - if (x <= 0 || getWidth() <= x || y <= 0 || y >= getHeight()) { + Rectangle bounds = imageDeleteButton.getBounds(); + if (bounds.x < x && x < bounds.x + bounds.width && bounds.y < y && y < bounds.y + bounds.height) { + imagePreviewPane.setImageWithSuffix(null); + imageLocationPane.setSelectedIndex(DEFAULT_INSET_LOCATION_INDEX); + imagePaddingPane.setValue(DEFAULT_INSET_PADDING); imagePreviewOverlayPane.setVisible(false); imageDeleteButton.setVisible(false); imageDeleteButton.setEnabled(false); + getComponent(1).setVisible(false); + + fireStateChanged(); } } }); @@ -211,20 +232,6 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { }).dealWithImageFile(returnVal); } }); - this.imageDeleteButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - imagePreviewPane.setImageWithSuffix(null); - imageLocationPane.setSelectedIndex(DEFAULT_INSET_LOCATION_INDEX); - imagePaddingPane.setValue(DEFAULT_INSET_PADDING); - imagePreviewOverlayPane.setVisible(false); - imageDeleteButton.setVisible(false); - imageDeleteButton.setEnabled(false); - getComponent(1).setVisible(false); - - fireStateChanged(); - } - }); } public void populateBean(TitlePacker packer) { From 4fd14630e5b8a3410dfaaf0ae7aa8ba4d044d8fc Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 27 Jul 2021 11:52:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-55839=20=E7=BB=84=E4=BB=B6=E5=A4=8D?= =?UTF-8?q?=E7=94=A8-=E7=A6=81=E7=94=A8tab=E5=9D=97=E7=9A=84=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=9B=BE=E7=89=87=E8=BE=B9=E6=A1=86=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E9=A2=84=E6=9C=9F=E6=98=AF=E5=8F=AA=E9=9D=A2?= =?UTF-8?q?=E5=90=91=E5=9B=BE=E8=A1=A8=E5=9D=97=E4=B8=8E=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 使用LayoutStylePane的控件都启用了组件边框 【改动思路】 1. 新增控制参数supportBorderImage,控制样式面板中是否支持图片边框 2. supportBorderImage默认为false,不支持图片边框 3. 仅针对报表块和图表块,设置supportBorderImage为true,支持图片边框 --- .../gui/xpane/BorderLineAndImagePane.java | 41 ++++++++++++++----- .../fr/design/gui/xpane/LayoutStylePane.java | 9 +++- .../layout/WTitleLayoutDefinePane.java | 2 +- 3 files changed, 40 insertions(+), 12 deletions(-) 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 b25d66e30f..0f2b853d1b 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 @@ -98,13 +98,13 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { private int[] ninePoint = new int[] {-1, -1, -1, -1}; - public BorderLineAndImagePane() { - this.initComponents(); + public BorderLineAndImagePane(boolean supportBorderImage) { + this.initComponents(supportBorderImage); this.initLayout(); } - private void initComponents() { - borderLineCombo = new BorderLineAndImageComboBox(); + private void initComponents(boolean supportBorderImage) { + borderLineCombo = new BorderLineAndImageComboBox(supportBorderImage); borderColorPane = new NewColorSelectBox(145); imagePreviewPane = new ImagePreviewPane() {{ setImageStyle(Style.DEFAULT_STYLE); @@ -386,16 +386,25 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { protected static class BorderLineAndImageComboBox extends LineComboBox { public static final int LINE_PICTURE = -1; - public final static int[] BORDER_LINE_STYLE_ARRAY = new int[] { + public final static int[] BORDER_LINE_AND_IMAGE_STYLE_ARRAY = new int[] { Constants.LINE_NONE, LINE_PICTURE, Constants.LINE_THIN, //1px Constants.LINE_MEDIUM, //2px Constants.LINE_THICK, //3px }; + public final static int[] BORDER_LINE_STYLE_ARRAY = new int[] { + Constants.LINE_NONE, + Constants.LINE_THIN, //1px + Constants.LINE_MEDIUM, //2px + Constants.LINE_THICK, //3px + }; + + private boolean supportBorderImage = false; - public BorderLineAndImageComboBox() { - super(BORDER_LINE_STYLE_ARRAY); + public BorderLineAndImageComboBox(boolean supportBorderImage) { + super(supportBorderImage ? BORDER_LINE_AND_IMAGE_STYLE_ARRAY : BORDER_LINE_STYLE_ARRAY); + this.supportBorderImage = supportBorderImage; } @Override @@ -407,15 +416,27 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { } public boolean isSelectedBorderLine() { - return getSelectedIndex() > 1; + Object object = getSelectedItem(); + if (object != null) { + int value = (int) object; + return value > 0; + } + return false; } public boolean isSelectedBorderImage() { - return getSelectedIndex() == 1; + Object object = getSelectedItem(); + if (object != null) { + int value = (int) object; + return value == LINE_PICTURE; + } + return false; } public void selectBorderImage() { - this.setSelectedIndex(1); + if (supportBorderImage) { + this.setSelectedIndex(1); + } } } 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 7c2094dd74..95659df6b7 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 @@ -88,7 +88,14 @@ public class LayoutStylePane extends BasicBeanPane { //标题背景透明度 protected UIPercentDragPane titleBackgroundOpacityPane; + private boolean supportBorderImage = false; + public LayoutStylePane() { + this(false); + } + + public LayoutStylePane(boolean supportBorderImage) { + this.supportBorderImage = supportBorderImage; this.initLayout(); } @@ -130,7 +137,7 @@ public class LayoutStylePane extends BasicBeanPane { protected JPanel createBackgroundStylePane() { borderStyleCombo = new UIComboBox(BORDER_STYLE); - borderLineAndImagePane = new BorderLineAndImagePane(); + borderLineAndImagePane = new BorderLineAndImagePane(this.supportBorderImage); cornerSpinner = new UISpinner(0,1000,1,0); double p = TableLayout.PREFERRED; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java index bae310fdb9..004c3e2c67 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java @@ -27,7 +27,7 @@ public abstract class WTitleLayoutDefinePane