Browse Source

Merge pull request #18 in CHART/design from ~ZHENG/design:release/9.0 to release/9.0

* commit 'b32c869551cde257208d4c542ce2d12f8799e5d0': (21 commits)
  .DS_Store
  9.0面板修改
  修改方法
  修改方法名称
  条件属性存取classpath
  重命名类名
  9.0新图表配置面板调整
  修改类名称
  修改FormatPane 4 vanchart
  调整一下标题和图例的显示策略部分
  9.0新图表面板调整: 1、样式:标签面板 2、样式:提示面板 3、样式:数据表面板
  修改方法名称
  update
  添加地图数据目录
  删掉部分代码
  修改继承关系
  修改继承关系
  增加chart用的基础面板抽象类
  9.0图表样式修改: 1、整体布局调整 2、属性切换图标换为文字 3、样式:标题面板调整 4、样式:图例面板调整
  9.0图表样式修改: 1、整体布局调整 2、属性切换图标换为文字 3、样式:标题面板调整 4、样式:图例面板调整
  ...
master
superman 7 years ago
parent
commit
e951746a6a
  1. 3
      designer/src/com/fr/start/Designer.java
  2. 14
      designer_base/src/com/fr/design/actions/core/ActionFactory.java
  3. 44
      designer_base/src/com/fr/design/dialog/BasicScrollPane.java
  4. 2
      designer_base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
  5. 21
      designer_base/src/com/fr/design/gui/style/FormatPane.java
  6. 68
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  7. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/area.png
  8. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/bar.png
  9. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/bubble.png
  10. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/column.png
  11. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/custom.png
  12. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/drillmap.png
  13. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/funnel.png
  14. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/gantt.png
  15. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/gauge.png
  16. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/heatmap.png
  17. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/line.png
  18. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/map.png
  19. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/multiPie.png
  20. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/pie.png
  21. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/radar.png
  22. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/scatter.png
  23. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/structure.png
  24. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/treeMap.png
  25. BIN
      designer_chart/src/com/fr/design/images/form/toolbar/wordcloud.png
  26. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_Drill_Map.png
  27. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewBubble.png
  28. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewCustom.png
  29. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewFunnel.png
  30. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGantt.png
  31. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGauge.png
  32. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewHeatMap.png
  33. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMap.png
  34. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMultiPie.png
  35. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewRadar.png
  36. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewScatter.png
  37. BIN
      designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png
  38. 9
      designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java
  39. 5
      designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java
  40. 44
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java
  41. 38
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java
  42. 3
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/XYScatterSeriesPane.java
  43. 93
      designer_chart/src/com/fr/design/module/ChartDesignerModule.java
  44. 40
      designer_chart/src/com/fr/plugin/chart/area/AreaIndependentVanChartInterface.java
  45. 96
      designer_chart/src/com/fr/plugin/chart/area/VanChartAreaConditionPane.java
  46. 95
      designer_chart/src/com/fr/plugin/chart/area/VanChartAreaPlotPane.java
  47. 51
      designer_chart/src/com/fr/plugin/chart/area/VanChartAreaSeriesPane.java
  48. BIN
      designer_chart/src/com/fr/plugin/chart/area/images/area.png
  49. BIN
      designer_chart/src/com/fr/plugin/chart/area/images/custom.png
  50. BIN
      designer_chart/src/com/fr/plugin/chart/area/images/percentStack.png
  51. BIN
      designer_chart/src/com/fr/plugin/chart/area/images/stack.png
  52. 56
      designer_chart/src/com/fr/plugin/chart/bar/BarIndependentVanChartInterface.java
  53. 96
      designer_chart/src/com/fr/plugin/chart/bar/VanChartBarPlotPane.java
  54. 23
      designer_chart/src/com/fr/plugin/chart/bar/VanChartBarStylePane.java
  55. BIN
      designer_chart/src/com/fr/plugin/chart/bar/images/bar.png
  56. BIN
      designer_chart/src/com/fr/plugin/chart/bar/images/custom.png
  57. BIN
      designer_chart/src/com/fr/plugin/chart/bar/images/percentstack.png
  58. BIN
      designer_chart/src/com/fr/plugin/chart/bar/images/stack.png
  59. 85
      designer_chart/src/com/fr/plugin/chart/bubble/BubbleIndependentVanChartInterface.java
  60. 94
      designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionPane.java
  61. 22
      designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionSelectionPane.java
  62. 27
      designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleInteractivePane.java
  63. 171
      designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubblePlotPane.java
  64. 92
      designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleSeriesPane.java
  65. 57
      designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleStylePane.java
  66. 74
      designer_chart/src/com/fr/plugin/chart/bubble/component/VanChartBubblePane.java
  67. 184
      designer_chart/src/com/fr/plugin/chart/bubble/data/VanChartBubblePlotTableDataContentPane.java
  68. 28
      designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartBubbleRefreshTooltipPane.java
  69. 23
      designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaBackgroundPane.java
  70. 26
      designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaPane.java
  71. 19
      designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleLabelPane.java
  72. 18
      designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleTooltipPane.java
  73. BIN
      designer_chart/src/com/fr/plugin/chart/bubble/images/bubble.png
  74. BIN
      designer_chart/src/com/fr/plugin/chart/bubble/images/force.png
  75. BIN
      designer_chart/src/com/fr/plugin/chart/bubble/images/large.png
  76. 43
      designer_chart/src/com/fr/plugin/chart/column/ColumnBorderAttriPane.java
  77. 36
      designer_chart/src/com/fr/plugin/chart/column/ColumnIndependentVanChartInterface.java
  78. 93
      designer_chart/src/com/fr/plugin/chart/column/VanChartColumnConditionPane.java
  79. 34
      designer_chart/src/com/fr/plugin/chart/column/VanChartColumnLabelBorderPane.java
  80. 96
      designer_chart/src/com/fr/plugin/chart/column/VanChartColumnPlotPane.java
  81. 194
      designer_chart/src/com/fr/plugin/chart/column/VanChartColumnSeriesPane.java
  82. 143
      designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java
  83. BIN
      designer_chart/src/com/fr/plugin/chart/column/images/column.png
  84. BIN
      designer_chart/src/com/fr/plugin/chart/column/images/custom.png
  85. BIN
      designer_chart/src/com/fr/plugin/chart/column/images/percentstack.png
  86. BIN
      designer_chart/src/com/fr/plugin/chart/column/images/stack.png
  87. 56
      designer_chart/src/com/fr/plugin/chart/custom/CustomIndependentVanChartInterface.java
  88. 134
      designer_chart/src/com/fr/plugin/chart/custom/CustomPlotDesignerPaneFactory.java
  89. 66
      designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomDataPane.java
  90. 175
      designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotDataContentsTabPane.java
  91. 296
      designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java
  92. 27
      designer_chart/src/com/fr/plugin/chart/custom/component/CategoryCustomPlotTableDataContentPane.java
  93. 103
      designer_chart/src/com/fr/plugin/chart/custom/component/ChartImageCheckOutPane.java
  94. 84
      designer_chart/src/com/fr/plugin/chart/custom/component/CustomPlotLocationPane.java
  95. 36
      designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotReportDataContentPane.java
  96. 44
      designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotTableDataContentPane.java
  97. 19
      designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAreaBackgroundPane.java
  98. 43
      designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAxisConditionPane.java
  99. 55
      designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotAxisPane.java
  100. 396
      designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotSelectPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

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

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

