Browse Source

CHART-2006 图表插件接口整理

master
zheng 7 years ago
parent
commit
79e170b361
  1. 334
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  2. 2
      designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java
  3. 5
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java
  4. 5
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java
  5. 7
      designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java
  6. 8
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  7. 24
      designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java
  8. 101
      designer_chart/src/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java
  9. 121
      designer_chart/src/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java
  10. 80
      designer_chart/src/com/fr/extended/chart/AbstractExtendedChartUIProvider.java
  11. 130
      designer_chart/src/com/fr/extended/chart/AbstractExtendedStylePane.java
  12. 39
      designer_chart/src/com/fr/extended/chart/ExtendedChartHyperLinkPane.java
  13. 81
      designer_chart/src/com/fr/extended/chart/ExtendedOtherPane.java
  14. 54
      designer_chart/src/com/fr/extended/chart/ExtendedTypePane.java
  15. 6
      designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java

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

@ -37,6 +37,7 @@ 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.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.form.ui.ChartEditor;
import com.fr.general.GeneralContext;
@ -89,14 +90,16 @@ import com.fr.stable.EnvChangedListener;
import com.fr.stable.StringUtils;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import javax.swing.*;
import javax.swing.Icon;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static com.fr.chart.charttypes.ChartTypeManager.CHART_PRIORITY;
import static com.fr.chart.charttypes.ChartTypeManager.VAN_CHART_PRIORITY;
/**
* Created by eason on 14/12/29.
@ -108,7 +111,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
private static LinkedHashMap<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>> chartTypeInterfaces =
new LinkedHashMap<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>>();
private static Map<String, String> idAndPriorityMap = new HashMap<String, String>();
public synchronized static ChartTypeInterfaceManager getInstance() {
return classManager;
@ -185,32 +190,28 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
private static void readVanChart() {
if (chartTypeInterfaces.containsKey(ChartTypeManager.VAN_CHART_PRIORITY)) {
if (chartTypeInterfaces.containsKey(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);
addChartTypeInterface(VAN_CHART_PRIORITY, PiePlot4VanChart.VAN_CHART_PIE_PLOT, new PieIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID, new ColumnIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID, new BarIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartLinePlot.VAN_CHART_LINE_PLOT, new LineIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID, new AreaIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGaugePlot.VAN_CHART_GAUGE_PLOT, new GaugeIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartRadarPlot.VAN_CHART_RADAR_PLOT, new RadarIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartScatterPlot.VAN_CHART_SCATTER_PLOT_ID, new ScatterIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID, new BubbleIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID, new CustomIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartMultiPiePlot.VAN_CHART_MULTILAYER_PLOT_ID, new MultiPieIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartMapPlot.VAN_CHART_MAP_ID, new MapIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartDrillMapPlot.VAN_CHART_DRILL_MAP_ID, new DrillMapIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartTreeMapPlot.VAN_CHART_TREE_MAP_PLOT_ID, new TreeMapIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartFunnelPlot.VAN_CHART_FUNNEL_PLOT_ID, new FunnelIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartHeatMapPlot.VAN_CHART_HEAT_MAP_ID, new HeatMapIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartWordCloudPlot.WORD_CLOUD_PLOT_ID, new WordCloudIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new StructureIndependentVanChartInterface());
}
@ -219,54 +220,27 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
if (chartTypeInterfaces.containsKey(CHART_PRIORITY)) {
return;
}
CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap> chartUIList =
new CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>(LinkedHashMap.class);
chartUIList.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface());
chartUIList.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface());
chartUIList.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface());
chartUIList.put(ChartConstants.PIE_CHART, new PieIndependentChartInterface());
chartUIList.put(ChartConstants.AREA_CHART, new AreaIndependentChartInterface());
chartUIList.put(ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface());
chartUIList.put(ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface());
chartUIList.put(ChartConstants.RADAR_CHART, new RadarIndependentChartInterface());
chartUIList.put(ChartConstants.STOCK_CHART, new StockIndependentChartInterface());
chartUIList.put(ChartConstants.METER_CHART, new MeterIndependentChartInterface());
chartUIList.put(ChartConstants.RANGE_CHART, new RangeIndependentChartInterface());
chartUIList.put(ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface());
chartUIList.put(ChartConstants.GANTT_CHART, new GanttIndependentChartInterface());
chartUIList.put(ChartConstants.DONUT_CHART, new DonutIndependentChartInterface());
chartUIList.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface());
chartUIList.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface());
chartUIList.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface());
chartTypeInterfaces.put(CHART_PRIORITY, chartUIList);
}
public String getIconPath(String plotID) {
if (chartTypeInterfaces != null) {
for (Map.Entry<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>> entry : chartTypeInterfaces.entrySet()) {
String priority = entry.getKey();
String imagePath = getIconPath(priority, plotID);
if (StringUtils.isNotEmpty(imagePath)) {
return imagePath;
}
}
}
return StringUtils.EMPTY;
}
private String getIconPath(String priority, String plotID) {
if (chartTypeInterfaces.get(priority) != null && chartTypeInterfaces.get(priority).get(plotID) != null) {
return chartTypeInterfaces.get(priority).get(plotID).getIconPath();
} else {
return StringUtils.EMPTY;
}
}
private static void addChartTypeInterface(IndependentChartUIProvider provider, String priority, String plotID) {
addChartTypeInterface(CHART_PRIORITY, ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.LINE_CHART, new LineIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.BAR_CHART, new BarIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.PIE_CHART, new PieIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.AREA_CHART, new AreaIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.RADAR_CHART, new RadarIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.STOCK_CHART, new StockIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.METER_CHART, new MeterIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.RANGE_CHART, new RangeIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.GANTT_CHART, new GanttIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.DONUT_CHART, new DonutIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.MAP_CHART, new MapIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface());
}
private static void addChartTypeInterface(String priority, String plotID, IndependentChartUIProvider provider) {
if (chartTypeInterfaces != null) {
if (!chartTypeInterfaces.containsKey(priority)) {
@ -281,9 +255,19 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
chartUIList.put(plotID, provider);
}
}
idAndPriorityMap.put(plotID, priority);
}
}
private static IndependentChartUIProvider getChartTypeInterface(String plotID) {
if (idAndPriorityMap.containsKey(plotID)) {
String priority = idAndPriorityMap.get(plotID);
if (chartTypeInterfaces.containsKey(priority)) {
return chartTypeInterfaces.get(priority).get(plotID);
}
}
return null;
}
/**
* 把所有的pane加到list里
@ -295,11 +279,13 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
List<Integer> priorityList = getPriorityInOrder();
for (Integer aPriorityList : priorityList) {
String priority = String.valueOf(aPriorityList);
Iterator chartUIIterator = chartTypeInterfaces.get(priority).entrySet().iterator();
Iterator<Map.Entry<String, IndependentChartUIProvider>> chartUIIterator = chartTypeInterfaces.get(priority).entrySet().iterator();
while (chartUIIterator.hasNext()) {
Map.Entry chartUIEntry = (Map.Entry) chartUIIterator.next();
IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue();
paneList.add(provider.getPlotTypePane());
Map.Entry<String, IndependentChartUIProvider> chartUIEntry = chartUIIterator.next();
IndependentChartUIProvider provider = chartUIEntry.getValue();
AbstractChartTypePane pane = provider.getPlotTypePane();
pane.setPlotID(chartUIEntry.getKey());
paneList.add(pane);
}
}
}
@ -396,23 +382,25 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
return index;
}
public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
if (plotInChart(plotID, priority)) {
return getChartDataPane(priority, plotID, listener);
public String getIconPath(String plotID) {
if (chartTypeInterfaces != null) {
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getIconPath();
}
}
return getChartDataPane(CHART_PRIORITY, plotID, listener);
return StringUtils.EMPTY;
}
private ChartDataPane getChartDataPane(String priority, String plotID, AttributeChangeListener listener) {
return chartTypeInterfaces.get(priority).get(plotID).getChartDataPane(listener);
public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) {
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getChartDataPane(listener);
}
return new ChartDataPane(listener);
}
/**
@ -428,54 +416,33 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
public AbstractChartAttrPane[] getAttrPaneArray(String plotID, AttributeChangeListener listener) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
if (plotInChart(plotID, priority)) {
return getAttrPaneArray(priority, plotID, listener);
}
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getAttrPaneArray(listener);
}
return getAttrPaneArray(CHART_PRIORITY, plotID, listener);
}
private AbstractChartAttrPane[] getAttrPaneArray(String priority, String plotID, AttributeChangeListener listener) {
return new AbstractChartAttrPane[0];
return chartTypeInterfaces.get(priority).get(plotID).getAttrPaneArray(listener);
}
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), priority)) {
return getTableDataSourcePane(priority, plot, parent);
}
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID());
if (provider != null) {
return provider.getTableDataSourcePane(plot, parent);
}
return getTableDataSourcePane(CHART_PRIORITY, plot, parent);
}
private AbstractTableDataContentPane getTableDataSourcePane(String priority, Plot plot, ChartDataPane parent) {
return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getTableDataSourcePane(plot, parent);
return null;
}
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
String plotID = plot.getPlotID();
if (plotInChart(plotID, priority)) {
return getReportDataSourcePane(priority, plot, parent);
}
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID());
if (provider != null) {
return provider.getReportDataSourcePane(plot, parent);
}
return getReportDataSourcePane(CHART_PRIORITY, plot, parent);
return null;
}
private boolean plotInChart(String plotID, String priority) {
@ -485,47 +452,25 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
&& chartTypeInterfaces.get(priority).containsKey(plotID);
}
private AbstractReportDataContentPane getReportDataSourcePane(String priority, Plot plot, ChartDataPane parent) {
return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getReportDataSourcePane(plot, parent);
}
public ConditionAttributesPane getPlotConditionPane(Plot plot) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), priority)) {
return getPlotConditionPane(priority, plot);
}
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID());
if (provider != null) {
return provider.getPlotConditionPane(plot);
}
return getPlotConditionPane(CHART_PRIORITY, plot);
}
private ConditionAttributesPane getPlotConditionPane(String priority, Plot plot) {
return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getPlotConditionPane(plot);
return null;
}
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), priority)) {
return getPlotSeriesPane(priority, parent, plot);
}
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID());
if (provider != null) {
return provider.getPlotSeriesPane(parent, plot);
}
return getPlotSeriesPane(CHART_PRIORITY, parent, plot);
}
private BasicBeanPane<Plot> getPlotSeriesPane(String priority, ChartStylePane parent, Plot plot) {
return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getPlotSeriesPane(parent, plot);
return null;
}
/**
@ -535,23 +480,24 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
* @return 是否使用默认的界面
*/
public boolean isUseDefaultPane(String plotID) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
if (chartTypeInterfaces.get(priority).containsKey(plotID)) {
return isUseDefaultPane(priority, plotID);
}
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.isUseDefaultPane();
}
return true;
}
private boolean isUseDefaultPane(String priority, String plotID) {
return !(chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) || chartTypeInterfaces.get(priority).get(plotID).isUseDefaultPane();
public boolean needChartChangePane(Chart chart) {
if (chart != null && chart.getPlot() != null) {
IndependentChartUIProvider provider = getChartTypeInterface(chart.getPlot().getPlotID());
if (provider != null) {
return provider.needChartChangePane();
}
}
return true;
}
@Override
@ -561,7 +507,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
String priority = injection.getAttribute("priority", CHART_PRIORITY);
String plotID = injection.getAttribute("plotID");
IndependentChartUIProvider instance = (IndependentChartUIProvider) injection.getObject();
addChartTypeInterface(instance, priority, plotID);
addChartTypeInterface(priority, plotID, instance);
}
}
@ -593,37 +539,21 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
//获取指定图表的编辑面板
public ChartEditPane getChartEditPane(String plotID) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
if (plotInChart(plotID, priority)) {
return getChartEditPane(priority, plotID);
}
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getChartEditPane(plotID);
}
return getChartEditPane(CHART_PRIORITY, plotID);
}
private ChartEditPane getChartEditPane(String priority, String plotID) {
return chartTypeInterfaces.get(priority).get(plotID).getChartEditPane(plotID);
return new ChartEditPane();
}
public ChartsConfigPane getChartConfigPane(String plotID) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
if (plotInChart(plotID, priority)) {
return getChartConfigPane(priority, plotID);
}
IndependentChartUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
return provider.getChartConfigPane(plotID);
}
return getChartConfigPane(CHART_PRIORITY, plotID);
}
private ChartsConfigPane getChartConfigPane(String priority, String plotID) {
return chartTypeInterfaces.get(priority).get(plotID).getChartConfigPane(plotID);
return null;
}
}

