From a3f21099d59068f836e11aafb2f31c03a634edc3 Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 18 Aug 2022 18:38:43 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-76068=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E3=80=90=E8=B5=B7=E5=A7=8B=E9=A1=B5=E3=80=91=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E6=B2=A1=E8=AE=B0=20=E6=9B=B4=E6=94=B9=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E6=96=B9=E6=A1=88=EF=BC=8C=E5=9C=A8=E4=B8=BB=20JAR=20?= =?UTF-8?q?=E4=B8=AD=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/startup/metric/DesignerMetrics.java | 6 + .../metric/DesignerStartupPageStatistic.java | 172 ++++++++++++++++++ .../com/fr/startup/ui/StartupPageWindow.java | 5 + .../startup/ui/StartupPageWorkspacePanel.java | 12 ++ 4 files changed, 195 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/startup/metric/DesignerStartupPageStatistic.java diff --git a/designer-base/src/main/java/com/fr/startup/metric/DesignerMetrics.java b/designer-base/src/main/java/com/fr/startup/metric/DesignerMetrics.java index e62609279d..aa7391df7e 100644 --- a/designer-base/src/main/java/com/fr/startup/metric/DesignerMetrics.java +++ b/designer-base/src/main/java/com/fr/startup/metric/DesignerMetrics.java @@ -7,6 +7,8 @@ public class DesignerMetrics { private DesignerStartupModel model = new DesignerStartupModel(); + private DesignerStartupPageStatistic statistic = new DesignerStartupPageStatistic(); + public DesignerMetrics() { } @@ -14,4 +16,8 @@ public class DesignerMetrics { return model; } + public DesignerStartupPageStatistic getStatistic() { + return statistic; + } + } diff --git a/designer-base/src/main/java/com/fr/startup/metric/DesignerStartupPageStatistic.java b/designer-base/src/main/java/com/fr/startup/metric/DesignerStartupPageStatistic.java new file mode 100644 index 0000000000..f53d8656ad --- /dev/null +++ b/designer-base/src/main/java/com/fr/startup/metric/DesignerStartupPageStatistic.java @@ -0,0 +1,172 @@ +package com.fr.startup.metric; + +import com.fr.start.common.DesignerStartupContext; +import com.fr.startup.ui.StartupPageModel; + +import java.util.ArrayDeque; +import java.util.Deque; + +/** + * 设计器启动页使用数据 + * + * created by Harrison on 2022/08/12 + **/ +public class DesignerStartupPageStatistic { + + private final Deque operations = new ArrayDeque<>(); + + public void recordOpenEmptyTemplate() { + + Operation operation = OperationType.DO_OPEN_EMPTY_TEMPLATE.create(); + StartupPageModel pageModel = DesignerStartupContext.getInstance().getStartupPageModel(); + operation.setWorkspace(pageModel.getSelectWorkspaceInfo().getName()); + operation.setWorkspaceNum(pageModel.getWorkspaceInfos().size()); + pushOperation(operation); + } + + public void recordSwitchWorkspace() { + + Operation operation = OperationType.DO_SWITCH_WORKSPACE.create(); + StartupPageModel pageModel = DesignerStartupContext.getInstance().getStartupPageModel(); + operation.setWorkspace(pageModel.getSelectWorkspaceInfo().getName()); + operation.setWorkspaceNum(pageModel.getWorkspaceInfos().size()); + pushOperation(operation); + } + + public void recordShowAllAction() { + + Operation operation = OperationType.DO_SHOW_ALL_ACTION.create(); + StartupPageModel pageModel = DesignerStartupContext.getInstance().getStartupPageModel(); + operation.setWorkspaceNum(pageModel.getWorkspaceInfos().size()); + pushOperation(operation); + } + + public void recordOpenLastTemplate(String lastOpenFile) { + + Operation operation = OperationType.DO_OPEN_LAST_TEMPLATE_ACTION.create(); + StartupPageModel pageModel = DesignerStartupContext.getInstance().getStartupPageModel(); + operation.setWorkspaceNum(pageModel.getWorkspaceInfos().size()); + operation.setTemplate(lastOpenFile); + pushOperation(operation); + } + + public void pushOperation(Operation operation) { + + this.operations.push(operation); + } + + public Deque getOperations() { + + return this.operations; + } + + public enum OperationType { + + /** + * 双击工作目录进入 或 点击蓝色箭头进入 + */ + DO_OPEN_EMPTY_TEMPLATE(0), + + /** + * 切换其他工作目录 + */ + DO_SWITCH_WORKSPACE(1), + + /** + * 点击展开全部 + */ + DO_SHOW_ALL_ACTION(2), + + /** + * 点击工作目录中的模版直接打开 或 直接点击蓝色箭头进入 + */ + DO_OPEN_LAST_TEMPLATE_ACTION(3); + + private final int sign; + + OperationType(int sign) { + this.sign = sign; + } + + public int getSign() { + return sign; + } + + public Operation create() { + + Operation operation = new Operation(); + operation.setOperateType(this); + return operation; + } + } + + public static class Operation { + + /** + * operate:0-双击工作目录进入 或 点击蓝色箭头进入;1-切换其他工作目录;2-点击展开全部;3-点击工作目录中的模版直接打开 或 直接点击蓝色箭头进入 + */ + private int operate; + + /** + * workplace:工作目录名称,当operate为 0或1时记录 + */ + private String workspace; + + /** + * workplaceNumber:工作目录的个数,当operate为 0或1或2或3时记录 + */ + private int workspaceNum; + + /** + * template:模板名称,当operate为 3时记录 + */ + private String template; + + public Operation(int operate, String workspace, int workspaceNum, String template) { + this.operate = operate; + this.workspace = workspace; + this.workspaceNum = workspaceNum; + this.template = template; + } + + public Operation() { + } + + public int getOperate() { + return operate; + } + + public void setOperateType(OperationType operateType) { + this.operate = operateType.getSign(); + } + + public void setOperate(int operate) { + this.operate = operate; + } + + public String getWorkspace() { + return workspace; + } + + public void setWorkspace(String workspace) { + this.workspace = workspace; + } + + public int getWorkspaceNum() { + return workspaceNum; + } + + public void setWorkspaceNum(int workspaceNum) { + this.workspaceNum = workspaceNum; + } + + public String getTemplate() { + return template; + } + + public void setTemplate(String template) { + this.template = template; + } + } + +} diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java index e62005b283..cb0442abd8 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java @@ -18,6 +18,8 @@ import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ProductConstants; import com.fr.stable.collections.CollectionUtils; +import com.fr.start.common.DesignerStartupContext; +import com.fr.startup.metric.DesignerMetrics; import org.jetbrains.annotations.NotNull; import javax.swing.BorderFactory; @@ -392,6 +394,9 @@ public class StartupPageWindow extends JFrame { DesignerEnvManager.getEnvManager().setLastOpenFile(recentFile); pageModel.getOpenLastTemplateRunnable().run(); + + DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); + designerMetrics.getStatistic().recordOpenLastTemplate(recentFile); } } diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java index de1e5f62be..14e2e09208 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java @@ -7,6 +7,8 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.ColorUtils; +import com.fr.start.common.DesignerStartupContext; +import com.fr.startup.metric.DesignerMetrics; import com.fr.third.guava.collect.Lists; import org.jetbrains.annotations.NotNull; @@ -539,12 +541,19 @@ public class StartupPageWorkspacePanel extends JPanel { pageModel.setSelectWorkspaceInfo(workspaceInfo); openEmptyTemplateRunnable.run(); + + DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); + designerMetrics.getStatistic().recordOpenEmptyTemplate(); } private void doSwitchWorkspace(StartupWorkspaceBean workspaceInfo) { + // selectWorkspaceRunnable pageModel.setSelectWorkspaceInfo(workspaceInfo); selectWorkspaceRunnable.run(); + + DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); + designerMetrics.getStatistic().recordSwitchWorkspace(); } private void doShowAllAction(UILabel fontLabel, UILabel iconLabel) { @@ -560,6 +569,9 @@ public class StartupPageWorkspacePanel extends JPanel { showLessContent(); showMore = !showMore; } + DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); + designerMetrics.getStatistic().recordShowAllAction(); + repaintAll(); }