Link.Zhao
2 years ago
37 changed files with 2097 additions and 200 deletions
@ -0,0 +1,99 @@
|
||||
package com.fr.design.mainframe.theme.utils; |
||||
|
||||
import com.fr.base.CloneTransformer; |
||||
import com.fr.base.NameStyle; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.theme.FineColorSynchronizer; |
||||
import com.fr.base.theme.TemplateTheme; |
||||
import com.fr.base.theme.settings.ThemedCellStyle; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2022/9/21 |
||||
* |
||||
* 如果粘贴到的模板主题单元格样式与复制过来的主题单元格样式不同,那么需要转换复制过来的主题单元格样式为自定义样式,以保持被复制的样式。 |
||||
* 转换非主题单元格样式内的主题色,以及单元格内的其他主题色,为自定义色 |
||||
*/ |
||||
public class CellElementStylePaster { |
||||
|
||||
/** |
||||
* 为没有实现FCloneable接口的类而抽象出的clone方法包装接口, |
||||
* 使用者需要实现此接口方法,调用真正的clone方法. |
||||
* @param <T> |
||||
*/ |
||||
private interface CloneExecutor<T> { |
||||
T clone(T o) throws Exception; |
||||
} |
||||
private static boolean needConvertThemedStyleToCustomStyle(NameStyle nameStyle) { |
||||
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentOpeningOrEditingTemplate(); |
||||
if (template != null) { |
||||
TemplateTheme theme = template.getTemplateTheme(); |
||||
if (theme != null) { |
||||
ThemedCellStyle themedCellStyle = theme.getCellStyleList().find(nameStyle.getName()); |
||||
return !nameStyle.getRealStyle().equals(themedCellStyle.getStyle()); |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
|
||||
private static <T> T convertThemedColorToCustomColor(T o, CloneExecutor<T> executor) { |
||||
CloneTransformer.setTransformer(new FineColorSynchronizer.FineColorTransformer(fineColor -> { |
||||
fineColor.setHor(-1); |
||||
fineColor.setVer(-1); |
||||
})); |
||||
|
||||
Object cloned = null; |
||||
try { |
||||
cloned = executor.clone(o); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
|
||||
CloneTransformer.clearTransformer(); |
||||
return (T) cloned; |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @param cellElement 粘贴到的单元格 |
||||
* @return |
||||
* 如果粘贴到的模板主题单元格样式与复制过来的主题单元格样式不同,那么需要转换复制过来的主题单元格样式为自定义样式,以保持被复制的样式。 |
||||
* 转换非主题单元格样式内的主题色,以及单元格内的其他主题色,为自定义色 |
||||
*/ |
||||
public static TemplateCellElement convertStyleAndColor(TemplateCellElement cellElement) { |
||||
Style backupStyle = cellElement.getStyle(); |
||||
cellElement = convertThemedColorToCustomColor(cellElement, o -> (TemplateCellElement) o.clone()); |
||||
|
||||
Style style = convertStyleAndColor(backupStyle); |
||||
cellElement.setStyle(style); |
||||
|
||||
return cellElement; |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @param style |
||||
* @return |
||||
* 如果粘贴到的模板主题单元格样式与复制过来的主题单元格样式不同,那么需要转换复制过来的主题单元格样式为自定义样式,以保持被复制的样式。 |
||||
* 转换非主题单元格样式内的主题色 |
||||
*/ |
||||
public static Style convertStyleAndColor(Style style) { |
||||
if (style instanceof NameStyle) { |
||||
NameStyle nameStyle = (NameStyle) style; |
||||
if (needConvertThemedStyleToCustomStyle(nameStyle)) { |
||||
style = nameStyle.getRealStyle(); |
||||
} |
||||
} |
||||
if (!(style instanceof NameStyle)) { |
||||
style = convertThemedColorToCustomColor(style, o -> (Style) o.clone()); |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
} |
@ -0,0 +1,128 @@
|
||||
package com.fr.design.actions.replace.action.content.formula; |
||||
|
||||
import com.fr.chart.chartdata.MeterReportDefinition; |
||||
import com.fr.design.actions.replace.info.DealWithInfoValue; |
||||
import com.fr.design.actions.replace.info.Info; |
||||
import com.fr.design.actions.replace.info.base.SearchTag; |
||||
import com.fr.design.actions.replace.utils.ShowValueUtils; |
||||
import com.fr.general.GeneralUtils; |
||||
import com.fr.plugin.chart.map.data.VanMapReportDefinition; |
||||
import com.fr.stable.collections.combination.Pair; |
||||
import org.jetbrains.annotations.Nullable; |
||||
|
||||
import java.util.List; |
||||
|
||||
|
||||
/** |
||||
* 针对特殊类型进行处理,负责公式校验(公式设置值时如果是new一个新的公式都要放进来这里根据持有对象来校验) |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public enum FormulaTag implements DealWithInfoValue { |
||||
/** |
||||
* 经度 |
||||
*/ |
||||
CHART_DATA_LONGITUDE(SearchTag.CHART_DATA_LONGITUDE) { |
||||
@Override |
||||
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) { |
||||
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) { |
||||
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject(); |
||||
definition.setLongitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getLongitude()), findStr, replaceStr)); |
||||
} |
||||
} |
||||
}, |
||||
/** |
||||
* 纬度 |
||||
*/ |
||||
CHART_DATA_LATITUDE(SearchTag.CHART_DATA_LATITUDE) { |
||||
@Override |
||||
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) { |
||||
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) { |
||||
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject(); |
||||
definition.setLatitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getLatitude()), findStr, replaceStr)); |
||||
} |
||||
} |
||||
}, |
||||
/** |
||||
* 区域名 |
||||
*/ |
||||
CHART_AREA_NAME(SearchTag.CHART_AREA_NAME) { |
||||
@Override |
||||
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) { |
||||
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) { |
||||
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject(); |
||||
definition.setCategoryName(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getCategoryName()), findStr, replaceStr)); |
||||
} |
||||
} |
||||
}, |
||||
/** |
||||
* 终点经度 |
||||
*/ |
||||
CHART_DATA_END_LONGITUDE(SearchTag.CHART_DATA_END_LONGITUDE) { |
||||
@Override |
||||
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) { |
||||
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) { |
||||
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject(); |
||||
definition.setEndLongitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getEndLongitude()), findStr, replaceStr)); |
||||
} |
||||
} |
||||
}, |
||||
/** |
||||
* 终点纬度 |
||||
*/ |
||||
CHART_DATA_END_LATITUDE(SearchTag.CHART_DATA_END_LATITUDE) { |
||||
@Override |
||||
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) { |
||||
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) { |
||||
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject(); |
||||
definition.setEndLatitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getEndLatitude()), findStr, replaceStr)); |
||||
} |
||||
} |
||||
}, |
||||
/** |
||||
* 终点区域名 |
||||
*/ |
||||
CHART_AREA_END_NAME(SearchTag.CHART_AREA_END_NAME) { |
||||
@Override |
||||
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) { |
||||
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) { |
||||
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject(); |
||||
definition.setEndAreaName(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getEndAreaName()), findStr, replaceStr)); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
int index; |
||||
|
||||
FormulaTag(int index) { |
||||
this.index = index; |
||||
} |
||||
|
||||
/** |
||||
* 匹配 |
||||
* |
||||
* @param index |
||||
* @return |
||||
*/ |
||||
@Nullable |
||||
public static FormulaTag match(int index) { |
||||
FormulaTag[] values = FormulaTag.values(); |
||||
for (FormulaTag value : values) { |
||||
if (value.index == index) { |
||||
return value; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
abstract public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray); |
||||
|
||||
@Override |
||||
public String getInfoShowStr(Info info) { |
||||
return info.getContent().getOldShowStr(); |
||||
} |
||||
} |
@ -0,0 +1,95 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportDetailedDefinition; |
||||
import com.fr.plugin.chart.box.data.VanBoxReportResultDefinition; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 箱型图 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartBoxDataFormulaAction implements SearchChartDataFormula { |
||||
|
||||
private SearchChartBoxDataFormulaAction() { |
||||
} |
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof VanBoxReportDefinition) { |
||||
VanBoxReportDefinition definition = (VanBoxReportDefinition) provider; |
||||
//明细数据
|
||||
ITContent detailContent = ITContent.copy(content); |
||||
detailContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Detailed_Data")); |
||||
dealDetailDefinition(formulaInfos, detailContent, definition.getDetailedDefinition()); |
||||
//结果数据
|
||||
ITContent resultContent = ITContent.copy(content); |
||||
resultContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Result_Data")); |
||||
dealResultDefinition(formulaInfos, resultContent, definition.getResultDefinition()); |
||||
} |
||||
} |
||||
|
||||
private void dealResultDefinition(List<FormulaInfo> formulaInfos, ITContent content, VanBoxReportResultDefinition resultDefinition) { |
||||
//分类
|
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Category"), resultDefinition.getCategoryName()); |
||||
//系列名
|
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Name"), resultDefinition.getSeriesName()); |
||||
//最大值
|
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Data_Max"), resultDefinition.getMax()); |
||||
//上四分位数
|
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Data_Q3"), resultDefinition.getQ3()); |
||||
//中位数
|
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Data_Median"), resultDefinition.getMedian()); |
||||
//下四分位数
|
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Data_Q1"), resultDefinition.getQ1()); |
||||
//最小值
|
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Min_Value"), resultDefinition.getMin()); |
||||
|
||||
} |
||||
|
||||
private void dealDetailDefinition(List<FormulaInfo> formulaInfos, ITContent content, VanBoxReportDetailedDefinition detailedDefinition) { |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Category_Name"), detailedDefinition.getCategoryName()); |
||||
SearchChartMapDataFormulaAction.dealSeriesDefinition(formulaInfos, content, detailedDefinition.getSeriesList()); |
||||
} |
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartBoxDataFormulaAction getInstance() { |
||||
return SearchChartBoxDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartBoxDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartBoxDataFormulaAction instance; |
||||
|
||||
SearchChartBoxDataFormulaActionEnum() { |
||||
instance = new SearchChartBoxDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartBoxDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,79 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.chartdata.BubbleReportDefinition; |
||||
import com.fr.chart.chartdata.BubbleSeriesValue; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 散点图、气泡图数据 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartBubbleDataFormulaAction implements SearchChartDataFormula { |
||||
|
||||
private SearchChartBubbleDataFormulaAction() { |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof BubbleReportDefinition) { |
||||
BubbleReportDefinition reportDefinition = (BubbleReportDefinition) provider; |
||||
for (int i = 0; i < reportDefinition.size(); i++) { |
||||
if (reportDefinition.get(i) instanceof BubbleSeriesValue) { |
||||
BubbleSeriesValue seriesValue = (BubbleSeriesValue) reportDefinition.get(i); |
||||
dealBubbleSeriesValue(formulaInfos, content, seriesValue); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void dealBubbleSeriesValue(List<FormulaInfo> formulaInfos, ITContent content, BubbleSeriesValue seriesValue) { |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Name"), seriesValue.getBubbleSereisName()); |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Size"), seriesValue.getBubbleSeriesSize()); |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_X_Axis"), seriesValue.getBubbleSeriesX()); |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Y_Axis"), seriesValue.getBubbleSeriesY()); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartBubbleDataFormulaAction getInstance() { |
||||
return SearchChartBubbleDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartBubbleDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartBubbleDataFormulaAction instance; |
||||
|
||||
SearchChartBubbleDataFormulaActionEnum() { |
||||
instance = new SearchChartBubbleDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartBubbleDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,79 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
|
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
|
||||
import com.fr.plugin.chart.custom.CustomDefinition; |
||||
import com.fr.plugin.chart.custom.CustomPlotFactory; |
||||
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||
|
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 组合图 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartCustomDataFormulaAction implements SearchChartDataFormula { |
||||
|
||||
private SearchChartCustomDataFormulaAction() { |
||||
} |
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof CustomDefinition) { |
||||
CustomDefinition definition = (CustomDefinition) provider; |
||||
Map<String, SearchChartDataFormula> map = SearchChartDataFormulaManager.getInstance().getChartDataType(); |
||||
for (CustomPlotType customPlotType : definition.getDefinitionProviderMap().keySet()) { |
||||
TopDefinitionProvider definitionProvider = definition.getDefinitionProviderMap().get(customPlotType); |
||||
if (map.containsKey(definitionProvider.getClass().getSimpleName())) { |
||||
ITContent customContent = ITContent.copy(content); |
||||
customContent.addOtherPos(CustomPlotFactory.getTitle(customPlotType)); |
||||
map.get(definitionProvider.getClass().getSimpleName()).searchChartDataFormula(formulaInfos, customContent, definitionProvider); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartCustomDataFormulaAction getInstance() { |
||||
return SearchChartCustomDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartCustomDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartCustomDataFormulaAction instance; |
||||
|
||||
SearchChartCustomDataFormulaActionEnum() { |
||||
instance = new SearchChartCustomDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartCustomDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.Formula; |
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.design.actions.replace.action.content.formula.SearchFormula; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 搜索图表-数据中的公式 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public interface SearchChartDataFormula extends SearchFormula { |
||||
|
||||
|
||||
/** |
||||
* 搜索图表-数据中的公式 |
||||
* |
||||
* @param formulaInfos |
||||
* @param content |
||||
* @param provider |
||||
*/ |
||||
void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider); |
||||
|
||||
/** |
||||
* 快速处理Formula |
||||
* |
||||
* @param formulaInfos |
||||
* @param reportContent |
||||
* @param otherPos |
||||
* @param o |
||||
*/ |
||||
default void dealFormulaObject(List<FormulaInfo> formulaInfos, ITContent reportContent, String otherPos, Object o) { |
||||
if (o instanceof Formula) { |
||||
ITContent content = ITContent.copy(reportContent); |
||||
content.addOtherPos(otherPos); |
||||
content.setReplaceObject(o); |
||||
formulaInfos.add(new FormulaInfo(content)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,160 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.design.actions.replace.action.SearchAction; |
||||
import com.fr.design.actions.replace.action.SearchManager; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 管理图表-数据中的公式 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartDataFormulaManager implements SearchManager { |
||||
private static Map<String, SearchChartDataFormula> chartDataType = new HashMap<>(); |
||||
/** |
||||
* 其余普通类型 |
||||
*/ |
||||
public static final String VAN_CHART_NORMAL_REPORT_DATA_DEFINITION = "VanChartNormalReportDataDefinition"; |
||||
/** |
||||
* 散点图、气泡图数据 |
||||
*/ |
||||
public static final String BUBBLE_REPORT_DEFINITION = "BubbleReportDefinition"; |
||||
/** |
||||
* 组合图 |
||||
*/ |
||||
public static final String CUSTOM_DEFINITION = "CustomDefinition"; |
||||
/** |
||||
* 多层饼图、矩形树图 |
||||
*/ |
||||
public static final String MULTI_PIE_REPORT_DATA_DEFINITION = "MultiPieReportDataDefinition"; |
||||
/** |
||||
* 地图、热力地图 |
||||
*/ |
||||
public static final String VAN_MAP_DEFINITION = "VanMapDefinition"; |
||||
/** |
||||
* 钻取地图 |
||||
*/ |
||||
public static final String DRILL_MAP_DEFINITION = "DrillMapDefinition"; |
||||
/** |
||||
* 词云 |
||||
*/ |
||||
public static final String WORD_CLOUD_REPORT_DEFINITION = "WordCloudReportDefinition"; |
||||
/** |
||||
* 漏斗图 |
||||
*/ |
||||
public static final String METER_REPORT_DEFINITION = "MeterReportDefinition"; |
||||
/** |
||||
* 甘特图 |
||||
*/ |
||||
public static final String VAN_GANTT_DEFINITION = "VanGanttDefinition"; |
||||
/** |
||||
* 框架图 |
||||
*/ |
||||
public static final String STRUCTURE_REPORT_DEFINITION = "StructureReportDefinition"; |
||||
/** |
||||
* 箱型图 |
||||
*/ |
||||
public static final String VAN_BOX_REPORT_DEFINITION = "VanBoxReportDefinition"; |
||||
|
||||
/** |
||||
* 组合图中的大部分类型 |
||||
*/ |
||||
public static final String NORMAL_REPORT_DATA_DEFINITION = "NormalReportDataDefinition"; |
||||
|
||||
private SearchChartDataFormulaManager() { |
||||
register(VAN_CHART_NORMAL_REPORT_DATA_DEFINITION, SearchChartVanNormalDataFormulaAction.getInstance()); |
||||
register(BUBBLE_REPORT_DEFINITION, SearchChartBubbleDataFormulaAction.getInstance()); |
||||
register(MULTI_PIE_REPORT_DATA_DEFINITION, SearchChartMultiPieDataFormulaAction.getInstance()); |
||||
register(VAN_MAP_DEFINITION, SearchChartMapDataFormulaAction.getInstance()); |
||||
register(DRILL_MAP_DEFINITION, SearchChartDrillMapDataFormulaAction.getInstance()); |
||||
register(WORD_CLOUD_REPORT_DEFINITION, SearchChartWordCloudDataFormulaAction.getInstance()); |
||||
register(METER_REPORT_DEFINITION, SearchChartMeterDataFormulaAction.getInstance()); |
||||
register(VAN_GANTT_DEFINITION, SearchChartGanttDataFormulaAction.getInstance()); |
||||
register(STRUCTURE_REPORT_DEFINITION, SearchChartStructureDataFormulaAction.getInstance()); |
||||
register(VAN_BOX_REPORT_DEFINITION, SearchChartBoxDataFormulaAction.getInstance()); |
||||
register(CUSTOM_DEFINITION, SearchChartCustomDataFormulaAction.getInstance()); |
||||
register(NORMAL_REPORT_DATA_DEFINITION, SearchChartNormalReportDataFormulaAction.getInstance()); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取类别 |
||||
* |
||||
* @return |
||||
*/ |
||||
public Map<String, SearchChartDataFormula> getChartDataType() { |
||||
return chartDataType; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void registerAction(String tag, SearchAction searchAction) { |
||||
if (searchAction instanceof SearchChartDataFormula) { |
||||
register(tag, (SearchChartDataFormula) searchAction); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void removeAction(String tag) { |
||||
remove(tag); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 注册 |
||||
* |
||||
* @param tag 用于匹配的类型tag |
||||
* @param searchChartDataFormula 对应的实现类 |
||||
*/ |
||||
private void register(String tag, SearchChartDataFormula searchChartDataFormula) { |
||||
chartDataType.put(tag, searchChartDataFormula); |
||||
} |
||||
|
||||
/** |
||||
* 注销 |
||||
* |
||||
* @param tag 用于匹配的tag |
||||
*/ |
||||
private void remove(String tag) { |
||||
chartDataType.remove(tag); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartDataFormulaManager getInstance() { |
||||
return SearchChartCollectionFormulaManagerEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartCollectionFormulaManagerEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartDataFormulaManager instance; |
||||
|
||||
SearchChartCollectionFormulaManagerEnum() { |
||||
instance = new SearchChartDataFormulaManager(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartDataFormulaManager getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,93 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chartx.data.AbstractDataDefinition; |
||||
import com.fr.chartx.data.DrillMapChartDataDefinition; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; |
||||
import com.fr.plugin.chart.map.data.VanMapReportDefinition; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 钻取地图 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartDrillMapDataFormulaAction implements SearchChartDataFormula { |
||||
private SearchChartDrillMapDataFormulaAction() { |
||||
} |
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof DrillMapDefinition) { |
||||
DrillMapDefinition definition = (DrillMapDefinition) provider; |
||||
|
||||
if (definition.isFromBottomData()) { |
||||
dealDefinition(formulaInfos, content, definition.getBottomDataDefinition()); |
||||
} else { |
||||
for (int i = 0; i < definition.getEachLayerDataDefinitionList().size(); i++) { |
||||
ITContent listContent = ITContent.copy(content); |
||||
int index = i + 1; |
||||
listContent.addOtherPos( |
||||
Toolkit.i18nText("Fine-Design_Chart_Index_Article") + index + Toolkit.i18nText("Fine-Design_Chart_Index_Layer") |
||||
); |
||||
dealDefinition(formulaInfos, listContent, definition.getEachLayerDataDefinitionList().get(i)); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 这边存在点地图和区域地图两种,点地图特殊的地方需要处理一下 |
||||
* |
||||
* @param formulaInfos |
||||
* @param content |
||||
* @param provider |
||||
*/ |
||||
private void dealDefinition(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof VanMapReportDefinition) { |
||||
SearchChartMapDataFormulaAction.getInstance().dealAreaName(formulaInfos, content, ((VanMapReportDefinition) provider).getCategoryName(), (VanMapReportDefinition) provider); |
||||
SearchChartMapDataFormulaAction.dealSeriesDefinition(formulaInfos, content, ((VanMapReportDefinition) provider).getSeriesList()); |
||||
SearchChartMapDataFormulaAction.getInstance().dealPointDefinition4Special(formulaInfos, content, provider); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartDrillMapDataFormulaAction getInstance() { |
||||
return SearchChartDrillMapDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartDrillMapDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartDrillMapDataFormulaAction instance; |
||||
|
||||
SearchChartDrillMapDataFormulaActionEnum() { |
||||
instance = new SearchChartDrillMapDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartDrillMapDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,108 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.Formula; |
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.gantt.data.VanGanttDefinition; |
||||
import com.fr.plugin.chart.gantt.data.VanGanttLinkReportDefinition; |
||||
import com.fr.plugin.chart.gantt.data.VanGanttReportDefinition; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 甘特图 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartGanttDataFormulaAction implements SearchChartDataFormula { |
||||
private SearchChartGanttDataFormulaAction() { |
||||
} |
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof VanGanttDefinition) { |
||||
VanGanttDefinition definition = (VanGanttDefinition) provider; |
||||
if (definition.getDataDefinition() instanceof VanGanttReportDefinition) { |
||||
VanGanttReportDefinition reportDefinition = (VanGanttReportDefinition) definition.getDataDefinition(); |
||||
ITContent reportContent = ITContent.copy(content); |
||||
reportContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Gantt_Chart")); |
||||
dealReportDefinition(formulaInfos, reportContent, reportDefinition); |
||||
} |
||||
if (definition.getLinkDefinition() instanceof VanGanttLinkReportDefinition) { |
||||
VanGanttLinkReportDefinition linkReportDefinition = (VanGanttLinkReportDefinition) definition.getLinkDefinition(); |
||||
ITContent linkContent = ITContent.copy(content); |
||||
linkContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Task_Link")); |
||||
dealLinkDefinition(formulaInfos, linkContent, linkReportDefinition); |
||||
|
||||
} |
||||
} |
||||
} |
||||
|
||||
private void dealLinkDefinition(List<FormulaInfo> formulaInfos, ITContent linkContent, VanGanttLinkReportDefinition linkReportDefinition) { |
||||
//起始任务id
|
||||
dealFormulaObject(formulaInfos, linkContent, Toolkit.i18nText("Fine-Design_Chart_Start_Task_ID"), linkReportDefinition.getStartTaskID()); |
||||
//结束任务id
|
||||
dealFormulaObject(formulaInfos, linkContent, Toolkit.i18nText("Fine-Design_Chart_End_Task_ID"), linkReportDefinition.getEndTaskID()); |
||||
//关联类型
|
||||
dealFormulaObject(formulaInfos, linkContent, Toolkit.i18nText("Fine-Design_Chart_Link_Type"), linkReportDefinition.getLinkType()); |
||||
} |
||||
|
||||
private void dealReportDefinition(List<FormulaInfo> formulaInfos, ITContent reportContent, VanGanttReportDefinition reportDefinition) { |
||||
//系列名
|
||||
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Series_Name"), reportDefinition.getSeriesName()); |
||||
//开始时间
|
||||
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Start_Time"), reportDefinition.getStartTime()); |
||||
//结束时间
|
||||
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_End_Time"), reportDefinition.getEndTime()); |
||||
//里程碑时间
|
||||
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Marker_Time"), reportDefinition.getMarkTime()); |
||||
//进度
|
||||
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Process"), reportDefinition.getProgress()); |
||||
//任务ID
|
||||
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Task_ID"), reportDefinition.getLinkID()); |
||||
//项目名称
|
||||
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Project_Name"), reportDefinition.getFirstProcess()); |
||||
//项目
|
||||
for (Object o : reportDefinition.getProcessList()) { |
||||
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Project"), o); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartGanttDataFormulaAction getInstance() { |
||||
return SearchChartGanttDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartGanttDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartGanttDataFormulaAction instance; |
||||
|
||||
SearchChartGanttDataFormulaActionEnum() { |
||||
instance = new SearchChartGanttDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartGanttDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
||||
|
@ -0,0 +1,246 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.Formula; |
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.chartdata.SeriesDefinition; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.actions.replace.info.base.SearchTag; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.map.data.VanMapDefinition; |
||||
import com.fr.plugin.chart.map.data.VanMapReportDefinition; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 地图 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartMapDataFormulaAction implements SearchChartDataFormula { |
||||
private SearchChartMapDataFormulaAction() { |
||||
} |
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof VanMapDefinition) { |
||||
VanMapDefinition mapDefinition = (VanMapDefinition) provider; |
||||
//区域地图
|
||||
ITContent areaContent = ITContent.copy(content); |
||||
areaContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Region_Map")); |
||||
dealAreaDefinition(formulaInfos, areaContent, mapDefinition.getAreaDefinition()); |
||||
//流向地图
|
||||
ITContent lineContent = ITContent.copy(content); |
||||
lineContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_LineMap")); |
||||
dealLineDefinition(formulaInfos, content, mapDefinition.getLineDefinition()); |
||||
//点地图
|
||||
ITContent pointContent = ITContent.copy(content); |
||||
pointContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_PointMap")); |
||||
dealPointDefinition(formulaInfos, content, mapDefinition.getPointDefinition()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 处理点地图 |
||||
* |
||||
* @param formulaInfos |
||||
* @param content |
||||
* @param pointDefinition |
||||
*/ |
||||
public void dealPointDefinition(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider pointDefinition) { |
||||
if (pointDefinition instanceof VanMapReportDefinition) { |
||||
VanMapReportDefinition definition = (VanMapReportDefinition) pointDefinition; |
||||
ITContent pointContent = ITContent.copy(content); |
||||
//系列名&值
|
||||
dealSeriesDefinition(formulaInfos, pointContent, definition.getSeriesList()); |
||||
//经纬度
|
||||
dealLongitudeAndLatitude(formulaInfos, pointContent, definition); |
||||
//区域名
|
||||
dealAreaName(formulaInfos, pointContent, definition.getCategoryName(), definition); |
||||
} |
||||
} |
||||
|
||||
private boolean isFormulaString(Object o) { |
||||
String formulaFlag = "="; |
||||
return o instanceof String && ((String) o).startsWith(formulaFlag); |
||||
} |
||||
|
||||
private void dealLineDefinition(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider lineDefinition) { |
||||
if (lineDefinition instanceof VanMapReportDefinition) { |
||||
VanMapReportDefinition definition = (VanMapReportDefinition) lineDefinition; |
||||
ITContent lineContent = ITContent.copy(content); |
||||
//系列名&值
|
||||
dealSeriesDefinition(formulaInfos, lineContent, definition.getSeriesList()); |
||||
//经纬度
|
||||
dealLongitudeAndLatitude(formulaInfos, lineContent, definition); |
||||
//终点经纬度
|
||||
if (isFormulaString(definition.getEndLongitude())) { |
||||
ITContent longContent = ITContent.copy(lineContent); |
||||
longContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_End_Longitude")); |
||||
longContent.setReplaceObject(definition.getEndLongitude()); |
||||
longContent.setTag(SearchTag.CHART_DATA_END_LONGITUDE); |
||||
longContent.setHoldObject(definition); |
||||
formulaInfos.add(new FormulaInfo(longContent)); |
||||
} |
||||
if (isFormulaString(definition.getEndLatitude())) { |
||||
ITContent latitudeContent = ITContent.copy(lineContent); |
||||
latitudeContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_End_Latitude")); |
||||
latitudeContent.setReplaceObject(definition.getEndLatitude()); |
||||
latitudeContent.setTag(SearchTag.CHART_DATA_END_LATITUDE); |
||||
latitudeContent.setHoldObject(definition); |
||||
formulaInfos.add(new FormulaInfo(latitudeContent)); |
||||
} |
||||
if (isFormulaString(definition.getEndAreaName())) { |
||||
ITContent endAreaNameContent = ITContent.copy(lineContent); |
||||
endAreaNameContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")); |
||||
endAreaNameContent.setReplaceObject(definition.getEndAreaName()); |
||||
endAreaNameContent.setTag(SearchTag.CHART_AREA_END_NAME); |
||||
endAreaNameContent.setHoldObject(definition); |
||||
formulaInfos.add(new FormulaInfo(endAreaNameContent)); |
||||
} |
||||
//区域名
|
||||
dealAreaName(formulaInfos, lineContent, definition.getCategoryName(), definition); |
||||
} |
||||
} |
||||
|
||||
private void dealLongitudeAndLatitude(List<FormulaInfo> formulaInfos, ITContent content, VanMapReportDefinition definition) { |
||||
if (isFormulaString(definition.getLongitude())) { |
||||
ITContent longContent = ITContent.copy(content); |
||||
longContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Longitude")); |
||||
longContent.setReplaceObject(definition.getLongitude()); |
||||
longContent.setTag(SearchTag.CHART_DATA_LONGITUDE); |
||||
longContent.setHoldObject(definition); |
||||
formulaInfos.add(new FormulaInfo(longContent)); |
||||
} |
||||
if (isFormulaString(definition.getLatitude())) { |
||||
ITContent latitudeContent = ITContent.copy(content); |
||||
latitudeContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Latitude")); |
||||
latitudeContent.setReplaceObject(definition.getLatitude()); |
||||
latitudeContent.setHoldObject(definition); |
||||
latitudeContent.setTag(SearchTag.CHART_DATA_LATITUDE); |
||||
formulaInfos.add(new FormulaInfo(latitudeContent)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 处理区域地图 |
||||
* |
||||
* @param formulaInfos |
||||
* @param content |
||||
* @param areaDefinition |
||||
*/ |
||||
public void dealAreaDefinition(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider areaDefinition) { |
||||
if (areaDefinition instanceof VanMapReportDefinition) { |
||||
VanMapReportDefinition reportDefinition = (VanMapReportDefinition) areaDefinition; |
||||
ITContent mapContent = ITContent.copy(content); |
||||
//系列名&值
|
||||
dealSeriesDefinition(formulaInfos, mapContent, reportDefinition.getSeriesList()); |
||||
//区域名
|
||||
dealAreaName(formulaInfos, mapContent, reportDefinition.getCategoryName(), reportDefinition); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 处理点地图特有的 |
||||
* |
||||
* @param formulaInfos |
||||
* @param content |
||||
* @param pointDefinition |
||||
*/ |
||||
public void dealPointDefinition4Special(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider pointDefinition) { |
||||
if (pointDefinition instanceof VanMapReportDefinition) { |
||||
VanMapReportDefinition definition = (VanMapReportDefinition) pointDefinition; |
||||
ITContent pointContent = ITContent.copy(content); |
||||
//经纬度
|
||||
dealLongitudeAndLatitude(formulaInfos, pointContent, definition); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 处理区域名 |
||||
* @param formulaInfos |
||||
* @param content |
||||
* @param object |
||||
* @param definition |
||||
*/ |
||||
public void dealAreaName(List<FormulaInfo> formulaInfos, ITContent content, Object object, VanMapReportDefinition definition) { |
||||
if (object instanceof Formula) { |
||||
ITContent cateContent = ITContent.copy(content); |
||||
cateContent.addOtherPos( |
||||
Toolkit.i18nText("Fine-Design_Chart_Area_Name") |
||||
); |
||||
cateContent.setReplaceObject(object); |
||||
formulaInfos.add(new FormulaInfo(cateContent)); |
||||
} else if (isFormulaString(object)) { |
||||
ITContent strContent = ITContent.copy(content); |
||||
strContent.setHoldObject(definition); |
||||
strContent.setTag(SearchTag.CHART_AREA_NAME); |
||||
strContent.setReplaceObject(object); |
||||
strContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Area_Name")); |
||||
formulaInfos.add(new FormulaInfo(strContent)); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 处理系列名&值 |
||||
*/ |
||||
public static void dealSeriesDefinition(List<FormulaInfo> formulaInfos, ITContent content, List<SeriesDefinition> seriesDefinitions) { |
||||
for (SeriesDefinition seriesDefinition : seriesDefinitions) { |
||||
if (seriesDefinition.getValue() instanceof Formula) { |
||||
ITContent valueContent = ITContent.copy(content); |
||||
valueContent.addOtherPos( |
||||
Toolkit.i18nText("Fine-Design_Chart_Series_Value") |
||||
); |
||||
valueContent.setReplaceObject(seriesDefinition.getValue()); |
||||
formulaInfos.add(new FormulaInfo(valueContent)); |
||||
} |
||||
if (seriesDefinition.getSeriesName() instanceof Formula) { |
||||
ITContent nameContent = ITContent.copy(content); |
||||
nameContent.addOtherPos( |
||||
Toolkit.i18nText("Fine-Design_Chart_Series_Name") |
||||
); |
||||
nameContent.setReplaceObject(seriesDefinition.getSeriesName()); |
||||
formulaInfos.add(new FormulaInfo(nameContent)); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartMapDataFormulaAction getInstance() { |
||||
return SearchChartMapDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartMapDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartMapDataFormulaAction instance; |
||||
|
||||
SearchChartMapDataFormulaActionEnum() { |
||||
instance = new SearchChartMapDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartMapDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,68 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.Formula; |
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.chartdata.MeterReportDefinition; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 漏斗图 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartMeterDataFormulaAction implements SearchChartDataFormula { |
||||
|
||||
private SearchChartMeterDataFormulaAction() { |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof MeterReportDefinition) { |
||||
MeterReportDefinition definition = (MeterReportDefinition) provider; |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Name"), definition.getName()); |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Value"), definition.getValue()); |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Target_Value"), definition.getTarget()); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartMeterDataFormulaAction getInstance() { |
||||
return SearchChartMeterDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartMeterDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartMeterDataFormulaAction instance; |
||||
|
||||
SearchChartMeterDataFormulaActionEnum() { |
||||
instance = new SearchChartMeterDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartMeterDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,71 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.Formula; |
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
|
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.multilayer.data.MultiPieReportDataDefinition; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 层次图 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartMultiPieDataFormulaAction implements SearchChartDataFormula { |
||||
private SearchChartMultiPieDataFormulaAction() { |
||||
} |
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof MultiPieReportDataDefinition) { |
||||
//层次
|
||||
MultiPieReportDataDefinition definition = (MultiPieReportDataDefinition) provider; |
||||
for (int i = 0; i < definition.getLevelColumnNameList().size(); i++) { |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Level"), definition.getLevelColumnNameList().get(i)); |
||||
} |
||||
|
||||
//值字段
|
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Basic_Base_Value"), definition.getValue()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartMultiPieDataFormulaAction getInstance() { |
||||
return SearchChartMultiPieDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartMultiPieDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartMultiPieDataFormulaAction instance; |
||||
|
||||
SearchChartMultiPieDataFormulaActionEnum() { |
||||
instance = new SearchChartMultiPieDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartMultiPieDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.chartdata.NormalReportDataDefinition; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 组合图中的大部分类型 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-22 |
||||
*/ |
||||
public class SearchChartNormalReportDataFormulaAction implements SearchChartDataFormula { |
||||
|
||||
private SearchChartNormalReportDataFormulaAction() { |
||||
} |
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof NormalReportDataDefinition) { |
||||
NormalReportDataDefinition dataDefinition = (NormalReportDataDefinition) provider; |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Category_Name"), dataDefinition.getCategoryName()); |
||||
SearchChartMapDataFormulaAction.dealSeriesDefinition(formulaInfos, content, dataDefinition.getSeriesList()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartNormalReportDataFormulaAction getInstance() { |
||||
return SearchChartNormalReportDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartNormalReportDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartNormalReportDataFormulaAction instance; |
||||
|
||||
SearchChartNormalReportDataFormulaActionEnum() { |
||||
instance = new SearchChartNormalReportDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartNormalReportDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,69 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.structure.data.StructureReportDefinition; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 框架图 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartStructureDataFormulaAction implements SearchChartDataFormula { |
||||
private SearchChartStructureDataFormulaAction() { |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof StructureReportDefinition) { |
||||
StructureReportDefinition definition = (StructureReportDefinition) provider; |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Node_Name"), definition.getNodeName()); |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Node_Id"), definition.getNodeID()); |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Parent_Node_Id"), definition.getParentID()); |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Value"), definition.getNodeValue()); |
||||
|
||||
|
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartStructureDataFormulaAction getInstance() { |
||||
return SearchChartStructureDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartStructureDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartStructureDataFormulaAction instance; |
||||
|
||||
SearchChartStructureDataFormulaActionEnum() { |
||||
instance = new SearchChartStructureDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartStructureDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,74 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.chartdata.NormalReportDataDefinition; |
||||
import com.fr.chart.chartdata.SeriesDefinition; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 普通图表类型 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartVanNormalDataFormulaAction implements SearchChartDataFormula { |
||||
private SearchChartVanNormalDataFormulaAction() { |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof NormalReportDataDefinition) { |
||||
NormalReportDataDefinition normalReportDataDefinition = (NormalReportDataDefinition) provider; |
||||
//分类名
|
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Category_Name"), normalReportDataDefinition.getCategoryName()); |
||||
//系列名&值
|
||||
for (Object seriesDefinition : normalReportDataDefinition.getSeriesList()) { |
||||
if (seriesDefinition instanceof SeriesDefinition) { |
||||
SeriesDefinition definition = (SeriesDefinition) seriesDefinition; |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Name"), definition.getSeriesName()); |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Value"), definition.getValue()); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartVanNormalDataFormulaAction getInstance() { |
||||
return SearchChartNormalDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartNormalDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartVanNormalDataFormulaAction instance; |
||||
|
||||
SearchChartNormalDataFormulaActionEnum() { |
||||
instance = new SearchChartVanNormalDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartVanNormalDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,63 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.chart; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.wordcloud.data.WordCloudReportDefinition; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 词云 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchChartWordCloudDataFormulaAction implements SearchChartDataFormula { |
||||
private SearchChartWordCloudDataFormulaAction() { |
||||
} |
||||
|
||||
@Override |
||||
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) { |
||||
if (provider instanceof WordCloudReportDefinition) { |
||||
WordCloudReportDefinition definition = (WordCloudReportDefinition) provider; |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Word_Name"), definition.getWordName()); |
||||
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Word_Value"), definition.getWordValue()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 对外开放获取对象的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartWordCloudDataFormulaAction getInstance() { |
||||
return SearchWordCloudDataFormulaActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchWordCloudDataFormulaActionEnum { |
||||
/** |
||||
* 单例 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartWordCloudDataFormulaAction instance; |
||||
|
||||
SearchWordCloudDataFormulaActionEnum() { |
||||
instance = new SearchChartWordCloudDataFormulaAction(); |
||||
} |
||||
|
||||
/** |
||||
* 获取单例的方法 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartWordCloudDataFormulaAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,68 @@
|
||||
package com.fr.design.actions.replace.action.content.formula.highlight.javascript; |
||||
|
||||
import com.fr.base.chart.BaseChartCollection; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.web.ChartHyperPoplink; |
||||
import com.fr.design.actions.replace.action.content.formula.chart.SearchChartCollectionFormulaAction; |
||||
import com.fr.design.actions.replace.info.FormulaInfo; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.js.JavaScript; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 图表超链-悬浮窗图表的公式 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-20 |
||||
*/ |
||||
public class SearchChartHyperPopLinkAction implements SearchJSFormula { |
||||
private SearchChartHyperPopLinkAction() { |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) { |
||||
if (javaScript instanceof ChartHyperPoplink) { |
||||
ChartHyperPoplink chartHyperPoplink = (ChartHyperPoplink) javaScript; |
||||
if (chartHyperPoplink.getChartCollection() instanceof ChartCollection) { |
||||
SearchChartCollectionFormulaAction.getInstance().searchChartCollectionFormula(formulaInfos, content, (ChartCollection) chartHyperPoplink.getChartCollection()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取单例 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static SearchChartHyperPopLinkAction getInstance() { |
||||
return SearchChartHyperPopLinkActionEnum.SINGLETON.getInstance(); |
||||
} |
||||
|
||||
/** |
||||
* 枚举实现单例 |
||||
*/ |
||||
private enum SearchChartHyperPopLinkActionEnum { |
||||
/** |
||||
* 单例实现 |
||||
*/ |
||||
SINGLETON; |
||||
private SearchChartHyperPopLinkAction instance; |
||||
|
||||
SearchChartHyperPopLinkActionEnum() { |
||||
instance = new SearchChartHyperPopLinkAction(); |
||||
} |
||||
|
||||
/** |
||||
* 拿到对象 |
||||
* |
||||
* @return |
||||
*/ |
||||
public SearchChartHyperPopLinkAction getInstance() { |
||||
return instance; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.fr.design.actions.replace.info.base; |
||||
|
||||
/** |
||||
* 用于校验的标签 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-09-21 |
||||
*/ |
||||
public class SearchTag { |
||||
/** |
||||
* 经度 |
||||
*/ |
||||
public static final int CHART_DATA_LONGITUDE = 0; |
||||
/** |
||||
* 纬度 |
||||
*/ |
||||
public static final int CHART_DATA_LATITUDE = 1; |
||||
/** |
||||
* 区域名 |
||||
*/ |
||||
public static final int CHART_AREA_NAME = 2; |
||||
/** |
||||
* 终点经度 |
||||
*/ |
||||
public static final int CHART_DATA_END_LONGITUDE = 3; |
||||
/** |
||||
* 终点纬度 |
||||
*/ |
||||
public static final int CHART_DATA_END_LATITUDE = 4; |
||||
/** |
||||
* 终点区域名 |
||||
*/ |
||||
public static final int CHART_AREA_END_NAME = 5; |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue