Browse Source

REPORT-75998 添加图表-数据搜索相关、增加用户不同输入的处理、增加超链悬浮窗图表类型

feature/x
Destiny.Lin 2 years ago
parent
commit
72817d38b0
  1. 6
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java
  2. 30
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java
  3. 128
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java
  4. 95
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java
  5. 79
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBubbleDataFormulaAction.java
  6. 31
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  7. 79
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCustomDataFormulaAction.java
  8. 46
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormula.java
  9. 160
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormulaManager.java
  10. 93
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDrillMapDataFormulaAction.java
  11. 108
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartGanttDataFormulaAction.java
  12. 239
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java
  13. 68
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMeterDataFormulaAction.java
  14. 71
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMultiPieDataFormulaAction.java
  15. 65
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartNormalReportDataFormulaAction.java
  16. 69
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartStructureDataFormulaAction.java
  17. 74
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartVanNormalDataFormulaAction.java
  18. 63
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartWordCloudDataFormulaAction.java
  19. 68
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchChartHyperPopLinkAction.java
  20. 6
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormulaManager.java
  21. 14
      designer-realize/src/main/java/com/fr/design/actions/replace/info/DealWithInfoValue.java
  22. 59
      designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java
  23. 37
      designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java
  24. 70
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  25. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java
  26. 37
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java
  27. 15
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

6
designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java

@ -59,7 +59,7 @@ public enum ShowSearchResultAction implements ShowValue {
ChartCollection chartCollection = (ChartCollection) cellElement.getValue();
for (int i = 0; i < chartCollection.getChartCount(); i++) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
if (titleName.contains(str)) {
if (isTitleNameValid(titleName, str)) {
CellInfo cellInfo = ((CellInfo) info).copy();
cellInfo.setCellChartIndex(i);
cellInfo.getContent().addOtherPos(
@ -92,6 +92,10 @@ public enum ShowSearchResultAction implements ShowValue {
cellInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(titleName, str));
cellInfo.getContent().setSelected(true);
}
private boolean isTitleNameValid(String titleName, String str){
return titleName.contains(str) && StringUtils.isNotEmpty(titleName);
}
},
/**
* 搜索JS事件

30
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java

@ -502,7 +502,35 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
}
return false;
}
};
},
/**
* 存储字符串类型需要特殊处理
*/
STRING("String"){
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(o[0]))){
map.put("content", GeneralUtils.objectToString(o[0]));
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
FormulaTag formulaTag = FormulaTag.match(info.getContent().getTag());
if (formulaTag != null){
info.updateOldStr(GeneralUtils.objectToString(info.getContent().getReplaceObject()), findStr);
formulaTag.setValue(info, findStr, replaceStr, operatorArray);
}
}
@Override
public boolean check(Info info) {
return true;
}
}
;
String name;

128
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java

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

95
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java

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

79
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBubbleDataFormulaAction.java

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

31
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java

@ -1,19 +1,25 @@
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.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Title;
import com.fr.chart.chartdata.NormalChartData;
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 com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartValueAxis;
import java.util.List;
import java.util.Map;
/**
* 图表类型获取公式汇总
@ -24,7 +30,6 @@ import java.util.List;
*/
public class SearchChartCollectionFormulaAction {
private SearchChartCollectionFormulaAction() {
}
@ -39,17 +44,23 @@ public class SearchChartCollectionFormulaAction {
for (int i = 0; i < chartCollection.getChartCount(); i++) {
ITContent chartContent = ITContent.copy(content);
searchChartPatternFormula(formulaInfos, chartContent, chartCollection.getChart(i));
//数据-单元格数据-分类名&系列名&值
searchChartDataFormula(formulaInfos, content, chartCollection.getChart(i));
SearchChartDataFormulaManager searchChartDataFormulaManager = SearchChartDataFormulaManager.getInstance();
Map<String, SearchChartDataFormula> type = searchChartDataFormulaManager.getChartDataType();
if (isDefinitionValid(chartCollection.getChart(i).getFilterDefinition())) {
String name = chartCollection.getChart(i).getFilterDefinition().getClass().getSimpleName();
SearchChartDataFormula searchChartDataFormula = type.get(name);
TopDefinitionProvider provider = chartCollection.getChart(i).getFilterDefinition();
ITContent dataContent = ITContent.copy(content);
dataContent.addOtherPos(chartCollection.getChart(i).getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
searchChartDataFormula.searchChartDataFormula(formulaInfos, dataContent, provider);
}
}
}
private void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, Chart chart) {
if (chart.defaultChartData() instanceof NormalChartData) {
NormalChartData chartData = (NormalChartData) chart.defaultChartData();
//todo
}
private boolean isDefinitionValid(TopDefinitionProvider provider) {
return provider != null && SearchChartDataFormulaManager.getInstance().getChartDataType().containsKey(provider.getClass().getSimpleName());
}
@ -120,7 +131,7 @@ public class SearchChartCollectionFormulaAction {
if (xAxis != null) {
//轴标题
ITContent xAxisContent = ITContent.copy(chartContent);
if (!chartContent.isFrm()){
if (!chartContent.isFrm()) {
xAxisContent.addOtherPos(chart.getChartName());
}
xAxisContent.addOtherPos(

79
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCustomDataFormulaAction.java

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

46
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormula.java

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

160
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormulaManager.java

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

93
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDrillMapDataFormulaAction.java

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

108
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartGanttDataFormulaAction.java

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

239
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java

@ -0,0 +1,239 @@
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);
}
}
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;
}
}
}

68
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMeterDataFormulaAction.java

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

71
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMultiPieDataFormulaAction.java

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

65
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartNormalReportDataFormulaAction.java

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

69
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartStructureDataFormulaAction.java

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

74
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartVanNormalDataFormulaAction.java

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

63
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartWordCloudDataFormulaAction.java

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

68
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchChartHyperPopLinkAction.java

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

6
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormulaManager.java

@ -20,6 +20,7 @@ public class SearchJSFormulaManager implements SearchManager {
public static final String COMMIT_2_DB_JAVASCRIPT = "Commit2DBJavaScript";
public static final String EXPORT_JAVASCRIPT = "ExportJavaScript";
public static final String MOBILE_POPUP_HYPERLINK = "MobilePopupHyperlink";
public static final String CHART_HYPER_POP_LINK = "ChartHyperPoplink";
private SearchJSFormulaManager() {
//控件事件里面需要特殊处理的类型
@ -35,11 +36,12 @@ public class SearchJSFormulaManager implements SearchManager {
//JavaScriptImpl——只有参数可以放公式,不需要特殊处理
//MobilePopupHyperlink
//ChartHyperPoplink
//ChartHyperRelateCellLink
//ChartHyperRelateFloatLink
//ChartHyperRelateCellLink——只有参数可以放公式,不需要特殊处理
//ChartHyperRelateFloatLink——只有参数可以放公式,不需要特殊处理
register(COMMIT_2_DB_JAVASCRIPT, SearchCommit2DBJSFormulaAction.getInstance());
register(EXPORT_JAVASCRIPT, SearchExportJSFormulaAction.getInstance());
register(MOBILE_POPUP_HYPERLINK, SearchMobileHyperlinkFormulaAction.getInstance());
register(CHART_HYPER_POP_LINK, SearchChartHyperPopLinkAction.getInstance());
}
@Override

14
designer-realize/src/main/java/com/fr/design/actions/replace/info/DealWithInfoValue.java

@ -1,10 +1,11 @@
package com.fr.design.actions.replace.info;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -23,7 +24,9 @@ public interface DealWithInfoValue {
* @param o 用于替换的replaceObject
* @return 返回便于处理的Map不同类型可能会存在多个需要存储的数据eg控件名 & 水印
*/
Map<String, String> getValue(Object... o);
default Map<String, String> getValue(Object... o) {
return new HashMap<>();
}
/**
@ -34,7 +37,8 @@ public interface DealWithInfoValue {
* @param replaceStr 用于替换的字符串
* @param operatorArray 存储内容类替换所要操作的所有位置Pair<起始位置,结束位置>
*/
void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray);
default void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
}
/**
@ -43,5 +47,7 @@ public interface DealWithInfoValue {
* @param info 信息
* @return 返回用于展示的字符串
*/
String getInfoShowStr(Info info);
default String getInfoShowStr(Info info) {
return StringUtils.EMPTY;
}
}

59
designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java

@ -66,6 +66,16 @@ public class ITContent implements Cloneable {
*/
private boolean jumpAble = true;
/**
* 持有公式的对象
*/
private Object holdObject;
/**
* 与SearchTag对应的标签用于后续校验处理
*/
private int tag = -1;
public ITContent() {
this.sheetID = StringUtils.EMPTY;
this.sheetName = StringUtils.EMPTY;
@ -79,6 +89,7 @@ public class ITContent implements Cloneable {
this.lastSearchStr = StringUtils.EMPTY;
this.trlString = StringUtils.EMPTY;
this.operatorArray = new ArrayList<>();
this.holdObject = new Object();
}
@ -89,23 +100,43 @@ public class ITContent implements Cloneable {
*/
public static ITContent copy(ITContent content) {
ITContent result = new ITContent();
result.setSheetID(content.getSheetID());
result.setSheetName(content.getSheetName());
result.setTemplateName(content.getTemplateName());
result.setBlockName(content.getBlockName());
result.addOtherPos(content.getOtherPos());
result.setReplaceObject(content.getReplaceObject());
result.setShowObject(content.getShowObject());
result.setTrlString(content.getTrlString());
result.setShowStr(content.getShowStr());
result.setOldShowStr(content.getOldShowStr());
result.setLastSearchStr(content.getLastSearchStr());
result.setOperatorArray(content.getOperatorArray());
result.setFrmFlag(content.isFrm());
result.setJumpAble(content.isJumpAble());
if (content != null){
result.setSheetID(content.getSheetID());
result.setSheetName(content.getSheetName());
result.setTemplateName(content.getTemplateName());
result.setBlockName(content.getBlockName());
result.addOtherPos(content.getOtherPos());
result.setReplaceObject(content.getReplaceObject());
result.setShowObject(content.getShowObject());
result.setTrlString(content.getTrlString());
result.setShowStr(content.getShowStr());
result.setOldShowStr(content.getOldShowStr());
result.setLastSearchStr(content.getLastSearchStr());
result.setOperatorArray(content.getOperatorArray());
result.setFrmFlag(content.isFrm());
result.setJumpAble(content.isJumpAble());
result.setHoldObject(content.getHoldObject());
result.setTag(content.getTag());
}
return result;
}
public int getTag() {
return tag;
}
public void setTag(int tag) {
this.tag = tag;
}
public Object getHoldObject() {
return holdObject;
}
public void setHoldObject(Object holdObject) {
this.holdObject = holdObject;
}
public Object getReplaceObject() {
return replaceObject;
}

37
designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java

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

70
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java

@ -154,42 +154,43 @@ public class ITReplaceMainDialog extends UIDialog {
* 替换
*/
private void replace() {
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
String replaceStr = ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).getText();
if (StringUtils.equals(getSearchStr(), searchStr)) {
if (isITReplaceValid() && checkTemplateChanged(searchResultList)) {
for (Info info : searchResultList) {
if (info.getContent().isSelected()) {
info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray());
ShowValueUtils.updateHighlight(info, replaceStr);
}
}
southPanel.getTableEditorPane().update();
northPane.refreshReplaceInputComboBoxItems();
ITTableEditorPane.getEditTable().repaint();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
setSearchFlag(false);
if (isITReplaceValid() && checkTemplateChanged(searchResultList)) {
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
String replaceStr = ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).getText();
for (Info info : searchResultList) {
if (info.getContent().isSelected()) {
info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray());
ShowValueUtils.updateHighlight(info, replaceStr);
} else {
Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")};
int optionSelected = FineJOptionPane.showOptionDialog(
ITReplaceMainDialog.this,
Toolkit.i18nText("Fine-Design_Replace_Message"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.ERROR_MESSAGE,
null,
// 如果传null, 则按钮为 optionType 类型所表示的按钮(也就是确认对话框)
options,
options[0]
);
//如果选择了重新查找,则再查找一遍
if (optionSelected == 0) {
search();
}
}
southPanel.getTableEditorPane().update();
northPane.refreshReplaceInputComboBoxItems();
ITTableEditorPane.getEditTable().repaint();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
setSearchFlag(false);
} else {
Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")};
int optionSelected = FineJOptionPane.showOptionDialog(
ITReplaceMainDialog.this,
Toolkit.i18nText("Fine-Design_Replace_Message"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.ERROR_MESSAGE,
null,
// 如果传null, 则按钮为 optionType 类型所表示的按钮(也就是确认对话框)
options,
options[0]
);
//如果选择了重新查找,则再查找一遍
if (optionSelected == 0) {
search();
}
search();
}
@ -281,9 +282,11 @@ public class ITReplaceMainDialog extends UIDialog {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
templateID = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget().getTemplateID();
itTableEditor.clear();
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
setSearchStr(searchStr);
ShowSearchResultAction searchAction = ShowSearchResultAction.match(GeneralUtils.objectToString(northPane.getFindCombobox().getSelectedItem()));
if (searchAction != null) {
searchResultList = searchAction.addMatchResult(((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText(), searchAction.showSearchValue(jTemplate));
searchResultList = searchAction.addMatchResult(searchStr, searchAction.showSearchValue(jTemplate));
itTableEditor.add(searchResultList);
northPane.getResultLabel().setText("<html>" + Toolkit.i18nText("Fine-Design_Replace_Search_Finish") + "<font color = 'rgb(61,153,249)'>" + searchResultList.size() + "</font>" + Toolkit.i18nText("Fine-Design_Replace_Result"));
}
@ -291,7 +294,6 @@ public class ITReplaceMainDialog extends UIDialog {
northPane.refreshFindInputComboBoxItems();
setSearchFlag(true);
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
if (StringUtils.isNotEmpty(searchStr)) {
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setEditable(true);
northPane.getReplaceInputCombobox().setEditable(true);

4
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java

@ -3,6 +3,7 @@ package com.fr.design.actions.replace.ui;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -27,9 +28,10 @@ public class ITReplaceWestPanel {
contentButton.setBorderPainted(false);
leftJpanel.add(contentButton);
leftJpanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, new Color(218, 218, 221)));
//填充一下面板
int labelNum = 14;
for (int i = 0; i < labelNum; i++) {
leftJpanel.add(new UILabel(""));
leftJpanel.add(new UILabel(StringUtils.EMPTY));
}
}

37
designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java

@ -3,6 +3,8 @@ package com.fr.design.actions.replace.utils;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chart.web.ChartHyperPoplink;
import com.fr.design.actions.replace.action.content.js.SearchChartJSAction;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
@ -38,7 +40,7 @@ public class SearchJSUtils {
* 从Listener中获取JS
*/
public static void searchJSFromListener(List<JSInfo> jsInfos, ITContent content) {
if (content.getReplaceObject() instanceof Listener){
if (content.getReplaceObject() instanceof Listener) {
Listener listener = (Listener) (content.getReplaceObject());
JavaScript javaScript = listener.getAction();
if (javaScript instanceof JavaScriptImpl) {
@ -102,15 +104,18 @@ public class SearchJSUtils {
Toolkit.i18nText("Fine-Design_Chart_Tooltip") + "-" + Toolkit.i18nText("Fine-Design_Basic_Custom")));
}
}
private static boolean isToolTipValid(VanChartPlot plot){
private static boolean isToolTipValid(VanChartPlot plot) {
return plot.getAttrTooltipFromConditionCollection() != null && ((AttrTooltip) plot.getAttrTooltipFromConditionCollection()).isEnable() && plot.getAttrTooltipFromConditionCollection() instanceof AttrTooltip;
}
private static void addAttrLabelDetail2Array(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList) {
if (isLabelDetailValid(plot)) {
arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getAttrLabelDetail().getContent().getHtmlLabel(), Toolkit.i18nText("Fine-Design_Chart_Value_Label")));
}
}
private static boolean isLabelDetailValid(VanChartPlot plot){
private static boolean isLabelDetailValid(VanChartPlot plot) {
return plot.getAttrLabelFromConditionCollection() != null
&& plot.getAttrLabelFromConditionCollection().getAttrLabelDetail() != null
&& plot.getAttrLabelFromConditionCollection().getAttrLabelDetail().getContent().getHtmlLabel() != null;
@ -121,7 +126,8 @@ public class SearchJSUtils {
arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getSecondLabelDetail().getContent().getHtmlLabel(), Toolkit.i18nText("Fine-Design_Chart_Category_Label")));
}
}
private static boolean isSecondLabelDetailValid(VanChartPlot plot){
private static boolean isSecondLabelDetailValid(VanChartPlot plot) {
return plot.getAttrLabelFromConditionCollection() != null
&& plot.getAttrLabelFromConditionCollection().getSecondLabelDetail() != null
&& plot.getAttrLabelFromConditionCollection().getSecondLabelDetail().getContent().getHtmlLabel() != null;
@ -239,17 +245,34 @@ public class SearchJSUtils {
public static void addJSInfosFromHyperLink(Elem elem, List<JSInfo> jsInfos, ITContent content) {
if (elem.getNameHyperlinkGroup() != null) {
for (int j = 0; j < elem.getNameHyperlinkGroup().size(); j++) {
if ((elem.getNameHyperlinkGroup().getNameHyperlink(j).getJavaScript()) instanceof JavaScriptImpl) {
NameJavaScript nameJavaScript = elem.getNameHyperlinkGroup().getNameHyperlink(j);
JavaScript javaScript = nameJavaScript.getJavaScript();
if (javaScript instanceof JavaScriptImpl) {
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Hyperlink"));
newContent.setReplaceObject(elem.getNameHyperlinkGroup().getNameHyperlink(j));
newContent.addOtherPos(elem.getNameHyperlinkGroup().getNameHyperlink(j).getName());
newContent.setReplaceObject(nameJavaScript);
newContent.addOtherPos(nameJavaScript.getName());
SearchJSUtils.addJSInfos(jsInfos, new JSInfo(newContent));
} else if (isChartHyperPopLinkValid(javaScript)) {
ITContent chartContent = ITContent.copy(content);
chartContent.addOtherPos(nameJavaScript.getName());
ChartCollection chartCollection = (ChartCollection) ((ChartHyperPoplink) javaScript).getChartCollection();
SearchChartJSAction.getInstance().searchChartJS(chartCollection, chartContent, jsInfos);
}
}
}
}
/**
* 是否图表悬浮超链且内部图表是否可用
*
* @param javaScript
* @return
*/
private static boolean isChartHyperPopLinkValid(JavaScript javaScript) {
return javaScript instanceof ChartHyperPoplink && ((ChartHyperPoplink) javaScript).getChartCollection() instanceof ChartCollection;
}
/**
* 从Action中拿JS
*

15
designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

@ -3,7 +3,7 @@ package com.fr.design.actions.replace.utils;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.ui.ITReplaceMainDialog;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
@ -30,6 +30,7 @@ public class ShowValueUtils {
public static final String ANY_THING_REGEX = ".";
public static final String NUMBER_REGEX = "[0-9]";
public static final String ENGLISH_REGEX = "[a-zA-Z]";
/**
* 获取除内容外其他一次性展示所有的内容名称水印...
*
@ -61,13 +62,14 @@ public class ShowValueUtils {
/**
* 转换正则表达式
*
* @param regex
* @return
*/
public static String changeRegex(String regex){
regex = regex.replace(NUMBER,NUMBER_REGEX);
public static String changeRegex(String regex) {
regex = regex.replace(NUMBER, NUMBER_REGEX);
regex = regex.replace(ENGLISH, ENGLISH_REGEX);
regex = regex.replace(ANY_THING,ANY_THING_REGEX);
regex = regex.replace(ANY_THING, ANY_THING_REGEX);
return regex;
}
@ -128,17 +130,18 @@ public class ShowValueUtils {
/**
* 支持正则表达式的indexOf
*
* @param str
* @param regex
* @return
*/
public static int indexOf(String str, String regex){
public static int indexOf(String str, String regex) {
CharSequence inputStr = str;
int failReturn = -1;
String patternStr = changeRegex(regex);
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(inputStr);
if(matcher.find()){
if (matcher.find()) {
return matcher.start();
}
return failReturn;

Loading…
Cancel
Save