Browse Source
Merge in DESIGN/design from ~HARRISON/design:feature/x to feature/x * commit 'c984ad0633e740b6c259d71c884b2a9d74eb9e87': REPORT-76068【迭代】【起始页】埋点没记 - 对切换的定义做一个明确 - 补充注释 REPORT-76068【迭代】【起始页】埋点没记 更改埋点方案,在主 JAR 中记录feature/x
Harrison
2 years ago
4 changed files with 223 additions and 0 deletions
@ -0,0 +1,199 @@
|
||||
package com.fr.startup.metric; |
||||
|
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.start.common.DesignerStartupContext; |
||||
import com.fr.startup.ui.StartupPageModel; |
||||
import com.fr.startup.ui.StartupWorkspaceBean; |
||||
|
||||
import java.util.ArrayDeque; |
||||
import java.util.Deque; |
||||
|
||||
/** |
||||
* 设计器启动页使用数据 |
||||
* |
||||
* created by Harrison on 2022/08/12 |
||||
**/ |
||||
public class DesignerStartupPageStatistic { |
||||
|
||||
private final Deque<Operation> operations = new ArrayDeque<>(); |
||||
|
||||
/** |
||||
* 见 {@link OperationType} 的注释 |
||||
*/ |
||||
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); |
||||
} |
||||
|
||||
/** |
||||
* 见 {@link OperationType} 的注释 |
||||
*/ |
||||
public void recordSwitchWorkspace(StartupWorkspaceBean lastWorkspaceInfo, StartupWorkspaceBean currentWorkspace) { |
||||
|
||||
if (lastWorkspaceInfo != null && StringUtils.equals(lastWorkspaceInfo.getName(), currentWorkspace.getName())) { |
||||
return; |
||||
} |
||||
Operation operation = OperationType.DO_SWITCH_WORKSPACE.create(); |
||||
StartupPageModel pageModel = DesignerStartupContext.getInstance().getStartupPageModel(); |
||||
operation.setWorkspace(currentWorkspace.getName()); |
||||
operation.setWorkspaceNum(pageModel.getWorkspaceInfos().size()); |
||||
pushOperation(operation); |
||||
} |
||||
|
||||
/** |
||||
* 见 {@link OperationType} 的注释 |
||||
*/ |
||||
public void recordShowAllAction() { |
||||
|
||||
Operation operation = OperationType.DO_SHOW_ALL_ACTION.create(); |
||||
StartupPageModel pageModel = DesignerStartupContext.getInstance().getStartupPageModel(); |
||||
operation.setWorkspaceNum(pageModel.getWorkspaceInfos().size()); |
||||
pushOperation(operation); |
||||
} |
||||
|
||||
/** |
||||
* 见 {@link OperationType} 的注释 |
||||
*/ |
||||
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); |
||||
} |
||||
|
||||
/** |
||||
* 添加操作 |
||||
* |
||||
* @param operation 操作 |
||||
*/ |
||||
public void pushOperation(Operation operation) { |
||||
|
||||
this.operations.push(operation); |
||||
} |
||||
|
||||
/** |
||||
* 获取操作 |
||||
* |
||||
* @return 操作 |
||||
*/ |
||||
public Deque<Operation> 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; |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue