diff --git a/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java b/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java index 7440895a8..91f9bf3dc 100644 --- a/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java +++ b/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java @@ -30,6 +30,7 @@ import com.fr.event.Listener; import com.fr.log.FineLoggerFactory; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -51,7 +52,7 @@ public class ContentReplacerCenter { } private List contentChangeList = new ArrayList<>(); - private List items = new ArrayList<>(); + private Map itemsMap = new HashMap<>(); private ContentReplacerCenter() { @@ -61,21 +62,21 @@ public class ContentReplacerCenter { if (param.getChangeMap().isEmpty()) { return; } - items.add(param); + itemsMap.put(param.getChangeItem(), param); } }); EventDispatcher.listen(TableDataModifyEvent.INSTANCE, new Listener() { @Override public void on(Event event, ContentChangeItem param) { - items.add(param); + itemsMap.put(param.getChangeItem(), param); long start = System.currentTimeMillis(); ContentObjectManager.getInstance().searchObject(param.getObject()); FineLoggerFactory.getLogger().debug("search object spend {} ms", (System.currentTimeMillis() - start)); FineLoggerFactory.getLogger().debug("search result: {}", ContentObjectManager.getInstance().getObjectMap() == null ? null : ContentObjectManager.getInstance().getObjectMap().keySet()); - List itemsCopy = new ArrayList<>(items); - items.clear(); + List itemsCopy = new ArrayList<>(itemsMap.values()); + itemsMap.clear(); onRename(itemsCopy, contentChangeList); } });