Browse Source

Merge pull request #10540 in DESIGN/design from bugfix/11.0 to feature/x

* commit '3adf5179b57abbafd6805ebc57835b9e28aa4a4d':
  REPORT-83083 FR图表全量覆盖-部分位置内容查不到相应位置信息,需要补充一下
  REPORT-83604 模板内容所有类型的替换:单条替换会替换所有
  REPORT-83302 设置项弹窗打开后再次编辑的内容无法实时显示在可选项里
  REPORT-83571 数据列设置从分组-普通替换为列表不生效
feature/x
superman 2 years ago
parent
commit
98a5d7e00e
  1. 131
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  2. 41
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java
  3. 3
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchChartHyperPopLinkAction.java
  4. 40
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java
  5. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/CellGroupType.java
  6. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  7. 41
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  8. 134
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java
  9. 40
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

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

@ -13,15 +13,14 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartattr.SwitchTitle;
import com.fr.chart.chartattr.Title;
import com.fr.chart.chartdata.NormalReportDataDefinition;
import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction;
import com.fr.design.actions.replace.action.content.formula.widget.DictionaryType;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.SearchJSUtils;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.js.NameJavaScript;
@ -29,10 +28,13 @@ import com.fr.js.NameJavaScriptGroup;
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 com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.custom.CustomDefinition;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.report.cell.TemplateCellElement;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.stable.StringUtils;
import java.util.List;
@ -111,21 +113,41 @@ public class SearchChartCollectionFormulaAction {
}
private void dealPlot(List<FormulaInfo> formulaInfos, ITContent content, Plot plot) {
if (SearchJSUtils.isCustomMapPlot(plot)) {
dealNameJavaScriptGroup(formulaInfos, ShowValueUtils.getCustomMapContent(content, Toolkit.i18nText("Fine-Design_Chart_Region_Map")), ((VanChartMapPlot) plot).getAreaHotHyperLink());
dealNameJavaScriptGroup(formulaInfos, ShowValueUtils.getCustomMapContent(content, Toolkit.i18nText("Fine-Design_Chart_LineMap")), ((VanChartMapPlot) plot).getLineHotHyperLink());
dealNameJavaScriptGroup(formulaInfos, ShowValueUtils.getCustomMapContent(content, Toolkit.i18nText("Fine-Design_Chart_PointMap")), ((VanChartMapPlot) plot).getPointHotHyperLink());
} else {
NameJavaScriptGroup javaScriptGroup = plot.getHotHyperLink();
dealNameJavaScriptGroup(formulaInfos, content, javaScriptGroup);
}
}
private void dealNameJavaScriptGroup(List<FormulaInfo> formulaInfos, ITContent content, NameJavaScriptGroup javaScriptGroup) {
if (javaScriptGroup != null) {
for (int i = 0; i < javaScriptGroup.size(); i++) {
ITContent formulaContent = ITContent.copy(content);
NameJavaScript javaScript = javaScriptGroup.getNameHyperlink(i);
content.addOtherPos(javaScript.getName());
formulaContent.addOtherPos(javaScript.getName());
SearchJSHighlightAction action = SearchJSHighlightAction.getInstance();
action.searchJSFormulaFromOther(formulaInfos, content, javaScript.getJavaScript());
action.searchJSFormulaFromOther(formulaInfos, formulaContent, javaScript.getJavaScript());
}
}
}
private void searchFormulaFromChartPresent(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
searchPresent4Formula(provider.getCategoryPresent(), content, formulaInfos);
searchPresent4Formula(provider.getSeriesPresent(), content, formulaInfos);
if (provider instanceof CustomDefinition) {
CustomDefinition definition = (CustomDefinition) provider;
Map<CustomPlotType, TopDefinitionProvider> map = definition.getDefinitionProviderMap();
for (CustomPlotType type : map.keySet()) {
ITContent customContent = ITContent.copy(content);
customContent.addOtherPos(CustomPlotFactory.getTitle(type));
searchFormulaFromChartPresent(formulaInfos, customContent, map.get(type));
}
} else {
searchPresent4Formula(provider.getCategoryPresent(), ShowValueUtils.getCustomMapContent(content, Toolkit.i18nText("Fine-Design_Chart_Category")), formulaInfos);
searchPresent4Formula(provider.getSeriesPresent(), ShowValueUtils.getCustomMapContent(content, Toolkit.i18nText("Fine-Design_Chart_Series")), formulaInfos);
}
}
private void searchPresent4Formula(Present present, ITContent content, List<FormulaInfo> formulaInfos) {
@ -195,26 +217,33 @@ public class SearchChartCollectionFormulaAction {
private void searchChartPatternFormulaFromAlertLine(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
if (chart.getPlot() instanceof VanChartRectanglePlot) {
VanChartRectanglePlot plot = chart.getPlot();
for (VanChartAxis axis : plot.getXAxisList()) {
dealAlertLineFormula(formulaInfos, chartContent, axis);
}
for (VanChartAxis axis : plot.getYAxisList()) {
dealAlertLineFormula(formulaInfos, chartContent, axis);
}
} else {
dealAlertLineFormula(formulaInfos, chartContent, chart.getPlot().getxAxis());
dealAlertLineFormula(formulaInfos, chartContent, chart.getPlot().getyAxis());
}
}
}
private void dealAlertLineFormula(List<FormulaInfo> formulaInfos, ITContent chartContent, Axis axis) {
if (axis instanceof VanChartAxis) {
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")
Toolkit.i18nText("Fine-Design_Chart_Alert_Line"),
((VanChartAxis) axis).getAxisName()
);
if (xAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) xAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
}
}
if (yAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) yAxis).getAlertValues();
List<VanChartAlertValue> list = ((VanChartAxis) axis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
@ -224,9 +253,6 @@ public class SearchChartCollectionFormulaAction {
}
}
}
private void dealAlertContent(List<FormulaInfo> formulaInfos, ITContent content, VanChartAlertValue alertValue) {
if (alertValue.getAlertContentFormula() != null) {
ITContent alertContent = ITContent.copy(content);
@ -247,41 +273,44 @@ public class SearchChartCollectionFormulaAction {
private void searchChartPatternFormulaFromAxisValue(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null) {
if (chart.getPlot() instanceof VanChartRectanglePlot) {
searchVanChartRectanglePlotAxisFormula(formulaInfos, chartContent, chart.getPlot(), chart);
} else {
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());
//样式-坐标轴
dealAxisFormula(formulaInfos, chartContent, xAxis, chart);
dealAxisFormula(formulaInfos, chartContent, yAxis, chart);
}
}
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(),
private void searchVanChartRectanglePlotAxisFormula(List<FormulaInfo> formulaInfos, ITContent chartContent, VanChartRectanglePlot plot, Chart chart) {
for (VanChartAxis axis : plot.getXAxisList()) {
dealAxisFormula(formulaInfos, chartContent, axis, chart);
}
for (VanChartAxis axis : plot.getYAxisList()) {
dealAxisFormula(formulaInfos, chartContent, axis, chart);
}
}
private void dealAxisFormula(List<FormulaInfo> formulaInfos, ITContent chartContent, Axis axis, Chart chart) {
if (axis instanceof VanChartAxis) {
//轴标题
ITContent content = ITContent.copy(chartContent);
if (!chartContent.isFrm()) {
content.addOtherPos(chart.getChartName());
}
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Y_Axis")
((VanChartAxis) axis).getAxisName()
);
dealTitle(formulaInfos, yAxisContent, yAxis.getTitle());
dealChartValueDefine(formulaInfos, yAxisContent, yAxis);
dealTitle(formulaInfos, content, axis.getTitle());
dealChartValueDefine(formulaInfos, content, axis);
}
}
}
private void dealChartValueDefine(List<FormulaInfo> formulaInfos, ITContent axisContent, Axis axis) {
ITContent content = ITContent.copy(axisContent);
content.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Value_Define"));

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

@ -34,11 +34,11 @@ public class SearchChartMapDataFormulaAction implements SearchChartDataFormula {
//流向地图
ITContent lineContent = ITContent.copy(content);
lineContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_LineMap"));
dealLineDefinition(formulaInfos, content, mapDefinition.getLineDefinition());
dealLineDefinition(formulaInfos, lineContent, mapDefinition.getLineDefinition());
//点地图
ITContent pointContent = ITContent.copy(content);
pointContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_PointMap"));
dealPointDefinition(formulaInfos, content, mapDefinition.getPointDefinition());
dealPointDefinition(formulaInfos, pointContent, mapDefinition.getPointDefinition());
}
}
@ -101,7 +101,7 @@ public class SearchChartMapDataFormulaAction implements SearchChartDataFormula {
formulaInfos.add(new FormulaInfo(endAreaNameContent));
}
//区域名
dealAreaName(formulaInfos, lineContent, definition.getCategoryName(), definition);
dealAreaName(formulaInfos, lineContent, definition.getCategoryName(), definition, true);
}
}
@ -160,18 +160,34 @@ public class SearchChartMapDataFormulaAction implements SearchChartDataFormula {
}
/**
* 处理区域名
* @param formulaInfos
* @param content
* @param object
* @param definition
* 处理区域名不用考虑特殊起名
* @param formulaInfos 存储信息的数据结构
* @param content ITContent
* @param object 分类
* @param definition 数据
*/
public void dealAreaName(List<FormulaInfo> formulaInfos, ITContent content, Object object, VanMapReportDefinition definition) {
dealAreaName(formulaInfos, content, object, definition, false);
}
/**
* 处理区域名特殊起名
* @param formulaInfos 存储信息的数据结构
* @param content ITContent
* @param object 分类
* @param definition 数据
* @param lineFlag 线地图的标志
*/
public void dealAreaName(List<FormulaInfo> formulaInfos, ITContent content, Object object, VanMapReportDefinition definition, boolean lineFlag) {
String str;
if (lineFlag) {
str = Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name");
} else {
str = Toolkit.i18nText("Fine-Design_Chart_Area_Name");
}
if (object instanceof Formula) {
ITContent cateContent = ITContent.copy(content);
cateContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Area_Name")
);
cateContent.addOtherPos(str);
cateContent.setReplaceObject(object);
formulaInfos.add(new FormulaInfo(cateContent));
} else if (isFormulaString(object)) {
@ -179,12 +195,11 @@ public class SearchChartMapDataFormulaAction implements SearchChartDataFormula {
strContent.setHoldObject(definition);
strContent.setTag(SearchTag.CHART_AREA_NAME);
strContent.setReplaceObject(object);
strContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Area_Name"));
strContent.addOtherPos(str);
formulaInfos.add(new FormulaInfo(strContent));
}
}
/**
* 处理系列名&
*/

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

