Destiny.Lin
2 years ago
7 changed files with 483 additions and 0 deletions
@ -0,0 +1,79 @@ |
|||||||
|
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.Info; |
||||||
|
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.DataControl; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Destiny.Lin |
||||||
|
* @version 11.0 |
||||||
|
* created by Destiny.Lin on 2022-08-19 |
||||||
|
*/ |
||||||
|
public abstract class AbstractSearchWidgetFormulaAction implements SearchWidgetFormula { |
||||||
|
|
||||||
|
/** |
||||||
|
* 用于处理控件共有的事件以及控件值中的公式 |
||||||
|
* |
||||||
|
* @param content |
||||||
|
* @param formulaInfos |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public void searchFormulaFromWidget(ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
Widget widget = (Widget) content.getReplaceObject(); |
||||||
|
//控件值中的公式
|
||||||
|
searchFormulaFromWidgetValue(content,formulaInfos); |
||||||
|
for (int i = 0 ; i < widget.getListenerSize() ;i++){ |
||||||
|
Listener listener = widget.getListener(i); |
||||||
|
ITContent newContent = content.copy(); |
||||||
|
newContent.getContentObject().setListener(listener); |
||||||
|
//控件的事件可以使用的JS有五种,这边统一交给Highlight那边判断超级链接并进行处理
|
||||||
|
SearchJSHighlightAction SJSA = new SearchJSHighlightAction(); |
||||||
|
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Event")); |
||||||
|
SJSA.searchJSFormulaFromOther(formulaInfos,newContent, listener.getAction()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 判断一下控件有没有控件值接口,如果有再判断一下控件值是否已经设置并且是公式 |
||||||
|
* @param content |
||||||
|
* @param formulaInfos |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public void searchFormulaFromWidgetValue(ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
if(content.getReplaceObject() instanceof DataControl){ |
||||||
|
if (((DataControl) content.getReplaceObject()).getWidgetValue() != null |
||||||
|
&& ((DataControl) content.getReplaceObject()).getWidgetValue().getValue() instanceof Formula){ |
||||||
|
ITContent newContent = content.copy(); |
||||||
|
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Widget_Value")); |
||||||
|
newContent.setReplaceObject(((DataControl)content.getReplaceObject()).getWidgetValue().getValue()); |
||||||
|
formulaInfos.add(new FormulaInfo(newContent)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void searchFormulaFromWidgetInfos(WidgetInfo widgetInfo, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void searchFormula(ArrayList<FormulaInfo> formulaInfos, ITContent content) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public ArrayList<? extends Info> search4Infos(JTemplate jTemplate) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,114 @@ |
|||||||
|
package com.fr.design.actions.replace.action.content.formula.widget; |
||||||
|
|
||||||
|
import com.fr.data.Dictionary; |
||||||
|
import com.fr.data.impl.DatabaseDictionary; |
||||||
|
import com.fr.data.impl.FormulaDictionary; |
||||||
|
import com.fr.data.impl.TableDataDictionary; |
||||||
|
import com.fr.design.actions.replace.info.FormulaInfo; |
||||||
|
import com.fr.design.actions.replace.info.base.ITContent; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import org.jetbrains.annotations.Nullable; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
|
||||||
|
/** |
||||||
|
* 数据字典处理 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @version 11.0 |
||||||
|
* created by Destiny.Lin on 2022-08-22 |
||||||
|
*/ |
||||||
|
enum DictionaryType implements DictionaryAction { |
||||||
|
|
||||||
|
/** |
||||||
|
* 数据字典——公式 |
||||||
|
*/ |
||||||
|
FORMULA_DICTIONARY("FormulaDictionary") { |
||||||
|
@Override |
||||||
|
public void searchFormulaFromDictionary(ITContent content, ArrayList<FormulaInfo> formulaInfos, Dictionary dictionary) { |
||||||
|
//显示值
|
||||||
|
if (((FormulaDictionary) dictionary).getExcuteFormula() != null) { |
||||||
|
ITContent excuteContent = content.copy(); |
||||||
|
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 = content.copy(); |
||||||
|
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)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
/** |
||||||
|
* 数据查询 |
||||||
|
*/ |
||||||
|
TABLE_DATA_DICTIONARY("TableDataDictionary") { |
||||||
|
@Override |
||||||
|
public void searchFormulaFromDictionary(ITContent content, ArrayList<FormulaInfo> formulaInfos, Dictionary dictionary) { |
||||||
|
if (((TableDataDictionary) dictionary).getFormula() != null) { |
||||||
|
ITContent newContent = content.copy(); |
||||||
|
newContent.setReplaceObject(((TableDataDictionary) dictionary).getFormula()); |
||||||
|
newContent.addOtherPos( |
||||||
|
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"), |
||||||
|
Toolkit.i18nText("Fine-Design_Basic_Dic_Data_Query"), |
||||||
|
Toolkit.i18nText("Fine-Design_Basic_Display_Value") |
||||||
|
); |
||||||
|
formulaInfos.add(new FormulaInfo(newContent)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
/** |
||||||
|
* 数据库表 |
||||||
|
*/ |
||||||
|
DATABASE_DICTIONARY("DatabaseDictionary") { |
||||||
|
@Override |
||||||
|
public void searchFormulaFromDictionary(ITContent content, ArrayList<FormulaInfo> formulaInfos, Dictionary dictionary) { |
||||||
|
if (((DatabaseDictionary) dictionary).getFormula() != null) { |
||||||
|
ITContent newContent = content.copy(); |
||||||
|
newContent.setReplaceObject(((DatabaseDictionary) dictionary).getFormula()); |
||||||
|
newContent.addOtherPos( |
||||||
|
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"), |
||||||
|
Toolkit.i18nText("Fine-Design_Basic_Datasource_From_Database"), |
||||||
|
Toolkit.i18nText("Fine-Design_Basic_Display_Value") |
||||||
|
); |
||||||
|
formulaInfos.add(new FormulaInfo(newContent)); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
String name; |
||||||
|
|
||||||
|
DictionaryType(String name) { |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 匹配 |
||||||
|
* |
||||||
|
* @param name |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@Nullable |
||||||
|
public static DictionaryType match(String name) { |
||||||
|
DictionaryType[] values = DictionaryType.values(); |
||||||
|
for (DictionaryType value : values) { |
||||||
|
if (value.name.equals(name)) { |
||||||
|
return value; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package com.fr.design.actions.replace.action.content.formula.widget; |
||||||
|
|
||||||
|
import com.fr.design.actions.replace.info.FormulaInfo; |
||||||
|
import com.fr.design.actions.replace.info.base.ITContent; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
|
||||||
|
/** |
||||||
|
* 控件中的公式只会在事件、控件值 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @version 11.0 |
||||||
|
* created by Destiny.Lin on 2022-08-19 |
||||||
|
*/ |
||||||
|
public class SearchCommonWidgetFormulaAction extends AbstractSearchWidgetFormulaAction { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void searchFormulaFromWidget(ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
//每个事件的事件、控件值两部分的公式获取逻辑是一样的,直接调用即可,各自其他地方的公式就需要特殊处理
|
||||||
|
super.searchFormulaFromWidget(content, formulaInfos); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,46 @@ |
|||||||
|
package com.fr.design.actions.replace.action.content.formula.widget; |
||||||
|
|
||||||
|
import com.fr.design.actions.replace.info.FormulaInfo; |
||||||
|
import com.fr.design.actions.replace.info.base.ITContent; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.form.ui.DateEditor; |
||||||
|
import org.gradle.internal.impldep.org.apache.commons.lang.StringUtils; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
|
||||||
|
/** |
||||||
|
* 日期类型控件特殊处理 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @version 11.0 |
||||||
|
* created by Destiny.Lin on 2022-08-26 |
||||||
|
*/ |
||||||
|
public class SearchDateEditorFormulaAction extends AbstractSearchWidgetFormulaAction { |
||||||
|
@Override |
||||||
|
public void searchFormulaFromWidget(ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
super.searchFormulaFromWidget(content, formulaInfos); |
||||||
|
dealStratDateFormula(content, formulaInfos); |
||||||
|
dealEndDateFormula(content, formulaInfos); |
||||||
|
} |
||||||
|
|
||||||
|
private void dealEndDateFormula(ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
DateEditor dateEditor = (DateEditor) content.getReplaceObject(); |
||||||
|
if (dateEditor.getEndDateFM() != null && !StringUtils.isEmpty(dateEditor.getEndDateFM().getContent())) { |
||||||
|
ITContent newContent = content.copy(); |
||||||
|
newContent.setReplaceObject(dateEditor.getEndDateFM()); |
||||||
|
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_End_Time")); |
||||||
|
formulaInfos.add(new FormulaInfo(newContent)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void dealStratDateFormula(ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
DateEditor dateEditor = (DateEditor) content.getReplaceObject(); |
||||||
|
if (dateEditor.getStartDateFM() != null && !StringUtils.isEmpty(dateEditor.getStartDateFM().getContent())) { |
||||||
|
ITContent newContent = content.copy(); |
||||||
|
newContent.setReplaceObject(dateEditor.getStartDateFM()); |
||||||
|
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Start_Time")); |
||||||
|
formulaInfos.add(new FormulaInfo(newContent)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
package com.fr.design.actions.replace.action.content.formula.widget; |
||||||
|
|
||||||
|
import com.fr.design.actions.replace.info.FormulaInfo; |
||||||
|
import com.fr.design.actions.replace.info.base.ITContent; |
||||||
|
import com.fr.form.ui.DictionaryContainer; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
|
||||||
|
/** |
||||||
|
* 控件中的公式会存在: 控件值、 非树形结构数据字典、 事件 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @version 11.0 |
||||||
|
* created by Destiny.Lin on 2022-08-20 |
||||||
|
*/ |
||||||
|
public class SearchDictFormulaAction extends AbstractSearchWidgetFormulaAction { |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void searchFormulaFromWidget(ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
//控件值、事件
|
||||||
|
super.searchFormulaFromWidget(content, formulaInfos); |
||||||
|
//数据字典
|
||||||
|
searchFormulaFromDict(content, formulaInfos); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void searchFormulaFromDict(ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
if (content.getReplaceObject() instanceof DictionaryContainer) { |
||||||
|
if (((DictionaryContainer) content.getReplaceObject()).getDictionary() != null) { |
||||||
|
DictionaryType type = DictionaryType.match(((DictionaryContainer) content.getReplaceObject()).getDictionary().getClass().getSimpleName()); |
||||||
|
if (type != null) { |
||||||
|
type.searchFormulaFromDictionary(content, formulaInfos, ((DictionaryContainer) content.getReplaceObject()).getDictionary()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,75 @@ |
|||||||
|
package com.fr.design.actions.replace.action.content.formula.widget; |
||||||
|
|
||||||
|
import com.fr.data.impl.DatabaseDictionary; |
||||||
|
import com.fr.data.impl.FormulaDisplayDictionary; |
||||||
|
import com.fr.data.impl.TableDataDictionary; |
||||||
|
import com.fr.data.impl.TreeNodeAttr; |
||||||
|
import com.fr.data.impl.TreeNodeWrapper; |
||||||
|
import com.fr.design.actions.replace.info.FormulaInfo; |
||||||
|
import com.fr.design.actions.replace.info.base.ITContent; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.form.ui.TreeEditor; |
||||||
|
import com.fr.form.ui.tree.LayerConfig; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Destiny.Lin |
||||||
|
* @version 11.0 |
||||||
|
* created by Destiny.Lin on 2022-08-22 |
||||||
|
*/ |
||||||
|
public class SearchTreeEditorFormulaAction extends AbstractSearchWidgetFormulaAction { |
||||||
|
@Override |
||||||
|
public void searchFormulaFromWidget(ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
//控件值、事件
|
||||||
|
super.searchFormulaFromWidget(content, formulaInfos); |
||||||
|
//树形结构数据字典
|
||||||
|
SearchFormulaFromModelConfig(content, formulaInfos); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void SearchFormulaFromModelConfig(ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() != null) { |
||||||
|
//LayerConfig[] 急速分层构建
|
||||||
|
//TreeNodeWrapper 普通分层构建
|
||||||
|
if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() instanceof LayerConfig[]) { |
||||||
|
LayerConfig[] layerConfigs = (LayerConfig[]) ((TreeEditor) content.getReplaceObject()).getBuildModelConfig(); |
||||||
|
dealWithLayerConfigs(layerConfigs, content, formulaInfos); |
||||||
|
} else if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() instanceof TreeNodeWrapper) { |
||||||
|
TreeNodeWrapper wrapper = (TreeNodeWrapper) ((TreeEditor) content.getReplaceObject()).getBuildModelConfig(); |
||||||
|
dealWithTreeNodeWrapper(wrapper, content, formulaInfos); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void dealWithTreeNodeWrapper(TreeNodeWrapper wrapper, ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
for (TreeNodeAttr attr : wrapper.getTreeNodeAttrs()) { |
||||||
|
if (((FormulaDisplayDictionary) attr.getDictionary()).getFormula() != null |
||||||
|
&& !StringUtils.isEmpty(((FormulaDisplayDictionary) attr.getDictionary()).getFormula().getContent())) { |
||||||
|
ITContent newContent = content.copy(); |
||||||
|
newContent.setReplaceObject(((FormulaDisplayDictionary) attr.getDictionary()).getFormula()); |
||||||
|
newContent.addOtherPos( |
||||||
|
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"), |
||||||
|
Toolkit.i18nText("Fine-Design_Basic_Layer_Build") |
||||||
|
); |
||||||
|
formulaInfos.add(new FormulaInfo(newContent)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void dealWithLayerConfigs(LayerConfig[] layerConfigs, ITContent content, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
for (LayerConfig layerConfig : layerConfigs) { |
||||||
|
if (layerConfig.getDictionary().getFormula() != null |
||||||
|
&& !StringUtils.isEmpty(layerConfig.getDictionary().getFormula().getContent())) { |
||||||
|
ITContent newContent = content.copy(); |
||||||
|
newContent.setReplaceObject(layerConfig.getDictionary().getFormula()); |
||||||
|
newContent.addOtherPos( |
||||||
|
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"), |
||||||
|
Toolkit.i18nText("Fine-Design_Basic_DataTable_Build") |
||||||
|
); |
||||||
|
formulaInfos.add(new FormulaInfo(newContent)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,108 @@ |
|||||||
|
package com.fr.design.actions.replace.action.content.formula.widget; |
||||||
|
|
||||||
|
import com.fr.design.actions.replace.action.content.widget.SearchWidgetAction; |
||||||
|
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.mainframe.JTemplate; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.HashMap; |
||||||
|
|
||||||
|
/** |
||||||
|
* 查找控件内的公式 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @version 11.0 |
||||||
|
* created by Destiny.Lin on 2022-08-19 |
||||||
|
*/ |
||||||
|
public class SearchWidgetFormulaAction extends AbstractSearchWidgetFormulaAction { |
||||||
|
public static HashMap<String,SearchWidgetFormula> widgetHashMap = new HashMap<>(); |
||||||
|
static { |
||||||
|
//WParameterLayout
|
||||||
|
//PageFixedRowComboBox
|
||||||
|
//FormSubmitButton
|
||||||
|
//TreeEditor
|
||||||
|
//CheckBox
|
||||||
|
//Password
|
||||||
|
//TextArea
|
||||||
|
//CheckBoxGroup
|
||||||
|
//RadioGroup
|
||||||
|
//TreeComboBoxEditor
|
||||||
|
//NumberEditor
|
||||||
|
//DateEditor
|
||||||
|
//ComboCheckBox
|
||||||
|
//ComboBox
|
||||||
|
//FreeButton
|
||||||
|
//Label
|
||||||
|
/** |
||||||
|
* 可能有控件值、 有事件 |
||||||
|
*/ |
||||||
|
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("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()); |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public SearchWidgetFormulaAction(JTemplate jTemplate,ArrayList<FormulaInfo> fomulaInfos){ |
||||||
|
fomulaInfos.addAll(search4Infos(jTemplate)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public ArrayList<FormulaInfo> search4Infos(JTemplate jTemplate) { |
||||||
|
ArrayList<FormulaInfo> formulaInfos = new ArrayList<>(); |
||||||
|
SearchWidgetAction searchWidgetAction = new SearchWidgetAction(jTemplate); |
||||||
|
if (!searchWidgetAction.isWidgetInfosEmpty()){ |
||||||
|
for (WidgetInfo widgetInfo : searchWidgetAction.getWidgetInfos()){ |
||||||
|
//由于控件类型比较多,各种控件也不大相同,可能存放公式的地方也都不一样,这边根据对应的类型进行处理
|
||||||
|
searchFormulaFromWidgetInfos(widgetInfo,formulaInfos); |
||||||
|
} |
||||||
|
} |
||||||
|
return formulaInfos; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void searchFormulaFromWidgetInfos(WidgetInfo widgetInfo, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
if (widgetInfo.isReplaceObjectExist()){ |
||||||
|
searchFormulaFromWidgetValue(widgetInfo,formulaInfos); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void searchFormulaFromWidgetValue(WidgetInfo widgetInfo, ArrayList<FormulaInfo> formulaInfos) { |
||||||
|
Widget widget = (Widget)widgetInfo.getContent().getReplaceObject(); |
||||||
|
if (widgetHashMap.containsKey(widget.getClass().getSimpleName())){ |
||||||
|
SearchWidgetFormula searchWidgetFormula = widgetHashMap.get(widget.getClass().getSimpleName()); |
||||||
|
ITContent content = widgetInfo.getContent().copy(); |
||||||
|
searchWidgetFormula.searchFormulaFromWidget(content,formulaInfos); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue