Browse Source

Merge pull request #980 in DESIGN/design from ~ZHENG/c-design:refactor/19.4.3 to refactor/19.4.3

* commit 'a8993872e22b49fd7e857a83d34c4f4a69b27ca9':
  CHART-9141 删除图表设计器相关代码
  CHART-9141 replace chart with chartProvider(eg:typePane) && 图表公式相关接口 && 删除图表内部对datamodel的cache(和engine确认过)
research/10.0
zheng 6 years ago
parent
commit
c0982f2e68
  1. 16
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  2. 8
      designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java
  3. 86
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  4. 10
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java
  5. 5
      designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java
  6. 3
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  7. 43
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  8. 65
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDesignerOtherPane.java
  9. 68
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  10. 67
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  11. 33
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/StylePane4Chart.java
  12. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java
  13. 394
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java
  14. 409
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractDeprecatedChartTypePane.java
  15. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java
  16. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java
  17. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java
  18. 8
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java
  19. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java
  20. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java
  21. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java
  22. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java
  23. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java
  24. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java
  25. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java
  26. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java
  27. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java
  28. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java
  29. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java
  30. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java
  31. 7
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java
  32. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  33. 4
      designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java

16
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -2,7 +2,6 @@ package com.fr.design;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
@ -161,7 +160,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
int index = 0;
for (ChartInternationalNameContentBean bean : typeName) {
String plotID = bean.getPlotID();
String plotID = bean.getChartID();
ChartProvider[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) {
continue;
@ -254,7 +253,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
*
* @param paneList pane容器
*/
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends Chart>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends Chart>>> allChartTypePane) {
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends ChartProvider>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane) {
List<Integer> priorityList = getPriorityInOrder();
for (Integer aPriorityList : priorityList) {
@ -264,7 +263,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
public void addPlotTypePaneList(String priority, List<FurtherBasicBeanPane<? extends Chart>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends Chart>>> allChartTypePane) {
public void addPlotTypePaneList(String priority, List<FurtherBasicBeanPane<? extends ChartProvider>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane) {
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) {
@ -283,7 +282,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
paneList.add(pane);
if (allChartTypePane.get(priority) == null) {
allChartTypePane.put(priority, new LinkedHashMap<String, FurtherBasicBeanPane<? extends Chart>>());
allChartTypePane.put(priority, new LinkedHashMap<String, FurtherBasicBeanPane<? extends ChartProvider>>());
}
allChartTypePane.get(priority).put(plotID, pane);
}
@ -450,9 +449,10 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return true;
}
public boolean needChartChangePane(Chart chart) {
if (chart != null && chart.getPlot() != null) {
IndependentChartUIProvider provider = getChartTypeInterface(chart.getPlot().getPlotID());
public boolean needChartChangePane(ChartProvider chart) {
if (chart != null) {
String chartID = chart.getID();
IndependentChartUIProvider provider = getChartTypeInterface(chartID);
if (provider != null) {
return provider.needChartChangePane();
}

8
designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java

@ -1,7 +1,7 @@
package com.fr.design.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
public abstract class ChartCommonWizardPane extends ChartWizardPane {
private static final long serialVersionUID = 2467967841657570498L;
@ -12,11 +12,11 @@ public abstract class ChartCommonWizardPane extends ChartWizardPane {
return;
}
populate(cc.getSelectedChart());
populate(cc.getSelectedChartProvider());
}
public abstract void populate(Chart chart);
public abstract void populate(ChartProvider chart);
public abstract void update(Chart oldChart);
public abstract void update(ChartProvider oldChart);
}

86
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -5,18 +5,13 @@ package com.fr.design.chart;
*/
import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.ChartIcon;
import com.fr.chart.chartattr.MapPlot;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.license.exception.RegistEditionException;
import com.fr.license.function.VT4FR;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
@ -24,7 +19,6 @@ import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer;
@ -37,22 +31,22 @@ public class ChartTypePane extends ChartCommonWizardPane {
private static final long serialVersionUID = -1175602484968520546L;
private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstanceWithCheck().getAllChartBaseNames();
//todo@shinerefactor 这个页面所有强转Chart的地方都要处理一下
private Chart[][] charts4Icon = null;
private ChartProvider[][] charts4Icon = null;
{
charts4Icon = new Chart[this.typeName.length][];
charts4Icon = new ChartProvider[this.typeName.length][];
for (int i = 0; i < this.typeName.length; i++) {
ChartProvider[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID());
ChartProvider[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getChartID());
int rowChartsCount = rowCharts.length;
charts4Icon[i] = new Chart[rowChartsCount];
charts4Icon[i] = new ChartProvider[rowChartsCount];
for (int j = 0; j < rowChartsCount; j++) {
try {
charts4Icon[i][j] = (Chart) rowCharts[j].clone();
charts4Icon[i][j].setTitle(null);
if(charts4Icon[i][j].getPlot() != null){
charts4Icon[i][j].getPlot().setLegend(null);
}
charts4Icon[i][j] = (ChartProvider) rowCharts[j].clone();
//todo@shinerefactor 老图表也是提供一张图片 这边就不用setTitle(null) 然后实时去画
// charts4Icon[i][j].setTitle(null);
// if(charts4Icon[i][j].getPlot() != null){
// charts4Icon[i][j].getPlot().setLegend(null);
// }
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
@ -123,7 +117,7 @@ public class ChartTypePane extends ChartCommonWizardPane {
protected ListSelectionListener listSelectionListener = new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
int main_index = mainTypeList.getSelectedIndex();
Chart[] sub_charts = ChartTypePane.this.charts4Icon[main_index];
ChartProvider[] sub_charts = ChartTypePane.this.charts4Icon[main_index];
ChartTypePane.this.iconListModel.clear();
for (int i = 0; i < sub_charts.length; i++) {
ChartTypePane.this.iconListModel.addElement(new ChartIcon(sub_charts[i]));
@ -133,56 +127,14 @@ public class ChartTypePane extends ChartCommonWizardPane {
};
public String getChartName(ChartIcon chartIcon) {
Chart chart = (Chart)chartIcon.getChart();
return chart.getChartName();
ChartProvider chart = chartIcon.getChart();
return ChartTypeManager.getInstanceWithCheck().getChartName(chart.getID());
}
public void populate(Chart chart) {
if (chart == null) {
return;
}
Plot plot = chart.getPlot();
int mainIndex = 0;
int subIndex = 0;
for (int i = 0; i < typeName.length; i++) {
ChartProvider[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(typeName[i].getPlotID());
for (int j = 0; j < charts.length; j++) {
if (((Chart) charts[j]).getPlot().match4GUI(plot)) {
mainIndex = i;
subIndex = j;
// 一旦匹配 立马中断
break;
}
}
}
mainTypeList.setSelectedIndex(mainIndex);
iconViewList.setSelectedIndex(subIndex);
}
public void update(Chart oldChart) {
String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID();
Chart chart = (Chart) ChartTypeManager.getInstanceWithCheck().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
if(chart.getPlot() != null){
if(chart.getPlot() instanceof MapPlot && !supportMap()){
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Not_Supported"));
throw new RegistEditionException(VT4FR.ChartMap);
}
if (chart.getPlot() != null) {
try {
oldChart.changePlotInNewType((Plot) chart.getPlot().clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
public void populate(ChartProvider chart) {
}
private boolean supportMap() {
return VT4FR.ChartMap.isSupport();
public void update(ChartProvider oldChart) {
}
public void update(ChartCollection cc) {
@ -190,12 +142,12 @@ public class ChartTypePane extends ChartCommonWizardPane {
return;
}
Chart chart4Update = cc.getSelectedChart();
ChartProvider chart4Update = cc.getSelectedChartProvider();
if (chart4Update == null) {
String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID();
Chart chart = (Chart) ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
String plotID = typeName[mainTypeList.getSelectedIndex()].getChartID();
ChartProvider chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
try{
chart4Update = (Chart)chart.clone();
chart4Update = (ChartProvider) chart.clone();
cc.addChart(chart4Update);
}catch (CloneNotSupportedException ex){
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);

10
designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java

@ -1,7 +1,6 @@
package com.fr.design.chart.gui;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.base.chart.BaseChartGetter;
import com.fr.design.gui.core.WidgetOption;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.Widget;
@ -38,14 +37,11 @@ public class ChartWidgetOption extends WidgetOption {
Class<? extends ChartEditor> clz = widgetClass();
try {
ChartEditor widget = clz.newInstance();
ChartProvider chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0];
widget.addChart((ChartProvider) chart.clone());
widget.setChartCollection(BaseChartGetter.createChartCollection(this.chartID));
return widget;
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

5
designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java

@ -1,6 +1,5 @@
package com.fr.design.chart.gui.active.action;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.actions.UpdateAction;
@ -32,10 +31,6 @@ public abstract class ChartComponentAction extends UpdateAction {
return chartComponent.getChartCollection();
}
public Axis getActiveAxis() {
return chartComponent.getActiveAxis();
}
public AxisGlyph getActiveAxisGlyph() {
return chartComponent.getActiveAxisGlyph();
}

3
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -1,6 +1,5 @@
package com.fr.design.chart.series.SeriesCondition.impl;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.Bar2DPlot;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
@ -92,7 +91,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
this.itemNameTextField.setText(chartHyperlink.getItemName());
}
BaseChartCollection cc = chartHyperlink.getChartCollection();
ChartCollection cc = (ChartCollection) chartHyperlink.getChartCollection();
if (cc == null || cc.getChartCount() < 1) {
cc = createChartCollection();
chartHyperlink.setChartCollection(cc);

43
designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java

@ -1,8 +1,8 @@
package com.fr.design.mainframe.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.data.DesignTableDataManager;
@ -20,6 +20,7 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.ChartTypePane;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
@ -109,12 +110,14 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
if (!ComparatorUtils.equals(collection, lastCollection)) {
//此处画图
Chart chart = collection.getSelectedChart();
chart.demoImgEvent(true);
VanChart vanChart = collection.getSelectedChart(VanChart.class);
if (vanChart != null) {
//此处画图
vanChart.demoImgEvent(true);
}
try {
lastCollection = (ChartCollection) collection.clone();
lastCollection = collection.clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("error in clone ChartEditPane");
}
@ -131,7 +134,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
* 重新构造面板
* @param currentChart 图表
*/
public void reLayout(Chart currentChart){
public void reLayout(ChartProvider currentChart) {
if(currentChart != null){
int chartIndex = getSelectedChartIndex(currentChart);
this.removeAll();
@ -139,12 +142,8 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
paneList = new ArrayList<AbstractChartAttrPane>();
addTypePane();
boolean isDefault = true;
String plotID = "";
if(currentChart.getPlot() != null){
plotID = currentChart.getPlot().getPlotID();
isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
}
String chartID = currentChart.getID();
boolean isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID);
if(isDefault){
paneList.add(dataPane4SupportCell);
@ -152,11 +151,11 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
paneList.add(otherPane);
this.isDefaultPane = true;
}else{
ChartDataPane chartDataPane = createChartDataPane(plotID);
ChartDataPane chartDataPane = createChartDataPane(chartID);
if (chartDataPane != null) {
paneList.add(chartDataPane);
}
AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(plotID, listener);
AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(chartID, listener);
for(int i = 0; i < otherPaneList.length; i++){
otherPaneList[i].addAttributeChangeListener(listener);
paneList.add(otherPaneList[i]);
@ -226,8 +225,8 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
return;
}
if(checkNeedsReLayout(collection.getSelectedChart())){
reLayout(collection.getSelectedChart());
if (checkNeedsReLayout(collection.getSelectedChartProvider())) {
reLayout(collection.getSelectedChartProvider());
}
this.collection = collection;
@ -253,7 +252,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
}
}
public int getSelectedChartIndex(Chart chart){
public int getSelectedChartIndex(ChartProvider chart) {
int index = 0;
if(typePane != null){
FurtherBasicBeanPane[] paneList = typePane.getPaneList();
@ -267,15 +266,13 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
}
//populate的时候看看要不要重构面板
private boolean checkNeedsReLayout(Chart chart){
private boolean checkNeedsReLayout(ChartProvider chart) {
if(chart != null){
int lastIndex = typePane.getSelectedIndex();
int currentIndex = getSelectedChartIndex(chart);
boolean currentPane = true;
if(chart.getPlot() != null){
String plotID = chart.getPlot().getPlotID();
currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
}
String chartID = chart.getID();
boolean currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID);
return (currentPane != isDefaultPane) || (!currentPane && lastIndex != currentIndex);
}
return false;

65
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDesignerOtherPane.java

@ -1,65 +0,0 @@
/*
* Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved.
*/
package com.fr.design.mainframe.chart.gui;
import com.fr.design.mainframe.chart.gui.other.ChartDesignerConditionAttrPane;
import com.fr.design.mainframe.chart.gui.other.ChartDesignerInteractivePane;
import com.fr.design.dialog.BasicPane;
import javax.swing.*;
import java.awt.*;
import java.util.*;
/**
* 图表设计器的图标属性表高级tab
* Created by IntelliJ IDEA.
* Author : daisy
* Version: 6.5.6
* Date: 14-10-16
* Time: 下午2:04
*/
public class ChartDesignerOtherPane extends ChartOtherPane {
@Override
protected JPanel createContentPane() {
JPanel content = new JPanel(new BorderLayout());
otherPane = new ChartTabPane();
content.add(otherPane, BorderLayout.CENTER);
return content;
}
/**
* 界面标题
*
* @return 返回标题.
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Advanced");
}
private boolean isHaveCondition() {
return hasCondition;
}
private class ChartTabPane extends TabPane {
@Override
protected java.util.List<BasicPane> initPaneList() {
java.util.List<BasicPane> paneList = new ArrayList<BasicPane>();
interactivePane = new ChartDesignerInteractivePane(ChartDesignerOtherPane.this);
paneList.add(interactivePane);
if (ChartDesignerOtherPane.this.isHaveCondition()) {
conditionAttrPane = new ChartDesignerConditionAttrPane();
paneList.add(conditionAttrPane);
}
return paneList;
}
}
}

68
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -19,6 +19,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
@ -42,6 +43,8 @@ import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
/**
* 图表 类型 增删 控制按钮界面.
@ -56,6 +59,12 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private static final int P_W = 300;
private static final int P_H = 400;
private static Set<Class<? extends ChartProvider>> supportChangeConfigChartClassSet = new HashSet<Class<? extends ChartProvider>>();
static {
registerSupportChangeConfigChartClass(VanChart.class);
}
private UIButton addButton;
private UIButton configButton;
private ArrayList<ChartChangeButton> indexList = new ArrayList<ChartChangeButton>();
@ -109,6 +118,10 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
// Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
}
public static void registerSupportChangeConfigChartClass(Class<? extends ChartProvider> cls) {
supportChangeConfigChartClassSet.add(cls);
}
private void initConfigCreator() {
configCreator = new UIMenuNameableCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"), new AttrChangeConfig(), ChangeConfigPane.class);
}
@ -135,7 +148,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
if (editingCollection != null) {
//点击添加按钮,则会触发切换状态
ChartProvider chart = editingCollection.getChangeStateNewChart();
ChartProvider chart = getChangeStateNewChart();
try {
ChartProvider newChart = (ChartProvider) chart.clone();
editingCollection.addNamedChart(name, newChart);
@ -150,12 +163,51 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
//获取图表收集器的状态
private void checkoutChange(){
editingCollection.calculateMultiChartMode();
calculateMultiChartMode();
if (parent != null){
parent.relayoutChartTypePane(editingCollection);
}
//检查是否可以配置切换
configButton.setEnabled(editingCollection.changeEnable());
configButton.setEnabled(changeEnable());
}
/**
* 获取切花状态下的图表
*
* @return
*/
public ChartProvider getChangeStateNewChart() {
ChartProvider chart = editingCollection.getSelectedChartProvider();
String priority = ChartTypeManager.VAN_CHART_PRIORITY;
//todo@shinerefactor
// chart.getPriority();
return ChartTypeManager.getInstanceWithCheck().getFirstChart(priority);
}
//图表收集器模式状态改变
private void calculateMultiChartMode() {
//设置切换功能是否可用
editingCollection.getChangeConfigAttr().setEnable(changeEnable());
//多图表切换模式
if (editingCollection.getChartCount() > 1) {
editingCollection.setState(SwitchState.CHANGE);
} else {
editingCollection.setState(SwitchState.DEFAULT);
}
}
/**
* 是否支持图表切换的配置
*
* @return
*/
private boolean changeEnable() {
return editingCollection.getChartCount() > 1
&& supportChange();
}
private boolean supportChange() {
return supportChangeConfigChartClassSet.contains(editingCollection.getSelectedChartProvider().getClass());
}
ActionListener configListener = new ActionListener() {
@ -310,11 +362,11 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
}
private void checkConfigButtonVisible() {
addButton.setVisible(ChartTypeManager.enabledChart(editingCollection.getSelectedChart().getPlot().getPlotID()));
addButton.setVisible(ChartTypeManager.enabledChart(editingCollection.getSelectedChartProvider().getID()));
//新建一个collection
if(editingCollection.getState() == SwitchState.DEFAULT && editingCollection.getSelectedChart() != null){
if (editingCollection.getState() == SwitchState.DEFAULT && editingCollection.getSelectedChartProvider() != null) {
//Chart 不支持图表切换
configButton.setVisible(editingCollection.getSelectedChart().supportChange());
configButton.setVisible(supportChange());
}
}
@ -440,7 +492,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private void deleteAButton() {
//先重构属性,在重构面板,否则面板在重构过程中,会重新将属性中的切换图表加到indexList中,导致面板无法删除
//记录改变前的plotID
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChart().getPlot().getPlotID();
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider().getID();
if (editingCollection != null) {
int count = editingCollection.getChartCount();
for (int i = 0; i < count; i++) {
@ -520,7 +572,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
if (isEnabled()) {
noSelected();
//记录改变前的plotID
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChart().getPlot().getPlotID();
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider().getID();
changeCollectionSelected(getButtonName());
setSelectedWithFireListener(true);
fireSelectedChanged();

67
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -2,9 +2,9 @@ package com.fr.design.mainframe.chart.gui;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartattr.SwitchState;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.dialog.BasicScrollPane;
@ -99,13 +99,13 @@ public class ChartTypePane extends AbstractChartAttrPane{
return PaneTitleConstants.CHART_TYPE_TITLE;
}
class ComboBoxPane extends UIComboBoxPane<Chart>{
private Map<String, Map<String, FurtherBasicBeanPane<? extends Chart>>> allChartTypePane;
class ComboBoxPane extends UIComboBoxPane<ChartProvider> {
private Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane;
@Override
protected List<FurtherBasicBeanPane<? extends Chart>> initPaneList() {
List<FurtherBasicBeanPane<? extends Chart>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Chart>>();
allChartTypePane = new LinkedHashMap<String, Map<String, FurtherBasicBeanPane<? extends Chart>>>();
protected List<FurtherBasicBeanPane<? extends ChartProvider>> initPaneList() {
List<FurtherBasicBeanPane<? extends ChartProvider>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartProvider>>();
allChartTypePane = new LinkedHashMap<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>>();
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, allChartTypePane);
return paneList;
}
@ -121,13 +121,12 @@ public class ChartTypePane extends AbstractChartAttrPane{
* 如果是切换图表的不同图表之间切换则collection的选择下标会改变
* @param chart
*/
public void updateBean(Chart chart) {
public void updateBean(ChartProvider chart) {
Plot oldPlot = chart.getPlot();
String lastPlotID = oldPlot == null ? StringUtils.EMPTY : oldPlot.getPlotID();
String lastPlotID = chart.getID();
try{
Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone();
ChartProvider newDefaultChart = (ChartProvider) ((AbstractChartTypePane) getSelectedPane()).getDefaultChart().clone();
if (!ComparatorUtils.equals(chart.getClass(), newDefaultChart.getClass())) {
//vanChart 和 chart 之间切换
//不同chart之间切换
@ -142,20 +141,20 @@ public class ChartTypePane extends AbstractChartAttrPane{
//这一步会替换plot
((AbstractChartTypePane)getSelectedPane()).updateBean(chart);
Plot plot = chart.getPlot();
String chartID = chart.getID();
if(plot != null){
String plotID = plot.getPlotID();
//chartID改变的话图表类型就算改变了
if (StringUtils.isNotEmpty(chartID)) {
//plot改变的话图表类型就算改变了
chart.setWrapperName(ChartTypeManager.getInstanceWithCheck().getWrapperName(plotID));
chart.setChartImagePath(ChartTypeManager.getInstanceWithCheck().getChartImagePath(plotID));
if (chart instanceof Chart) {
//todo@shinerefactor: 这边看下是否可以删除
((Chart) chart).setWrapperName(ChartTypeManager.getInstanceWithCheck().getWrapperName(chartID));
((Chart) chart).setChartImagePath(ChartTypeManager.getInstanceWithCheck().getChartImagePath(chartID));
}
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID);
if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){
if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, chartID))) {
editPane.reLayout(chart);
}
}
@ -195,12 +194,12 @@ public class ChartTypePane extends AbstractChartAttrPane{
private void addOnePriorityCards(String priority, boolean ignore) {
Map<String, FurtherBasicBeanPane<? extends Chart>> map = allChartTypePane.get(priority);
Map<String, FurtherBasicBeanPane<? extends ChartProvider>> map = allChartTypePane.get(priority);
Iterator<Map.Entry<String, FurtherBasicBeanPane<? extends Chart>>> iterator = map.entrySet().iterator();
Iterator<Map.Entry<String, FurtherBasicBeanPane<? extends ChartProvider>>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, FurtherBasicBeanPane<? extends Chart>> entry = iterator.next();
Map.Entry<String, FurtherBasicBeanPane<? extends ChartProvider>> entry = iterator.next();
String plotID = entry.getKey();
if (ignore || ChartTypeManager.enabledChart(plotID)) {
cards.add(entry.getValue());
@ -217,9 +216,11 @@ public class ChartTypePane extends AbstractChartAttrPane{
//处理办法:这边除了重构 下拉项选项和cardNames 还需要把cards重构下(不需要init pane,只需要我需要的拿出来就好了)
private void relayout(ChartCollection collection){
//重构需要重构下拉框选项和cardNames
Chart chart = collection.getSelectedChart();
String priority = chart.getPriority();
String plotID = chart.getPlot().getPlotID();
ChartProvider chart = collection.getSelectedChartProvider();
String priority = ChartTypeManager.VAN_CHART_PRIORITY;
//TODO@shinerefactor
// chart.getPriority();
String plotID = chart.getID();
boolean enabledChart = ChartTypeManager.enabledChart(plotID);
String item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(priority, plotID);
@ -262,7 +263,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
}
@Override
public void populateBean(Chart ob) {
public void populateBean(ChartProvider ob) {
for (int i = 0; i < this.cards.size(); i++) {
FurtherBasicBeanPane pane = cards.get(i);
if (pane.accept(ob)) {
@ -279,12 +280,12 @@ public class ChartTypePane extends AbstractChartAttrPane{
}
@Override
public Chart updateBean() {
public ChartProvider updateBean() {
return getSelectedPane().updateBean();
}
@Override
public FurtherBasicBeanPane<? extends Chart> getSelectedPane(){
public FurtherBasicBeanPane<? extends ChartProvider> getSelectedPane() {
Object item = jcb.getSelectedItem();
for (int i = 0; i < cards.size(); i++){
if (ComparatorUtils.equals(item, cards.get(i).title4PopupWindow())){
@ -303,8 +304,8 @@ public class ChartTypePane extends AbstractChartAttrPane{
* @param collection
*/
public void reLayoutEditPane(String lastPlotID, ChartCollection collection){
Chart chart = collection.getSelectedChart();
String plotID = chart.getPlot().getPlotID();
ChartProvider chart = collection.getSelectedChartProvider();
String plotID = chart.getID();
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){
editPane.reLayout(chart);
@ -322,7 +323,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void populate(ChartCollection collection) {
editingCollection = collection;
Chart chart = collection.getSelectedChart();
ChartProvider chart = collection.getSelectedChartProvider();
this.remove(leftContentPane);
initContentPane();
@ -340,7 +341,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void update(ChartCollection collection) {
editingCollection = collection;
buttonPane.update(collection);// 内部操作时 已经做过处理.
Chart chart = collection.getSelectedChart();
ChartProvider chart = collection.getSelectedChartProvider();
chartTypeComBox.updateBean(chart);
}

33
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/StylePane4Chart.java

@ -1,33 +0,0 @@
package com.fr.design.mainframe.chart.gui;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane;
import com.fr.design.mainframe.chart.gui.style.series.SeriesPane4ChartDesigner;
/**
* 图表设计器的样式面板
* Created by IntelliJ IDEA.
* Author : daisy
* Version: 6.5.6
* Date: 14-10-25
* Time: 下午6:56
*/
public class StylePane4Chart extends ChartStylePane {
public StylePane4Chart(AttributeChangeListener listener, boolean isNeedFormula) {
super(listener, isNeedFormula);
}
public void update(ChartCollection collection) {
int selectIndex = collection.getSelectedIndex();
super.update(collection);
collection.getSelectedChart().setStyleGlobal(false);
collection.setChartName(selectIndex, collection.getSelectedChart().getTitle().getTextObject().toString());
}
protected ChartSeriesPane createChartSeriesPane(){
return new SeriesPane4ChartDesigner(StylePane4Chart.this);
}
}

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java

@ -9,9 +9,9 @@ import com.fr.chart.chartattr.Chart;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-25 下午04:55:05
*/
public abstract class AbstractBarPane extends AbstractChartTypePane {
public abstract class AbstractBarPane extends AbstractDeprecatedChartTypePane {
protected static final int COLOMN_CHART = 0;
protected static final int COLOMN_CHART = 0;
protected static final int STACK_COLOMN_CHART = 1;
protected static final int PERCENT_STACK_COLOMN_CHART = 2;
protected static final int THREE_D_COLOMN_CHART = 3;

394
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java

@ -1,21 +1,9 @@
package com.fr.design.mainframe.chart.gui.type;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.background.ColorBackground;
import com.fr.chart.base.AttrContents;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.ChartUtils;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.chart.base.TextAttr;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.CategoryPlot;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Legend;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartattr.Title;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.charttypes.BarIndependentChart;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.beans.FurtherBasicBeanPane;
@ -25,9 +13,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.js.NameJavaScriptGroup;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import javax.swing.JPanel;
@ -35,12 +20,11 @@ import javax.swing.JSeparator;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
public abstract class AbstractChartTypePane<T extends ChartProvider> extends FurtherBasicBeanPane<T> {
private static final int ONE_LINE_NUM = 4;
@ -163,50 +147,6 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
}
}
}
/**
* 更新界面属性
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
for(ChartImagePane imagePane : styleList) {
imagePane.isPressing = false;
}
if(styleList != null && !styleList.isEmpty()){
int plotStyle = chart.getPlot().getPlotStyle();
String styleName = chart.getPlot().getPlotFillStyle().getFillStyleName();
switch (plotStyle){
case ChartConstants.STYLE_SHADE: if(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Retro"), styleName)){
styleList.get(STYLE_SHADE).isPressing = true;
lastStyleIndex = STYLE_SHADE;
}
break;
case ChartConstants.STYLE_TRANSPARENT:if(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Fresh"), styleName)){
styleList.get(STYLE_TRANSPARENT).isPressing = true;
lastStyleIndex = STYLE_TRANSPARENT;
}
break;
case ChartConstants.STYLE_3D: if(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"), styleName)){
styleList.get(STYLE_PLANE3D).isPressing = true;
lastStyleIndex = STYLE_PLANE3D;
}
break;
case ChartConstants.STYLE_OUTER:if(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"), styleName)){
styleList.get(STYLE_HIGHLIGHT).isPressing = true;
lastStyleIndex = STYLE_HIGHLIGHT;
}
break;
default:
lastStyleIndex = -1;
break;
}
stylePane.setVisible(!(chart.getPlot().isSupport3D()));
this.repaint();
}
}
protected void checkDemosBackground() {
if(this.styleList != null && !styleList.isEmpty()){
@ -222,119 +162,10 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
}
}
private void setPlotFillStyle(Chart chart){
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance();
Plot plot = chart.getPlot();
Object preStyle = null;
String name = "";
if(styleList.get(STYLE_SHADE).isPressing){
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Retro");
preStyle = manager.getPreStyle(name);
}else if(styleList.get(STYLE_TRANSPARENT).isPressing){
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Fresh");
preStyle = manager.getPreStyle(name);
}else if(styleList.get(STYLE_PLANE3D).isPressing){
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright");
preStyle = manager.getPreStyle(name);
}else if(styleList.get(STYLE_HIGHLIGHT).isPressing){
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright");
preStyle = manager.getPreStyle(name);
}
if(preStyle == null){
plot.getPlotFillStyle().setColorStyle(ChartConstants.COLOR_DEFAULT);
}else{
AttrFillStyle fillStyle = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle);
fillStyle.setFillStyleName(name);
plot.setPlotFillStyle(fillStyle);
}
}
/**
* 保存风格,对选中的风格做设置
*/
public void updateBean(Chart chart) {
Plot oldPlot = chart.getPlot();
Plot newPlot = this.setSelectedClonedPlotWithCondition(oldPlot);
checkTypeChange(oldPlot);//判断图表的类型是否发生变化
if(styleList != null && !styleList.isEmpty()){
if(styleList.get(STYLE_SHADE).isPressing && lastStyleIndex != STYLE_SHADE){
lastStyleIndex = STYLE_SHADE;
chart.setPlot(newPlot);
chart.getPlot().setPlotStyle(ChartConstants.STYLE_SHADE);
resetChart(chart);
createCondition4Shade(chart);
setPlotFillStyle(chart);
}else if(styleList.get(STYLE_TRANSPARENT).isPressing && lastStyleIndex != STYLE_TRANSPARENT){
lastStyleIndex = STYLE_TRANSPARENT;
chart.setPlot(newPlot);
chart.getPlot().setPlotStyle(ChartConstants.STYLE_TRANSPARENT);
resetChart(chart);
createCondition4Transparent(chart);
setPlotFillStyle(chart);
}else if(styleList.get(STYLE_PLANE3D).isPressing && lastStyleIndex != STYLE_PLANE3D){
lastStyleIndex = STYLE_PLANE3D;
chart.setPlot(newPlot);
chart.getPlot().setPlotStyle(ChartConstants.STYLE_3D);
resetChart(chart);
createCondition4Plane3D(chart);
setPlotFillStyle(chart);
}else if(styleList.get(STYLE_HIGHLIGHT).isPressing && lastStyleIndex != STYLE_HIGHLIGHT){
lastStyleIndex = STYLE_HIGHLIGHT;
chart.setPlot(newPlot);
chart.getPlot().setPlotStyle(ChartConstants.STYLE_OUTER);
resetChart(chart);
createCondition4HighLight(chart);
setPlotFillStyle(chart);
}else if(lastStyleIndex >= STYLE_SHADE && lastStyleIndex <= STYLE_HIGHLIGHT){
if(styleList.get(lastStyleIndex).isDoubleClicked || typeChanged){
chart.setPlot(newPlot);
resetChart(chart);
styleList.get(lastStyleIndex).isPressing = false;
checkDemosBackground();
lastStyleIndex = -1;
}
}
stylePane.setVisible(!(chart.getPlot().isSupport3D()));
this.repaint();
}
}
private Plot setSelectedClonedPlotWithCondition(Plot oldPlot){
Plot newPlot = getSelectedClonedPlot();
if(oldPlot != null && ComparatorUtils.equals(newPlot.getClass(), oldPlot.getClass())){
if(oldPlot.getHotHyperLink() != null){
NameJavaScriptGroup hotHyper = oldPlot.getHotHyperLink();
try {
newPlot.setHotHyperLink((NameJavaScriptGroup)hotHyper.clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error in Hyperlink, Please Check it.", e);
}
}
newPlot.setConditionCollection(oldPlot.getConditionCollection());
newPlot.setSeriesDragEnable(oldPlot.isSeriesDragEnable());
if(newPlot.isSupportZoomCategoryAxis() && newPlot.getxAxis() != null) {
newPlot.getxAxis().setZoom(oldPlot.getxAxis().isZoom());
}
if(newPlot.isSupportTooltipInInteractivePane()) {
newPlot.setHotTooltipStyle(oldPlot.getHotTooltipStyle());
}
if(newPlot.isSupportAutoRefresh()) {
newPlot.setAutoRefreshPerSecond(oldPlot.getAutoRefreshPerSecond());
}
if (newPlot.isSupportAxisTip()) {
newPlot.setInteractiveAxisTooltip(oldPlot.isInteractiveAxisTooltip());
}
}
return newPlot;
}
/**
* 更新整个新的Chart类型
*/
public Chart updateBean() {
public T updateBean() {
return null;
}
@ -346,14 +177,6 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
chart.setBackground(null);
}
protected void changePlotWithClone(Chart chart, Plot plot) {
try {
chart.switchPlot((Plot)plot.clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error in change plot");
}
}
/**
* 重置
*/
@ -394,219 +217,6 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
return false;
}
//高光渐变的默认属性设置
private void createCondition4HighLight(Chart chart){
if(chart != null){
//标题
Title title = new Title(chart.getTitle().getTextObject());
chart.setTitle(title);
title.setTitleVisible(true);
TextAttr textAttr = title.getTextAttr();
if (textAttr == null) {
textAttr = new TextAttr();
title.setTextAttr(textAttr);
}
title.setPosition(Constants.LEFT);
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(51, 51, 51)));
//图例
Legend legend = new Legend();
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138,140,139)));
legend.setPosition(Constants.RIGHT_TOP);
chart.getPlot().setLegend(legend);
//分类轴,现在只有柱形图,条形图,面积图
if(chart.getPlot() instanceof CategoryPlot){
CategoryPlot plot = (CategoryPlot)chart.getPlot();
//分类轴设置
Axis cateAxis = plot.getxAxis();
cateAxis.setAxisStyle(Constants.LINE_THICK);
cateAxis.setAxisColor(new Color(204, 220, 228));
cateAxis.setTickMarkType(Constants.TICK_MARK_INSIDE);
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setShowAxisLabel(true);
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(138,140,139)));
//值轴
Axis valueAxis = plot.getyAxis();
valueAxis.setAxisStyle(Constants.NONE);
valueAxis.setAxisColor(null);
valueAxis.setTickMarkType(Constants.TICK_MARK_INSIDE);
valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
valueAxis.setShowAxisLabel(true);
valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(138,140,139)));
//绘图区
plot.setBorderStyle(Constants.LINE_THIN);
plot.setBorderColor(new Color(204, 220, 228));
plot.setBackground(ColorBackground.getInstance(new Color(248, 247, 245)));
plot.getyAxis().setMainGridStyle(Constants.LINE_THIN);
plot.getyAxis().setMainGridColor(new Color(192,192,192));
}
}
}
//平面3D的默认属性设置
private void createCondition4Plane3D(Chart chart){
if(chart != null){
//标题
Title title = new Title(chart.getTitle().getTextObject());
chart.setTitle(title);
title.setTitleVisible(true);
TextAttr textAttr = title.getTextAttr();
if (textAttr == null) {
textAttr = new TextAttr();
title.setTextAttr(textAttr);
}
title.setPosition(Constants.CENTER);
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 16f, new Color(51,51,51)));
//图例
Legend legend = new Legend();
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128,128,128)));
legend.setPosition(Constants.TOP);
chart.getPlot().setLegend(legend);
//分类轴,现在只有柱形图,条形图,面积图
if(chart.getPlot() instanceof CategoryPlot){
CategoryPlot plot = (CategoryPlot)chart.getPlot();
//分类轴设置
Axis cateAxis = plot.getxAxis();
cateAxis.setAxisStyle(Constants.LINE_THICK);
cateAxis.setAxisColor(new Color(57, 57, 57));
cateAxis.setTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setShowAxisLabel(true);
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(57,57,57)));
//值轴设置
Axis valueAxis = plot.getyAxis();
valueAxis.setAxisStyle(Constants.LINE_NONE);
valueAxis.setTickMarkType(Constants.TICK_MARK_NONE);
valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
valueAxis.setShowAxisLabel(false);
//绘图区
plot.getyAxis().setMainGridStyle(Constants.LINE_THIN);
plot.getyAxis().setMainGridColor(new Color(192,192,192));
chart.setBorderStyle(Constants.LINE_NONE);
//数据标签
ConditionAttr attrList = plot.getConditionCollection().getDefaultAttr();
DataSeriesCondition attr = attrList.getExisted(AttrContents.class);
if(attr != null) {
attrList.remove(attr);
}
AttrContents attrContents = new AttrContents();
attrContents.setPosition(Constants.OUTSIDE);
attrContents.setSeriesLabel(ChartConstants.VALUE_PARA);
attrContents.setTextAttr(new TextAttr(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(51,51,51))));
attrList.addDataSeriesCondition(attrContents);
}
}
}
//透明风格的默认属性设置
private void createCondition4Transparent(Chart chart){
if(chart != null){
//标题
Title title = new Title(chart.getTitle().getTextObject());
chart.setTitle(title);
title.setTitleVisible(true);
TextAttr textAttr = title.getTextAttr();
if (textAttr == null) {
textAttr = new TextAttr();
title.setTextAttr(textAttr);
}
title.setPosition(Constants.LEFT);
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(192,192,192)));
//图例
Legend legend = new Legend();
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138,140,139)));
legend.setPosition(Constants.RIGHT_TOP);
chart.getPlot().setLegend(legend);
Plot plot = chart.getPlot();
//绘图区
chart.setBackground(ColorBackground.getInstance(new Color(51,51,51)));
//分类轴,现在只有柱形图,条形图,面积图
if(plot instanceof CategoryPlot){
//边框
plot.setBorderStyle(Constants.LINE_THIN);
plot.setBorderColor(new Color(65,65,65));
//分类轴设置
Axis cateAxis = plot.getxAxis();
cateAxis.setAxisStyle(Constants.LINE_THICK);
cateAxis.setAxisColor(new Color(192,192,192));
cateAxis.setTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setShowAxisLabel(true);
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(150,150,150)));
//值轴
Axis valueAxis = plot.getyAxis();
valueAxis.setShowAxisLabel(true);
valueAxis.setAxisStyle(Constants.LINE_NONE);
valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(150,150,150)));
valueAxis.setMainGridStyle(Constants.LINE_THIN);
valueAxis.setMainGridColor(new Color(63, 62, 62));
}
}
}
//渐变的默认属性设置
private void createCondition4Shade(Chart chart){
if(chart != null){
//标题
Title title = new Title(chart.getTitle().getTextObject());
chart.setTitle(title);
title.setTitleVisible(true);
TextAttr textAttr = title.getTextAttr();
if (textAttr == null) {
textAttr = new TextAttr();
title.setTextAttr(textAttr);
}
title.setPosition(Constants.CENTER);
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(0,51,102)));
//图例
Legend legend = new Legend();
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128,128,128)));
legend.setPosition(Constants.BOTTOM);
chart.getPlot().setLegend(legend);
//分类轴,现在只有柱形图,条形图,面积图
if(chart.getPlot() instanceof CategoryPlot){
CategoryPlot plot = (CategoryPlot)chart.getPlot();
//分类轴设置
Axis cateAxis = plot.getxAxis();
cateAxis.setAxisStyle(Constants.LINE_THICK);
cateAxis.setAxisColor(new Color(73, 100, 117));
cateAxis.setTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setShowAxisLabel(true);
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(128,128,128)));
//值轴
Axis valueAxis = plot.getyAxis();
valueAxis.setShowAxisLabel(true);
valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(128,128,128)));
valueAxis.setAxisStyle(Constants.LINE_NONE);
//绘图区
plot.getyAxis().setMainGridStyle(Constants.LINE_THIN);
plot.getyAxis().setMainGridColor(new Color(192,192,192));
plot.setHorizontalIntervalBackgroundColor(new Color(243,243,243));
}
}
}
protected boolean needsResetChart(Chart chart){
return chart != null
&&chart.getPlot() != null

409
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractDeprecatedChartTypePane.java

@ -0,0 +1,409 @@
package com.fr.design.mainframe.chart.gui.type;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.background.ColorBackground;
import com.fr.chart.base.AttrContents;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.ChartUtils;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.chart.base.TextAttr;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.CategoryPlot;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Legend;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartattr.Title;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.js.NameJavaScriptGroup;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import java.awt.Color;
import java.awt.Font;
/**
* Created by shine on 2019/7/1.
*/
public abstract class AbstractDeprecatedChartTypePane extends AbstractChartTypePane<Chart> {
protected void changePlotWithClone(Chart chart, Plot plot) {
try {
chart.switchPlot((Plot) plot.clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error in change plot");
}
}
/**
* 更新界面属性
*/
public void populateBean(Chart chart) {
for (ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
for (ChartImagePane imagePane : styleList) {
imagePane.isPressing = false;
}
if (styleList != null && !styleList.isEmpty()) {
int plotStyle = chart.getPlot().getPlotStyle();
String styleName = chart.getPlot().getPlotFillStyle().getFillStyleName();
switch (plotStyle) {
case ChartConstants.STYLE_SHADE:
if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Retro"), styleName)) {
styleList.get(STYLE_SHADE).isPressing = true;
lastStyleIndex = STYLE_SHADE;
}
break;
case ChartConstants.STYLE_TRANSPARENT:
if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Fresh"), styleName)) {
styleList.get(STYLE_TRANSPARENT).isPressing = true;
lastStyleIndex = STYLE_TRANSPARENT;
}
break;
case ChartConstants.STYLE_3D:
if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"), styleName)) {
styleList.get(STYLE_PLANE3D).isPressing = true;
lastStyleIndex = STYLE_PLANE3D;
}
break;
case ChartConstants.STYLE_OUTER:
if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"), styleName)) {
styleList.get(STYLE_HIGHLIGHT).isPressing = true;
lastStyleIndex = STYLE_HIGHLIGHT;
}
break;
default:
lastStyleIndex = -1;
break;
}
stylePane.setVisible(!(chart.getPlot().isSupport3D()));
this.repaint();
}
}
public void updateBean(Chart chart) {
Plot oldPlot = chart.getPlot();
Plot newPlot = this.setSelectedClonedPlotWithCondition(oldPlot);
checkTypeChange(oldPlot);//判断图表的类型是否发生变化
if (styleList != null && !styleList.isEmpty()) {
if (styleList.get(STYLE_SHADE).isPressing && lastStyleIndex != STYLE_SHADE) {
lastStyleIndex = STYLE_SHADE;
chart.setPlot(newPlot);
chart.getPlot().setPlotStyle(ChartConstants.STYLE_SHADE);
resetChart(chart);
createCondition4Shade(chart);
setPlotFillStyle(chart);
} else if (styleList.get(STYLE_TRANSPARENT).isPressing && lastStyleIndex != STYLE_TRANSPARENT) {
lastStyleIndex = STYLE_TRANSPARENT;
chart.setPlot(newPlot);
chart.getPlot().setPlotStyle(ChartConstants.STYLE_TRANSPARENT);
resetChart(chart);
createCondition4Transparent(chart);
setPlotFillStyle(chart);
} else if (styleList.get(STYLE_PLANE3D).isPressing && lastStyleIndex != STYLE_PLANE3D) {
lastStyleIndex = STYLE_PLANE3D;
chart.setPlot(newPlot);
chart.getPlot().setPlotStyle(ChartConstants.STYLE_3D);
resetChart(chart);
createCondition4Plane3D(chart);
setPlotFillStyle(chart);
} else if (styleList.get(STYLE_HIGHLIGHT).isPressing && lastStyleIndex != STYLE_HIGHLIGHT) {
lastStyleIndex = STYLE_HIGHLIGHT;
chart.setPlot(newPlot);
chart.getPlot().setPlotStyle(ChartConstants.STYLE_OUTER);
resetChart(chart);
createCondition4HighLight(chart);
setPlotFillStyle(chart);
} else if (lastStyleIndex >= STYLE_SHADE && lastStyleIndex <= STYLE_HIGHLIGHT) {
if (styleList.get(lastStyleIndex).isDoubleClicked || typeChanged) {
chart.setPlot(newPlot);
resetChart(chart);
styleList.get(lastStyleIndex).isPressing = false;
checkDemosBackground();
lastStyleIndex = -1;
}
}
stylePane.setVisible(!(chart.getPlot().isSupport3D()));
this.repaint();
}
}
private Plot setSelectedClonedPlotWithCondition(Plot oldPlot) {
Plot newPlot = getSelectedClonedPlot();
if (oldPlot != null && ComparatorUtils.equals(newPlot.getClass(), oldPlot.getClass())) {
if (oldPlot.getHotHyperLink() != null) {
NameJavaScriptGroup hotHyper = oldPlot.getHotHyperLink();
try {
newPlot.setHotHyperLink((NameJavaScriptGroup) hotHyper.clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error in Hyperlink, Please Check it.", e);
}
}
newPlot.setConditionCollection(oldPlot.getConditionCollection());
newPlot.setSeriesDragEnable(oldPlot.isSeriesDragEnable());
if (newPlot.isSupportZoomCategoryAxis() && newPlot.getxAxis() != null) {
newPlot.getxAxis().setZoom(oldPlot.getxAxis().isZoom());
}
if (newPlot.isSupportTooltipInInteractivePane()) {
newPlot.setHotTooltipStyle(oldPlot.getHotTooltipStyle());
}
if (newPlot.isSupportAutoRefresh()) {
newPlot.setAutoRefreshPerSecond(oldPlot.getAutoRefreshPerSecond());
}
if (newPlot.isSupportAxisTip()) {
newPlot.setInteractiveAxisTooltip(oldPlot.isInteractiveAxisTooltip());
}
}
return newPlot;
}
//平面3D的默认属性设置
private void createCondition4Plane3D(Chart chart) {
if (chart != null) {
//标题
Title title = new Title(chart.getTitle().getTextObject());
chart.setTitle(title);
title.setTitleVisible(true);
TextAttr textAttr = title.getTextAttr();
if (textAttr == null) {
textAttr = new TextAttr();
title.setTextAttr(textAttr);
}
title.setPosition(Constants.CENTER);
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 16f, new Color(51, 51, 51)));
//图例
Legend legend = new Legend();
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128, 128, 128)));
legend.setPosition(Constants.TOP);
chart.getPlot().setLegend(legend);
//分类轴,现在只有柱形图,条形图,面积图
if (chart.getPlot() instanceof CategoryPlot) {
CategoryPlot plot = (CategoryPlot) chart.getPlot();
//分类轴设置
Axis cateAxis = plot.getxAxis();
cateAxis.setAxisStyle(Constants.LINE_THICK);
cateAxis.setAxisColor(new Color(57, 57, 57));
cateAxis.setTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setShowAxisLabel(true);
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(57, 57, 57)));
//值轴设置
Axis valueAxis = plot.getyAxis();
valueAxis.setAxisStyle(Constants.LINE_NONE);
valueAxis.setTickMarkType(Constants.TICK_MARK_NONE);
valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
valueAxis.setShowAxisLabel(false);
//绘图区
plot.getyAxis().setMainGridStyle(Constants.LINE_THIN);
plot.getyAxis().setMainGridColor(new Color(192, 192, 192));
chart.setBorderStyle(Constants.LINE_NONE);
//数据标签
ConditionAttr attrList = plot.getConditionCollection().getDefaultAttr();
DataSeriesCondition attr = attrList.getExisted(AttrContents.class);
if (attr != null) {
attrList.remove(attr);
}
AttrContents attrContents = new AttrContents();
attrContents.setPosition(Constants.OUTSIDE);
attrContents.setSeriesLabel(ChartConstants.VALUE_PARA);
attrContents.setTextAttr(new TextAttr(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(51, 51, 51))));
attrList.addDataSeriesCondition(attrContents);
}
}
}
//透明风格的默认属性设置
private void createCondition4Transparent(Chart chart) {
if (chart != null) {
//标题
Title title = new Title(chart.getTitle().getTextObject());
chart.setTitle(title);
title.setTitleVisible(true);
TextAttr textAttr = title.getTextAttr();
if (textAttr == null) {
textAttr = new TextAttr();
title.setTextAttr(textAttr);
}
title.setPosition(Constants.LEFT);
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(192, 192, 192)));
//图例
Legend legend = new Legend();
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138, 140, 139)));
legend.setPosition(Constants.RIGHT_TOP);
chart.getPlot().setLegend(legend);
Plot plot = chart.getPlot();
//绘图区
chart.setBackground(ColorBackground.getInstance(new Color(51, 51, 51)));
//分类轴,现在只有柱形图,条形图,面积图
if (plot instanceof CategoryPlot) {
//边框
plot.setBorderStyle(Constants.LINE_THIN);
plot.setBorderColor(new Color(65, 65, 65));
//分类轴设置
Axis cateAxis = plot.getxAxis();
cateAxis.setAxisStyle(Constants.LINE_THICK);
cateAxis.setAxisColor(new Color(192, 192, 192));
cateAxis.setTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setShowAxisLabel(true);
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(150, 150, 150)));
//值轴
Axis valueAxis = plot.getyAxis();
valueAxis.setShowAxisLabel(true);
valueAxis.setAxisStyle(Constants.LINE_NONE);
valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(150, 150, 150)));
valueAxis.setMainGridStyle(Constants.LINE_THIN);
valueAxis.setMainGridColor(new Color(63, 62, 62));
}
}
}
//渐变的默认属性设置
private void createCondition4Shade(Chart chart) {
if (chart != null) {
//标题
Title title = new Title(chart.getTitle().getTextObject());
chart.setTitle(title);
title.setTitleVisible(true);
TextAttr textAttr = title.getTextAttr();
if (textAttr == null) {
textAttr = new TextAttr();
title.setTextAttr(textAttr);
}
title.setPosition(Constants.CENTER);
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(0, 51, 102)));
//图例
Legend legend = new Legend();
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128, 128, 128)));
legend.setPosition(Constants.BOTTOM);
chart.getPlot().setLegend(legend);
//分类轴,现在只有柱形图,条形图,面积图
if (chart.getPlot() instanceof CategoryPlot) {
CategoryPlot plot = (CategoryPlot) chart.getPlot();
//分类轴设置
Axis cateAxis = plot.getxAxis();
cateAxis.setAxisStyle(Constants.LINE_THICK);
cateAxis.setAxisColor(new Color(73, 100, 117));
cateAxis.setTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setShowAxisLabel(true);
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(128, 128, 128)));
//值轴
Axis valueAxis = plot.getyAxis();
valueAxis.setShowAxisLabel(true);
valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(128, 128, 128)));
valueAxis.setAxisStyle(Constants.LINE_NONE);
//绘图区
plot.getyAxis().setMainGridStyle(Constants.LINE_THIN);
plot.getyAxis().setMainGridColor(new Color(192, 192, 192));
plot.setHorizontalIntervalBackgroundColor(new Color(243, 243, 243));
}
}
}
//高光渐变的默认属性设置
private void createCondition4HighLight(Chart chart) {
if (chart != null) {
//标题
Title title = new Title(chart.getTitle().getTextObject());
chart.setTitle(title);
title.setTitleVisible(true);
TextAttr textAttr = title.getTextAttr();
if (textAttr == null) {
textAttr = new TextAttr();
title.setTextAttr(textAttr);
}
title.setPosition(Constants.LEFT);
textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(51, 51, 51)));
//图例
Legend legend = new Legend();
legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138, 140, 139)));
legend.setPosition(Constants.RIGHT_TOP);
chart.getPlot().setLegend(legend);
//分类轴,现在只有柱形图,条形图,面积图
if (chart.getPlot() instanceof CategoryPlot) {
CategoryPlot plot = (CategoryPlot) chart.getPlot();
//分类轴设置
Axis cateAxis = plot.getxAxis();
cateAxis.setAxisStyle(Constants.LINE_THICK);
cateAxis.setAxisColor(new Color(204, 220, 228));
cateAxis.setTickMarkType(Constants.TICK_MARK_INSIDE);
cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
cateAxis.setShowAxisLabel(true);
cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(138, 140, 139)));
//值轴
Axis valueAxis = plot.getyAxis();
valueAxis.setAxisStyle(Constants.NONE);
valueAxis.setAxisColor(null);
valueAxis.setTickMarkType(Constants.TICK_MARK_INSIDE);
valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE);
valueAxis.setShowAxisLabel(true);
valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(138, 140, 139)));
//绘图区
plot.setBorderStyle(Constants.LINE_THIN);
plot.setBorderColor(new Color(204, 220, 228));
plot.setBackground(ColorBackground.getInstance(new Color(248, 247, 245)));
plot.getyAxis().setMainGridStyle(Constants.LINE_THIN);
plot.getyAxis().setMainGridColor(new Color(192, 192, 192));
}
}
}
private void setPlotFillStyle(Chart chart) {
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance();
Plot plot = chart.getPlot();
Object preStyle = null;
String name = "";
if (styleList.get(STYLE_SHADE).isPressing) {
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Retro");
preStyle = manager.getPreStyle(name);
} else if (styleList.get(STYLE_TRANSPARENT).isPressing) {
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Fresh");
preStyle = manager.getPreStyle(name);
} else if (styleList.get(STYLE_PLANE3D).isPressing) {
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright");
preStyle = manager.getPreStyle(name);
} else if (styleList.get(STYLE_HIGHLIGHT).isPressing) {
name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright");
preStyle = manager.getPreStyle(name);
}
if (preStyle == null) {
plot.getPlotFillStyle().setColorStyle(ChartConstants.COLOR_DEFAULT);
} else {
AttrFillStyle fillStyle = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle);
fillStyle.setFillStyleName(name);
plot.setPlotFillStyle(fillStyle);
}
}
}

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java