2
designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java

@ -27,6 +27,8 @@ public interface IndependentChartUIProvider extends Level {
int CURRENT_API_LEVEL = 3;
boolean needChartChangePane();
/**
* 图表的类型定义界面类型就是属性表的第一个界面
*

5
designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java

@ -57,6 +57,11 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ
return obj != null && ComparatorUtils.equals(obj.getClass(), this.getClass());
}
@Override
public boolean needChartChangePane() {
return true;
}
public ConditionAttributesPane getPlotConditionPane(Plot plot){
return new DataSeriesConditionPane();
}

5
designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java

@ -33,6 +33,11 @@ public abstract class AbstractIndependentChartsUI extends AbstractProvider imple
}
@Override
public boolean needChartChangePane() {
return true;
}
@Override
public AbstractChartTypePane getPlotTypePane() {
return new PiePlotPane();

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

@ -22,10 +22,11 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
@ -52,7 +53,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
private TitleChangeListener titleChangeListener = null;
private Calendar lastTime;
protected ChartEditPane() {
public ChartEditPane() {
this.setLayout(new BorderLayout());
paneList = new ArrayList<AbstractChartAttrPane>();

8
designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -17,11 +17,13 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox;
import com.fr.design.mainframe.chart.gui.item.ItemEventType;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.extended.chart.AbstractChart;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
@ -316,6 +318,8 @@ public class ChartTypePane extends AbstractChartAttrPane{
buttonPane.populateBean(collection);
chartTypeComBox.populateBean(chart);
buttonPane.setVisible(ChartTypeInterfaceManager.getInstance().needChartChangePane(chart));
this.initAllListeners();
}

24
designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java

@ -31,8 +31,12 @@ import com.fr.general.Inter;
import com.fr.js.NameJavaScriptGroup;
import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.util.ArrayList;
import java.util.List;
@ -49,6 +53,8 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
protected static final int BAIDU = 0;
protected static final int GOOGLE = 1;
private String plotID;
protected List<ChartImagePane> typeDemo;
protected List<ChartImagePane> styleList;
@ -356,11 +362,23 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
}
/**
* 此接口已删除不用实现了
*
* 获取各图表类型界面ID, 本质是plotID
* 使用getPlotID
* @return 图表类型界面ID
*/
@Deprecated
protected abstract String getPlotTypeID();
public String getPlotID() {
return plotID;
}
public void setPlotID(String plotID) {
this.plotID = plotID;
}
/**
*
* @param ob 对象
@ -370,7 +388,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
if(ob instanceof Chart){
Chart chart = (Chart)ob;
Plot plot = chart.getPlot();
if(plot != null && ComparatorUtils.equals(plot.getPlotID(), getPlotTypeID())){
if(plot != null && ComparatorUtils.equals(plot.getPlotID(), getPlotID())){
return true;
}
}

101
designer_chart/src/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java

@ -0,0 +1,101 @@
package com.fr.extended.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.formula.TinyFormulaPane;
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.data.report.AbstractReportDataContentPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Arrays;
/**
* Created by shine on 2018/3/7.
*/
public abstract class AbstractExtendedChartReportDataPane<T extends AbstractDataConfig> extends AbstractReportDataContentPane {
public AbstractExtendedChartReportDataPane() {
initComponents();
}
protected void initComponents() {
String[] labels = fieldLabel();
TinyFormulaPane[] formulaPanes = formulaPanes();
int len = Math.min(labels.length, formulaPanes.length);
Component[][] components = new Component[len][2];
for (int i = 0; i < len; i++) {
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]};
}
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, COMPONENT_WIDTH};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 24, 6);
panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.CENTER);
}
protected abstract String[] fieldLabel();
protected abstract TinyFormulaPane[] formulaPanes();
protected abstract void populate(T dataConf);
protected abstract T update();
public void populateBean(ChartCollection collection) {
if (collection != null) {
Chart chart = collection.getSelectedChart();
if (chart != null && chart instanceof AbstractChart) {
AbstractDataConfig dataConfig = ((AbstractChart) chart).getDataConfig();
if (dataConfig != null) {
populate((T) dataConfig);
}
}
}
}
@Override
public void updateBean(ChartCollection ob) {
if (ob != null) {
Chart chart = ob.getSelectedChart();
if (chart != null) {
ExtendedReportDataSet dataSet = new ExtendedReportDataSet();
dataSet.setDataConfig(update());
chart.setFilterDefinition(dataSet);
}
}
}
protected void populateField(TinyFormulaPane formulaPane, ExtendedField field) {
formulaPane.populateBean(field.getFieldName());
}
protected void updateField(TinyFormulaPane formulaPane, ExtendedField field) {
field.setFieldName(formulaPane.updateBean());
}
@Override
protected String[] columnNames() {
return new String[0];
}
}

121
designer_chart/src/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java

@ -0,0 +1,121 @@
package com.fr.extended.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
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.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.general.GeneralUtils;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.util.Arrays;
import java.util.List;
/**
* Created by shine on 2018/3/2.
*/
public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataConfig> extends AbstractTableDataContentPane {
public AbstractExtendedChartTableDataPane() {
initComponents();
}
protected void initComponents() {
String[] labels = fieldLabel();
UIComboBox[] comboBoxes = filedComboBoxes();
int len = Math.min(labels.length, comboBoxes.length);
Component[][] components = new Component[len][2];
for (int i = 0; i < len; i++) {
UIComboBox comboBox = comboBoxes[i];
comboBox.setPreferredSize(new Dimension(100, 20));
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), comboBox};
}
double p = TableLayout.PREFERRED;
double[] columnSize = {p, p};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.CENTER);
}
protected abstract String[] fieldLabel();
protected abstract UIComboBox[] filedComboBoxes();
protected abstract void populate(T dataConf);
protected abstract T update();
@Override
public void populateBean(ChartCollection collection) {
if (collection != null) {
Chart chart = collection.getSelectedChart();
if (chart != null && chart instanceof AbstractChart) {
AbstractDataConfig dataConfig = ((AbstractChart) chart).getDataConfig();
if (dataConfig != null) {
populate((T) dataConfig);
}
}
}
}
@Override
public void updateBean(ChartCollection ob) {
if (ob != null) {
Chart chart = ob.getSelectedChart();
if (chart != null) {
ExtendedTableDataSet dataSet = new ExtendedTableDataSet();
dataSet.setDataConfig(update());
chart.setFilterDefinition(dataSet);
}
}
}
@Override
public void checkBoxUse(boolean hasUse) {
for (UIComboBox comboBox : filedComboBoxes()) {
comboBox.setEnabled(hasUse);
}
}
@Override
public void clearAllBoxList() {
for (UIComboBox comboBox : filedComboBoxes()) {
clearBoxItems(comboBox);
}
}
@Override
protected void refreshBoxListWithSelectTableData(List columnNameList) {
for (UIComboBox comboBox : filedComboBoxes()) {
refreshBoxItems(comboBox, columnNameList);
}
}
protected void populateField(UIComboBox comboBox, ExtendedField field) {
comboBox.setSelectedItem(field.getFieldName());
}
protected void updateField(UIComboBox comboBox, ExtendedField field) {
field.setFieldName(GeneralUtils.objectToString(comboBox.getSelectedItem()));
}
}

80
designer_chart/src/com/fr/extended/chart/AbstractExtendedChartUIProvider.java

@ -0,0 +1,80 @@
package com.fr.extended.chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.fun.IndependentChartUIProvider;
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.ChartEditPane;
import com.fr.design.mainframe.chart.ChartsConfigPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.stable.fun.impl.AbstractProvider;
/**
* Created by shine on 2018/3/2.
*/
public abstract class AbstractExtendedChartUIProvider extends AbstractProvider implements IndependentChartUIProvider {
@Override
public boolean needChartChangePane() {
return false;
}
@Override
public AbstractChartTypePane getPlotTypePane() {
return new ExtendedTypePane();
}
@Override
public ChartDataPane getChartDataPane(AttributeChangeListener listener) {
return new ChartDataPane(listener);
}
@Override
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) {
return new AbstractChartAttrPane[0];
}
@Override
public boolean isUseDefaultPane() {
return false;
}
@Override
public int currentAPILevel() {
return CURRENT_API_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public ChartEditPane getChartEditPane(String plotID) {
return new ChartEditPane();
}
@Override
public ConditionAttributesPane getPlotConditionPane(Plot plot) {
return null;
}
@Override
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) {
return null;
}
@Override
public String getIconPath() {
return null;
}
@Override
public ChartsConfigPane getChartConfigPane(String plotID) {
return null;
}
}

