From 2f8216cd831e7ae6d83d323bfc75e19fb774a8c9 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 26 Sep 2022 13:45:48 +0800 Subject: [PATCH 01/12] =?UTF-8?q?REPORT-75998=20=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=80=85=E8=B0=83=E8=AF=95&=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=BC=96=E8=BE=91=E6=A8=A1=E5=BC=8F=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=A4=84=E7=90=86=E3=80=81=E5=AE=8C=E5=96=84=E9=80=9A=E9=85=8D?= =?UTF-8?q?=E7=AC=A6=E3=80=81=E4=BC=98=E5=8C=96=E7=95=8C=E9=9D=A2=E3=80=81?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8B=BE=E9=80=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/AllowAuthorityEditAction.java | 8 ++ .../fr/design/module/DesignModuleFactory.java | 13 +++ .../fr/design/preview/DeveloperPreview.java | 8 ++ .../action/ShowSearchResultAction.java | 4 +- .../replace/ui/ITReplaceMainDialog.java | 26 +++++- .../replace/ui/ITReplaceNorthPanel.java | 5 +- .../replace/ui/ITReplaceSouthPanel.java | 7 +- .../actions/replace/ui/ITTableButton.java | 1 - .../actions/replace/ui/ITTableEditorPane.java | 4 +- .../actions/replace/utils/ShowValueUtils.java | 79 +++++++++++++++---- .../fr/start/module/DesignerActivator.java | 2 + 11 files changed, 133 insertions(+), 24 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index 1a0509d267..bb26e17118 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -4,11 +4,14 @@ import com.fr.base.svg.IconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; +import com.fr.design.module.DesignModuleFactory; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; +import com.fr.invoke.Reflect; +import com.fr.log.FineLoggerFactory; /** * Author : daisy @@ -61,6 +64,11 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); + try { + Reflect.on(DesignModuleFactory.getReplacePane().newInstance()).call("close"); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } //画虚线 return true; diff --git a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java index baed29be47..60a4dfcf18 100644 --- a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java +++ b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java @@ -50,6 +50,7 @@ public class DesignModuleFactory { private Class ITReplaceAction; private Class formParaDesigner; private Class paraPropertyPane; + private Class replacePane; private Class formHierarchyPaneCls; private Class widgetPropertyPane; private Class buttonDetailPaneClass; @@ -131,6 +132,18 @@ public class DesignModuleFactory { return instance.ITReplaceAction; } + /** + * 注册一下查找替换面板 + * @param r + */ + public static void registerReplacePane(Class r){ + instance.replacePane = r; + } + + public static Class getReplacePane(){ + return instance.replacePane; + } + public static void registerParaPropertyPaneClass(Class p) { instance.paraPropertyPane = p; } diff --git a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java index 69e514b408..5c0a623857 100644 --- a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java +++ b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java @@ -6,9 +6,12 @@ import com.fr.design.fun.impl.AbstractPreviewProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; +import com.fr.design.module.DesignModuleFactory; import com.fr.design.worker.WorkerManager; import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.general.web.ParameterConstants; +import com.fr.invoke.Reflect; +import com.fr.log.FineLoggerFactory; import java.util.HashMap; import java.util.Map; @@ -47,6 +50,11 @@ public class DeveloperPreview extends AbstractPreviewProvider { @Override public void onClick(JTemplate jt) { super.onClick(jt); + try { + Reflect.on(DesignModuleFactory.getReplacePane().newInstance()).call("close"); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId()); if (worker instanceof CallbackSaveWorker) { CallbackSaveWorker callbackSaveWorker = (CallbackSaveWorker) worker; 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 601b3d09e5..f555de9689 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 @@ -75,7 +75,7 @@ public enum ShowSearchResultAction implements ShowValue { } else { Map stringHashMap = info.getValue(); String content = stringHashMap.getOrDefault(objectContentKey, StringUtils.EMPTY); - if (content.contains(str) && StringUtils.isNotEmpty(content)) { + if (ShowValueUtils.contains(content,str) && StringUtils.isNotEmpty(content)) { info.getContent().setShowStr(ShowValueUtils.getCommonString(content, str)); info.getContent().setOldShowStr(content); info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str)); @@ -416,6 +416,6 @@ public enum ShowSearchResultAction implements ShowValue { * @return */ public boolean isTitleNameValid(Title title, String str){ - return title != null && GeneralUtils.objectToString(title.getTextObject()).contains(str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject())); + return title != null && ShowValueUtils.contains(GeneralUtils.objectToString(title.getTextObject()),str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject())); } } 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 f145cae021..2a922902f7 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 @@ -52,8 +52,9 @@ public class ITReplaceMainDialog extends UIDialog { private ITReplaceWestPanel westPanel; private boolean searchFlag; private String searchStr; + private static boolean existed = false; - private ITReplaceMainDialog() { + public ITReplaceMainDialog() { super(DesignerContext.getDesignerFrame()); init(); } @@ -66,6 +67,7 @@ public class ITReplaceMainDialog extends UIDialog { initFrame(); fitScreen(); ITReplaceFlag = true; + existed = true; } /** @@ -309,6 +311,28 @@ public class ITReplaceMainDialog extends UIDialog { } } + /** + * 面板是否存在 + * @return + */ + public static boolean isExisted() { + return existed; + } + + public static void setExisted(boolean existed) { + ITReplaceMainDialog.existed = existed; + } + + + /** + * 进入权限编辑状态&开发者调试时关闭面板 + */ + public static void close(){ + if (isExisted()){ + getInstance().dispose(); + setExisted(false); + } + } /** * 检测结果是否合法 */ 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 bc4e82255f..a4fe1fef0f 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 @@ -47,6 +47,7 @@ public class ITReplaceNorthPanel { private static final int HEIGHT = 161; private static final int BUTTON_WIDTH = 60; private static final int BUTTON_GAP = 20; + private static final int MATCH_WIDTH = 70; private int findLabelX, findLabelY, findLabelWidth, findLabelHeight; @@ -83,7 +84,7 @@ public class ITReplaceNorthPanel { resultLabel = new UILabel(); String[] rangeItems = new String[]{Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")}; - String[] replaceInputItems = new String[]{""}; + String[] replaceInputItems = new String[]{StringUtils.EMPTY}; findCombobox = new UIComboBox(findItems.toArray()); rangeCombobox = new UIComboBox(rangeItems); findInputCombobox = new UIComboBox(findInputItems.toArray()) { @@ -247,7 +248,7 @@ public class ITReplaceNorthPanel { private void setUIRadioButtonBounds(int x, int y, int templateWidth) { matchX = x + templateWidth / 60; matchY = y + 90; - matchWidth = templateWidth; + matchWidth = MATCH_WIDTH; matchHeight = 25; matchRadioButton.setBounds(matchX, matchY, matchWidth, matchHeight); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java index 7db6b52850..8921dce5ff 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java @@ -18,7 +18,12 @@ public class ITReplaceSouthPanel { public ITReplaceSouthPanel() { itTableEditor = new ITTableEditor(); tableEditorPane = new ITTableEditorPane<>(itTableEditor); - RowSorter sorter = new TableRowSorter(itTableEditor); + RowSorter sorter = new TableRowSorter(itTableEditor){ + @Override + public boolean isSortable(int column) { + return column != 0 || column != 6; + } + }; tableEditorPane.getEditTable().setRowSorter(sorter); tableEditorPane.getEditTable().setSelectionBackground(new Color(217, 235, 254)); tableEditorPane.getEditTable().setRowHeight(tableEditorPane.getEditTable().getRowHeight() / 2 + tableEditorPane.getEditTable().getRowHeight()); diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java index 4c94cc1147..03717a725c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java @@ -43,7 +43,6 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor 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); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java index 928c2da67d..c35f2ef14d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java @@ -71,7 +71,7 @@ public class ITTableEditorPane extends BasicPane { int row = ((JTable) e.getSource()).rowAtPoint(e.getPoint()); int col = ((JTable) e.getSource()).columnAtPoint(e.getPoint()); if (col == 0) { - ITContent content = (ITContent) editTable.getValueAt(row, 7); + ITContent content = (ITContent) editTable.getValueAt(row, 6); if (content.isSelected()) { content.setSelected(false); editTable.setValueAt(content.isSelected(), row, col); @@ -187,7 +187,7 @@ public class ITTableEditorPane extends BasicPane { */ public static void selectAllOrNull(Boolean value) { for (int i = 0; i < getEditTable().getRowCount(); i++) { - ((ITContent) (getEditTable().getValueAt(i, 7))).setSelected(value); + ((ITContent) (getEditTable().getValueAt(i, 6))).setSelected(value); } } 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 b215a16c6d..b7da5fc23c 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 @@ -1,9 +1,8 @@ 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 +29,20 @@ 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]"; + private static List specialCharList = new ArrayList<>(); + static { + //正则特殊字符:? * () [] {} ^ $ + //如果是? 并采用通配符 ,会自动转成“.” 所以 ? 不用处理 + //$同理 + specialCharList.add("*"); + specialCharList.add("("); + specialCharList.add(")"); + specialCharList.add("["); + specialCharList.add("]"); + specialCharList.add("{"); + specialCharList.add("}"); + specialCharList.add("^"); + } /** * 获取除内容外其他一次性展示所有的内容(名称、水印...) @@ -42,9 +55,7 @@ public class ShowValueUtils { if (StringUtils.isEmpty(searchStr)) { return str; } else { - return "
" + - replaceAll(str, searchStr, "" + searchStr + "") + - "
"; + return updateHighlight(str, searchStr); } } @@ -57,7 +68,11 @@ public class ShowValueUtils { * @return 替换后的字符串 */ public static String replaceAll(String str, String regex, String replacement) { - return str.replace(regex, replacement); + if (ITReplaceMainDialog.isMatched()) { + return str.replaceAll(changeRegex(regex), replacement); + } else { + return str.replace(regex, replacement); + } } /** @@ -70,6 +85,10 @@ public class ShowValueUtils { regex = regex.replace(NUMBER, NUMBER_REGEX); regex = regex.replace(ENGLISH, ENGLISH_REGEX); regex = regex.replace(ANY_THING, ANY_THING_REGEX); + String change = "\\"; + for (int i = 0 ; i < specialCharList.size() ; i ++){ + regex = regex.replace(specialCharList.get(i),change + specialCharList.get(i)); + } return regex; } @@ -101,18 +120,36 @@ public class ShowValueUtils { return pairs; } + /** - * 更新高亮状态 + * 更新高亮 * - * @param info - * @param replaceStr + * @param str + * @param searchStr + * @return */ - public static void updateHighlight(Info info, String replaceStr) { - String s = info.getInfoShowStr(info); - s = s.replace(info.getContent().getLastSearchStr(), "" + replaceStr + ""); - info.getContent().setShowStr( - "
" + s + "
" - ); + public static String updateHighlight(String str, String searchStr) { + if (ITReplaceMainDialog.isMatched()) { + String result = str; + Pattern pattern = Pattern.compile(changeRegex(searchStr)); + Matcher matcher = pattern.matcher(str); + String head = ""; + String tail = ""; + int size = head.length() + tail.length(); + int index = 0; + StringBuilder builder = new StringBuilder(str); + while (matcher.find()) { + builder.replace(matcher.start() + index, matcher.end() + index, head + matcher.group() + tail); + index += size; + } + return "
" + + builder.toString() + + "
"; + } else { + return "
" + + replaceAll(str, searchStr, "" + searchStr + "") + + "
"; + } } @@ -146,4 +183,16 @@ public class ShowValueUtils { } return failReturn; } + + public static boolean contains(String originStr, String matchStr) { + if (ITReplaceMainDialog.isMatched()) { + String str = changeRegex(matchStr); + Pattern pattern = Pattern.compile(str); + Matcher matcher = pattern.matcher(originStr); + return matcher.find(); + } else { + return originStr.contains(matchStr); + } + + } } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index af32f596c4..1a04c79ac9 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -32,6 +32,7 @@ import com.fr.design.actions.insert.flot.FormulaFloatAction; import com.fr.design.actions.insert.flot.ImageFloatAction; import com.fr.design.actions.insert.flot.TextBoxFloatAction; import com.fr.design.actions.replace.ITReplaceAction; +import com.fr.design.actions.replace.ui.ITReplaceMainDialog; import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.env.DesignerWorkspaceLoader; @@ -466,6 +467,7 @@ public class DesignerActivator extends Activator implements Prepare { DesignModuleFactory.registerNewFormActionClass(NewFormAction.class); DesignModuleFactory.registerReplaceActionClass(ITReplaceAction.class); + DesignModuleFactory.registerReplacePane(ITReplaceMainDialog.class); DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class); DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class); DesignModuleFactory.registerFormHierarchyPaneClass(FormHierarchyTreePane.class); From 7f835f9f8f64067203ff4ed8bd54326c72a3c04b Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 26 Sep 2022 14:48:43 +0800 Subject: [PATCH 02/12] =?UTF-8?q?REPORT-75998=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E9=80=BB=E8=BE=91=E3=80=81=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E9=80=9A=E9=85=8D=E7=AC=A6=E3=80=81=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=E5=9B=BE=E7=89=87=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../replace/action/SearchManagerCenter.java | 2 +- .../action/ShowSearchResultAction.java | 31 ++++++++++------- .../action/content/cell/SearchCellAction.java | 1 + .../floatelement/SearchFloatAction.java | 5 ++- .../content/formula/FormulaReplaceObject.java | 34 ------------------- .../cell/SearchCellFormulaManager.java | 2 -- .../design/actions/replace/info/CellInfo.java | 28 --------------- .../actions/replace/utils/ShowValueUtils.java | 9 ++--- 8 files changed, 30 insertions(+), 82 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java index 211ab41d66..0608bde483 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java @@ -61,7 +61,7 @@ public class SearchManagerCenter { */ public enum ManagerType implements SearchManager { /** - * 注册单元格不同值类型中自己特有的公式(数据列、子报表、公式、富文本,可自己添加) + * 注册单元格不同值类型中自己特有的公式(数据列、子报表、公式,可自己添加) */ CELL_FORMULA(0) { @Override 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 f555de9689..846263c5a9 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 @@ -24,6 +24,7 @@ import com.fr.design.mainframe.JTemplate; import com.fr.general.GeneralUtils; import com.fr.report.cell.CellElement; import com.fr.report.cell.FloatElement; +import com.fr.report.cell.cellattr.core.RichText; import com.fr.stable.StringUtils; import com.fr.stable.collections.combination.Pair; import org.jetbrains.annotations.Nullable; @@ -75,7 +76,7 @@ public enum ShowSearchResultAction implements ShowValue { } else { Map stringHashMap = info.getValue(); String content = stringHashMap.getOrDefault(objectContentKey, StringUtils.EMPTY); - if (ShowValueUtils.contains(content,str) && StringUtils.isNotEmpty(content)) { + if (isValueValid(content, str, info)) { info.getContent().setShowStr(ShowValueUtils.getCommonString(content, str)); info.getContent().setOldShowStr(content); info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str)); @@ -94,6 +95,11 @@ public enum ShowSearchResultAction implements ShowValue { cellInfo.getContent().setSelected(true); } + private boolean isValueValid(String content, String str, Info info) { + CellElement cellElement = (CellElement) info.getContent().getReplaceObject(); + return ShowValueUtils.contains(content, str) && StringUtils.isNotEmpty(content) && !(cellElement.getValue() instanceof RichText); + + } }, /** * 搜索JS事件 @@ -139,7 +145,7 @@ public enum ShowSearchResultAction implements ShowValue { private void searchMap4JS(Map map, List jsInfos, JSInfo info, String str) { if (map.containsKey(objectNameKey) && StringUtils.isNotEmpty(map.get(objectNameKey))) { String name = map.get(objectNameKey); - if (name.contains(str)) { + if (ShowValueUtils.contains(name,str)) { JSInfo nameJSInfo = info.copy(); nameJSInfo.getContent().setShowStr(ShowValueUtils.getCommonString(name, str)); nameJSInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(name, str)); @@ -151,7 +157,7 @@ public enum ShowSearchResultAction implements ShowValue { } if (map.containsKey(objectContentKey) && StringUtils.isNotEmpty(map.get(objectContentKey))) { String content = map.get(objectContentKey); - if (content.contains(str)) { + if (ShowValueUtils.contains(content,str)) { JSInfo contentJSInfo = info.copy(); contentJSInfo.getContent().setShowStr(ShowValueUtils.getCommonString(content, str)); contentJSInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str)); @@ -195,7 +201,7 @@ public enum ShowSearchResultAction implements ShowValue { private void searchMap4SQLContent(Map map, List sqlInfos, SQLInfo info, String str) { if (map.containsKey(objectContentKey) && StringUtils.isNotEmpty(map.get(objectContentKey))) { String content = map.get(objectContentKey); - if (content.contains(str)) { + if (ShowValueUtils.contains(content,str)) { SQLInfo contentJSInfo = info.copy(); contentJSInfo.getContent().setShowStr(ShowValueUtils.getCommonString(content, str)); contentJSInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str)); @@ -231,7 +237,7 @@ public enum ShowSearchResultAction implements ShowValue { if (((FloatInfo) info).isChartExist()) { ChartCollection chartCollection = (ChartCollection) floatElement.getValue(); for (int i = 0; i < chartCollection.getChartCount(); i++) { - if (isTitleNameValid(chartCollection.getChart(i).getTitle(),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); @@ -244,7 +250,7 @@ public enum ShowSearchResultAction implements ShowValue { } } } else { - if (GeneralUtils.objectToString(floatElement.getValue()).contains(str)) { + if (ShowValueUtils.contains(GeneralUtils.objectToString(floatElement.getValue()), str)) { FloatInfo floatInfo = ((FloatInfo) info).copy(); setShowInfo(floatInfo, GeneralUtils.objectToString(floatElement.getValue()), str); floatInfos.add(floatInfo); @@ -285,7 +291,7 @@ public enum ShowSearchResultAction implements ShowValue { private void searchMap4Component(Map stringHashMap, ArrayList componentInfos, ComponentInfo info, String str) { if (stringHashMap.containsKey(objectContentKey)) { String content = stringHashMap.get(objectContentKey); - if (content.contains(str)) { + if (ShowValueUtils.contains(content,str)) { info.getContent().setShowStr(ShowValueUtils.getCommonString(content, str)); info.getContent().setOldShowStr(stringHashMap.get(objectContentKey)); info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str)); @@ -319,7 +325,7 @@ public enum ShowSearchResultAction implements ShowValue { private void searchMap4Widget(Map map, List widgetInfos, WidgetInfo info, String str) { if (map.containsKey(objectNameKey)) { String name = map.get(objectNameKey); - if (StringUtils.isNotEmpty(name) && name.contains(str)) { + if (StringUtils.isNotEmpty(name) && ShowValueUtils.contains(name,str)) { WidgetInfo nameInfo = info.copy(info); nameInfo.getContent().setShowStr(ShowValueUtils.getCommonString(name, str)); nameInfo.getContent().setOldShowStr(map.get(objectNameKey)); @@ -331,7 +337,7 @@ public enum ShowSearchResultAction implements ShowValue { } if (map.containsKey(objectWaterMarkKey)) { String waterMark = map.get(objectWaterMarkKey); - if (StringUtils.isNotEmpty(waterMark) && waterMark.contains(str)) { + if (StringUtils.isNotEmpty(waterMark) && ShowValueUtils.contains(waterMark,str)) { WidgetInfo widgetInfo = info.copy(info); widgetInfo.getContent().setShowStr(ShowValueUtils.getCommonString(waterMark, str)); widgetInfo.getContent().setOldShowStr(map.get(objectWaterMarkKey)); @@ -368,7 +374,7 @@ public enum ShowSearchResultAction implements ShowValue { private void searchMap4Formula(Map stringHashMap, List formulaInfos, FormulaInfo info, String str) { if (stringHashMap.containsKey(objectContentKey)) { String name = stringHashMap.get(objectContentKey); - if (name.contains(str)) { + if (ShowValueUtils.contains(name,str)) { info.getContent().setShowStr(ShowValueUtils.getCommonString(name, str)); info.getContent().setOldShowStr(stringHashMap.get(objectContentKey)); info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(name, str)); @@ -411,11 +417,12 @@ public enum ShowSearchResultAction implements ShowValue { /** * 标题是否可用 + * * @param title * @param str * @return */ - public boolean isTitleNameValid(Title title, String str){ - return title != null && ShowValueUtils.contains(GeneralUtils.objectToString(title.getTextObject()),str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject())); + public boolean isTitleNameValid(Title title, String str) { + return title != null && ShowValueUtils.contains(GeneralUtils.objectToString(title.getTextObject()), str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject())); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java index 826b247e0c..0f2f6d181a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java @@ -17,6 +17,7 @@ import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.general.GeneralUtils; import com.fr.main.impl.WorkBook; import com.fr.report.cell.CellElement; +import com.fr.report.cell.cellattr.core.RichText; import com.fr.report.elementcase.ElementCase; import com.fr.report.poly.PolyECBlock; import com.fr.report.report.Report; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java index 6f0a338b90..4a478b596e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java @@ -7,6 +7,7 @@ import com.fr.design.actions.replace.info.FloatInfo; import com.fr.design.actions.replace.info.base.ITContent; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JTemplate; +import com.fr.general.ImageWithSuffix; import com.fr.main.impl.WorkBook; import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.ElementCase; @@ -84,7 +85,9 @@ public class SearchFloatAction implements SearchAction { if (floatElement.getValue() instanceof ChartCollection) { floatInfo.setChartExist(true); } - result.add(floatInfo); + if (!(floatElement.getValue() instanceof ImageWithSuffix)){ + result.add(floatInfo); + } } } 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 720dbab1e8..e002832656 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 @@ -133,40 +133,6 @@ public enum FormulaReplaceObject implements DealWithInfoValue { return false; } }, - /** - * 富文本 - */ - RICH_CHAR("RichChar") { - @Override - public Map getValue(Object... o) { - HashMap map = new HashMap<>(); - if (o[0] instanceof RichChar) { - if (StringUtils.isNotEmpty(((RichChar) o[0]).getText())) { - map.put("content", (((RichChar) o[0]).getText())); - } - } - return map; - } - - @Override - public void setValue(Info info, String findStr, String replaceStr, List> operatorArray) { - Object replaceObject = info.getContent().getReplaceObject(); - if (replaceObject instanceof RichChar) { - RichChar richChar = (RichChar) replaceObject; - info.updateOldStr(richChar.getText(), findStr); - richChar.setText(ShowValueUtils.replaceAll(richChar.getText(), findStr, replaceStr)); - } - } - - @Override - public boolean check(Info info) { - if (info.getContent().getReplaceObject() instanceof RichChar){ - RichChar richChar = (RichChar) info.getContent().getReplaceObject(); - return StringUtils.equals(richChar.getText(), info.getContent().getOldShowStr()); - } - return false; - } - }, /** * KV */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java index eee99bf203..59982245e3 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java @@ -25,8 +25,6 @@ public class SearchCellFormulaManager implements SearchManager { register(DS_COLUMN, SearchDSColumnFormulaAction.getInstance()); //公式 register(FORMULA, SearchCellFormulaTypeAction.getInstance()); - //富文本 - register(RICH_TEXT, SearchRichFormulaAction.getInstance()); //子报表 register(SUB_REPORT, SearchSubReportFormulaAction.getInstance()); diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/info/CellInfo.java b/designer-realize/src/main/java/com/fr/design/actions/replace/info/CellInfo.java index 94a8f73ce5..e5a6ce4fa2 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/info/CellInfo.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/info/CellInfo.java @@ -219,34 +219,6 @@ public class CellInfo implements Info { return ((DSColumn) o.getValue()).getDSName(); } }, - - /** - * 富文本形式 - * 为了不破坏富文本的格式,暂时不对样式不同的文本进行连接替换,每个样式不同的文本都是一个独立的个体 - */ - RICH_TEXT("RichText") { - @Override - public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) { - cellInfo.updateOldStr(GeneralUtils.objectToString(((RichText) o).getContent()), findStr); - Iterator it = ((RichText) o).charIterator(); - while (it.hasNext()) { - RichChar richChar = it.next(); - richChar.setText(ShowValueUtils.replaceAll(richChar.getText(), findStr, replaceStr)); - } - } - - @Override - public void addValue2Map(Object o, HashMap map) { - map.put("content", ((RichText) o).getContent()); - } - - @Override - public String getCheckValue(Info info) { - CellElement o = (CellElement) info.getContent().getReplaceObject(); - return ((RichText) o.getValue()).getContent(); - } - }, - /** * 公式类型 */ 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 b7da5fc23c..c0d95e7079 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 @@ -31,7 +31,7 @@ public class ShowValueUtils { public static final String ENGLISH_REGEX = "[a-zA-Z]"; private static List specialCharList = new ArrayList<>(); static { - //正则特殊字符:? * () [] {} ^ $ + //正则特殊字符:? * () [] {} ^ $ . //如果是? 并采用通配符 ,会自动转成“.” 所以 ? 不用处理 //$同理 specialCharList.add("*"); @@ -42,6 +42,7 @@ public class ShowValueUtils { specialCharList.add("{"); specialCharList.add("}"); specialCharList.add("^"); + specialCharList.add("."); } /** @@ -82,13 +83,13 @@ public class ShowValueUtils { * @return */ 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); String change = "\\"; for (int i = 0 ; i < specialCharList.size() ; i ++){ regex = regex.replace(specialCharList.get(i),change + specialCharList.get(i)); } + regex = regex.replace(NUMBER, NUMBER_REGEX); + regex = regex.replace(ENGLISH, ENGLISH_REGEX); + regex = regex.replace(ANY_THING, ANY_THING_REGEX); return regex; } From a3041d2f0ba102fd8a7c0215407cfcd75a626f8e Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 26 Sep 2022 16:05:39 +0800 Subject: [PATCH 03/12] =?UTF-8?q?REPORT-75998=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=BB=84=E5=90=88=E5=9B=BEJS=E3=80=81=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SearchChartCollectionFormulaAction.java | 33 ++++++++++++++----- .../content/js/SearchChartJSAction.java | 29 ++++++++++++++++ .../actions/replace/info/ReplaceObject.java | 22 +++++-------- 3 files changed, 62 insertions(+), 22 deletions(-) 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 6d85266228..40ff04006c 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 @@ -9,6 +9,7 @@ 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.Plot; import com.fr.chart.chartattr.SwitchTitle; import com.fr.chart.chartattr.Title; @@ -28,6 +29,9 @@ 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.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.stable.StringUtils; @@ -92,20 +96,31 @@ public class SearchChartCollectionFormulaAction { 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()); - } + + if (chart.getPlot() instanceof VanChartCustomPlot){ + VanChartCustomPlot plot = chart.getPlot(); + for (int i = 0 ; i < plot.getCustomPlotList().size() ; i++){ + ITContent customContent = ITContent.copy(conditionContent); + customContent.addOtherPos(CustomPlotFactory.getTitle(CustomPlotFactory.getCustomType(plot.getCustomPlotList().get(i)))); + dealPlot(formulaInfos,customContent,plot.getCustomPlotList().get(i)); } + } else if (chart.getPlot() != null) { + dealPlot(formulaInfos,conditionContent,chart.getPlot()); } } + private void dealPlot(List formulaInfos, ITContent content, Plot plot){ + NameJavaScriptGroup javaScriptGroup = plot.getHotHyperLink(); + if (javaScriptGroup != null) { + for (int i = 0; i < javaScriptGroup.size(); i++) { + NameJavaScript javaScript = javaScriptGroup.getNameHyperlink(i); + content.addOtherPos(javaScript.getName()); + SearchJSHighlightAction action = SearchJSHighlightAction.getInstance(); + action.searchJSFormulaFromOther(formulaInfos, content, javaScript.getJavaScript()); + } + } + } private void searchFormulaFromChartPresent(List formulaInfos, ITContent content, TopDefinitionProvider provider) { searchPresent4Formula(provider.getCategoryPresent(), content, formulaInfos); 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 bbcb960053..069167260a 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 @@ -7,14 +7,20 @@ 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.i18n.Toolkit; +import com.fr.js.JavaScriptImpl; 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.base.RefreshMoreLabel; 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.vanchart.VanChart; import com.fr.stable.collections.combination.Pair; +import java.util.ArrayList; import java.util.List; /** @@ -60,7 +66,30 @@ public class SearchChartJSAction { chartContent.addOtherPos(chartCollection.getChart(i).getChartName()); //坐标轴 searchAxisJS(jsInfos, chartContent, chartCollection.getChart(i)); + //组合图表-条件属性-超链特判 + dealCustomPlot(jsInfos, conditionContent,chartCollection.getChart(i)); + } + } + private void dealCustomPlot(List jsInfos, ITContent conditionContent, Chart chart) { + if (chart.getPlot() instanceof VanChartCustomPlot){ + VanChartCustomPlot customPlot = chart.getPlot(); + for (VanChartPlot plot : customPlot.getCustomPlotList()){ + NameJavaScriptGroup javaScriptGroup = plot.getHotHyperLink(); + if (javaScriptGroup != null){ + for (int i = 0 ; i < javaScriptGroup.size();i++){ + if (javaScriptGroup.getNameHyperlink(i).getJavaScript() instanceof JavaScriptImpl){ + ITContent content = ITContent.copy(conditionContent); + content.addOtherPos( + CustomPlotFactory.getTitle(CustomPlotFactory.getCustomType(plot)), + javaScriptGroup.getNameHyperlink(i).getName() + ); + content.setReplaceObject(javaScriptGroup.getNameHyperlink(i)); + jsInfos.add(new JSInfo(content)); + } + } + } + } } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java b/designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java index 9f06a2d716..240ac6ba36 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java @@ -46,7 +46,7 @@ public enum ReplaceObject implements DealWithInfoValue { } else { NameJavaScript javaScript = ((NameJavaScript) (info.getContent().getReplaceObject())); info.updateOldStr(javaScript.getName(), findStr); - javaScript.setName(javaScript.getName().replaceAll(findStr, replaceStr)); + javaScript.setName(ShowValueUtils.replaceAll(javaScript.getName(), findStr, replaceStr)); } } @@ -87,15 +87,13 @@ public enum ReplaceObject implements DealWithInfoValue { @Override public void setValue(Info info, String findStr, String replaceStr, List> operatorArray) { if (((JSInfo) info).isContent()) { - if (operatorArray.size() > 0) { - JavaScriptImpl javaScript = (JavaScriptImpl) ((Listener) (info.getContent().getReplaceObject())).getAction(); - info.updateOldStr(javaScript.getContent(), findStr); - javaScript.setContent(ShowValueUtils.replaceAll(javaScript.getContent(), findStr, replaceStr)); - } + JavaScriptImpl javaScript = (JavaScriptImpl) ((Listener) (info.getContent().getReplaceObject())).getAction(); + info.updateOldStr(javaScript.getContent(), findStr); + javaScript.setContent(ShowValueUtils.replaceAll(javaScript.getContent(), findStr, replaceStr)); } else { Listener listener = ((Listener) ((info.getContent().getReplaceObject()))); info.updateOldStr(listener.getName(), findStr); - listener.setName(listener.getName().replaceAll(findStr, replaceStr)); + listener.setName(ShowValueUtils.replaceAll(listener.getName(), findStr, replaceStr)); } } @@ -135,12 +133,10 @@ public enum ReplaceObject implements DealWithInfoValue { @Override public void setValue(Info info, String findStr, String replaceStr, List> operatorArray) { if (((JSInfo) info).isContent()) { - if (operatorArray.size() > 0) { - VanChartHtmlLabel htmlLabel = ((VanChartHtmlLabel) (info.getContent().getReplaceObject())); - StringBuilder stringBuilder = new StringBuilder(htmlLabel.getCustomText()); - info.updateOldStr(htmlLabel.getCustomText(), findStr); - htmlLabel.setCustomText(ShowValueUtils.replaceAll(htmlLabel.getCustomText(), findStr, replaceStr)); - } + VanChartHtmlLabel htmlLabel = ((VanChartHtmlLabel) (info.getContent().getReplaceObject())); + StringBuilder stringBuilder = new StringBuilder(htmlLabel.getCustomText()); + info.updateOldStr(htmlLabel.getCustomText(), findStr); + htmlLabel.setCustomText(ShowValueUtils.replaceAll(htmlLabel.getCustomText(), findStr, replaceStr)); } } From eca25b845df9100f487390816f1d9c90a78c9af0 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 26 Sep 2022 16:14:26 +0800 Subject: [PATCH 04/12] =?UTF-8?q?REPORT-75998=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E3=80=81=E8=B0=83=E6=95=B4=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/content/cell/SearchCellAction.java | 1 - .../content/floatelement/SearchFloatAction.java | 2 +- .../chart/SearchChartCollectionFormulaAction.java | 10 +++++----- .../condition/SearchFormulaConditionAction.java | 1 - .../action/content/js/SearchChartJSAction.java | 12 ++++++------ .../design/actions/replace/utils/ShowValueUtils.java | 12 +++++++++--- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java index 0f2f6d181a..826b247e0c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java @@ -17,7 +17,6 @@ import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.general.GeneralUtils; import com.fr.main.impl.WorkBook; import com.fr.report.cell.CellElement; -import com.fr.report.cell.cellattr.core.RichText; import com.fr.report.elementcase.ElementCase; import com.fr.report.poly.PolyECBlock; import com.fr.report.report.Report; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java index 4a478b596e..4eaa574bea 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java @@ -85,7 +85,7 @@ public class SearchFloatAction implements SearchAction { if (floatElement.getValue() instanceof ChartCollection) { floatInfo.setChartExist(true); } - if (!(floatElement.getValue() instanceof ImageWithSuffix)){ + if (!(floatElement.getValue() instanceof ImageWithSuffix)) { result.add(floatInfo); } } 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 40ff04006c..aadf2aee41 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 @@ -97,20 +97,20 @@ public class SearchChartCollectionFormulaAction { Toolkit.i18nText("Fine-Design_Chart_Interactive") ); - if (chart.getPlot() instanceof VanChartCustomPlot){ + if (chart.getPlot() instanceof VanChartCustomPlot) { VanChartCustomPlot plot = chart.getPlot(); - for (int i = 0 ; i < plot.getCustomPlotList().size() ; i++){ + for (int i = 0; i < plot.getCustomPlotList().size(); i++) { ITContent customContent = ITContent.copy(conditionContent); customContent.addOtherPos(CustomPlotFactory.getTitle(CustomPlotFactory.getCustomType(plot.getCustomPlotList().get(i)))); - dealPlot(formulaInfos,customContent,plot.getCustomPlotList().get(i)); + dealPlot(formulaInfos, customContent, plot.getCustomPlotList().get(i)); } } else if (chart.getPlot() != null) { - dealPlot(formulaInfos,conditionContent,chart.getPlot()); + dealPlot(formulaInfos, conditionContent, chart.getPlot()); } } - private void dealPlot(List formulaInfos, ITContent content, Plot plot){ + private void dealPlot(List formulaInfos, ITContent content, Plot plot) { NameJavaScriptGroup javaScriptGroup = plot.getHotHyperLink(); if (javaScriptGroup != null) { for (int i = 0; i < javaScriptGroup.size(); i++) { diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchFormulaConditionAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchFormulaConditionAction.java index c6b8533219..44d495018b 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchFormulaConditionAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchFormulaConditionAction.java @@ -21,7 +21,6 @@ public class SearchFormulaConditionAction implements SearchConditionFormula { } - @Override public void searchFormulaFromCondition(List formulaInfos, ITContent content, Condition condition) { if (((FormulaCondition) (condition)).getFormula() != null) { 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 069167260a..ad97655263 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 @@ -67,18 +67,18 @@ public class SearchChartJSAction { //坐标轴 searchAxisJS(jsInfos, chartContent, chartCollection.getChart(i)); //组合图表-条件属性-超链特判 - dealCustomPlot(jsInfos, conditionContent,chartCollection.getChart(i)); + dealCustomPlot(jsInfos, conditionContent, chartCollection.getChart(i)); } } private void dealCustomPlot(List jsInfos, ITContent conditionContent, Chart chart) { - if (chart.getPlot() instanceof VanChartCustomPlot){ + if (chart.getPlot() instanceof VanChartCustomPlot) { VanChartCustomPlot customPlot = chart.getPlot(); - for (VanChartPlot plot : customPlot.getCustomPlotList()){ + for (VanChartPlot plot : customPlot.getCustomPlotList()) { NameJavaScriptGroup javaScriptGroup = plot.getHotHyperLink(); - if (javaScriptGroup != null){ - for (int i = 0 ; i < javaScriptGroup.size();i++){ - if (javaScriptGroup.getNameHyperlink(i).getJavaScript() instanceof JavaScriptImpl){ + if (javaScriptGroup != null) { + for (int i = 0; i < javaScriptGroup.size(); i++) { + if (javaScriptGroup.getNameHyperlink(i).getJavaScript() instanceof JavaScriptImpl) { ITContent content = ITContent.copy(conditionContent); content.addOtherPos( CustomPlotFactory.getTitle(CustomPlotFactory.getCustomType(plot)), 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 c0d95e7079..8f962667d3 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 @@ -1,7 +1,6 @@ package com.fr.design.actions.replace.utils; - import com.fr.design.actions.replace.ui.ITReplaceMainDialog; import com.fr.stable.StringUtils; import com.fr.stable.collections.combination.Pair; @@ -30,6 +29,7 @@ public class ShowValueUtils { public static final String NUMBER_REGEX = "[0-9]"; public static final String ENGLISH_REGEX = "[a-zA-Z]"; private static List specialCharList = new ArrayList<>(); + static { //正则特殊字符:? * () [] {} ^ $ . //如果是? 并采用通配符 ,会自动转成“.” 所以 ? 不用处理 @@ -84,8 +84,8 @@ public class ShowValueUtils { */ public static String changeRegex(String regex) { String change = "\\"; - for (int i = 0 ; i < specialCharList.size() ; i ++){ - regex = regex.replace(specialCharList.get(i),change + specialCharList.get(i)); + for (int i = 0; i < specialCharList.size(); i++) { + regex = regex.replace(specialCharList.get(i), change + specialCharList.get(i)); } regex = regex.replace(NUMBER, NUMBER_REGEX); regex = regex.replace(ENGLISH, ENGLISH_REGEX); @@ -185,6 +185,12 @@ public class ShowValueUtils { return failReturn; } + /** + * 支持通配符的contains + * @param originStr + * @param matchStr + * @return + */ public static boolean contains(String originStr, String matchStr) { if (ITReplaceMainDialog.isMatched()) { String str = changeRegex(matchStr); From b583847db8be588f2797de936ea9aaecb35511b6 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 26 Sep 2022 16:33:58 +0800 Subject: [PATCH 05/12] =?UTF-8?q?REPORT-75998=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=AD=94=E6=9C=AF=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../replace/ui/ITReplaceSouthPanel.java | 6 +++++- .../actions/replace/ui/ITTableEditor.java | 6 +++--- .../actions/replace/ui/ITTableEditorPane.java | 10 +++++----- .../actions/replace/utils/ShowValueUtils.java | 20 +++++++++---------- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java index 8921dce5ff..a240eba967 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java @@ -14,6 +14,10 @@ import java.awt.Color; public class ITReplaceSouthPanel { ITTableEditorPane tableEditorPane; ITTableEditor itTableEditor; + //勾选框索引 + public static final int CHECKBOX_INDEX = 0; + //ITContent在表格的列索引 + public static final int CONTENT_INDEX = 6; public ITReplaceSouthPanel() { itTableEditor = new ITTableEditor(); @@ -21,7 +25,7 @@ public class ITReplaceSouthPanel { RowSorter sorter = new TableRowSorter(itTableEditor){ @Override public boolean isSortable(int column) { - return column != 0 || column != 6; + return column != CHECKBOX_INDEX || column != CONTENT_INDEX; } }; tableEditorPane.getEditTable().setRowSorter(sorter); diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java index 45e209f3a8..5c57e6d6a1 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java @@ -48,8 +48,8 @@ public class ITTableEditor extends UITableModelAdapter { this.setDefaultEditor(ITTableButton.class, new ITTableButton()); this.setDefaultRenderer(ITTableButton.class, new ITTableButton()); - this.createTable().getColumnModel().getColumn(6).setMaxWidth(50); - this.createTable().getColumnModel().getColumn(0).setMaxWidth(50); + this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CONTENT_INDEX).setMaxWidth(50); + this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CHECKBOX_INDEX).setMaxWidth(50); } @@ -81,7 +81,7 @@ public class ITTableEditor extends UITableModelAdapter { */ @Override public boolean isCellEditable(int row, int col) { - return col == 6 || col == 0; + return col == ITReplaceSouthPanel.CONTENT_INDEX || col == ITReplaceSouthPanel.CHECKBOX_INDEX; } /** diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java index c35f2ef14d..a9fe470edd 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java @@ -70,8 +70,8 @@ public class ITTableEditorPane extends BasicPane { public void mouseClicked(MouseEvent e) { int row = ((JTable) e.getSource()).rowAtPoint(e.getPoint()); int col = ((JTable) e.getSource()).columnAtPoint(e.getPoint()); - if (col == 0) { - ITContent content = (ITContent) editTable.getValueAt(row, 6); + if (col == ITReplaceSouthPanel.CHECKBOX_INDEX) { + ITContent content = (ITContent) editTable.getValueAt(row, ITReplaceSouthPanel.CONTENT_INDEX); if (content.isSelected()) { content.setSelected(false); editTable.setValueAt(content.isSelected(), row, col); @@ -116,7 +116,7 @@ public class ITTableEditorPane extends BasicPane { if (e.getClickCount() > 0) { //获得选中列 int selectColumn = tableHeader.columnAtPoint(e.getPoint()); - if (selectColumn == 0) { + if (selectColumn == ITReplaceSouthPanel.CHECKBOX_INDEX) { boolean value = !selectBox.isSelected(); selectBox.setSelected(value); selectAllOrNull(value); @@ -152,7 +152,7 @@ public class ITTableEditorPane extends BasicPane { label.setHorizontalAlignment(SwingConstants.LEFT); selectBox.setHorizontalAlignment(SwingConstants.CENTER); selectBox.setBorderPainted(true); - JComponent component = (column == 0) ? selectBox : label; + JComponent component = (column == ITReplaceSouthPanel.CHECKBOX_INDEX) ? selectBox : label; component.setForeground(tableHeader.getForeground()); component.setBackground(tableHeader.getBackground()); component.setFont(tableHeader.getFont()); @@ -187,7 +187,7 @@ public class ITTableEditorPane extends BasicPane { */ public static void selectAllOrNull(Boolean value) { for (int i = 0; i < getEditTable().getRowCount(); i++) { - ((ITContent) (getEditTable().getValueAt(i, 6))).setSelected(value); + ((ITContent) (getEditTable().getValueAt(i, ITReplaceSouthPanel.CONTENT_INDEX))).setSelected(value); } } 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 8f962667d3..fa28c6de8b 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 @@ -79,18 +79,18 @@ public class ShowValueUtils { /** * 转换正则表达式 * - * @param regex + * @param regexStr * @return */ - public static String changeRegex(String regex) { + public static String changeRegex(String regexStr) { String change = "\\"; for (int i = 0; i < specialCharList.size(); i++) { - regex = regex.replace(specialCharList.get(i), change + specialCharList.get(i)); + regexStr = regexStr.replace(specialCharList.get(i), change + specialCharList.get(i)); } - regex = regex.replace(NUMBER, NUMBER_REGEX); - regex = regex.replace(ENGLISH, ENGLISH_REGEX); - regex = regex.replace(ANY_THING, ANY_THING_REGEX); - return regex; + regexStr = regexStr.replace(NUMBER, NUMBER_REGEX); + regexStr = regexStr.replace(ENGLISH, ENGLISH_REGEX); + regexStr = regexStr.replace(ANY_THING, ANY_THING_REGEX); + return regexStr; } /** @@ -170,13 +170,13 @@ public class ShowValueUtils { * 支持正则表达式的indexOf * * @param str - * @param regex + * @param regexStr * @return */ - public static int indexOf(String str, String regex) { + public static int indexOf(String str, String regexStr) { CharSequence inputStr = str; int failReturn = -1; - String patternStr = changeRegex(regex); + String patternStr = changeRegex(regexStr); Pattern pattern = Pattern.compile(patternStr); Matcher matcher = pattern.matcher(inputStr); if (matcher.find()) { From a0c4924612e8c9afb9f03d25a14e5988cdf6c4ba Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 26 Sep 2022 17:46:01 +0800 Subject: [PATCH 06/12] =?UTF-8?q?REPORT-75998=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SearchCommit2DBJSFormulaAction.java | 16 ++++++++ .../SearchExportJSFormulaAction.java | 15 +++++++ .../widget/SearchDateEditorFormulaAction.java | 4 +- .../widget/SearchTreeEditorFormulaAction.java | 40 +++++++++++++------ 4 files changed, 60 insertions(+), 15 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java index 76ad5ee2bb..dec08034ab 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java @@ -1,5 +1,6 @@ package com.fr.design.actions.replace.action.content.formula.highlight.javascript; +import com.fr.base.Formula; import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionFormula; import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionManager; import com.fr.design.actions.replace.info.FormulaInfo; @@ -10,6 +11,7 @@ import com.fr.js.Commit2DBJavaScript; import com.fr.js.JavaScript; import com.fr.write.DBManipulation; import com.fr.write.DMLConfigJob; +import com.fr.write.config.ColumnConfig; import com.fr.write.config.DMLConfig; import java.util.List; @@ -41,12 +43,26 @@ public class SearchCommit2DBJSFormulaAction implements SearchJSFormula { private void dealWithDBManipulation(List formulaInfos, ITContent content, DBManipulation dbManipulation) { DMLConfig dmlConfig = dbManipulation.getDmlConfig(); + //值中的公式 + dealWithColumnValue(formulaInfos, content, dmlConfig); //处理提交条件中的公式 dealWithCommit2DBCondition(formulaInfos, content, dmlConfig); //处理DBManipulation dealWithSubmitJob(formulaInfos, content, dmlConfig); } + private void dealWithColumnValue(List formulaInfos, ITContent content, DMLConfig dmlConfig) { + for (int i = 0; i < dmlConfig.getColumnConfigCount(); i++) { + ColumnConfig columnConfig = dmlConfig.getColumnConfig(i); + if (columnConfig.getColumnValue() instanceof Formula) { + ITContent configContent = ITContent.copy(content); + configContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Base_Value")); + configContent.setReplaceObject(columnConfig.getColumnValue()); + formulaInfos.add(new FormulaInfo(configContent)); + } + } + } + private void dealWithSubmitJob(List formulaInfos, ITContent content, DMLConfig dmlConfig) { for (int i = 0; i < dmlConfig.getSubmitJobCount(); i++) { //这边自定义事件不需要处理,只处理提交事件 diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchExportJSFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchExportJSFormulaAction.java index 716c2d908f..d19970c218 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchExportJSFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchExportJSFormulaAction.java @@ -1,11 +1,14 @@ package com.fr.design.actions.replace.action.content.formula.highlight.javascript; +import com.fr.base.Formula; +import com.fr.base.Parameter; 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.js.ExportJavaScript; import com.fr.js.JavaScript; import com.fr.js.SingleJavaScript; +import com.fr.stable.ParameterProvider; import java.util.List; @@ -26,8 +29,10 @@ public class SearchExportJSFormulaAction implements SearchJSFormula { public void searchJSFormulaFromOther(List formulaInfos, ITContent content, JavaScript javaScript) { //如果导出当前模板,可以存公式的地方就是命名方式-自定义 if (((ExportJavaScript) javaScript).isCurrentTemplate()) { + content.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")); dealSingleJavaScript(formulaInfos, content, ((ExportJavaScript) javaScript).getCurrentTemplateJavaScript()); } else { + content.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other")); List list = ((ExportJavaScript) javaScript).getJsListForOtherTemplates(); if (isListExist(list)) { for (SingleJavaScript singleJavaScript : list) { @@ -51,6 +56,16 @@ public class SearchExportJSFormulaAction implements SearchJSFormula { ); formulaInfos.add(new FormulaInfo(newContent)); } + if (!javaScript.isExtendParameters()) { + ITContent paraContent = ITContent.copy(content); + for (ParameterProvider parameter : javaScript.getParameters()) { + if (parameter.getValue() instanceof Formula) { + paraContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Base_Value")); + paraContent.setReplaceObject(parameter.getValue()); + formulaInfos.add(new FormulaInfo(paraContent)); + } + } + } } /** diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java index 67548b4157..28bd17c9b5 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java @@ -34,7 +34,7 @@ public class SearchDateEditorFormulaAction extends AbstractSearchWidgetFormulaAc if (dateEditor.getEndDateFM() != null && StringUtils.isNotEmpty(dateEditor.getEndDateFM().getContent())) { ITContent newContent = ITContent.copy(content); newContent.setReplaceObject(dateEditor.getEndDateFM()); - newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_End_Time")); + newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_FS_End_Date")); formulaInfos.add(new FormulaInfo(newContent)); } } @@ -44,7 +44,7 @@ public class SearchDateEditorFormulaAction extends AbstractSearchWidgetFormulaAc if (dateEditor.getStartDateFM() != null && StringUtils.isNotEmpty(dateEditor.getStartDateFM().getContent())) { ITContent newContent = ITContent.copy(content); newContent.setReplaceObject(dateEditor.getStartDateFM()); - newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Start_Time")); + newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_FS_Start_Date")); formulaInfos.add(new FormulaInfo(newContent)); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java index d1251c5b8c..3a36eb510c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java @@ -1,11 +1,15 @@ package com.fr.design.actions.replace.action.content.formula.widget; +import com.fr.data.Dictionary; +import com.fr.data.impl.FormulaDictionary; import com.fr.data.impl.FormulaDisplayDictionary; +import com.fr.data.impl.TableDataDictionary; import com.fr.data.impl.TreeNodeAttr; import com.fr.data.impl.TreeNodeWrapper; 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.form.ui.DictionaryContainer; import com.fr.form.ui.TreeEditor; import com.fr.form.ui.tree.LayerConfig; import com.fr.stable.StringUtils; @@ -37,28 +41,38 @@ public class SearchTreeEditorFormulaAction extends AbstractSearchWidgetFormulaAc if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() != null) { //LayerConfig[] 急速分层构建 //TreeNodeWrapper 普通分层构建 - if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() instanceof LayerConfig[]) { - LayerConfig[] layerConfigs = (LayerConfig[]) ((TreeEditor) content.getReplaceObject()).getBuildModelConfig(); + //TableDataDictionary 自动构建 + Object object = ((TreeEditor) content.getReplaceObject()).getBuildModelConfig(); + if (object instanceof LayerConfig[]) { + LayerConfig[] layerConfigs = (LayerConfig[]) object; dealWithLayerConfigs(layerConfigs, content, formulaInfos); - } else if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() instanceof TreeNodeWrapper) { - TreeNodeWrapper wrapper = (TreeNodeWrapper) ((TreeEditor) content.getReplaceObject()).getBuildModelConfig(); + } else if (object instanceof TreeNodeWrapper) { + TreeNodeWrapper wrapper = (TreeNodeWrapper) object; dealWithTreeNodeWrapper(wrapper, content, formulaInfos); + } else if (object instanceof TableDataDictionary) { + TableDataDictionary tableDataDictionary = (TableDataDictionary) object; + if (tableDataDictionary.getFormula() != null) { + ITContent autoContent = ITContent.copy(content); + autoContent.addOtherPos( + Toolkit.i18nText("Fine-Design_Basic_Auto_Build"), + Toolkit.i18nText("Fine-Design_Basic_Display_Value") + ); + autoContent.setReplaceObject(tableDataDictionary.getFormula()); + formulaInfos.add(new FormulaInfo(autoContent)); + } } + } } } private void dealWithTreeNodeWrapper(TreeNodeWrapper wrapper, ITContent content, List formulaInfos) { for (TreeNodeAttr attr : wrapper.getTreeNodeAttrs()) { - if (((FormulaDisplayDictionary) attr.getDictionary()).getFormula() != null - && StringUtils.isNotEmpty(((FormulaDisplayDictionary) attr.getDictionary()).getFormula().getContent())) { - ITContent newContent = ITContent.copy(content); - newContent.setReplaceObject(((FormulaDisplayDictionary) attr.getDictionary()).getFormula()); - newContent.addOtherPos( - Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"), - Toolkit.i18nText("Fine-Design_Basic_Layer_Build") - ); - formulaInfos.add(new FormulaInfo(newContent)); + if (attr.getDictionary() != null) { + DictionaryType type = DictionaryType.match(attr.getDictionary().getClass().getSimpleName()); + if (type != null) { + type.searchFormulaFromDictionary(content, formulaInfos, attr.getDictionary()); + } } } } From d64049244c7723940aa9e24d40bfa778c20f029f Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 27 Sep 2022 10:06:10 +0800 Subject: [PATCH 07/12] =?UTF-8?q?REPORT-75998=20=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E5=BA=95=E5=B1=82=E5=85=B3=E9=97=AD=E9=9D=A2=E6=9D=BF=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/AllowAuthorityEditAction.java | 11 ++------ .../actions/help/replace/ITReplaceHelper.java | 19 ++++++++++++++ .../actions/help/replace/ITReplaceUtils.java | 26 +++++++++++++++++++ .../fr/design/preview/DeveloperPreview.java | 9 +++---- .../SearchCommit2DBJSFormulaAction.java | 4 +-- .../replace/ui/ITReplaceMainDialog.java | 11 ++++---- .../actions/replace/utils/ShowValueUtils.java | 10 +++++-- 7 files changed, 65 insertions(+), 25 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceHelper.java create mode 100644 designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index bb26e17118..c7287ad838 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1,17 +1,14 @@ package com.fr.design.actions; -import com.fr.base.svg.IconUtils; import com.fr.base.vcs.DesignerMode; +import com.fr.design.actions.help.replace.ITReplaceUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; -import com.fr.design.module.DesignModuleFactory; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; -import com.fr.invoke.Reflect; -import com.fr.log.FineLoggerFactory; /** * Author : daisy @@ -64,11 +61,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); - try { - Reflect.on(DesignModuleFactory.getReplacePane().newInstance()).call("close"); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + ITReplaceUtils.close(); //画虚线 return true; diff --git a/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceHelper.java b/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceHelper.java new file mode 100644 index 0000000000..755a69ef63 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceHelper.java @@ -0,0 +1,19 @@ +package com.fr.design.actions.help.replace; + + +/** + * 定义一些底层操作 + * + * @author Destiny.Lin + * @version 11.0 + * created by Destiny.Lin on 2022-09-27 + */ +public interface ITReplaceHelper { + + + /** + * 关闭面板 + */ + void close(); + +} diff --git a/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java b/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java new file mode 100644 index 0000000000..fe7ba9d8c3 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java @@ -0,0 +1,26 @@ +package com.fr.design.actions.help.replace; + +import com.fr.design.module.DesignModuleFactory; +import com.fr.log.FineLoggerFactory; + +/** + * 工具类 + * + * @author Destiny.Lin + * @version 11.0 + * created by Destiny.Lin on 2022-09-27 + */ +public class ITReplaceUtils { + + + /** + * 进入权限编辑&开发者调试时要关闭面板 + */ + public static void close(){ + try { + DesignModuleFactory.getReplacePane().newInstance().close(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java index 5c0a623857..e8be79b641 100644 --- a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java +++ b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java @@ -1,5 +1,7 @@ package com.fr.design.preview; +import com.fr.design.actions.help.replace.ITReplaceHelper; +import com.fr.design.actions.help.replace.ITReplaceUtils; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.fun.impl.AbstractPreviewProvider; @@ -10,7 +12,6 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.worker.WorkerManager; import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.general.web.ParameterConstants; -import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; import java.util.HashMap; @@ -50,11 +51,7 @@ public class DeveloperPreview extends AbstractPreviewProvider { @Override public void onClick(JTemplate jt) { super.onClick(jt); - try { - Reflect.on(DesignModuleFactory.getReplacePane().newInstance()).call("close"); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + ITReplaceUtils.close(); SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId()); if (worker instanceof CallbackSaveWorker) { CallbackSaveWorker callbackSaveWorker = (CallbackSaveWorker) worker; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java index dec08034ab..946dc0d31c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java @@ -52,7 +52,7 @@ public class SearchCommit2DBJSFormulaAction implements SearchJSFormula { } private void dealWithColumnValue(List formulaInfos, ITContent content, DMLConfig dmlConfig) { - for (int i = 0; i < dmlConfig.getColumnConfigCount(); i++) { + for (int i = 0, len = dmlConfig.getColumnConfigCount(); i < len; i++) { ColumnConfig columnConfig = dmlConfig.getColumnConfig(i); if (columnConfig.getColumnValue() instanceof Formula) { ITContent configContent = ITContent.copy(content); @@ -64,7 +64,7 @@ public class SearchCommit2DBJSFormulaAction implements SearchJSFormula { } private void dealWithSubmitJob(List formulaInfos, ITContent content, DMLConfig dmlConfig) { - for (int i = 0; i < dmlConfig.getSubmitJobCount(); i++) { + for (int i = 0, len = dmlConfig.getColumnConfigCount(); i < len; i++) { //这边自定义事件不需要处理,只处理提交事件 if (dmlConfig.getSubmitJob(i) instanceof DMLConfigJob) { ITContent newContent = ITContent.copy(content); 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 2a922902f7..f6c82d8890 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 @@ -1,16 +1,14 @@ package com.fr.design.actions.replace.ui; +import com.fr.design.actions.help.replace.ITReplaceHelper; import com.fr.design.actions.replace.action.ShowSearchResultAction; import com.fr.design.actions.replace.info.Info; -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; @@ -41,7 +39,7 @@ import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable; * @version 11.0 * created by Destiny.Lin on 2022-08-10 */ -public class ITReplaceMainDialog extends UIDialog { +public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { List searchResultList = new ArrayList<>(); private static boolean ITReplaceFlag = false; private static boolean matched = false; @@ -315,7 +313,7 @@ public class ITReplaceMainDialog extends UIDialog { * 面板是否存在 * @return */ - public static boolean isExisted() { + public boolean isExisted() { return existed; } @@ -327,7 +325,8 @@ public class ITReplaceMainDialog extends UIDialog { /** * 进入权限编辑状态&开发者调试时关闭面板 */ - public static void close(){ + @Override + public void close(){ if (isExisted()){ getInstance().dispose(); setExisted(false); 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 fa28c6de8b..7ea1bdbbd0 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 @@ -140,7 +140,7 @@ public class ShowValueUtils { int index = 0; StringBuilder builder = new StringBuilder(str); while (matcher.find()) { - builder.replace(matcher.start() + index, matcher.end() + index, head + matcher.group() + tail); + builder.replace(matcher.start() + index, matcher.end() + index, head + changeHtmlStr(matcher.group()) + tail); index += size; } return "
" + @@ -148,12 +148,18 @@ public class ShowValueUtils { "
"; } else { return "
" + - replaceAll(str, searchStr, "" + searchStr + "") + + replaceAll(str, searchStr, "" + changeHtmlStr(searchStr) + "") + "
"; } } + private static String changeHtmlStr(String searchStr){ + String showStr = searchStr; + showStr = showStr.replace("<","<"); + showStr = showStr.replace(">", ">"); + return showStr; + } /** * 集合是否不为空 From 2162f3568574a8f8cea9c430d2521ff931856074 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 27 Sep 2022 10:08:08 +0800 Subject: [PATCH 08/12] =?UTF-8?q?REPORT-75998=20=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E5=BA=95=E5=B1=82=E5=85=B3=E9=97=AD=E9=9D=A2=E6=9D=BF=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/module/DesignModuleFactory.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java index 60a4dfcf18..2c75509f52 100644 --- a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java +++ b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java @@ -1,6 +1,7 @@ package com.fr.design.module; import com.fr.base.chart.BaseChartCollection; +import com.fr.design.actions.help.replace.ITReplaceHelper; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartDialog; @@ -136,11 +137,11 @@ public class DesignModuleFactory { * 注册一下查找替换面板 * @param r */ - public static void registerReplacePane(Class r){ + public static void registerReplacePane(Class r) { instance.replacePane = r; } - public static Class getReplacePane(){ + public static Class getReplacePane() { return instance.replacePane; } From a35cfde57c6883266c66b7b3f0cfd12c249d8853 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 27 Sep 2022 11:16:14 +0800 Subject: [PATCH 09/12] =?UTF-8?q?REPORT-75998=20=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E5=BA=95=E5=B1=82=E5=85=B3=E9=97=AD=E9=9D=A2=E6=9D=BF=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E3=80=81=E4=BF=AE=E6=94=B9=E6=AD=A3=E5=88=99=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/AllowAuthorityEditAction.java | 4 +- .../actions/help/replace/ITReplaceUtils.java | 26 ------------ .../fr/design/module/DesignModuleFactory.java | 12 +++--- .../fr/design/preview/DeveloperPreview.java | 5 +-- .../replace/ui/ITReplaceMainDialog.java | 20 ++++----- .../replace/utils/ReplaceOperator.java | 41 +++++++++++++++++++ .../actions/replace/utils/ShowValueUtils.java | 7 ++-- .../fr/start/module/DesignerActivator.java | 5 ++- 8 files changed, 63 insertions(+), 57 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index c7287ad838..2b1ad225ac 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1,9 +1,9 @@ package com.fr.design.actions; import com.fr.base.vcs.DesignerMode; -import com.fr.design.actions.help.replace.ITReplaceUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; +import com.fr.design.module.DesignModuleFactory; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; @@ -61,7 +61,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); - ITReplaceUtils.close(); + DesignModuleFactory.getReplaceOperator().close(); //画虚线 return true; diff --git a/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java b/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java deleted file mode 100644 index fe7ba9d8c3..0000000000 --- a/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fr.design.actions.help.replace; - -import com.fr.design.module.DesignModuleFactory; -import com.fr.log.FineLoggerFactory; - -/** - * 工具类 - * - * @author Destiny.Lin - * @version 11.0 - * created by Destiny.Lin on 2022-09-27 - */ -public class ITReplaceUtils { - - - /** - * 进入权限编辑&开发者调试时要关闭面板 - */ - public static void close(){ - try { - DesignModuleFactory.getReplacePane().newInstance().close(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } -} diff --git a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java index 2c75509f52..166ea80b1f 100644 --- a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java +++ b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java @@ -51,7 +51,7 @@ public class DesignModuleFactory { private Class ITReplaceAction; private Class formParaDesigner; private Class paraPropertyPane; - private Class replacePane; + private static ITReplaceHelper replaceHelper; private Class formHierarchyPaneCls; private Class widgetPropertyPane; private Class buttonDetailPaneClass; @@ -135,14 +135,14 @@ public class DesignModuleFactory { /** * 注册一下查找替换面板 - * @param r + * @param */ - public static void registerReplacePane(Class r) { - instance.replacePane = r; + public static void registerReplace(ITReplaceHelper replace) { + replaceHelper = replace; } - public static Class getReplacePane() { - return instance.replacePane; + public static ITReplaceHelper getReplaceOperator() { + return replaceHelper; } public static void registerParaPropertyPaneClass(Class p) { diff --git a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java index e8be79b641..07d40053c1 100644 --- a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java +++ b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java @@ -1,7 +1,5 @@ package com.fr.design.preview; -import com.fr.design.actions.help.replace.ITReplaceHelper; -import com.fr.design.actions.help.replace.ITReplaceUtils; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.fun.impl.AbstractPreviewProvider; @@ -12,7 +10,6 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.worker.WorkerManager; import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.general.web.ParameterConstants; -import com.fr.log.FineLoggerFactory; import java.util.HashMap; import java.util.Map; @@ -51,7 +48,7 @@ public class DeveloperPreview extends AbstractPreviewProvider { @Override public void onClick(JTemplate jt) { super.onClick(jt); - ITReplaceUtils.close(); + DesignModuleFactory.getReplaceOperator().close(); SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId()); if (worker instanceof CallbackSaveWorker) { CallbackSaveWorker callbackSaveWorker = (CallbackSaveWorker) worker; 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 f6c82d8890..784821b8fd 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 @@ -6,6 +6,7 @@ import com.fr.design.actions.replace.action.ShowSearchResultAction; import com.fr.design.actions.replace.info.Info; +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; @@ -29,6 +30,7 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; +import java.util.regex.Pattern; import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable; @@ -39,7 +41,7 @@ import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable; * @version 11.0 * created by Destiny.Lin on 2022-08-10 */ -public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { +public class ITReplaceMainDialog extends UIDialog { List searchResultList = new ArrayList<>(); private static boolean ITReplaceFlag = false; private static boolean matched = false; @@ -81,7 +83,7 @@ public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { } } } - instance.fitScreen(); + setExisted(true); return instance; } @@ -285,6 +287,7 @@ public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { itTableEditor.clear(); String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText(); setSearchStr(searchStr); + ShowValueUtils.containPattern = Pattern.compile(ShowValueUtils.changeRegex(searchStr)); ShowSearchResultAction searchAction = ShowSearchResultAction.match(GeneralUtils.objectToString(northPane.getFindCombobox().getSelectedItem())); if (searchAction != null) { searchResultList = searchAction.addMatchResult(searchStr, searchAction.showSearchValue(jTemplate)); @@ -313,7 +316,7 @@ public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { * 面板是否存在 * @return */ - public boolean isExisted() { + public static boolean isExisted() { return existed; } @@ -322,16 +325,7 @@ public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { } - /** - * 进入权限编辑状态&开发者调试时关闭面板 - */ - @Override - public void close(){ - if (isExisted()){ - getInstance().dispose(); - setExisted(false); - } - } + /** * 检测结果是否合法 */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java new file mode 100644 index 0000000000..4ce50e4ef4 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java @@ -0,0 +1,41 @@ +package com.fr.design.actions.replace.utils; + +import com.fr.design.actions.help.replace.ITReplaceHelper; +import com.fr.design.actions.replace.ui.ITReplaceMainDialog; + +/** + * 操作面板 + * + * @author Destiny.Lin + * @version 11.0 + * created by Destiny.Lin on 2022-09-27 + */ +public class ReplaceOperator implements ITReplaceHelper { + + /** + * 进入权限编辑状态&开发者调试时关闭面板 + */ + @Override + public void close(){ + if (isExisted()){ + ITReplaceMainDialog.getInstance().dispose(); + setExisted(false); + } + } + + /** + * 面板是否存在 + * @return + */ + public boolean isExisted(){ + return ITReplaceMainDialog.isExisted(); + } + + /** + * 设置面板存在属性 + * @param existed + */ + public void setExisted(boolean existed){ + ITReplaceMainDialog.setExisted(existed); + } +} 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 7ea1bdbbd0..438c3d98c7 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 @@ -28,6 +28,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]"; + public static Pattern containPattern; private static List specialCharList = new ArrayList<>(); static { @@ -182,8 +183,7 @@ public class ShowValueUtils { public static int indexOf(String str, String regexStr) { CharSequence inputStr = str; int failReturn = -1; - String patternStr = changeRegex(regexStr); - Pattern pattern = Pattern.compile(patternStr); + Pattern pattern = containPattern; Matcher matcher = pattern.matcher(inputStr); if (matcher.find()) { return matcher.start(); @@ -199,8 +199,7 @@ public class ShowValueUtils { */ public static boolean contains(String originStr, String matchStr) { if (ITReplaceMainDialog.isMatched()) { - String str = changeRegex(matchStr); - Pattern pattern = Pattern.compile(str); + Pattern pattern = containPattern; Matcher matcher = pattern.matcher(originStr); return matcher.find(); } else { diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 1a04c79ac9..7e937911c3 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -32,7 +32,7 @@ import com.fr.design.actions.insert.flot.FormulaFloatAction; import com.fr.design.actions.insert.flot.ImageFloatAction; import com.fr.design.actions.insert.flot.TextBoxFloatAction; import com.fr.design.actions.replace.ITReplaceAction; -import com.fr.design.actions.replace.ui.ITReplaceMainDialog; +import com.fr.design.actions.replace.utils.ReplaceOperator; import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.env.DesignerWorkspaceLoader; @@ -467,12 +467,13 @@ public class DesignerActivator extends Activator implements Prepare { DesignModuleFactory.registerNewFormActionClass(NewFormAction.class); DesignModuleFactory.registerReplaceActionClass(ITReplaceAction.class); - DesignModuleFactory.registerReplacePane(ITReplaceMainDialog.class); DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class); DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class); DesignModuleFactory.registerFormHierarchyPaneClass(FormHierarchyTreePane.class); DesignModuleFactory.registerWidgetPropertyPaneClass(WidgetPropertyPane.class); DesignModuleFactory.registerButtonDetailPaneClass(FormSubmitButtonDetailPane.class); + + DesignModuleFactory.registerReplace(new ReplaceOperator()); DesignModuleFactory.registerParameterReader(new FormParameterReader()); StableFactory.registerMarkedClass(BaseJForm.XML_TAG, NewJForm.class); From 69ae4d6c1159eb4edc0ef43f1c8e3cf61b175550 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 27 Sep 2022 11:19:21 +0800 Subject: [PATCH 10/12] =?UTF-8?q?REPORT-75998=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/replace/utils/ShowValueUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 438c3d98c7..19ab2758f3 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 @@ -133,7 +133,7 @@ public class ShowValueUtils { public static String updateHighlight(String str, String searchStr) { if (ITReplaceMainDialog.isMatched()) { String result = str; - Pattern pattern = Pattern.compile(changeRegex(searchStr)); + Pattern pattern = containPattern; Matcher matcher = pattern.matcher(str); String head = ""; String tail = ""; From 77ee617fe3e38b1bd1152112dd06572dfca825b1 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 27 Sep 2022 11:27:34 +0800 Subject: [PATCH 11/12] =?UTF-8?q?REPORT-75998=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../highlight/javascript/SearchCommit2DBJSFormulaAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java index 946dc0d31c..99ed9774ce 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java @@ -64,7 +64,7 @@ public class SearchCommit2DBJSFormulaAction implements SearchJSFormula { } private void dealWithSubmitJob(List formulaInfos, ITContent content, DMLConfig dmlConfig) { - for (int i = 0, len = dmlConfig.getColumnConfigCount(); i < len; i++) { + for (int i = 0, len = dmlConfig.getSubmitJobCount(); i < len; i++) { //这边自定义事件不需要处理,只处理提交事件 if (dmlConfig.getSubmitJob(i) instanceof DMLConfigJob) { ITContent newContent = ITContent.copy(content); From c1c17b85932d5138940757dfc8c6648d93c64aee Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 27 Sep 2022 12:05:19 +0800 Subject: [PATCH 12/12] =?UTF-8?q?REPORT-75998=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E5=B1=9E=E6=80=A7-=E6=8E=92=E5=BA=8F=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/AllowAuthorityEditAction.java | 1 + .../fr/design/module/DesignModuleFactory.java | 4 +++ .../fr/design/preview/DeveloperPreview.java | 1 + .../actions/replace/ITReplaceAction.java | 1 + .../content/formula/FormulaReplaceObject.java | 30 +++++++++++++++++++ .../replace/ui/ITReplaceMainDialog.java | 14 --------- .../replace/utils/ReplaceOperator.java | 22 ++------------ 7 files changed, 40 insertions(+), 33 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index 2b1ad225ac..546a702979 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -61,6 +61,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); + //进入时要关闭查找替换面板 DesignModuleFactory.getReplaceOperator().close(); //画虚线 diff --git a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java index 166ea80b1f..272daa7f5c 100644 --- a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java +++ b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java @@ -141,6 +141,10 @@ public class DesignModuleFactory { replaceHelper = replace; } + /** + * 获取查找替换面板的操作类 + * @return + */ public static ITReplaceHelper getReplaceOperator() { return replaceHelper; } diff --git a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java index 07d40053c1..176c44fe01 100644 --- a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java +++ b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java @@ -48,6 +48,7 @@ public class DeveloperPreview extends AbstractPreviewProvider { @Override public void onClick(JTemplate jt) { super.onClick(jt); + //进入时要关闭查找替换面板 DesignModuleFactory.getReplaceOperator().close(); SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId()); if (worker instanceof CallbackSaveWorker) { diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java index 1a9f67bb8a..358dc19652 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java @@ -55,6 +55,7 @@ public class ITReplaceAction extends UpdateAction { */ public void actionPerformed(ActionEvent event) { ITReplaceMainDialog mainFrame = ITReplaceMainDialog.getInstance(); + mainFrame.fitScreen(); mainFrame.setVisible(true); } 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 e002832656..6260565551 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 @@ -22,6 +22,7 @@ import com.fr.main.impl.WorkBook; import com.fr.report.cell.cellattr.CellInsertPolicyAttr; import com.fr.report.cell.cellattr.core.RichChar; import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.report.core.sort.sortexpression.FormulaSortExpression; import com.fr.stable.FormulaProvider; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; @@ -495,6 +496,35 @@ public enum FormulaReplaceObject implements DealWithInfoValue { public boolean check(Info info) { return true; } + }, + /** + * 排序 + */ + FORMULA_SORT_EXPRESSION("FormulaSortExpression"){ + @Override + public Map getValue(Object... o) { + HashMap map = new HashMap<>(); + if (StringUtils.isNotEmpty(((FormulaSortExpression) o[0]).getFormula())) { + map.put("content", ((FormulaSortExpression) o[0]).getFormula()); + } + return map; + } + + @Override + public void setValue(Info info, String findStr, String replaceStr, List> operatorArray) { + Object replaceObject = info.getContent().getReplaceObject(); + info.updateOldStr((((FormulaSortExpression) replaceObject).getFormula()), findStr); + ((FormulaSortExpression) replaceObject).setFormula(ShowValueUtils.replaceAll((((FormulaSortExpression) replaceObject).getFormula()), findStr, replaceStr)); + } + + @Override + public boolean check(Info info) { + if (info.getContent().getReplaceObject() instanceof FormulaSortExpression){ + FormulaSortExpression sortExpression = (FormulaSortExpression) info.getContent().getReplaceObject(); + return StringUtils.equals(sortExpression.getFormula(), info.getContent().getOldShowStr()); + } + return false; + } } ; 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 784821b8fd..f6fd8b6dc4 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 @@ -52,7 +52,6 @@ public class ITReplaceMainDialog extends UIDialog { private ITReplaceWestPanel westPanel; private boolean searchFlag; private String searchStr; - private static boolean existed = false; public ITReplaceMainDialog() { super(DesignerContext.getDesignerFrame()); @@ -67,7 +66,6 @@ public class ITReplaceMainDialog extends UIDialog { initFrame(); fitScreen(); ITReplaceFlag = true; - existed = true; } /** @@ -83,7 +81,6 @@ public class ITReplaceMainDialog extends UIDialog { } } } - setExisted(true); return instance; } @@ -312,17 +309,6 @@ public class ITReplaceMainDialog extends UIDialog { } } - /** - * 面板是否存在 - * @return - */ - public static boolean isExisted() { - return existed; - } - - public static void setExisted(boolean existed) { - ITReplaceMainDialog.existed = existed; - } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java index 4ce50e4ef4..e405c6be5f 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java @@ -13,29 +13,13 @@ import com.fr.design.actions.replace.ui.ITReplaceMainDialog; public class ReplaceOperator implements ITReplaceHelper { /** - * 进入权限编辑状态&开发者调试时关闭面板 + * 关闭面板 + * (当前关闭时机:进入权限编辑状态&开发者调试) */ @Override public void close(){ - if (isExisted()){ - ITReplaceMainDialog.getInstance().dispose(); - setExisted(false); - } + ITReplaceMainDialog.getInstance().dispose(); } - /** - * 面板是否存在 - * @return - */ - public boolean isExisted(){ - return ITReplaceMainDialog.isExisted(); - } - /** - * 设置面板存在属性 - * @param existed - */ - public void setExisted(boolean existed){ - ITReplaceMainDialog.setExisted(existed); - } }