Browse Source

REPORT-79271 feat:兼容处理调整为新增功能点

newui
Carlson 1 year ago
parent
commit
0c4d429488
  1. 39
      designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java
  2. 13
      designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java

39
designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java

@ -3,6 +3,9 @@ package com.fr.design.mainframe.chart.mode;
import com.fr.common.annotations.Open;
import com.fr.design.base.mode.DesignModeContext;
import java.util.HashSet;
import java.util.Set;
/**
* @author shine
* @version 10.0
@ -13,28 +16,21 @@ public class ChartEditContext {
private static ChartEditMode current = ChartEditMode.NORMAL;
private static ChartEditSupportDataType supportDataType = ChartEditSupportDataType.BOTH;
private static final Set<DuchampFeature> features = new HashSet<>();
/**
* 切换图表编辑模式
* @param mode 图表编辑模式
* 功能点枚举
*/
public static void switchTo(ChartEditMode mode) {
if (mode == ChartEditMode.NORMAL) {
switchTo(mode, ChartEditSupportDataType.BOTH);
} else if (mode == ChartEditMode.DUCHAMP) {
switchTo(mode, ChartEditSupportDataType.TABLE_DATA);
}
public enum DuchampFeature {
SUPPORT_REPORT_DATA
}
/**
* 切换图表编辑模式
* @param mode 图表编辑模式
* @param type 图表支持的数据来源
*/
public static void switchTo(ChartEditMode mode, ChartEditSupportDataType type) {
public static void switchTo(ChartEditMode mode) {
current = mode;
supportDataType = type;
}
public static boolean duchampMode() {
@ -54,10 +50,27 @@ public class ChartEditContext {
return !DesignModeContext.isDuchampMode();
}
/**
* 注册功能点
*/
public static void addDuchampFeature(DuchampFeature feature) {
features.add(feature);
}
/**
* 移除功能点
*/
public static void removeDuchampFeature(DuchampFeature feature) {
features.remove(feature);
}
/**
* 当前模式下是否支持单元格数据来源
*/
public static boolean supportReportData() {
return supportDataType == ChartEditSupportDataType.REPORT || supportDataType == ChartEditSupportDataType.BOTH;
if (normalMode()) {
return true;
}
return features.contains(DuchampFeature.SUPPORT_REPORT_DATA);
}
}

13
designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java

@ -1,13 +0,0 @@
package com.fr.design.mainframe.chart.mode;
/**
* @author Carlson
* @version 11.0
* Created by Carlson on 2023/8/1 14:25
* @description 图表数据来源兼容用
**/
public enum ChartEditSupportDataType {
TABLE_DATA, // 数据集数据
REPORT, // 单元格数据
BOTH // 包含二者
}
Loading…
Cancel
Save