Browse Source

Merge pull request #3542 in DESIGN/design from release/10.0 to bugfix/10.0

* commit 'ffc8993cccc7114b9c8752c1482ce56010d4530c':
  CHART-18182 模糊匹配方法移动到平台 & CHART-18190 点地图透明度控件
  REPORT-47797 本地和远程工程切换,日志有两个插件的报错 【问题原因】有些插件只用了_normal和_selected两种图标,没有使用_disabled图标,但是之前的逻辑没有对资源是否存在进行判断,会导致IOUtils中输出错误日志 【改动思路】添加判断;把适配插件的逻辑抽取一下
bugfix/10.0
superman 4 years ago
parent
commit
a712a2fca3
  1. 16
      designer-base/src/main/java/com/fr/base/svg/IconUtils.java
  2. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java
  3. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java
  4. 2
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

16
designer-base/src/main/java/com/fr/base/svg/IconUtils.java

@ -38,9 +38,8 @@ public class IconUtils {
if (IOUtils.readResource(resource) != null) { if (IOUtils.readResource(resource) != null) {
return SVGIcon.readSVGIcon(resource); return SVGIcon.readSVGIcon(resource);
} }
// 适配某些插件里是_normal.png、_selected.png的情况 // 适配插件
String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG); return adjustPluginsPng(resource);
return IOUtils.readIcon(pngResource);
} }
return IOUtils.readIcon(resource); return IOUtils.readIcon(resource);
} }
@ -48,6 +47,17 @@ public class IconUtils {
return readNoSuffixResource(resource, ICON_TYPE_NORMAL); return readNoSuffixResource(resource, ICON_TYPE_NORMAL);
} }
/**
* 适配插件中使用_normal.png_selected.png_disabled.png的情况
* @param resource 图片路径
* @return Icon
*/
private static Icon adjustPluginsPng(String resource) {
String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG);
// 考虑到某些插件可能只会使用三种图标中的一部分,这里做个判断,不然就会因为资源不存在而报错
return IOUtils.readResource(pngResource) == null ? new ImageIcon() : IOUtils.readIcon(pngResource);
}
/** /**
* 尝试读取不带扩展名的图标svg优先其次png最后gif都没读到就打印错误日志返回空白Icon * 尝试读取不带扩展名的图标svg优先其次png最后gif都没读到就打印错误日志返回空白Icon
* @param resource 图片路径 * @param resource 图片路径

4
designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java

@ -6,6 +6,7 @@ import com.fr.data.TableDataSource;
import com.fr.data.TableDataSourceTailor; import com.fr.data.TableDataSourceTailor;
import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.NameTableData; import com.fr.data.impl.NameTableData;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.datapane.TableDataComboBox;
@ -21,7 +22,6 @@ import com.fr.general.GeneralUtils;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.map.data.MapMatchResult; import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -246,7 +246,7 @@ public class MapAreaMatchPane extends BasicBeanPane<MapMatchResult> {
private void populateMatchData(Object[] columnData) { private void populateMatchData(Object[] columnData) {
Set<String> geoAreas = matchAreaTable.getItems(); Set<String> geoAreas = matchAreaTable.getItems();
Map<String, String> resultMap = ChartGEOJSONHelper.matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult()); Map<String, String> resultMap = GEOJSONHelper.getInstance().matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult());
Object[][] data = new Object[resultMap.size()][2]; Object[][] data = new Object[resultMap.size()][2];

4
designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java

@ -1,8 +1,8 @@
package com.fr.design.chartx.component; package com.fr.design.chartx.component;
import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import javax.swing.AbstractCellEditor; import javax.swing.AbstractCellEditor;
import javax.swing.JTable; import javax.swing.JTable;
@ -88,7 +88,7 @@ public class MatchAreaTable extends JTable {
return; return;
} }
int index = areaNameIndex.get(areaName); int index = areaNameIndex.get(areaName);
String result = ChartGEOJSONHelper.matchArea(GeneralUtils.objectToString(areaName), items); String result = GEOJSONHelper.getInstance().matchArea(GeneralUtils.objectToString(areaName), items, new HashMap<>());
getColumnModel().getColumn(1).getCellEditor().stopCellEditing(); getColumnModel().getColumn(1).getCellEditor().stopCellEditing();
this.setValueAt(result, index, 1); this.setValueAt(result, index, 1);
} }

2
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -443,7 +443,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
//不透明度 //不透明度
private JPanel createPointAlphaPane() { private JPanel createPointAlphaPane() {
pointAlphaPane = new UINumberDragPane(0, 100); pointAlphaPane = new UINumberDragPaneWithPercent(0, 100);
return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane); return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane);
} }

Loading…
Cancel
Save