@ -17,7 +17,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-25 下午06:57:36
*/
public class AreaPlotPane extends AbstractChartTypePane{
public class AreaPlotPane extends AbstractDeprecatedChartTypePane {
private static final int STACK_AREA_CHART = 0;
private static final int PERCENT_AREA_LINE_CHART = 1;

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java

@ -13,8 +13,8 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-25 下午06:56:47
*/
public class BubblePlotPane extends AbstractChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
public class BubblePlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int BUBBLE_CHART = 0;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java

@ -11,7 +11,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-21 下午06:17:40
*/
public class CustomPlotPane extends AbstractChartTypePane {
public class CustomPlotPane extends AbstractDeprecatedChartTypePane {
@Override
protected String getPlotTypeID() {

8
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java

@ -22,10 +22,10 @@ import java.text.DecimalFormat;
* @author eason
*
*/
public class DonutPlotPane extends AbstractChartTypePane{
private static final long serialVersionUID = -7084314809934346710L;
private static final int DONUT_CHART = 0; //2d圆环图
private static final int THREE_D_DONUT_CHART = 1; //3D圆环图
public class DonutPlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -7084314809934346710L;
private static final int DONUT_CHART = 0; //2d圆环图
private static final int THREE_D_DONUT_CHART = 1; //3D圆环图
@Override
protected String[] getTypeIconPath() {

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java

@ -18,7 +18,7 @@ import java.text.DecimalFormat;
* Time: 下午2:50
* To change this template use File | Settings | File Templates.
*/
public class FunnelPlotPane extends AbstractChartTypePane{
public class FunnelPlotPane extends AbstractDeprecatedChartTypePane {
private static final int FUNNEL_CHART = 0;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java

@ -11,7 +11,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午10:38:18
*/
public class GanttPlotPane extends AbstractChartTypePane{
public class GanttPlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int GANTT = 0;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java

@ -19,7 +19,7 @@ import java.awt.BorderLayout;
import java.awt.Component;
public class GisMapPlotPane extends AbstractChartTypePane{
public class GisMapPlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = 2595221900000305396L;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java

@ -9,7 +9,7 @@ import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
public class LinePlotPane extends AbstractChartTypePane{
public class LinePlotPane extends AbstractDeprecatedChartTypePane {
private static final int LINE_CHART = 0;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java

@ -16,7 +16,7 @@ import com.fr.log.FineLoggerFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
public class MapPlotPane extends AbstractChartTypePane {
public class MapPlotPane extends AbstractDeprecatedChartTypePane {
private boolean isSvgMap = true; // 默认是svg地图

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java

@ -16,9 +16,9 @@ import com.fr.log.FineLoggerFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午10:48:57
*/
public class MeterPlotPane extends AbstractChartTypePane {
public class MeterPlotPane extends AbstractDeprecatedChartTypePane {
private static final int METER = 0;
private static final int METER = 0;
private static final int BLUE_METER =1;
private static final int SIMPLE_METER = 2;

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java

@ -21,8 +21,8 @@ import java.text.DecimalFormat;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-25 下午06:55:33
*/
public class PiePlotPane extends AbstractChartTypePane{
private static final long serialVersionUID = -601566194238908115L;
public class PiePlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int PIE_CHART = 0;
private static final int THREE_D_PIE_CHART = 1;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java

@ -11,7 +11,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午09:55:01
*/
public class RadarPlotPane extends AbstractChartTypePane{
public class RadarPlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int RADAR = 0;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java

@ -12,7 +12,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午10:43:50
*/
public class RangePlotPane extends AbstractChartTypePane{
public class RangePlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int RANGE = 0;

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java

@ -11,7 +11,7 @@ import com.fr.locale.InterProviderFactory;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午10:52:36
*/
public class StockPlotPane extends AbstractChartTypePane {
public class StockPlotPane extends AbstractDeprecatedChartTypePane {
private static final int STOCK = 0;

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java

@ -1,12 +1,14 @@
package com.fr.design.mainframe.chart.gui.type;
import com.fr.chart.chartattr.Chart;
import com.fr.common.annotations.Compatible;
/**
* Created by mengao on 2017/8/30.
* 不能删掉这个类echarts插件中用到
*/
public abstract class UserDefinedChartTypePane extends AbstractChartTypePane {
@Compatible
public abstract class UserDefinedChartTypePane extends AbstractDeprecatedChartTypePane {
protected String[] getTypeLayoutPath() {
return new String[0];
}

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java

@ -14,7 +14,7 @@ import com.fr.stable.Constants;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-25 下午08:33:55
*/
public class XYScatterPlotPane extends AbstractChartTypePane{
public class XYScatterPlotPane extends AbstractDeprecatedChartTypePane {
private static final long serialVersionUID = -601566194238908115L;
private static final int XYSCATTER_CHART = 0;

7
designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java

@ -1,6 +1,5 @@
package com.fr.extended.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
@ -9,7 +8,7 @@ import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
/**
* Created by shine on 2018/3/5.
*/
public class ExtendedTypePane<T extends AbstractChart> extends AbstractChartTypePane {
public class ExtendedTypePane<T extends AbstractChart> extends AbstractChartTypePane<AbstractChart> {
@Override
protected String[] getTypeIconPath() {
@ -35,7 +34,7 @@ public class ExtendedTypePane<T extends AbstractChart> extends AbstractChartType
}
@Override
public void populateBean(Chart chart) {
public void populateBean(AbstractChart chart) {
if (getTypeIconPath().length > 0) {
for (ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
@ -47,7 +46,7 @@ public class ExtendedTypePane<T extends AbstractChart> extends AbstractChartType
}
@Override
public void updateBean(Chart chart) {
public void updateBean(AbstractChart chart) {
update((T) chart);
if (getTypeIconPath().length > 0) {

5
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -12,9 +12,8 @@ import com.fr.design.gui.ilable.MultilineLabel;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import com.fr.js.NameJavaScriptGroup;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom;
@ -25,7 +24,7 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
public abstract class AbstractVanChartTypePane extends AbstractChartTypePane{
public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Chart> {
private static final long serialVersionUID = 7743244512351499265L;
private UICheckBox largeModelCheckBox;

4
designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java

@ -64,9 +64,9 @@ public class PolyComponentsBar extends JToolBar {
);
this.add(serIcons[0]);
for (int i = 0; i < typeLen; i++) {
String chartID = typeName[i].getPlotID();
String chartID = typeName[i].getChartID();
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(chartID);
BaseChartCollection chartCollection = BaseChartGetter.getStaticChartCollection(chartID);
BaseChartCollection chartCollection = BaseChartGetter.createChartCollection(chartID);
serIcons[i + 1] = new SerIcon(chartCollection, InterProviderFactory.getProvider().getLocText(typeName[i].getName()), iconPath);
this.add(serIcons[i + 1]);
}

Loading…
Cancel
Save