Browse Source

Pull request #10187: REPORT-75998 修复迭代bug

Merge in DESIGN/design from ~DESTINY.LIN/design:feature/x to feature/x

* commit 'c1c17b85932d5138940757dfc8c6648d93c64aee':
  REPORT-75998 完善注释,增加单元格属性-排序中的公式
  REPORT-75998 修正提交入库
  REPORT-75998 修改正则表达式
  REPORT-75998 改变底层关闭面板方式、修改正则表达式
  REPORT-75998 改变底层关闭面板方式
  REPORT-75998 改变底层关闭面板方式
  REPORT-75998 完善控件公式
  REPORT-75998 优化魔术数
  REPORT-75998 增加注释、调整格式
  REPORT-75998 增加组合图JS、公式处理
  REPORT-75998 删除富文本逻辑、完善通配符、增加悬浮元素图片判断
  REPORT-75998 进入开发者调试&权限编辑模式逻辑处理、完善通配符、优化界面、修复勾选功能
feature/x
Destiny.Lin-林锦龙 2 years ago
parent
commit
bd3f3cb427
  1. 4
      designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java
  2. 19
      designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceHelper.java
  3. 18
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  4. 3
      designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java
  5. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java
  6. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java
  7. 31
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java
  8. 5
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java
  9. 64
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java
  10. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java
  11. 33
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  12. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchFormulaConditionAction.java
  13. 18
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java
  14. 15
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchExportJSFormulaAction.java
  15. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java
  16. 40
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java
  17. 29
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java
  18. 28
      designer-realize/src/main/java/com/fr/design/actions/replace/info/CellInfo.java
  19. 22
      designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java
  20. 11
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  21. 5
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  22. 11
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java
  23. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java
  24. 6
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java
  25. 10
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java
  26. 25
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java
  27. 113
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java
  28. 3
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

4
designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java

@ -1,9 +1,9 @@
package com.fr.design.actions;
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;
@ -61,6 +61,8 @@ public class AllowAuthorityEditAction extends TemplateComponentAction {
DesignerContext.getDesignerFrame().refreshDottedLine();
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane();
//进入时要关闭查找替换面板
DesignModuleFactory.getReplaceOperator().close();
//画虚线
return true;

19
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();
}

18
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;
@ -50,6 +51,7 @@ public class DesignModuleFactory {
private Class ITReplaceAction;
private Class formParaDesigner;
private Class paraPropertyPane;
private static ITReplaceHelper replaceHelper;
private Class<? extends HierarchyTreePane> formHierarchyPaneCls;
private Class<? extends BaseWidgetPropertyPane> widgetPropertyPane;
private Class buttonDetailPaneClass;
@ -131,6 +133,22 @@ public class DesignModuleFactory {
return instance.ITReplaceAction;
}
/**
* 注册一下查找替换面板
* @param
*/
public static void registerReplace(ITReplaceHelper replace) {
replaceHelper = replace;
}
/**
* 获取查找替换面板的操作类
* @return
*/
public static ITReplaceHelper getReplaceOperator() {
return replaceHelper;
}
public static void registerParaPropertyPaneClass(Class p) {
instance.paraPropertyPane = p;
}

3
designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java

@ -6,6 +6,7 @@ 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;
@ -47,6 +48,8 @@ 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) {
CallbackSaveWorker callbackSaveWorker = (CallbackSaveWorker) worker;

1
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);
}

2
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

31
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<String, String> stringHashMap = info.getValue();
String content = stringHashMap.getOrDefault(objectContentKey, StringUtils.EMPTY);
if (content.contains(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<String, String> map, List<JSInfo> 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<String, String> map, List<SQLInfo> 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<String, String> stringHashMap, ArrayList<ComponentInfo> 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<String, String> map, List<WidgetInfo> 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<String, String> stringHashMap, List<FormulaInfo> 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 && GeneralUtils.objectToString(title.getTextObject()).contains(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()));
}
}

5
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);
}
}
}

64
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;
@ -133,40 +134,6 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
return false;
}
},
/**
* 富文本
*/
RICH_CHAR("RichChar") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> 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<Pair<Integer, Integer>> 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
*/
@ -529,6 +496,35 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public boolean check(Info info) {
return true;
}
},
/**
* 排序
*/
FORMULA_SORT_EXPRESSION("FormulaSortExpression"){
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> 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<Pair<Integer, Integer>> 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;
}
}
;

2
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());

33
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<FormulaInfo> 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<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
searchPresent4Formula(provider.getCategoryPresent(), content, formulaInfos);

1
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<FormulaInfo> formulaInfos, ITContent content, Condition condition) {
if (((FormulaCondition) (condition)).getFormula() != null) {

18
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,14 +43,28 @@ public class SearchCommit2DBJSFormulaAction implements SearchJSFormula {
private void dealWithDBManipulation(List<FormulaInfo> 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<FormulaInfo> formulaInfos, ITContent content, DMLConfig dmlConfig) {
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);
configContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Base_Value"));
configContent.setReplaceObject(columnConfig.getColumnValue());
formulaInfos.add(new FormulaInfo(configContent));
}
}
}
private void dealWithSubmitJob(List<FormulaInfo> formulaInfos, ITContent content, DMLConfig dmlConfig) {
for (int i = 0; i < dmlConfig.getSubmitJobCount(); i++) {
for (int i = 0, len = dmlConfig.getSubmitJobCount(); i < len; i++) {
//这边自定义事件不需要处理,只处理提交事件
if (dmlConfig.getSubmitJob(i) instanceof DMLConfigJob) {
ITContent newContent = ITContent.copy(content);

15
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<FormulaInfo> 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<SingleJavaScript> 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));
}
}
}
}
/**

4
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));
}
}

40
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<FormulaInfo> 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());
}
}
}
}

29
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<JSInfo> 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));
}
}
}
}
}
}

28
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<RichChar> 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<String, String> map) {
map.put("content", ((RichText) o).getContent());
}
@Override
public String getCheckValue(Info info) {
CellElement o = (CellElement) info.getContent().getReplaceObject();
return ((RichText) o.getValue()).getContent();
}
},
/**
* 公式类型
*/

22
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<Pair<Integer, Integer>> 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<Pair<Integer, Integer>> 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));
}
}

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

@ -1,16 +1,15 @@
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;
@ -31,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;
@ -53,7 +53,7 @@ public class ITReplaceMainDialog extends UIDialog {
private boolean searchFlag;
private String searchStr;
private ITReplaceMainDialog() {
public ITReplaceMainDialog() {
super(DesignerContext.getDesignerFrame());
init();
}
@ -81,7 +81,6 @@ public class ITReplaceMainDialog extends UIDialog {
}
}
}
instance.fitScreen();
return instance;
}
@ -285,6 +284,7 @@ public class ITReplaceMainDialog extends UIDialog {
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));
@ -309,6 +309,9 @@ public class ITReplaceMainDialog extends UIDialog {
}
}
/**
* 检测结果是否合法
*/

5
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);
}

11
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java

@ -14,11 +14,20 @@ 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();
tableEditorPane = new ITTableEditorPane<>(itTableEditor);
RowSorter<ITTableEditor> sorter = new TableRowSorter<ITTableEditor>(itTableEditor);
RowSorter<ITTableEditor> sorter = new TableRowSorter<ITTableEditor>(itTableEditor){
@Override
public boolean isSortable(int column) {
return column != CHECKBOX_INDEX || column != CONTENT_INDEX;
}
};
tableEditorPane.getEditTable().setRowSorter(sorter);
tableEditorPane.getEditTable().setSelectionBackground(new Color(217, 235, 254));
tableEditorPane.getEditTable().setRowHeight(tableEditorPane.getEditTable().getRowHeight() / 2 + tableEditorPane.getEditTable().getRowHeight());

1
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);
}

