Browse Source

REPORT-75998 添加注册注销的管理类与管理中心

feature/x
Destiny.Lin 2 years ago
parent
commit
bc8ad762b1
  1. 30
      designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManager.java
  2. 214
      designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java
  3. 13
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java
  4. 12
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java
  5. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/SearchComponentAction.java
  6. 18
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java
  7. 17
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/SearchFormulaManager.java
  8. 37
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java
  9. 110
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java
  10. 35
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaTypeAction.java
  11. 92
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchDSColumnFormulaAction.java
  12. 64
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchRichFormulaAction.java
  13. 35
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchSubReportFormulaAction.java
  14. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  15. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/DataType.java
  16. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java
  17. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/floatelement/SearchFloatFormulaAction.java
  18. 50
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/SearchHighlightFormulaAction.java
  19. 105
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/SearchHighlightFormulaManager.java
  20. 41
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchCommonConditionAction.java
  21. 103
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchConditionManager.java
  22. 39
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchFormulaConditionAction.java
  23. 44
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchListConditionAction.java
  24. 38
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchObjectConditionAction.java
  25. 67
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java
  26. 37
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchExportJSFormulaAction.java
  27. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormula.java
  28. 116
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormulaManager.java
  29. 69
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSHighlightAction.java
  30. 37
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchMobileHyperlinkFormulaAction.java
  31. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/AbstractSearchWidgetFormulaAction.java
  32. 47
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/DictionaryType.java
  33. 38
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchCommonWidgetFormulaAction.java
  34. 37
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java
  35. 37
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDictFormulaAction.java
  36. 38
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java
  37. 47
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaAction.java
  38. 146
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaManager.java
  39. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchCellJSAction.java
  40. 6
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java
  41. 16
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchFloatJSAction.java
  42. 36
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchJSManager.java
  43. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchWebJSAction.java
  44. 5
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchWidgetJSAction.java
  45. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/sql/SearchSQLAction.java
  46. 10
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/SearchWidgetAction.java
  47. 3
      designer-realize/src/main/java/com/fr/design/actions/replace/info/FormulaInfo.java
  48. 16
      designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java
  49. 114
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  50. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

30
designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManager.java

@ -0,0 +1,30 @@
package com.fr.design.actions.replace.action;
/**
* 管理搜索元素的注册与注销
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public interface SearchManager {
/**
* 注册搜索行为
* @param tag
* @param searchAction
*/
void registerAction(String tag , SearchAction searchAction);
/**
* 根据tag注销搜索行为
* @param tag
*/
default void removeAction(String tag){};
/**
* 根据行为注销指定的搜索行为
* @param searchAction
*/
default void removeAction(SearchAction searchAction){};
}

214
designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java