@ -32,6 +32,8 @@ public class ActionFactory {
private static UpdateAction chartPreStyleAction = null;
private static UpdateAction chartMapEditorAction = null;
/**
* 待说明
*
@ -69,6 +71,18 @@ public class ActionFactory {
return chartPreStyleAction;
}
/**
* 注册图表的 地图资源
* @param action 地图资源action
*/
public static void registerChartMapEditorAction(UpdateAction action) {
chartMapEditorAction = action;
}
public static UpdateAction getChartMapEditorAction() {
return chartMapEditorAction;
}
/**
* kunsnat: 图表注册 悬浮元素编辑器 , 因为ChartCollecion和ChartQuickEditor一个在Chart,一个在Designer, 所以分开注册.
*

44
designer_base/src/com/fr/design/dialog/BasicScrollPane.java

@ -1,23 +1,15 @@
package com.fr.design.dialog;
import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import javax.swing.*;
import java.awt.*;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.iscrollbar.UIScrollBar;
public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
private static final long serialVersionUID = -4293765343535336275L;
private static final int MAXVALUE = 100;
@ -119,7 +111,7 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
/**
* august:不容易啊 还要用笔画图立个方程才计算出来
*
* @param e
* @param
*/
protected void ajustValues() {
doLayout();
@ -163,26 +155,30 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
} else {
int preferheight = leftcontentPane.getPreferredSize().height;
int value = scrollBar.getValue();
int baseValue = MAXVALUE - scrollBar.getVisibleAmount();
beginY = baseValue == 0 ? 0 : value * (preferheight - maxheight) / baseValue;
if(MAXVALUE - scrollBar.getVisibleAmount() != 0) {
beginY = value * (preferheight - maxheight) / (MAXVALUE - scrollBar.getVisibleAmount());
}
}
int width = parent.getWidth();
int height = parent.getHeight();
if (leftcontentPane.getPreferredSize().height > maxheight) {
leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth() - DET_WIDTH_OVER_HEIGHT, height + beginY);
scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height);
} else {
leftcontentPane.setBounds(0, 0, width - DET_WIDTH, height);
}
setLeftContentPaneBounds(parent, scrollBar, beginY, maxheight);
leftcontentPane.validate();
}
}
protected void setLeftContentPaneBounds(Container parent, UIScrollBar scrollBar, int beginY, int maxheight) {
int width = parent.getWidth();
int height = parent.getHeight();
if (leftcontentPane.getPreferredSize().height > maxheight) {
leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth() - DET_WIDTH_OVER_HEIGHT, height + beginY);
scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height);
} else {
leftcontentPane.setBounds(0, 0, width - DET_WIDTH, height);
}
}
protected boolean isShowScrollBar() {
return true;
}
@ -191,7 +187,7 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
public T updateBean() {
return null;
}
/**
* 用于在调用removeAll以后恢复原来pane的结构放在这边是因为BarLayout是内部类
* @param pane

2
designer_base/src/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java

@ -1,10 +1,10 @@
package com.fr.design.gui.frpane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.dialog.BasicPane;
import javax.swing.*;
import java.awt.*;

21
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -113,12 +113,7 @@ public class FormatPane extends AbstractBasicStylePane {
centerPane.setBorder(LEFT_BORDER);
frFontPane.setBorder(LEFT_BORDER);
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{null, centerPane},
new Component[]{fontPane, frFontPane},
};
Component[][] components = getComponent(fontPane, centerPane, typePane);
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
@ -126,6 +121,16 @@ public class FormatPane extends AbstractBasicStylePane {
this.add(panel, BorderLayout.CENTER);
}
protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{null, centerPane},
new Component[]{fontPane, frFontPane},
};
}
protected UIComboBoxRenderer createComBoxRender() {
return new UIComboBoxRenderer() {
@Override
@ -383,6 +388,10 @@ public class FormatPane extends AbstractBasicStylePane {
};
typeComboBox.setRenderer(render);
typeComboBox.addItemListener(itemListener);
setTypeComboBoxPane(typeComboBox);
}
protected void setTypeComboBoxPane (UIComboBox typeComboBox) {
this.add(typeComboBox, BorderLayout.NORTH);
}

68
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -25,6 +25,43 @@ import com.fr.form.ui.ChartEditor;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.AreaIndependentVanChartInterface;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.bar.BarIndependentVanChartInterface;
import com.fr.plugin.chart.bubble.BubbleIndependentVanChartInterface;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.column.ColumnIndependentVanChartInterface;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.custom.CustomIndependentVanChartInterface;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.drillmap.DrillMapIndependentVanChartInterface;
import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot;
import com.fr.plugin.chart.funnel.VanChartFunnelPlot;
import com.fr.plugin.chart.funnel.designer.FunnelIndependentVanChartInterface;
import com.fr.plugin.chart.gantt.VanChartGanttPlot;
import com.fr.plugin.chart.gantt.designer.GanttIndependentVanChartInterface;
import com.fr.plugin.chart.gauge.GaugeIndependentVanChartInterface;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot;
import com.fr.plugin.chart.heatmap.designer.HeatMapIndependentVanChartInterface;
import com.fr.plugin.chart.line.LineIndependentVanChartInterface;
import com.fr.plugin.chart.line.VanChartLinePlot;
import com.fr.plugin.chart.map.MapIndependentVanChartInterface;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.multilayer.MultiPieIndependentVanChartInterface;
import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot;
import com.fr.plugin.chart.pie.PieIndependentVanChartInterface;
import com.fr.plugin.chart.radar.RadarIndependentVanChartInterface;
import com.fr.plugin.chart.radar.VanChartRadarPlot;
import com.fr.plugin.chart.scatter.ScatterIndependentVanChartInterface;
import com.fr.plugin.chart.scatter.VanChartScatterPlot;
import com.fr.plugin.chart.structure.VanChartStructurePlot;
import com.fr.plugin.chart.structure.desinger.StructureIndependentVanChartInterface;
import com.fr.plugin.chart.treemap.TreeMapIndependentVanChartInterface;
import com.fr.plugin.chart.treemap.VanChartTreeMapPlot;
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot;
import com.fr.plugin.chart.wordcloud.designer.WordCloudIndependentVanChartInterface;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.PluginSingleInjection;
@ -58,6 +95,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
static {
readDefault();
readVanChart();
StableFactory.registerMarkedObject(XML_TAG, classManager);
}
@ -130,6 +168,36 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
aRowChart.createSlotImage();
}
}
private static void readVanChart() {
if (chartTypeInterfaces.containsKey(ChartTypeManager.VAN_CHART_PRIORITY)) {
return;
}
CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap> chartUIList =
new CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>(LinkedHashMap.class);
chartUIList.put(PiePlot4VanChart.VAN_CHART_PIE_PLOT, new PieIndependentVanChartInterface());
chartUIList.put(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID, new ColumnIndependentVanChartInterface());
chartUIList.put(VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID, new BarIndependentVanChartInterface());
chartUIList.put(VanChartLinePlot.VAN_CHART_LINE_PLOT, new LineIndependentVanChartInterface());
chartUIList.put(VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID, new AreaIndependentVanChartInterface());
chartUIList.put(VanChartGaugePlot.VAN_CHART_GAUGE_PLOT, new GaugeIndependentVanChartInterface());
chartUIList.put(VanChartRadarPlot.VAN_CHART_RADAR_PLOT, new RadarIndependentVanChartInterface());
chartUIList.put(VanChartScatterPlot.VAN_CHART_SCATTER_PLOT_ID, new ScatterIndependentVanChartInterface());
chartUIList.put(VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID, new BubbleIndependentVanChartInterface());
chartUIList.put(VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID, new CustomIndependentVanChartInterface());
chartUIList.put(VanChartMultiPiePlot.VAN_CHART_MULTILAYER_PLOT_ID, new MultiPieIndependentVanChartInterface());
chartUIList.put(VanChartMapPlot.VAN_CHART_MAP_ID, new MapIndependentVanChartInterface());
chartUIList.put(VanChartDrillMapPlot.VAN_CHART_DRILL_MAP_ID, new DrillMapIndependentVanChartInterface());
chartUIList.put(VanChartTreeMapPlot.VAN_CHART_TREE_MAP_PLOT_ID, new TreeMapIndependentVanChartInterface());
chartUIList.put(VanChartFunnelPlot.VAN_CHART_FUNNEL_PLOT_ID, new FunnelIndependentVanChartInterface());
chartUIList.put(VanChartHeatMapPlot.VAN_CHART_HEAT_MAP_ID, new HeatMapIndependentVanChartInterface());
chartUIList.put(VanChartWordCloudPlot.WORD_CLOUD_PLOT_ID, new WordCloudIndependentVanChartInterface());
chartUIList.put(VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface());
chartUIList.put(VanChartStructurePlot.STRUCTURE_PLOT_ID, new StructureIndependentVanChartInterface());
chartTypeInterfaces.put(ChartTypeManager.VAN_CHART_PRIORITY, chartUIList);
}
private static void readDefault() {

BIN
designer_chart/src/com/fr/design/images/form/toolbar/area.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/bar.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/bubble.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/column.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/custom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/drillmap.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/funnel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/gantt.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/gauge.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/heatmap.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/line.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/map.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/multiPie.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/pie.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/radar.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/scatter.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/structure.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
designer_chart/src/com/fr/design/images/form/toolbar/treeMap.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

BIN
designer_chart/src/com/fr/design/images/form/toolbar/wordcloud.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_Drill_Map.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewBubble.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewCustom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewFunnel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGantt.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGauge.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewHeatMap.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMap.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMultiPie.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewRadar.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewScatter.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

BIN
designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

9
designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java

@ -4,6 +4,9 @@ package com.fr.design.mainframe.chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import javax.swing.*;
import java.awt.*;
public abstract class AbstractChartAttrPane extends AbstractAttrNoScrollPane {
public abstract void populate(ChartCollection collection);
@ -25,6 +28,12 @@ public abstract class AbstractChartAttrPane extends AbstractAttrNoScrollPane {
}
protected void initContentPane() {
leftContentPane = createContentPane();
leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 0, 0, 0, original));
this.add(leftContentPane, BorderLayout.CENTER);
}
/**
* 刷新图表数据界面
* @param collection 图表收集器

5
designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe.chart;
import com.fr.base.BaseUtils;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.ChartTypeInterfaceManager;
@ -74,12 +73,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
//构建主面板
protected void createTabsPane() {
Icon[] iconArray = new Icon[paneList.size()];
String[] iconArray = new String[paneList.size()];
card = new CardLayout();
center = new JPanel(card);
for (int i = 0; i < paneList.size(); i++) {
AbstractChartAttrPane pane = paneList.get(i);
iconArray[i] = BaseUtils.readIcon(pane.getIconPath());
iconArray[i] = pane.title4PopupWindow();
center.add(pane, pane.title4PopupWindow());
}

44
designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java

@ -4,9 +4,9 @@ package com.fr.design.mainframe.chart.gui;
* Created by hufan on 2016/10/20.
*/
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.base.AttrChangeConfig;
import com.fr.chart.base.AttrChangeType;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
@ -15,6 +15,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.general.Inter;
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper;
import javax.swing.*;
import java.awt.*;
@ -55,11 +56,9 @@ public class ChangeConfigPane extends BasicBeanPane<ChartCollection> {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p,p,p,p};
double[] rowSize = {p,p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change_Style") + ":"),configStyleButton},
new Component[]{null, null},
new Component[]{new JSeparator(), null},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change_Style")),configStyleButton},
new Component[]{configPane, null},
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -84,6 +83,8 @@ public class ChangeConfigPane extends BasicBeanPane<ChartCollection> {
panel.add(buttonConfigPane, "button");
panel.add(carouselConfigPane, "carousel");
panel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0));
return panel;
}
@ -92,35 +93,33 @@ public class ChangeConfigPane extends BasicBeanPane<ChartCollection> {
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p,p,p};
timeInterval = new UISpinner(MIN_TIME, MAX_TIME, 1, 0);
colorSelectBox4carousel = new ColorSelectBoxWithOutTransparent(WIDTH);
Component[][] components = new Component[][]{
new Component[]{createTimeIntervalPane(),null},
new Component[]{new JSeparator(),null},
new Component[]{createCarouseBackgroundColorPane(),null},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Time_Interval")), timeInterval},
new Component[]{new UILabel(Inter.getLocText("Background")),colorSelectBox4carousel},
};
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
}
private Component createTimeIntervalPane() {
timeInterval = new UISpinner(MIN_TIME, MAX_TIME, 1, 0);
return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Time_Interval") + ":", timeInterval);
}
private JPanel createCarouseBackgroundColorPane() {
colorSelectBox4carousel = new ColorSelectBoxWithOutTransparent(WIDTH);
return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Background") + ":", colorSelectBox4carousel);
return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize);
}
private JPanel createTitleStylePane(){
styleAttrPane = new ChartTextAttrPane();
styleAttrPane = new ChartTextAttrPane(){
protected Component[][] getComponents(JPanel buttonPane) {
return new Component[][]{
new Component[]{fontNameComboBox, null},
new Component[]{buttonPane, null}
};
}
};
styleAttrPane.setPreferredSize(new Dimension(WIDTH, (int) styleAttrPane.getPreferredSize().getHeight()));
return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style")+":", styleAttrPane);
return TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Plugin-Chart_Character")+":", styleAttrPane);
}
private JPanel createButtonBackgroundColorPane(){
colorSelectBox4button = new ColorSelectBoxWithOutTransparent(WIDTH);
return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Background") + ":", colorSelectBox4button);
return TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Background") + ":", colorSelectBox4button);
}
private JPanel createButtonConfigPane() {
@ -130,7 +129,6 @@ public class ChangeConfigPane extends BasicBeanPane<ChartCollection> {
double[] rowSize = {p,p,p};
Component[][] components = new Component[][]{
new Component[]{createTitleStylePane(),null},
new Component[]{new JSeparator(),null},
new Component[]{createButtonBackgroundColorPane(),null},
};

38
designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java

@ -1,25 +1,23 @@
package com.fr.design.mainframe.chart.gui.style;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.JPanel;
import com.fr.base.BaseUtils;
import com.fr.base.Utils;
import com.fr.chart.base.TextAttr;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.dialog.BasicPane;
import com.fr.general.FRFont;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper;
import javax.swing.*;
import java.awt.*;
public class ChartTextAttrPane extends BasicPane {
private static final long serialVersionUID = 6731679928019436869L;
@ -147,17 +145,23 @@ public class ChartTextAttrPane extends BasicPane {
buttonPane.add(GUICoreUtils.createFlowPane(components1, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST);
double[] columnSize = {f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{fontNameComboBox},
new Component[]{buttonPane}
};
double[] columnSize = {p,f};
double[] rowSize = {p, p, p};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize);
this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.CENTER);
populate(FRFont.getInstance());
}
protected Component[][] getComponents(JPanel buttonPane) {
UILabel text = new UILabel(Inter.getLocText("Plugin-Chart_Character"), SwingConstants.LEFT);
return new Component[][]{
new Component[]{null, null},
new Component[]{text, fontNameComboBox},
new Component[]{null, buttonPane}
};
}
}

3
designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/XYScatterSeriesPane.java

@ -10,6 +10,7 @@ import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.Marker;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.ConfigHelper;
/**
* 散点图 属性表 系列界面.
@ -57,7 +58,7 @@ public class XYScatterSeriesPane extends LineSeriesPane {
attrList.remove(attr);
}
if(!ComparatorUtils.equals(markerPane.getSelectedMarkder().getMarkerType(), Marker.NULL_M)){
if(!ComparatorUtils.equals(markerPane.getSelectedMarkder().getMarkerType(), ConfigHelper.NULL_M)){
attrList.addDataSeriesCondition(new AttrMarkerType(markerPane.getSelectedMarkder().getMarkerType()));
}
}

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

@ -1 +1,92 @@
package com.fr.design.module; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.App; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.form.ui.ChartEditor; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import javax.swing.*; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 上午9:13 */ public class ChartDesignerModule extends DesignModule { public void start() { super.start(); dealBeforeRegister(); register(); registerFloatEditor(); } protected void dealBeforeRegister(){ StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); } private void register(){ DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); DesignModuleFactory.registerChartDialogClass(ChartDialog.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); } protected void registerFloatEditor() { ActionFactory.registerChartCollection(ChartCollection.class); } /** * 返回设计器能打开的模板类型的一个数组列表 * * @return 可以打开的模板类型的数组 */ public App<?>[] apps4TemplateOpener() { return new App[0]; } protected WidgetOption[] options4Show() { ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if (ArrayUtils.isEmpty(rowChart)) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } return child; } public String getInterNationalName() { return Inter.getLocText("FR-Chart-Design_ChartModule"); } }
package com.fr.design.module;
import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.chart.ChartDialog;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.ChartWidgetOption;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.mainframe.App;
import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.form.ui.ChartEditor;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.plugin.chart.map.server.ChartMapEditorAction;
import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import javax.swing.*;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 7.0.3
* Date: 13-7-8
* Time: 上午9:13
*/
public class ChartDesignerModule extends DesignModule {
public void start() {
super.start();
dealBeforeRegister();
register();
registerFloatEditor();
}
protected void dealBeforeRegister(){
StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class);
StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class);
}
private void register(){
DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup());
DesignModuleFactory.registerChartEditorClass(ChartEditor.class);
DesignModuleFactory.registerChartComponentClass(ChartComponent.class);
DesignModuleFactory.registerChartDialogClass(ChartDialog.class);
DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);
ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction());
ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction());
}
protected void registerFloatEditor() {
ActionFactory.registerChartCollection(ChartCollection.class);
}
/**
* 返回设计器能打开的模板类型的一个数组列表
*
* @return 可以打开的模板类型的数组
*/
public App<?>[] apps4TemplateOpener() {
return new App[0];
}
protected WidgetOption[] options4Show() {
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
for (int i = 0; i < typeName.length; i++) {
String plotID = typeName[i].getPlotID();
Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
if (ArrayUtils.isEmpty(rowChart)) {
continue;
}
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID);
Icon icon = IOUtils.readIcon(iconPath);
child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]);
}
return child;
}
public String getInterNationalName() {
return Inter.getLocText("FR-Chart-Design_ChartModule");
}
}

40
designer_chart/src/com/fr/plugin/chart/area/AreaIndependentVanChartInterface.java

@ -0,0 +1,40 @@
package com.fr.plugin.chart.area;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI;
/**
* Created by Mitisky on 15/11/18.
*/
public class AreaIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI {
@Override
public String getIconPath() {
return "com/fr/design/images/form/toolbar/area.png";
}
@Override
public AbstractChartTypePane getPlotTypePane() {
return new VanChartAreaPlotPane();
}
public ConditionAttributesPane getPlotConditionPane(Plot plot){
return new VanChartAreaConditionPane(plot);
}
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){
return new VanChartAreaSeriesPane(parent, plot);
}
/**
* plot面板的标题
* 插件兼容
*/
public String getPlotTypeTitle4PopupWindow(){
return VanChartAreaPlotPane.TITLE;
}
}

96
designer_chart/src/com/fr/plugin/chart/area/VanChartAreaConditionPane.java

@ -0,0 +1,96 @@
package com.fr.plugin.chart.area;
import com.fr.chart.base.AttrBackground;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Plot;
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane;
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.plugin.chart.attr.EffectHelper;
import com.fr.plugin.chart.base.AttrAreaSeriesFillColorBackground;
import com.fr.plugin.chart.base.AttrDataSheet;
import com.fr.plugin.chart.base.AttrEffect;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrTooltip;
import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.plugin.chart.base.VanChartAttrTrendLine;
import com.fr.plugin.chart.designer.PlotFactory;
import com.fr.plugin.chart.designer.other.condition.item.VanChartAreaFillColorConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartDataSheetContentPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartLineTypeConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartMarkerConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartTrendLineConditionPane;
import com.fr.plugin.chart.glyph.VanChartMultiCategoryDataPoint;
import com.fr.plugin.chart.scatter.large.VanChartLargeModelMarkerConditionPane;
import java.awt.*;
/**
* Created by Mitisky on 15/11/18.
*/
public class VanChartAreaConditionPane extends DataSeriesConditionPane {
private static final long serialVersionUID = -7180705321732069806L;
public VanChartAreaConditionPane(Plot plot) {
super(plot);
}
protected void initComponents() {
super.initComponents();
//添加全部条件属性后被遮挡
liteConditionPane.setPreferredSize(new Dimension(300, 400));
}
@Override
protected void addBasicAction() {
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this));
classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this));
classPaneMap.put(AttrAreaSeriesFillColorBackground.class, new VanChartAreaFillColorConditionPane(this, plot));
classPaneMap.put(VanChartAttrLine.class, new VanChartLineTypeConditionPane(this));
classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot));
//是否使用数据表
if (plot.getDataSheet().isVisible()) {
classPaneMap.put(AttrDataSheet.class, new VanChartDataSheetContentPane(this, plot));
}
if(PlotFactory.largeDataModel(plot)){
classPaneMap.put(VanChartAttrMarker.class, new VanChartLargeModelMarkerConditionPane(this));
} else {
classPaneMap.put(VanChartAttrMarker.class, new VanChartMarkerConditionPane(this));
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getAreaPlotDefaultEffect()));
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot));
}
}
protected void addStyleAction() {
}
@Override
protected ChartConditionPane createListConditionPane() {
return new ChartConditionPane(){
@Override
public String[] columns2Populate() {
return new String[]{
ChartConstants.CATEGORY_INDEX,
ChartConstants.CATEGORY_NAME,
ChartConstants.SERIES_INDEX,
ChartConstants.SERIES_NAME,
ChartConstants.VALUE,
VanChartMultiCategoryDataPoint.CATEGORY_ARRAY,
};
}
};
}
/**
* 返回图表class对象
* @return class对象
*/
public Class<? extends Plot> class4Correspond() {
return VanChartAreaPlot.class;
}
}

95
designer_chart/src/com/fr/plugin/chart/area/VanChartAreaPlotPane.java

