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