Browse Source

Merge pull request #15915 in DESIGN/design from fbp/release to fbp/merge

* commit '08b3c41a29cee18d45fd74a99588f11a8b17d5e8':
  REPORT-144753 fix:东区特定面板滚动问题修复
  REPORT-143943_【fr-fbp】设计器远程下,首次插入图表时非常慢
fbp/merge
superman 3 days ago
parent
commit
29a2678bdc
  1. 6
      designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java
  2. 49
      designer-chart/src/main/java/com/fanruan/map/DesignGEOJSONHelper.java
  3. 9
      designer-chart/src/main/java/com/fr/van/chart/designer/AbstractVanChartScrollPane.java
  4. 4
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java

6
designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java

@ -113,12 +113,12 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
} }
/** /**
* 插入图表后单元格元素使用cardLayout布局,需要滚动效果获取高度在子类中重新计算 * 插入图表后单元格元素使用cardLayout布局获取可视窗口高度用于判断面板是否需要滚动效果
* *
* @return height * @return 可见区域的高度
*/ */
protected int getMaxHeight(){ protected int getMaxHeight(){
return getHeight(); return getVisibleRect().height;
} }
protected class BarLayout implements LayoutManager { protected class BarLayout implements LayoutManager {

49
designer-chart/src/main/java/com/fanruan/map/DesignGEOJSONHelper.java

@ -1,12 +1,22 @@
package com.fanruan.map; package com.fanruan.map;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.decision.webservice.v10.map.geojson.MapDataType; import com.fr.decision.webservice.v10.map.geojson.MapDataType;
import com.fr.decision.webservice.v10.map.geojson.bean.GeoJSONFactory;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONUtils; import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.third.org.apache.commons.lang3.time.StopWatch; import com.fr.third.org.apache.commons.lang3.time.StopWatch;
import com.fr.workspace.server.repository.map.MapRepository; import com.fr.workspace.server.repository.map.MapRepository;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/** /**
* 设计器地图资源Helper * 设计器地图资源Helper
* *
@ -22,9 +32,21 @@ public class DesignGEOJSONHelper extends GEOJSONHelper {
StopWatch watch = new StopWatch(); StopWatch watch = new StopWatch();
watch.start(); watch.start();
URL_JSON_MAP.putAll(MapRepository.getInstance().getMapResource(GEOJSONUtils.getMapDataTypePath(MapDataType.GEOGRAPHIC))); ExecutorService executorService = Executors.newFixedThreadPool(2, new NamedThreadFactory("[design-map] initGeoJSON"));
URL_JSON_MAP.putAll(MapRepository.getInstance().getMapResource(GEOJSONUtils.getMapDataTypePath(MapDataType.IMAGE))); List<Callable<Void>> tasks = new ArrayList<>();
tasks.add(() -> {
updateGeographic();
return null;
});
tasks.add(() -> {
updateImage();
return null;
});
List<Future<Void>> resultList = executorService.invokeAll(tasks);
for (Future<Void> result : resultList) {
result.get();
}
executorService.shutdown();
FineLoggerFactory.getLogger().info("Load chart map resources spend time {} ms", watch.getTime()); FineLoggerFactory.getLogger().info("Load chart map resources spend time {} ms", watch.getTime());
watch.stop(); watch.stop();
@ -33,4 +55,25 @@ public class DesignGEOJSONHelper extends GEOJSONHelper {
} }
} }
private void updateGeographic() {
try {
Map<String, String> geographic = MapRepository.getInstance().getMapResource(GEOJSONUtils.getMapDataTypePath(MapDataType.GEOGRAPHIC));
for (Map.Entry<String, String> entry : geographic.entrySet()) {
URL_JSON_MAP.put(entry.getKey(), GeoJSONFactory.create(entry.getValue(), entry.getKey()));
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private void updateImage() {
try {
Map<String, String> image = MapRepository.getInstance().getMapResource(GEOJSONUtils.getMapDataTypePath(MapDataType.IMAGE));
for (Map.Entry<String, String> entry : image.entrySet()) {
URL_JSON_MAP.put(entry.getKey(), GeoJSONFactory.create(entry.getValue(), entry.getKey()));
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} }

9
designer-chart/src/main/java/com/fr/van/chart/designer/AbstractVanChartScrollPane.java

@ -19,13 +19,4 @@ public abstract class AbstractVanChartScrollPane<T> extends BasicScrollPane<T> {
super.reloaPane(pane); super.reloaPane(pane);
leftcontentPane.setBorder(BorderFactory.createEmptyBorder()); leftcontentPane.setBorder(BorderFactory.createEmptyBorder());
} }
/**
* 获取可视窗口高度
* @return height
*/
@Override
protected int getMaxHeight() {
return getVisibleRect().height;
}
} }

4
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java vendored

@ -1,11 +1,14 @@
package com.fanruan.boot.env.function; package com.fanruan.boot.env.function;
import com.fanruan.boot.ChartBaseComponent; import com.fanruan.boot.ChartBaseComponent;
import com.fanruan.carina.Carina;
import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop; import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental; import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.map.DesignGEOJSONHelper;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelperShell;
/** /**
@ -41,6 +44,7 @@ public class DesignChartBaseComponent extends ChartBaseComponent {
*/ */
@Supplemental @Supplemental
public void prepare() { public void prepare() {
Carina.getApplicationContext().singleton(GEOJSONHelperShell.class).set(DesignGEOJSONHelper.class);
super.prepare(); super.prepare();
} }

Loading…
Cancel
Save