130
designer_chart/src/com/fr/extended/chart/AbstractExtendedStylePane.java

@ -0,0 +1,130 @@
package com.fr.extended.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UITabGroup;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.util.List;
/**
* Created by shine on 2018/3/13.
*/
public abstract class AbstractExtendedStylePane<T extends AbstractChart> extends AbstractChartAttrPane {
private UITabGroup tabPane;
private String[] NameArray;
private JPanel centerPane;
private CardLayout cardLayout;
private List<BasicScrollPane<T>> paneList;
private AttributeChangeListener listener;
private T chart;
public AbstractExtendedStylePane() {
}
public AbstractExtendedStylePane(AttributeChangeListener listener) {
this.listener = listener;
}
@Override
protected JPanel createContentPane() {
cardLayout = new CardLayout();
paneList = initPaneList();
centerPane = new JPanel(cardLayout) {
@Override
public Dimension getPreferredSize() {
if (tabPane.getSelectedIndex() == -1) {
return super.getPreferredSize();
} else {
return paneList.get(tabPane.getSelectedIndex()).getPreferredSize();
}
}
};
NameArray = new String[paneList.size()];
for (int i = 0; i < paneList.size(); i++) {
BasicBeanPane<T> pane = paneList.get(i);
NameArray[i] = pane.getTitle();
centerPane.add(pane, NameArray[i]);
}
tabPane = new UITabGroup(NameArray) {
@Override
public void tabChanged(int index) {
cardLayout.show(centerPane, NameArray[index]);
dealWithTabChanged();
}
};
tabPane.setSelectedIndex(0);
tabPane.tabChanged(0);
JPanel panel = new JPanel(new BorderLayout(0, 4));
panel.add(tabPane, BorderLayout.NORTH);
panel.add(centerPane, BorderLayout.CENTER);
return panel;
}
private void dealWithTabChanged() {
AbstractExtendedStylePane.this.removeAttributeChangeListener();
paneList.get(tabPane.getSelectedIndex()).populateBean(chart);
AbstractExtendedStylePane.this.addAttributeChangeListener(listener);
}
protected abstract List<BasicScrollPane<T>> initPaneList();
@Override
public void populate(ChartCollection collection) {
if (collection != null) {
Chart chart = collection.getSelectedChart();
if (chart != null && chart instanceof AbstractChart){
this.chart = (T)chart;
paneList.get(tabPane.getSelectedIndex()).populateBean(this.chart);
}
}
}
@Override
public void update(ChartCollection collection) {
if (collection != null) {
Chart chart = collection.getSelectedChart();
if (chart != null && chart instanceof AbstractChart){
this.chart = (T)chart;
paneList.get(tabPane.getSelectedIndex()).updateBean(this.chart);
}
}
}
@Override
public String getIconPath() {
return "com/fr/design/images/chart/ChartStyle.png";
}
@Override
public String title4PopupWindow() {
return PaneTitleConstants.CHART_STYLE_TITLE;
}
}

