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 9364af650..c73a1b9bb 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 @@ -72,13 +72,9 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { if (component instanceof JComponent) { JComponent jComponent = (JComponent) component; image = ScreenImage.createImage(jComponent); - } else if (component instanceof Window){ - Window window = (Window) component; - window.toFront(); - image = ScreenImage.createImage(component); - showContainer(); - } else { + } else (component instanceof Window){ image = captureImage(component); + showContainer(); } targetList.add(component); highlightList.add(getTargetComponentWithImage(image, rectangle)); @@ -98,7 +94,6 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { public boolean addTarget(Rectangle rectangle) { try { targetList.add(null); - container.setVisible(false); BufferedImage image = captureImage(rectangle); highlightList.add(getTargetComponentWithImage(image, rectangle)); return true; @@ -121,6 +116,8 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { return false; } Point point = SwingUtilities.convertPoint(component,0,0, container.getRootPane()); + + origin = origin.intersection(new Rectangle(0,0,component.getWidth(), component.getHeight())); Rectangle rectangle = new Rectangle(point.x + origin.x, point.y + origin.y, origin.width, origin.height); BufferedImage image; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java index 29653c9b8..d19d20b8a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe.guide.creator; import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XOccupiedLayout; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormCreatorDropTarget; @@ -18,17 +17,15 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; -import sun.java2d.xr.XcbRequestCounter; import javax.swing.ImageIcon; import javax.swing.JComponent; +import javax.swing.JDialog; import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import java.awt.Component; import java.awt.Point; import java.awt.Rectangle; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; import java.io.InputStream; import java.util.UUID; @@ -42,7 +39,7 @@ public class GuideCreateUtils { public static Rectangle getXCreatorBoundsRelative2FormDesigner(XCreator xCreator) { FormDesigner designer = getFormDesigner(); Point point = SwingUtilities.convertPoint(xCreator, 0, 0, designer.getRootComponent()); - return new Rectangle(point.x + designer.getPaintX(), point.y + designer.getPaintY(), xCreator.getWidth(), xCreator.getHeight()); + return new Rectangle(point.x + designer.getPaintX() - designer.getHorizontalScaleValue(), point.y + designer.getPaintY(), xCreator.getWidth(), xCreator.getHeight()); } public static XCreator getXCreatorFormDesigner(String name) { @@ -115,4 +112,10 @@ public class GuideCreateUtils { public static void deleteGuideFile(String filePath) { WorkContext.getWorkResource().delete(filePath); } + + public static void openDialogWithoutModal(JDialog dialog) { + dialog.setModal(false); + dialog.setVisible(true); + + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java index c27663e4f..1571553cb 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.guide.creator; import com.fr.design.actions.file.WebPreviewUtils; +import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.ibutton.UIPreviewButton; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.CenterRegionContainerPane; @@ -11,6 +12,7 @@ import com.fr.design.mainframe.guide.scene.ClickScene; import com.fr.design.mainframe.guide.scene.DisplayScene; import com.fr.design.mainframe.guide.scene.GuideScene; import com.fr.design.mainframe.guide.scene.GuideSceneLifecycleAdaptor; +import com.fr.design.mainframe.guide.tip.BubbleTip; import com.fr.design.mainframe.guide.tip.GuideTip; import com.fr.design.utils.ComponentUtils; @@ -60,4 +62,28 @@ public class GuideSceneHelper { }); return scene; } + + public static GuideScene createSelectXCretorClickScene(String widgetName) { + ClickScene scene = new ClickScene(); + scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { + @Override + public boolean prepared() { + + XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner(widgetName); + scene.addClickTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(xCreator), ClickScene.ClickType.LEFT); + scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Select_Widget"), BubbleTip.Direction.BOTTOM); + return super.prepared(); + } + + @Override + public void onComplete() { + super.onComplete(); + FormDesigner designer = GuideCreateUtils.getFormDesigner(); + XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner(widgetName); + designer.getSelectionModel().reset(); + designer.getSelectionModel().selectACreator(xCreator); + } + }); + return scene; + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java index 0fa69aa05..67bee2d99 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java @@ -54,8 +54,8 @@ public class ThemeToggleGuide { .nextScene(createScene3()) .nextScene(createScene4()) .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) + .nextScene(GuideSceneHelper.createSelectXCretorClickScene("chart00")) .nextScene(createScene5()) - .nextScene(createScene6()) .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) .nextScene(GuideSceneHelper.createPreviewClickScene()); @@ -161,29 +161,6 @@ public class ThemeToggleGuide { } private static GuideScene createScene5() { - ClickScene scene = new ClickScene(); - scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { - @Override - public boolean prepared() { - XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner("chart00"); - scene.addClickTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(xCreator), ClickScene.ClickType.LEFT); - scene.addBubbleTip("选择此模板", BubbleTip.Direction.BOTTOM); - return super.prepared(); - } - - @Override - public void onComplete() { - super.onComplete(); - FormDesigner designer = GuideCreateUtils.getFormDesigner(); - XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner("chart00"); - designer.getSelectionModel().reset(); - designer.getSelectionModel().selectACreator(xCreator); - } - }); - return scene; - } - - private static GuideScene createScene6() { ClickScene scene = new ClickScene(); final UIButtonGroup[] uiButtonGroup = new UIButtonGroup[1]; scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { @@ -226,10 +203,8 @@ public class ThemeToggleGuide { if (themeDialog == null) { DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); themeDialog = new TemplateThemeUsingDialog<>(designerFrame, DesignerContext.getDesignerFrame().getSelectedJTemplate(), FormThemeConfig.getInstance()); - themeDialog.setModal(false); - } - if (!themeDialog.isVisible()) { - themeDialog.setVisible(true); } + themeDialog.setModal(false); + themeDialog.setVisible(true); } }