6
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;
}
/**

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

@ -70,8 +70,8 @@ public class ITTableEditorPane<T> 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, 7);
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<T> 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<T> 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<T> 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, ITReplaceSouthPanel.CONTENT_INDEX))).setSelected(value);
}
}

25
designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java

@ -0,0 +1,25 @@
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(){
ITReplaceMainDialog.getInstance().dispose();
}
}

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

@ -1,9 +1,7 @@
package com.fr.design.actions.replace.utils;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.ui.ITReplaceMainDialog;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
@ -30,6 +28,23 @@ 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<String> specialCharList = new ArrayList<>();
static {
//正则特殊字符:? * () [] {} ^ $ .
//如果是? 并采用通配符 ,会自动转成“.” 所以 ? 不用处理
//$同理
specialCharList.add("*");
specialCharList.add("(");
specialCharList.add(")");
specialCharList.add("[");
specialCharList.add("]");
specialCharList.add("{");
specialCharList.add("}");
specialCharList.add("^");
specialCharList.add(".");
}
/**
* 获取除内容外其他一次性展示所有的内容名称水印...
@ -42,9 +57,7 @@ public class ShowValueUtils {
if (StringUtils.isEmpty(searchStr)) {
return str;
} else {
return "<html><body><div><nobr>" +
replaceAll(str, searchStr, "<font color = 'rgb(61,153,249)'>" + searchStr + "</font>") +
"</nobr></div></body></html>";
return updateHighlight(str, searchStr);
}
}
@ -57,20 +70,28 @@ 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);
}
}
/**
* 转换正则表达式
*
* @param regex
* @param regexStr
* @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);
return regex;
public static String changeRegex(String regexStr) {
String change = "\\";
for (int i = 0; i < specialCharList.size(); i++) {
regexStr = regexStr.replace(specialCharList.get(i), change + specialCharList.get(i));
}
regexStr = regexStr.replace(NUMBER, NUMBER_REGEX);
regexStr = regexStr.replace(ENGLISH, ENGLISH_REGEX);
regexStr = regexStr.replace(ANY_THING, ANY_THING_REGEX);
return regexStr;
}
/**
@ -101,21 +122,45 @@ 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(), "<font color = 'rgb(61,153,249)'>" + replaceStr + "</font>");
info.getContent().setShowStr(
"<html><body><div><nobr>" + s + "</nobr></div></body></html>"
);
public static String updateHighlight(String str, String searchStr) {
if (ITReplaceMainDialog.isMatched()) {
String result = str;
Pattern pattern = containPattern;
Matcher matcher = pattern.matcher(str);
String head = "<font color = 'rgb(61,153,249)'>";
String tail = "</font>";
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 + changeHtmlStr(matcher.group()) + tail);
index += size;
}
return "<html><body><div><nobr>" +
builder.toString() +
"</nobr></div></body></html>";
} else {
return "<html><body><div><nobr>" +
replaceAll(str, searchStr, "<font color = 'rgb(61,153,249)'>" + changeHtmlStr(searchStr) + "</font>") +
"</nobr></div></body></html>";
}
}
private static String changeHtmlStr(String searchStr){
String showStr = searchStr;
showStr = showStr.replace("<","&lt;");
showStr = showStr.replace(">", "&gt");
return showStr;
}
/**
* 集合是否不为空
@ -132,18 +177,34 @@ 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);
Pattern pattern = Pattern.compile(patternStr);
Pattern pattern = containPattern;
Matcher matcher = pattern.matcher(inputStr);
if (matcher.find()) {
return matcher.start();
}
return failReturn;
}
/**
* 支持通配符的contains
* @param originStr
* @param matchStr
* @return
*/
public static boolean contains(String originStr, String matchStr) {
if (ITReplaceMainDialog.isMatched()) {
Pattern pattern = containPattern;
Matcher matcher = pattern.matcher(originStr);
return matcher.find();
} else {
return originStr.contains(matchStr);
}
}
}

3
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.utils.ReplaceOperator;
import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.env.DesignerWorkspaceLoader;
@ -471,6 +472,8 @@ public class DesignerActivator extends Activator implements Prepare {
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);

Loading…
Cancel
Save