@ -0,0 +1,95 @@
package com.fr.plugin.chart.area;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
/**
* Created by Mitisky on 15/11/18.
*/
public class VanChartAreaPlotPane extends AbstractVanChartTypePane {
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewArea");
private static final long serialVersionUID = -8161581682558781651L;
@Override
protected String[] getTypeIconPath() {
return new String[]{"/com/fr/plugin/chart/area/images/area.png",
"/com/fr/plugin/chart/area/images/stack.png",
"/com/fr/plugin/chart/area/images/percentStack.png",
"/com/fr/plugin/chart/area/images/custom.png",
};
}
@Override
protected String[] getTypeTipName() {
String area = Inter.getLocText("FR-Chart-Type_Area");
String stack = Inter.getLocText("FR-Chart-Type_Stacked");
String percent = Inter.getLocText("FR-Chart-Use_Percent");
return new String[]{
area,
stack + area,
percent + stack + area,
Inter.getLocText("FR-Chart-Mode_Custom")
};
}
/**
* 返回界面标题
* @return 界面标题
*/
public String title4PopupWindow() {
return Inter.getLocText("Plugin-ChartF_NewArea");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartAreaPlot) {
lastTypeIndex = ((VanChartAreaPlot) plot).getVanChartPlotType().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
/**
* 获取各图表类型界面ID, 本质是plotID
*
* @return 图表类型界面ID
*/
@Override
protected String getPlotTypeID() {
return VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID;
}
protected Plot getSelectedClonedPlot(){
VanChartAreaPlot newPlot = null;
Chart[] areaChart = AreaIndependentVanChart.AreaVanChartTypes;
for(int i = 0, len = areaChart.length; i < len; i++){
if(typeDemo.get(i).isPressing){
newPlot = (VanChartAreaPlot)areaChart[i].getPlot();
}
}
Plot cloned = null;
try {
cloned = (Plot)newPlot.clone();
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error In AreaChart");
}
return cloned;
}
public Chart getDefaultChart() {
return AreaIndependentVanChart.AreaVanChartTypes[0];
}
}

51
designer_chart/src/com/fr/plugin/chart/area/VanChartAreaSeriesPane.java

@ -0,0 +1,51 @@
package com.fr.plugin.chart.area;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.plugin.chart.column.VanChartCustomStackAndAxisConditionPane;
import com.fr.plugin.chart.line.VanChartLineSeriesPane;
import javax.swing.*;
import java.awt.*;
public class VanChartAreaSeriesPane extends VanChartLineSeriesPane{
private static final long serialVersionUID = 5497989595104913025L;
public VanChartAreaSeriesPane(ChartStylePane parent, Plot plot){
super(parent, plot);
}
protected JPanel getContentInPlotType(){
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] row = {p,p,p,p,p,p,p,p,p,p,p,p};
double[] col = {f};
Component[][] components = new Component[][]{
new Component[]{createStylePane()},
new Component[]{stylePane == null ? null : new JSeparator()},
new Component[]{createLineTypePane()},
new Component[]{new JSeparator()},
new Component[]{createMarkerPane()},
new Component[]{new JSeparator()},
new Component[]{createAreaFillColorPane()},
new Component[]{new JSeparator()},
new Component[]{createStackedAndAxisPane()},
new Component[]{createLargeDataModelPane()},
new Component[]{new JSeparator()},
new Component[]{createTrendLinePane()},
};
contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col);
return contentPane;
}
protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() {
return VanChartCustomStackAndAxisConditionPane.class;
}
}

BIN
designer_chart/src/com/fr/plugin/chart/area/images/area.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
designer_chart/src/com/fr/plugin/chart/area/images/custom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

BIN
designer_chart/src/com/fr/plugin/chart/area/images/percentStack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

BIN
designer_chart/src/com/fr/plugin/chart/area/images/stack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

56
designer_chart/src/com/fr/plugin/chart/bar/BarIndependentVanChartInterface.java

@ -0,0 +1,56 @@
package com.fr.plugin.chart.bar;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.chart.column.VanChartColumnConditionPane;
import com.fr.plugin.chart.column.VanChartColumnSeriesPane;
import com.fr.plugin.chart.designer.other.VanChartOtherPane;
import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI;
/**
* Created by Mitisky on 15/10/20.
*/
public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI {
@Override
public String getIconPath() {
return "com/fr/design/images/form/toolbar/bar.png";
}
@Override
public AbstractChartTypePane getPlotTypePane() {
return new VanChartBarPlotPane();
}
public ConditionAttributesPane getPlotConditionPane(Plot plot){
return new VanChartColumnConditionPane(plot);
}
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){
return new VanChartColumnSeriesPane(parent, plot);
}
/**
* 图表的属性界面数组
* @return 属性界面
*/
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){
VanChartStylePane stylePane = new VanChartBarStylePane(listener);
VanChartOtherPane otherPane = new VanChartOtherPane();
return new AbstractChartAttrPane[]{stylePane, otherPane};
}
/**
* plot面板的标题
* 插件兼容
*/
public String getPlotTypeTitle4PopupWindow(){
return VanChartBarPlotPane.TITLE;
}
}

96
designer_chart/src/com/fr/plugin/chart/bar/VanChartBarPlotPane.java

@ -0,0 +1,96 @@
package com.fr.plugin.chart.bar;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
/**
* Created by Mitisky on 15/10/20.
*/
public class VanChartBarPlotPane extends AbstractVanChartTypePane {
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewBar");
private static final long serialVersionUID = 2879689884048643002L;
@Override
protected String[] getTypeIconPath() {
return new String[]{"/com/fr/plugin/chart/bar/images/bar.png",
"/com/fr/plugin/chart/bar/images/stack.png",
"/com/fr/plugin/chart/bar/images/percentstack.png",
"/com/fr/plugin/chart/bar/images/custom.png",
};
}
@Override
protected String[] getTypeTipName() {
String bar = Inter.getLocText("FR-Chart-Type_Bar");
String stack = Inter.getLocText("FR-Chart-Type_Stacked");
String percent = Inter.getLocText("FR-Chart-Use_Percent");
return new String[]{
bar,
stack + bar,
percent + stack + bar,
Inter.getLocText("FR-Chart-Mode_Custom")
};
}
/**
* 返回界面标题
* @return 界面标题
*/
public String title4PopupWindow() {
return Inter.getLocText("Plugin-ChartF_NewBar");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartColumnPlot) {
lastTypeIndex = ((VanChartColumnPlot)plot).getVanChartPlotType().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
/**
* 获取各图表类型界面ID, 本质是plotID
*
* @return 图表类型界面ID
*/
@Override
protected String getPlotTypeID() {
return VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID;
}
protected Plot getSelectedClonedPlot(){
VanChartColumnPlot newPlot = null;
Chart[] barChart = BarIndependentVanChart.BarVanChartTypes;
for(int i = 0, len = barChart.length; i < len; i++){
if(typeDemo.get(i).isPressing){
newPlot = (VanChartColumnPlot)barChart[i].getPlot();
}
}
Plot cloned = null;
try {
cloned = (Plot)newPlot.clone();
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error In ColumnChart");
}
return cloned;
}
public Chart getDefaultChart() {
return BarIndependentVanChart.BarVanChartTypes[0];
}
}

23
designer_chart/src/com/fr/plugin/chart/bar/VanChartBarStylePane.java

@ -0,0 +1,23 @@
package com.fr.plugin.chart.bar;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.designer.style.axis.bar.VanChartBarAxisPane;
import java.util.List;
/**
* Created by Mitisky on 16/6/8.
*/
public class VanChartBarStylePane extends VanChartStylePane {
public VanChartBarStylePane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected void createVanChartAxisPane(List<BasicPane> paneList, VanChartAxisPlot plot) {
paneList.add(new VanChartBarAxisPane(plot, VanChartBarStylePane.this));
}
}

BIN
designer_chart/src/com/fr/plugin/chart/bar/images/bar.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

BIN
designer_chart/src/com/fr/plugin/chart/bar/images/custom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

BIN
designer_chart/src/com/fr/plugin/chart/bar/images/percentstack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

BIN
designer_chart/src/com/fr/plugin/chart/bar/images/stack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

85
designer_chart/src/com/fr/plugin/chart/bubble/BubbleIndependentVanChartInterface.java

@ -0,0 +1,85 @@
package com.fr.plugin.chart.bubble;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.report.BubblePlotReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.chart.bubble.data.VanChartBubblePlotTableDataContentPane;
import com.fr.plugin.chart.designer.other.VanChartOtherPane;
import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.vanchart.AbstractIndependentVanChartUI;
/**
* Created by Mitisky on 16/3/31.
*/
public class BubbleIndependentVanChartInterface extends AbstractIndependentVanChartUI {
/**
* 图表的类型定义界面类型就是属性表的第一个界面
*
* @return 图表的类型定义界面类型
*/
@Override
public AbstractChartTypePane getPlotTypePane() {
return new VanChartBubblePlotPane();
}
/**
* 图标路径
*
* @return 图标路径
*/
@Override
public String getIconPath() {
return "com/fr/design/images/form/toolbar/bubble.png";
}
@Override
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){
return new VanChartBubbleSeriesPane(parent, plot);
}
@Override
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){
if(((VanChartBubblePlot) plot).isForceBubble()){
return super.getTableDataSourcePane(plot, parent);
}
return new VanChartBubblePlotTableDataContentPane(parent);
}
@Override
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){
if(((VanChartBubblePlot) plot).isForceBubble()){
return super.getReportDataSourcePane(plot, parent);
}
return new BubblePlotReportDataContentPane(parent);
}
/**
* 图表的属性界面数组
* @return 属性界面
*/
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){
VanChartStylePane stylePane = new VanChartBubbleStylePane(listener);
VanChartOtherPane otherPane = new VanChartOtherPane(){
protected BasicBeanPane<Chart> createInteractivePane() {
return new VanChartBubbleInteractivePane();
}
};
return new AbstractChartAttrPane[]{stylePane, otherPane};
}
public ConditionAttributesPane getPlotConditionPane(Plot plot){
return new VanChartBubbleConditionPane(plot);
}
public String getPlotTypeTitle4PopupWindow(){
return VanChartBubblePlotPane.TITLE;
}
}

94
designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionPane.java

@ -0,0 +1,94 @@
package com.fr.plugin.chart.bubble;
import com.fr.chart.base.AttrAlpha;
import com.fr.chart.base.AttrBackground;
import com.fr.chart.chartattr.Plot;
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane;
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane;
import com.fr.plugin.chart.attr.EffectHelper;
import com.fr.plugin.chart.base.AttrEffect;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrTooltip;
import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble;
import com.fr.plugin.chart.designer.PlotFactory;
import com.fr.plugin.chart.designer.other.condition.item.VanChartBubbleSetConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane;
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel;
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltip;
import com.fr.plugin.chart.scatter.component.label.VanChartScatterLabelConditionPane;
import com.fr.plugin.chart.scatter.component.tooltip.VanChartScatterTooltipConditionPane;
import java.awt.*;
/**
* Created by Mitisky on 16/3/31.
*/
public class VanChartBubbleConditionPane extends DataSeriesConditionPane {
private static final long serialVersionUID = -7180705321732069806L;
public VanChartBubbleConditionPane(Plot plot) {
super(plot);
}
protected void initComponents() {
super.initComponents();
//添加全部条件属性后被遮挡
liteConditionPane.setPreferredSize(new Dimension(300, 400));
}
private boolean forceBubble() {
return plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble();
}
@Override
protected ChartConditionPane createListConditionPane() {
return forceBubble() ? new ChartConditionPane() : new VanChartBubbleConditionSelectionPane();
}
@Override
protected void addBasicAction() {
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this));
classPaneMap.put(VanChartAttrBubble.class, new VanChartBubbleSetConditionPane(this));
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this));
if(forceBubble()){
addForceAction();
} else if(PlotFactory.largeDataModel(plot)){
addLargeAction();
} else {
addNormalAction();
}
}
private void addNormalAction() {
classPaneMap.put(ScatterAttrLabel.class, new VanChartScatterLabelConditionPane(this, plot));
classPaneMap.put(ScatterAttrTooltip.class, new VanChartScatterTooltipConditionPane(this, plot));
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getBubblePlotDefaultEffect()));
}
private void addForceAction() {
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot));
classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot));
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getBubblePlotDefaultEffect()));
}
private void addLargeAction() {
classPaneMap.put(ScatterAttrTooltip.class, new VanChartScatterTooltipConditionPane(this, plot));
}
protected void addStyleAction() {
}
/**
* 返回图表class对象
* @return class对象
*/
public Class<? extends Plot> class4Correspond() {
return VanChartBubblePlot.class;
}
}

22
designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionSelectionPane.java

@ -0,0 +1,22 @@
package com.fr.plugin.chart.bubble;
import com.fr.chart.base.ChartConstants;
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane;
import com.fr.plugin.chart.scatter.VanChartScatterDataPoint;
/**
* Created by Mitisky on 16/3/31.
*/
public class VanChartBubbleConditionSelectionPane extends ChartConditionPane {
public String[] columns2Populate() {
return new String[]{
ChartConstants.SERIES_INDEX,
ChartConstants.SERIES_NAME,
VanChartScatterDataPoint.X,
VanChartScatterDataPoint.Y,
ChartConstants.VALUE
};
}
}

27
designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleInteractivePane.java

@ -0,0 +1,27 @@
package com.fr.plugin.chart.bubble;
import com.fr.chart.chartattr.Plot;
import com.fr.general.Inter;
import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.designer.other.VanChartInteractivePaneWithOutSort;
/**
* Created by Mitisky on 16/3/31.
*/
public class VanChartBubbleInteractivePane extends VanChartInteractivePaneWithOutSort {
protected String[] getNameArray() {
Plot plot = chart.getPlot();
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) {
return new String[]{Inter.getLocText("Plugin-ChartF_XYAxis"), Inter.getLocText("Chart-Use_None")};
}
return super.getNameArray();
}
protected String[] getValueArray() {
Plot plot = chart.getPlot();
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) {
return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE};
}
return super.getValueArray();
}
}

171
designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubblePlotPane.java

