Browse Source

Merge pull request #1553 in BA/design from CHART/design:feature/9.0 to feature/9.0

* commit '73ebdccd4d08162cb5291546dedda709de8a9e28':
  CHART-1882   堆积和坐标轴界面bug
  去掉import *
  CHART-1836 CHART-1864
  空数据提示自定义,前台传递参数修改,面板调整
  修改pmd
  空数据提示代码格式化
  用户自定义空数据提示的面板部分和xml管理部分
superman 8 years ago
parent
commit
10994d0469
  1. 3
      designer/src/com/fr/start/Designer.java
  2. 19
      designer_base/src/com/fr/design/actions/core/ActionFactory.java
  3. BIN
      designer_base/src/com/fr/design/images/chart/EmptyChart.png
  4. 2
      designer_base/src/com/fr/design/locale/designer.properties
  5. 2
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  6. 2
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  7. 2
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  8. 2
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  9. 2
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  10. BIN
      designer_chart/src/com/fr/design/images/us_emptydata.png
  11. BIN
      designer_chart/src/com/fr/design/images/zh_emptydata.png
  12. 1
      designer_chart/src/com/fr/design/module/ChartDesignerModule.java
  13. 46
      designer_chart/src/com/fr/design/module/ChartEmptyDataStyleAction.java
  14. 237
      designer_chart/src/com/fr/design/module/ChartEmptyDataStylePane.java

3
designer/src/com/fr/start/Designer.java

