|
|
|
@ -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); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|