39
designer_chart/src/com/fr/extended/chart/ExtendedChartHyperLinkPane.java

@ -0,0 +1,39 @@
package com.fr.extended.chart;
import com.fr.base.BaseFormula;
import com.fr.chart.chartattr.Plot;
import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.chart.custom.component.VanChartHyperLinkPane;
import java.util.Map;
/**
* Created by shine on 2018/3/13.
*/
public class ExtendedChartHyperLinkPane extends VanChartHyperLinkPane {
private AbstractChart chart;
public void populateBean(AbstractChart chart) {
this.chart = chart;
populate(chart.getPlot());
}
public void updateBean(AbstractChart chart) {
update(chart.getPlot());
}
@Override
protected Map<String, BaseFormula> getHyperLinkEditorMap() {
return chart.getHyperLinkEditorMap();
}
@Override
protected NameJavaScriptGroup populateHotHyperLink(Plot plot) {
return chart.getLinkGroup();
}
@Override
protected void updateHotHyperLink(Plot plot, NameJavaScriptGroup nameGroup) {
chart.setLinkGroup(nameGroup);
}
}

81
designer_chart/src/com/fr/extended/chart/ExtendedOtherPane.java

@ -0,0 +1,81 @@
package com.fr.extended.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.general.Inter;
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.Component;
/**
* Created by shine on 2018/3/12.
*/
public class ExtendedOtherPane extends AbstractChartAttrPane {
private ExtendedChartHyperLinkPane hyperLinkPane;
private UISpinner autoRefreshTime;
@Override
public void populate(ChartCollection collection) {
if (collection != null) {
Chart chart = collection.getSelectedChart();
if (chart != null && chart instanceof AbstractChart) {
hyperLinkPane.populateBean((AbstractChart) chart);
autoRefreshTime.setValue(((AbstractChart) chart).getAutoRefreshTime());
}
}
}
@Override
public void update(ChartCollection collection) {
if (collection != null) {
Chart chart = collection.getSelectedChart();
if (chart != null && chart instanceof AbstractChart) {
hyperLinkPane.updateBean((AbstractChart) chart);
((AbstractChart) chart).setAutoRefreshTime(autoRefreshTime.getValue());
}
}
}
@Override
protected JPanel createContentPane() {
autoRefreshTime = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p, p, p, p};
Component[][] components = new Component[][]{
new Component[]{autoRefreshTime, null},
new Component[]{createHyperlinkPane(), null}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
@Override
public String getIconPath() {
return null;
}
private JPanel createHyperlinkPane() {
hyperLinkPane = new ExtendedChartHyperLinkPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("M_Insert-Hyperlink"), hyperLinkPane);
}
@Override
public String title4PopupWindow() {
return PaneTitleConstants.CHART_OTHER_TITLE;
}
}