@ -0,0 +1,171 @@
package com.fr.plugin.chart.bubble;
import com.fr.chart.base.AttrAlpha;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel;
import com.fr.plugin.chart.vanchart.VanChart;
/**
* Created by Mitisky on 16/3/31.
*/
public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewBubble");;
private static final long serialVersionUID = -3481633368542654247L;
private static final float FORCE_ALPHA = 1.0f;
private static final float ALPHA = 0.7f;
@Override
protected String[] getTypeIconPath() {
return new String[]{"/com/fr/plugin/chart/bubble/images/bubble.png",
"/com/fr/plugin/chart/bubble/images/force.png"
};
}
@Override
protected String[] getTypeTipName() {
return new String[]{
Inter.getLocText("FR-Chart-Chart_BubbleChart"),
Inter.getLocText("Plugin-ChartF_NewForceBubble")
};
}
/**
* 返回界面标题
* @return 界面标题
*/
public String title4PopupWindow() {
return Inter.getLocText("Plugin-ChartF_NewBubble");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot)plot).isForceBubble()){
lastTypeIndex = BubblePlotType.FORCE.ordinal();
} else {
lastTypeIndex = BubblePlotType.NORMAL.ordinal();
}
typeDemo.get(lastTypeIndex).isPressing = true;
checkDemosBackground();
}
private void removeDefaultAttr(ConditionAttr conditionAttr, Class <? extends DataSeriesCondition> targetClass) {
DataSeriesCondition attr = conditionAttr.getExisted(targetClass);
if (attr != null){
conditionAttr.remove(targetClass);
}
}
/**
* 获取各图表类型界面ID, 本质是plotID
*
* @return 图表类型界面ID
*/
@Override
protected String getPlotTypeID() {
return VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID;
}
protected Plot getSelectedClonedPlot(){
VanChartBubblePlot newPlot = null;
Chart[] bubbleChart = BubbleIndependentVanChart.BubbleVanChartTypes;
for(int i = 0, len = bubbleChart.length; i < len; i++){
if(typeDemo.get(i).isPressing){
newPlot = (VanChartBubblePlot)bubbleChart[i].getPlot();
}
}
Plot cloned = null;
try {
cloned = (Plot)newPlot.clone();
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error In BubbleChart");
}
return cloned;
}
public Chart getDefaultChart() {
return BubbleIndependentVanChart.BubbleVanChartTypes[0];
}
@Override
/**
* 力學氣泡圖切換到其他氣泡圖時刪除條件屬性
* 并且将bubbleAttr属性重置
*/
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{
cloneOldDefaultAttrConditionCollection(oldPlot, newPlot);
}
@Override
protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{
if (oldPlot.getConditionCollection() != null) {
ConditionCollection newCondition = new ConditionCollection();
newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone());
newPlot.setConditionCollection(newCondition);
ConditionAttr attrList = newCondition.getDefaultAttr();
//根据气泡图类型,重设透明度属性
removeDefaultAttr(attrList, AttrAlpha.class);
//删除标签属性(防止切换到大数据气泡图标签属性会拷贝过去)
removeDefaultAttr(attrList, ScatterAttrLabel.class);
AttrAlpha attrAlpha = new AttrAlpha();
attrAlpha.setAlpha(((VanChartBubblePlot)newPlot).isForceBubble() ? FORCE_ALPHA : ALPHA);
attrList.addDataSeriesCondition(attrAlpha);
}
}
@Override
protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException {
if(oldPlot instanceof VanChartBubblePlot && newPlot instanceof VanChartBubblePlot){
if(((VanChartBubblePlot) oldPlot).isForceBubble() == ((VanChartBubblePlot) newPlot).isForceBubble()){
super.cloneHotHyperLink(oldPlot, newPlot);
}
}
}
@Override
protected VanChartTools createVanChartTools() {
VanChartTools tools = new VanChartTools();
tools.setSort(false);
return tools;
}
/**
* 气泡图相同图表类型之间切换的时候chart的部分属性也需要重置
* @param chart
*/
@Override
protected void resetChartAttr4SamePlot(Chart chart){
VanChartZoom vanChartZoom = new VanChartZoom();
((VanChart)chart).setVanChartZoom(vanChartZoom);
//重置监控刷新选项
resetRefreshMoreLabelAttr((VanChart)chart);
}
}

92
designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleSeriesPane.java

@ -0,0 +1,92 @@
package com.fr.plugin.chart.bubble;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.general.Inter;
import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble;
import com.fr.plugin.chart.bubble.component.VanChartBubblePane;
import com.fr.plugin.chart.custom.component.VanChartCustomAxisConditionPane;
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper;
import com.fr.plugin.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import com.fr.plugin.chart.designer.style.series.VanChartCustomStackAndAxisEditPane;
import javax.swing.*;
import java.awt.*;
/**
* Created by Mitisky on 16/3/31.
*/
public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane {
private static final long serialVersionUID = 5595016643808487932L;
private VanChartBubblePane bubblePane;
public VanChartBubbleSeriesPane(ChartStylePane parent, Plot plot) {
super(parent, plot);
}
protected JPanel getContentInPlotType() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] row = {p, p, p, p, p, p};
double[] col = {f};
Component[][] components = new Component[][]{
new Component[]{createBubblePane()},
new Component[]{new JSeparator()},
new Component[]{createStackedAndAxisPane()},
new Component[]{createAlphaPane()},
new Component[]{new JSeparator()},
new Component[]{createLargeDataModelPane()}
};
contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col);
return contentPane;
}
@Override
//堆积和坐标轴设置(自定义柱形图等用到)
protected JPanel createStackedAndAxisPane() {
stackAndAxisEditPane = new VanChartCustomStackAndAxisEditPane(){
@Override
protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() {
return VanChartCustomAxisConditionPane.class;
}
@Override
protected String getPaneTitle(){
return Inter.getLocText("Plugin-ChartF_Custom_Axis");
}
};
return stackAndAxisEditPane;
}
private JPanel createBubblePane() {
bubblePane = new VanChartBubblePane();
return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Bubble"), bubblePane);
}
protected void populateCondition(ConditionAttr defaultAttr){
super.populateCondition(defaultAttr);
if(bubblePane != null) {
VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class);
bubblePane.populateBean(attrBubble);
}
}
protected void updateCondition(ConditionAttr defaultAttr){
super.updateCondition(defaultAttr);
if(bubblePane != null){
VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class);
if (attrBubble != null) {
defaultAttr.remove(attrBubble);
}
defaultAttr.addDataSeriesCondition(bubblePane.updateBean());
}
}
}

57
designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleStylePane.java

@ -0,0 +1,57 @@
package com.fr.plugin.chart.bubble;
import com.fr.chart.chartattr.Plot;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane;
import com.fr.plugin.chart.bubble.force.VanChartForceBubbleAreaPane;
import com.fr.plugin.chart.bubble.force.VanChartForceBubbleLabelPane;
import com.fr.plugin.chart.bubble.force.VanChartForceBubbleTooltipPane;
import com.fr.plugin.chart.designer.style.background.VanChartAreaPane;
import com.fr.plugin.chart.scatter.component.VanChartScatterStylePane;
import java.util.List;
/**
* Created by Mitisky on 16/3/31.
*/
public class VanChartBubbleStylePane extends VanChartScatterStylePane {
public VanChartBubbleStylePane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected void createVanChartLabelPane(List<BasicPane> paneList) {
Plot plot = getChart().getPlot();
if(((VanChartBubblePlot) plot).isForceBubble()){
paneList.add(new VanChartForceBubbleLabelPane(VanChartBubbleStylePane.this));
} else {
super.createVanChartLabelPane(paneList);
}
}
protected void addVanChartTooltipPane(List<BasicPane> paneList){
Plot plot = getChart().getPlot();
if(((VanChartBubblePlot) plot).isForceBubble()){
paneList.add(new VanChartForceBubbleTooltipPane(VanChartBubbleStylePane.this));
} else {
super.addVanChartTooltipPane(paneList);
}
}
@Override
protected void addVanChartAreaPane(List<BasicPane> paneList) {
if (((VanChartBubblePlot)getChart().getPlot()).isForceBubble()){
paneList.add(new VanChartForceBubbleAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this));
}else {
paneList.add(new VanChartAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this));
}
}
@Override
protected ChartSeriesPane createChartSeriesPane() {
return new ChartSeriesPane(VanChartBubbleStylePane.this);
}
}

74
designer_chart/src/com/fr/plugin/chart/bubble/component/VanChartBubblePane.java

@ -0,0 +1,74 @@
package com.fr.plugin.chart.bubble.component;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble;
import javax.swing.*;
import java.awt.*;
/**
* Created by Mitisky on 16/3/31.
* 气泡大小等设置界面
*/
public class VanChartBubblePane extends BasicBeanPane<VanChartAttrBubble> {
private UISpinner minDiameter;
private UISpinner maxDiameter;
private UIButtonGroup<Integer> shadow;
private UIButtonGroup<Integer> displayNegative;
public VanChartBubblePane(){
minDiameter = new UISpinner(0,Double.MAX_VALUE,1,0);
maxDiameter = new UISpinner(0,Double.MAX_VALUE,1,0);
shadow = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_Open"),
Inter.getLocText("Plugin-ChartF_Close")});
displayNegative = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_Open"),
Inter.getLocText("Plugin-ChartF_Close")});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] row = {p, p, p, p};
double[] col = {p, f};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_MinDiameter")), minDiameter},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_MaxDiameter")), maxDiameter},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Shadow")), shadow},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_DisplayNegative")), displayNegative},
};
JPanel content = TableLayoutHelper.createTableLayoutPane(components, row, col);
this.setLayout(new BorderLayout());
this.add(content, BorderLayout.CENTER);
}
public void populateBean(VanChartAttrBubble bubble) {
if(bubble == null){
bubble = new VanChartAttrBubble();
}
minDiameter.setValue(bubble.getMinDiameter());
maxDiameter.setValue(bubble.getMaxDiameter());
shadow.setSelectedIndex(bubble.isShadow() ? 0 : 1);
displayNegative.setSelectedIndex(bubble.isDisplayNegative() ? 0 : 1);
}
public VanChartAttrBubble updateBean() {
VanChartAttrBubble bubble = new VanChartAttrBubble();
bubble.setMinDiameter(minDiameter.getValue());
bubble.setMaxDiameter(maxDiameter.getValue());
bubble.setShadow(shadow.getSelectedIndex() == 0);
bubble.setDisplayNegative(displayNegative.getSelectedIndex() == 0);
return bubble;
}
@Override
public String title4PopupWindow() {
return Inter.getLocText("Plugin-ChartF_Bubble");
}
}

184
designer_chart/src/com/fr/plugin/chart/bubble/data/VanChartBubblePlotTableDataContentPane.java

@ -0,0 +1,184 @@
package com.fr.plugin.chart.bubble.data;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.BubblePlot;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartdata.BubbleTableDefinition;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.util.List;
public class VanChartBubblePlotTableDataContentPane extends AbstractTableDataContentPane {
private static final Dimension PREFERRED_SIZE = new Dimension(100, 20);
protected UIComboBox seriesName;
protected UIComboBox xCombox;
protected UIComboBox yCombox;
protected UIComboBox bubbleSize;
private ChartDataFilterPane dataScreeningPane;
public VanChartBubblePlotTableDataContentPane(ChartDataPane parent) {
seriesName = new UIComboBox();
xCombox = new UIComboBox();
yCombox = new UIComboBox();
dataScreeningPane = new ChartDataFilterPane(new BubblePlot(), parent);
seriesName.setPreferredSize(PREFERRED_SIZE);
xCombox.setPreferredSize(PREFERRED_SIZE);
yCombox.setPreferredSize(PREFERRED_SIZE);
seriesName.addItem(Inter.getLocText("Chart-Use_None"));
initBubbleSize();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = { p, p,p,p};
double[] columnSize_north = {p, f};
double[] rowSize_north = {p, p, p, p};
Component[][] components_north = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Chart-Series_Name")+":", SwingConstants.RIGHT), seriesName},
new Component[]{new UILabel("x :", SwingConstants.RIGHT), xCombox},
new Component[]{new UILabel("y :", SwingConstants.RIGHT), yCombox},
new Component[]{new UILabel(Inter.getLocText("FR-Chart_Bubble_Size")+":", SwingConstants.RIGHT), bubbleSize},
};
JPanel north = TableLayoutHelper.createTableLayoutPane(components_north,rowSize_north,columnSize_north);
north.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
Component[][] components = new Component[][]{
new Component[]{north},
new Component[]{new JSeparator()},
new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Data_Filter"))},
new Component[]{dataScreeningPane}
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.CENTER);
seriesName.addItemListener(tooltipListener);
xCombox.addItemListener(tooltipListener);
yCombox.addItemListener(tooltipListener);
bubbleSize.addItemListener(tooltipListener);
}
protected void initBubbleSize() {
bubbleSize = new UIComboBox();
bubbleSize.setPreferredSize(new Dimension(100, 20));
}
/**
* 检查box是否使用, donothing
* @param hasUse 是否使用.
*/
public void checkBoxUse(boolean hasUse) {
}
protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(seriesName, list);
seriesName.addItem(Inter.getLocText("Chart-Use_None"));
refreshBoxItems(xCombox, list);
refreshBoxItems(yCombox, list);
refreshBoxItems(bubbleSize, list);
}
/**
* 清空所有的box设置
*/
public void clearAllBoxList(){
clearBoxItems(seriesName);
seriesName.addItem(Inter.getLocText("Chart-Use_None"));
clearBoxItems(xCombox);
clearBoxItems(yCombox);
clearBoxItems(bubbleSize);
}
@Override
public void populateBean(ChartCollection collection) {
super.populateBean(collection);
TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition();
if (!(top instanceof BubbleTableDefinition)) {
return;
}
BubbleTableDefinition definition = (BubbleTableDefinition) top;
if(definition.getSeriesName() == null || ComparatorUtils.equals(StringUtils.EMPTY, definition.getSeriesName())) {
seriesName.setSelectedItem(Inter.getLocText("Chart-Use_None"));
} else {
combineCustomEditValue(seriesName, definition.getSeriesName());
}
combineCustomEditValue(xCombox, definition.getBubbleX());
combineCustomEditValue(yCombox, definition.getBubbleY());
//气泡图不配置“无”
populateBubbleSize(definition);
dataScreeningPane.populateBean(collection);
}
protected void populateBubbleSize(BubbleTableDefinition definition) {
if (ComparatorUtils.equals(definition.getBubbleSize(), Inter.getLocText("Chart-Use_None"))){
combineCustomEditValue(bubbleSize, StringUtils.EMPTY);
}else {
combineCustomEditValue(bubbleSize, definition.getBubbleSize());
}
}
@Override
public void updateBean(ChartCollection collection) {
BubbleTableDefinition definition = new BubbleTableDefinition();
collection.getSelectedChart().setFilterDefinition(definition);
Object resultName = seriesName.getSelectedItem();
Object resultX = xCombox.getSelectedItem();
Object resultY = yCombox.getSelectedItem();
Object resultSize = bubbleSize.getSelectedItem();
if(resultName == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultName)) {
definition.setSeriesName(StringUtils.EMPTY);
} else {
definition.setSeriesName(resultName.toString());
}
if (resultX != null) {
definition.setBubbleX(resultX.toString());
}
if (resultY != null) {
definition.setBubbleY(resultY.toString());
}
if (resultSize != null) {
definition.setBubbleSize(resultSize.toString());
}
dataScreeningPane.updateBean(collection);
}
/**
* 重新布局
*/
public void redoLayoutPane(){
dataScreeningPane.relayoutPane(this.isNeedSummaryCaculateMethod());
}
}

28
designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartBubbleRefreshTooltipPane.java

@ -0,0 +1,28 @@
package com.fr.plugin.chart.bubble.force;
import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.designer.component.VanChartRefreshTooltipContentPane;
import com.fr.plugin.chart.designer.component.VanChartTooltipContentPane;
import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotRefreshTooltipPane;
import com.fr.plugin.chart.scatter.VanChartScatterRefreshTooltipContentPane;
/**
* Created by mengao on 2017/6/12.
*/
public class VanChartBubbleRefreshTooltipPane extends VanChartPlotRefreshTooltipPane {
public VanChartBubbleRefreshTooltipPane(Plot plot) {
super(plot);
}
@Override
protected VanChartTooltipContentPane getTooltipContentPane(Plot plot){
if (((VanChartBubblePlot)plot).isForceBubble()) {
return new VanChartRefreshTooltipContentPane(parent, VanChartBubbleRefreshTooltipPane.this);
} else {
return new VanChartScatterRefreshTooltipContentPane(parent, VanChartBubbleRefreshTooltipPane.this);
}
}
}

23
designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaBackgroundPane.java

@ -0,0 +1,23 @@
package com.fr.plugin.chart.bubble.force;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.plugin.chart.designer.style.background.VanChartAreaBackgroundPane;
import java.awt.*;
//图表区|绘图区 边框和背景
public class VanChartForceBubbleAreaBackgroundPane extends VanChartAreaBackgroundPane {
public VanChartForceBubbleAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent) {
super(isPlot, parent);
}
@Override
protected Component[][] initComponents() {
return new Component[][]{
new Component[]{chartBorderPane},
new Component[]{chartBackgroundPane},
};
}
}

26
designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaPane.java

@ -0,0 +1,26 @@
package com.fr.plugin.chart.bubble.force;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.designer.style.background.VanChartAreaPane;
/**
* 属性表, 图表样式-背景界面.
*/
public class VanChartForceBubbleAreaPane extends VanChartAreaPane {
public VanChartForceBubbleAreaPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
@Override
protected void initPlotPane(boolean b, AbstractAttrNoScrollPane parent) {
plotPane = new VanChartForceBubbleAreaBackgroundPane(true, parent);
}
}

19
designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleLabelPane.java

@ -0,0 +1,19 @@
package com.fr.plugin.chart.bubble.force;
import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.designer.style.label.VanChartLabelPane;
import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane;
/**
* Created by Mitisky on 16/3/31.
*/
public class VanChartForceBubbleLabelPane extends VanChartLabelPane {
public VanChartForceBubbleLabelPane(VanChartStylePane parent) {
super(parent);
}
protected VanChartPlotLabelPane getLabelPane(Plot plot) {
return new VanChartPlotLabelPane(plot, parent);
}
}

18
designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleTooltipPane.java

@ -0,0 +1,18 @@
package com.fr.plugin.chart.bubble.force;
import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane;
import com.fr.plugin.chart.designer.style.tooltip.VanChartTooltipPane;
/**
* Created by Mitisky on 16/3/31.
*/
public class VanChartForceBubbleTooltipPane extends VanChartTooltipPane {
public VanChartForceBubbleTooltipPane(VanChartStylePane parent) {
super(parent);
}
protected VanChartPlotTooltipPane getTooltipPane(Plot plot) {
return new VanChartPlotTooltipPane(plot, parent);
}
}

BIN
designer_chart/src/com/fr/plugin/chart/bubble/images/bubble.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

BIN
designer_chart/src/com/fr/plugin/chart/bubble/images/force.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

BIN
designer_chart/src/com/fr/plugin/chart/bubble/images/large.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

43
designer_chart/src/com/fr/plugin/chart/column/ColumnBorderAttriPane.java

@ -0,0 +1,43 @@
package com.fr.plugin.chart.column;
import com.fr.design.chart.comp.BorderAttriPane;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import com.fr.stable.CoreConstants;
import java.awt.*;
/**
* Created by hufan on 2016/8/11.
*/
public class ColumnBorderAttriPane extends BorderAttriPane {
private UISpinner radius;
public ColumnBorderAttriPane() {
this(Inter.getLocText("plugin-ChartF_Radius"));
}
public ColumnBorderAttriPane(String radiusString) {
this.add(new UILabel(radiusString + ":"));
radius = new UISpinner(0,1000,1,0);
this.add(radius);
radius.setPreferredSize(new Dimension(60, 18));
}
public void setRadius(int value) {
this.radius.setValue(value);
}
public double getRadius() {
return this.radius.getValue();
}
@Override
protected String title4PopupWindow() {
return "Border";
}
}

36
designer_chart/src/com/fr/plugin/chart/column/ColumnIndependentVanChartInterface.java

@ -0,0 +1,36 @@
package com.fr.plugin.chart.column;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI;
/**
* Created by Mitisky on 15/9/24.
*/
public class ColumnIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI {
@Override
public String getIconPath() {
return "com/fr/design/images/form/toolbar/column.png";
}
@Override
public AbstractChartTypePane getPlotTypePane() {
return new VanChartColumnPlotPane();
}
public ConditionAttributesPane getPlotConditionPane(Plot plot){
return new VanChartColumnConditionPane(plot);
}
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){
return new VanChartColumnSeriesPane(parent, plot);
}
public String getPlotTypeTitle4PopupWindow(){
return VanChartColumnPlotPane.TITLE;
}
}

93
designer_chart/src/com/fr/plugin/chart/column/VanChartColumnConditionPane.java

@ -0,0 +1,93 @@
package com.fr.plugin.chart.column;
import com.fr.chart.base.AttrAlpha;
import com.fr.chart.base.AttrBackground;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Plot;
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane;
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane;
import com.fr.plugin.chart.attr.EffectHelper;
import com.fr.plugin.chart.base.AttrDataSheet;
import com.fr.plugin.chart.base.AttrEffect;
import com.fr.plugin.chart.base.AttrFloatColor;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrSeriesImageBackground;
import com.fr.plugin.chart.base.AttrTooltip;
import com.fr.plugin.chart.base.VanChartAttrTrendLine;
import com.fr.plugin.chart.designer.other.condition.item.VanChartDataSheetContentPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartFloatColorConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesImageBackgroundConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane;
import com.fr.plugin.chart.designer.other.condition.item.VanChartTrendLineConditionPane;
import com.fr.plugin.chart.glyph.VanChartMultiCategoryDataPoint;
import java.awt.*;
/**
* Created by Mitisky on 15/9/28.
*/
public class VanChartColumnConditionPane extends DataSeriesConditionPane{
private static final long serialVersionUID = -7180705321732069806L;
public VanChartColumnConditionPane(Plot plot) {
super(plot);
}
protected void initComponents() {
super.initComponents();
//添加全部条件属性后被遮挡
liteConditionPane.setPreferredSize(new Dimension(300, 400));
}
@Override
protected void addBasicAction() {
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this));
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this));
classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(this));
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot));
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this));
classPaneMap.put(AttrSeriesImageBackground.class, new VanChartSeriesImageBackgroundConditionPane(this));
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getColumnPlotDefaultEffect()));
classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot));
//是否使用数据表
//自定义柱形图设置多X坐标轴时,不支持数据表
if (plot.getDataSheet().isVisible() && ((VanChartColumnPlot) plot).getXAxisList().size() == 1) {
classPaneMap.put(AttrDataSheet.class, new VanChartDataSheetContentPane(this, plot));
}
}
protected void addStyleAction() {
}
@Override
protected ChartConditionPane createListConditionPane() {
return new ChartConditionPane(){
@Override
public String[] columns2Populate() {
return new String[]{
ChartConstants.CATEGORY_INDEX,
ChartConstants.CATEGORY_NAME,
ChartConstants.SERIES_INDEX,
ChartConstants.SERIES_NAME,
ChartConstants.VALUE,
VanChartMultiCategoryDataPoint.CATEGORY_ARRAY,
};
}
};
}
/**
* 返回图表class对象
* @return class对象
*/
public Class<? extends Plot> class4Correspond() {
return VanChartColumnPlot.class;
}
}

34
designer_chart/src/com/fr/plugin/chart/column/VanChartColumnLabelBorderPane.java

@ -0,0 +1,34 @@
package com.fr.plugin.chart.column;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.design.chart.comp.BorderAttriPane;
import com.fr.design.chart.series.SeriesCondition.LabelBorderPane;
import com.fr.design.condition.ConditionAttributesPane;
/**
* Created by hufan on 2016/8/11.
*/
public class VanChartColumnLabelBorderPane extends LabelBorderPane {
public VanChartColumnLabelBorderPane(ConditionAttributesPane conditionAttributesPane) {
super(conditionAttributesPane);
}
@Override
protected BorderAttriPane initBorderAttrPane(){
return new ColumnBorderAttriPane();
}
public void populate(DataSeriesCondition condition) {
super.populate(condition);
if (condition instanceof AttrBorder) {
((ColumnBorderAttriPane)linePane).setRadius(attrBorder.getRoundRadius());
}
}
public DataSeriesCondition update() {
super.update();
attrBorder.setRoundRadius((int) ((ColumnBorderAttriPane)linePane).getRadius());
attrBorder.setRoundBorder(true);
return attrBorder;
}
}

96
designer_chart/src/com/fr/plugin/chart/column/VanChartColumnPlotPane.java

@ -0,0 +1,96 @@
package com.fr.plugin.chart.column;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
/**
* Created by Mitisky on 15/9/24.
*/
public class VanChartColumnPlotPane extends AbstractVanChartTypePane {
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewColumn");
private static final long serialVersionUID = 5950923001789733745L;
@Override
protected String[] getTypeIconPath() {
return new String[]{"/com/fr/plugin/chart/column/images/column.png",
"/com/fr/plugin/chart/column/images/stack.png",
"/com/fr/plugin/chart/column/images/percentstack.png",
"/com/fr/plugin/chart/column/images/custom.png",
};
}
@Override
protected String[] getTypeTipName() {
String column = Inter.getLocText("FR-Chart-Type_Column");
String stack = Inter.getLocText("FR-Chart-Type_Stacked");
String percent = Inter.getLocText("FR-Chart-Use_Percent");
return new String[]{
column,
stack + column,
percent + stack + column,
Inter.getLocText("FR-Chart-Mode_Custom")
};
}
/**
* 返回界面标题
* @return 界面标题
*/
public String title4PopupWindow() {
return Inter.getLocText("Plugin-ChartF_NewColumn");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartColumnPlot) {
lastTypeIndex = ((VanChartColumnPlot)plot).getVanChartPlotType().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
/**
* 获取各图表类型界面ID, 本质是plotID
*
* @return 图表类型界面ID
*/
@Override
protected String getPlotTypeID() {
return VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID;
}
protected Plot getSelectedClonedPlot(){
VanChartColumnPlot newPlot = null;
Chart[] columnChart = ColumnIndependentVanChart.ColumnVanChartTypes;
for(int i = 0, len = columnChart.length; i < len; i++){
if(typeDemo.get(i).isPressing){
newPlot = (VanChartColumnPlot)columnChart[i].getPlot();
}
}
Plot cloned = null;
try {
cloned = (Plot)newPlot.clone();
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error In ColumnChart");
}
return cloned;
}
public Chart getDefaultChart() {
return ColumnIndependentVanChart.ColumnVanChartTypes[0];
}
}

194
designer_chart/src/com/fr/plugin/chart/column/VanChartColumnSeriesPane.java

@ -0,0 +1,194 @@
package com.fr.plugin.chart.column;
import com.fr.base.background.ImageBackground;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.plugin.chart.base.AttrSeriesImageBackground;
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper;
import com.fr.plugin.chart.designer.component.border.VanChartBorderPane;
import com.fr.plugin.chart.designer.component.border.VanChartBorderWithRadiusPane;
import com.fr.plugin.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 新条形图系列界面
*/
public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane {
private static final long serialVersionUID = -8875943419420081420L;
private UIButtonGroup<Integer> isFixedWidth;//是否固定宽度
private UISpinner columnWidth;//宽度
private UINumberDragPane categoryGap;//分类间隔
private UINumberDragPane seriesGap;//系列间隔
private UIButtonGroup<Integer> isFillWithImage;//是否使用图片填充
private ImageBackgroundQuickPane imagePane;//填充图片选择界面
public VanChartColumnSeriesPane(ChartStylePane parent, Plot plot) {
super(parent, plot);
}
protected JPanel getContentInPlotType() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p,p,p,p,p,p,p,p,p,p};
Component[][] components = new Component[][]{
new Component[]{createStylePane()},
new Component[]{stylePane == null ? null : new JSeparator()},
new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{p,f})},
new Component[]{new JSeparator()},
new Component[]{createBorderPane()},
new Component[]{createStackedAndAxisPane()},
new Component[]{createTrendLinePane()},
};
contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
return contentPane;
}
//边框(有圆角)
protected VanChartBorderPane createDiffBorderPane() {
return new VanChartBorderWithRadiusPane();
}
private JPanel createSeriesStylePane(double[] row, double[] col) {
isFixedWidth = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")});
columnWidth = new UISpinner(0,1000,1,0);
seriesGap = new UINumberDragPane(-100, 100);
categoryGap = new UINumberDragPane(0, 100);
isFillWithImage = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")});
imagePane = new ImageBackgroundQuickPane(false);
Component[][] components1 = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Fixed_Column_Width")),isFixedWidth},
new Component[]{null,columnWidth},
};
JPanel panel1 = TableLayoutHelper.createTableLayoutPane(components1, row, col);
Component[][] components2 = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Gap_Series")),seriesGap},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Gap_Category")),categoryGap},
};
JPanel panel2 = TableLayoutHelper.createTableLayoutPane(components2, row, col);
Component[][] components3 = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Filled_With_Image")),isFillWithImage},
};
JPanel panel3 = TableLayoutHelper.createTableLayoutPane(components3, row, col);
JPanel panel = new JPanel(new BorderLayout(0, 4));
panel.add(panel1, BorderLayout.NORTH);
panel.add(panel2, BorderLayout.CENTER);
panel.add(panel3, BorderLayout.SOUTH);
JPanel borderPane = new JPanel(new BorderLayout());
borderPane.add(panel, BorderLayout.NORTH);
borderPane.add(imagePane, BorderLayout.CENTER);
isFixedWidth.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkColumnWidth();
}
});
isFillWithImage.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkImagePane();
}
});
return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), borderPane);
}
private void checkAll() {
checkColumnWidth();
checkImagePane();
}
private void checkColumnWidth() {
columnWidth.setEnabled(isFixedWidth.getSelectedIndex() == 0);
}
private void checkImagePane() {
GUICoreUtils.setEnabled(imagePane, isFillWithImage.getSelectedIndex() == 0);
}
public void populateBean(Plot plot) {
if(plot == null) {
return;
}
super.populateBean(plot);
if(plot instanceof VanChartColumnPlot){
VanChartColumnPlot columnPlot4VanChart = (VanChartColumnPlot)plot;
isFixedWidth.setSelectedIndex(columnPlot4VanChart.isFixedWidth() ? 0 : 1);
columnWidth.setValue(columnPlot4VanChart.getColumnWidth());
categoryGap.populateBean(columnPlot4VanChart.getCategoryIntervalPercent());
seriesGap.populateBean(columnPlot4VanChart.getSeriesOverlapPercent());
isFillWithImage.setSelectedIndex(columnPlot4VanChart.isFilledWithImage() ? 0 : 1);
ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr();
if(columnPlot4VanChart.isFilledWithImage()){
AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class);
if(attrSeriesImageBackground != null){
imagePane.populateBean(attrSeriesImageBackground.getSeriesBackground());
}
}
}
checkAll();
}
public void updateBean(Plot plot) {
if(plot == null) {
return;
}
super.updateBean(plot);
if(plot instanceof VanChartColumnPlot){
VanChartColumnPlot columnPlot4VanChart = (VanChartColumnPlot)plot;
columnPlot4VanChart.setFixedWidth(isFixedWidth.getSelectedIndex() == 0);
columnPlot4VanChart.setColumnWidth((int)columnWidth.getValue());
columnPlot4VanChart.setCategoryIntervalPercent(categoryGap.updateBean());
columnPlot4VanChart.setSeriesOverlapPercent(seriesGap.updateBean());
columnPlot4VanChart.setFilledWithImage(isFillWithImage.getSelectedIndex() == 0);
ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr();
if(isFillWithImage.getSelectedIndex() == 0){
AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class);
if(attrSeriesImageBackground == null){
attrSeriesImageBackground = new AttrSeriesImageBackground();
defaultAttr.addDataSeriesCondition(attrSeriesImageBackground);
}
attrSeriesImageBackground.setSeriesBackground(imagePane.updateBean());
//设置背景图片平铺方式
ImageBackground imageBackground = (ImageBackground) attrSeriesImageBackground.getSeriesBackground();
if (imageBackground != null){
imageBackground.setLayout(Constants.IMAGE_TILED);
}
} else {
AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class);
if(attrSeriesImageBackground != null){
defaultAttr.remove(attrSeriesImageBackground);
}
}
}
}
}

143
designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java

@ -0,0 +1,143 @@
package com.fr.plugin.chart.column;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.data.condition.AbstractCondition;
import com.fr.data.condition.ListCondition;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.LiteConditionPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis;
import com.fr.plugin.chart.designer.style.series.VanChartSeriesConditionPane;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 堆积和坐标轴设置
*/
public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<ConditionAttr> {
private static final long serialVersionUID = 2713124322060048526L;
protected UIButtonGroup<Integer> XAxis;
protected UIButtonGroup<Integer> YAxis;
protected UIButtonGroup<Integer> isStacked;
protected UIButtonGroup<Integer> isPercentStacked;
private LiteConditionPane liteConditionPane;
public VanChartCustomStackAndAxisConditionPane(){
}
private void doLayoutPane(){
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
//配置界面
JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(deployPane);
deployPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Plugin-ChartF_Deploy") + ":", null));
deployPane.add(createDeployPane());
//条件界面
JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(conditionPane);
conditionPane.setBorder(BorderFactory.createEmptyBorder());
conditionPane.add(liteConditionPane = new VanChartSeriesConditionPane());
liteConditionPane.setPreferredSize(new Dimension(300, 300));
}
private JPanel createDeployPane()
{
isStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")});
isPercentStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")});
double p = TableLayout.PREFERRED;
double[] columnSize = {p,p};
double[] rowSize = {p,p,p,p};
return TableLayoutHelper.createTableLayoutPane(getDeployComponents(), rowSize, columnSize);
}
protected Component[][] getDeployComponents() {
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("ChartF-X_Axis")),XAxis},
new Component[]{new UILabel(Inter.getLocText("ChartF-Y_Axis")),YAxis},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Type_Stacked")),isStacked},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_PercentStacked")),isPercentStacked},
};
isStacked.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkBox();
}
});
return components;
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Plugin-ChartF_StackAndSeries");
}
private void checkBox() {
isPercentStacked.setEnabled(isStacked.getSelectedIndex() == 0);
}
public void populateBean(ConditionAttr conditionAttr){
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis)conditionAttr.getExisted(AttrSeriesStackAndAxis.class);
XAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getXAxisNamesArray());
YAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getYAxisNameArray());
doLayoutPane();
XAxis.setSelectedIndex(seriesStackAndAxis.getXAxisIndex());
YAxis.setSelectedIndex(seriesStackAndAxis.getYAxisIndex());
isStacked.setSelectedIndex(seriesStackAndAxis.isStacked() ? 0 : 1);
isPercentStacked.setSelectedIndex(seriesStackAndAxis.isPercentStacked() ? 0 : 1);
if (conditionAttr.getCondition() == null) {
this.liteConditionPane.populateBean(new ListCondition());
} else {
this.liteConditionPane.populateBean(conditionAttr.getCondition());
}
checkBox();
}
public void updateBean(ConditionAttr conditionAttr){
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis)conditionAttr.getExisted(AttrSeriesStackAndAxis.class);
seriesStackAndAxis.setXAxisIndex(XAxis.getSelectedIndex());
seriesStackAndAxis.setYAxisIndex(YAxis.getSelectedIndex());
updateStackAndPercent(seriesStackAndAxis);
AbstractCondition con = (AbstractCondition) this.liteConditionPane.updateBean();
conditionAttr.setCondition(con);
}
protected void updateStackAndPercent(AttrSeriesStackAndAxis seriesStackAndAxis) {
seriesStackAndAxis.setStacked(isStacked.getSelectedIndex() == 0);
if(seriesStackAndAxis.isStacked()){
seriesStackAndAxis.setPercentStacked(isPercentStacked.getSelectedIndex() == 0);
} else {
seriesStackAndAxis.setPercentStacked(false);
}
}
public ConditionAttr updateBean(){
ConditionAttr conditionAttr = new ConditionAttr();
updateBean(conditionAttr);
return conditionAttr;
}
}

BIN
designer_chart/src/com/fr/plugin/chart/column/images/column.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

BIN
designer_chart/src/com/fr/plugin/chart/column/images/custom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

BIN
designer_chart/src/com/fr/plugin/chart/column/images/percentstack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

BIN
designer_chart/src/com/fr/plugin/chart/column/images/stack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

56
designer_chart/src/com/fr/plugin/chart/custom/CustomIndependentVanChartInterface.java

@ -0,0 +1,56 @@
package com.fr.plugin.chart.custom;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.chart.custom.other.VanChartCustomOtherPane;
import com.fr.plugin.chart.custom.style.VanChartCustomStylePane;
import com.fr.plugin.chart.designer.other.VanChartOtherPane;
import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.vanchart.AbstractIndependentVanChartUI;
/**
* Created by Mitisky on 16/2/16.
*/
public class CustomIndependentVanChartInterface extends AbstractIndependentVanChartUI {
/**
* 图表的类型定义界面类型就是属性表的第一个界面
*
* @return 图表的类型定义界面类型
*/
@Override
public AbstractChartTypePane getPlotTypePane() {
return new VanChartCustomPlotPane();
}
/**
* 图标路径
*
* @return 图标路径
*/
@Override
public String getIconPath() {
return "com/fr/design/images/form/toolbar/custom.png";
}
@Override
/**
* 图表的属性界面数组
* @return 属性界面
*/
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){
VanChartStylePane stylePane = new VanChartCustomStylePane(listener);
VanChartOtherPane otherPane = new VanChartCustomOtherPane();
return new AbstractChartAttrPane[]{stylePane, otherPane};
}
public ChartDataPane getChartDataPane(AttributeChangeListener listener){
return new VanChartCustomDataPane(listener);
}
public String getPlotTypeTitle4PopupWindow(){
return VanChartCustomPlotPane.TITLE;
}
}

134
designer_chart/src/com/fr/plugin/chart/custom/CustomPlotDesignerPaneFactory.java

@ -0,0 +1,134 @@
package com.fr.plugin.chart.custom;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane;
import com.fr.general.FRLogger;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.component.CustomPlotLocationPane;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.bubble.data.VanChartBubblePlotTableDataContentPane;
import com.fr.plugin.chart.scatter.data.VanChartScatterPlotTableDataContentPane;
import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane;
import com.fr.plugin.chart.designer.style.axis.gauge.VanChartGaugeAxisPane;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.radar.VanChartRadarPlot;
import com.fr.plugin.chart.scatter.VanChartScatterPlot;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Mitisky on 16/6/23.
*/
public class CustomPlotDesignerPaneFactory {
//图表类型对应数据配置界面
private static Map<Class<? extends Plot>, Class<? extends AbstractTableDataContentPane>> plotTableDataContentPaneMap = new HashMap<Class<? extends Plot>, Class<? extends AbstractTableDataContentPane>>();
//图表类型对应的位置面板
private static Map<Class<? extends Plot>, Class<? extends BasicBeanPane<Plot>>> plotPositionMap = new HashMap<Class<? extends Plot>, Class<? extends BasicBeanPane<Plot>>>();
static {
plotPositionMap.put(PiePlot4VanChart.class, CustomPlotLocationPane.class);
plotPositionMap.put(VanChartRadarPlot.class, CustomPlotLocationPane.class);
plotPositionMap.put(VanChartGaugePlot.class, CustomPlotLocationPane.class);
}
/**
* 根据图表类型创建位置面板
* @param plot 图表
* @return 位置面板
*/
public static BasicBeanPane<Plot> createCustomPlotPositionPane(Plot plot) {
Class<? extends Plot> key = plot.getClass();
if(plotPositionMap.containsKey(key)){
try{
Class<? extends BasicBeanPane<Plot>> cl = plotPositionMap.get(key);
Constructor<? extends BasicBeanPane<Plot> > constructor = cl.getConstructor();
return constructor.newInstance();
} catch (Exception e){
FRLogger.getLogger().error(e.getMessage());
}
}
return null;
}
/**
* 每种类型对应的数据配置界面
* @return
*/
static {
plotTableDataContentPaneMap.put(VanChartScatterPlot.class, VanChartScatterPlotTableDataContentPane.class);
plotTableDataContentPaneMap.put(VanChartBubblePlot.class, VanChartBubblePlotTableDataContentPane.class);
}
/**
* 根据图表类型创建数据配置
* @param plot 图表
* @param parent
* @return 数据配置界面
*/
public static AbstractTableDataContentPane createCustomPlotTableDataContentPane(Plot plot, ChartDataPane parent) {
Class<? extends Plot> key = plot.getClass();
if(plotTableDataContentPaneMap.containsKey(key)){
try{
Class<? extends AbstractTableDataContentPane> cl = plotTableDataContentPaneMap.get(key);
Constructor<? extends AbstractTableDataContentPane > constructor = cl.getConstructor(ChartDataPane.class);
return constructor.newInstance(parent);
} catch (Exception e){
FRLogger.getLogger().error(e.getMessage());
}
}
return new CategoryPlotTableDataContentPane(parent);
}
/**
* plotType是否需要建立新的坐标系面板
*/
private static Map<CustomPlotType, Class<? extends VanChartAxisPane>> diffAxisMap = new HashMap<CustomPlotType, Class<? extends VanChartAxisPane>>();
static {
diffAxisMap.put(CustomPlotType.POINTER_360, VanChartGaugeAxisPane.class);
diffAxisMap.put(CustomPlotType.POINTER_180, VanChartGaugeAxisPane.class);
diffAxisMap.put(CustomPlotType.RING, VanChartGaugeAxisPane.class);
diffAxisMap.put(CustomPlotType.SLOT, VanChartGaugeAxisPane.class);
diffAxisMap.put(CustomPlotType.CUVETTE, VanChartGaugeAxisPane.class);
diffAxisMap.put(CustomPlotType.RADAR, null);//默认的为null,直接new,不用反射
diffAxisMap.put(CustomPlotType.STACK_RADAR, null);
}
public static Boolean isUseDiffAxisPane(VanChartPlot plot){
CustomPlotType customPlotType = CustomPlotFactory.getCustomType(plot);
return diffAxisMap.containsKey(customPlotType);
}
public static VanChartAxisPane createAxisPane(VanChartAxisPlot plot, VanChartStylePane parent) {
CustomPlotType key = CustomPlotFactory.getCustomType((VanChartPlot)plot);
if(diffAxisMap.containsKey(key)){
try{
Class<? extends VanChartAxisPane> cl = diffAxisMap.get(key);
if(cl != null) {
Constructor<? extends VanChartAxisPane> constructor = cl.getConstructor(VanChartAxisPlot.class, VanChartStylePane.class);
return constructor.newInstance(plot, parent);
}
} catch (Exception e){
FRLogger.getLogger().error(e.getMessage());
}
}
return new VanChartAxisPane(plot,parent);
}
}

66
designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomDataPane.java

@ -0,0 +1,66 @@
package com.fr.plugin.chart.custom;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import javax.swing.*;
import java.awt.*;
/**
* Created by Fangjie on 2016/4/29.
*/
public class VanChartCustomDataPane extends ChartDataPane {
private VanChartCustomPlotDataContentsTabPane contentsTabPane;
private Chart chart;
public VanChartCustomDataPane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected JPanel createContentPane() {
JPanel content = new JPanel(new BorderLayout());
if (chart == null) {
return content;
}
contentsTabPane = new VanChartCustomPlotDataContentsTabPane((VanChartCustomPlot)chart.getPlot(), VanChartCustomDataPane.this, listener);
content.add(contentsTabPane, BorderLayout.CENTER);
return content;
}
public void populate(ChartCollection collection) {
this.chart = collection.getSelectedChart();
this.remove(leftContentPane);
initContentPane();
this.removeAttributeChangeListener();
contentsTabPane.populateBean(collection);
this.addAttributeChangeListener(listener);
this.initAllListeners();
}
@Override
/**
* 返回绑定的属性事件.
* @param listener 增加监听
*/
public void addAttributeChangeListener(AttributeChangeListener listener) {
super.addAttributeChangeListener(listener);
contentsTabPane.addAttributeChangeListener(listener);
}
@Override
/**
* 保存 数据界面内容
*/
public void update(ChartCollection collection){
if(contentsTabPane != null) {
contentsTabPane.updateBean(collection);
}
}
}

175
designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotDataContentsTabPane.java

