From a32e451dee863a236cba3686e611015cd7208d36 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 11 Oct 2021 10:58:44 +0800 Subject: [PATCH 1/7] =?UTF-8?q?REPORT-60513=20=E5=8A=9F=E8=83=BD=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E6=8F=90=E7=A4=BA=E5=A2=9E=E5=8A=A0=E9=81=AE=E7=BD=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/guide/ui/BubbleHintDialog.java | 47 -------------- .../mainframe/guide/entry/GuideEntryHint.java | 63 +++++++++++++++++++ .../mainframe/guide/entry/GuideEntryPane.java | 7 +-- 3 files changed, 64 insertions(+), 53 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHintDialog.java create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHintDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHintDialog.java deleted file mode 100644 index 5a7b55c81a..0000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHintDialog.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fr.design.mainframe.guide.ui; - -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; -import com.fr.design.mainframe.guide.collect.GuideCollector; - -import javax.swing.JDialog; -import java.awt.Color; -import java.awt.Point; -import java.awt.Window; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -public class BubbleHintDialog extends JDialog { - private static final int DIALOG_WIDTH = 220; - private static final int DIALOG_HEIGHT = 140; - private static BubbleHintDialog dialog; - - public static BubbleHintDialog getInstance(){ - if (dialog == null) { - dialog = new BubbleHintDialog(DesignerContext.getDesignerFrame()); - } - return dialog; - } - - public BubbleHintDialog(Window parent) { - super(parent); - setUndecorated(true); - this.setBackground(new Color(0,0,0,0)); - setSize(DIALOG_WIDTH, DIALOG_HEIGHT); - BubbleHint bubbleHint = new BubbleHint(); - bubbleHint.addConfirmAction(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - setVisible(false); - dispose(); - GuideCollector.getInstance().setShowHint(true); - } - }); - this.setContentPane(bubbleHint); - } - - public void showDialog(Point location) { - dialog.setLocation(location); - dialog.setVisible(true); - } -} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java new file mode 100644 index 0000000000..c1e361ec22 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java @@ -0,0 +1,63 @@ +package com.fr.design.mainframe.guide.entry; + +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.guide.base.GuideView; +import com.fr.design.mainframe.guide.collect.GuideCollector; +import com.fr.design.mainframe.guide.scene.AbstractGuideScene; +import com.fr.design.mainframe.guide.scene.GuideSceneLifecycleAdaptor; +import com.fr.design.mainframe.guide.ui.BubbleHint; + +import javax.swing.SwingUtilities; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class GuideEntryHint { + private static GuideEntryHint hint; + private GuideView guideView; + + public static GuideEntryHint getInstance() { + if (hint == null) { + hint = new GuideEntryHint(); + } + return hint; + } + + public GuideEntryHint() { + AbstractGuideScene scene = new AbstractGuideScene(){}; + BubbleHint bubbleHint = new BubbleHint(); + guideView = new GuideView(DesignerContext.getDesignerFrame()); + + bubbleHint.addConfirmAction(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + GuideCollector.getInstance().setShowHint(true); + guideView.dismissGuide(); + } + }); + + scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { + @Override + public boolean prepared() { + scene.addTarget(GuideEntryPane.getGuideEntryPane()); + scene.addCustomTarget(bubbleHint, getBubbleLocation()); + return true; + } + }); + + guideView.setScene(scene); + } + + public void show() { + if (!guideView.isVisible()) { + guideView.showGuide(); + } + } + + private Point getBubbleLocation() { + Point point = SwingUtilities.convertPoint(GuideEntryPane.getGuideEntryPane(),0,0, guideView.getRootPane()); + Dimension size = GuideEntryPane.getGuideEntryPane().getSize(); + return new Point(point.x - 187,point.y + size.height); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryPane.java index ce43fef6e5..9353570a3c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryPane.java @@ -5,7 +5,6 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.guide.collect.GuideCollector; -import com.fr.design.mainframe.guide.ui.BubbleHintDialog; import com.fr.design.mainframe.guide.ui.GuideManageDialog; import com.fr.general.IOUtils; @@ -13,7 +12,6 @@ import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorListener; import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -53,10 +51,7 @@ public class GuideEntryPane extends BasicPane { @Override public void ancestorAdded(AncestorEvent event) { if (!GuideCollector.getInstance().isShowHint()) { - BubbleHintDialog dialog = BubbleHintDialog.getInstance(); - Point point = getLocationOnScreen(); - Dimension size = getSize(); - dialog.showDialog(new Point(point.x - 187,point.y + size.height)); + GuideEntryHint.getInstance().show(); } } From a259cd9bb847718b4d170b0a9cd94c39350ee7ba Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 11 Oct 2021 11:30:06 +0800 Subject: [PATCH 2/7] =?UTF-8?q?REPORT-60484=20=E8=A7=A3=E5=86=B3=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95=E4=BC=9A=E5=A4=9A?= =?UTF-8?q?=E6=AC=A1=E6=B3=A8=E5=86=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/guide/base/GuideManager.java | 4 ++++ .../java/com/fr/design/mainframe/guide/GuideRegister.java | 1 + 2 files changed, 5 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideManager.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideManager.java index e5d837b593..08c46688d8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideManager.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideManager.java @@ -106,4 +106,8 @@ public class GuideManager { } GuideCollector.getInstance().saveInfo(); } + + public void clearAll() { + guideVersionList.clear(); + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java index 8ed6f3a30f..537051153e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java @@ -12,6 +12,7 @@ import com.fr.design.mainframe.guide.creator.theme.ThemeToggleGuide; public class GuideRegister { public static void register() { GuideCollector.getInstance().loadFromFile(); + GuideManager.getInstance().clearAll(); registerGroup(); registerGuide(); } From fc3ff14763a58eb335c8374cd417f686379a23e6 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 11 Oct 2021 14:50:51 +0800 Subject: [PATCH 3/7] =?UTF-8?q?REPORT-60485=20=E8=A7=A3=E5=86=B3=E5=BC=95?= =?UTF-8?q?=E5=AF=BC=E9=A1=B5=E4=B8=AD=E6=A8=A1=E6=9D=BF=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E7=82=B9=E5=8F=96=E6=B6=88=E4=B9=9F=E6=98=BE=E7=A4=BA=E5=AE=8C?= =?UTF-8?q?=E6=88=90=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/base/Guide.java | 13 -------- .../guide/scene/AbstractGuideScene.java | 5 +-- .../guide/scene/GuideSceneLifecycle.java | 7 +++-- .../scene/GuideSceneLifecycleAdaptor.java | 4 +-- .../guide/creator/GuideSceneHelper.java | 31 ++++++++++++++++--- .../layout/ChangeLayoutComponentGuide.java | 3 +- .../layout/UseLayoutAndComponentGuide.java | 9 ++++-- .../theme/DownloadComponentPackageGuide.java | 9 ++++-- .../guide/creator/theme/ThemeToggleGuide.java | 9 ++++-- 9 files changed, 55 insertions(+), 35 deletions(-) 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 7f34950ad8..5bc37889d6 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,14 +10,10 @@ import javax.swing.SwingUtilities; import javax.swing.SwingWorker; public class Guide { - public enum GuideState { - NONE, DONE - } private String id; private String name; private String description; private String completeMessage; - private GuideState state; private GuideView guideView; private GuideLifecycle lifecycle; private boolean isComplete; @@ -31,7 +27,6 @@ public class Guide { this.id = id; this.name = name; this.description = description; - this.state = GuideState.NONE; } public String getId() { @@ -69,14 +64,6 @@ public class Guide { this.completeMessage = completeMessage; } - public GuideState getState() { - return state; - } - - public void setState(GuideState state) { - this.state = state; - } - public void setGuideView(GuideView guideView) { this.guideView = guideView; } 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 55c7511f4e..f0d74789d2 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 @@ -321,8 +321,9 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { public void complete() { container.getLayeredPane().remove(this); container.repaint(); - if (lifecycle != null) { - lifecycle.onComplete(); + + if (lifecycle != null && !lifecycle.onComplete()) { + return; } if (sceneFilter != null) { nextScene = sceneFilter.getFilterScene(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycle.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycle.java index 9b9e072780..36734a619f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycle.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycle.java @@ -4,7 +4,7 @@ public interface GuideSceneLifecycle { /** * 引导场景准备工作 * 给 scene 添加 target 应该在这个阶段处理 - * @return + * @return 返回true自动执行scene, 返回false需要手动触发 */ boolean prepared(); @@ -14,7 +14,8 @@ public interface GuideSceneLifecycle { void onShow(); /** - * scene 完成后 + * scene 交互完成后处理 + * @return 返回true自动进入下一个scene,返回false需要手动触发 */ - void onComplete(); + boolean onComplete(); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycleAdaptor.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycleAdaptor.java index 06c40ad11f..1ed99dca6f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycleAdaptor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycleAdaptor.java @@ -12,7 +12,7 @@ public abstract class GuideSceneLifecycleAdaptor implements GuideSceneLifecycle } @Override - public void onComplete() { - + public boolean onComplete() { + return 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 ac366b0648..ff80efcf9c 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 @@ -7,6 +7,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.CenterRegionContainerPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.guide.base.GuideManager; import com.fr.design.mainframe.guide.scene.ClickScene; import com.fr.design.mainframe.guide.scene.DisplayScene; @@ -15,6 +16,8 @@ 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; +import com.fr.design.worker.save.CallbackSaveWorker; +import com.fr.design.worker.save.EmptyCallBackSaveWorker; import java.awt.Window; @@ -43,9 +46,28 @@ public class GuideSceneHelper { } @Override - public void onComplete() { + public boolean onComplete() { GuideManager.getInstance().getCurrentGuide().getGuideView().dismissGuide(); - WebPreviewUtils.preview(DesignerContext.getDesignerFrame().getSelectedJTemplate()); + JTemplate jt = DesignerContext.getDesignerFrame().getSelectedJTemplate(); + jt.stopEditing(); + if (!jt.isSaved()) { + CallbackSaveWorker worker = jt.save2Env(); + if (worker instanceof EmptyCallBackSaveWorker) { + GuideManager.getInstance().getCurrentGuide().terminate(); + } else { + worker.addSuccessCallback(new Runnable() { + @Override + public void run() { + WebPreviewUtils.preview(jt); + GuideManager.getInstance().getCurrentGuide().complete(); + } + }); + } + worker.start(jt.getRuntimeId()); + return false; + } + WebPreviewUtils.preview(jt); + return true; } }); return scene; @@ -56,7 +78,6 @@ public class GuideSceneHelper { 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); @@ -64,12 +85,12 @@ public class GuideSceneHelper { } @Override - public void onComplete() { - super.onComplete(); + public boolean onComplete() { FormDesigner designer = GuideCreateUtils.getFormDesigner(); XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner(widgetName); designer.getSelectionModel().reset(); designer.getSelectionModel().selectACreator(xCreator); + return true; } }); return scene; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java index c3c736ae1a..335837196a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java @@ -141,7 +141,7 @@ public class ChangeLayoutComponentGuide { } @Override - public void onComplete() { + public boolean onComplete() { FormDesigner formDesigner = GuideCreateUtils.getFormDesigner(); XCreator from = GuideCreateUtils.getXCreatorFormDesigner(TARGET_FROM_NAME); @@ -152,6 +152,7 @@ public class ChangeLayoutComponentGuide { GuideCreateUtils.addXCreatorToXLayoutContainer(from, (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner("box1"), true); GuideCreateUtils.addXCreatorToXLayoutContainer(to, (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner("box0"), true); + return true; } }); return scene; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java index aae059f2c3..6234ea7902 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java @@ -115,9 +115,10 @@ public class UseLayoutAndComponentGuide { } @Override - public void onComplete() { + public boolean onComplete() { newFormPane = new NewFormPane(); GuideCreateUtils.showDialogWithoutModal(newFormPane.getWindow()); + return true; } }); return scene; @@ -174,9 +175,10 @@ public class UseLayoutAndComponentGuide { } @Override - public void onComplete() { + public boolean onComplete() { newFormPane.createLayoutForm(); newFormPane.getWindow().dispose(); + return true; } }); return scene; @@ -209,11 +211,12 @@ public class UseLayoutAndComponentGuide { } @Override - public void onComplete() { + public boolean onComplete() { LocalWidgetBlock block = getLocalWidgetBlock(shareID); XCreator xCreator = block.transformXCreator(block); XOccupiedLayout xOccupiedLayout = getXOccupiedLayout(name); GuideCreateUtils.addXCreatorToXLayoutContainer(xCreator, xOccupiedLayout, false); + return true; } }); return scene; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java index 3305803569..d36506c94c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java @@ -157,8 +157,9 @@ public class DownloadComponentPackageGuide { } @Override - public void onComplete() { + public boolean onComplete() { FormWidgetDetailPane.getInstance().swich2Online(); + return true; } }); return scene; @@ -221,13 +222,14 @@ public class DownloadComponentPackageGuide { } @Override - public void onComplete() { + public boolean onComplete() { downLoadTheme(); themeConfirmDialog = GuideCreateUtils.showConfirmDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Share_Apply_Suitable_Theme_Tip"), Toolkit.i18nText("Fine-Design_Basic_Confirm"), FineJOptionPane.OK_CANCEL_OPTION); + return true; } }); return scene; @@ -264,12 +266,13 @@ public class DownloadComponentPackageGuide { } @Override - public void onComplete() { + public boolean onComplete() { closeConfirmDialog(); JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); TemplateThemeConfig config = template.getUsingTemplateThemeConfig(); TemplateTheme theme = config.cachedFetch(downloadThemeName); template.setTemplateTheme(theme); + return true; } }); 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 1d573cf2b3..177fecc4b2 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 @@ -86,8 +86,9 @@ public class ThemeToggleGuide { } @Override - public void onComplete() { + public boolean onComplete() { showTemplateThemeUsingDialog(); + return true; } }); @@ -142,8 +143,9 @@ public class ThemeToggleGuide { } @Override - public void onComplete() { + public boolean onComplete() { GuideCreateUtils.selectXCreatorByWidgetName(TARGET_XCREATOR_NAME); + return true; } }); return scene; @@ -179,10 +181,11 @@ public class ThemeToggleGuide { } @Override - public void onComplete() { + public boolean onComplete() { if (uiButtonGroup[0] != null) { uiButtonGroup[0].setSelectedIndex(0); } + return true; } }); return scene; From e1ec51d5062d00484a49baf232f8a4efac951a43 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 11 Oct 2021 21:07:23 +0800 Subject: [PATCH 4/7] =?UTF-8?q?REPORT-60693=20=E5=BC=80=E5=90=AF=E5=BC=95?= =?UTF-8?q?=E5=AF=BC=E7=9A=84=E6=97=B6=E5=80=99=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=9C=80=E5=A4=A7=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/guide/base/Guide.java | 3 +++ 1 file changed, 3 insertions(+) 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 5bc37889d6..9469f931a1 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 @@ -1,11 +1,13 @@ package com.fr.design.mainframe.guide.base; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.guide.collect.GuideCollector; import com.fr.design.mainframe.guide.scene.GuideScene; import com.fr.design.mainframe.guide.ui.GuideCompleteDialog; import com.fr.design.mainframe.guide.ui.GuideManageDialog; import com.fr.stable.StringUtils; +import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; @@ -92,6 +94,7 @@ public class Guide { * 开启引导流程 */ public void go() { + DesignerContext.getDesignerFrame().setExtendedState(JFrame.MAXIMIZED_BOTH); // 同时只能启动一个引导 if (GuideManager.getInstance().getCurrentGuide() != null) { return; From 8c9aca1a7911abf87c33cf279d0cca4821117a4e Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 11 Oct 2021 21:13:40 +0800 Subject: [PATCH 5/7] =?UTF-8?q?REPORT-60492=20&&=20REPORT-60480=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3window=E4=B8=8A=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=92=8C=E9=94=99=E4=BD=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/guide/base/GuideView.java | 57 +++++++------------ 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java index d6ff17cbc7..aa277adbbf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java @@ -5,17 +5,15 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.guide.scene.AbstractGuideScene; import com.fr.design.mainframe.guide.scene.GuideScene; import com.fr.design.mainframe.guide.ui.GuideLoadingGlassPane; +import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.JDialog; import javax.swing.SwingUtilities; import java.awt.Color; import java.awt.Graphics; import java.awt.Window; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; +import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.awt.event.WindowFocusListener; public class GuideView extends JDialog { private static GuideView guideView; @@ -43,32 +41,19 @@ public class GuideView extends JDialog { this.setLayout(FRGUIPaneFactory.createBorderLayout()); setBg(); this.setGlassPane(new GuideLoadingGlassPane()); - } - - private WindowFocusListener windowFocusListener = new WindowFocusListener() { - @Override - public void windowGainedFocus(WindowEvent e) { - requestFocus(); - setLocationRelativeTo(window); - } - - @Override - public void windowLostFocus(WindowEvent e) { - - } - }; - - private ComponentListener componentListener = new ComponentAdapter() { - @Override - public void componentResized(ComponentEvent e) { - setLocationRelativeTo(window); - } + DesignerContext.getDesignerFrame().addWindowListener(new WindowAdapter() { - @Override - public void componentMoved(ComponentEvent e) { - setLocation(window.getLocation()); - } - }; + @Override + public void windowDeiconified(WindowEvent e) { + if (isVisible()) { + updateGuideViewLocation(); + // window 带透明的dialog在窗口最小化后再打开会不渲染,这边试了下重新设置visible可行 + setVisible(false); + setVisible(true); + } + } + }); + } public GuideView(Window window, Guide guide) { this(window); @@ -98,11 +83,7 @@ public class GuideView extends JDialog { } public void showGuide() { - window.addComponentListener(componentListener); - window.addWindowFocusListener(windowFocusListener); - this.setLocationRelativeTo(window); - this.setSize(window.getSize()); - this.setLocation(window.getLocation()); + updateGuideViewLocation(); this.setVisible(true); if (scene != null) { scene.start(); @@ -112,8 +93,6 @@ public class GuideView extends JDialog { } public void dismissGuide() { - window.removeComponentListener(componentListener); - window.removeWindowFocusListener(windowFocusListener); this.getLayeredPane().removeAll(); revalidate(); repaint(); @@ -127,6 +106,7 @@ public class GuideView extends JDialog { } public void showLoading() { + updateGuideViewLocation(); this.setVisible(true); this.getGlassPane().setVisible(true); } @@ -141,4 +121,9 @@ public class GuideView extends JDialog { } }); } + + private void updateGuideViewLocation() { + GUICoreUtils.centerWindow(window, this); + this.setSize(getSize()); + } } From e6460ff3cf97e8c6faf216caeb211f91ee7e2858 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 11 Oct 2021 21:16:21 +0800 Subject: [PATCH 6/7] =?UTF-8?q?REPORT-60477=20=E5=AE=8C=E6=88=90=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=9A=84=E6=8C=89=E9=92=AE=E6=9C=89=E9=87=8D=E5=BD=B1?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8UIButton=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../guide/ui/GuideCompleteDialog.java | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java index 3da6beb5f2..29316652da 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java @@ -1,15 +1,17 @@ package com.fr.design.mainframe.guide.ui; import com.fr.design.gui.frpane.UITextPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.IOUtils; import javax.swing.BorderFactory; import javax.swing.Icon; -import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.SwingConstants; @@ -20,6 +22,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; +import java.awt.Graphics2D; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -83,13 +86,15 @@ public class GuideCompleteDialog extends JDialog { buttonContainer.setPreferredSize(new Dimension(190,38)); buttonContainer.setOpaque(false); - JButton button = new JButton(Toolkit.i18nText("Fine-Design_Guide_Complete_End")); - button.setPreferredSize(new Dimension(122, 38)); - button.setBackground(BUTTON_BG_COLOR); + UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Complete_End")){ + @Override + public Dimension getPreferredSize() { + return new Dimension(122, 38); + } + }; + button.setUI(confirmButtonUI); + button.setRoundBorder(true); button.setForeground(Color.WHITE); - button.setBorder(null); - button.setContentAreaFilled(false); - button.setOpaque(true); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -114,4 +119,16 @@ public class GuideCompleteDialog extends JDialog { repaint(); this.setVisible(true); } + + private UIButtonUI confirmButtonUI = new UIButtonUI() { + protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { + if (isPressed(b) && b.isPressedPainted()) { + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), BUTTON_BG_COLOR); + } else if (isRollOver(b)) { + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), BUTTON_BG_COLOR); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), BUTTON_BG_COLOR); + } + } + }; } From b10a645f2f5e3a051b9d08c943b203bca94fedeb Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 11 Oct 2021 22:39:19 +0800 Subject: [PATCH 7/7] =?UTF-8?q?REPORT-60489=20=E4=B8=BB=E9=A2=98=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=BC=95=E5=AF=BC=E9=95=BF=E6=8C=89=E6=BB=91=E5=8A=A8?= =?UTF-8?q?=E6=97=B6=E5=80=99=E4=BC=9A=E6=9C=89=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/guide/scene/ClickScene.java | 17 ++++++++++++++++- .../theme/TemplateThemeGridPagesPane.java | 2 ++ .../dialog/TemplateThemeGridPagesDialog.java | 1 - .../guide/creator/theme/ThemeToggleGuide.java | 6 ++---- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java index 735b007361..6217f41e7b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java @@ -88,6 +88,20 @@ public class ClickScene extends AbstractGuideScene{ redispatchMouseEvent(e, target); } } + + @Override + public void mouseEntered(MouseEvent e) { + if (isDispatch) { + redispatchMouseEvent(e, target); + } + } + + @Override + public void mouseExited(MouseEvent e) { + if (isDispatch) { + redispatchMouseEvent(e, target); + } + } }); } @@ -99,10 +113,11 @@ public class ClickScene extends AbstractGuideScene{ @Override public void showScene() { - super.showScene(); // 交互类的 scene 如果没有高亮内容块载,需要及时终止Guide,否则就没法去掉模态框影响到设计器主功能的使用了 if (this.getComponentCount() == 0) { GuideManager.getInstance().getCurrentGuide().terminate(); + } else { + super.showScene(); } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java index a76ec12c6f..855e2bf785 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java @@ -51,6 +51,7 @@ import java.util.Set; * Created by Starryi on 2021/10/9 */ public class TemplateThemeGridPagesPane extends JPanel { + public static final String COMPLETE_BUTTON = "theme_button_complete"; private BreadcrumbBar breadcrumbBar; private JPanel contentPane; private CardLayout cardLayout; @@ -176,6 +177,7 @@ public class TemplateThemeGridPagesPane extends JPanel { private UIButton createCompleteButton() { UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Complete")); + button.setName(COMPLETE_BUTTON); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java index 2c43c2a024..9711e8e8ad 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java @@ -16,7 +16,6 @@ import javax.swing.JPanel; * Created by Starryi on 2021/8/13 */ public class TemplateThemeGridPagesDialog extends TemplateThemeDialog implements TemplateThemeGridPagesPane.PageChangeListener { - public static final String COMPLETE_BUTTON = "theme_button_complete"; public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 40; public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37; 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 91f3ae08ba..2387a470c5 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 @@ -1,6 +1,5 @@ package com.fr.design.mainframe.guide.creator.theme; -import com.fr.base.theme.FormTheme; import com.fr.base.theme.FormThemeConfig; import com.fr.base.theme.TemplateTheme; import com.fr.design.file.HistoryTemplateListCache; @@ -8,8 +7,6 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.style.FollowingThemePane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.CenterRegionContainerPane; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.guide.GuideIds; import com.fr.design.mainframe.guide.base.Guide; @@ -24,6 +21,7 @@ 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.mainframe.theme.TemplateThemeBlock; +import com.fr.design.mainframe.theme.TemplateThemeGridPagesPane; import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; import com.fr.design.utils.ComponentUtils; @@ -137,7 +135,7 @@ public class ThemeToggleGuide { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { @Override public boolean prepared() { - scene.addClickTarget(ComponentUtils.findComponentByName(themeDialog, TemplateThemeUsingDialog.COMPLETE_BUTTON), ClickScene.ClickType.LEFT, true); + scene.addClickTarget(ComponentUtils.findComponentByName(themeDialog, TemplateThemeGridPagesPane.COMPLETE_BUTTON), ClickScene.ClickType.LEFT, true); scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Complete"), BubbleTip.Direction.TOP); return true; }