Destiny.Lin
2 years ago
50 changed files with 1743 additions and 318 deletions
@ -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){}; |
||||
} |
@ -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; |
||||
} |
||||
} |
||||
|
||||
} |
@ -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; |
||||
} |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
||||
|
||||
} |
@ -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; |
||||
} |
||||
} |
||||
|
||||
} |
@ -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; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue