Browse Source

Pull request #10125: REPORT-75998 完善图表、决策报表逻辑

Merge in DESIGN/design from ~DESTINY.LIN/design:feature/x to feature/x

* commit 'da1d28d62de11caadf6d2f157fd07c76c5e63e40':
  REPORT-75998 添加监控刷新JS
  REPORT-75998 界面添加滚动条,优化一些可能会出错的判断、增加条件显示-条件属性-标签中的JS
  REPORT-75998 处理扩展图表报错问题
  REPORT-75998 添加注释、增加决策报表底层组件的搜索逻辑
  REPORT-75998 添加图表-数据搜索相关、增加用户不同输入的处理、增加超链悬浮窗图表类型
feature/x
Destiny.Lin-林锦龙 2 years ago
parent
commit
768ac4bef2
  1. 20
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java
  2. 11
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/SearchComponentAction.java
  3. 30
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java
  4. 128
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java
  5. 95
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java
  6. 79
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBubbleDataFormulaAction.java
  7. 139
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  8. 79
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCustomDataFormulaAction.java
  9. 46
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormula.java
  10. 160
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormulaManager.java
  11. 93
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDrillMapDataFormulaAction.java
  12. 108
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartGanttDataFormulaAction.java
  13. 246
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java
  14. 68
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMeterDataFormulaAction.java
  15. 71
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMultiPieDataFormulaAction.java
  16. 65
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartNormalReportDataFormulaAction.java
  17. 69
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartStructureDataFormulaAction.java
  18. 74
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartVanNormalDataFormulaAction.java
  19. 63
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartWordCloudDataFormulaAction.java
  20. 68
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchChartHyperPopLinkAction.java
  21. 6
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormulaManager.java
  22. 11
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaAction.java
  23. 3
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaManager.java
  24. 69
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java
  25. 14
      designer-realize/src/main/java/com/fr/design/actions/replace/info/DealWithInfoValue.java
  26. 59
      designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java
  27. 37
      designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java
  28. 75
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  29. 53
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  30. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java
  31. 82
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java
  32. 15
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

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

@ -2,6 +2,7 @@ package com.fr.design.actions.replace.action;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Title;
import com.fr.design.actions.replace.action.content.cell.SearchCellAction;
import com.fr.design.actions.replace.action.content.component.SearchComponentAction;
import com.fr.design.actions.replace.action.content.floatelement.SearchFloatAction;
@ -58,8 +59,8 @@ public enum ShowSearchResultAction implements ShowValue {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
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(chartCollection.getChart(i).getTitle(), str)) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
CellInfo cellInfo = ((CellInfo) info).copy();
cellInfo.setCellChartIndex(i);
cellInfo.getContent().addOtherPos(
@ -92,6 +93,7 @@ public enum ShowSearchResultAction implements ShowValue {
cellInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(titleName, str));
cellInfo.getContent().setSelected(true);
}
},
/**
* 搜索JS事件
@ -229,8 +231,8 @@ public enum ShowSearchResultAction implements ShowValue {
if (((FloatInfo) info).isChartExist()) {
ChartCollection chartCollection = (ChartCollection) floatElement.getValue();
for (int i = 0; i < chartCollection.getChartCount(); i++) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
if (titleName.contains(str)) {
if (isTitleNameValid(chartCollection.getChart(i).getTitle(),str)) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
FloatInfo floatInfo = ((FloatInfo) info).copy();
floatInfo.setFloatChartIndex(i);
floatInfo.getContent().addOtherPos(
@ -406,4 +408,14 @@ public enum ShowSearchResultAction implements ShowValue {
}
return null;
}
/**
* 标题是否可用
* @param title
* @param str
* @return
*/
public boolean isTitleNameValid(Title title, String str){
return title != null && GeneralUtils.objectToString(title.getTextObject()).contains(str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject()));
}
}

11
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/SearchComponentAction.java

