From 4c49a3b475761171ae03aaca01acb8b5a5cc5a18 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 25 Oct 2021 09:38:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-61299=20=E5=BC=B9=E7=AA=97=E7=B1=BB?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E9=AB=98=E4=BA=AE=E5=8C=BA=E5=9F=9F=E4=B8=8D?= =?UTF-8?q?=E5=8A=A0=E7=99=BD=E8=BE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../guide/scene/AbstractGuideScene.java | 46 +++++++++++-------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java index 5ead71c621..5f22d620e5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java @@ -75,13 +75,16 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { if (component instanceof JComponent) { JComponent jComponent = (JComponent) component; image = ScreenImage.createImage(jComponent); + highlightList.add(getTargetComponentWithImage(image, rectangle, true)); } else if (component instanceof Window) { image = ScreenImage.createImage(component); + highlightList.add(getTargetComponentWithImage(image, rectangle, false)); } else { image = captureImage(component); + highlightList.add(getTargetComponentWithImage(image, rectangle,true)); } targetList.add(component); - highlightList.add(getTargetComponentWithImage(image, rectangle)); + return true; } catch (AWTException e) { e.printStackTrace(); @@ -99,7 +102,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { try { targetList.add(null); BufferedImage image = captureImage(rectangle); - highlightList.add(getTargetComponentWithImage(image, rectangle)); + highlightList.add(getTargetComponentWithImage(image, rectangle, true)); return true; } catch (AWTException e) { e.printStackTrace(); @@ -133,7 +136,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { image = ScreenImage.createImage(component).getSubimage(origin.x, origin.y, origin.width, origin.height); } targetList.add(component); - highlightList.add(getTargetComponentWithImage(image, rectangle)); + highlightList.add(getTargetComponentWithImage(image, rectangle, true)); return true; } catch (AWTException e) { e.printStackTrace(); @@ -170,22 +173,29 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { return highlightList; } - private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle) { + private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle, boolean showBorder) { ImageIcon ic = new ImageIcon(image); - UILabel label = new UILabel(ic){ - @Override - public Insets getInsets() { - return DEFAULT_HIGHLIGHT_INSETS; - } - }; - label.setBackground(Color.WHITE); - label.setOpaque(true); - label.setBounds(new Rectangle( - rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left, - rectangle.y - DEFAULT_HIGHLIGHT_INSETS.top, - rectangle.width + DEFAULT_HIGHLIGHT_INSETS.left + DEFAULT_HIGHLIGHT_INSETS.right, - rectangle.height + DEFAULT_HIGHLIGHT_INSETS.top + DEFAULT_HIGHLIGHT_INSETS.bottom - )); + UILabel label; + if (showBorder) { + label = new UILabel(ic){ + @Override + public Insets getInsets() { + return DEFAULT_HIGHLIGHT_INSETS; + } + }; + label.setBackground(Color.WHITE); + label.setOpaque(true); + label.setBounds(new Rectangle( + rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left, + rectangle.y - DEFAULT_HIGHLIGHT_INSETS.top, + rectangle.width + DEFAULT_HIGHLIGHT_INSETS.left + DEFAULT_HIGHLIGHT_INSETS.right, + rectangle.height + DEFAULT_HIGHLIGHT_INSETS.top + DEFAULT_HIGHLIGHT_INSETS.bottom + )); + } else { + label = new UILabel(ic); + label.setBounds(rectangle); + } + return label; } From 626fd1add99dc6765c091f90a9ea99d6d698cedd Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 25 Oct 2021 11:31:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-61299=20popupMenu=E7=9A=84=E5=AD=90?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=AB=98=E4=BA=AE=E4=B8=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/guide/scene/AbstractGuideScene.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java index 5f22d620e5..cdb1765ffb 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java @@ -13,6 +13,7 @@ import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JPanel; +import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import java.awt.AWTException; import java.awt.AlphaComposite; @@ -75,7 +76,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { if (component instanceof JComponent) { JComponent jComponent = (JComponent) component; image = ScreenImage.createImage(jComponent); - highlightList.add(getTargetComponentWithImage(image, rectangle, true)); + highlightList.add(getTargetComponentWithImage(image, rectangle, !(component.getParent() instanceof JPopupMenu))); } else if (component instanceof Window) { image = ScreenImage.createImage(component); highlightList.add(getTargetComponentWithImage(image, rectangle, false)); From 7ace9cb7ebff3d6f527f5d29fbdbcb63f20744d0 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 25 Oct 2021 11:49:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-60896=20mac=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E8=92=99=E5=B1=82=E7=BB=93=E6=9D=9F=E5=90=8E=E6=9C=89=E9=81=97?= =?UTF-8?q?=E7=95=99=E9=80=8F=E6=98=8E=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/guide/base/Guide.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java index 9469f931a1..c8d3e6801d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java @@ -10,6 +10,8 @@ import com.fr.stable.StringUtils; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; +import java.awt.event.HierarchyEvent; +import java.awt.event.HierarchyListener; public class Guide { private String id; @@ -101,7 +103,7 @@ public class Guide { } GuideManager.getInstance().setCurrentGuide(this); guideView.showLoading(); - + guideView.addHierarchyListener(loadingHierarchyListener); new SwingWorker() { @Override protected Boolean doInBackground() { @@ -135,6 +137,9 @@ public class Guide { public void start() { guideView.hideLoading(); + } + + private void startScene() { if (scene != null) { guideView.setScene(scene); guideView.showGuide(); @@ -161,6 +166,7 @@ public class Guide { if (lifecycle != null) { lifecycle.onTerminate(); } + guideView.removeHierarchyListener(loadingHierarchyListener); end(); } @@ -186,4 +192,12 @@ public class Guide { public void removeGuideLifecycle() { this.lifecycle = null; } + + private HierarchyListener loadingHierarchyListener = new HierarchyListener() { + @Override + public void hierarchyChanged(HierarchyEvent e) { + guideView.removeHierarchyListener(loadingHierarchyListener); + startScene(); + } + }; }