Browse Source

REPORT-75998 完善控件公式

feature/x
Destiny.Lin 2 years ago
parent
commit
a0c4924612
  1. 16
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java
  2. 15
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchExportJSFormulaAction.java
  3. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java
  4. 40
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java

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

@ -1,5 +1,6 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript; package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
import com.fr.base.Formula;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionFormula; import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionFormula;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionManager; 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.FormulaInfo;
@ -10,6 +11,7 @@ import com.fr.js.Commit2DBJavaScript;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.write.DBManipulation; import com.fr.write.DBManipulation;
import com.fr.write.DMLConfigJob; import com.fr.write.DMLConfigJob;
import com.fr.write.config.ColumnConfig;
import com.fr.write.config.DMLConfig; import com.fr.write.config.DMLConfig;
import java.util.List; import java.util.List;
@ -41,12 +43,26 @@ public class SearchCommit2DBJSFormulaAction implements SearchJSFormula {
private void dealWithDBManipulation(List<FormulaInfo> formulaInfos, ITContent content, DBManipulation dbManipulation) { private void dealWithDBManipulation(List<FormulaInfo> formulaInfos, ITContent content, DBManipulation dbManipulation) {
DMLConfig dmlConfig = dbManipulation.getDmlConfig(); DMLConfig dmlConfig = dbManipulation.getDmlConfig();
//值中的公式
dealWithColumnValue(formulaInfos, content, dmlConfig);
//处理提交条件中的公式 //处理提交条件中的公式
dealWithCommit2DBCondition(formulaInfos, content, dmlConfig); dealWithCommit2DBCondition(formulaInfos, content, dmlConfig);
//处理DBManipulation //处理DBManipulation
dealWithSubmitJob(formulaInfos, content, dmlConfig); dealWithSubmitJob(formulaInfos, content, dmlConfig);
} }
private void dealWithColumnValue(List<FormulaInfo> formulaInfos, ITContent content, DMLConfig dmlConfig) {
for (int i = 0; i < dmlConfig.getColumnConfigCount(); i++) {
ColumnConfig columnConfig = dmlConfig.getColumnConfig(i);
if (columnConfig.getColumnValue() instanceof Formula) {
ITContent configContent = ITContent.copy(content);
configContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Base_Value"));
configContent.setReplaceObject(columnConfig.getColumnValue());
formulaInfos.add(new FormulaInfo(configContent));
}
}
}
private void dealWithSubmitJob(List<FormulaInfo> formulaInfos, ITContent content, DMLConfig dmlConfig) { private void dealWithSubmitJob(List<FormulaInfo> formulaInfos, ITContent content, DMLConfig dmlConfig) {
for (int i = 0; i < dmlConfig.getSubmitJobCount(); i++) { for (int i = 0; i < dmlConfig.getSubmitJobCount(); i++) {
//这边自定义事件不需要处理,只处理提交事件 //这边自定义事件不需要处理,只处理提交事件

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

@ -1,11 +1,14 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript; package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
import com.fr.base.Formula;
import com.fr.base.Parameter;
import com.fr.design.actions.replace.info.FormulaInfo; import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent; import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.js.ExportJavaScript; import com.fr.js.ExportJavaScript;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.js.SingleJavaScript; import com.fr.js.SingleJavaScript;
import com.fr.stable.ParameterProvider;
import java.util.List; import java.util.List;
@ -26,8 +29,10 @@ public class SearchExportJSFormulaAction implements SearchJSFormula {
public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) { public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
//如果导出当前模板,可以存公式的地方就是命名方式-自定义 //如果导出当前模板,可以存公式的地方就是命名方式-自定义
if (((ExportJavaScript) javaScript).isCurrentTemplate()) { if (((ExportJavaScript) javaScript).isCurrentTemplate()) {
content.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current"));
dealSingleJavaScript(formulaInfos, content, ((ExportJavaScript) javaScript).getCurrentTemplateJavaScript()); dealSingleJavaScript(formulaInfos, content, ((ExportJavaScript) javaScript).getCurrentTemplateJavaScript());
} else { } else {
content.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other"));
List<SingleJavaScript> list = ((ExportJavaScript) javaScript).getJsListForOtherTemplates(); List<SingleJavaScript> list = ((ExportJavaScript) javaScript).getJsListForOtherTemplates();
if (isListExist(list)) { if (isListExist(list)) {
for (SingleJavaScript singleJavaScript : list) { for (SingleJavaScript singleJavaScript : list) {
@ -51,6 +56,16 @@ public class SearchExportJSFormulaAction implements SearchJSFormula {
); );
formulaInfos.add(new FormulaInfo(newContent)); formulaInfos.add(new FormulaInfo(newContent));
} }
if (!javaScript.isExtendParameters()) {
ITContent paraContent = ITContent.copy(content);
for (ParameterProvider parameter : javaScript.getParameters()) {
if (parameter.getValue() instanceof Formula) {
paraContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Base_Value"));
paraContent.setReplaceObject(parameter.getValue());
formulaInfos.add(new FormulaInfo(paraContent));
}
}
}
} }
/** /**

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

@ -34,7 +34,7 @@ public class SearchDateEditorFormulaAction extends AbstractSearchWidgetFormulaAc
if (dateEditor.getEndDateFM() != null && StringUtils.isNotEmpty(dateEditor.getEndDateFM().getContent())) { if (dateEditor.getEndDateFM() != null && StringUtils.isNotEmpty(dateEditor.getEndDateFM().getContent())) {
ITContent newContent = ITContent.copy(content); ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(dateEditor.getEndDateFM()); newContent.setReplaceObject(dateEditor.getEndDateFM());
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_End_Time")); newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_FS_End_Date"));
formulaInfos.add(new FormulaInfo(newContent)); formulaInfos.add(new FormulaInfo(newContent));
} }
} }
@ -44,7 +44,7 @@ public class SearchDateEditorFormulaAction extends AbstractSearchWidgetFormulaAc
if (dateEditor.getStartDateFM() != null && StringUtils.isNotEmpty(dateEditor.getStartDateFM().getContent())) { if (dateEditor.getStartDateFM() != null && StringUtils.isNotEmpty(dateEditor.getStartDateFM().getContent())) {
ITContent newContent = ITContent.copy(content); ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(dateEditor.getStartDateFM()); newContent.setReplaceObject(dateEditor.getStartDateFM());
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Start_Time")); newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_FS_Start_Date"));
formulaInfos.add(new FormulaInfo(newContent)); formulaInfos.add(new FormulaInfo(newContent));
} }
} }

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

@ -1,11 +1,15 @@
package com.fr.design.actions.replace.action.content.formula.widget; package com.fr.design.actions.replace.action.content.formula.widget;
import com.fr.data.Dictionary;
import com.fr.data.impl.FormulaDictionary;
import com.fr.data.impl.FormulaDisplayDictionary; import com.fr.data.impl.FormulaDisplayDictionary;
import com.fr.data.impl.TableDataDictionary;
import com.fr.data.impl.TreeNodeAttr; import com.fr.data.impl.TreeNodeAttr;
import com.fr.data.impl.TreeNodeWrapper; import com.fr.data.impl.TreeNodeWrapper;
import com.fr.design.actions.replace.info.FormulaInfo; import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent; import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.form.ui.DictionaryContainer;
import com.fr.form.ui.TreeEditor; import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.tree.LayerConfig; import com.fr.form.ui.tree.LayerConfig;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -37,28 +41,38 @@ public class SearchTreeEditorFormulaAction extends AbstractSearchWidgetFormulaAc
if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() != null) { if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() != null) {
//LayerConfig[] 急速分层构建 //LayerConfig[] 急速分层构建
//TreeNodeWrapper 普通分层构建 //TreeNodeWrapper 普通分层构建
if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() instanceof LayerConfig[]) { //TableDataDictionary 自动构建
LayerConfig[] layerConfigs = (LayerConfig[]) ((TreeEditor) content.getReplaceObject()).getBuildModelConfig(); Object object = ((TreeEditor) content.getReplaceObject()).getBuildModelConfig();
if (object instanceof LayerConfig[]) {
LayerConfig[] layerConfigs = (LayerConfig[]) object;
dealWithLayerConfigs(layerConfigs, content, formulaInfos); dealWithLayerConfigs(layerConfigs, content, formulaInfos);
} else if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() instanceof TreeNodeWrapper) { } else if (object instanceof TreeNodeWrapper) {
TreeNodeWrapper wrapper = (TreeNodeWrapper) ((TreeEditor) content.getReplaceObject()).getBuildModelConfig(); TreeNodeWrapper wrapper = (TreeNodeWrapper) object;
dealWithTreeNodeWrapper(wrapper, content, formulaInfos); dealWithTreeNodeWrapper(wrapper, content, formulaInfos);
} else if (object instanceof TableDataDictionary) {
TableDataDictionary tableDataDictionary = (TableDataDictionary) object;
if (tableDataDictionary.getFormula() != null) {
ITContent autoContent = ITContent.copy(content);
autoContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Auto_Build"),
Toolkit.i18nText("Fine-Design_Basic_Display_Value")
);
autoContent.setReplaceObject(tableDataDictionary.getFormula());
formulaInfos.add(new FormulaInfo(autoContent));
}
} }
} }
} }
} }
private void dealWithTreeNodeWrapper(TreeNodeWrapper wrapper, ITContent content, List<FormulaInfo> formulaInfos) { private void dealWithTreeNodeWrapper(TreeNodeWrapper wrapper, ITContent content, List<FormulaInfo> formulaInfos) {
for (TreeNodeAttr attr : wrapper.getTreeNodeAttrs()) { for (TreeNodeAttr attr : wrapper.getTreeNodeAttrs()) {
if (((FormulaDisplayDictionary) attr.getDictionary()).getFormula() != null if (attr.getDictionary() != null) {
&& StringUtils.isNotEmpty(((FormulaDisplayDictionary) attr.getDictionary()).getFormula().getContent())) { DictionaryType type = DictionaryType.match(attr.getDictionary().getClass().getSimpleName());
ITContent newContent = ITContent.copy(content); if (type != null) {
newContent.setReplaceObject(((FormulaDisplayDictionary) attr.getDictionary()).getFormula()); type.searchFormulaFromDictionary(content, formulaInfos, attr.getDictionary());
newContent.addOtherPos( }
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Layer_Build")
);
formulaInfos.add(new FormulaInfo(newContent));
} }
} }
} }

Loading…
Cancel
Save