@ -52,6 +52,8 @@ public class SearchComponentAction implements SearchAction {
content.setTemplateName(jTemplate.getTemplateName());
content.addTRL(jTemplate.getTemplateName());
content.setFrmFlag(true);
//处理最底层form组件
dealForm(componentInfos, content, form.getContainer());
//参数面板
dealPara(componentInfos, content, form.getParaContainer());
//body面板
@ -60,6 +62,15 @@ public class SearchComponentAction implements SearchAction {
setComponentInfos(componentInfos);
}
private void dealForm(List<ComponentInfo> componentInfos, ITContent content, WLayout container) {
ITContent formContent = ITContent.copy(content);
formContent.setReplaceObject(container);
dealContent(formContent, container.getWidgetName());
formContent.addOtherPos(container.getWidgetName());
formContent.setJumpAble(false);
componentInfos.add(new ComponentInfo(formContent));
}
private void dealBody(List<ComponentInfo> componentInfos, ITContent content, Widget body) {
if (body instanceof WLayout) {
ITContent bodyContent = ITContent.copy(content);

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

139
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());
}
@ -65,34 +76,37 @@ public class SearchChartCollectionFormulaAction {
}
private void searchChartPatternFormulaFromAlertLine(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
ITContent content = ITContent.copy(chartContent);
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Background"),
Toolkit.i18nText("Fine-Design_Chart_Plot_Region"),
Toolkit.i18nText("Fine-Design_Chart_Alert_Line")
);
if (xAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) xAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
if (chart.getPlot() != null){
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
ITContent content = ITContent.copy(chartContent);
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Background"),
Toolkit.i18nText("Fine-Design_Chart_Plot_Region"),
Toolkit.i18nText("Fine-Design_Chart_Alert_Line")
);
if (xAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) xAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
}
}
}
if (yAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) yAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
if (yAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) yAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
}
}
}
}
private void dealAlertContent(List<FormulaInfo> formulaInfos, ITContent content, VanChartAlertValue alertValue) {
@ -114,39 +128,40 @@ public class SearchChartCollectionFormulaAction {
}
private void searchChartPatternFormulaFromAxisValue(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
//样式-坐标轴-x轴
if (xAxis != null) {
//轴标题
ITContent xAxisContent = ITContent.copy(chartContent);
if (!chartContent.isFrm()){
xAxisContent.addOtherPos(chart.getChartName());
if (chart.getPlot() != null){
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
//样式-坐标轴-x轴
if (xAxis != null) {
//轴标题
ITContent xAxisContent = ITContent.copy(chartContent);
if (!chartContent.isFrm()) {
xAxisContent.addOtherPos(chart.getChartName());
}
xAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_X_Axis")
);
dealTitle(formulaInfos, xAxisContent, xAxis.getTitle());
dealChartValueDefine(formulaInfos, xAxisContent, xAxis);
}
xAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_X_Axis")
);
dealTitle(formulaInfos, xAxisContent, xAxis.getTitle());
dealChartValueDefine(formulaInfos, xAxisContent, xAxis);
}
//样式-坐标轴-y轴-轴标题
if (yAxis != null) {
ITContent yAxisContent = ITContent.copy(chartContent);
yAxisContent.addOtherPos(
chart.getChartName(),
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Y_Axis")
);
dealTitle(formulaInfos, yAxisContent, yAxis.getTitle());
dealChartValueDefine(formulaInfos, yAxisContent, yAxis);
//样式-坐标轴-y轴-轴标题
if (yAxis != null) {
ITContent yAxisContent = ITContent.copy(chartContent);
yAxisContent.addOtherPos(
chart.getChartName(),
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Y_Axis")
);
dealTitle(formulaInfos, yAxisContent, yAxis.getTitle());
dealChartValueDefine(formulaInfos, yAxisContent, yAxis);
}
}
}
private void dealChartValueDefine(List<FormulaInfo> formulaInfos, ITContent axisContent, Axis axis) {

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

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

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

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

11
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaAction.java

@ -20,6 +20,7 @@ import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.Label;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
@ -74,22 +75,21 @@ public class SearchWidgetFormulaAction extends AbstractSearchWidgetFormulaAction
private void searchFormulaFromWidgetValue(Info info, List<FormulaInfo> formulaInfos) {
Widget widget = (Widget) info.getContent().getReplaceObject();
if (widget instanceof WScaleLayout) {
widget = ((CRBoundsWidget) ((WScaleLayout) widget).getWidget(0)).getWidget();
info.getContent().setReplaceObject(widget);
}
if (widget instanceof WTitleLayout) {
if (((WTitleLayout) widget).getTitleBoundsWidget() != null){
if (((WTitleLayout) widget).getTitleBoundsWidget() != null) {
CRBoundsWidget boundsWidget = ((WTitleLayout) widget).getTitleBoundsWidget();
if (boundsWidget.getWidget() instanceof Label){
if (boundsWidget.getWidget() instanceof Label) {
ITContent titleContent = ITContent.copy(info.getContent());
titleContent.setReplaceObject(((Label) boundsWidget.getWidget()).getWidgetValue().getValue());
formulaInfos.add(new FormulaInfo(titleContent));
}
}
Widget tempWidget = (((WTitleLayout) widget).getBodyBoundsWidget()).getWidget();
if (tempWidget instanceof ChartEditor && ((ChartEditor) tempWidget).getChartCollection() instanceof ChartCollection) {
if (isChartValid(tempWidget)) {
SearchChartCollectionFormulaAction.getInstance().searchChartCollectionFormula(formulaInfos, info.getContent(), (ChartCollection) ((ChartEditor) tempWidget).getChartCollection());
}
}
@ -102,6 +102,9 @@ public class SearchWidgetFormulaAction extends AbstractSearchWidgetFormulaAction
}
private boolean isChartValid(Widget tempWidget) {
return tempWidget instanceof ChartEditor && ((ChartEditor) tempWidget).getChartCollection() instanceof ChartCollection;
}
public boolean isReplaceObjectExist(Info info) {
return info.getContent() != null && info.getContent().getReplaceObject() != null;

3
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaManager.java

@ -33,6 +33,7 @@ public class SearchWidgetFormulaManager implements SearchManager {
private static final String TREE_COMBO_BOX_EDITOR = "TreeComboBoxEditor";
private static final String TREE_EDITOR = "TreeEditor";
private static final String W_TITLE_LAYOUT = "WTitleLayout";
private static final String W_BORDER_LAYOUT = "WBorderLayout";
private SearchWidgetFormulaManager() {
/**
@ -48,7 +49,7 @@ public class SearchWidgetFormulaManager implements SearchManager {
register(NUMBER_EDITOR, SearchCommonWidgetFormulaAction.getInstance());
register(TEXT_EDITOR, SearchCommonWidgetFormulaAction.getInstance());
register(W_TITLE_LAYOUT, SearchCommonWidgetFormulaAction.getInstance());
register(W_BORDER_LAYOUT, SearchCommonWidgetFormulaAction.getInstance());
/**
* 日期类型
*/

69
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java

@ -10,7 +10,9 @@ import com.fr.design.i18n.Toolkit;
import com.fr.js.NameJavaScript;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.base.RefreshMoreLabel;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.collections.combination.Pair;
import java.util.List;
@ -42,7 +44,7 @@ public class SearchChartJSAction {
ITContent htmlITContent = ITContent.copy(content);
htmlITContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Chart"));
SearchJSUtils.addJSInfosFromHtmlLabel(htmlITContent, htmlLabels, jsInfos);
//图表-特效-交互属性
//图表-特效-交互属性-超级链接
ITContent conditionContent = ITContent.copy(content);
conditionContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Chart"),
@ -51,35 +53,62 @@ public class SearchChartJSAction {
);
SearchJSUtils.addJSInfosFromNameJS(conditionContent, nameJavaScripts, jsInfos);
//图表-特效-交互属性-监控刷新
dealMonitorRefreshJS(conditionContent,chartCollection,jsInfos);
for (int i = 0; i < chartCollection.getChartCount(); i++) {
ITContent chartContent = ITContent.copy(content);
chartContent.addOtherPos(chartCollection.getChart(i).getChartName());
searchAxisJS(jsInfos, chartContent, chartCollection.getChart(i));
}
}
private void searchAxisJS(List<JSInfo> jsInfos, ITContent chartContent, Chart chart) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
if (xAxis instanceof VanChartAxis) {
ITContent xAxisContent = ITContent.copy(chartContent);
xAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_X_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Format")
);
dealAxisHtmlLabelJS(jsInfos, ((VanChartAxis) xAxis).getHtmlLabel(), xAxisContent);
private void dealMonitorRefreshJS(ITContent conditionContent, ChartCollection chartCollection, List<JSInfo> jsInfos) {
for (int i = 0 ; i < chartCollection.getChartCount() ; i ++){
if (chartCollection.getChart(i) instanceof VanChart){
VanChart chart = (VanChart) chartCollection.getChart(i);
if (isMonitorValid(chart.getRefreshMoreLabel())){
VanChartHtmlLabel htmlLabel = chart.getRefreshMoreLabel().getAttrTooltip().getContent().getHtmlLabel();
if (htmlLabel != null){
ITContent content = ITContent.copy(conditionContent);
content.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Moniter_refresh"));
content.setReplaceObject(htmlLabel);
jsInfos.add(new JSInfo(content));
}
}
}
}
}
private boolean isMonitorValid(RefreshMoreLabel moreLabel){
return moreLabel.isMoreLabel() && moreLabel.getAttrTooltip() != null && moreLabel.getAttrTooltip().isEnable();
}
if (yAxis instanceof VanChartAxis) {
ITContent yAxisContent = ITContent.copy(chartContent);
yAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Y_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Format")
);
dealAxisHtmlLabelJS(jsInfos, ((VanChartAxis) yAxis).getHtmlLabel(), yAxisContent);
private void searchAxisJS(List<JSInfo> jsInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null){
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
if (xAxis instanceof VanChartAxis) {
ITContent xAxisContent = ITContent.copy(chartContent);
xAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_X_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Format")
);
dealAxisHtmlLabelJS(jsInfos, ((VanChartAxis) xAxis).getHtmlLabel(), xAxisContent);
}
if (yAxis instanceof VanChartAxis) {
ITContent yAxisContent = ITContent.copy(chartContent);
yAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Y_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Format")
);
dealAxisHtmlLabelJS(jsInfos, ((VanChartAxis) yAxis).getHtmlLabel(), yAxisContent);
}
}
}
private void dealAxisHtmlLabelJS(List<JSInfo> jsInfos, VanChartHtmlLabel label, ITContent content) {

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

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

@ -10,6 +10,7 @@ import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -97,7 +98,7 @@ public class ITReplaceMainDialog extends UIDialog {
setSize(width, height);
setLocation(new Point(point.x, point.y + jTemplate.getHeight() / 2 + jTemplate.getHeight() / 2 - 385));
northPane.fitScreen(0, 0, jTemplate.getWidth());
northPane.fitScreen(0, 0,width);
}
@ -142,7 +143,7 @@ public class ITReplaceMainDialog extends UIDialog {
}
}
});
center.add(northPane.getUpPanel(), BorderLayout.NORTH);
center.add(northPane.getScrollPane(), BorderLayout.NORTH);
center.add(southPanel.getTableEditorPane(), BorderLayout.CENTER);
add(westPanel.getLeftJpanel(), BorderLayout.WEST);
//主体部分
@ -154,42 +155,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 +283,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 +295,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);

53
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java

@ -1,8 +1,8 @@
package com.fr.design.actions.replace.ui;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
@ -12,6 +12,7 @@ import com.fr.stable.StringUtils;
import javax.swing.ComboBoxEditor;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -36,12 +37,16 @@ public class ITReplaceNorthPanel {
private UIComboBox findInputCombobox;
private UIComboBox replaceInputCombobox;
private UIScrollPane scrollPane;
private UIButton replaceButton;
private UIButton searchButton;
//存储的5次最近输入
private int maxItemCount = 5;
private static final int LIMIT_WIDTH = 1250;
private static final int HEIGHT = 161;
private static final int BUTTON_WIDTH = 60;
private static final int BUTTON_GAP = 20;
private int findLabelX, findLabelY, findLabelWidth, findLabelHeight;
@ -52,9 +57,9 @@ public class ITReplaceNorthPanel {
private int resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight;
private int findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight;
private int replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight;
private int replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight;
private int searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight;
private int buttonGap;
private int replaceButtonX, replaceButtonY, replaceButtonHeight;
private int searchButtonX, searchButtonY, searchButtonHeight;
public static ArrayList<String> findItems = new ArrayList<>();
public static ArrayList<String> findInputItems = new ArrayList<>();
@ -103,9 +108,8 @@ public class ITReplaceNorthPanel {
replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button"));
searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button"));
setLimitSize(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getWidth());
upPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT));
scrollPane = new UIScrollPane(upPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
upPanel.add(findLabel);
upPanel.add(rangeLabel);
upPanel.add(resultLabel);
@ -124,8 +128,8 @@ public class ITReplaceNorthPanel {
* @param width
*/
public void setLimitSize(int width) {
width = Math.max(LIMIT_WIDTH, width);
upPanel.setMaximumSize(new Dimension(width, 161));
upPanel.setMinimumSize(new Dimension(width, 161));
upPanel.setPreferredSize(new Dimension(width, 161));
}
@ -139,6 +143,8 @@ public class ITReplaceNorthPanel {
*/
public void fitScreen(int x, int y, int templateWidth) {
templateWidth = Math.max(templateWidth, LIMIT_WIDTH);
setFindLabelBounds(x, y, templateWidth);
setRangeLabelBounds(x, y, templateWidth);
setResultLabelBounds(x, y, templateWidth);
@ -152,6 +158,7 @@ public class ITReplaceNorthPanel {
setReplaceButtonBounds(x, y, templateWidth);
setSearchButtonBounds(x, y, templateWidth);
}
@ -198,27 +205,31 @@ public class ITReplaceNorthPanel {
}
private void setSearchButtonBounds(int x, int y, int templateWidth) {
buttonGap = templateWidth / 90;
searchButtonWidth = templateWidth / 30;
public UIScrollPane getScrollPane() {
return scrollPane;
}
public void setScrollPane(UIScrollPane scrollPane) {
this.scrollPane = scrollPane;
}
private void setSearchButtonBounds(int x, int y, int templateWidth) {
searchButtonHeight = 25;
searchButtonY = resultLabelY;
searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - replaceButtonWidth * 2 - buttonGap;
searchButton.setBounds(searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight);
searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH * 2 - BUTTON_GAP;
searchButton.setBounds(searchButtonX, searchButtonY, BUTTON_WIDTH, searchButtonHeight);
}
private void setReplaceButtonBounds(int x, int y, int templateWidth) {
buttonGap = templateWidth / 90;
replaceButtonWidth = templateWidth / 30;
replaceButtonHeight = 25;
replaceButtonY = resultLabelY;
replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - replaceButtonWidth;
replaceButton.setBounds(replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight);
replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - BUTTON_WIDTH;
replaceButton.setBounds(replaceButtonX, replaceButtonY, BUTTON_WIDTH, replaceButtonHeight);
}
private void setReplaceInputComboboxBounds(int x, int y, int templateWidth) {
replaceInputComboBoxX = x + templateWidth / 2 + templateWidth / 30;
replaceInputComboBoxX = x + templateWidth / 2 + templateWidth / 60;
replaceInputComboBoxY = y + 55;
replaceInputComboBoxWidth = templateWidth / 3 + templateWidth / 30 * 2;
replaceInputComboBoxHeight = 25;
@ -243,7 +254,7 @@ public class ITReplaceNorthPanel {
private void setRangeComboboxBounds(int x, int y, int templateWidth) {
rangeComboBoxX = x + templateWidth / 2 + templateWidth / 15 + templateWidth / 60;
rangeComboBoxX = x + templateWidth / 2 + templateWidth / 15;
rangeComboBoxY = y + 20;
rangeComboBoxWidth = templateWidth / 3 + templateWidth / 60;
rangeComboBoxHeight = 25;
@ -270,7 +281,7 @@ public class ITReplaceNorthPanel {
}
private void setRangeLabelBounds(int x, int y, int templateWidth) {
rangeLabelX = x + templateWidth / 2 + templateWidth / 30;
rangeLabelX = x + templateWidth / 2 + templateWidth / 60;
rangeLabelY = y + 20;
rangeLabelWidth = findLabelWidth;
rangeLabelHeight = 25;

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

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

@ -1,8 +1,11 @@
package com.fr.design.actions.replace.utils;
import com.fr.chart.base.DataSeriesCondition;
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;
@ -14,6 +17,7 @@ import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrTooltip;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.plugin.chart.vanchart.VanChart;
@ -38,7 +42,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) {
@ -69,12 +73,14 @@ public class SearchJSUtils {
*/
private static void addHtmlLabel2Array(List<Pair<VanChartHtmlLabel, String>> arrayList, ChartCollection collection) {
for (int i = 0; i < collection.getChartCount(); i++) {
VanChart chart = ((VanChart) collection.getChart(i));
int size = chart.getPlot().getConditionCollection().getConditionAttrSize();
ConditionCollection conditionCollection = chart.getPlot().getConditionCollection();
addAttrLabelHtmlLabel(chart, arrayList);
for (int j = 0; j < size; j++) {
searchConditionCollection(arrayList, conditionCollection.getConditionAttr(j));
if (collection.getChart(i) instanceof VanChart){
VanChart chart = ((VanChart) collection.getChart(i));
int size = chart.getPlot().getConditionCollection().getConditionAttrSize();
ConditionCollection conditionCollection = chart.getPlot().getConditionCollection();
addAttrLabelHtmlLabel(chart, arrayList);
for (int j = 0; j < size; j++) {
searchConditionCollection(arrayList, conditionCollection.getConditionAttr(j));
}
}
}
}
@ -102,15 +108,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 +130,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;
@ -140,14 +150,28 @@ public class SearchJSUtils {
private static void searchConditionCollection(List<Pair<VanChartHtmlLabel, String>> arrayList, ConditionAttr conditionAttr) {
int conditionSize = conditionAttr.getDataSeriesConditionCount();
for (int t = 0; t < conditionSize; t++) {
if (conditionAttr.getDataSeriesCondition(t) instanceof AttrTooltip) {
arrayList.add(new Pair<>(((AttrTooltip) conditionAttr.getDataSeriesCondition(t)).getContent().getHtmlLabel(),
Toolkit.i18nText("Fine-Design_Chart_Animation_Special") + "-" + Toolkit.i18nText("Fine-Design_Chart_Condition_Display")));
DataSeriesCondition condition = conditionAttr.getDataSeriesCondition(t);
String str = Toolkit.i18nText("Fine-Design_Chart_Animation_Special") + "-" + Toolkit.i18nText("Fine-Design_Chart_Condition_Display");
if (StringUtils.isNotEmpty(conditionAttr.getName())){
str += "-"+conditionAttr.getName();
}
if (condition instanceof AttrTooltip) {
arrayList.add(new Pair<>(((AttrTooltip) condition).getContent().getHtmlLabel(), str+"-"+Toolkit.i18nText("Fine-Design_Chart_Data_Point_Tooltip")));
}
if (condition instanceof AttrLabel){
AttrLabel label = (AttrLabel) condition;
if (isAttrLabelValid(label)){
arrayList.add(new Pair<>(label.getContent().getHtmlLabel(), str+"-"+Toolkit.i18nText("Fine-Design_Chart_Label")));
}
}
}
}
private static boolean isAttrLabelValid(AttrLabel label){
return label.isEnable() && label.getContent() != null && label.getContent().getHtmlLabel() != null;
}
/**
* 获取图表-特效-交互属性中的JS
*
@ -157,10 +181,11 @@ public class SearchJSUtils {
public static List<NameJavaScript> getNameJavaScript(ChartCollection chartCollection) {
ArrayList<NameJavaScript> nameJavaScriptArrayList = new ArrayList<>();
for (int i = 0; i < chartCollection.getChartCount(); i++) {
VanChart chart = ((VanChart) chartCollection.getChart(i));
NameJavaScriptGroup nameJavaScriptGroup = chart.getPlot().getHotHyperLink();
addNameJavaScript2Array(nameJavaScriptArrayList, nameJavaScriptGroup);
if (chartCollection.getChart(i) instanceof VanChart){
VanChart chart = ((VanChart) chartCollection.getChart(i));
NameJavaScriptGroup nameJavaScriptGroup = chart.getPlot().getHotHyperLink();
addNameJavaScript2Array(nameJavaScriptArrayList, nameJavaScriptGroup);
}
}
return nameJavaScriptArrayList;
}
@ -239,17 +264,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