From 72817d38b022acbf29519f8d8fb4d968af4ca2f4 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 22 Sep 2022 10:16:38 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-75998=20=E6=B7=BB=E5=8A=A0=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8-=E6=95=B0=E6=8D=AE=E6=90=9C=E7=B4=A2=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E3=80=81=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E8=BE=93=E5=85=A5=E7=9A=84=E5=A4=84=E7=90=86=E3=80=81?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B6=85=E9=93=BE=E6=82=AC=E6=B5=AE=E7=AA=97?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/ShowSearchResultAction.java | 6 +- .../content/formula/FormulaReplaceObject.java | 30 ++- .../action/content/formula/FormulaTag.java | 128 ++++++++++ .../SearchChartBoxDataFormulaAction.java | 95 +++++++ .../SearchChartBubbleDataFormulaAction.java | 79 ++++++ .../SearchChartCollectionFormulaAction.java | 31 ++- .../SearchChartCustomDataFormulaAction.java | 79 ++++++ .../formula/chart/SearchChartDataFormula.java | 46 ++++ .../chart/SearchChartDataFormulaManager.java | 160 ++++++++++++ .../SearchChartDrillMapDataFormulaAction.java | 93 +++++++ .../SearchChartGanttDataFormulaAction.java | 108 ++++++++ .../SearchChartMapDataFormulaAction.java | 239 ++++++++++++++++++ .../SearchChartMeterDataFormulaAction.java | 68 +++++ .../SearchChartMultiPieDataFormulaAction.java | 71 ++++++ ...rchChartNormalReportDataFormulaAction.java | 65 +++++ ...SearchChartStructureDataFormulaAction.java | 69 +++++ ...SearchChartVanNormalDataFormulaAction.java | 74 ++++++ ...SearchChartWordCloudDataFormulaAction.java | 63 +++++ .../SearchChartHyperPopLinkAction.java | 68 +++++ .../javascript/SearchJSFormulaManager.java | 6 +- .../replace/info/DealWithInfoValue.java | 14 +- .../actions/replace/info/base/ITContent.java | 59 ++++- .../actions/replace/info/base/SearchTag.java | 37 +++ .../replace/ui/ITReplaceMainDialog.java | 70 ++--- .../replace/ui/ITReplaceWestPanel.java | 4 +- .../actions/replace/utils/SearchJSUtils.java | 37 ++- .../actions/replace/utils/ShowValueUtils.java | 15 +- 27 files changed, 1734 insertions(+), 80 deletions(-) create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBubbleDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCustomDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormula.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormulaManager.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDrillMapDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartGanttDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMeterDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMultiPieDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartNormalReportDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartStructureDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartVanNormalDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartWordCloudDataFormulaAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchChartHyperPopLinkAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java index 2f44137c78..0d250337c4 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java @@ -59,7 +59,7 @@ public enum ShowSearchResultAction implements ShowValue { ChartCollection chartCollection = (ChartCollection) cellElement.getValue(); for (int i = 0; i < chartCollection.getChartCount(); i++) { String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject()); - if (titleName.contains(str)) { + if (isTitleNameValid(titleName, str)) { CellInfo cellInfo = ((CellInfo) info).copy(); cellInfo.setCellChartIndex(i); cellInfo.getContent().addOtherPos( @@ -92,6 +92,10 @@ public enum ShowSearchResultAction implements ShowValue { cellInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(titleName, str)); cellInfo.getContent().setSelected(true); } + + private boolean isTitleNameValid(String titleName, String str){ + return titleName.contains(str) && StringUtils.isNotEmpty(titleName); + } }, /** * 搜索JS事件 diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java index 3aaea18b33..720dbab1e8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java +++ b/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 getValue(Object... o) { + HashMap 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> 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; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java new file mode 100644 index 0000000000..c5c12d3bfc --- /dev/null +++ b/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> 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> 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> 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> 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> 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> 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> operatorArray); + + @Override + public String getInfoShowStr(Info info) { + return info.getContent().getOldShowStr(); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java new file mode 100644 index 0000000000..fee727ae36 --- /dev/null +++ b/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 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 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 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBubbleDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBubbleDataFormulaAction.java new file mode 100644 index 0000000000..d012ad58b3 --- /dev/null +++ b/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 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 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java index 15da2cd842..fd17f57eeb 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java +++ b/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 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 formulaInfos, ITContent content, Chart chart) { - if (chart.defaultChartData() instanceof NormalChartData) { - NormalChartData chartData = (NormalChartData) chart.defaultChartData(); - //todo - } + private boolean isDefinitionValid(TopDefinitionProvider provider) { + return provider != null && SearchChartDataFormulaManager.getInstance().getChartDataType().containsKey(provider.getClass().getSimpleName()); } @@ -120,7 +131,7 @@ public class SearchChartCollectionFormulaAction { if (xAxis != null) { //轴标题 ITContent xAxisContent = ITContent.copy(chartContent); - if (!chartContent.isFrm()){ + if (!chartContent.isFrm()) { xAxisContent.addOtherPos(chart.getChartName()); } xAxisContent.addOtherPos( diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCustomDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCustomDataFormulaAction.java new file mode 100644 index 0000000000..5c63ac52e0 --- /dev/null +++ b/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 formulaInfos, ITContent content, TopDefinitionProvider provider) { + if (provider instanceof CustomDefinition) { + CustomDefinition definition = (CustomDefinition) provider; + Map 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormula.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormula.java new file mode 100644 index 0000000000..6378d9dfb1 --- /dev/null +++ b/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 formulaInfos, ITContent content, TopDefinitionProvider provider); + + /** + * 快速处理Formula + * + * @param formulaInfos + * @param reportContent + * @param otherPos + * @param o + */ + default void dealFormulaObject(List 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)); + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormulaManager.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormulaManager.java new file mode 100644 index 0000000000..f8916a757f --- /dev/null +++ b/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 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 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDrillMapDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDrillMapDataFormulaAction.java new file mode 100644 index 0000000000..e4e6000e85 --- /dev/null +++ b/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 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 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartGanttDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartGanttDataFormulaAction.java new file mode 100644 index 0000000000..75c6daf235 --- /dev/null +++ b/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 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 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 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; + } + } +} + diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java new file mode 100644 index 0000000000..c66309c10a --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java @@ -0,0 +1,239 @@ +package com.fr.design.actions.replace.action.content.formula.chart; + +import com.fr.base.Formula; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.actions.replace.info.FormulaInfo; +import com.fr.design.actions.replace.info.base.ITContent; +import com.fr.design.actions.replace.info.base.SearchTag; +import com.fr.design.i18n.Toolkit; +import com.fr.plugin.chart.map.data.VanMapDefinition; +import com.fr.plugin.chart.map.data.VanMapReportDefinition; + +import java.util.List; + +/** + * 地图 + * + * @author Destiny.Lin + * @version 11.0 + * created by Destiny.Lin on 2022-09-21 + */ +public class SearchChartMapDataFormulaAction implements SearchChartDataFormula { + private SearchChartMapDataFormulaAction() { + } + + @Override + public void searchChartDataFormula(List 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 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 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 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 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 formulaInfos, ITContent content, TopDefinitionProvider pointDefinition) { + if (pointDefinition instanceof VanMapReportDefinition) { + VanMapReportDefinition definition = (VanMapReportDefinition) pointDefinition; + ITContent pointContent = ITContent.copy(content); + //经纬度 + dealLongitudeAndLatitude(formulaInfos, pointContent, definition); + } + } + + public void dealAreaName(List 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 formulaInfos, ITContent content, List 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; + } + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMeterDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMeterDataFormulaAction.java new file mode 100644 index 0000000000..6b635ebfda --- /dev/null +++ b/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 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMultiPieDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMultiPieDataFormulaAction.java new file mode 100644 index 0000000000..75f1147a98 --- /dev/null +++ b/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 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartNormalReportDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartNormalReportDataFormulaAction.java new file mode 100644 index 0000000000..cfd3f0e68e --- /dev/null +++ b/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 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartStructureDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartStructureDataFormulaAction.java new file mode 100644 index 0000000000..266d1fe4a0 --- /dev/null +++ b/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 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartVanNormalDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartVanNormalDataFormulaAction.java new file mode 100644 index 0000000000..65f4800d21 --- /dev/null +++ b/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 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartWordCloudDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartWordCloudDataFormulaAction.java new file mode 100644 index 0000000000..d22eadaeab --- /dev/null +++ b/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 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; + } + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchChartHyperPopLinkAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchChartHyperPopLinkAction.java new file mode 100644 index 0000000000..4edd5b4f17 --- /dev/null +++ b/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 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; + } + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormulaManager.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormulaManager.java index df797a36fa..e77e4c60ec 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormulaManager.java +++ b/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 diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/info/DealWithInfoValue.java b/designer-realize/src/main/java/com/fr/design/actions/replace/info/DealWithInfoValue.java index feb5cc1a78..2330fa5fdf 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/info/DealWithInfoValue.java +++ b/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 getValue(Object... o); + default Map 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> operatorArray); + default void setValue(Info info, String findStr, String replaceStr, List> operatorArray) { + } /** @@ -43,5 +47,7 @@ public interface DealWithInfoValue { * @param info 信息 * @return 返回用于展示的字符串 */ - String getInfoShowStr(Info info); + default String getInfoShowStr(Info info) { + return StringUtils.EMPTY; + } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java b/designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java index de736cb27f..afa9847f37 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java +++ b/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; } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java b/designer-realize/src/main/java/com/fr/design/actions/replace/info/base/SearchTag.java new file mode 100644 index 0000000000..2106c51c0f --- /dev/null +++ b/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; + + +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java index 4ac477cdc5..da8951d5ab 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java @@ -154,42 +154,43 @@ public class ITReplaceMainDialog extends UIDialog { * 替换 */ private void replace() { + String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText(); + String replaceStr = ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).getText(); + if (StringUtils.equals(getSearchStr(), searchStr)) { + if (isITReplaceValid() && checkTemplateChanged(searchResultList)) { + for (Info info : searchResultList) { + if (info.getContent().isSelected()) { + info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray()); + ShowValueUtils.updateHighlight(info, replaceStr); + } + } + southPanel.getTableEditorPane().update(); + northPane.refreshReplaceInputComboBoxItems(); + ITTableEditorPane.getEditTable().repaint(); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange(); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true); + setSearchFlag(false); - if (isITReplaceValid() && checkTemplateChanged(searchResultList)) { - String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText(); - String replaceStr = ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).getText(); - - - for (Info info : searchResultList) { - if (info.getContent().isSelected()) { - info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray()); - ShowValueUtils.updateHighlight(info, replaceStr); + } else { + Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")}; + int optionSelected = FineJOptionPane.showOptionDialog( + ITReplaceMainDialog.this, + Toolkit.i18nText("Fine-Design_Replace_Message"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.ERROR_MESSAGE, + null, + // 如果传null, 则按钮为 optionType 类型所表示的按钮(也就是确认对话框) + options, + options[0] + ); + //如果选择了重新查找,则再查找一遍 + if (optionSelected == 0) { + search(); } } - southPanel.getTableEditorPane().update(); - northPane.refreshReplaceInputComboBoxItems(); - ITTableEditorPane.getEditTable().repaint(); - HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange(); - HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true); - setSearchFlag(false); - } else { - Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")}; - int optionSelected = FineJOptionPane.showOptionDialog( - ITReplaceMainDialog.this, - Toolkit.i18nText("Fine-Design_Replace_Message"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), - JOptionPane.YES_NO_CANCEL_OPTION, - JOptionPane.ERROR_MESSAGE, - null, - // 如果传null, 则按钮为 optionType 类型所表示的按钮(也就是确认对话框) - options, - options[0] - ); - //如果选择了重新查找,则再查找一遍 - if (optionSelected == 0) { - search(); - } + search(); } @@ -281,9 +282,11 @@ public class ITReplaceMainDialog extends UIDialog { JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); templateID = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget().getTemplateID(); itTableEditor.clear(); + String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText(); + setSearchStr(searchStr); ShowSearchResultAction searchAction = ShowSearchResultAction.match(GeneralUtils.objectToString(northPane.getFindCombobox().getSelectedItem())); if (searchAction != null) { - searchResultList = searchAction.addMatchResult(((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText(), searchAction.showSearchValue(jTemplate)); + searchResultList = searchAction.addMatchResult(searchStr, searchAction.showSearchValue(jTemplate)); itTableEditor.add(searchResultList); northPane.getResultLabel().setText("" + Toolkit.i18nText("Fine-Design_Replace_Search_Finish") + "" + searchResultList.size() + "" + Toolkit.i18nText("Fine-Design_Replace_Result")); } @@ -291,7 +294,6 @@ public class ITReplaceMainDialog extends UIDialog { northPane.refreshFindInputComboBoxItems(); setSearchFlag(true); - String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText(); if (StringUtils.isNotEmpty(searchStr)) { ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setEditable(true); northPane.getReplaceInputCombobox().setEditable(true); diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java index a552f4f841..9295baf655 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java +++ b/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)); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java index 6ec96038eb..5c7acb1b3c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java @@ -3,6 +3,8 @@ package com.fr.design.actions.replace.utils; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.chart.web.ChartHyperPoplink; +import com.fr.design.actions.replace.action.content.js.SearchChartJSAction; import com.fr.design.actions.replace.info.JSInfo; import com.fr.design.actions.replace.info.base.ITContent; import com.fr.design.i18n.Toolkit; @@ -38,7 +40,7 @@ public class SearchJSUtils { * 从Listener中获取JS */ public static void searchJSFromListener(List jsInfos, ITContent content) { - if (content.getReplaceObject() instanceof Listener){ + if (content.getReplaceObject() instanceof Listener) { Listener listener = (Listener) (content.getReplaceObject()); JavaScript javaScript = listener.getAction(); if (javaScript instanceof JavaScriptImpl) { @@ -102,15 +104,18 @@ public class SearchJSUtils { Toolkit.i18nText("Fine-Design_Chart_Tooltip") + "-" + Toolkit.i18nText("Fine-Design_Basic_Custom"))); } } - private static boolean isToolTipValid(VanChartPlot plot){ + + private static boolean isToolTipValid(VanChartPlot plot) { return plot.getAttrTooltipFromConditionCollection() != null && ((AttrTooltip) plot.getAttrTooltipFromConditionCollection()).isEnable() && plot.getAttrTooltipFromConditionCollection() instanceof AttrTooltip; } + private static void addAttrLabelDetail2Array(VanChartPlot plot, List> arrayList) { if (isLabelDetailValid(plot)) { arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getAttrLabelDetail().getContent().getHtmlLabel(), Toolkit.i18nText("Fine-Design_Chart_Value_Label"))); } } - private static boolean isLabelDetailValid(VanChartPlot plot){ + + private static boolean isLabelDetailValid(VanChartPlot plot) { return plot.getAttrLabelFromConditionCollection() != null && plot.getAttrLabelFromConditionCollection().getAttrLabelDetail() != null && plot.getAttrLabelFromConditionCollection().getAttrLabelDetail().getContent().getHtmlLabel() != null; @@ -121,7 +126,8 @@ public class SearchJSUtils { arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getSecondLabelDetail().getContent().getHtmlLabel(), Toolkit.i18nText("Fine-Design_Chart_Category_Label"))); } } - private static boolean isSecondLabelDetailValid(VanChartPlot plot){ + + private static boolean isSecondLabelDetailValid(VanChartPlot plot) { return plot.getAttrLabelFromConditionCollection() != null && plot.getAttrLabelFromConditionCollection().getSecondLabelDetail() != null && plot.getAttrLabelFromConditionCollection().getSecondLabelDetail().getContent().getHtmlLabel() != null; @@ -239,17 +245,34 @@ public class SearchJSUtils { public static void addJSInfosFromHyperLink(Elem elem, List 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 * diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java index 75288d0f92..b215a16c6d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java +++ b/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; From 2a810e445c841c17fec8c62675e39a15572c6489 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 22 Sep 2022 10:40:18 +0800 Subject: [PATCH 2/5] =?UTF-8?q?REPORT-75998=20=E6=B7=BB=E5=8A=A0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E3=80=81=E5=A2=9E=E5=8A=A0=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=BA=95=E5=B1=82=E7=BB=84=E4=BB=B6=E7=9A=84=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/component/SearchComponentAction.java | 11 +++++++++++ .../chart/SearchChartMapDataFormulaAction.java | 7 +++++++ .../formula/widget/SearchWidgetFormulaAction.java | 11 +++++++---- .../formula/widget/SearchWidgetFormulaManager.java | 3 ++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/SearchComponentAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/SearchComponentAction.java index 4326f62287..336aa93745 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/SearchComponentAction.java +++ b/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 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 componentInfos, ITContent content, Widget body) { if (body instanceof WLayout) { ITContent bodyContent = ITContent.copy(content); diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java index c66309c10a..b892e35c82 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java @@ -159,6 +159,13 @@ public class SearchChartMapDataFormulaAction implements SearchChartDataFormula { } } + /** + * 处理区域名 + * @param formulaInfos + * @param content + * @param object + * @param definition + */ public void dealAreaName(List formulaInfos, ITContent content, Object object, VanMapReportDefinition definition) { if (object instanceof Formula) { ITContent cateContent = ITContent.copy(content); diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaAction.java index 769d608382..3e1f4a8bcf 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaAction.java +++ b/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 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; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaManager.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaManager.java index 719f49f003..1d11046164 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaManager.java +++ b/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()); /** * 日期类型 */ From 8b938e3a8ac7df4f1025a11b6af4cf73101c6045 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 22 Sep 2022 12:37:56 +0800 Subject: [PATCH 3/5] =?UTF-8?q?REPORT-75998=20=E5=A4=84=E7=90=86=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E5=9B=BE=E8=A1=A8=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SearchChartBoxDataFormulaAction.java | 2 +- .../content/js/SearchChartJSAction.java | 41 ++++++++++--------- .../actions/replace/utils/SearchJSUtils.java | 23 ++++++----- 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java index fee727ae36..b677d3e86f 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java @@ -50,7 +50,7 @@ public class SearchChartBoxDataFormulaAction implements SearchChartDataFormula { 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()); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java index 768972c679..9f5e705a62 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java @@ -59,27 +59,30 @@ public class SearchChartJSAction { } private void searchAxisJS(List 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); + 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); + } } - 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 jsInfos, VanChartHtmlLabel label, ITContent content) { diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java index 5c7acb1b3c..1495c8fac8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java @@ -71,12 +71,14 @@ public class SearchJSUtils { */ private static void addHtmlLabel2Array(List> 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)); + } } } } @@ -163,10 +165,11 @@ public class SearchJSUtils { public static List getNameJavaScript(ChartCollection chartCollection) { ArrayList 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; } From c899ce3df3aab02a0732023772039c3ccc875c0f Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 22 Sep 2022 15:50:39 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-75998=20=E7=95=8C=E9=9D=A2=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=BB=9A=E5=8A=A8=E6=9D=A1=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=8F=AF=E8=83=BD=E4=BC=9A=E5=87=BA=E9=94=99?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E6=96=AD=E3=80=81=E5=A2=9E=E5=8A=A0=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E6=98=BE=E7=A4=BA-=E6=9D=A1=E4=BB=B6=E5=B1=9E?= =?UTF-8?q?=E6=80=A7-=E6=A0=87=E7=AD=BE=E4=B8=AD=E7=9A=84JS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/ShowSearchResultAction.java | 22 ++-- .../SearchChartCollectionFormulaAction.java | 110 +++++++++--------- .../replace/ui/ITReplaceMainDialog.java | 5 +- .../replace/ui/ITReplaceNorthPanel.java | 54 +++++---- .../actions/replace/utils/SearchJSUtils.java | 22 +++- 5 files changed, 127 insertions(+), 86 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java index 0d250337c4..601b3d09e5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java +++ b/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 (isTitleNameValid(titleName, 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( @@ -93,9 +94,6 @@ public enum ShowSearchResultAction implements ShowValue { cellInfo.getContent().setSelected(true); } - private boolean isTitleNameValid(String titleName, String str){ - return titleName.contains(str) && StringUtils.isNotEmpty(titleName); - } }, /** * 搜索JS事件 @@ -233,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( @@ -410,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())); + } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java index fd17f57eeb..9276302a90 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java @@ -76,34 +76,37 @@ public class SearchChartCollectionFormulaAction { } private void searchChartPatternFormulaFromAlertLine(List 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 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 list = ((VanChartAxis) xAxis).getAlertValues(); + for (VanChartAlertValue alertValue : list) { + //警戒线设置 + dealAlertValue(formulaInfos, content, alertValue); + //提示文字 + dealAlertContent(formulaInfos, content, alertValue); + } } - } - if (yAxis instanceof VanChartAxis) { - List list = ((VanChartAxis) yAxis).getAlertValues(); - for (VanChartAlertValue alertValue : list) { - //警戒线设置 - dealAlertValue(formulaInfos, content, alertValue); - //提示文字 - dealAlertContent(formulaInfos, content, alertValue); + if (yAxis instanceof VanChartAxis) { + List list = ((VanChartAxis) yAxis).getAlertValues(); + for (VanChartAlertValue alertValue : list) { + //警戒线设置 + dealAlertValue(formulaInfos, content, alertValue); + //提示文字 + dealAlertContent(formulaInfos, content, alertValue); + } } } + } private void dealAlertContent(List formulaInfos, ITContent content, VanChartAlertValue alertValue) { @@ -125,39 +128,40 @@ public class SearchChartCollectionFormulaAction { } private void searchChartPatternFormulaFromAxisValue(List 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 formulaInfos, ITContent axisContent, Axis axis) { diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java index da8951d5ab..a1443d89f4 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java +++ b/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); //主体部分 diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java index ff5b3c8199..eb019cff65 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java +++ b/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 findItems = new ArrayList<>(); public static ArrayList 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,9 @@ 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.setMinimumSize(new Dimension(width, 161)); upPanel.setPreferredSize(new Dimension(width, 161)); } @@ -139,6 +144,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 +159,7 @@ public class ITReplaceNorthPanel { setReplaceButtonBounds(x, y, templateWidth); setSearchButtonBounds(x, y, templateWidth); + } @@ -198,27 +206,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 +255,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 +282,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; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java index 1495c8fac8..13094fc5c8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java @@ -1,5 +1,6 @@ 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; @@ -16,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; @@ -148,14 +150,28 @@ public class SearchJSUtils { private static void searchConditionCollection(List> 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 * From da1d28d62de11caadf6d2f157fd07c76c5e63e40 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 22 Sep 2022 16:32:53 +0800 Subject: [PATCH 5/5] =?UTF-8?q?REPORT-75998=20=E6=B7=BB=E5=8A=A0=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E5=88=B7=E6=96=B0JS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/js/SearchChartJSAction.java | 28 ++++++++++++++++++- .../replace/ui/ITReplaceNorthPanel.java | 1 - 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java index 9f5e705a62..b7269318e5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java +++ b/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,13 +53,37 @@ 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 dealMonitorRefreshJS(ITContent conditionContent, ChartCollection chartCollection, List 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(); + } + private void searchAxisJS(List jsInfos, ITContent chartContent, Chart chart) { if (chart.getPlot() != null){ Axis xAxis = chart.getPlot().getxAxis(); diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java index eb019cff65..bc4e82255f 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java @@ -130,7 +130,6 @@ public class ITReplaceNorthPanel { 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)); }