Browse Source

REPORT-75998 完善替换后触发查找的整体逻辑,修复查找后没有全选的问题、完善图表搜索逻辑

feature/x
Destiny.Lin 2 years ago
parent
commit
e0e04607f1
  1. 105
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  2. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java
  3. 35
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchWebJSAction.java
  4. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java
  5. 8
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  6. 10
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java
  7. 23
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java
  8. 8
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java

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

@ -2,21 +2,34 @@ 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.base.present.DictPresent;
import com.fr.base.present.FormulaPresent;
import com.fr.base.present.Present;
import com.fr.chart.base.AttrChangeConfig;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
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.i18n.Toolkit;
import com.fr.js.NameJavaScript;
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.report.cell.TemplateCellElement;
import com.fr.stable.StringUtils;
import java.util.List;
import java.util.Map;
@ -44,7 +57,12 @@ public class SearchChartCollectionFormulaAction {
for (int i = 0; i < chartCollection.getChartCount(); i++) {
ITContent chartContent = ITContent.copy(content);
searchChartPatternFormula(formulaInfos, chartContent, chartCollection.getChart(i));
if (isChangeConfigAttrValid(chartCollection.getChangeConfigAttr())) {
//图表切换属性
dealChangeConfig(formulaInfos, chartContent, chartCollection.getChart(i));
}
//图表-交互属性-超级链接
dealChartHyperLink(formulaInfos, chartContent, chartCollection.getChart(i));
//数据-单元格数据-分类名&系列名&值
SearchChartDataFormulaManager searchChartDataFormulaManager = SearchChartDataFormulaManager.getInstance();
Map<String, SearchChartDataFormula> type = searchChartDataFormulaManager.getChartDataType();
@ -56,7 +74,92 @@ public class SearchChartCollectionFormulaAction {
dataContent.addOtherPos(chartCollection.getChart(i).getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
searchChartDataFormula.searchChartDataFormula(formulaInfos, dataContent, provider);
}
//数据-形态
if (chartCollection.getChart(i).getFilterDefinition() != null) {
ITContent presentContent = ITContent.copy(content);
presentContent.addOtherPos(chartCollection.getChart(i).getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
searchFormulaFromChartPresent(formulaInfos, presentContent, chartCollection.getChart(i).getFilterDefinition());
}
}
}
private void dealChartHyperLink(List<FormulaInfo> formulaInfos, ITContent content, Chart chart) {
ITContent conditionContent = ITContent.copy(content);
if (StringUtils.isNotEmpty(chart.getChartName())) {
conditionContent.addOtherPos(chart.getChartName());
}
conditionContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Animation_Special"),
Toolkit.i18nText("Fine-Design_Chart_Interactive")
);
if (chart.getPlot() != null) {
NameJavaScriptGroup javaScriptGroup = chart.getPlot().getHotHyperLink();
if (javaScriptGroup != null) {
for (int i = 0; i < javaScriptGroup.size(); i++) {
NameJavaScript javaScript = javaScriptGroup.getNameHyperlink(i);
conditionContent.addOtherPos(javaScript.getName());
SearchJSHighlightAction action = SearchJSHighlightAction.getInstance();
action.searchJSFormulaFromOther(formulaInfos, conditionContent, javaScript.getJavaScript());
}
}
}
}
private void searchFormulaFromChartPresent(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
searchPresent4Formula(provider.getCategoryPresent(), content, formulaInfos);
searchPresent4Formula(provider.getSeriesPresent(), content, formulaInfos);
}
private void searchPresent4Formula(Present present, ITContent content, List<FormulaInfo> formulaInfos) {
if (present instanceof FormulaPresent) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(present);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Style_Present"),
Toolkit.i18nText("Fine-Design_Basic_Present_Formula_Present"));
formulaInfos.add(new FormulaInfo(newContent));
}
if (present instanceof DictPresent) {
ITContent dictContent = ITContent.copy(content);
dictContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Style_Present"),
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary")
);
DictPresent dictPresent = (DictPresent) present;
if (dictPresent.getDictionary() != null) {
DictionaryType type = DictionaryType.match(dictPresent.getDictionary().getClass().getSimpleName());
if (type != null) {
type.searchFormulaFromDictionary(dictContent, formulaInfos, dictPresent.getDictionary());
}
}
}
}
private boolean isChangeConfigAttrValid(AttrChangeConfig attrChangeConfig) {
return attrChangeConfig != null && attrChangeConfig.isEnable();
}
private void dealChangeConfig(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
ITContent content = ITContent.copy(chartContent);
if (StringUtils.isNotEmpty(chart.getChartName())) {
content.addOtherPos(chart.getChartName());
}
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Type"),
Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes")
);
if (isSwitchTitleValid(chart.getSwitchTitle())) {
SwitchTitle title = chart.getSwitchTitle();
content.setReplaceObject(title.getContent());
formulaInfos.add(new FormulaInfo(content));
}
}
private boolean isSwitchTitleValid(SwitchTitle title) {
return title != null && title.getContent() instanceof Formula;
}
private boolean isDefinitionValid(TopDefinitionProvider provider) {

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

@ -58,10 +58,12 @@ public class SearchChartJSAction {
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<JSInfo> jsInfos) {
for (int i = 0; i < chartCollection.getChartCount(); i++) {

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

@ -32,6 +32,7 @@ import java.util.Map;
public class SearchWebJSAction implements SearchJS {
private final static Map<String, String> MAP = new HashMap<>();
private final static Map<String, String> SERVER_MAP = new HashMap<>();
private List<WebContent> arrayList = new ArrayList<>();
private SearchWebJSAction() {
@ -41,6 +42,9 @@ public class SearchWebJSAction implements SearchJS {
MAP.put("WebPage", Toolkit.i18nText("Fine-Design_Report_Pagination_Setting"));
MAP.put("WebWrite", Toolkit.i18nText("Fine-Design_Report_Write_Setting"));
MAP.put("WebView", Toolkit.i18nText("Fine-Design_Report_Data_Analysis_Settings"));
SERVER_MAP.put("WebPage", Toolkit.i18nText("Fine-Design_Report_ReportServerP_Report_Server_Parameter") + "-" + Toolkit.i18nText("Fine-Design_Report_Pagination_Setting"));
SERVER_MAP.put("WebWrite", Toolkit.i18nText("Fine-Design_Report_ReportServerP_Report_Server_Parameter") + "-" + Toolkit.i18nText("Fine-Design_Report_Write_Setting"));
SERVER_MAP.put("WebView", Toolkit.i18nText("Fine-Design_Report_ReportServerP_Report_Server_Parameter") + "-" + Toolkit.i18nText("Fine-Design_Report_Data_Analysis_Settings"));
}
@ -54,6 +58,27 @@ public class SearchWebJSAction implements SearchJS {
private void addJSInfos2ListFromWeb(JTemplate jTemplate, List<JSInfo> jsInfos) {
dealServerWebAttr(jTemplate, jsInfos);
dealTemplateWebAttr(jTemplate, jsInfos);
}
private void dealServerWebAttr(JTemplate jTemplate, List<JSInfo> jsInfos) {
ReportWebAttr webReportAttr = ReportWebAttr.getInstance();
if (webReportAttr != null) {
webReportAttr.getWebWrite();
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
content.setJumpAble(false);
addWebContent2Array(webReportAttr);
for (int i = 0; i < arrayList.size(); i++) {
addJSInfos2ListFromServerWebAttr(content, jsInfos, arrayList.get(i));
}
}
}
private void dealTemplateWebAttr(JTemplate jTemplate, List<JSInfo> jsInfos) {
if (jTemplate.getTarget() instanceof WorkBook) {
WorkBook workBook = (WorkBook) jTemplate.getTarget();
ReportWebAttr webAttr = workBook.getReportWebAttr();
@ -67,6 +92,15 @@ public class SearchWebJSAction implements SearchJS {
}
}
private void addJSInfos2ListFromServerWebAttr(ITContent content, List<JSInfo> jsInfos, WebContent webContent) {
ITContent newContent = ITContent.copy(content);
if (SERVER_MAP.containsKey(webContent.getClass().getSimpleName())) {
newContent.addOtherPos(SERVER_MAP.get(webContent.getClass().getSimpleName()));
}
addJSInfos2ListFromWebButton(newContent, jsInfos, webContent);
addJSInfos2ListFromWebListener(newContent, jsInfos, webContent);
}
private void addJSInfos2ListFromArray(ITContent content, List<JSInfo> jsInfos, WebContent webContent) {
ITContent newContent = ITContent.copy(content);
if (MAP.containsKey(webContent.getClass().getSimpleName())) {
@ -94,6 +128,7 @@ public class SearchWebJSAction implements SearchJS {
}
private void addWebContent2Array(ReportWebAttr webAttr) {
arrayList.clear();
if (webAttr != null) {
addContent(arrayList, webAttr.getWebWrite());
addContent(arrayList, webAttr.getWebPage());

2
designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java

@ -2,6 +2,7 @@ package com.fr.design.actions.replace.info;
import com.fr.data.impl.DBTableData;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.form.event.Listener;
import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScript;
@ -210,6 +211,7 @@ public enum ReplaceObject implements DealWithInfoValue {
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject();
info.updateOldStr(dbTableData.getQuery(), findStr);
dbTableData.setQuery(ShowValueUtils.replaceAll(dbTableData.getQuery(), findStr, replaceStr));
//todo DesignTableDataManager
}
@Override

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

@ -32,6 +32,8 @@ import java.util.ArrayList;
import java.util.List;
import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable;
/**
* 主面板
*
@ -162,16 +164,14 @@ public class ITReplaceMainDialog extends UIDialog {
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);
search();
} else {
Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")};
int optionSelected = FineJOptionPane.showOptionDialog(
@ -291,6 +291,8 @@ public class ITReplaceMainDialog extends UIDialog {
itTableEditor.add(searchResultList);
northPane.getResultLabel().setText("<html>" + Toolkit.i18nText("Fine-Design_Replace_Search_Finish") + "<font color = 'rgb(61,153,249)'>" + searchResultList.size() + "</font>" + Toolkit.i18nText("Fine-Design_Replace_Result"));
}
ITTableEditorPane.ITHeaderRenderer renderer = (ITTableEditorPane.ITHeaderRenderer) getEditTable().getTableHeader().getDefaultRenderer();
renderer.refreshHeader(getEditTable());
itTableEditor.fireTableDataChanged();
northPane.refreshFindInputComboBoxItems();
setSearchFlag(true);

10
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

@ -5,11 +5,14 @@ import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ReportComponentComposite;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.Component;
@ -36,10 +39,11 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
paraButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ITContent content = (ITContent) getEditTable().getValueAt(getEditTable().getEditingRow(), 7);
ITContent content = (ITContent) getEditTable().getValueAt(getEditTable().getEditingRow(), 6);
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true);
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(new TRL(GeneralUtils.objectToString(content.getTrlString())));
ReportComponentComposite composite = (ReportComponentComposite) HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getCurrentReportComponentPane();
}
ITReplaceMainDialog.setITReplaceFlag(false);
}
@ -60,7 +64,7 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
*/
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
ITContent content = (ITContent) table.getValueAt(row, 7);
ITContent content = (ITContent) table.getValueAt(row, 6);
paraButton.setEnabled(content.isJumpAble());
return paraButton;
}
@ -78,7 +82,7 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
*/
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
ITContent content = (ITContent) table.getValueAt(row, 7);
ITContent content = (ITContent) table.getValueAt(row, 6);
paraButton.setEnabled(content.isJumpAble());
return paraButton;
}

23
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java

@ -31,7 +31,6 @@ public class ITTableEditor extends UITableModelAdapter {
Toolkit.i18nText("Fine-Design_Replace_Template_Name"),
Toolkit.i18nText("Fine-Design_Replace_Sheet_Name"),
Toolkit.i18nText("Fine-Design_Replace_Block_Name"),
Toolkit.i18nText("Fine-Design_Replace_Location"),
Toolkit.i18nText("Fine-Design_Replace_Location_Info"),
Toolkit.i18nText("Fine-Design_Replace_Operator"),
});
@ -43,14 +42,13 @@ public class ITTableEditor extends UITableModelAdapter {
UILabel.class,
UILabel.class,
UILabel.class,
UILabel.class,
ITTableButton.class,
});
this.setDefaultEditor(ITTableButton.class, new ITTableButton());
this.setDefaultRenderer(ITTableButton.class, new ITTableButton());
this.createTable().getColumnModel().getColumn(7).setMaxWidth(50);
this.createTable().getColumnModel().getColumn(6).setMaxWidth(50);
this.createTable().getColumnModel().getColumn(0).setMaxWidth(50);
}
@ -83,7 +81,7 @@ public class ITTableEditor extends UITableModelAdapter {
*/
@Override
public boolean isCellEditable(int row, int col) {
return col == 7 || col == 0;
return col == 6 || col == 0;
}
/**
@ -157,21 +155,10 @@ public class ITTableEditor extends UITableModelAdapter {
return " " + content.getBlockName();
}
},
/**
* 第六列展示位置
* 第六列展示路径
*/
INDEX_5(5) {
@Override
public Object returnContentObject(ITContent content) {
return " " + content.getShowObject();
}
},
/**
* 第七列展示路径
*/
INDEX_6(6) {
@Override
public Object returnContentObject(ITContent content) {
return " " + content.getOtherPos();
@ -179,9 +166,9 @@ public class ITTableEditor extends UITableModelAdapter {
},
/**
* 展示定位按钮
* 展示定位按钮
*/
INDEX_7(7) {
INDEX_6(6) {
@Override
public Object returnContentObject(ITContent content) {
return content;

8
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java

@ -128,6 +128,12 @@ public class ITTableEditorPane<T> extends BasicPane {
});
}
public void refreshHeader(JTable table) {
selectBox.setSelected(true);
int rowHeight = table.getRowHeight();
table.updateUI();
table.setRowHeight(rowHeight);
}
@Override
public Component getTableCellRendererComponent(JTable table,
@ -149,6 +155,8 @@ public class ITTableEditorPane<T> extends BasicPane {
component.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
return component;
}
}

Loading…
Cancel
Save