@ -130,6 +130,9 @@ public class Designer extends BaseDesigner {
if (ActionFactory.getChartPreStyleAction() != null) { if (ActionFactory.getChartPreStyleAction() != null) {
menuDef.addShortCut(ActionFactory.getChartPreStyleAction()); menuDef.addShortCut(ActionFactory.getChartPreStyleAction());
} }
if (ActionFactory.getChartEmptyDataStyleAction() != null) {
menuDef.addShortCut(ActionFactory.getChartEmptyDataStyleAction());
}
if (ActionFactory.getChartMapEditorAction() != null) { if (ActionFactory.getChartMapEditorAction() != null) {
menuDef.addShortCut(ActionFactory.getChartMapEditorAction()); menuDef.addShortCut(ActionFactory.getChartMapEditorAction());
} }

19
designer_base/src/com/fr/design/actions/core/ActionFactory.java

@ -50,6 +50,7 @@ public class ActionFactory {
private static ConcurrentMap<Class, Class<? extends QuickEditor>> cellEditorClass = new ConcurrentHashMap<>(); private static ConcurrentMap<Class, Class<? extends QuickEditor>> cellEditorClass = new ConcurrentHashMap<>();
private static UpdateAction chartPreStyleAction = null; private static UpdateAction chartPreStyleAction = null;
private static UpdateAction chartEmptyDataStyleAction = null;
private static UpdateAction chartMapEditorAction = null; private static UpdateAction chartMapEditorAction = null;
private ActionFactory() { private ActionFactory() {
@ -126,6 +127,15 @@ public class ActionFactory {
chartPreStyleAction = action; chartPreStyleAction = action;
} }
/**
* 注册图表的 空数据提示样式.
*
* @param action 注册的图表空数据提示样式action
*/
public static void registerChartEmptyDataStyleAction(UpdateAction action) {
chartEmptyDataStyleAction = action;
}
/** /**
* kunsnat: 图表注册 悬浮元素编辑器 , 因为ChartCollection和ChartQuickEditor一个在Chart,一个在Designer, 所以分开注册. * kunsnat: 图表注册 悬浮元素编辑器 , 因为ChartCollection和ChartQuickEditor一个在Chart,一个在Designer, 所以分开注册.
* *
@ -157,6 +167,15 @@ public class ActionFactory {
return chartPreStyleAction; return chartPreStyleAction;
} }
/**
* 图表空数据提示样式Action
*
* @return 图表空数据提示样式Action
*/
public static UpdateAction getChartEmptyDataStyleAction() {
return chartEmptyDataStyleAction;
}
/** /**
* 图表编辑器Action * 图表编辑器Action

BIN
designer_base/src/com/fr/design/images/chart/EmptyChart.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

2
designer_base/src/com/fr/design/locale/designer.properties

@ -2149,6 +2149,8 @@ FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places= FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect. FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect.
FR-Designer_Format_JavaScript=Format Code FR-Designer_Format_JavaScript=Format Code
FR-Designer_Tip_Content=
FR-Designer_Chart_Empty_Data=
FR-Designer-Vcs_tab_click=Please exit the version management status and then switch the template FR-Designer-Vcs_tab_click=Please exit the version management status and then switch the template
FR-Designer_Preference_CachingTemplate=Template memory optimization FR-Designer_Preference_CachingTemplate=Template memory optimization
FR-Designer_Preference_MaxCachingTemplate=The designer maximum cache template number: FR-Designer_Preference_MaxCachingTemplate=The designer maximum cache template number:

2
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2148,6 +2148,8 @@ FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places= FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect. FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect.
FR-Designer_Format_JavaScript=Format Code FR-Designer_Format_JavaScript=Format Code
FR-Designer_Tip_Content=
FR-Designer_Chart_Empty_Data=
FR-Designer-Vcs_tab_click=Please exit the version management status and then switch the template FR-Designer-Vcs_tab_click=Please exit the version management status and then switch the template
FR-Designer_Preference_CachingTemplate=Template memory optimization FR-Designer_Preference_CachingTemplate=Template memory optimization
FR-Designer_Preference_MaxCachingTemplate=The designer maximum cache template number: FR-Designer_Preference_MaxCachingTemplate=The designer maximum cache template number:

2
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2149,6 +2149,8 @@ FR-Designer_Decimal_Places=\u5C0F\u6570\u67A0\u6570:
FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9 FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9
FR-Designer_Env_Des_Https= FR-Designer_Env_Des_Https=
FR-Designer_Format_JavaScript=Format Code FR-Designer_Format_JavaScript=Format Code
FR-Designer_Tip_Content=
FR-Designer_Chart_Empty_Data=
FR-Designer-Vcs_tab_click= FR-Designer-Vcs_tab_click=
FR-Designer_Move_Up= FR-Designer_Move_Up=
FR-Designer_Move_Down= FR-Designer_Move_Down=

2
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2149,6 +2149,8 @@ FR-Designer_Export_Background=
FR-Designer_Print_Background= FR-Designer_Print_Background=
FR-Designer_Env_Des_Https= FR-Designer_Env_Des_Https=
FR-Designer_Format_JavaScript=Format Code FR-Designer_Format_JavaScript=Format Code
FR-Designer_Tip_Content=
FR-Designer_Chart_Empty_Data=
FR-Designer-Vcs_tab_click= FR-Designer-Vcs_tab_click=
FR-Designer_Move_Up= FR-Designer_Move_Up=
FR-Designer_Move_Down= FR-Designer_Move_Down=

2
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2149,6 +2149,8 @@ FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places= FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=\u82E5\u542F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8BC1\u4E66\u8DEF\u5F84\u3001https\u79D8\u94A5\uFF09\uFF0C\u5FC5\u987B\u91CD\u542F\u8BBE\u8BA1\u5668\u624D\u80FD\u751F\u6548\u3002 FR-Designer_Env_Des_Https=\u82E5\u542F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8BC1\u4E66\u8DEF\u5F84\u3001https\u79D8\u94A5\uFF09\uFF0C\u5FC5\u987B\u91CD\u542F\u8BBE\u8BA1\u5668\u624D\u80FD\u751F\u6548\u3002
FR-Designer_Format_JavaScript=\u683C\u5F0F\u5316\u4EE3\u7801 FR-Designer_Format_JavaScript=\u683C\u5F0F\u5316\u4EE3\u7801
FR-Designer_Tip_Content=\u63D0\u793A\u5185\u5BB9
FR-Designer_Chart_Empty_Data=\u56FE\u8868\u7A7A\u6570\u636E\u63D0\u793A
FR-Designer-Vcs_tab_click=\u8BF7\u5148\u9000\u51FA\u7248\u672C\u7BA1\u7406\u72B6\u6001\u518D\u5207\u6362\u6A21\u677F FR-Designer-Vcs_tab_click=\u8BF7\u5148\u9000\u51FA\u7248\u672C\u7BA1\u7406\u72B6\u6001\u518D\u5207\u6362\u6A21\u677F
FR-Designer_Preference_CachingTemplate=\u6A21\u677F\u5185\u5B58\u4F18\u5316 FR-Designer_Preference_CachingTemplate=\u6A21\u677F\u5185\u5B58\u4F18\u5316
FR-Designer_Preference_MaxCachingTemplate=\u8BBE\u8BA1\u5668\u6700\u5927\u7F13\u5B58\u6A21\u677F\u4E2A\u6570\uFF1A FR-Designer_Preference_MaxCachingTemplate=\u8BBE\u8BA1\u5668\u6700\u5927\u7F13\u5B58\u6A21\u677F\u4E2A\u6570\uFF1A

2
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2148,6 +2148,8 @@ FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places= FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=\u82E5\u555F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8B49\u66F8\u8DEF\u5F91\u3001https\u7955\u9470\uFF09\uFF0C\u5FC5\u9808\u91CD\u555F\u8A2D\u8A08\u5668\u624D\u80FD\u751F\u6548\u3002 FR-Designer_Env_Des_Https=\u82E5\u555F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8B49\u66F8\u8DEF\u5F91\u3001https\u7955\u9470\uFF09\uFF0C\u5FC5\u9808\u91CD\u555F\u8A2D\u8A08\u5668\u624D\u80FD\u751F\u6548\u3002
FR-Designer_Format_JavaScript=Format Code FR-Designer_Format_JavaScript=Format Code
FR-Designer_Tip_Content=
FR-Designer_Chart_Empty_Data=
FR-Designer-Vcs_tab_click= FR-Designer-Vcs_tab_click=
FR-Designer_Preference_CachingTemplate=\u7BC4\u672C\u8A18\u61B6\u9AD4\u512A\u5316 FR-Designer_Preference_CachingTemplate=\u7BC4\u672C\u8A18\u61B6\u9AD4\u512A\u5316
FR-Designer_Preference_MaxCachingTemplate=\u8A2D\u8A08\u5668\u6700\u5927\u7DE9\u5B58\u7BC4\u672C\u500B\u6578\uFF1A FR-Designer_Preference_MaxCachingTemplate=\u8A2D\u8A08\u5668\u6700\u5927\u7DE9\u5B58\u7BC4\u672C\u500B\u6578\uFF1A

BIN
designer_chart/src/com/fr/design/images/us_emptydata.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
designer_chart/src/com/fr/design/images/zh_emptydata.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

1
designer_chart/src/com/fr/design/module/ChartDesignerModule.java

@ -53,6 +53,7 @@ public class ChartDesignerModule extends DesignModule {
DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);
ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction());
ActionFactory.registerChartEmptyDataStyleAction(new ChartEmptyDataStyleAction());
ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction()); ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction());
} }

46
designer_chart/src/com/fr/design/module/ChartEmptyDataStyleAction.java

@ -0,0 +1,46 @@
package com.fr.design.module;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import java.awt.event.ActionEvent;
/**
* Created by mengao on 2017/11/23.
* 空数据配置action
*/
public class ChartEmptyDataStyleAction extends UpdateAction {
public ChartEmptyDataStyleAction() {
this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/chart/EmptyChart.png"));
this.setName(Inter.getLocText("FR-Designer_Chart_Empty_Data"));
}
@Override
public void actionPerformed(ActionEvent e) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final ChartEmptyDataStylePane pane = new ChartEmptyDataStylePane();
BasicDialog dialog = pane.showWindow(designerFrame);
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
pane.updateBean();
}
@Override
public void doCancel() {
//直接关闭弹出框
}
});
pane.populateBean();
dialog.setVisible(true);
}
}

