Browse Source

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

* commit '84d188f040db54fc2a552f389f6ce16e2c971466':
  REPORT-80693 数据脱敏二期 圈复杂度问题
  REPORT-80693 数据脱敏二期 【问题原因】一期和二期一起剩余了比较多的bug,处理有风险,跟Lipei、Harrison、Alicia透明讨论后,确定先延期迭代,已修改的代码屏蔽功能入口与关键位置 【改动方案】具体屏蔽的内容,详见https://kms.fineres.com/pages/viewpage.action?pageId=568269880 【review建议】
  REPORT-83876 单元格替换了3次但撤回变成了2次
  REPORT-80695 模板全局级别查找替换二期 修改钻取地图的获取逻辑
  REPORT-80695 模板全局级别查找替换二期 修改钻取地图的获取逻辑
feature/x
superman 2 years ago
parent
commit
7068f0c7bd
  1. 421
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  2. 5
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  3. 5
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  4. 31
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java

421
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -3,39 +3,28 @@
*/
package com.fr.design.data.datapane.preview;
import com.fr.base.BaseUtils;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.data.TableDataSource;
import com.fr.data.desensitize.base.DesensitizationTableData;
import com.fr.data.impl.DBTableData;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.NameDataModel;
import com.fr.data.operator.DataOperator;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.desensitization.TableDataPreviewDesensitizeManager;
import com.fr.design.data.datapane.preview.desensitization.model.DesensitizedPreviewTableModel;
import com.fr.design.data.datapane.preview.desensitization.view.setting.TableDataDesensitizationSettingPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.gui.itable.SortableJTable;
import com.fr.design.gui.itable.TableSorter;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.ui.util.UIUtil;
import com.fr.function.TIME;
import com.fr.general.FRFont;
@ -50,7 +39,6 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableCellRenderer;
@ -69,19 +57,12 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CancellationException;
/**
* august PreviewTablePane一共提供5个共有的静态方法用来预览
*/
public class PreviewTablePane extends BasicPane {
private static final String DATA_DESENSITIZATION_CONFIG = Toolkit.i18nText("Fine-Design_Report_Desensitization_Config");
private static final String LEFT_BRACKET = "(";
private static final String RIGHT_BRACKET = ")";
private static final String COUNT = Toolkit.i18nText("Fine-Design_Report_Desensitization_Count");
private TableData tableData;
private DataModel dataModel;
private UINumberField maxPreviewNumberField;
@ -97,54 +78,6 @@ public class PreviewTablePane extends BasicPane {
private static PreviewTablePane THIS;
private EmbeddedTableData previewTableData;
private UILabel desensitizationLabel;
/**
* 用于refreshLabel的鼠标监听
*/
private final MouseAdapter refreshLabelMouseAdapter = new MouseAdapter() {
boolean mouseEntered = false;
boolean buttonPressed = false;
@Override
public void mouseEntered(MouseEvent e) { // 当鼠标进入时候调用.
mouseEntered = true;
if (!buttonPressed) {
refreshLabel.setBackground(java.awt.Color.WHITE);
refreshLabel.setOpaque(true);
refreshLabel.setBorder(BorderFactory.createLineBorder(java.awt.Color.GRAY));
}
}
@Override
public void mouseExited(MouseEvent e) {
mouseEntered = false;
refreshLabel.setOpaque(false);
refreshLabel.setBorder(BorderFactory.createEmptyBorder());
}
@Override
public void mousePressed(MouseEvent e) {
buttonPressed = true;
refreshLabel.setBackground(java.awt.Color.lightGray);
}
@Override
public void mouseReleased(MouseEvent e) {
buttonPressed = false;
if (mouseEntered) {
refreshLabel.setBackground(java.awt.Color.WHITE);
try {
populate(tableData);
if (dataModel != null) {
setRowsLimitTableModel();
}
} catch (Exception ignore) {
}
}
}
};
public static final PreviewTablePane getInstance() {
if (THIS == null) {
THIS = new PreviewTablePane();
@ -154,175 +87,91 @@ public class PreviewTablePane extends BasicPane {
private PreviewTablePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
// northPane
this.add(initNorthPane(), BorderLayout.NORTH);
// centerPane
this.add(initCenterPane(), BorderLayout.CENTER);
// dialog
initDialog();
// progressBar
initProgressBar();
}
/**
* 初始化northPane
*
* @return
*/
private JComponent initNorthPane() {
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// 预览行数面板
northPane.add(initPreviewNumberPane(), BorderLayout.CENTER);
// 脱敏预览设置面板
northPane.add(initDesensitizationPane(), BorderLayout.EAST);
return northPane;
}
/**
* 初始化预览行数面板
*
* @return
*/
private JComponent initPreviewNumberPane() {
// elalke:预览行数
JPanel previewNumberPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
// 当前行数
this.add(previewNumberPanel, BorderLayout.NORTH);
JPanel currentPreviewPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
previewNumberPanel.add(currentPreviewPanel);
currentPreviewPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Current_Preview_Rows") + ":"));
currentRowsField = new UINumberField();
currentPreviewPanel.add(currentRowsField);
currentRowsField.setEditable(false);
currentRowsField.setColumns(4);
currentRowsField.setInteger(true);
// 最大行数
JPanel maxPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
previewNumberPanel.add(maxPanel);
maxPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Maximum_Number_of_Preview_Rows") + ":"));
maxPreviewNumberField = new UINumberField();
maxPanel.add(maxPreviewNumberField);
maxPreviewNumberField.setColumns(4);
maxPreviewNumberField.setInteger(true);
maxPreviewNumberField.setValue(DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow());
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
maxPreviewNumberField.setValue(designerEnvManager.getMaxNumberOrPreviewRow());
maxPreviewNumberField.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
designerEnvManager.setMaxNumberOrPreviewRow((int) ((UINumberField) evt.getSource()).getValue());
}
});
// 刷新按钮
initRefreshLabel();
previewNumberPanel.add(currentPreviewPanel);
previewNumberPanel.add(maxPanel);
previewNumberPanel.add(refreshLabel);
return previewNumberPanel;
}
private void initRefreshLabel() {
Icon refreshImage = IconUtils.readIcon("/com/fr/design/images/control/refresh");
Icon refreshImage = BaseUtils.readIcon("/com/fr/design/images/control/refresh.png");
refreshLabel = new UILabel(refreshImage);
refreshLabel.addMouseListener(refreshLabelMouseAdapter);
}
/**
* 初始化脱敏设置面板
*
* @return
*/
private JComponent initDesensitizationPane() {
JPanel desensitizationPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
// 初始化Label
desensitizationLabel = new UILabel(DATA_DESENSITIZATION_CONFIG);
desensitizationLabel.setForeground(UIConstants.NORMAL_BLUE);
desensitizationLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
TableDataDesensitizationSettingPane settingPane = new TableDataDesensitizationSettingPane((DesensitizationTableData) tableData);
settingPane.populateBean((DesensitizationTableData) tableData);
BasicDialog dialog = settingPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(PreviewTablePane.this), new DialogActionAdapter() {
@Override
public void doOk() {
// 保存脱敏规则配置
settingPane.updateBean();
// 改变模板保存状态
JTemplate<?, ?> editingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (Objects.nonNull(editingTemplate)) {
editingTemplate.fireTargetModified(true);
}
}
previewNumberPanel.add(refreshLabel);
refreshLabel.addMouseListener(new MouseAdapter() {
boolean mouseEntered = false;
boolean buttonPressed = false;
public void mouseEntered(MouseEvent e) { // 当鼠标进入时候调用.
mouseEntered = true;
if (!buttonPressed) {
refreshLabel.setBackground(java.awt.Color.WHITE);
refreshLabel.setOpaque(true);
refreshLabel.setBorder(BorderFactory.createLineBorder(java.awt.Color.GRAY));
}
}
@Override
public void doCancel() {
public void mouseExited(MouseEvent e) {
mouseEntered = false;
refreshLabel.setOpaque(false);
refreshLabel.setBorder(BorderFactory.createEmptyBorder());
}
}
}, BasicDialog.DEFAULT);
dialog.setVisible(true);
// 关闭预览页面
PreviewTablePane.this.dialog.setVisible(false);
public void mousePressed(MouseEvent e) {
buttonPressed = true;
refreshLabel.setBackground(java.awt.Color.lightGray);
}
});
// 初始化分隔符
ToolBarDef toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(SeparatorDef.DEFAULT);
UIToolbar toolBar = ToolBarDef.createJToolBar();
toolBar.setBorderPainted(false);
toolbarDef.updateToolBar(toolBar);
// 初始化预览按钮
UIToggleButton previewToggle = new UIToggleButton(new Icon[]{IconUtils.readIcon("/com/fr/design/images/m_file/preview"), IconUtils.readIcon("/com/fr/design/images/m_file/preview")}, true);
previewToggle.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Preview"));
previewToggle.setSelected(false);
previewToggle.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// 切换TableModel的脱敏状态
togglePreviewTableModelDesensitizeStatus();
// 刷新页面,展示
refreshTable();
public void mouseReleased(MouseEvent e) {
buttonPressed = false;
if (mouseEntered) {
refreshLabel.setBackground(java.awt.Color.WHITE);
try {
populate(tableData);
if (dataModel != null) {
setRowsLimitTableModel();
}
} catch (Exception e1) {
}
}
}
});
desensitizationPane.add(desensitizationLabel);
desensitizationPane.add(toolBar);
desensitizationPane.add(previewToggle);
return desensitizationPane;
}
/**
* 设置脱敏设置的个数
*
* @param model
*/
private void setDesensitizationCount(TableModel model) {
if (isDesensitizeOpened()) {
int count = model instanceof DesensitizedPreviewTableModel ? ((DesensitizedPreviewTableModel) model).getDesensitizeColumnsCount() : 0;
desensitizationLabel.setText(DATA_DESENSITIZATION_CONFIG + LEFT_BRACKET + count + RIGHT_BRACKET + COUNT);
} else {
desensitizationLabel.setText(DATA_DESENSITIZATION_CONFIG);
}
}
/**
* 初始化centerPane
*
* @return
*/
private JComponent initCenterPane() {
preveiwTable = new CopyableJTable(new TableSorter());
preveiwTable.setRowSelectionAllowed(false);
preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
return new JScrollPane(preveiwTable);
}
private void initDialog() {
this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER);
if (this.dialog == null) {
this.dialog = this.showWindow(new JFrame());
}
}
private void initProgressBar() {
progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
@Override
public void doMonitorCanceled() {
if (getWorker() != null) {
getWorker().cancel(true);
@ -333,7 +182,7 @@ public class PreviewTablePane extends BasicPane {
}
public AutoProgressBar getProgressBar() {
return PreviewTablePane.progressBar;
return this.progressBar;
}
@Override
@ -374,10 +223,9 @@ public class PreviewTablePane extends BasicPane {
}
/**
* 为预览表的columnIndex列着色.
*
* @param columnIndex 列索引值
* @param c 颜色
* elake:为预览表的columnIndex列着色.
* @param columnIndex
* @param c
*/
private void setPreviewTableColumnColor(final int columnIndex, final Color c) {
addLoadedListener(new LoadedEventListener() {
@ -385,7 +233,6 @@ public class PreviewTablePane extends BasicPane {
public void fireLoaded() {
TableColumn column = preveiwTable.getColumnModel().getColumn(columnIndex);
DefaultTableCellRenderer cellRenderer = new DefaultTableCellRenderer() {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
comp.setBackground(c);
@ -406,7 +253,7 @@ public class PreviewTablePane extends BasicPane {
getInstance().preveiwTable = new SortableJTable(new TableSorter());
getInstance().preveiwTable.setRowSelectionAllowed(false);
getInstance().preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
PreviewTablePane.progressBar.close();
getInstance().progressBar.close();
getInstance().repaint();
}
@ -488,7 +335,6 @@ public class PreviewTablePane extends BasicPane {
private void previewTableDataSQL() throws Exception {
connectionBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) {
@Override
public void doMonitorCanceled() {
getWorker().cancel(true);
getDialog().setVisible(false);
@ -503,49 +349,42 @@ public class PreviewTablePane extends BasicPane {
private void setPreviewTableColumnValue(final Graphics g) {
for (int i = 0; i < preveiwTable.getColumnModel().getColumnCount(); i++) {
TableColumn column = preveiwTable.getColumnModel().getColumn(i);
DefaultTableCellRenderer cellRenderer = getDefaultTableCellRenderer();
column.setCellRenderer(cellRenderer);
}
}
/**
* 默认表格格子渲染器
*
* @return
*/
private DefaultTableCellRenderer getDefaultTableCellRenderer() {
return new DefaultTableCellRenderer() {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Font f = table.getFont();
//默认在系统不支持 无法显示时 如自造的字 ,字体设置为空.
Font defaultShowFont = FRFont.getInstance("", f.getStyle(), f.getSize());
if (value instanceof String) {
String str = (String) value;
for (int j = 0; j < str.length(); j++) {
char c = str.charAt(j);
if (!f.canDisplay(c)) {
table.setFont(defaultShowFont);
DefaultTableCellRenderer cellRenderer = new DefaultTableCellRenderer() {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Font f = table.getFont();
//默认在系统不支持 无法显示时 如自造的字 ,字体设置为空.
Font defaultShowFont = FRFont.getInstance("", f.getStyle(), f.getSize());
if (value instanceof String) {
String str = (String) value;
for (int j = 0; j < str.length(); j++) {
char c = str.charAt(j);
if (!f.canDisplay(c)) {
table.setFont(defaultShowFont);
}
}
}
return comp;
}
return comp;
}
};
};
column.setCellRenderer(cellRenderer);
}
}
private void setWorker() {
worker = new SwingWorker<TableModel, Void>() {
@Override
protected TableModel doInBackground() throws Exception {
worker = new SwingWorker<PreviewTableModel, Void>() {
protected PreviewTableModel doInBackground() throws Exception {
connectionBar.start();
try {
testDBTableDataConnection(tableData);
if (tableData instanceof DBTableData) {
boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase());
if (!status) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}
}
} finally {
// 将close操作放到EDT线程中
UIUtil.invokeLaterIfNeeded(() -> connectionBar.close());
@ -555,20 +394,22 @@ public class PreviewTablePane extends BasicPane {
// parameterInputDialog
// update之后的parameters,转成一个parameterMap,用于预览TableData
PreviewTableModel previewModel = new PreviewTableModel(previewTableData.createDataModel(null), (int) maxPreviewNumberField.getValue());
if (TableDataPreviewDesensitizeManager.getInstance().needDesensitize(tableData)) {
// 数据集预览脱敏
previewModel = TableDataPreviewDesensitizeManager.getInstance().desensitizeTableModel(tableData, previewModel);
for (int i = 0; i < previewTableData.getColumnCount(); i++) {
Class<?> cls = previewTableData.getColumnClass(i);
if (cls == Date.class || cls == TIME.class || cls == Timestamp.class) {
previewModel.dateIndexs.add(i);
}
}
dealWithPreviewTableModelColumnClass(previewModel, previewTableData);
return previewModel;
}
@Override
public void done() {
try {
TableModel model = get();
setPreviewTableModel(model);
PreviewTableModel model = get();
setModel(model);
setCurrentRows(model.getRowCount());
setPreviewTableColumnValue(getParent().getGraphics());
fireLoadedListener();
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -583,36 +424,6 @@ public class PreviewTablePane extends BasicPane {
};
}
/**
* 检查DBTableData连接
*
* @param tableData
* @throws Exception
*/
private void testDBTableDataConnection(TableData tableData) throws Exception {
if (tableData instanceof DBTableData) {
boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase());
if (!status) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}
}
}
/**
* 处理预览Model的列类型
*
* @param previewModel
* @param previewTableData
*/
private void dealWithPreviewTableModelColumnClass(PreviewTableModel previewModel, EmbeddedTableData previewTableData) {
for (int i = 0; i < previewTableData.getColumnCount(); i++) {
Class<?> cls = previewTableData.getColumnClass(i);
if (cls == Date.class || cls == TIME.class || cls == Timestamp.class) {
previewModel.dateIndexs.add(i);
}
}
}
/**
* 直接预览存储过程的一个返回数据集没有实际值和显示值
*
@ -721,61 +532,9 @@ public class PreviewTablePane extends BasicPane {
} catch (Exception e) {
previewModel = new PreviewTableModel((int) maxPreviewNumberField.getValue());
}
setPreviewTableModel(previewModel);
}
/**
* 切换TableModel的展示状态
*/
private void togglePreviewTableModelDesensitizeStatus() {
if (!isDesensitizeOpened()) {
// 未启用数据脱敏时,不需要切换
return;
}
TableSorter tableSorter = (TableSorter) preveiwTable.getModel();
TableModel originTableModel = tableSorter.getTableModel();
if (originTableModel instanceof DesensitizedPreviewTableModel) {
((DesensitizedPreviewTableModel) originTableModel).toggleNeedDesensite();
}
}
/**
* 刷新一下预览页面用于切换脱敏和非脱敏时的显示
*/
private void refreshTable() {
TableModel originTableModel = getCurrentTableModel();
setPreviewTableModel(originTableModel);
}
/**
* 获取当前的TableModel已经除掉了TableSorter的包装
*
* @return
*/
private TableModel getCurrentTableModel() {
TableSorter tableSorter = (TableSorter) preveiwTable.getModel();
return tableSorter.getTableModel();
}
/**
* 设置预览TableModel
*
* @param previewTableModel
*/
private void setPreviewTableModel(TableModel previewTableModel) {
setDesensitizationCount(previewTableModel);
setModel(previewTableModel);
setCurrentRows(previewTableModel.getRowCount());
setModel(previewModel);
setCurrentRows(previewModel.getRowCount());
fireLoadedListener();
}
/**
* 数据脱敏是否启用
* @return
*/
private boolean isDesensitizeOpened() {
return tableData instanceof DesensitizationTableData &&
((DesensitizationTableData) tableData).getDesensitizationConfig().isDesensitizeOpened();
}
}

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

@ -34,6 +34,7 @@ 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.drillmap.VanChartDrillMapPlot;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.stable.StringUtils;
@ -106,6 +107,10 @@ public class SearchChartCollectionFormulaAction {
customContent.addOtherPos(CustomPlotFactory.getTitle(CustomPlotFactory.getCustomType(plot.getCustomPlotList().get(i))));
dealPlot(formulaInfos, customContent, plot.getCustomPlotList().get(i));
}
} else if (chart.getPlot() instanceof VanChartDrillMapPlot) {
ITContent drillContent = ITContent.copy(conditionContent);
drillContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Drill_Dir"));
dealNameJavaScriptGroup(formulaInfos, drillContent, ((VanChartDrillMapPlot) chart.getPlot()).getDrillUpHyperLink());
} else if (chart.getPlot() != null) {
dealPlot(formulaInfos, conditionContent, chart.getPlot());
}

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

@ -257,7 +257,6 @@ public class ITReplaceMainDialog extends UIDialog {
* @param replaceStr
*/
public void replace(String searchStr, String replaceStr) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
for (Info info : searchContentResultList) {
if (!info.getContent().isWrongful() && info.getContent().isSelected()) {
info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray());
@ -266,6 +265,7 @@ public class ITReplaceMainDialog extends UIDialog {
info.getContent().setReplaced(true);
}
}
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
northPane.getResultLabel().setText(ShowValueUtils.getResultTip(searchContentResultList.size(), contentReplaceCount, contentReplaceFailedCount));
southPanel.getTableEditorPane().update();
northPane.refreshReplaceInputComboBoxItems();
@ -529,7 +529,6 @@ public class ITReplaceMainDialog extends UIDialog {
if (isInputStrValid(inputStr, extraStr)) {
String secondStr = GeneralUtils.objectToString(northPane.getReplaceSettingInputComboBox().getSelectedItem());
String thirdStr = GeneralUtils.objectToString(northPane.getReplaceExtraSettingComboBox().getSelectedItem());
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
for (Info info : searchSettingResultList) {
if (isSupportReplace(info)) {
SettingController controller = SettingController.match(firstStr);
@ -540,10 +539,10 @@ public class ITReplaceMainDialog extends UIDialog {
}
}
}
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
northPane.getSettingResultLabel().setText(ShowValueUtils.getResultTip(searchSettingResultList.size(), settingReplaceCount, settingReplaceFailedCount));
southPanel.getTableEditorPane().update();
ITTableEditorPane.getEditTable().repaint();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
} else {
search4Setting();
}

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

@ -26,6 +26,7 @@ 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.drillmap.VanChartDrillMapPlot;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.map.attr.AttrMapLabel;
import com.fr.plugin.chart.map.attr.AttrMapTooltip;
@ -63,6 +64,14 @@ public class SearchJSUtils {
*/
public static final String CATEGORY_LABEL = ShowValueUtils.joinStr4Position(Toolkit.i18nText("Fine-Design_Basic_Style"), Toolkit.i18nText("Fine-Design_Chart_Data_Label"), Toolkit.i18nText("Fine-Design_Chart_Category_Label"));
/**
* 条件属性
*/
public static final String CONDITION = ShowValueUtils.joinStr4Position(
Toolkit.i18nText("Fine-Design_Chart_Chart"),
Toolkit.i18nText("Fine-Design_Chart_Animation_Special"),
Toolkit.i18nText("Fine-Design_Chart_Interactive"));
/**
* 从Listener中获取JS
*/
@ -338,6 +347,8 @@ public class SearchJSUtils {
VanChart chart = ((VanChart) chartCollection.getChart(i));
if (isCustomMapPlot(chart.getPlot())) {
dealMapNameJavaScript(content, chart.getPlot(), jsInfos);
} else if (chart.getPlot() instanceof VanChartDrillMapPlot) {
dealDrillNameJavaScript(content, chart.getPlot(), jsInfos);
} else {
NameJavaScriptGroup nameJavaScriptGroup = chart.getPlot().getHotHyperLink();
addNameJavaScript2Array(nameJavaScriptArrayList, nameJavaScriptGroup);
@ -347,6 +358,17 @@ public class SearchJSUtils {
return nameJavaScriptArrayList;
}
private static void dealDrillNameJavaScript(ITContent content, VanChartDrillMapPlot plot, List<JSInfo> jsInfos) {
ITContent chartContent = ITContent.copy(content);
chartContent.addOtherPos(
CONDITION,
Toolkit.i18nText("Fine-Design_Chart_Drill_Dir")
);
List<NameJavaScript> list = new ArrayList<>();
addNameJavaScript2Array(list, plot.getDrillUpHyperLink());
addJSInfosFromNameJS(chartContent, list, jsInfos);
}
/**
* 是否是组合地图
* @param plot 图表的plot
@ -366,14 +388,15 @@ public class SearchJSUtils {
List<NameJavaScript> areaJavaScriptList = new ArrayList<>();
List<NameJavaScript> lineJavaScriptList = new ArrayList<>();
List<NameJavaScript> pointJavaScriptList = new ArrayList<>();
ITContent chartContent = ITContent.copy(content);
chartContent.addOtherPos(CONDITION);
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);
addJSInfosFromNameJS(ShowValueUtils.getCustomMapContent(chartContent, Toolkit.i18nText("Fine-Design_Chart_Region_Map")), areaJavaScriptList, jsInfos);
addJSInfosFromNameJS(ShowValueUtils.getCustomMapContent(chartContent, Toolkit.i18nText("Fine-Design_Chart_LineMap")), lineJavaScriptList, jsInfos);
addJSInfosFromNameJS(ShowValueUtils.getCustomMapContent(chartContent, Toolkit.i18nText("Fine-Design_Chart_PointMap")), pointJavaScriptList, jsInfos);
}
private static void addNameJavaScript2Array(List<NameJavaScript> nameJavaScriptArrayList, NameJavaScriptGroup nameJavaScriptGroup) {

Loading…
Cancel
Save