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