237
designer_chart/src/com/fr/design/module/ChartEmptyDataStylePane.java

@ -0,0 +1,237 @@
package com.fr.design.module;
import com.fr.base.BaseUtils;
import com.fr.base.ChartEmptyDataStyleManagerProvider;
import com.fr.base.ChartEmptyDataStyleServerManager;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ButtonGroup;
import java.awt.Image;
import java.awt.Dimension;
import java.awt.Component;
import java.awt.GridLayout;
/**
* Created by mengao on 2017/11/23.
*/
public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
private static final int WIDTH = 150;
private static final int HEIGHT = 20;
private static final int FIVE = 5;
private static final int TEN = 10;
private static final int THIRTY = 30;
private static Image DEFAULT_EMPTY_DATA_IMAGE;
private UIButtonGroup emptyData;
private UIRadioButton defaultRadioButton;
private UIRadioButton customRadioButton;
private UIButton selectPictureButton;
private ImagePreviewPane previewPane;
private ImageFileChooser imageFileChooser;
private Image emptyDataImage = DEFAULT_EMPTY_DATA_IMAGE;
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");
}
@Override
protected JPanel createContentPane() {
JPanel content = new JPanel(new BorderLayout());
content.add(creatNorthPane(), BorderLayout.NORTH);
content.add(creatCenterPane(), BorderLayout.CENTER);
return content;
}
private JPanel creatNorthPane() {
emptyData = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), Inter.getLocText("Plugin-ChartF_Close")});
emptyData.setSelectedIndex(0);
emptyData.setPreferredSize(new Dimension(WIDTH, HEIGHT));
emptyData.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkEmptyDataStyle();
repaintPreviewPane();
}
});
UILabel promptContent = new UILabel(Inter.getLocText("FR-Designer_Tip_Content"));
JPanel northPane = GUICoreUtils.createFlowPane(new Component[]{promptContent, emptyData}, FlowLayout.LEFT, TEN, 0);
northPane.setBorder(BorderFactory.createEmptyBorder(0, FIVE, 0, 0));
return northPane;
}
private JPanel creatCenterPane() {
JPanel centerPane = new JPanel(FRGUIPaneFactory.createBorderLayout());
// preview pane
JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPane.add(previewContainerPane, BorderLayout.CENTER);
JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Preview"));
previewOwnerPane.setLayout(new BorderLayout());
previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER);
previewContainerPane.add(initSelectFilePane(), BorderLayout.EAST);
previewPane = new ImagePreviewPane();
previewOwnerPane.add(new JScrollPane(previewPane));
// init image file chooser.
imageFileChooser = new ImageFileChooser();
imageFileChooser.setMultiSelectionEnabled(false);
return centerPane;
}
public JPanel initSelectFilePane() {
JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane();
selectFilePane.setBorder(BorderFactory.createEmptyBorder(TEN, FIVE, 0, THIRTY));
defaultRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_DEFAULT"));
customRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer-Widget-Style_Custom"));
ButtonGroup buttonGroup = new ButtonGroup();
defaultRadioButton.setSelected(true);
buttonGroup.add(defaultRadioButton);
buttonGroup.add(customRadioButton);
defaultRadioButton.addActionListener(getLayoutActionListener());
customRadioButton.addActionListener(getLayoutActionListener());
JPanel jp = new JPanel(new GridLayout(3, 1, 0, TEN));
jp.add(defaultRadioButton);
jp.add(customRadioButton);
selectPictureButton = new UIButton(
Inter.getLocText("FR-Designer_Background_Image_Select"));
selectPictureButton.addActionListener(getSelectPictureActionListener());
jp.add(selectPictureButton);
selectFilePane.add(jp, BorderLayout.NORTH);
return selectFilePane;
}
private ActionListener getLayoutActionListener() {
return new ActionListener() {
public void actionPerformed(ActionEvent evt) {
emptyDataImage = null;
checkCustomImage();
repaintPreviewPane();
}
};
}
/**
* Select picture.
*/
private ActionListener getSelectPictureActionListener() {
return new ActionListener() {
public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser.showOpenDialog(ChartEmptyDataStylePane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
if (selectedFile != null && selectedFile.isFile()) {
emptyDataImage = BaseUtils.readImage(selectedFile.getPath());
CoreGraphHelper.waitForImage(emptyDataImage);
repaintPreviewPane();
} else {
previewPane.setImage(null);
}
}
}
};
}
private void checkEmptyDataStyle() {
boolean b = emptyData.getSelectedIndex() == 0;
defaultRadioButton.setEnabled(b);
customRadioButton.setEnabled(b);
selectPictureButton.setEnabled(b);
}
private void checkCustomImage() {
selectPictureButton.setVisible(customRadioButton.isSelected());
}
private void repaintPreviewPane() {
emptyDataImage = customRadioButton.isSelected() ? emptyDataImage : DEFAULT_EMPTY_DATA_IMAGE;
previewPane.setImage(emptyData.getSelectedIndex() == 0 ? emptyDataImage : null);
previewPane.repaint();
}
@Override
public String getIconPath() {
return StringUtils.EMPTY;
}
@Override
public String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Chart_Empty_Data");
}
public void populateBean() {
ChartEmptyDataStyleManagerProvider manager = ChartEmptyDataStyleServerManager.getProviderInstance();
emptyData.setSelectedIndex(manager.isOpenEmptyDataStyle() == true ? 0 : 1);
customRadioButton.setSelected(manager.isCustomEmptyDataStyle());
emptyDataImage = manager.getEmptyDataImage();
checkEmptyDataStyle();
checkCustomImage();
repaintPreviewPane();
}
public void updateBean() {
ChartEmptyDataStyleManagerProvider manager = ChartEmptyDataStyleServerManager.getProviderInstance();
manager.setOpenEmptyDataStyle(emptyData.getSelectedIndex() == 0);
manager.setCustomEmptyDataStyle(customRadioButton.isSelected());
manager.setEmptyDataImage(emptyDataImage);
try {
manager.writeResource();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
// 通知报表整个刷新.
DesignerFrame frame = DesignerContext.getDesignerFrame();
if (frame != null) {
frame.repaint();
}
}
}
Loading…
Cancel
Save