54
designer_chart/src/com/fr/extended/chart/ExtendedTypePane.java

@ -0,0 +1,54 @@
package com.fr.extended.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
/**
* Created by shine on 2018/3/5.
*/
public class ExtendedTypePane extends AbstractChartTypePane {
@Override
protected String[] getTypeIconPath() {
return new String[0];
}
@Override
protected String[] getTypeTipName() {
return new String[0];
}
@Override
public void populateBean(Chart chart) {
}
@Override
public void updateBean(Chart chart) {
}
@Override
protected String getPlotTypeID() {
return null;
}
@Override
public Chart getDefaultChart() {
return ChartTypeManager.getInstance().getChartTypes(getPlotID())[0];
}
@Override
public String title4PopupWindow() {
return ChartTypeManager.getInstance().getChartName(getPlotID());
}
@Override
protected String[] getTypeLayoutPath() {
return new String[0];
}
@Override
protected String[] getTypeLayoutTipName() {
return new String[0];
}
}

6
designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java

@ -1,5 +1,6 @@
package com.fr.plugin.chart.custom.component;
import com.fr.base.BaseFormula;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.web.ChartHyperPoplink;
import com.fr.chart.web.ChartHyperRelateCellLink;
@ -77,7 +78,7 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
Constructor<? extends BasicBeanPane> constructor = null;
try {
constructor = creator.getUpdatePane().getConstructor(HashMap.class, boolean.class);
return constructor.newInstance(plot.getHyperLinkEditorMap(), false);
return constructor.newInstance(getHyperLinkEditorMap(), false);
} catch (InstantiationException e) {
FRLogger.getLogger().error(e.getMessage(), e);
@ -91,6 +92,9 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
return null;
}
protected Map<String, BaseFormula> getHyperLinkEditorMap() {
return plot.getHyperLinkEditorMap();
}
/**
* 弹出列表的标题.

Loading…
Cancel
Save