@ -0,0 +1,214 @@
package com.fr.design.actions.replace.action;
import com.fr.design.actions.replace.action.content.formula.cell.SearchCellFormulaManager;
import com.fr.design.actions.replace.action.content.formula.highlight.SearchHighlightFormulaManager;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionManager;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSFormulaManager;
import com.fr.design.actions.replace.action.content.formula.widget.SearchWidgetFormulaManager;
import com.fr.design.actions.replace.action.content.js.SearchCellJSAction;
import com.fr.design.actions.replace.action.content.js.SearchJS;
import com.fr.design.actions.replace.action.content.js.SearchJSManager;
import com.fr.design.actions.replace.action.content.js.SearchWebJSAction;
import com.fr.design.actions.replace.action.content.js.SearchWidgetJSAction;
import com.fr.third.v2.org.apache.poi.ss.formula.functions.T;
import org.jetbrains.annotations.Nullable;
/**
* 管理各个管理类的注入的管理中心
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public class SearchManagerCenter {
public static final int CELL_FORMULA = 0;
public static final int CONDITION_FORMULA = 1;
public static final int JS_FORMULA = 2;
public static final int HIGHLIGHT_FORMULA = 3;
public static final int WIDGET_FORMULA = 4;
public static final int JS = 5;
private SearchManagerCenter() {
}
/**
* 注册
*
* @param index 指定类型编号
* @param tag 类名称
* @param searchAction 对应搜索行为
*/
public void register(int index, String tag, SearchAction searchAction) {
ManagerType managerType = ManagerType.match(index);
if (managerType != null) {
managerType.registerAction(tag, searchAction);
}
}
/**
* 注销
*
* @param index 指定类型编号
* @param tag 类名称
*/
public void remove(int index, String tag) {
ManagerType managerType = ManagerType.match(index);
if (managerType != null) {
managerType.removeAction(tag);
}
}
/**
* 管理类的类型
*/
public enum ManagerType implements SearchManager {
/**
* 注册单元格不同值类型中自己特有的公式数据列子报表公式富文本可自己添加
*/
CELL_FORMULA(0) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchCellFormulaManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(String tag) {
SearchCellFormulaManager.getInstance().removeAction(tag);
}
},
/**
* 注册条件属性中的公式公式类型的条件属性包装了一个比较器作为条件的条件对象组合条件用多个AND或者OR连接起来的条件组成的对象简单比较的条件可自己添加
*/
CONDITION_FORMULA(1) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchConditionManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(String tag) {
SearchConditionManager.getInstance().removeAction(tag);
}
},
/**
* 注冊超链类型中的自己特有的公式提交入库导出事件移动端弹窗可自己添加
* 其他类型的超链都只有参数部分会存在公式属于公有统一处理
*/
JS_FORMULA(2) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchJSFormulaManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(String tag) {
SearchJSFormulaManager.getInstance().removeAction(tag);
}
},
/**
* 注册条件属性中自己特有的公式超级链接控件... 可自己添加
*/
HIGHLIGHT_FORMULA(3) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchHighlightFormulaManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(String tag) {
SearchHighlightFormulaManager.getInstance().removeAction(tag);
}
},
/**
* 注册不同控件中的公式非树形数据字典树形数据字典无数据字典可自己添加
*/
WIDGET_FORMULA(4) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchWidgetFormulaManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(String tag) {
SearchWidgetFormulaManager.getInstance().removeAction(tag);
}
},
/**
* 注册获取JS的场景当前控件单元格模板Web属性悬浮元素可自行添加
*/
JS(5) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchJSManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(SearchAction searchAction) {
SearchJSManager.getInstance().removeAction(searchAction);
}
};
int index;
ManagerType(int index) {
this.index = index;
}
/**
* 匹配
*
* @param index
* @return
*/
@Nullable
public static ManagerType match(int index) {
ManagerType[] values = ManagerType.values();
for (ManagerType value : values) {
if (value.index == index) {
return value;
}
}
return null;
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchManagerCenter getInstance() {
return SearchManagerCenterEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchManagerCenterEnum {
/**
* 单例
*/
SINGLETON;
private SearchManagerCenter instance;
SearchManagerCenterEnum() {
instance = new SearchManagerCenter();
}
/**
* 获取单例对象
*
* @return
*/
public SearchManagerCenter getInstance() {
return instance;
}
}
}

13
designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java

@ -9,15 +9,22 @@ import com.fr.design.actions.replace.action.content.formula.SearchFormulaManager
import com.fr.design.actions.replace.action.content.js.SearchJSManager;
import com.fr.design.actions.replace.action.content.sql.SearchSQLAction;
import com.fr.design.actions.replace.action.content.widget.SearchWidgetAction;
import com.fr.design.actions.replace.info.*;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.actions.replace.info.ComponentInfo;
import com.fr.design.actions.replace.info.FloatInfo;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.SQLInfo;
import com.fr.design.actions.replace.info.WidgetInfo;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.i18n.Toolkit;
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.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import org.gradle.internal.impldep.org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
@ -197,7 +204,7 @@ public enum ShowSearchResultAction implements ShowValue {
}
}
private void updateOperaotrArray(int index, int preLength, int strLength, SQLInfo sqlInfo) {
private void updateOperatorArray(int index, int preLength, int strLength, SQLInfo sqlInfo) {
ArrayList<Pair<Integer, Integer>> pairs = new ArrayList<>();
pairs.add(new Pair<>(index + preLength, index + preLength + strLength));
sqlInfo.getContent().setOperatorArray(pairs);

12
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java

@ -42,8 +42,6 @@ public class SearchCellAction implements SearchAction {
private SearchCellAction() {
}
;
public List<CellInfo> getCellInfos() {
return cellInfos;
}
@ -60,13 +58,13 @@ public class SearchCellAction implements SearchAction {
*/
@Override
public void search4Infos(JTemplate jTemplate) {
ITContent content = new ITContent();
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
content.addTRL(jTemplate.getTemplateName());
if (jTemplate.getTarget() instanceof Form) {
setCellInfos(dealForm(jTemplate));
} else if (jTemplate.getTarget() instanceof WorkBook) {
setCellInfos(dealWorkBook((WorkBook) jTemplate.getTarget(),content));
setCellInfos(dealWorkBook((WorkBook) jTemplate.getTarget(), content));
} else {
setCellInfos(new ArrayList<>());
}
@ -118,10 +116,10 @@ public class SearchCellAction implements SearchAction {
/**
* 处理普通报表
*
* @param workBook 要搜索的报表对象
* @param workBook 要搜索的报表对象
* @return 对应信息Array
*/
public List<CellInfo> dealWorkBook(WorkBook workBook,ITContent workBookContent) {
public List<CellInfo> dealWorkBook(WorkBook workBook, ITContent workBookContent) {
ArrayList<CellInfo> result = new ArrayList<>();
for (int i = 0; i < workBook.getReportCount(); i++) {
Report report = workBook.getReport(i);
@ -198,7 +196,7 @@ public class SearchCellAction implements SearchAction {
/**
* 枚举实现单例
*/
enum SearchCellActionEnum {
private enum SearchCellActionEnum {
/**
* 单例
*/

7
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/SearchComponentAction.java

@ -23,6 +23,9 @@ import java.util.List;
*/
public class SearchComponentAction implements SearchAction {
private SearchComponentAction() {
}
private List<ComponentInfo> componentInfos;
@ -83,6 +86,7 @@ public class SearchComponentAction implements SearchAction {
private void dealBodyContainer(List<ComponentInfo> componentInfos, ITContent bodyContent, WLayout body) {
ITContent content = ITContent.copy(bodyContent);
content.setReplaceObject(body);
content.setJumpAble(false);
dealContent(content, body.getWidgetName());
//WParameterLayout
componentInfos.add(new ComponentInfo(content));
@ -92,6 +96,7 @@ public class SearchComponentAction implements SearchAction {
if (paraContainer != null) {
ITContent paraContent = ITContent.copy(content);
paraContent.addOtherPos(paraContainer.getWidgetName());
paraContent.setJumpAble(false);
//单独处理一下para组件
dealParaContainer(componentInfos, paraContent, paraContainer);
//处理para的子组件
@ -145,7 +150,7 @@ public class SearchComponentAction implements SearchAction {
/**
* 枚举实现单例
*/
enum SearchComponentActionEnum {
private enum SearchComponentActionEnum {
/**
* 单例
*/

18
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java

@ -14,9 +14,8 @@ import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.js.SingleJavaScript;
import com.fr.main.impl.WorkBook;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.CellInsertPolicyAttr;
import com.fr.report.cell.cellattr.core.RichText;
import com.fr.report.cell.cellattr.core.RichChar;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.stable.FormulaProvider;
import com.fr.stable.ParameterProvider;
@ -107,19 +106,26 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
/**
* 富文本
*/
RICH_TEXT("RichText") {
RICH_CHAR("RichChar") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((RichText) ((CellElement) o[0]).getValue()).getContent())) {
map.put("content", ((RichText) ((CellElement) o[0]).getValue()).getContent());
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) {
//todo 富文本公式处理
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));
}
}
},

17
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/SearchFormulaManager.java

@ -1,6 +1,7 @@
package com.fr.design.actions.replace.action.content.formula;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import com.fr.design.actions.replace.action.content.formula.cell.SearchCellFormulaAction;
import com.fr.design.actions.replace.action.content.formula.data.SearchDataFormulaAction;
import com.fr.design.actions.replace.action.content.formula.floatelement.SearchFloatFormulaAction;
@ -26,11 +27,11 @@ public class SearchFormulaManager implements SearchAction {
private Set<SearchFormula> formulaProviderSet = new HashSet<>();
private SearchFormulaManager() {
registerFormula(SearchCellFormulaAction.getInstance());
registerFormula(SearchWidgetFormulaAction.getInstance());
registerFormula(SearchDataFormulaAction.getInstance());
registerFormula(SearchTemplateFormulaAction.getInstance());
registerFormula(SearchFloatFormulaAction.getInstance());
register(SearchCellFormulaAction.getInstance());
register(SearchWidgetFormulaAction.getInstance());
register(SearchDataFormulaAction.getInstance());
register(SearchTemplateFormulaAction.getInstance());
register(SearchFloatFormulaAction.getInstance());
}
@Override
@ -47,7 +48,7 @@ public class SearchFormulaManager implements SearchAction {
*
* @param searchFormula
*/
public void registerFormula(SearchFormula searchFormula) {
public void register(SearchFormula searchFormula) {
formulaProviderSet.add(searchFormula);
}
@ -56,7 +57,7 @@ public class SearchFormulaManager implements SearchAction {
*
* @param searchFormula
*/
public void removeFormula(SearchFormula searchFormula) {
public void remove(SearchFormula searchFormula) {
formulaProviderSet.remove(searchFormula);
}
@ -83,7 +84,7 @@ public class SearchFormulaManager implements SearchAction {
/**
* 枚举实现单例
*/
enum SearchFormulaManagerEnum {
private enum SearchFormulaManagerEnum {
/**
* 单例
*/

37
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java

@ -4,7 +4,6 @@ import com.fr.base.Formula;
import com.fr.base.present.DictPresent;
import com.fr.base.present.FormulaPresent;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.data.impl.DatabaseDictionary;
import com.fr.design.actions.replace.action.content.cell.SearchCellAction;
import com.fr.design.actions.replace.action.content.formula.chart.SearchChartCollectionFormulaAction;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.*;
@ -17,7 +16,6 @@ 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.design.mainframe.JTemplate;
import com.fr.form.ui.DictionaryContainer;
import com.fr.general.data.Condition;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.CellElement;
@ -28,7 +26,6 @@ import com.fr.report.cell.cellattr.highlight.HighlightGroup;
import com.fr.report.core.sort.common.CellSortAttr;
import com.fr.report.core.sort.sortexpression.FormulaSortExpression;
import com.fr.report.core.sort.sortexpression.SortExpression;
import sun.security.krb5.SCDynamicStoreConfig;
import java.util.HashMap;
import java.util.List;
@ -44,23 +41,6 @@ import java.util.Map;
public class SearchCellFormulaAction implements SearchCellFormula {
public static HashMap<String, SearchCellFormula> cellType = new HashMap<>();
static {
cellType.put("DSColumn", new SearchDSColumnFormulaAction());
cellType.put("Formula", new SearchCellFormulaTypeAction());
cellType.put("RichText", new SearchRichFormulaAction());
cellType.put("SubReport", new SearchSubReportFormulaAction());
}
public static HashMap<String, SearchConditionFormula> conditionHashMap = new HashMap<>();
static {
conditionHashMap.put("FormulaCondition", new SearchFormulaConditionAction());
conditionHashMap.put("ObjectCondition", new SearchObjectConditionAction());
conditionHashMap.put("ListCondition", new SearchListConditionAction());
}
private SearchCellFormulaAction() {
}
@ -108,7 +88,7 @@ public class SearchCellFormulaAction implements SearchCellFormula {
NameJavaScriptGroup nameJavaScriptGroup = ((CellElement) cellInfo.getContent().getReplaceObject()).getNameHyperlinkGroup();
if (nameJavaScriptGroup != null) {
for (int i = 0; i < nameJavaScriptGroup.size(); i++) {
SearchJSHighlightAction action = new SearchJSHighlightAction();
SearchJSHighlightAction action = SearchJSHighlightAction.getInstance();
ITContent content = ITContent.copy(cellInfo.getContent());
content.addOtherPos(nameJavaScriptGroup.getNameHyperlink(i).getName());
action.searchJSFormulaFromOther(formulaInfos, content, nameJavaScriptGroup.getNameHyperlink(i).getJavaScript());
@ -124,7 +104,7 @@ public class SearchCellFormulaAction implements SearchCellFormula {
for (int j = 0; j < ((DefaultHighlight) highlightGroup.getHighlight(i)).actionCount(); j++) {
HighlightAction highlightAction = ((DefaultHighlight) highlightGroup.getHighlight(i)).getHighlightAction(j);
//处理HighlightAction
SearchHighlightFormulaAction searchHighlightAction = new SearchHighlightFormulaAction();
SearchHighlightFormulaAction searchHighlightAction = SearchHighlightFormulaAction.getInstance();
ITContent newContent = ITContent.copy(cellInfo.getContent());
searchHighlightAction.dealWithHighlightAction(newContent, formulaInfos, highlightAction);
}
@ -138,7 +118,8 @@ public class SearchCellFormulaAction implements SearchCellFormula {
for (int i = 0; i < highlightGroup.size(); i++) {
DefaultHighlight defaultHighlight = (DefaultHighlight) highlightGroup.getHighlight(i);
if (isConditionKeyExist(defaultHighlight.getCondition())) {
SearchConditionFormula searchCondition = conditionHashMap.get(((DefaultHighlight) highlightGroup.getHighlight(i)).getCondition().getClass().getSimpleName());
Map<String, SearchConditionFormula> conditionType = SearchConditionManager.getInstance().getConditionType();
SearchConditionFormula searchCondition = conditionType.get(((DefaultHighlight) highlightGroup.getHighlight(i)).getCondition().getClass().getSimpleName());
ITContent newContent = ITContent.copy(cellInfo.getContent());
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"),
@ -154,7 +135,8 @@ public class SearchCellFormulaAction implements SearchCellFormula {
}
private boolean isConditionKeyExist(Condition condition) {
return conditionHashMap.containsKey(condition.getClass().getSimpleName());
return SearchConditionManager.getInstance().getConditionType().containsKey(condition.getClass().getSimpleName());
}
@ -241,14 +223,16 @@ public class SearchCellFormulaAction implements SearchCellFormula {
}
private void searchFormulaFromCellInfo(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
Map<String, SearchCellFormula> cellType = SearchCellFormulaManager.getInstance().getCellType();
CellElement cellElement = ((CellElement) (cellInfo.getContent().getReplaceObject()));
if (isCellValueValid(cellInfo)) {
SearchCellFormula searchCellFormula = cellType.get(((CellElement) (cellInfo.getContent().getReplaceObject())).getValue().getClass().getSimpleName());
SearchCellFormula searchCellFormula = cellType.get(cellElement.getValue().getClass().getSimpleName());
searchCellFormula.searchFormulaFromCellType(formulaInfos, cellInfo.getContent());
} else if (isChart(cellInfo)) {
ITContent chartContent = cellInfo.getContent();
//这边置否的原因是决策报表里面单元格里面放的图表是可以有多个的,每个还是有各自的名字,和普通报表一样处理即可
chartContent.setFrmFlag(false);
SearchChartCollectionFormulaAction.getInstance().searchChartCollectionFormula(formulaInfos, cellInfo.getContent(), (ChartCollection) ((CellElement) (cellInfo.getContent().getReplaceObject())).getValue());
SearchChartCollectionFormulaAction.getInstance().searchChartCollectionFormula(formulaInfos, cellInfo.getContent(), (ChartCollection) cellElement.getValue());
}
}
@ -258,6 +242,7 @@ public class SearchCellFormulaAction implements SearchCellFormula {
}
private boolean isCellValueValid(CellInfo cellInfo) {
Map<String, SearchCellFormula> cellType = SearchCellFormulaManager.getInstance().getCellType();
return ((CellElement) (cellInfo.getContent().getReplaceObject())).getValue() != null
&& cellType.containsKey(((CellElement) (cellInfo.getContent().getReplaceObject())).getValue().getClass().getSimpleName());
}

110
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java

@ -0,0 +1,110 @@
package com.fr.design.actions.replace.action.content.formula.cell;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import java.util.HashMap;
import java.util.Map;
/**
* 管理要搜索的单元格类型公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public class SearchCellFormulaManager implements SearchManager {
private Map<String, SearchCellFormula> cellType = new HashMap<>();
public static final String DS_COLUMN = "DSColumn";
public static final String FORMULA = "Formula";
public static final String RICH_TEXT = "RichText";
public static final String SUB_REPORT = "SubReport";
private SearchCellFormulaManager() {
//数据列
register(DS_COLUMN, SearchDSColumnFormulaAction.getInstance());
//公式
register(FORMULA, SearchCellFormulaTypeAction.getInstance());
//富文本
register(RICH_TEXT, SearchRichFormulaAction.getInstance());
//子报表
register(SUB_REPORT, SearchSubReportFormulaAction.getInstance());
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchCellFormula){
register(tag, (SearchCellFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchCellFormula 对应的实现类
*/
private void register(String tag, SearchCellFormula searchCellFormula) {
cellType.put(tag, searchCellFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
cellType.remove(tag);
}
/**
* 获取单元格类型
*
* @return
*/
public Map<String, SearchCellFormula> getCellType() {
return cellType;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchCellFormulaManager getInstance() {
return SearchCellFormulaManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCellFormulaManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchCellFormulaManager instance;
SearchCellFormulaManagerEnum() {
instance = new SearchCellFormulaManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchCellFormulaManager getInstance() {
return instance;
}
}
}

35
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaTypeAction.java

@ -17,6 +17,8 @@ import java.util.List;
public class SearchCellFormulaTypeAction implements SearchCellFormula {
private SearchCellFormulaTypeAction(){}
@Override
public void searchFormulaFromCellType(List<FormulaInfo> formulaInfos, ITContent content) {
ITContent newContent = ITContent.copy(content);
@ -24,4 +26,37 @@ public class SearchCellFormulaTypeAction implements SearchCellFormula {
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Formula"));
formulaInfos.add(new FormulaInfo(newContent));
}
/**
* 获取单例
*
* @return
*/
public static SearchCellFormulaTypeAction getInstance() {
return SearchCellFormulaTypeActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCellFormulaTypeActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchCellFormulaTypeAction instance;
SearchCellFormulaTypeActionEnum() {
instance = new SearchCellFormulaTypeAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchCellFormulaTypeAction getInstance() {
return instance;
}
}
}

92
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchDSColumnFormulaAction.java

@ -4,6 +4,7 @@ import com.fr.base.Formula;
import com.fr.base.Parameter;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchCommonConditionAction;
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.action.content.formula.highlight.condition.SearchFormulaConditionAction;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchListConditionAction;
import com.fr.design.actions.replace.info.FormulaInfo;
@ -18,6 +19,7 @@ import com.fr.report.core.sort.sortexpression.SortExpression;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 查找公式时单元格格式如果是数据列型则操作此类
@ -27,35 +29,35 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-18
*/
public class SearchDSColumnFormulaAction implements SearchCellFormula {
public static HashMap<String, SearchConditionFormula> conditionHashMap = new HashMap<>();
static {
conditionHashMap.put("FormulaCondition", new SearchFormulaConditionAction());
conditionHashMap.put("CommonCondition", new SearchCommonConditionAction());
conditionHashMap.put("ListCondition", new SearchListConditionAction());
}
private SearchDSColumnFormulaAction(){}
@Override
public void searchFormulaFromCellType(List<FormulaInfo> formulaInfos, ITContent itContent) {
if (((CellElement) (itContent.getReplaceObject())).getValue() instanceof DSColumn) {
if (((DSColumn) ((CellElement) (itContent.getReplaceObject())).getValue()).getCondition() != null) {
ITContent content = ITContent.copy(itContent);
//数据列
content.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_DS_Column"));
DSColumn dsColumn = (DSColumn) ((CellElement) (itContent.getReplaceObject())).getValue();
//过滤条件中的公式
addFormulaInfos2ArrayFromCondition(content, dsColumn.getCondition(), formulaInfos);
//动态参数中的公式
addFormulaInfos2ArrayFromPara(content, dsColumn, formulaInfos);
//高级-排序中的公式
addFormulaInfos2ArrayFromSortExpression(content, dsColumn, formulaInfos);
//高级-显示值中的公式
addFormulaInfos2ArrayFromResult(content, dsColumn, formulaInfos);
if (itContent.getReplaceObject() instanceof CellElement){
CellElement cellElement = (CellElement) itContent.getReplaceObject();
if (cellElement.getValue() instanceof DSColumn) {
if (((DSColumn) cellElement.getValue()).getCondition() != null) {
ITContent content = ITContent.copy(itContent);
//数据列
content.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_DS_Column"));
DSColumn dsColumn = (DSColumn) ((CellElement) (itContent.getReplaceObject())).getValue();
//过滤条件中的公式
addFormulaInfos2ArrayFromCondition(content, dsColumn.getCondition(), formulaInfos);
//动态参数中的公式
addFormulaInfos2ArrayFromPara(content, dsColumn, formulaInfos);
//高级-排序中的公式
addFormulaInfos2ArrayFromSortExpression(content, dsColumn, formulaInfos);
//高级-显示值中的公式
addFormulaInfos2ArrayFromResult(content, dsColumn, formulaInfos);
}
}
}
}
}
private void addFormulaInfos2ArrayFromResult(ITContent content, DSColumn dsColumn, List<FormulaInfo> formulaInfos) {
@ -109,11 +111,49 @@ public class SearchDSColumnFormulaAction implements SearchCellFormula {
*/
private void addFormulaInfos2ArrayFromCondition(ITContent content, Condition condition, List<FormulaInfo> formulaInfos) {
//这边condition有三种情况:FormulaCondition、CommonCondition、ListCondition,分别处理
SearchConditionFormula searchCondition = conditionHashMap.get(condition.getClass().getSimpleName());
ITContent newContent = ITContent.copy(content);
//过滤条件
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Filter_Conditions"));
searchCondition.searchFormulaFromCondition(formulaInfos, newContent, condition);
Map<String, SearchConditionFormula> conditionType = SearchConditionManager.getInstance().getConditionType();
if (conditionType.containsKey(condition.getClass().getSimpleName())){
SearchConditionFormula searchCondition = conditionType.get(condition.getClass().getSimpleName());
ITContent newContent = ITContent.copy(content);
//过滤条件
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Filter_Conditions"));
searchCondition.searchFormulaFromCondition(formulaInfos, newContent, condition);
}
}
/**
* 获取单例
*
* @return
*/
public static SearchDSColumnFormulaAction getInstance() {
return SearchDSColumnFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchDSColumnFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchDSColumnFormulaAction instance;
SearchDSColumnFormulaActionEnum() {
instance = new SearchDSColumnFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchDSColumnFormulaAction getInstance() {
return instance;
}
}
}

64
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchRichFormulaAction.java

@ -2,10 +2,13 @@ package com.fr.design.actions.replace.action.content.formula.cell;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.core.RichChar;
import com.fr.report.cell.cellattr.core.RichText;
import java.util.Iterator;
import java.util.List;
/**
@ -17,20 +20,61 @@ import java.util.List;
*/
public class SearchRichFormulaAction implements SearchCellFormula {
private SearchRichFormulaAction() {
}
@Override
public void searchFormulaFromCellType(List<FormulaInfo> formulaInfos, ITContent content) {
//todo 富文本这边直接遍历RichChar来拿公式
String contain = "${";
if (((RichText) ((CellElement) (content.getReplaceObject())).getValue()).getContent().contains(contain)) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(((CellElement) (content.getReplaceObject())).getValue());
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Rich_Text"),
Toolkit.i18nText("Fine-Design_Basic_Formula")
);
formulaInfos.add(new FormulaInfo(newContent));
RichText richText = ((RichText) ((CellElement) (content.getReplaceObject())).getValue());
Iterator<RichChar> it = richText.charIterator();
while (it.hasNext()) {
RichChar richChar = it.next();
if (richChar.isFormula()) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(richChar);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Rich_Text"),
Toolkit.i18nText("Fine-Design_Basic_Formula")
);
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
/**
* 获取单例
*
* @return
*/
public static SearchRichFormulaAction getInstance() {
return SearchRichFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchRichFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchRichFormulaAction instance;
SearchRichFormulaActionEnum() {
instance = new SearchRichFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchRichFormulaAction getInstance() {
return instance;
}
}
}

35
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchSubReportFormulaAction.java

@ -18,6 +18,10 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-18
*/
public class SearchSubReportFormulaAction implements SearchCellFormula {
private SearchSubReportFormulaAction() {
}
@Override
public void searchFormulaFromCellType(List<FormulaInfo> formulaInfos, ITContent content) {
KV[] kvs = ((SubReport) (((CellElement) content.getReplaceObject()).getValue())).getParameterKVS();
@ -28,8 +32,39 @@ public class SearchSubReportFormulaAction implements SearchCellFormula {
newContent.setReplaceObject(kv);
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchSubReportFormulaAction getInstance() {
return SearchSubReportFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchSubReportFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchSubReportFormulaAction instance;
SearchSubReportFormulaActionEnum() {
instance = new SearchSubReportFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchSubReportFormulaAction getInstance() {
return instance;
}
}
}

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

@ -25,7 +25,7 @@ import java.util.List;
public class SearchChartCollectionFormulaAction {
public SearchChartCollectionFormulaAction() {
private SearchChartCollectionFormulaAction() {
}
/**
@ -235,7 +235,7 @@ public class SearchChartCollectionFormulaAction {
/**
* 枚举实现单例
*/
enum SearchChartCollectionFormulaActionEnum {
private enum SearchChartCollectionFormulaActionEnum {
/**
* 单例
*/

2
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/DataType.java

@ -9,6 +9,7 @@ import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
@ -106,6 +107,7 @@ public enum DataType {
* @param name
* @return
*/
@Nullable
public static DataType match(String name) {
DataType[] values = DataType.values();
for (DataType value : values) {

2
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java

@ -90,7 +90,7 @@ public class SearchDataFormulaAction implements SearchFormula {
/**
* 枚举实现单例
*/
enum SearchDataFormulaActionEnum {
private enum SearchDataFormulaActionEnum {
/**
* 单例
*/

4
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/floatelement/SearchFloatFormulaAction.java

@ -44,7 +44,7 @@ public class SearchFloatFormulaAction implements SearchFloatFormula {
NameJavaScriptGroup nameJavaScriptGroup = ((FloatElement) floatInfo.getContent().getReplaceObject()).getNameHyperlinkGroup();
if (nameJavaScriptGroup != null) {
for (int i = 0; i < nameJavaScriptGroup.size(); i++) {
SearchJSHighlightAction action = new SearchJSHighlightAction();
SearchJSHighlightAction action = SearchJSHighlightAction.getInstance();
action.searchJSFormulaFromOther(formulaInfos, floatInfo.getContent(), nameJavaScriptGroup.getNameHyperlink(i).getJavaScript());
}
}
@ -133,7 +133,7 @@ public class SearchFloatFormulaAction implements SearchFloatFormula {
/**
* 单例实现枚举
*/
enum SearchFloatFormulaActionEnum {
private enum SearchFloatFormulaActionEnum {
/**
* 单例
*/

50
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/SearchHighlightFormulaAction.java

@ -8,6 +8,7 @@ import com.fr.report.cell.cellattr.highlight.HighlightAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 处理条件属性中各种属性的公式超级链接控件...
@ -17,23 +18,50 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-18
*/
public class SearchHighlightFormulaAction implements SearchHighlightFormula {
public static HashMap<String, SearchHighlightFormula> highlightHashMap = new HashMap<>();
static {
//这边控件类型不做处理,在SearchWidgetFormulaAction统一处理即可
//条件属性-超级链接
highlightHashMap.put("HyperlinkHighlightAction", new SearchJSHighlightAction());
//条件属性-...
// TODO: 2022/9/14 条件属性的其他类型
}
private SearchHighlightFormulaAction() {
}
@Override
public void dealWithHighlightAction(ITContent content, List<FormulaInfo> formulaInfos, HighlightAction highlightAction) {
if (highlightHashMap.containsKey(highlightAction.getClass().getSimpleName())) {
SearchHighlightFormula searchHighlight = highlightHashMap.get(highlightAction.getClass().getSimpleName());
Map<String, SearchHighlightFormula> highlightType = SearchHighlightFormulaManager.getInstance().getHighlightType();
if (highlightType.containsKey(highlightAction.getClass().getSimpleName())) {
SearchHighlightFormula searchHighlight = highlightType.get(highlightAction.getClass().getSimpleName());
searchHighlight.dealWithHighlightAction(content, formulaInfos, highlightAction);
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchHighlightFormulaAction getInstance() {
return SearchHighlightFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchHighlightFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchHighlightFormulaAction instance;
SearchHighlightFormulaActionEnum() {
instance = new SearchHighlightFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchHighlightFormulaAction getInstance() {
return instance;
}
}
}

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

@ -0,0 +1,105 @@
package com.fr.design.actions.replace.action.content.formula.highlight;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import com.fr.design.actions.replace.action.content.formula.cell.SearchCellFormula;
import com.fr.design.actions.replace.action.content.formula.cell.SearchCellFormulaManager;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction;
import java.util.HashMap;
import java.util.Map;
/**
* 管理要搜索的条件属性类型公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public class SearchHighlightFormulaManager implements SearchManager {
private Map<String, SearchHighlightFormula> highlightType = new HashMap<>();
public static final String HYPERLINK_HIGHLIGHT_ACTION = "HyperlinkHighlightAction";
private SearchHighlightFormulaManager() {
//这边控件类型不做处理,在SearchWidgetFormulaAction统一处理即可
//条件属性-超级链接
register(HYPERLINK_HIGHLIGHT_ACTION, SearchJSHighlightAction.getInstance());
//条件属性-...
// TODO: 2022/9/14 条件属性的其他类型
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchHighlightFormula){
register(tag, (SearchHighlightFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchHighlightFormula 对应的实现类
*/
private void register(String tag, SearchHighlightFormula searchHighlightFormula) {
highlightType.put(tag, searchHighlightFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
highlightType.remove(tag);
}
/**
* 获取单元格类型
*
* @return
*/
public Map<String, SearchHighlightFormula> getHighlightType() {
return highlightType;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchHighlightFormulaManager getInstance() {
return SearchHighlightFormulaManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchHighlightFormulaManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchHighlightFormulaManager instance;
SearchHighlightFormulaManagerEnum() {
instance = new SearchHighlightFormulaManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchHighlightFormulaManager getInstance() {
return instance;
}
}
}

41
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchCommonConditionAction.java

@ -16,12 +16,51 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-17
*/
public class SearchCommonConditionAction implements SearchConditionFormula {
private SearchCommonConditionAction() {
}
@Override
public void searchFormulaFromCondition(List<FormulaInfo> formulaInfos, ITContent content, Condition condition) {
if (((CommonCondition) condition).getCompare().getValue() != null && ((CommonCondition) condition).getCompare().getValue() instanceof Formula) {
if (((CommonCondition) condition).getCompare().getValue() instanceof Formula) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(((CommonCondition) condition).getCompare());
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 获取单例
*
* @return
*/
public static SearchCommonConditionAction getInstance() {
return SearchCommonConditionActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCommonConditionActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchCommonConditionAction instance;
SearchCommonConditionActionEnum() {
instance = new SearchCommonConditionAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchCommonConditionAction getInstance() {
return instance;
}
}
}

103
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchConditionManager.java

@ -0,0 +1,103 @@
package com.fr.design.actions.replace.action.content.formula.highlight.condition;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import java.util.HashMap;
import java.util.Map;
/**
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public class SearchConditionManager implements SearchManager {
private Map<String, SearchConditionFormula> conditionType = new HashMap<>();
public static final String FORMULA_CONDITION = "FormulaCondition";
public static final String OBJECT_CONDITION = "ObjectCondition";
public static final String LIST_CONDITION = "ListCondition";
public static final String COMMON_CONDITION = "CommonCondition";
private SearchConditionManager() {
register(FORMULA_CONDITION, SearchFormulaConditionAction.getInstance());
register(OBJECT_CONDITION, SearchObjectConditionAction.getInstance());
register(LIST_CONDITION, SearchListConditionAction.getInstance());
register(COMMON_CONDITION, SearchCommonConditionAction.getInstance());
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchConditionFormula){
register(tag, (SearchConditionFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchConditionFormula 对应的实现类
*/
private void register(String tag, SearchConditionFormula searchConditionFormula) {
conditionType.put(tag, searchConditionFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
conditionType.remove(tag);
}
/**
* 获取类型
* @return
*/
public Map<String, SearchConditionFormula> getConditionType(){
return conditionType;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchConditionManager getInstance() {
return SearchConditionManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchConditionManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchConditionManager instance;
SearchConditionManagerEnum() {
instance = new SearchConditionManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchConditionManager getInstance() {
return instance;
}
}
}

39
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchFormulaConditionAction.java

@ -1,6 +1,7 @@
package com.fr.design.actions.replace.action.content.formula.highlight.condition;
import com.fr.data.condition.FormulaCondition;
import com.fr.design.actions.replace.action.content.formula.cell.SearchCellFormulaTypeAction;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
@ -16,6 +17,12 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-17
*/
public class SearchFormulaConditionAction implements SearchConditionFormula {
private SearchFormulaConditionAction() {
}
@Override
public void searchFormulaFromCondition(List<FormulaInfo> formulaInfos, ITContent content, Condition condition) {
if (((FormulaCondition) (condition)).getFormula() != null) {
@ -23,6 +30,38 @@ public class SearchFormulaConditionAction implements SearchConditionFormula {
newContent.setReplaceObject(condition);
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 获取单例
*
* @return
*/
public static SearchFormulaConditionAction getInstance() {
return SearchFormulaConditionActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchFormulaConditionActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchFormulaConditionAction instance;
SearchFormulaConditionActionEnum() {
instance = new SearchFormulaConditionAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchFormulaConditionAction getInstance() {
return instance;
}
}
}

44
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchListConditionAction.java

@ -19,20 +19,58 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-17
*/
public class SearchListConditionAction implements SearchConditionFormula {
private SearchListConditionAction() {
}
@Override
public void searchFormulaFromCondition(List<FormulaInfo> formulaInfos, ITContent content, Condition condition) {
for (int i = 0; i < ((ListCondition) condition).getJoinConditionCount(); i++) {
Condition joinCondition = ((ListCondition) condition).getJoinCondition(i).getCondition();
if (joinCondition instanceof CommonCondition) {
SearchCommonConditionAction commonConditionAction = new SearchCommonConditionAction();
SearchCommonConditionAction commonConditionAction = SearchCommonConditionAction.getInstance();
commonConditionAction.searchFormulaFromCondition(formulaInfos, content, joinCondition);
} else if (joinCondition instanceof FormulaCondition) {
SearchFormulaConditionAction formulaConditionAction = new SearchFormulaConditionAction();
SearchFormulaConditionAction formulaConditionAction = SearchFormulaConditionAction.getInstance();
formulaConditionAction.searchFormulaFromCondition(formulaInfos, content, joinCondition);
} else if (joinCondition instanceof ObjectCondition) {
SearchObjectConditionAction objectConditionAction = new SearchObjectConditionAction();
SearchObjectConditionAction objectConditionAction = SearchObjectConditionAction.getInstance();
objectConditionAction.searchFormulaFromCondition(formulaInfos, content, joinCondition);
}
}
}
/**
* 获取单例
*
* @return
*/
public static SearchListConditionAction getInstance() {
return SearchListConditionActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchListConditionActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchListConditionAction instance;
SearchListConditionActionEnum() {
instance = new SearchListConditionAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchListConditionAction getInstance() {
return instance;
}
}
}

38
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchObjectConditionAction.java

@ -16,6 +16,11 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-18
*/
public class SearchObjectConditionAction implements SearchConditionFormula {
private SearchObjectConditionAction() {
}
@Override
public void searchFormulaFromCondition(List<FormulaInfo> formulaInfos, ITContent content, Condition condition) {
if (((ObjectCondition) condition).getCompare().getValue() != null && ((ObjectCondition) condition).getCompare().getValue() instanceof Formula) {
@ -24,4 +29,37 @@ public class SearchObjectConditionAction implements SearchConditionFormula {
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 获取单例
*
* @return
*/
public static SearchObjectConditionAction getInstance() {
return SearchObjectConditionActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchObjectConditionActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchObjectConditionAction instance;
SearchObjectConditionActionEnum() {
instance = new SearchObjectConditionAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchObjectConditionAction getInstance() {
return instance;
}
}
}

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

@ -1,9 +1,7 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchCommonConditionAction;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionFormula;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchFormulaConditionAction;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchListConditionAction;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionManager;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
@ -14,9 +12,8 @@ import com.fr.write.DBManipulation;
import com.fr.write.DMLConfigJob;
import com.fr.write.config.DMLConfig;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 获取提交入库中的公式
@ -27,12 +24,7 @@ import java.util.List;
*/
public class SearchCommit2DBJSFormulaAction implements SearchJSFormula {
public static HashMap<String, SearchConditionFormula> conditionHashMap = new HashMap<>();
static {
conditionHashMap.put("FormulaCondition", new SearchFormulaConditionAction());
conditionHashMap.put("CommonCondition", new SearchCommonConditionAction());
conditionHashMap.put("ListCondition", new SearchListConditionAction());
private SearchCommit2DBJSFormulaAction() {
}
@Override
@ -70,12 +62,12 @@ public class SearchCommit2DBJSFormulaAction implements SearchJSFormula {
private void dealWithCallBack(List<FormulaInfo> formulaInfos, ITContent content, Commit2DBJavaScript javaScript) {
if (javaScript.getCallBack() != null) {
SearchJSHighlightAction SJSA = new SearchJSHighlightAction();
SearchJSHighlightAction jsHighlightAction = SearchJSHighlightAction.getInstance();
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Set_Callback_Function")
);
SJSA.searchJSFormulaFromOther(formulaInfos, newContent, javaScript.getCallBack());
jsHighlightAction.searchJSFormulaFromOther(formulaInfos, newContent, javaScript.getCallBack());
}
}
@ -84,14 +76,51 @@ public class SearchCommit2DBJSFormulaAction implements SearchJSFormula {
if (dmlConfig.getCondition() != null) {
//这边condition有三种情况:FormulaCondition、CommonCondition、ListCondition,分别处理
Condition condition = dmlConfig.getCondition();
SearchConditionFormula searchCondition = conditionHashMap.get(condition.getClass().getSimpleName());
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Submit_Condition")
);
searchCondition.searchFormulaFromCondition(formulaInfos, newContent, condition);
Map<String, SearchConditionFormula> conditionType = SearchConditionManager.getInstance().getConditionType();
if (conditionType.containsKey(condition.getClass().getSimpleName())) {
SearchConditionFormula searchCondition = conditionType.get(condition.getClass().getSimpleName());
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Submit_Condition")
);
searchCondition.searchFormulaFromCondition(formulaInfos, newContent, condition);
}
}
}
/**
* 获取单例
*
* @return
*/
public static SearchCommit2DBJSFormulaAction getInstance() {
return SearchCommit2DBJSFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCommit2DBJSFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchCommit2DBJSFormulaAction instance;
SearchCommit2DBJSFormulaActionEnum() {
instance = new SearchCommit2DBJSFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchCommit2DBJSFormulaAction getInstance() {
return instance;
}
}
}

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

@ -18,6 +18,10 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-19
*/
public class SearchExportJSFormulaAction implements SearchJSFormula {
private SearchExportJSFormulaAction() {
}
@Override
public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
//如果导出当前模板,可以存公式的地方就是命名方式-自定义
@ -48,4 +52,37 @@ public class SearchExportJSFormulaAction implements SearchJSFormula {
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 获取单例
*
* @return
*/
public static SearchExportJSFormulaAction getInstance() {
return SearchExportJSFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchExportJSFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchExportJSFormulaAction instance;
SearchExportJSFormulaActionEnum() {
instance = new SearchExportJSFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchExportJSFormulaAction getInstance() {
return instance;
}
}
}

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

@ -27,7 +27,7 @@ public interface SearchJSFormula extends SearchHighlightFormula {
default void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
}
;
/**
* 从超链中的参数获取公式
@ -39,5 +39,5 @@ public interface SearchJSFormula extends SearchHighlightFormula {
default void addFormulaInfosFromJSPara(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
}
;
}

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

@ -0,0 +1,116 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchCommonConditionAction;
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 java.util.HashMap;
import java.util.Map;
/**
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public class SearchJSFormulaManager implements SearchManager {
private static Map<String, SearchJSFormula> javaScriptType = new HashMap<>();
public static final String COMMIT_2_DB_JAVASCRIPT = "Commit2DBJavaScript";
public static final String EXPORT_JAVASCRIPT = "ExportJavaScript";
public static final String MOBILE_POPUP_HYPERLINK = "MobilePopupHyperlink";
private SearchJSFormulaManager() {
//控件事件里面需要特殊处理的类型
//EmailJavaScript(这个暂时不做处理)
//ExportJavaScript
//MobilePopupHyperlink
//Commit2DBJavaScript
//单元格条件属性里面需要处理的类型
//WebHyperlink——只有参数可以放公式,不需要特殊处理
//ReportletHyperlink——只有参数可以放公式,不需要特殊处理
//EmailJavaScript(这个暂时不做处理)
//ParameterJavaScript——只有参数可以放公式,不需要特殊处理
//JavaScriptImpl——只有参数可以放公式,不需要特殊处理
//MobilePopupHyperlink
//ChartHyperPoplink
//ChartHyperRelateCellLink
//ChartHyperRelateFloatLink
register(COMMIT_2_DB_JAVASCRIPT, SearchCommit2DBJSFormulaAction.getInstance());
register(EXPORT_JAVASCRIPT, SearchExportJSFormulaAction.getInstance());
register(MOBILE_POPUP_HYPERLINK, SearchMobileHyperlinkFormulaAction.getInstance());
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchJSFormula){
register(tag, (SearchJSFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchJSFormula 对应的实现类
*/
private void register(String tag, SearchJSFormula searchJSFormula) {
javaScriptType.put(tag, searchJSFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
javaScriptType.remove(tag);
}
/**
* 获取类型
* @return
*/
public Map<String, SearchJSFormula> getJSType(){
return javaScriptType;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchJSFormulaManager getInstance() {
return SearchJSFormulaManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchJSFormulaManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchJSFormulaManager instance;
SearchJSFormulaManagerEnum() {
instance = new SearchJSFormulaManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchJSFormulaManager getInstance() {
return instance;
}
}
}

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

@ -5,16 +5,14 @@ import com.fr.base.Formula;
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.Commit2DBJavaScript;
import com.fr.js.JavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.HyperlinkHighlightAction;
import com.fr.stable.ParameterProvider;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 处理条件属性中各种超级链接内的公式也包括事件中的各种超链
@ -24,33 +22,9 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-18
*/
public class SearchJSHighlightAction implements SearchJSFormula {
//需要特殊处理的JS类型
public static HashMap<String, SearchJSFormula> javaScriptHashMap = new HashMap<>();
public static HashMap<Class, SearchJSFormula> hashMap = new HashMap<>();
static {
hashMap.put(Commit2DBJavaScript.class, new SearchCommit2DBJSFormulaAction());
}
static {
//控件事件里面需要特殊处理的类型
//EmailJavaScript(这个暂时不做处理)
//ExportJavaScript
//MobilePopupHyperlink
//Commit2DBJavaScript
//单元格条件属性里面需要处理的类型
//WebHyperlink——只有参数可以放公式,不需要特殊处理
//ReportletHyperlink——只有参数可以放公式,不需要特殊处理
//EmailJavaScript(这个暂时不做处理)
//ParameterJavaScript——只有参数可以放公式,不需要特殊处理
//JavaScriptImpl——只有参数可以放公式,不需要特殊处理
//MobilePopupHyperlink
//ChartHyperPoplink
//ChartHyperRelateCellLink
//ChartHyperRelateFloatLink
javaScriptHashMap.put("Commit2DBJavaScript", new SearchCommit2DBJSFormulaAction());
javaScriptHashMap.put("ExportJavaScript", new SearchExportJSFormulaAction());
javaScriptHashMap.put("MobilePopupHyperlink", new SearchMobileHyperlinkFormulaAction());
private SearchJSHighlightAction() {
}
@Override
@ -102,10 +76,45 @@ public class SearchJSHighlightAction implements SearchJSFormula {
public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
//获取JS中的参数中的公式
addFormulaInfosFromJSPara(formulaInfos, content, javaScript);
Map<String, SearchJSFormula> javaScriptType = SearchJSFormulaManager.getInstance().getJSType();
//这里面类型比较多,但是一部分不用处理——公式可能存在的地方只有参数,这部分在addFormulaInfosFromJSPara中就已经把公式拿完了
if (javaScriptHashMap.containsKey(javaScript.getClass().getSimpleName())) {
SearchJSFormula javaScriptFormula = javaScriptHashMap.get(javaScript.getClass().getSimpleName());
if (javaScriptType.containsKey(javaScript.getClass().getSimpleName())) {
SearchJSFormula javaScriptFormula = javaScriptType.get(javaScript.getClass().getSimpleName());
javaScriptFormula.searchJSFormulaFromOther(formulaInfos, content, javaScript);
}
}
/**
* 获取单例
*
* @return
*/
public static SearchJSHighlightAction getInstance() {
return SearchJSHighlightActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchJSHighlightActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchJSHighlightAction instance;
SearchJSHighlightActionEnum() {
instance = new SearchJSHighlightAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchJSHighlightAction getInstance() {
return instance;
}
}
}

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

@ -17,6 +17,10 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-19
*/
public class SearchMobileHyperlinkFormulaAction implements SearchJSFormula {
private SearchMobileHyperlinkFormulaAction() {
}
@Override
public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
if (((MobilePopupHyperlink) javaScript).getPopupText() instanceof Formula) {
@ -29,4 +33,37 @@ public class SearchMobileHyperlinkFormulaAction implements SearchJSFormula {
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 获取单例
*
* @return
*/
public static SearchMobileHyperlinkFormulaAction getInstance() {
return SearchMobileHyperlinkFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchMobileHyperlinkFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchMobileHyperlinkFormulaAction instance;
SearchMobileHyperlinkFormulaActionEnum() {
instance = new SearchMobileHyperlinkFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchMobileHyperlinkFormulaAction getInstance() {
return instance;
}
}
}

7
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/AbstractSearchWidgetFormulaAction.java

@ -3,12 +3,9 @@ package com.fr.design.actions.replace.action.content.formula.widget;
import com.fr.base.Formula;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.WidgetInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.event.Listener;
import com.fr.form.ui.ComboCheckBox;
import com.fr.form.ui.DataControl;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
@ -40,10 +37,10 @@ public abstract class AbstractSearchWidgetFormulaAction implements SearchWidgetF
Listener listener = widget.getListener(i);
ITContent newContent = ITContent.copy(content);
//控件的事件可以使用的JS有五种,这边统一交给Highlight那边判断超级链接并进行处理
SearchJSHighlightAction SJSA = new SearchJSHighlightAction();
SearchJSHighlightAction jsHighlightAction = SearchJSHighlightAction.getInstance();
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Event"),listener.getName());
SJSA.searchJSFormulaFromOther(formulaInfos, newContent, listener.getAction());
jsHighlightAction.searchJSFormulaFromOther(formulaInfos, newContent, listener.getAction());
}
}

47
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/DictionaryType.java

@ -26,29 +26,32 @@ public enum DictionaryType implements DictionaryAction {
FORMULA_DICTIONARY("FormulaDictionary") {
@Override
public void searchFormulaFromDictionary(ITContent content, List<FormulaInfo> formulaInfos, Dictionary dictionary) {
//显示值
if (((FormulaDictionary) dictionary).getExcuteFormula() != null) {
ITContent excuteContent = ITContent.copy(content);
excuteContent.setReplaceObject(dictionary);
excuteContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Formula"),
Toolkit.i18nText("Fine-Design_Basic_Display_Value")
);
formulaInfos.add(new FormulaInfo(excuteContent));
}
//实际值
if (((FormulaDictionary) dictionary).getProduceFormula() != null) {
ITContent produceContent = ITContent.copy(content);
produceContent.setReplaceObject(dictionary);
produceContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Formula"),
Toolkit.i18nText("Fine-Design_Basic_Actual_Value")
);
formulaInfos.add(new FormulaInfo(produceContent));
}
if (dictionary instanceof FormulaDictionary) {
FormulaDictionary formulaDictionary = (FormulaDictionary) dictionary;
//显示值
if (formulaDictionary.getExcuteFormula() != null) {
ITContent excuteContent = ITContent.copy(content);
excuteContent.setReplaceObject(dictionary);
excuteContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Formula"),
Toolkit.i18nText("Fine-Design_Basic_Display_Value")
);
formulaInfos.add(new FormulaInfo(excuteContent));
}
//实际值
if (formulaDictionary.getProduceFormula() != null) {
ITContent produceContent = ITContent.copy(content);
produceContent.setReplaceObject(dictionary);
produceContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Formula"),
Toolkit.i18nText("Fine-Design_Basic_Actual_Value")
);
formulaInfos.add(new FormulaInfo(produceContent));
}
}
}
},
/**

38
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchCommonWidgetFormulaAction.java

@ -14,9 +14,47 @@ import java.util.List;
*/
public class SearchCommonWidgetFormulaAction extends AbstractSearchWidgetFormulaAction {
private SearchCommonWidgetFormulaAction() {
}
@Override
public void searchFormulaFromWidget(ITContent content, List<FormulaInfo> formulaInfos) {
//每个事件的事件、控件值两部分的公式获取逻辑是一样的,直接调用即可,各自其他地方的公式就需要特殊处理
super.searchFormulaFromWidget(content, formulaInfos);
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchCommonWidgetFormulaAction getInstance() {
return SearchCommonWidgetFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCommonWidgetFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchCommonWidgetFormulaAction instance;
SearchCommonWidgetFormulaActionEnum() {
instance = new SearchCommonWidgetFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchCommonWidgetFormulaAction getInstance() {
return instance;
}
}
}

37
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java

@ -20,6 +20,9 @@ import java.util.List;
public class SearchDateEditorFormulaAction extends AbstractSearchWidgetFormulaAction {
private SearchDateEditorFormulaAction() {
}
@Override
public void searchFormulaFromWidget(ITContent content, List<FormulaInfo> formulaInfos) {
super.searchFormulaFromWidget(content, formulaInfos);
@ -47,4 +50,38 @@ public class SearchDateEditorFormulaAction extends AbstractSearchWidgetFormulaAc
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchDateEditorFormulaAction getInstance() {
return SearchDateEditorFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchDateEditorFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchDateEditorFormulaAction instance;
SearchDateEditorFormulaActionEnum() {
instance = new SearchDateEditorFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchDateEditorFormulaAction getInstance() {
return instance;
}
}
}

37
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDictFormulaAction.java

@ -17,6 +17,8 @@ import java.util.List;
*/
public class SearchDictFormulaAction extends AbstractSearchWidgetFormulaAction {
private SearchDictFormulaAction() {
}
@Override
public void searchFormulaFromWidget(ITContent content, List<FormulaInfo> formulaInfos) {
@ -36,6 +38,41 @@ public class SearchDictFormulaAction extends AbstractSearchWidgetFormulaAction {
}
}
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchDictFormulaAction getInstance() {
return SearchDictFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchDictFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchDictFormulaAction instance;
SearchDictFormulaActionEnum() {
instance = new SearchDictFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchDictFormulaAction getInstance() {
return instance;
}
}
}

38
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java

@ -21,6 +21,9 @@ import java.util.List;
* created by Destiny.Lin on 2022-08-22
*/
public class SearchTreeEditorFormulaAction extends AbstractSearchWidgetFormulaAction {
private SearchTreeEditorFormulaAction() {
}
@Override
public void searchFormulaFromWidget(ITContent content, List<FormulaInfo> formulaInfos) {
//控件值、事件
@ -73,4 +76,39 @@ public class SearchTreeEditorFormulaAction extends AbstractSearchWidgetFormulaAc
}
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchTreeEditorFormulaAction getInstance() {
return SearchTreeEditorFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchTreeEditorFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchTreeEditorFormulaAction instance;
SearchTreeEditorFormulaActionEnum() {
instance = new SearchTreeEditorFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchTreeEditorFormulaAction getInstance() {
return instance;
}
}
}

47
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaAction.java

@ -23,6 +23,7 @@ import com.fr.main.impl.WorkBook;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 查找控件内的公式
@ -35,45 +36,6 @@ public class SearchWidgetFormulaAction extends AbstractSearchWidgetFormulaAction
private SearchWidgetFormulaAction() {
}
public static HashMap<String, SearchWidgetFormula> widgetHashMap = new HashMap<>();
static {
/**
* 可能有控件值 有事件
*/
widgetHashMap.put("FormSubmitButton", new SearchCommonWidgetFormulaAction());
widgetHashMap.put("WParameterLayout", new SearchCommonWidgetFormulaAction());
widgetHashMap.put("TextArea", new SearchCommonWidgetFormulaAction());
widgetHashMap.put("Password", new SearchCommonWidgetFormulaAction());
widgetHashMap.put("CheckBox", new SearchCommonWidgetFormulaAction());
widgetHashMap.put("Label", new SearchCommonWidgetFormulaAction());
widgetHashMap.put("FreeButton", new SearchCommonWidgetFormulaAction());
widgetHashMap.put("NumberEditor", new SearchCommonWidgetFormulaAction());
widgetHashMap.put("TextEditor", new SearchCommonWidgetFormulaAction());
/**
* 日期类型
*/
widgetHashMap.put("DateEditor", new SearchDateEditorFormulaAction());
/**
* 控件值事件非树形数据字典
*/
widgetHashMap.put("ComboBox", new SearchDictFormulaAction());
widgetHashMap.put("RadioGroup", new SearchDictFormulaAction());
widgetHashMap.put("CheckBoxGroup", new SearchDictFormulaAction());
widgetHashMap.put("ComboCheckBox", new SearchDictFormulaAction());
widgetHashMap.put("PageFixedRowComboBox", new SearchDictFormulaAction());
/**
* 控件值事件树形数据字典
*/
widgetHashMap.put("TreeComboBoxEditor", new SearchTreeEditorFormulaAction());
widgetHashMap.put("TreeEditor", new SearchTreeEditorFormulaAction());
}
@Override
public void searchFormulaFromObject(JTemplate jTemplate, List<FormulaInfo> formulaInfos) {
List<FormulaInfo> result = new ArrayList<>();
@ -117,8 +79,9 @@ public class SearchWidgetFormulaAction extends AbstractSearchWidgetFormulaAction
SearchChartCollectionFormulaAction.getInstance().searchChartCollectionFormula(formulaInfos, info.getContent(), (ChartCollection) ((ChartEditor) widget).getChartCollection());
}
}
if (widgetHashMap.containsKey(widget.getClass().getSimpleName())) {
SearchWidgetFormula searchWidgetFormula = widgetHashMap.get(widget.getClass().getSimpleName());
Map<String, SearchWidgetFormula> widgetType = SearchWidgetFormulaManager.getInstance().getWidgetType();
if (widgetType.containsKey(widget.getClass().getSimpleName())) {
SearchWidgetFormula searchWidgetFormula = widgetType.get(widget.getClass().getSimpleName());
ITContent content = ITContent.copy(info.getContent());
searchWidgetFormula.searchFormulaFromWidget(content, formulaInfos);
}
@ -142,7 +105,7 @@ public class SearchWidgetFormulaAction extends AbstractSearchWidgetFormulaAction
/**
* 枚举实现单例
*/
enum SearchWidgetFormulaActionEnum {
private enum SearchWidgetFormulaActionEnum {
/**
* 单例
*/

146
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaManager.java

@ -0,0 +1,146 @@
package com.fr.design.actions.replace.action.content.formula.widget;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import com.fr.design.actions.replace.action.content.formula.highlight.SearchHighlightFormula;
import com.fr.design.actions.replace.action.content.formula.highlight.SearchHighlightFormulaManager;
import java.util.HashMap;
import java.util.Map;
/**
* 管理要搜索的控件类型公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public class SearchWidgetFormulaManager implements SearchManager {
private Map<String, SearchWidgetFormula> widgetType = new HashMap<>();
private static final String FORM_SUBMIT_BUTTON = "FormSubmitButton";
private static final String W_PARAMETER_LAYOUT = "WParameterLayout";
private static final String TEXT_AREA = "TextArea";
private static final String PASSWORD = "Password";
private static final String CHECK_BOX = "CheckBox";
private static final String LABEL = "Label";
private static final String FREE_BUTTON = "FreeButton";
private static final String NUMBER_EDITOR = "NumberEditor";
private static final String TEXT_EDITOR = "TextEditor";
private static final String DATE_EDITOR = "DateEditor";
private static final String COMBO_BOX = "ComboBox";
private static final String RADIO_GROUP = "RadioGroup";
private static final String CHECK_BOX_GROUP = "CheckBoxGroup";
private static final String COMBO_CHECK_BOX = "ComboCheckBox";
private static final String PAGE_FIXED_ROW_COMBOBOX = "PageFixedRowComboBox";
private static final String TREE_COMBO_BOX_EDITOR = "TreeComboBoxEditor";
private static final String TREE_EDITOR = "TreeEditor";
private SearchWidgetFormulaManager() {
/**
* 可能有控件值 有事件
*/
register(FORM_SUBMIT_BUTTON, SearchCommonWidgetFormulaAction.getInstance());
register(W_PARAMETER_LAYOUT, SearchCommonWidgetFormulaAction.getInstance());
register(TEXT_AREA, SearchCommonWidgetFormulaAction.getInstance());
register(PASSWORD, SearchCommonWidgetFormulaAction.getInstance());
register(CHECK_BOX, SearchCommonWidgetFormulaAction.getInstance());
register(LABEL, SearchCommonWidgetFormulaAction.getInstance());
register(FREE_BUTTON, SearchCommonWidgetFormulaAction.getInstance());
register(NUMBER_EDITOR, SearchCommonWidgetFormulaAction.getInstance());
register(TEXT_EDITOR, SearchCommonWidgetFormulaAction.getInstance());
/**
* 日期类型
*/
register(DATE_EDITOR, SearchDateEditorFormulaAction.getInstance());
/**
* 控件值事件非树形数据字典
*/
register(COMBO_BOX, SearchDictFormulaAction.getInstance());
register(RADIO_GROUP, SearchDictFormulaAction.getInstance());
register(CHECK_BOX_GROUP, SearchDictFormulaAction.getInstance());
register(COMBO_CHECK_BOX, SearchDictFormulaAction.getInstance());
register(PAGE_FIXED_ROW_COMBOBOX, SearchDictFormulaAction.getInstance());
/**
* 控件值事件树形数据字典
*/
register(TREE_COMBO_BOX_EDITOR, SearchTreeEditorFormulaAction.getInstance());
register(TREE_EDITOR, SearchTreeEditorFormulaAction.getInstance());
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchWidgetFormula) {
register(tag, (SearchWidgetFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchWidgetFormula 对应的实现类
*/
private void register(String tag, SearchWidgetFormula searchWidgetFormula) {
widgetType.put(tag, searchWidgetFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
widgetType.remove(tag);
}
/**
* 获取单元格类型
*
* @return
*/
public Map<String, SearchWidgetFormula> getWidgetType() {
return widgetType;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchWidgetFormulaManager getInstance() {
return SearchWidgetFormulaManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchWidgetFormulaManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchWidgetFormulaManager instance;
SearchWidgetFormulaManagerEnum() {
instance = new SearchWidgetFormulaManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchWidgetFormulaManager getInstance() {
return instance;
}
}
}

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

@ -61,7 +61,7 @@ public class SearchCellJSAction implements SearchJS {
//单元格如果是图表还需要额外处理
if (cell.getValue() instanceof ChartCollection) {
SearchChartJSAction.getInstance().searchChartJS((ChartCollection) cell.getValue(),ITContent.copy(cellInfo.getContent()),jsInfos);
SearchChartJSAction.getInstance().searchChartJS((ChartCollection) cell.getValue(), ITContent.copy(cellInfo.getContent()), jsInfos);
//List<Pair<VanChartHtmlLabel, String>> htmlLabels = SearchJSUtils.getHtmlLabel((ChartCollection) cell.getValue());
//List<NameJavaScript> nameJavaScripts = SearchJSUtils.getNameJavaScript((ChartCollection) cell.getValue());
////图表-样式-标签以及图表-特效-条件显示
@ -133,7 +133,7 @@ public class SearchCellJSAction implements SearchJS {
/**
* 枚举实现单例
*/
enum SearchCellJSActionEnum {
private enum SearchCellJSActionEnum {
/**
* 单例
*/

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

@ -24,6 +24,10 @@ import java.util.List;
*/
public class SearchChartJSAction {
private SearchChartJSAction() {
}
/**
* 寻找图表中的JS
*
@ -102,7 +106,7 @@ public class SearchChartJSAction {
/**
* 枚举实现单例
*/
enum SearchChartJSActionEnum {
private enum SearchChartJSActionEnum {
/**
* 单例
*/

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

@ -49,19 +49,7 @@ public class SearchFloatJSAction implements SearchJS {
//从超级链接搜索
SearchJSUtils.addJSInfosFromHyperLink(floatElement, jsInfos, content);
if (floatElement.getValue() instanceof ChartCollection) {
SearchChartJSAction.getInstance().searchChartJS((ChartCollection) floatElement.getValue(),ITContent.copy(floatInfo.getContent()),jsInfos);
//List<Pair<VanChartHtmlLabel, String>> htmlLabels = SearchJSUtils.getHtmlLabel((ChartCollection) floatElement.getValue());
//List<NameJavaScript> nameJavaScripts = SearchJSUtils.getNameJavaScript((ChartCollection) floatElement.getValue());
////图表-样式-标签以及图表-特效-条件显示
//SearchJSUtils.addJSInfosFromHtmlLabel(content, htmlLabels, jsInfos);
////图表-特效-交互属性
//ITContent newContent = ITContent.copy(content);
//newContent.addOtherPos(
// Toolkit.i18nText("Fine-Design_Chart_Chart"),
// Toolkit.i18nText("Fine-Design_Chart_Animation_Special"),
// Toolkit.i18nText("Fine-Design_Chart_Interactive")
//);
//SearchJSUtils.addJSInfosFromNameJS(newContent, nameJavaScripts, jsInfos);
SearchChartJSAction.getInstance().searchChartJS((ChartCollection) floatElement.getValue(), ITContent.copy(floatInfo.getContent()), jsInfos);
}
}
}
@ -79,7 +67,7 @@ public class SearchFloatJSAction implements SearchJS {
/**
* 枚举实现单例
*/
enum SearchFloatJSActionEnum {
private enum SearchFloatJSActionEnum {
/**
* 单例
*/

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

@ -1,12 +1,10 @@
package com.fr.design.actions.replace.action.content.js;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.content.formula.SearchFormula;
import com.fr.design.actions.replace.action.SearchManager;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.ui.Widget;
import java.util.ArrayList;
import java.util.HashSet;
@ -21,19 +19,19 @@ import java.util.Set;
* @version 11.0
* created by Destiny.Lin on 2022-08-12
*/
public class SearchJSManager implements SearchAction {
public class SearchJSManager implements SearchAction, SearchManager {
private List<JSInfo> jsInfos;
private Set<SearchJS> searchJSSet = new HashSet<>();
private SearchJSManager() {
//从控件
registerJS(SearchWidgetJSAction.getInstance());
register(SearchWidgetJSAction.getInstance());
//从单元格获取JS
registerJS(SearchCellJSAction.getInstance());
register(SearchCellJSAction.getInstance());
//从模板Web属性
registerJS(SearchWebJSAction.getInstance());
register(SearchWebJSAction.getInstance());
//从悬浮元素
registerJS(SearchFloatJSAction.getInstance());
register(SearchFloatJSAction.getInstance());
}
@Override
@ -53,19 +51,33 @@ public class SearchJSManager implements SearchAction {
this.jsInfos = jsInfos;
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchJS){
register((SearchJS) searchAction);
}
}
@Override
public void removeAction(SearchAction searchAction) {
if (searchAction instanceof SearchJS){
remove((SearchJS) searchAction);
}
}
/**
* 注册对象
*
* @param searchJS
*/
public void registerJS(SearchJS searchJS) {
private void register(SearchJS searchJS) {
searchJSSet.add(searchJS);
}
/**
* 销毁对象
*/
public void removeJS(SearchJS searchJS) {
private void remove(SearchJS searchJS) {
searchJSSet.remove(searchJS);
}
@ -78,10 +90,12 @@ public class SearchJSManager implements SearchAction {
return SearchJSActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
enum SearchJSActionEnum {
private enum SearchJSActionEnum {
/**
* 单例
*/

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

@ -149,7 +149,7 @@ public class SearchWebJSAction implements SearchJS {
/**
* 枚举实现单例
*/
enum SearchWebJSActionEnum {
private enum SearchWebJSActionEnum {
/**
* 单例
*/

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

@ -25,6 +25,9 @@ import java.util.List;
*/
public class SearchWidgetJSAction implements SearchJS {
private SearchWidgetJSAction() {
}
@Override
public void searchJSFromObject(JTemplate jTemplate, List<JSInfo> jsInfos) {
List<JSInfo> widgetJSInfos = new ArrayList<>();
@ -65,7 +68,7 @@ public class SearchWidgetJSAction implements SearchJS {
/**
* 枚举实现单例
*/
enum SearchWidgetJSActionEnum {
private enum SearchWidgetJSActionEnum {
/**
* 单例
*/

2
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/sql/SearchSQLAction.java

@ -119,7 +119,7 @@ public class SearchSQLAction implements SearchAction {
/**
* 枚举实现单例
*/
enum SearchSQLActionEnum {
private enum SearchSQLActionEnum {
/**
* 单例
*/

10
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/SearchWidgetAction.java

@ -36,6 +36,8 @@ import java.util.List;
public class SearchWidgetAction implements SearchAction {
List<WidgetInfo> widgetInfos;
private SearchWidgetAction() {
}
@Override
public void search4Infos(JTemplate jTemplate) {
@ -96,7 +98,10 @@ public class SearchWidgetAction implements SearchAction {
//处理HighlightAction
if (isHighlightWidgetExist(highlightAction)) {
ITContent content = ITContent.copy(cellInfo.getContent());
content.addOtherPos("条件属性-超链控件");
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"),
Toolkit.i18nText("Fine-Design_Report_Hyperlink"),
Toolkit.i18nText("Fine-Design_Basic_Widget"));
content.setReplaceObject(((WidgetHighlightAction) highlightAction).getWidget());
content.setShowObject(cellInfo.getContent().getReplaceObject());
widgetInfos.add(new WidgetInfo(content));
@ -140,6 +145,7 @@ public class SearchWidgetAction implements SearchAction {
Toolkit.i18nText("Fine-Design_Basic_Widget"),
widget.getWidgetName());
newContent.setReplaceObject(widget);
newContent.setJumpAble(false);
newContent.setShowObject(Toolkit.i18nText("Fine-Design_Parameter_Panel"));
widgetInfos.add(new WidgetInfo(newContent));
}
@ -176,7 +182,7 @@ public class SearchWidgetAction implements SearchAction {
/**
* 枚举实现单例
*/
enum SearchWidgetActionEnum {
private enum SearchWidgetActionEnum {
/**
* 单例
*/

3
designer-realize/src/main/java/com/fr/design/actions/replace/info/FormulaInfo.java

@ -23,6 +23,7 @@ public class FormulaInfo implements Info {
private ITContent content;
private static final String DISPLAY = Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary") + "-" + Toolkit.i18nText("Fine-Design_Chart_Formula") + "-" + Toolkit.i18nText("Fine-Design_Basic_Display_Value");
private static final String ACTUAL = Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary") + "-" + Toolkit.i18nText("Fine-Design_Chart_Formula") + "-" + Toolkit.i18nText("Fine-Design_Basic_Actual_Value");
public FormulaInfo(ITContent content) {
this.content = content;
}
@ -68,7 +69,7 @@ public class FormulaInfo implements Info {
}
private Map<String, String> getCommonValue() {
Map map = new HashMap();
Map<String, String> map = new HashMap();
FormulaReplaceObject o = FormulaReplaceObject.match(this.content.getReplaceObject().getClass().getSimpleName());
if (o != null) {
return o.getValue(this.content.getReplaceObject());

16
designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java

@ -62,6 +62,10 @@ public class ITContent implements Cloneable {
*/
private boolean selected = true;
/**
* 是否可跳转
*/
private boolean jumpAble = true;
public ITContent() {
this.sheetID = StringUtils.EMPTY;
@ -99,6 +103,7 @@ public class ITContent implements Cloneable {
result.setLastSearchStr(content.getLastSearchStr());
result.setOperatorArray(content.getOperatorArray());
result.setFrmFlag(content.isFrm());
result.setJumpAble(content.isJumpAble());
return result;
}
@ -260,6 +265,17 @@ public class ITContent implements Cloneable {
this.lastSearchStr = lastSearchStr;
}
public boolean isJumpAble() {
return jumpAble;
}
public void setJumpAble(boolean jumpAble) {
this.jumpAble = jumpAble;
}
public boolean isFrmFlag() {
return frmFlag;
}
@Override
public String toString() {

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

@ -42,17 +42,17 @@ public class ITReplaceNorthPanel {
private int maxItemCount = 5;
private int FIND_LABEL_X, FIND_LABEL_Y, FIND_LABEL_WIDTH, FIND_LABEL_HEIGHT;
private int FIND_COMBOBOX_X, FIND_COMBOBOX_Y, FIND_COMBOBOX_WIDTH, FIND_COMBOBOX_HEIGHT;
private int RANGE_LABEL_X, RANGE_LABEL_Y, RANGE_LABEL_WIDTH, RANGE_LABEL_HEIGHT;
private int RANGE_COMBOBOX_X, RANGE_COMBOBOX_Y, RANGE_COMBOBOX_WIDTH, RANGE_COMBOBOX_HEIGHT;
private int MATCH_X, MATCH_Y, MATCH_WIDTH, MATCH_HEIGHT;
private int RESULT_LABEL_X, RESULT_LABEL_Y, RESULT_LABEL_WIDTH, RESULT_LABEL_HEIGHT;
private int FIND_INPUT_COMBOBOX_X, FIND_INPUT_COMBOBOX_Y, FIND_INPUT_COMBOBOX_WIDTH, FIND_INPUT_COMBOBOX_HEIGHT;
private int findLabelX, findLabelY, findLabelWidth, findLabelHeight;
private int findComboBoxX, findComboBoxY, findComboBoxWidth, findComboBoxHeight;
private int rangeLabelX, rangeLabelY, rangeLabelWidth, rangeLabelHeight;
private int rangeComboBoxX, rangeComboBoxY, rangeComboBoxWidth, rangeComboBoxHeight;
private int matchX, matchY, matchWidth, matchHeight;
private int resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight;
private int findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight;
private int REPLACE_INPUT_COMBOBOX_X, REPLACE_INPUT_COMBOBOX_Y, REPLACE_INPUT_COMBOBOX_WIDTH, REPLACE_INPUT_COMBOBOX_HEIGHT;
private int REPLACE_BUTTON_X, REPLACE_BUTTON_Y, REPLACE_BUTTON_WIDTH, REPLACE_BUTTON_HEIGHT;
private int SEARCH_BUTTON_X, SEARCH_BUTTON_Y, SEARCH_BUTTON_WIDTH, SEARCH_BUTTON_HEIGHT;
private int BUTTON_GAP;
private int replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight;
private int searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight;
private int buttonGap;
public static ArrayList<String> findItems = new ArrayList<>();
public static ArrayList<String> findInputItems = new ArrayList<>();
@ -191,22 +191,22 @@ public class ITReplaceNorthPanel {
private void setSearchButtonBounds(int x, int y, int templateWidth) {
BUTTON_GAP = templateWidth / 90;
SEARCH_BUTTON_WIDTH = templateWidth / 30;
buttonGap = templateWidth / 90;
searchButtonWidth = templateWidth / 30;
SEARCH_BUTTON_HEIGHT = 25;
SEARCH_BUTTON_Y = RESULT_LABEL_Y;
SEARCH_BUTTON_X = REPLACE_INPUT_COMBOBOX_X + REPLACE_INPUT_COMBOBOX_WIDTH - REPLACE_BUTTON_WIDTH * 2 - BUTTON_GAP;
searchButton.setBounds(SEARCH_BUTTON_X, SEARCH_BUTTON_Y, SEARCH_BUTTON_WIDTH, SEARCH_BUTTON_HEIGHT);
searchButtonHeight = 25;
searchButtonY = resultLabelY;
searchButtonX = REPLACE_INPUT_COMBOBOX_X + REPLACE_INPUT_COMBOBOX_WIDTH - replaceButtonWidth * 2 - buttonGap;
searchButton.setBounds(searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight);
}
private void setReplaceButtonBounds(int x, int y, int templateWidth) {
BUTTON_GAP = templateWidth / 90;
REPLACE_BUTTON_WIDTH = templateWidth / 30;
REPLACE_BUTTON_HEIGHT = 25;
REPLACE_BUTTON_Y = RESULT_LABEL_Y;
REPLACE_BUTTON_X = REPLACE_INPUT_COMBOBOX_X + REPLACE_INPUT_COMBOBOX_WIDTH - REPLACE_BUTTON_WIDTH;
replaceButton.setBounds(REPLACE_BUTTON_X, REPLACE_BUTTON_Y, REPLACE_BUTTON_WIDTH, REPLACE_BUTTON_HEIGHT);
buttonGap = templateWidth / 90;
replaceButtonWidth = templateWidth / 30;
replaceButtonHeight = 25;
replaceButtonY = resultLabelY;
replaceButtonX = REPLACE_INPUT_COMBOBOX_X + REPLACE_INPUT_COMBOBOX_WIDTH - replaceButtonWidth;
replaceButton.setBounds(replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight);
}
private void setReplaceInputComboboxBounds(int x, int y, int templateWidth) {
@ -218,64 +218,64 @@ public class ITReplaceNorthPanel {
}
private void setFindInputComboboxBounds(int x, int y, int templateWidth) {
FIND_INPUT_COMBOBOX_X = x + templateWidth / 60;
FIND_INPUT_COMBOBOX_Y = y + 55;
FIND_INPUT_COMBOBOX_WIDTH = templateWidth / 3 + templateWidth / 30 * 2;
FIND_INPUT_COMBOBOX_HEIGHT = 25;
findInputCombobox.setBounds(FIND_INPUT_COMBOBOX_X, FIND_INPUT_COMBOBOX_Y, FIND_INPUT_COMBOBOX_WIDTH, FIND_INPUT_COMBOBOX_HEIGHT);
findInputComboBoxX = x + templateWidth / 60;
findInputComboBoxY = y + 55;
findInputComboBoxWidth = templateWidth / 3 + templateWidth / 30 * 2;
findInputComboBoxHeight = 25;
findInputCombobox.setBounds(findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight);
}
private void setUIRadioButtonBounds(int x, int y, int templateWidth) {
MATCH_X = x + templateWidth / 60;
MATCH_Y = y + 90;
MATCH_WIDTH = templateWidth;
MATCH_HEIGHT = 25;
matchRadioButton.setBounds(MATCH_X, MATCH_Y, MATCH_WIDTH, MATCH_HEIGHT);
matchX = x + templateWidth / 60;
matchY = y + 90;
matchWidth = templateWidth;
matchHeight = 25;
matchRadioButton.setBounds(matchX, matchY, matchWidth, matchHeight);
}
private void setRangeComboboxBounds(int x, int y, int templateWidth) {
RANGE_COMBOBOX_X = x + templateWidth / 2 + templateWidth / 15 + templateWidth / 60;
RANGE_COMBOBOX_Y = y + 20;
RANGE_COMBOBOX_WIDTH = templateWidth / 3 + templateWidth / 60;
RANGE_COMBOBOX_HEIGHT = 25;
rangeCombobox.setBounds(RANGE_COMBOBOX_X, RANGE_COMBOBOX_Y, RANGE_COMBOBOX_WIDTH, RANGE_COMBOBOX_HEIGHT);
rangeComboBoxX = x + templateWidth / 2 + templateWidth / 15 + templateWidth / 60;
rangeComboBoxY = y + 20;
rangeComboBoxWidth = templateWidth / 3 + templateWidth / 60;
rangeComboBoxHeight = 25;
rangeCombobox.setBounds(rangeComboBoxX, rangeComboBoxY, rangeComboBoxWidth, rangeComboBoxHeight);
}
private void setFindComboboxBounds(int x, int y, int templateWidth) {
FIND_COMBOBOX_X = x + templateWidth / 30 * 2;
FIND_COMBOBOX_Y = y + 20;
FIND_COMBOBOX_WIDTH = templateWidth / 3 + templateWidth / 60;
FIND_COMBOBOX_HEIGHT = 25;
findCombobox.setBounds(FIND_COMBOBOX_X, FIND_COMBOBOX_Y, FIND_COMBOBOX_WIDTH, FIND_COMBOBOX_HEIGHT);
findComboBoxX = x + templateWidth / 30 * 2;
findComboBoxY = y + 20;
findComboBoxWidth = templateWidth / 3 + templateWidth / 60;
findComboBoxHeight = 25;
findCombobox.setBounds(findComboBoxX, findComboBoxY, findComboBoxWidth, findComboBoxHeight);
}
private void setResultLabelBounds(int x, int y, int templateWidth) {
RESULT_LABEL_X = FIND_LABEL_X;
RESULT_LABEL_Y = y + 125;
RESULT_LABEL_WIDTH = templateWidth;
RESULT_LABEL_HEIGHT = 25;
resultLabel.setBounds(RESULT_LABEL_X, RESULT_LABEL_Y, RESULT_LABEL_WIDTH, RESULT_LABEL_HEIGHT);
resultLabelX = findLabelX;
resultLabelY = y + 125;
resultLabelWidth = templateWidth;
resultLabelHeight = 25;
resultLabel.setBounds(resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight);
}
private void setRangeLabelBounds(int x, int y, int templateWidth) {
RANGE_LABEL_X = x + templateWidth / 2 + templateWidth / 30;
RANGE_LABEL_Y = y + 20;
RANGE_LABEL_WIDTH = FIND_LABEL_WIDTH;
RANGE_LABEL_HEIGHT = 25;
rangeLabel.setBounds(RANGE_LABEL_X, RANGE_LABEL_Y, RANGE_LABEL_WIDTH, RANGE_LABEL_HEIGHT);
rangeLabelX = x + templateWidth / 2 + templateWidth / 30;
rangeLabelY = y + 20;
rangeLabelWidth = findLabelWidth;
rangeLabelHeight = 25;
rangeLabel.setBounds(rangeLabelX, rangeLabelY, rangeLabelWidth, rangeLabelHeight);
}
private void setFindLabelBounds(int x, int y, int templateWidth) {
FIND_LABEL_X = x + templateWidth / 60;
FIND_LABEL_Y = y + 20;
FIND_LABEL_WIDTH = templateWidth / 20;
FIND_LABEL_HEIGHT = 25;
findLabel.setBounds(FIND_LABEL_X, FIND_LABEL_Y, FIND_LABEL_WIDTH, FIND_LABEL_HEIGHT);
findLabelX = x + templateWidth / 60;
findLabelY = y + 20;
findLabelWidth = templateWidth / 20;
findLabelHeight = 25;
findLabel.setBounds(findLabelX, findLabelY, findLabelWidth, findLabelHeight);
}
public JPanel getUpPanel() {

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

@ -60,6 +60,8 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
*/
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
ITContent content = (ITContent) table.getValueAt(row, 7);
paraButton.setEnabled(content.isJumpAble());
return paraButton;
}
@ -76,6 +78,8 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
*/
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
ITContent content = (ITContent) table.getValueAt(row, 7);
paraButton.setEnabled(content.isJumpAble());
return paraButton;
}

Loading…
Cancel
Save