Harrison
2 years ago
4 changed files with 195 additions and 0 deletions
@ -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<Operation> 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<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