|
|
|
@ -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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|