Browse Source

Pull request #11761: REPORT-82787 & REPORT-92160图表空数据提示配置页面,默认图片需补充繁中版,修复设计器图标无disable状态

Merge in DESIGN/design from ~OBO/design:release/11.0 to release/11.0

* commit '083ceefcfb57a98440f710b21f7ab4691ac2e1ee':
  REPORT-92160 设计器-图标-数据源部分-新建无disable状态
  REPORT-82787 图表空数据提示配置页面,默认图片需补充繁中版
release/11.0
Obo-王学仁 2 years ago committed by Bruce.Deng-邓铖臻
parent
commit
d2e0e59f7c
  1. 2
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  2. 33
      designer-base/src/main/java/com/fr/design/menu/MenuDef.java
  3. 37
      designer-chart/src/main/java/com/fr/design/locale/impl/EmptyDataMark.java
  4. 12
      designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java
  5. BIN
      designer-chart/src/main/resources/com/fr/design/images/zh_traditional_emptydata.png

2
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -229,7 +229,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
private TreeSearchToolbarPane initToolBarPane() {
// toolbar
addMenuDef = new MenuDef(Toolkit.i18nText("Fine-Design_Basic_Action_Add"));
addMenuDef.setIconPath("/com/fr/design/standard/addpopup/addPopup");
addMenuDef.setDisabledIcon("/com/fr/design/standard/addpopup/addPopup", true);
createAddMenuDef();
// 创建插件监听
createPluginListener();

33
designer-base/src/main/java/com/fr/design/menu/MenuDef.java

@ -3,25 +3,32 @@ package com.fr.design.menu;
import com.fr.base.svg.IconUtils;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.*;
import com.fr.design.gui.imenu.UIHeadMenu;
import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIPopupEastAttrMenu;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.imenu.UIScrollMenu;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import java.util.HashSet;
import java.util.Set;
import javax.swing.*;
import javax.swing.JMenu;
import javax.swing.JPopupMenu;
import javax.swing.JToolBar;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import java.awt.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ContainerListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Define Menu.
@ -46,6 +53,7 @@ public class MenuDef extends ShortCut {
protected Boolean isEastAttr = false;
protected char mnemonic;
protected String iconPath;
private boolean needDisabled;
protected String tooltip;
//item List.
private List<ShortCut> shortcutList = new ArrayList<ShortCut>();
@ -112,9 +120,19 @@ public class MenuDef extends ShortCut {
}
public void setIconPath(String iconPath) {
this.iconPath = iconPath;
setDisabledIcon(iconPath, false);
}
/**
* 设置不可用图标时,注意传递路径问题,若路径为"view_normal.svg",请传递"view",不带后缀
* 读取disable图标的文件名应当为"xxx_disabled.svg",也是项目中的svg命名规范
* 注意必须是svg图标路径才能使用此函数设置正常和禁用状态
*
* */
public void setDisabledIcon(String iconPath, boolean needDisabled) {
this.iconPath = iconPath;
this.needDisabled = needDisabled;
}
public int getShortCutCount() {
return this.shortcutList.size();
}
@ -183,6 +201,9 @@ public class MenuDef extends ShortCut {
if (createdButton == null) {
if (iconPath != null) {
createdButton = new UIButton(IconUtils.readIcon(iconPath));
if(needDisabled) {
createdButton.setDisabledIcon(IconUtils.readIcon(iconPath + IconUtils.ICON_TYPE_DISABLED));
}
createdButton.set4ToolbarButton();
} else {
createdButton = new UIButton(name);

37
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<BufferedImage> {
private Map<Locale, BufferedImage> 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;
}
}

12
designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java

@ -10,12 +10,13 @@ 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;
@ -26,7 +27,6 @@ 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;
@ -35,6 +35,8 @@ import java.awt.GridLayout;
import java.awt.Image;
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 +65,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<BufferedImage> localeMark = LocaleCenter.getMark(EmptyDataMark.class);
DEFAULT_EMPTY_DATA_IMAGE = localeMark.getValue();
}
@Override

BIN
designer-chart/src/main/resources/com/fr/design/images/zh_traditional_emptydata.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Loading…
Cancel
Save