Browse Source

Pull request #4528: REPORT-53157 值一样 对象地址不一样的对象同样需要被返回处理

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

* commit '8f71836add656fbdd589ae998b6223a049506f6f':
  REPORT-53157 值一样 对象地址不一样的对象同样需要被返回处理
feature/10.0
Hades 4 years ago
parent
commit
1c9ff48f1e
  1. 8
      designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java
  2. 10
      designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java

8
designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java

@ -24,6 +24,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FunctionGrouper; import com.fr.report.cell.cellattr.core.group.FunctionGrouper;
import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.report.cell.cellattr.core.group.SelectCount;
import com.fr.stable.Filter; import com.fr.stable.Filter;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
@ -48,7 +49,7 @@ public class ContentObjectManager {
/** /**
* 放置所有需要替换内容的对象 * 放置所有需要替换内容的对象
*/ */
private Map<String, Set<Object>> objectMap; private Map<String, Collection<Object>> objectMap;
private final Set<String> set = new HashSet<>(); private final Set<String> set = new HashSet<>();
@ -98,14 +99,13 @@ public class ContentObjectManager {
} }
@Nullable @Nullable
public Map<String, Set<Object>> getObjectMap() { public Map<String, Collection<Object>> getObjectMap() {
return objectMap; return objectMap;
} }
public boolean needContentTip(Object ob, Set<String> nameSet) { public boolean needContentTip(Object ob, Set<String> nameSet) {
long start = System.currentTimeMillis();
objectMap = ClassHelper.searchObject(ob, set, ModClassFilter.getInstance()); objectMap = ClassHelper.searchObject(ob, set, ModClassFilter.getInstance());
for (Map.Entry<String, Set<Object>> entry : objectMap.entrySet()) { for (Map.Entry<String, Collection<Object>> entry : objectMap.entrySet()) {
for (Object o : entry.getValue()) { for (Object o : entry.getValue()) {
for (String name : nameSet) { for (String name : nameSet) {
ContentReplacer contentReplacer = map.get(entry.getKey()); ContentReplacer contentReplacer = map.get(entry.getKey());

10
designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java

@ -29,9 +29,9 @@ import com.fr.event.EventDispatcher;
import com.fr.event.Listener; 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.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* 默认联动内容替换器实现 * 默认联动内容替换器实现
@ -106,14 +106,14 @@ public class ContentReplacerCenter {
} }
private void onRename(List<ContentChangeItem> contentChangeItemList, List<ContentChange> contentChangeList) { private void onRename(List<ContentChangeItem> contentChangeItemList, List<ContentChange> contentChangeList) {
Map<String, Set<Object>> objectMap = ContentObjectManager.getInstance().getObjectMap(); Map<String, Collection<Object>> objectMap = ContentObjectManager.getInstance().getObjectMap();
if (objectMap != null) { if (objectMap != null) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
for (ContentChange contentChange : contentChangeList) { for (ContentChange contentChange : contentChangeList) {
Set<Object> set = objectMap.get(contentChange.type()); Collection<Object> objects = objectMap.get(contentChange.type());
// 所有需要处理的js等对象 // 所有需要处理的js等对象
if (set != null) { if (objects != null) {
for (Object ob : set) { for (Object ob : objects) {
fireChange(ob, contentChange, contentChangeItemList); fireChange(ob, contentChange, contentChangeItemList);
} }
} }

Loading…
Cancel
Save