@ -0,0 +1,175 @@
package com.fr.plugin.chart.custom;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane;
import com.fr.plugin.chart.custom.component.VanChartDataPane;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import javax.swing.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Fangjie on 2016/4/29.
*/
public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, ChartCollection> {
public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) {
super(plot, parent, listener);
}
@Override
protected void initTabTitle() {
if (plot == null){
return;
}
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
NameArray = new String[Math.min(customPlotList.size(), paneList.size())];
for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) {
JPanel pane = paneList.get(i);
//获取点的tooltip作为标题
VanChartPlot vanChartPlot = customPlotList.get(i);
CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot);
NameArray[i] = CustomPlotFactory.getTitle(plotType);
centerPane.add(pane, NameArray[i]);
}
}
@Override
protected List<JPanel> initPaneList() {
if (plot == null){
return null;
}
List<JPanel> paneList = new ArrayList<JPanel>();
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
for (int i = 0; i < customPlotList.size(); i++){
//根据不同的plot创建不同的数据配置界面
ChartDataPane contentPane = new VanChartDataPane(listener);
paneList.add(contentPane);
}
return paneList;
}
@Override
public void populateBean(ChartCollection chartCollection){
plot = (VanChartCustomPlot) chartCollection.getSelectedChart().getPlot();
if (paneList == null){
paneList = initPaneList();
}
if (paneList != null){
try {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) {
//將plot包裝起来,主要是为了获取dataDefinition
ChartCollection cloneCollection = (ChartCollection) chartCollection.clone();
//设置collection的plot
cloneCollection.getSelectedChart().setPlot(customPlotList.get(i));
//获取definitionMap中的dataDefinition
TopDefinitionProvider definition = chartCollection.getSelectedChart().getFilterDefinition();
TopDefinitionProvider dataDefinition = null;
if (definition != null && definition instanceof CustomDefinition) {
Map<CustomPlotType, TopDefinitionProvider> definitionProviderMap = ((CustomDefinition)definition).getDefinitionProviderMap();
dataDefinition = definitionProviderMap.get(CustomPlotFactory.getCustomType(customPlotList.get(i)));
}
cloneCollection.getSelectedChart().setFilterDefinition(dataDefinition);
((ChartDataPane) paneList.get(i)).populate(cloneCollection);
}
}catch (Exception e){
return;
}
}
}
@Override
public ChartCollection updateBean() {
return null;
}
@Override
public void updateBean(ChartCollection collection){
if (paneList == null || plot == null){
return;
}
try {
Map<CustomPlotType, TopDefinitionProvider> definitionMap = new HashMap<CustomPlotType, TopDefinitionProvider>();
//已经有的数据配置不允许重置
for (int i = 0; i < paneList.size() && i < plot.getCustomPlotList().size(); i++) {
//将plot包裝起来,主要是为了获取dataDefinition
ChartCollection cloneCollection = (ChartCollection) collection.clone();
//设置Collection的plot
cloneCollection.getSelectedChart().setPlot(plot.getCustomPlotList().get(i));
//重置
cloneCollection.getSelectedChart().setFilterDefinition(null);
//更新
((ChartDataPane) paneList.get(i)).update(cloneCollection);
CustomPlotFactory.setCustomCategoryAttr(plot);
//将处理好的dataDefinition剥离出来并存储
definitionMap.put(CustomPlotFactory.getCustomType(plot.getCustomPlotList().get(i)), cloneCollection.getSelectedChart().getFilterDefinition());
}
CustomDefinition customDefinition = new CustomDefinition();
customDefinition.setDefinitionProviderMap(definitionMap);
collection.getSelectedChart().setFilterDefinition(customDefinition);
}catch (Exception e){
return;
}
}
@Override
public boolean accept(Object ob) {
return false;
}
@Override
public String title4PopupWindow() {
return null;
}
@Override
public void reset() {
}
/**
* 返回绑定的属性事件.
* @param listener 增加监听
*/
public void addAttributeChangeListener(AttributeChangeListener listener) {
for (int i = 0; i < paneList.size(); i++){
((ChartDataPane) paneList.get(i)).addAttributeChangeListener(listener);
}
}
}

296
designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java

@ -0,0 +1,296 @@
package com.fr.plugin.chart.custom;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.custom.component.VanChartCustomPlotSelectPane;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.custom.type.CustomStyle;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.*;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Mitisky on 16/2/16.
*/
public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewCustom");
//是否选择自定义
private boolean isCustom = false;
private static final long serialVersionUID = -3481633368542654247L;
//切换到自定义组合图时,显示的版面
private JPanel customPane;
private VanChartCustomPlotSelectPane customSelectPane;
private JPanel autoPane;
//自定义和自动版面的容器,cardLayOut布局
private JPanel contentPane;
protected Component[][] getPaneComponents(JPanel typePane){
initContent();
return new Component[][]{
new Component[]{typePane},
new Component[]{stylePane},
new Component[]{contentPane}
};
}
private void initContent() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
autoPane = new JPanel();
customSelectPane = new VanChartCustomPlotSelectPane();
Component[][] components = new Component[][]{
new Component[]{new JSeparator()},
new Component[]{customSelectPane}
};
double[] columnSize = {p, f};
double[] rowSize = {p, p};
customPane = TableLayoutHelper.createTableLayoutPane(components, rowSize , columnSize);
contentPane = new JPanel(new CardLayout()){
@Override
public Dimension getPreferredSize() {
if(isCustom){
return customPane.getPreferredSize();
} else{
return new Dimension(autoPane.getWidth(), 0);
}
}
};
contentPane.add(autoPane, "auto");
contentPane.add(customPane, "custom");
}
private void checkCardPane() {
CardLayout cardLayout = (CardLayout) contentPane.getLayout();
if (isCustom) {
cardLayout.show(contentPane, "custom");
} else {
cardLayout.show(contentPane, "auto");
}
}
@Override
protected String[] getTypeIconPath() {
return new String[]{"/com/fr/plugin/chart/custom/images/column_line.png",
"/com/fr/plugin/chart/custom/images/column_area.png",
"/com/fr/plugin/chart/custom/images/stack_column_line.png",
"/com/fr/plugin/chart/custom/images/custom.png",
};
}
@Override
protected String[] getTypeTipName() {
return new String[]{
Inter.getLocText("Plugin-ChartF_NewCustom_ColumnLine"),
Inter.getLocText("Plugin-ChartF_NewCustom_ColumnArea"),
Inter.getLocText("Plugin-ChartF_NewCustom_StackColumnLine"),
Inter.getLocText("Plugin-ChartF_NewCustom_Custom")
};
}
@Override
/**
* 返回界面标题
* @return 界面标题
*/
public String title4PopupWindow() {
return Inter.getLocText("Plugin-ChartF_NewCustom");
}
@Override
public void updateBean(Chart chart) {
//保存上次选中的值,其会在super中更新
int lastState = lastTypeIndex;
super.updateBean(chart);
//如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置
if (lastState != lastTypeIndex) {
chart.setFilterDefinition(null);
}
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes;
for(int i = 0, len = customChart.length; i < len; i++){
if(typeDemo.get(i).isPressing){
if (i == customChart.length-1){
isCustom = true;
//先重置自定义组合面板,如果不重置,无法获取选择顺序
if (lastState == customChart.length-1 && samePlot) {
//更新数据配置,刪除已经不在的图表数据
dealCustomDefinition(chart);
customSelectPane.updateBean(chart);
}else if (samePlot){//如果是同一个图表切换过来,则重置面板
customSelectPane.populateBean(chart);
}
}
}else {
isCustom = false;
}
}
checkCardPane();
}
private void dealCustomDefinition(Chart chart) {
CustomDefinition definition = (CustomDefinition) chart.getFilterDefinition();
if (definition == null){
return;
}
Map<CustomPlotType, TopDefinitionProvider> definitionMap = definition.getDefinitionProviderMap();
if (definitionMap == null){
return;
}
Map<CustomPlotType, TopDefinitionProvider> newDefinitionMap = new HashMap<CustomPlotType, TopDefinitionProvider>();
VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot();
for (int i = 0; i < customPlot.getCustomPlotList().size(); i++){
CustomPlotType plotType = CustomPlotFactory.getCustomType(customPlot.getCustomPlotList().get(i));
TopDefinitionProvider definitionProvider = definitionMap.get(plotType);
newDefinitionMap.put(plotType, definitionProvider);
}
definition.setDefinitionProviderMap(newDefinitionMap);
}
/**
* 不同图表切換重置chart屬性
* @param chart
* @param newPlot
*/
@Override
protected void resetChartAttr(Chart chart, Plot newPlot){
super.resetChartAttr(chart, newPlot);
//切换图表清空数据配置
chart.setFilterDefinition(null);
//设置默认不排序
VanChartTools tools = ((VanChart)chart).getVanChartTools();
if (tools != null) {
tools.setSort(false);
}
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
//获取上次选中的图标
VanChartCustomPlot customPlot = (VanChartCustomPlot)chart.getPlot();
lastTypeIndex = customPlot.getCustomStyle().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
isCustom = customPlot.getCustomStyle() == CustomStyle.CUSTOM;
//自定义选择时,更新自定义面板
if (isCustom){
customSelectPane.populateBean(chart);
}
checkCardPane();
checkDemosBackground();
}
/**
* 获取各图表类型界面ID, 本质是plotID
*
* @return 图表类型界面ID
*/
@Override
protected String getPlotTypeID() {
return VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID;
}
protected Plot getSelectedClonedPlot(){
VanChartCustomPlot newPlot = null;
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes;
for(int i = 0, len = customChart.length; i < len; i++){
if(typeDemo.get(i).isPressing){
newPlot = (VanChartCustomPlot)customChart[i].getPlot();
}
}
Plot cloned = null;
try {
cloned = (Plot)newPlot.clone();
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error In ScatterChart");
}
return cloned;
}
public Chart getDefaultChart() {
return CustomIndependentVanChart.CustomVanChartTypes[0];
}
@Override
/**
*删除配置的条件属性
*/
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{
cloneOldDefaultAttrConditionCollection(oldPlot, newPlot);
}
@Override
/**
* 删除线型配置
*/
protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{
if (oldPlot.getConditionCollection() != null) {
ConditionCollection newCondition = new ConditionCollection();
newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone());
newPlot.setConditionCollection(newCondition);
//删除线型设置
ConditionAttr attrList = newCondition.getDefaultAttr();
DataSeriesCondition attr = attrList.getExisted(VanChartAttrLine.class);
if (attr != null){
attrList.remove(VanChartAttrLine.class);
}
}
}
}

27
designer_chart/src/com/fr/plugin/chart/custom/component/CategoryCustomPlotTableDataContentPane.java

@ -0,0 +1,27 @@
package com.fr.plugin.chart.custom.component;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane;
/**
* Created by Fangjie on 2016/5/18.
*/
public class CategoryCustomPlotTableDataContentPane extends CategoryPlotTableDataContentPane {
public CategoryCustomPlotTableDataContentPane() {
super();
}
public CategoryCustomPlotTableDataContentPane(ChartDataPane parent) {
super(parent);
}
/**
* 检查 某些Box是否可用
* 分类不可用
* @param hasUse 是否使用
*/
public void checkBoxUse(boolean hasUse) {
categoryCombox.setEnabled(false);
checkSeriseUse(hasUse);
}
}

103
designer_chart/src/com/fr/plugin/chart/custom/component/ChartImageCheckOutPane.java

@ -0,0 +1,103 @@
package com.fr.plugin.chart.custom.component;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.util.ArrayList;
/**
* Created by Fangjie on 2016/4/19.
*/
public class ChartImageCheckOutPane extends BasicPane implements UIObserver {
private JCheckBox checkBox;
private CustomPlotType customPlotType;
private ArrayList<ChangeListener> changeListeners = new ArrayList<ChangeListener>();
public ChartImageCheckOutPane(CustomPlotType type){
this(type, false);
}
public ChartImageCheckOutPane( CustomPlotType type, boolean isSelected){
this.customPlotType = type;
initCheckBox(isSelected);
this.add(checkBox, BorderLayout.CENTER);
}
public CustomPlotType getCustomPlotType() {
return customPlotType;
}
private void initCheckBox(boolean isSelected) {
this.checkBox = new JCheckBox();
this.checkBox.setSelected(isSelected);
//设置提示
this.checkBox.setToolTipText(CustomPlotFactory.getTooltipText(this.customPlotType));
//背景
checkBox.setIcon(new ImageIcon(getClass().getResource(getIconPath(customPlotType,isSelected))));
this.setLayout(new BorderLayout());
}
private String getIconPath(CustomPlotType customPlotType, boolean isSelected) {
return isSelected ? CustomPlotFactory.getTypeIconPath(customPlotType)[0] : CustomPlotFactory.getTypeIconPath(customPlotType)[1];
}
public JCheckBox getCheckBox() {
return checkBox;
}
public void checkIconImage(){
checkBox.setIcon(new ImageIcon(getClass().getResource(getIconPath(customPlotType, checkBox.isSelected()))));
}
public void setPaneBorder(boolean isRightLine, boolean isBottomLine){
this.setBorder(BorderFactory.createMatteBorder(1, 1, isBottomLine ? 1 : 0, isRightLine ? 1 : 0, UIConstants.LINE_COLOR));
}
public void setSelected(boolean isSelected){
checkBox.setSelected(isSelected);
}
public boolean isSelected(){
return checkBox.isSelected();
}
@Override
protected String title4PopupWindow() {
return null;
}
public void fireStateChange() {
for (int i = 0; i < changeListeners.size(); i++) {
changeListeners.get(i).stateChanged(new ChangeEvent(this));
}
}
@Override
public void registerChangeListener(final UIObserverListener listener) {
changeListeners.add(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
}
@Override
public boolean shouldResponseChangeListener() {
return false;
}
}

84
designer_chart/src/com/fr/plugin/chart/custom/component/CustomPlotLocationPane.java

@ -0,0 +1,84 @@
package com.fr.plugin.chart.custom.component;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.attr.plot.VanChartPositionPlot;
import com.fr.plugin.chart.base.Position;
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper;
import javax.swing.*;
import java.awt.*;
/**
* Created by Fangjie on 2016/4/26.
*/
public class CustomPlotLocationPane extends BasicBeanPane<Plot>{
private UISpinner radius;
private UISpinner xDirection;
private UISpinner yDirection;
private static final double MIN_ANGLE = PiePlot4VanChart.START_ANGLE;
private static final double MAX_ANGLE = PiePlot4VanChart.END_ANGLE;
public CustomPlotLocationPane(){
init();
}
private void init() {
radius = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 50);
xDirection = new UISpinner(0, 100, 1, 20);
yDirection = new UISpinner(0, 100, 1, 20);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Position") + "(%): " + Inter.getLocText("Plugin-ChartF_X_Direction"), SwingConstants.LEFT),xDirection},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Y_Direction"), SwingConstants.RIGHT),yDirection},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Radius") + "(px): ",SwingConstants.LEFT),radius}
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, new double[]{-2, -2, -2}, new double[]{-2, -1});
this.setLayout(new BorderLayout(0,0));
this.add(TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Location"), panel), BorderLayout.CENTER);
}
@Override
public void populateBean(Plot plot) {
if (plot instanceof VanChartPositionPlot) {
Position position = ((VanChartPositionPlot) plot).getPosition();
if (position != null) {
radius.setValue(position.getRadius());
xDirection.setValue(position.getX());
yDirection.setValue(position.getY());
}
}
}
@Override
public void updateBean(Plot plot) {
if (plot instanceof VanChartPositionPlot) {
Position position = new Position();
position.setRadius(radius.getValue());
position.setX(xDirection.getValue());
position.setY(yDirection.getValue());
((VanChartPositionPlot) plot).setPosition(position);
}
}
@Override
public Plot updateBean() {
return null;
}
@Override
protected String title4PopupWindow() {
return null;
}
}

36
designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotReportDataContentPane.java

@ -0,0 +1,36 @@
package com.fr.plugin.chart.custom.component;
import com.fr.chart.chartdata.MeterReportDefinition;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.MeterPlotReportDataContentPane;
import javax.swing.*;
import java.awt.*;
/**
* Created by Fangjie on 2016/5/23.
*/
public class MeterCustomPlotReportDataContentPane extends MeterPlotReportDataContentPane{
private UITextField singCateText;
public MeterCustomPlotReportDataContentPane(ChartDataPane parent) {
super(parent);
}
@Override
protected Component getSingCatePane() {
return singCateText = new UITextField();
}
@Override
protected void populateSingCatePane(String name) {
singCateText.setText(name);
}
@Override
protected void updateSingCatePane(MeterReportDefinition meterDefinition) {
meterDefinition.setName(singCateText.getText());
}
}

44
designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotTableDataContentPane.java

