Browse Source

REPORT-140634 【数据集替换】下拉树和视图树的数据集替换都不行

release/11.0
Destiny.Lin 2 weeks ago
parent
commit
8cc71df412
  1. 43
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java

43
designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java

@ -11,6 +11,8 @@ import com.fr.data.condition.ListCondition;
import com.fr.data.core.Compare;
import com.fr.data.impl.NameTableData;
import com.fr.data.impl.TableDataDictionary;
import com.fr.data.impl.TreeNodeAttr;
import com.fr.data.impl.TreeNodeWrapper;
import com.fr.design.actions.replace.action.content.cell.SearchCellAction;
import com.fr.design.actions.replace.action.content.formula.SearchFormulaManager;
import com.fr.design.actions.replace.action.content.formula.cell.SearchCellFormulaAction;
@ -30,8 +32,10 @@ import com.fr.form.data.DataBinding;
import com.fr.form.ui.DataControl;
import com.fr.form.ui.DictionaryContainer;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.form.ui.tree.LayerConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.data.Condition;
import com.fr.general.data.TableDataColumn;
@ -542,6 +546,10 @@ public class ReplaceUtils {
private static void replaceWidget(Widget widget, List<TableReplacementEntity> entities) {
if (widget instanceof DictionaryContainer) {
DictionaryContainer db = (DictionaryContainer) widget;
if (widget instanceof TreeEditor) {
Object config = ((TreeEditor) widget).getBuildModelConfig();
replaceTreeConfig(config, entities);
}
if (db.getDictionary() instanceof TableDataDictionary) {
TableDataDictionary tdd = (TableDataDictionary) db.getDictionary();
NameTableData ndd = (NameTableData) tdd.getTableData();
@ -563,6 +571,41 @@ public class ReplaceUtils {
}
}
private static void replaceTreeConfig(Object config, List<TableReplacementEntity> entities) {
if (config instanceof LayerConfig[]) {
LayerConfig[] layerConfigs = (LayerConfig[]) config;
dealWithLayerConfigs(layerConfigs, entities);
} else if (config instanceof TreeNodeWrapper) {
TreeNodeWrapper wrapper = (TreeNodeWrapper) config;
dealWithTreeNodeWrapper(wrapper, entities);
} else if (config instanceof TableDataDictionary) {
TableDataDictionary tableDataDictionary = (TableDataDictionary) config;
ElementCaseHelper.replaceTableDataDictionary(tableDataDictionary, (NameTableData) tableDataDictionary.getTableData(), entities);
}
}
private static void dealWithTreeNodeWrapper(TreeNodeWrapper wrapper, List<TableReplacementEntity> entities) {
for (TreeNodeAttr attr : wrapper.getTreeNodeAttrs()) {
if (attr.getDictionary() instanceof TableDataDictionary) {
TableDataDictionary tableDataDictionary = (TableDataDictionary) attr.getDictionary();
ElementCaseHelper.replaceTableDataDictionary(tableDataDictionary, (NameTableData) tableDataDictionary.getTableData(), entities);
}
}
}
private static void dealWithLayerConfigs(LayerConfig[] layerConfigs, List<TableReplacementEntity> entities) {
for (LayerConfig layerConfig : layerConfigs) {
if (layerConfig.getDictionary() != null ) {
for (TableReplacementEntity entity : entities) {
if (layerConfig.getTableData() instanceof NameTableData && StringUtils.equals(layerConfig.getTableData().getName(), entity.getOldName())) {
layerConfig.setTableData(new NameTableData(entity.getNewName()));
}
}
ElementCaseHelper.replaceTableDataDictionary(layerConfig.getDictionary(), (NameTableData) layerConfig.getDictionary().getTableData(), entities);
}
}
}
/**
* 替换悬浮元素中的数据集
*

Loading…
Cancel
Save