Browse Source

Pull request #4552: REPORT-53772 【智能联动】组件名/数据集名替换时,拖入失败时重新再拖入成功 有几率造成多次替换

Merge in DESIGN/design from ~HADES/design:feature/10.0 to feature/10.0

* commit '814b4636f532418f308bd4a3cd35f89e2499f18d':
  REPORT-53772 【智能联动】组件名/数据集名替换时,拖入失败时重新再拖入成功 有几率造成多次替换
feature/10.0
Hades 3 years ago
parent
commit
4d2a09294b
  1. 11
      designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java

11
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<ContentChange> contentChangeList = new ArrayList<>();
private List<ContentChangeItem> items = new ArrayList<>();
private Map<ChangeItem, ContentChangeItem> 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<ContentChangeItem>() {
@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<ContentChangeItem> itemsCopy = new ArrayList<>(items);
items.clear();
List<ContentChangeItem> itemsCopy = new ArrayList<>(itemsMap.values());
itemsMap.clear();
onRename(itemsCopy, contentChangeList);
}
});

Loading…
Cancel
Save