@ -27,7 +27,8 @@ public class SearchChartHyperPopLinkAction implements SearchJSFormula {
if (javaScript instanceof ChartHyperPoplink) {
ChartHyperPoplink chartHyperPoplink = (ChartHyperPoplink) javaScript;
if (chartHyperPoplink.getChartCollection() instanceof ChartCollection) {
SearchChartCollectionFormulaAction.getInstance().searchChartCollectionFormula(formulaInfos, content, (ChartCollection) chartHyperPoplink.getChartCollection());
ITContent chartContent = ITContent.copy(content);
SearchChartCollectionFormulaAction.getInstance().searchChartCollectionFormula(formulaInfos, chartContent, (ChartCollection) chartHyperPoplink.getChartCollection());
}
}
}

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

@ -13,6 +13,7 @@ import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.base.RefreshMoreLabel;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.plugin.chart.custom.CustomPlotFactory;
@ -45,7 +46,7 @@ public class SearchChartJSAction {
*/
public void searchChartJS(ChartCollection chartCollection, ITContent content, List<JSInfo> jsInfos) {
List<Pair<VanChartHtmlLabel, String>> htmlLabels = SearchJSUtils.getHtmlLabel(chartCollection);
List<NameJavaScript> nameJavaScripts = SearchJSUtils.getNameJavaScript(chartCollection);
List<NameJavaScript> nameJavaScripts = SearchJSUtils.getNameJavaScript(chartCollection, content, jsInfos);
//图表-样式-标签以及图表-特效-条件显示
ITContent htmlITContent = ITContent.copy(content);
htmlITContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Chart"));
@ -117,29 +118,44 @@ public class SearchChartJSAction {
private void searchAxisJS(List<JSInfo> jsInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null) {
if (chart.getPlot() instanceof VanChartRectanglePlot) {
searchVanChartRectanglePlotAxisJS(jsInfos, chartContent, chart.getPlot());
} else {
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);
dealAxis(jsInfos, chartContent, xAxis);
dealAxis(jsInfos, chartContent, yAxis);
}
}
}
if (yAxis instanceof VanChartAxis) {
private void dealAxis(List<JSInfo> jsInfos, ITContent chartContent, Axis axis) {
if (axis instanceof VanChartAxis) {
ITContent yAxisContent = ITContent.copy(chartContent);
yAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Y_Axis"),
((VanChartAxis) axis).getAxisName(),
Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Format")
);
dealAxisHtmlLabelJS(jsInfos, ((VanChartAxis) yAxis).getHtmlLabel(), yAxisContent);
dealAxisHtmlLabelJS(jsInfos, ((VanChartAxis) axis).getHtmlLabel(), yAxisContent);
}
}
/**
* 自定义的图表可以存放多个轴
* @param jsInfos 存储信息的数据结构
* @param chartContent ITContent
* @param plot 图表的VanChartRectanglePlot
*/
private void searchVanChartRectanglePlotAxisJS(List<JSInfo> jsInfos, ITContent chartContent, VanChartRectanglePlot plot) {
for (VanChartAxis axis : plot.getXAxisList()) {
dealAxis(jsInfos, chartContent, axis);
}
for (VanChartAxis axis : plot.getYAxisList()) {
dealAxis(jsInfos, chartContent, axis);
}
}
private void dealAxisHtmlLabelJS(List<JSInfo> jsInfos, VanChartHtmlLabel label, ITContent content) {

4
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/CellGroupType.java

@ -237,7 +237,11 @@ public enum CellGroupType {
*/
public void replace(Info info, String firstStr, String secondStr) {
FunctionGrouper grouper = new FunctionGrouper();
if (StringUtils.equals(firstStr, SettingContent.DIGIT_SETTING_LIST)) {
grouper.setDivideMode(getGroupType(firstStr));
} else {
grouper.setDivideMode(getGroupType(secondStr));
}
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
DSColumn column = (DSColumn) cellElement.getValue();
column.setGrouper(grouper);

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

@ -254,7 +254,7 @@ public class ITReplaceMainDialog extends UIDialog {
public void replace(String searchStr, String replaceStr) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
for (Info info : searchContentResultList) {
if (!info.getContent().isWrongful()) {
if (!info.getContent().isWrongful() && info.getContent().isSelected()) {
info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray());
}
info.getContent().setReplaced(true);

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

@ -20,6 +20,8 @@ import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
@ -317,6 +319,45 @@ public class ITReplaceNorthPanel {
refreshExtraComboBox(replaceSettingInputComboBox, replaceExtraSettingComboBox);
}
});
initInputComboBoxPopupListener(findSettingInputComboBox);
initInputComboBoxPopupListener(replaceSettingInputComboBox);
}
private void initInputComboBoxPopupListener(UIComboBox box) {
box.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
String str = GeneralUtils.objectToString(findSettingComboBox.getSelectedItem());
int findExtraIndex = findExtraSettingComboBox.getSelectedIndex();
int replaceExtraIndex = replaceExtraSettingComboBox.getSelectedIndex();
box.refreshBoxItems(SettingController.getSettingRefreshItems(str));
dealExtraItemSelect(findExtraSettingComboBox, findExtraIndex);
dealExtraItemSelect(replaceExtraSettingComboBox, replaceExtraIndex);
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
}
});
}
/**
* 重新设置额外下拉框的选中索引
* @param comboBox 额外下拉框
* @param index 索引
*/
private void dealExtraItemSelect(UIComboBox comboBox, int index) {
if (comboBox.getItemCount() > index) {
comboBox.setSelectedIndex(index);
}
}
/**

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

@ -2,6 +2,7 @@ package com.fr.design.actions.replace.utils;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chart.web.ChartHyperPoplink;
@ -22,9 +23,13 @@ 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.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.map.attr.AttrMapLabel;
import com.fr.plugin.chart.map.attr.AttrMapTooltip;
import com.fr.plugin.chart.type.MapType;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.report.cell.Elem;
import com.fr.stable.StringUtils;
@ -119,14 +124,58 @@ public class SearchJSUtils {
for (int i = 0; i < collection.getChartCount(); i++) {
if (collection.getChart(i) instanceof VanChart) {
VanChart chart = ((VanChart) collection.getChart(i));
int size = chart.getPlot().getConditionCollection().getConditionAttrSize();
ConditionCollection conditionCollection = chart.getPlot().getConditionCollection();
//如果是组合图
if (chart.getPlot() instanceof VanChartCustomPlot) {
VanChartCustomPlot plot = chart.getPlot();
for (VanChartPlot vanChartPlot : plot.getCustomPlotList()) {
dealPlotHtmlLabel(arrayList, vanChartPlot);
}
} else if (chart.getPlot() instanceof VanChartPlot){
dealPlotHtmlLabel(arrayList, chart.getPlot());
}
addAttrLabelHtmlLabel(chart, arrayList);
for (int j = 0; j < size; j++) {
searchConditionCollection(arrayList, conditionCollection.getConditionAttr(j));
}
}
}
private static void dealPlotHtmlLabel(List<Pair<VanChartHtmlLabel, String>> arrayList, VanChartPlot plot) {
//如果是组合地图
if (plot instanceof VanChartMapPlot) {
dealMapPlotHtmlLabel(arrayList, (VanChartMapPlot) plot);
} else {
dealCommonPlotHtmlLabel(arrayList, plot);
}
}
private static void dealMapPlotHtmlLabel(List<Pair<VanChartHtmlLabel, String>> arrayList, VanChartMapPlot plot) {
ConditionCollection area = plot.getConditionCollection();
ConditionCollection line = plot.getLineConditionCollection();
ConditionCollection point = plot.getPointConditionCollection();
dealMapCollectionHtmlLabel(arrayList, area, Toolkit.i18nText("Fine-Design_Chart_Region_Map"));
dealMapCollectionHtmlLabel(arrayList, line, Toolkit.i18nText("Fine-Design_Chart_LineMap"));
dealMapCollectionHtmlLabel(arrayList, point, Toolkit.i18nText("Fine-Design_Chart_PointMap"));
}
private static void dealMapCollectionHtmlLabel(List<Pair<VanChartHtmlLabel, String>> arrayList, ConditionCollection collection, String i18nText) {
for (int i = 0, size = collection.getConditionAttrSize(); i < size; i++) {
searchConditionCollection(arrayList, collection.getConditionAttr(i), i18nText);
}
}
private static void dealCommonPlotHtmlLabel(List<Pair<VanChartHtmlLabel, String>> arrayList, VanChartPlot plot) {
int size = plot.getConditionCollection().getConditionAttrSize();
CustomPlotType plotType = CustomPlotFactory.getCustomType(plot);
ConditionCollection conditionCollection = plot.getConditionCollection();
for (int j = 0; j < size; j++) {
if (plotType != null) {
searchConditionCollection(arrayList, conditionCollection.getConditionAttr(j), CustomPlotFactory.getTitle(plotType));
} else {
searchConditionCollection(arrayList, conditionCollection.getConditionAttr(j), StringUtils.EMPTY);
}
}
}
/**
@ -140,15 +189,26 @@ public class SearchJSUtils {
//如果是地图类型要特殊处理
if (plot instanceof VanChartMapPlot) {
addMapJS2Array((VanChartMapPlot) plot, arrayList);
} else if(plot instanceof VanChartCustomPlot){
for (VanChartPlot vanChartPlot : ((VanChartCustomPlot) plot).getCustomPlotList()) {
CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot);
dealAttrLabelHtml4VanChartPlot(vanChartPlot, arrayList, CustomPlotFactory.getTitle(plotType));
}
} else {
addAttrToolTipCondition2Array(plot, arrayList);
if (isAttrLabelExist(plot)) {
addAttrLabelDetail2Array(plot, arrayList);
addAttrSecondLabelDetail2Array(plot, arrayList);
dealAttrLabelHtml4VanChartPlot(plot, arrayList, StringUtils.EMPTY);
}
}
private static void dealAttrLabelHtml4VanChartPlot(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList, String str) {
addAttrToolTipCondition2Array(plot, arrayList, str);
if (isAttrLabelExist(plot)) {
addAttrLabelDetail2Array(plot, arrayList, str);
addAttrSecondLabelDetail2Array(plot, arrayList, str);
}
}
/**
* 用于处理地图类型图表中的样式中的JSAttrMapTooltip AttrMapLabel
*
@ -195,9 +255,9 @@ public class SearchJSUtils {
}
}
private static void addAttrToolTipCondition2Array(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList) {
private static void addAttrToolTipCondition2Array(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList, String str) {
if (isToolTipValid(plot.getAttrTooltipFromConditionCollection())) {
arrayList.add(new Pair<>(((AttrTooltip) plot.getAttrTooltipFromConditionCollection()).getContent().getHtmlLabel(), STYLE_TOOLTIP_CUSTOM));
arrayList.add(new Pair<>(((AttrTooltip) plot.getAttrTooltipFromConditionCollection()).getContent().getHtmlLabel(), ShowValueUtils.getChartOtherPos(STYLE_TOOLTIP_CUSTOM, str)));
}
}
@ -205,9 +265,9 @@ public class SearchJSUtils {
return tooltip instanceof AttrTooltip && ((AttrTooltip) tooltip).isEnable() && ((AttrTooltip) tooltip).getContent() != null && ((AttrTooltip) tooltip).getContent().getHtmlLabel() != null;
}
private static void addAttrLabelDetail2Array(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList) {
private static void addAttrLabelDetail2Array(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList, String str) {
if (isLabelDetailValid(plot)) {
arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getAttrLabelDetail().getContent().getHtmlLabel(), STYLE_LABEL));
arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getAttrLabelDetail().getContent().getHtmlLabel(), ShowValueUtils.getChartOtherPos(STYLE_LABEL, str)));
}
}
@ -217,9 +277,9 @@ public class SearchJSUtils {
&& plot.getAttrLabelFromConditionCollection().getAttrLabelDetail().getContent().getHtmlLabel() != null;
}
private static void addAttrSecondLabelDetail2Array(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList) {
private static void addAttrSecondLabelDetail2Array(VanChartPlot plot, List<Pair<VanChartHtmlLabel, String>> arrayList, String str) {
if (isSecondLabelDetailValid(plot)) {
arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getSecondLabelDetail().getContent().getHtmlLabel(), CATEGORY_LABEL));
arrayList.add(new Pair<>(plot.getAttrLabelFromConditionCollection().getSecondLabelDetail().getContent().getHtmlLabel(), ShowValueUtils.getChartOtherPos(CATEGORY_LABEL, str)));
}
}
@ -239,21 +299,22 @@ public class SearchJSUtils {
* @param arrayList
* @param conditionAttr
*/
private static void searchConditionCollection(List<Pair<VanChartHtmlLabel, String>> arrayList, ConditionAttr conditionAttr) {
private static void searchConditionCollection(List<Pair<VanChartHtmlLabel, String>> arrayList, ConditionAttr conditionAttr, String name) {
int conditionSize = conditionAttr.getDataSeriesConditionCount();
for (int t = 0; t < conditionSize; t++) {
DataSeriesCondition condition = conditionAttr.getDataSeriesCondition(t);
String str = Toolkit.i18nText("Fine-Design_Chart_Animation_Special") + "-" + Toolkit.i18nText("Fine-Design_Chart_Condition_Display");
String str = ShowValueUtils.joinStr4Position(Toolkit.i18nText("Fine-Design_Chart_Animation_Special"), Toolkit.i18nText("Fine-Design_Chart_Condition_Display"));
if (StringUtils.isNotEmpty(conditionAttr.getName())) {
str += "-" + conditionAttr.getName();
str = ShowValueUtils.joinStr4Position(str, conditionAttr.getName());
}
str = ShowValueUtils.joinStr4Position(str, name);
if (condition instanceof AttrTooltip) {
arrayList.add(new Pair<>(((AttrTooltip) condition).getContent().getHtmlLabel(), str + "-" + Toolkit.i18nText("Fine-Design_Chart_Data_Point_Tooltip")));
arrayList.add(new Pair<>(((AttrTooltip) condition).getContent().getHtmlLabel(), ShowValueUtils.joinStr4Position(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")));
arrayList.add(new Pair<>(label.getContent().getHtmlLabel(), ShowValueUtils.joinStr4Position(str, Toolkit.i18nText("Fine-Design_Chart_Label"))));
}
}
@ -270,18 +331,51 @@ public class SearchJSUtils {
* @param chartCollection
* @return
*/
public static List<NameJavaScript> getNameJavaScript(ChartCollection chartCollection) {
public static List<NameJavaScript> getNameJavaScript(ChartCollection chartCollection, ITContent content, List<JSInfo> jsInfos) {
ArrayList<NameJavaScript> nameJavaScriptArrayList = new ArrayList<>();
for (int i = 0; i < chartCollection.getChartCount(); i++) {
if (chartCollection.getChart(i) instanceof VanChart) {
VanChart chart = ((VanChart) chartCollection.getChart(i));
if (isCustomMapPlot(chart.getPlot())) {
dealMapNameJavaScript(content, chart.getPlot(), jsInfos);
} else {
NameJavaScriptGroup nameJavaScriptGroup = chart.getPlot().getHotHyperLink();
addNameJavaScript2Array(nameJavaScriptArrayList, nameJavaScriptGroup);
}
}
}
return nameJavaScriptArrayList;
}
/**
* 是否是组合地图
* @param plot 图表的plot
* @return 是则返回true
*/
public static boolean isCustomMapPlot(Plot plot) {
return plot instanceof VanChartMapPlot && ((VanChartMapPlot) plot).getMapType() == MapType.CUSTOM;
}
/**
* 处理图表的交互属性可能存在多种地图
* @param content 存储信息的数据结构
* @param plot 图表的VanChartMapPlot
*/
private static void dealMapNameJavaScript(ITContent content, VanChartMapPlot plot, List<JSInfo> jsInfos) {
List<NameJavaScript> areaJavaScriptList = new ArrayList<>();
List<NameJavaScript> lineJavaScriptList = new ArrayList<>();
List<NameJavaScript> pointJavaScriptList = new ArrayList<>();
addNameJavaScript2Array(areaJavaScriptList, plot.getAreaHotHyperLink());
addNameJavaScript2Array(lineJavaScriptList, plot.getLineHotHyperLink());
addNameJavaScript2Array(pointJavaScriptList, plot.getPointHotHyperLink());
addJSInfosFromNameJS(ShowValueUtils.getCustomMapContent(content, Toolkit.i18nText("Fine-Design_Chart_Region_Map")), areaJavaScriptList, jsInfos);
addJSInfosFromNameJS(ShowValueUtils.getCustomMapContent(content, Toolkit.i18nText("Fine-Design_Chart_LineMap")), lineJavaScriptList, jsInfos);
addJSInfosFromNameJS(ShowValueUtils.getCustomMapContent(content, Toolkit.i18nText("Fine-Design_Chart_PointMap")), pointJavaScriptList, jsInfos);
}
private static void addNameJavaScript2Array(List<NameJavaScript> nameJavaScriptArrayList, NameJavaScriptGroup nameJavaScriptGroup) {
if (isNameJavaScriptGroupExist(nameJavaScriptGroup)) {
for (int j = 0; j < nameJavaScriptGroup.size(); j++) {

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

@ -2,6 +2,7 @@ package com.fr.design.actions.replace.utils;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.ui.ITReplaceMainDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StableUtils;
@ -391,14 +392,47 @@ public class ShowValueUtils {
*/
public static String getResultTip(int findCount, int replaceCount, int failedCount) {
StringBuilder str = new StringBuilder();
str.append("<html>").append(Toolkit.i18nText("Fine-Design_Replace_Search_Finish")).append("<font color = 'rgb(61,153,249)'>").append(findCount).append("</font>").append(Toolkit.i18nText("Fine-Design_Replace_Result"));
str.append("<html>").append(Toolkit.i18nText("Fine-Design_Replace_Search_Finish", "<font color = 'rgb(61,153,249)'>" + findCount+ "</font>"));
if (replaceCount != 0) {
str.append(Toolkit.i18nText("Fine-Design_Replace_Also_Finish")).append("<font color = 'rgb(61,153,249)'>").append(replaceCount).append("</font>").append(Toolkit.i18nText("Fine-Design_Replace_Result_Count"));
str.append(Toolkit.i18nText("Fine-Design_Replace_Also_Finish", "<font color = 'rgb(61,153,249)'>" + replaceCount + "</font>"));
if (failedCount != 0) {
str.append(Toolkit.i18nText("Fine-Design_Replace_Have")).append("<font color = 'rgb(236,124,125)'>").append(failedCount).append("</font>").append(Toolkit.i18nText("Fine-Design_Replace_Can_Not_Replace"));
str.append(Toolkit.i18nText("Fine-Design_Replace_Have", "<font color = 'rgb(236,124,125)'>" + failedCount + "</font>"));
}
} else {
if (failedCount != 0) {
str.append(Toolkit.i18nText("Fine-Design_Replace_Also_Finish", "<font color = 'rgb(61,153,249)'>" + replaceCount + "</font>"));
str.append(Toolkit.i18nText("Fine-Design_Replace_Have", "<font color = 'rgb(236,124,125)'>" + failedCount + "</font>"));
}
}
return str.toString();
}
/**
* 返回图表类型的位置信息组合图就需要加上对应的类型名称
* @param str 基础信息
* @param customStyle 组合图的类型信息
* @return 组合后的位置信息
*/
public static String getChartOtherPos(String str, String customStyle) {
if (StringUtils.isNotEmpty(customStyle)) {
return joinStr4Position(str, customStyle);
} else {
return str;
}
}
/**
* 用于获取增加指定地图后缀的ITContent
* @param content 原ITContent
* @param str 后缀
* @return 处理后的新的ITContent
*/
public static ITContent getCustomMapContent(ITContent content, String str) {
ITContent resultContent = ITContent.copy(content);
resultContent.addOtherPos(str);
return resultContent;
}
}

Loading…
Cancel
Save