@ -0,0 +1,44 @@
package com.fr.plugin.chart.custom.component;
import com.fr.base.Utils;
import com.fr.chart.chartdata.MeterTableDefinition;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.table.MeterPlotTableDataContentPane;
import com.fr.plugin.chart.data.VanChartMeterCustomTableDefinition;
import java.awt.*;
/**
* Created by Fangjie on 2016/5/18.
*/
public class MeterCustomPlotTableDataContentPane extends MeterPlotTableDataContentPane {
private static final int TEXT_HT = 20;
private static final int TEXT_WD = 80;
private UITextField nameField;
public MeterCustomPlotTableDataContentPane(ChartDataPane parent) {
super(parent);
}
@Override
protected Component getNameComponent() {
nameField = new UITextField();
nameField.setPreferredSize(new Dimension(TEXT_WD, TEXT_HT));
return nameField;
}
@Override
protected void populateNameComponent(MeterTableDefinition meter) {
nameField.setText(meter.getName());
}
@Override
protected void updateNameComponent(MeterTableDefinition meter) {
meter.setName(Utils.objectToString(nameField.getText()));
}
@Override
protected MeterTableDefinition getMeterTableDefinition(){
return new VanChartMeterCustomTableDefinition();
}
}

19
designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAreaBackgroundPane.java

@ -0,0 +1,19 @@
package com.fr.plugin.chart.custom.component;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.plugin.chart.custom.style.VanChartCustomAxisAreaPane;
import com.fr.plugin.chart.designer.style.background.VanChartAreaBackgroundPane;
import com.fr.plugin.chart.designer.style.background.VanChartAxisAreaPane;
/**
* Created by Fangjie on 2016/5/19.
*/
public class VanChartCustomAreaBackgroundPane extends VanChartAreaBackgroundPane {
public VanChartCustomAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent) {
super(isPlot, parent);
}
protected VanChartAxisAreaPane initAxisAreaPane() {
return new VanChartCustomAxisAreaPane();
}
}

43
designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAxisConditionPane.java

@ -0,0 +1,43 @@
package com.fr.plugin.chart.custom.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.Inter;
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis;
import com.fr.plugin.chart.column.VanChartCustomStackAndAxisConditionPane;
import java.awt.*;
/**
* 自定义坐标轴设置
* 散点图和气泡图用到
* 堆积和百分比属性为false
*/
public class VanChartCustomAxisConditionPane extends VanChartCustomStackAndAxisConditionPane {
public VanChartCustomAxisConditionPane(){
}
protected Component[][] getDeployComponents() {
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("ChartF-X_Axis")),XAxis},
new Component[]{new UILabel(Inter.getLocText("ChartF-Y_Axis")),YAxis},
};
return components;
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Plugin-ChartF_Custom_Axis");
}
@Override
protected void updateStackAndPercent(AttrSeriesStackAndAxis seriesStackAndAxis) {
seriesStackAndAxis.setStacked(false);
seriesStackAndAxis.setPercentStacked(false);
}
}

55
designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotAxisPane.java

@ -0,0 +1,55 @@
package com.fr.plugin.chart.custom.component;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis;
import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane;
import java.util.List;
/**
* Created by Fangjie on 2016/5/12.
*/
public class VanChartCustomPlotAxisPane extends VanChartAxisPane {
public VanChartCustomPlotAxisPane(VanChartAxisPlot plot, VanChartStylePane parent) {
super(plot, parent);
}
//删除此坐标轴相关堆积属性的设置
protected void removeOthers(int axisIndex, boolean isXAxis){
//堆积和坐标轴
VanChartCustomPlot customPlot = (VanChartCustomPlot)editingPlot;
List<VanChartPlot> plotList = customPlot.getCustomPlotList();
for (int k = 0; k < plotList.size(); k++) {
if (customPlot.getStandardAxisOrder().contains(k)){
VanChartRectanglePlot vanChartPlot = (VanChartRectanglePlot) plotList.get(k);
if (vanChartPlot.isHaveAxis() && !CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlot)){
remove(axisIndex, isXAxis, vanChartPlot);
}
}
}
}
private void remove(int axisIndex, boolean isXAxis, VanChartRectanglePlot vanChartPlot){
ConditionCollection stackAndAxisCondition = vanChartPlot.getStackAndAxisCondition();
if (stackAndAxisCondition == null) {
return;
}
for (int i = 0, len = stackAndAxisCondition.getConditionAttrSize(); i < len; i++) {
ConditionAttr conditionAttr = stackAndAxisCondition.getConditionAttr(i);
AttrSeriesStackAndAxis stackAndAxis = (AttrSeriesStackAndAxis) conditionAttr.getExisted(AttrSeriesStackAndAxis.class);
int index = isXAxis ? stackAndAxis.getXAxisIndex() : stackAndAxis.getYAxisIndex();
if (index == axisIndex) {
stackAndAxisCondition.removeConditionAttr(conditionAttr);
}
}
}
}

396
designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotSelectPane.java

@ -0,0 +1,396 @@
package com.fr.plugin.chart.custom.component;
import com.fr.chart.chartattr.Chart;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.custom.type.CustomStyle;
import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Fangjie on 2016/4/19.
*/
public class VanChartCustomPlotSelectPane extends BasicBeanPane<Chart> {
private static final int NO_DIRTY = -1;
private static final int NOT_LAST = -1;
private static final int REC_WIDTH = 58;
private static final int REC_HEIGHT = 50;
private static final int CUSTOM_TYPE_NUM = 4;
public static final String MASSAGE = Inter.getLocText("Plugin-ChartF_At_Least_One_Chart");
private List<ChartImageCheckOutPane> customTypeList = new ArrayList<ChartImageCheckOutPane>();
//该列表记录上次每个checkout的状态
private List<Boolean> oldSelectedList;
//保存点击的checkout顺序
private List<CustomPlotType> selectedPlotTypeList = new ArrayList<CustomPlotType>();
//将所有面板排布后的面板
private JPanel content;
public VanChartCustomPlotSelectPane(){
initCustomType();
}
private void initCustomType() {
initAllCheckOutPane();
initContentPane();
updateOldSelectedList();
addCheckBoxListener();
checkoutSelected();
}
private void updateOldSelectedList() {
oldSelectedList = new ArrayList<Boolean>();
for (int i = 0; i < customTypeList.size(); i++){
oldSelectedList.add(customTypeList.get(i).getCheckBox().isSelected());
}
}
private void checkoutSelected() {
for (int i = 0; i < customTypeList.size(); i++){
//根据是否选中重置背景
customTypeList.get(i).checkIconImage();
}
}
private void initContentPane() {
content = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(CUSTOM_TYPE_NUM, 0, 0);
for (int i = 0; i < customTypeList.size(); i++){
customTypeList.get(i).setPreferredSize(new Dimension(REC_WIDTH,REC_HEIGHT));
//是否画右边线
boolean isRightLine = (i == customTypeList.size() - 1) ? true : ((i + 1)%CUSTOM_TYPE_NUM == 0) ? true : false;
//是否画下边线
int row = i / CUSTOM_TYPE_NUM;
int column = i % CUSTOM_TYPE_NUM;
boolean isBottomLine = ((row+1)*CUSTOM_TYPE_NUM + column < customTypeList.size()) ? false : true;
customTypeList.get(i).setPaneBorder(isRightLine, isBottomLine);
content.add(customTypeList.get(i));
}
this.setLayout(new BorderLayout());
this.add(content, BorderLayout.CENTER);
}
private void addCheckBoxListener() {
for (int i = 0; i < customTypeList.size(); i++){
//初始化每个customType的listener
customTypeList.get(i).getCheckBox().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
int index = isLastSelected();
if (index != NOT_LAST) {//如果是最后一个
customTypeList.get(index).getCheckBox().setSelected(true);
//彈出警告框
JOptionPane.showMessageDialog(new JPanel(), MASSAGE,"", JOptionPane.WARNING_MESSAGE);
}
//点击后更新已选顺序
checkoutSelectedPlotTypeList();
//点击后,更新背景
checkoutSelected();
//响应观察者事件,以便更新chart
fireDirty();
}
});
}
}
/**
* 根据选择更新顺序
*/
private void checkoutSelectedPlotTypeList() {
int index = getDirtySelectedIndex(oldSelectedList);
if (index == NO_DIRTY){
return;
}
boolean isAdd = getDirtyState(index);
//获取选中的自定义图表类型
CustomPlotType plotType = customTypeList.get(index).getCustomPlotType();
//根据类型处理增加或者删除
dealSelectedPlotTypeList(isAdd, plotType, selectedPlotTypeList);
}
private void fireDirty() {
int index = getDirtySelectedIndex(oldSelectedList);
if (index != NO_DIRTY) {
customTypeList.get(index).fireStateChange();
}
}
@Override
public void populateBean(Chart chart) {
VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot();
populateCustomTypeList(customPlot);
populateSelectedPlotTypeList(customPlot);
checkoutSelected();
}
private void populateSelectedPlotTypeList(VanChartCustomPlot customPlot) {
selectedPlotTypeList = new ArrayList<CustomPlotType>();
List<VanChartPlot> customPlotList = customPlot.getCustomPlotList();
for (int i = 0; i < customPlotList.size(); i++){
selectedPlotTypeList.add(CustomPlotFactory.getCustomType(customPlotList.get(i)));
}
}
private void populateCustomTypeList(VanChartCustomPlot customPlot) {
if (customPlot.getCustomStyle() != CustomStyle.CUSTOM){
return;
}
List<VanChartPlot> customPlotList = customPlot.getCustomPlotList();
oldSelectedList = new ArrayList<Boolean>();
for (int i = 0; i < customTypeList.size(); i++){
boolean isSelected = false;
CustomPlotType customPlotType = customTypeList.get(i).getCustomPlotType();
//更新选中项
if (customPlotTypeContained(customPlotType, customPlotList)) {
isSelected = true;
}
customTypeList.get(i).setSelected(isSelected);
//同时设置oldList
oldSelectedList.add(isSelected);
}
}
private boolean customPlotTypeContained(CustomPlotType customPlotType, List<VanChartPlot> customPlotList) {
boolean contained = false;
for (int i = 0; i < customPlotList.size(); i++){
if (ComparatorUtils.equals(customPlotType, CustomPlotFactory.getCustomType(customPlotList.get(i)))){
contained = true;
break;
}
}
return contained;
}
@Override
public Chart updateBean() {
return null;
}
@Override
public void updateBean(Chart chart) {
VanChartCustomPlot customPlot = (VanChartCustomPlot)chart.getPlot();
//根据选择的组合图更新,根据保存的顺序更新组合图
updateCustomPlotList(customPlot);
//响应完毕后,更新状态
updateOldSelectedList();
}
private void updateCustomPlotList(VanChartCustomPlot customPlot) {
//根据selectedPlotTypeList更新customPlotList
//切换之后,给与全新构建的plotList,这回导致其他面板上的设置无效,也是合理的
List<VanChartPlot> newCustomPlotList = new ArrayList<VanChartPlot>();
List<VanChartPlot> oldCustomPlotList = customPlot.getCustomPlotList();
//复制已经设置的plot
try {
for (int i = 0; i < oldCustomPlotList.size(); i++){
VanChartPlot vanChartPlot = oldCustomPlotList.get(i);
if (selectedPlotTypeList.contains(CustomPlotFactory.getCustomType(vanChartPlot))){
newCustomPlotList.add((VanChartPlot) vanChartPlot.clone());
}
}
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error(e.getMessage());
}
//没有复制到的plot重创
for (int i = 0; i < selectedPlotTypeList.size(); i++){
CustomPlotType customPlotType = selectedPlotTypeList.get(i);
if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){
VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType);
vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString());
//设置公共属性
setCommonAttr(vanChartPlot, customPlot);
newCustomPlotList.add(vanChartPlot);
}
}
customPlot.setCustomPlotList(newCustomPlotList);
}
private void setCommonAttr(VanChartPlot vanChartPlot, VanChartCustomPlot customPlot) {
//坐标轴公共属性
dealAxisAttr(vanChartPlot, customPlot);
}
private void dealAxisAttr(VanChartPlot vanChartPlot, VanChartCustomPlot customPlot) {
if (vanChartPlot.isHaveAxis() && !CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlot) && customPlot.isHaveStandardAxis()){
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)vanChartPlot;
//指针指向同一个标准坐标轴
rectanglePlot.setXAxisList(customPlot.getXAxisList());
rectanglePlot.setYAxisList(customPlot.getYAxisList());
}
}
private void dealSelectedPlotTypeList(boolean isAdd, CustomPlotType plotType, List<CustomPlotType> customPlotTypeList) {
//根据isAdd删除或者增加
if (isAdd){
customPlotTypeList.add(plotType);
}else {
//定位选中的是那个plot
int index = -1;
for (int i = 0; i < customPlotTypeList.size(); i++){
if (ComparatorUtils.equals(plotType, customPlotTypeList.get(i))){
index = i;
break;
}
}
if (index == -1){
return;
}
customPlotTypeList.remove(index);
}
}
/**
* 获取id为index的图表是选中还是删除
* 增加则返回true
* 删除返回false
* @param index
* @return
*/
private boolean getDirtyState(int index) {
boolean isAdd = true;
boolean newState = customTypeList.get(index).getCheckBox().isSelected();
boolean oldState = oldSelectedList.get(index);
//true->false为删除;false->true为增加
if (oldState == true && newState == false){
isAdd = false;
}else if (oldState == false && newState == true){
isAdd = true;
}
return isAdd;
}
@Override
protected String title4PopupWindow() {
return null;
}
/**
* 如果是最后一个则返回最后一个checkout的index
* 否则返回-1
* @return
*/
private int isLastSelected() {
int count = 0;
int index = NOT_LAST;
for (int i = 0; i < customTypeList.size(); i++){
if (customTypeList.get(i).getCheckBox().isSelected()){
count++;
}
}
if (count == 0){
//查找是哪一个变化了
index = getDirtySelectedIndex(oldSelectedList);
}
return index;
}
/**
* 获取改变状态的index
* 如果有两个都改变了改函数获取的是排在前面的index
* 如果没找到
* @param oldSelectedList
* @return
*/
private int getDirtySelectedIndex(List<Boolean> oldSelectedList) {
for (int i = 0; i < oldSelectedList.size(); i++){
if ((oldSelectedList.get(i)) != customTypeList.get(i).getCheckBox().isSelected()){
return i;
}
}
return NO_DIRTY;
}
/**
* 构建所有可用的组合图面板
*/
private void initAllCheckOutPane() {
//将所有工厂中的图表都加入到可选面板中
CustomPlotType[] customPlotTypes = CustomPlotType.getTypes();
for(int i = 0; i < customPlotTypes.length; i++){
boolean isSelected = false;
CustomPlotType customPlotType = customPlotTypes[i];
//前两个默认选中
if (i == 0 || i == 1) {
isSelected = true;
selectedPlotTypeList.add(customPlotType);
}
ChartImageCheckOutPane checkOutPane = new ChartImageCheckOutPane(customPlotType, isSelected);
customTypeList.add(checkOutPane);
}
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save