diff --git a/designer-chart/src/main/java/com/fr/design/locale/impl/EmptyDataMark.java b/designer-chart/src/main/java/com/fr/design/locale/impl/EmptyDataMark.java new file mode 100644 index 0000000000..6b7a2f5fbd --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/locale/impl/EmptyDataMark.java @@ -0,0 +1,37 @@ +package com.fr.design.locale.impl; + +import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; +import com.fr.general.locale.LocaleMark; + +import java.awt.image.BufferedImage; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * 根据本地化信息设置服务器图表空数据提示图标 + * + * @author obo + * @version 11.0 + * Created by obo on 2023/3/22 + */ +public class EmptyDataMark implements LocaleMark { + + private Map map = new HashMap<>(); + + private static final BufferedImage ZH_EMPTY_DATA = IOUtils.readImage("com/fr/design/images/zh_emptydata.png"); + private static final BufferedImage US_EMPTY_DATA = IOUtils.readImage("/com/fr/design/images/us_emptydata.png"); + private static final BufferedImage ZH_TRADITIONAL_EMPTY_DATA = IOUtils.readImage("/com/fr/design/images/zh_traditional_emptydata.png"); + + public EmptyDataMark() { + map.put(Locale.CHINA, ZH_EMPTY_DATA); + map.put(Locale.US, US_EMPTY_DATA); + map.put(Locale.TAIWAN, ZH_TRADITIONAL_EMPTY_DATA); + } + @Override + public BufferedImage getValue() { + BufferedImage result = map.get(GeneralContext.getLocale()); + return result == null ? US_EMPTY_DATA : result; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java index 31718fda82..b4d1100d9f 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java @@ -10,31 +10,23 @@ import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.locale.impl.EmptyDataMark; import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImagePreviewPane; import com.fr.design.utils.ImageUtils; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.GeneralContext; -import com.fr.general.IOUtils; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.stable.Constants; import com.fr.stable.CoreGraphHelper; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.JFileChooser; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.SwingWorker; -import java.io.File; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.GridLayout; -import java.awt.Image; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; +import java.io.File; /** * Created by mengao on 2017/11/23. @@ -63,8 +55,8 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { static { - DEFAULT_EMPTY_DATA_IMAGE = GeneralContext.isChineseEnv() ? IOUtils.readImage("com/fr/design/images/zh_emptydata.png") - : IOUtils.readImage("com/fr/design/images/us_emptydata.png"); + LocaleMark localeMark = LocaleCenter.getMark(EmptyDataMark.class); + DEFAULT_EMPTY_DATA_IMAGE = localeMark.getValue(); } @Override diff --git a/designer-chart/src/main/resources/com/fr/design/images/zh_traditional_emptydata.png b/designer-chart/src/main/resources/com/fr/design/images/zh_traditional_emptydata.png new file mode 100644 index 0000000000..738fa685ad Binary files /dev/null and b/designer-chart/src/main/resources/com/fr/design/images/zh_traditional_emptydata.png differ