diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 06cfc242a..8ef36de4c 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/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 chartUIList = + new CloseableContainedMap(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() { diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/area.png b/designer_chart/src/com/fr/design/images/form/toolbar/area.png new file mode 100644 index 000000000..0e690168c Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/area.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/bar.png b/designer_chart/src/com/fr/design/images/form/toolbar/bar.png new file mode 100644 index 000000000..0913e05b1 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/bar.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/bubble.png b/designer_chart/src/com/fr/design/images/form/toolbar/bubble.png new file mode 100644 index 000000000..249e3cda0 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/bubble.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/column.png b/designer_chart/src/com/fr/design/images/form/toolbar/column.png new file mode 100644 index 000000000..e07ad0583 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/column.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/custom.png b/designer_chart/src/com/fr/design/images/form/toolbar/custom.png new file mode 100644 index 000000000..dd25ad047 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/custom.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/drillmap.png b/designer_chart/src/com/fr/design/images/form/toolbar/drillmap.png new file mode 100644 index 000000000..6459771db Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/drillmap.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/funnel.png b/designer_chart/src/com/fr/design/images/form/toolbar/funnel.png new file mode 100644 index 000000000..ff8239f8d Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/funnel.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/gantt.png b/designer_chart/src/com/fr/design/images/form/toolbar/gantt.png new file mode 100644 index 000000000..08a6282f2 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/gantt.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/gauge.png b/designer_chart/src/com/fr/design/images/form/toolbar/gauge.png new file mode 100644 index 000000000..8ee7ab31f Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/gauge.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/heatmap.png b/designer_chart/src/com/fr/design/images/form/toolbar/heatmap.png new file mode 100644 index 000000000..6e6c2146c Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/heatmap.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/line.png b/designer_chart/src/com/fr/design/images/form/toolbar/line.png new file mode 100644 index 000000000..5bb276465 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/line.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/map.png b/designer_chart/src/com/fr/design/images/form/toolbar/map.png new file mode 100644 index 000000000..6459771db Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/map.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/multiPie.png b/designer_chart/src/com/fr/design/images/form/toolbar/multiPie.png new file mode 100644 index 000000000..b6bca9a3e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/multiPie.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/pie.png b/designer_chart/src/com/fr/design/images/form/toolbar/pie.png new file mode 100644 index 000000000..15885cd7b Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/pie.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/radar.png b/designer_chart/src/com/fr/design/images/form/toolbar/radar.png new file mode 100644 index 000000000..5343bef30 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/radar.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/scatter.png b/designer_chart/src/com/fr/design/images/form/toolbar/scatter.png new file mode 100644 index 000000000..5edb30ff5 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/scatter.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/structure.png b/designer_chart/src/com/fr/design/images/form/toolbar/structure.png new file mode 100644 index 000000000..31720b517 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/structure.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/treeMap.png b/designer_chart/src/com/fr/design/images/form/toolbar/treeMap.png new file mode 100644 index 000000000..09edd2b77 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/treeMap.png differ diff --git a/designer_chart/src/com/fr/design/images/form/toolbar/wordcloud.png b/designer_chart/src/com/fr/design/images/form/toolbar/wordcloud.png new file mode 100644 index 000000000..3423b0583 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/form/toolbar/wordcloud.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_Drill_Map.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_Drill_Map.png new file mode 100644 index 000000000..2f68dcf8f Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_Drill_Map.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewBubble.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewBubble.png new file mode 100644 index 000000000..e1ab5c313 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewBubble.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewCustom.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewCustom.png new file mode 100644 index 000000000..dd25ad047 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewCustom.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewFunnel.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewFunnel.png new file mode 100644 index 000000000..c23759fba Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewFunnel.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGantt.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGantt.png new file mode 100644 index 000000000..e5da857b6 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGantt.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGauge.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGauge.png new file mode 100644 index 000000000..2c62da86b Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewGauge.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewHeatMap.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewHeatMap.png new file mode 100644 index 000000000..0450c5007 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewHeatMap.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMap.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMap.png new file mode 100644 index 000000000..2f68dcf8f Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMap.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMultiPie.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMultiPie.png new file mode 100644 index 000000000..b6bca9a3e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewMultiPie.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewRadar.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewRadar.png new file mode 100644 index 000000000..754781f9f Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewRadar.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewScatter.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewScatter.png new file mode 100644 index 000000000..24a2aaa3e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewScatter.png differ diff --git a/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png new file mode 100644 index 000000000..09edd2b77 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png differ diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/XYScatterSeriesPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/XYScatterSeriesPane.java index 1d66cb620..96f0fff3e 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/XYScatterSeriesPane.java +++ b/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())); } } diff --git a/designer_chart/src/com/fr/plugin/.DS_Store b/designer_chart/src/com/fr/plugin/.DS_Store new file mode 100644 index 000000000..d215211c5 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/.DS_Store differ diff --git a/designer_chart/src/com/fr/plugin/chart/area/AreaIndependentVanChartInterface.java b/designer_chart/src/com/fr/plugin/chart/area/AreaIndependentVanChartInterface.java new file mode 100644 index 000000000..0f23b7942 --- /dev/null +++ b/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 getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new VanChartAreaSeriesPane(parent, plot); + } + + /** + * plot面板的标题 + * 插件兼容 + */ + public String getPlotTypeTitle4PopupWindow(){ + return VanChartAreaPlotPane.TITLE; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaConditionPane.java b/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaConditionPane.java new file mode 100644 index 000000000..0591a6008 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaConditionPane.java @@ -0,0 +1,84 @@ +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.AttrDataSheet; +import com.fr.plugin.chart.base.AttrTooltip; +import com.fr.plugin.chart.attr.EffectHelper; +import com.fr.plugin.chart.VanChartAttrHelper; +import com.fr.plugin.chart.base.*; +import com.fr.plugin.chart.designer.PlotFactory; +import com.fr.plugin.chart.designer.other.condition.item.*; +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 class4Correspond() { + return VanChartAreaPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaPlotPane.java b/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaPlotPane.java new file mode 100644 index 000000000..2e31b4c93 --- /dev/null +++ b/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]; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaSeriesPane.java b/designer_chart/src/com/fr/plugin/chart/area/VanChartAreaSeriesPane.java new file mode 100644 index 000000000..e0bd8852e --- /dev/null +++ b/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 getStackAndAxisPaneClass() { + return VanChartCustomStackAndAxisConditionPane.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/area/images/area.png b/designer_chart/src/com/fr/plugin/chart/area/images/area.png new file mode 100644 index 000000000..013b0ab3c Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/area/images/area.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/area/images/custom.png b/designer_chart/src/com/fr/plugin/chart/area/images/custom.png new file mode 100644 index 000000000..319a873c3 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/area/images/custom.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/area/images/percentStack.png b/designer_chart/src/com/fr/plugin/chart/area/images/percentStack.png new file mode 100644 index 000000000..78f414eb6 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/area/images/percentStack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/area/images/stack.png b/designer_chart/src/com/fr/plugin/chart/area/images/stack.png new file mode 100644 index 000000000..d41ca6010 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/area/images/stack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bar/BarIndependentVanChartInterface.java b/designer_chart/src/com/fr/plugin/chart/bar/BarIndependentVanChartInterface.java new file mode 100644 index 000000000..1e0917d96 --- /dev/null +++ b/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 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; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/bar/VanChartBarPlotPane.java b/designer_chart/src/com/fr/plugin/chart/bar/VanChartBarPlotPane.java new file mode 100644 index 000000000..3156380fa --- /dev/null +++ b/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]; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/bar/VanChartBarStylePane.java b/designer_chart/src/com/fr/plugin/chart/bar/VanChartBarStylePane.java new file mode 100644 index 000000000..91b36e90b --- /dev/null +++ b/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 paneList, VanChartAxisPlot plot) { + paneList.add(new VanChartBarAxisPane(plot, VanChartBarStylePane.this)); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bar/images/bar.png b/designer_chart/src/com/fr/plugin/chart/bar/images/bar.png new file mode 100644 index 000000000..06191f7ac Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bar/images/bar.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bar/images/custom.png b/designer_chart/src/com/fr/plugin/chart/bar/images/custom.png new file mode 100644 index 000000000..7356c36d8 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bar/images/custom.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bar/images/percentstack.png b/designer_chart/src/com/fr/plugin/chart/bar/images/percentstack.png new file mode 100644 index 000000000..608292e0b Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bar/images/percentstack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bar/images/stack.png b/designer_chart/src/com/fr/plugin/chart/bar/images/stack.png new file mode 100644 index 000000000..001650f7b Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bar/images/stack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/BubbleIndependentVanChartInterface.java b/designer_chart/src/com/fr/plugin/chart/bubble/BubbleIndependentVanChartInterface.java new file mode 100644 index 000000000..bd9f0695e --- /dev/null +++ b/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 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 createInteractivePane() { + return new VanChartBubbleInteractivePane(); + } + }; + return new AbstractChartAttrPane[]{stylePane, otherPane}; + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new VanChartBubbleConditionPane(plot); + } + + public String getPlotTypeTitle4PopupWindow(){ + return VanChartBubblePlotPane.TITLE; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionPane.java new file mode 100644 index 000000000..77e06a512 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionPane.java @@ -0,0 +1,90 @@ +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.base.VanChartAttrBubble; +import com.fr.plugin.chart.designer.PlotFactory; +import com.fr.plugin.chart.designer.other.condition.item.*; +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 class4Correspond() { + return VanChartBubblePlot.class; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionSelectionPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleConditionSelectionPane.java new file mode 100644 index 000000000..0ea9262e6 --- /dev/null +++ b/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 + }; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleInteractivePane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleInteractivePane.java new file mode 100644 index 000000000..62bcb6060 --- /dev/null +++ b/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(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubblePlotPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubblePlotPane.java new file mode 100644 index 000000000..8987a6f9a --- /dev/null +++ b/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 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); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleSeriesPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleSeriesPane.java new file mode 100644 index 000000000..6c9be8ef1 --- /dev/null +++ b/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.base.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 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()); + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleStylePane.java b/designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubbleStylePane.java new file mode 100644 index 000000000..e3e76be69 --- /dev/null +++ b/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 paneList) { + Plot plot = getChart().getPlot(); + + if(((VanChartBubblePlot) plot).isForceBubble()){ + paneList.add(new VanChartForceBubbleLabelPane(VanChartBubbleStylePane.this)); + } else { + super.createVanChartLabelPane(paneList); + } + } + + protected void addVanChartTooltipPane(List paneList){ + Plot plot = getChart().getPlot(); + if(((VanChartBubblePlot) plot).isForceBubble()){ + paneList.add(new VanChartForceBubbleTooltipPane(VanChartBubbleStylePane.this)); + } else { + super.addVanChartTooltipPane(paneList); + } + } + + @Override + protected void addVanChartAreaPane(List 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); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/component/VanChartBubblePane.java b/designer_chart/src/com/fr/plugin/chart/bubble/component/VanChartBubblePane.java new file mode 100644 index 000000000..563341380 --- /dev/null +++ b/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.base.VanChartAttrBubble; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 16/3/31. + * 气泡大小等设置界面 + */ +public class VanChartBubblePane extends BasicBeanPane { + private UISpinner minDiameter; + private UISpinner maxDiameter; + private UIButtonGroup shadow; + private UIButtonGroup displayNegative; + + public VanChartBubblePane(){ + minDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); + maxDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); + shadow = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), + Inter.getLocText("Plugin-ChartF_Close")}); + displayNegative = new UIButtonGroup(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"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/data/VanChartBubblePlotTableDataContentPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/data/VanChartBubblePlotTableDataContentPane.java new file mode 100644 index 000000000..007a1490d --- /dev/null +++ b/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()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartBubbleRefreshTooltipPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartBubbleRefreshTooltipPane.java new file mode 100644 index 000000000..5db33768c --- /dev/null +++ b/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); + } + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaBackgroundPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaBackgroundPane.java new file mode 100644 index 000000000..39e0b57de --- /dev/null +++ b/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}, + }; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleAreaPane.java new file mode 100644 index 000000000..1e5c780f7 --- /dev/null +++ b/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); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleLabelPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleLabelPane.java new file mode 100644 index 000000000..4886c9f1d --- /dev/null +++ b/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); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleTooltipPane.java b/designer_chart/src/com/fr/plugin/chart/bubble/force/VanChartForceBubbleTooltipPane.java new file mode 100644 index 000000000..67f1412aa --- /dev/null +++ b/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); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/images/bubble.png b/designer_chart/src/com/fr/plugin/chart/bubble/images/bubble.png new file mode 100644 index 000000000..86853335d Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bubble/images/bubble.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/images/force.png b/designer_chart/src/com/fr/plugin/chart/bubble/images/force.png new file mode 100644 index 000000000..d6a7304a3 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bubble/images/force.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/bubble/images/large.png b/designer_chart/src/com/fr/plugin/chart/bubble/images/large.png new file mode 100644 index 000000000..d6301bc69 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/bubble/images/large.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/column/ColumnBorderAttriPane.java b/designer_chart/src/com/fr/plugin/chart/column/ColumnBorderAttriPane.java new file mode 100644 index 000000000..a955618fb --- /dev/null +++ b/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"; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/column/ColumnIndependentVanChartInterface.java b/designer_chart/src/com/fr/plugin/chart/column/ColumnIndependentVanChartInterface.java new file mode 100644 index 000000000..04aaa070f --- /dev/null +++ b/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 getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new VanChartColumnSeriesPane(parent, plot); + } + + public String getPlotTypeTitle4PopupWindow(){ + return VanChartColumnPlotPane.TITLE; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnConditionPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnConditionPane.java new file mode 100644 index 000000000..7bec7744b --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnConditionPane.java @@ -0,0 +1,82 @@ +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.AttrDataSheet; +import com.fr.plugin.chart.base.AttrTooltip; +import com.fr.plugin.chart.attr.EffectHelper; +import com.fr.plugin.chart.base.*; +import com.fr.plugin.chart.designer.other.condition.item.*; +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 class4Correspond() { + return VanChartColumnPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnLabelBorderPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnLabelBorderPane.java new file mode 100644 index 000000000..6dc0f3ccd --- /dev/null +++ b/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; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnPlotPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnPlotPane.java new file mode 100644 index 000000000..978823b57 --- /dev/null +++ b/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]; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnSeriesPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartColumnSeriesPane.java new file mode 100644 index 000000000..cb418b163 --- /dev/null +++ b/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 isFixedWidth;//是否固定宽度 + private UISpinner columnWidth;//宽度 + + private UINumberDragPane categoryGap;//分类间隔 + private UINumberDragPane seriesGap;//系列间隔 + private UIButtonGroup 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(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(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); + } + } + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java new file mode 100644 index 000000000..dfb8664e8 --- /dev/null +++ b/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 { + private static final long serialVersionUID = 2713124322060048526L; + + protected UIButtonGroup XAxis; + protected UIButtonGroup YAxis; + protected UIButtonGroup isStacked; + protected UIButtonGroup 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(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); + isPercentStacked = new UIButtonGroup(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(seriesStackAndAxis.getXAxisNamesArray()); + YAxis = new UIButtonGroup(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; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/column/images/column.png b/designer_chart/src/com/fr/plugin/chart/column/images/column.png new file mode 100644 index 000000000..4561cf945 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/column/images/column.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/column/images/custom.png b/designer_chart/src/com/fr/plugin/chart/column/images/custom.png new file mode 100644 index 000000000..6a8c71f8d Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/column/images/custom.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/column/images/percentstack.png b/designer_chart/src/com/fr/plugin/chart/column/images/percentstack.png new file mode 100644 index 000000000..ee380e28e Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/column/images/percentstack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/column/images/stack.png b/designer_chart/src/com/fr/plugin/chart/column/images/stack.png new file mode 100644 index 000000000..ef43ac258 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/column/images/stack.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/CustomIndependentVanChartInterface.java b/designer_chart/src/com/fr/plugin/chart/custom/CustomIndependentVanChartInterface.java new file mode 100644 index 000000000..473cdbce9 --- /dev/null +++ b/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; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/custom/CustomPlotDesignerPaneFactory.java b/designer_chart/src/com/fr/plugin/chart/custom/CustomPlotDesignerPaneFactory.java new file mode 100644 index 000000000..b4f4138a4 --- /dev/null +++ b/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> plotTableDataContentPaneMap = new HashMap, Class>(); + + + + + //图表类型对应的位置面板 + private static Map, Class>> plotPositionMap = new HashMap, Class>>(); + + 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 createCustomPlotPositionPane(Plot plot) { + Class key = plot.getClass(); + if(plotPositionMap.containsKey(key)){ + try{ + Class> cl = plotPositionMap.get(key); + Constructor > 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 key = plot.getClass(); + if(plotTableDataContentPaneMap.containsKey(key)){ + try{ + Class cl = plotTableDataContentPaneMap.get(key); + Constructor 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> diffAxisMap = new HashMap>(); + 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 cl = diffAxisMap.get(key); + if(cl != null) { + Constructor 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); + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomDataPane.java b/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomDataPane.java new file mode 100644 index 000000000..73a95537a --- /dev/null +++ b/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); + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotDataContentsTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotDataContentsTabPane.java new file mode 100644 index 000000000..f3c91a3a7 --- /dev/null +++ b/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 { + public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) { + super(plot, parent, listener); + } + + @Override + protected void initTabTitle() { + + if (plot == null){ + return; + } + + List 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 initPaneList() { + + if (plot == null){ + return null; + } + + List paneList = new ArrayList(); + + List 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 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 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 definitionMap = new HashMap(); + + //已经有的数据配置不允许重置 + + 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); + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java b/designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java new file mode 100644 index 000000000..94be28fd2 --- /dev/null +++ b/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 definitionMap = definition.getDefinitionProviderMap(); + + if (definitionMap == null){ + return; + } + + Map newDefinitionMap = new HashMap(); + + 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); + } + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/CategoryCustomPlotTableDataContentPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/CategoryCustomPlotTableDataContentPane.java new file mode 100644 index 000000000..ac1b05538 --- /dev/null +++ b/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); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/ChartImageCheckOutPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/ChartImageCheckOutPane.java new file mode 100644 index 000000000..fc36decc9 --- /dev/null +++ b/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 changeListeners = new ArrayList(); + + 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; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/CustomPlotLocationPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/CustomPlotLocationPane.java new file mode 100644 index 000000000..b3bd29de8 --- /dev/null +++ b/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{ + 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; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotReportDataContentPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotReportDataContentPane.java new file mode 100644 index 000000000..ec45eaf2a --- /dev/null +++ b/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()); + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotTableDataContentPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/MeterCustomPlotTableDataContentPane.java new file mode 100644 index 000000000..efece3b85 --- /dev/null +++ b/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(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAreaBackgroundPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAreaBackgroundPane.java new file mode 100644 index 000000000..65241fc0b --- /dev/null +++ b/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(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAxisConditionPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomAxisConditionPane.java new file mode 100644 index 000000000..daa479a2a --- /dev/null +++ b/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); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotAxisPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotAxisPane.java new file mode 100644 index 000000000..4b274e56e --- /dev/null +++ b/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 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); + } + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotSelectPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotSelectPane.java new file mode 100644 index 000000000..02761a195 --- /dev/null +++ b/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 { + + 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 customTypeList = new ArrayList(); + + //该列表记录上次每个checkout的状态 + private List oldSelectedList; + + //保存点击的checkout顺序 + private List selectedPlotTypeList = new ArrayList(); + + //将所有面板排布后的面板 + private JPanel content; + + + public VanChartCustomPlotSelectPane(){ + initCustomType(); + } + + private void initCustomType() { + + initAllCheckOutPane(); + + initContentPane(); + + updateOldSelectedList(); + + addCheckBoxListener(); + + checkoutSelected(); + } + + private void updateOldSelectedList() { + oldSelectedList = new ArrayList(); + 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(); + + List 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 customPlotList = customPlot.getCustomPlotList(); + + oldSelectedList = new ArrayList(); + + 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 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 newCustomPlotList = new ArrayList(); + List 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 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 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); + } + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotTabPane.java new file mode 100644 index 000000000..755441d94 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotTabPane.java @@ -0,0 +1,81 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.style.legend.AutoSelectedPane; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.designer.component.VanChartPlotMultiTabPane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/22. + */ +public abstract class VanChartCustomPlotTabPane extends VanChartPlotMultiTabPane { + private static final long serialVersionUID = 8633385688766835241L; + + public VanChartCustomPlotTabPane(E plot, BasicPane parent) { + this(plot, parent, null); + } + + public VanChartCustomPlotTabPane(E plot, BasicPane parent, AttributeChangeListener listener) { + super(plot, parent, listener); + } + + protected abstract void initTabTitle(); + + @Override + protected void initLayout() { + JPanel tabPanel = new JPanel(new BorderLayout()); + tabPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, getBackground())); + tabPanel.add(tabPane, BorderLayout.CENTER); + this.setLayout(new BorderLayout(0, 6)); + this.add(tabPanel, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } + + /** + * 设置选中的界面id + */ + public void setSelectedByIds(int level, String... id) { + tabPane.setSelectedIndex(-1); + for (int i = 0; i < paneList.size(); i++) { + if (ComparatorUtils.equals(id[level], NameArray[i])) { + tabPane.setSelectedIndex(i); + tabPane.tabChanged(i); + if (id.length >= level + 2) { + ((AutoSelectedPane)paneList.get(i)).setSelectedIndex(id[level + 1]); + } + break; + } + } + } + + @Override + public void relayoutWhenListChange() { + centerPane = new JPanel(cardLayout) { + @Override + public Dimension getPreferredSize() { + if (tabPane.getSelectedIndex() == -1) { + return super.getPreferredSize(); + } else { + return paneList.get(tabPane.getSelectedIndex()).getPreferredSize(); + } + } + }; + + //获取tab的标题 + initTabTitle(); + + tabPane = new VanChartCustomPlotUITabGroup(NameArray) { + @Override + public void tabChanged(int index) { + dealWithTabChanged(index); + } + }; + tabPane.setSelectedIndex(0); + tabPane.tabChanged(0); + initLayout(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotUITabGroup.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotUITabGroup.java new file mode 100644 index 000000000..3819b76b2 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotUITabGroup.java @@ -0,0 +1,130 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UITabGroup; +import com.fr.design.gui.ibutton.UIToggleButton; + +import javax.swing.*; +import javax.swing.border.Border; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/21. + */ +public class VanChartCustomPlotUITabGroup extends UITabGroup{ + + private static final int WIDTH = 198; + private static final int BUTTON_HEIGHT = 30; + private int listNum = 0; + + public VanChartCustomPlotUITabGroup(Icon[] iconArray) { + super(iconArray); + } + + public VanChartCustomPlotUITabGroup(String[] textArray) { + super(textArray); + } + + @Override + protected LayoutManager getGridLayout(int number) { + //这个地方可以顺便获取list个数 + listNum = number; + return new GridBagLayout(); + } + + @Override + protected void paintBorder(Graphics g) { + Border border = getBorder(); + if (border != null) { + border.paintBorder(this, g, 0, 0, getWidth(), getHeight()); + } + } + + @Override + protected Border getGroupBorder() { + return BorderFactory.createEmptyBorder(1, 1, 1, 1); + } + + @Override + protected void initButton(UIToggleButton labelButton) { + + int ButtonWidth = WIDTH / 3; + if (listNum <= 1){ + return; + }else if (listNum == 2){ + ButtonWidth = WIDTH / 2; + } + + //将button加入到pane中,以便可以对边框进行控制 + labelButton.setRoundBorder(false); + labelButton.setBorderPainted(false); + + + + labelButtonList.add(labelButton); + + int index = labelButtonList.size() - 1; + + JPanel panel = getButtonPanel(labelButton, index); + + GridBagConstraints constraints=new GridBagConstraints(); + + int end = listNum % 3; + + if (end == 1 && index == 0){ + constraints.gridy = 0; + constraints.gridx = 0; + constraints.gridheight = 1; + constraints.gridwidth = 6; + ButtonWidth = WIDTH + 2; + }else if (end == 2 && (index == 0 || index == 1) && listNum != 2){ + constraints.gridy = 0; + constraints.gridx = index == 1 ? 4 : 0; + constraints.gridheight = 1; + constraints.gridwidth = index == 0 ? 4 : 2; + ButtonWidth = index == 0 ? ButtonWidth * 2 + 1 : ButtonWidth; + }else { + int l = ((index + ((end == 0) ? end : (3 - end))) / 3); + constraints.gridy = l; + constraints.gridx = ((index - (l * 3 - (end == 0 ? end : 3 - end))))*2; + constraints.gridheight = 1; + constraints.gridwidth = 2; + } + labelButton.setPreferredSize(new Dimension(ButtonWidth, BUTTON_HEIGHT)); + + this.add(panel, constraints); + } + + private JPanel getButtonPanel(UIToggleButton labelButton, int index) { + JPanel panel = new JPanel(); + panel.setLayout(new BorderLayout()); + panel.add(labelButton,BorderLayout.CENTER); + + setPanelBorder(panel, index); + + return panel; + } + + public void setPanelBorder(JPanel panel, int index) { + int end = listNum % 3; + int num = listNum; + + //调整index + if (end == 1 && index != 0){ + index += 2; + num += 2; + }else if (end == 2 && index != 0 && index != 1){ + index += 1; + num += 1; + } + boolean isRightLine = (index+1) % 3 == 0 ? true : false; + isRightLine = (end == 2 && index == 1) ? true : isRightLine; + isRightLine = (end == 1 && index == 0) ? true : isRightLine; + //是否画下边线 + int row = index / 3; + int column = index % 3; + boolean isBottomLine = ((row+1)*3 + column < num) ? false : true; + + panel.setBorder(BorderFactory.createMatteBorder(1, 1, isBottomLine ? 1 : 0, isRightLine ? 1 : 0, UIConstants.LINE_COLOR)); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartDataPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartDataPane.java new file mode 100644 index 000000000..cd0c72938 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartDataPane.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; + +import javax.swing.*; + +/** + * Created by Fangjie on 2016/5/18. + */ +public class VanChartDataPane extends ChartDataPane { + + public VanChartDataPane(AttributeChangeListener listener) { + super(listener); + } + + @Override + protected JPanel createContentPane() { + contentsPane = new NormalChartDataPane(listener, VanChartDataPane.this); + return contentsPane; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java new file mode 100644 index 000000000..9f41e7b86 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java @@ -0,0 +1,133 @@ +package com.fr.plugin.chart.custom.component; + +import com.fr.chart.chartattr.Plot; +import com.fr.chart.web.ChartHyperPoplink; +import com.fr.chart.web.ChartHyperRelateCellLink; +import com.fr.chart.web.ChartHyperRelateFloatLink; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.javascript.ChartEmailPane; +import com.fr.design.fun.HyperlinkProvider; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.frpane.UICorrelationComboBoxPane; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.general.Inter; +import com.fr.js.*; +import com.fr.plugin.chart.designer.other.HyperlinkMapFactory; +import com.fr.stable.bridge.StableFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Set; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartHyperLinkPane extends UICorrelationComboBoxPane { + + public VanChartHyperLinkPane() { + super(); + } + + public void populate(Plot plot) { + HashMap paneMap = getHyperlinkMap(plot); + + //安装平台内打开插件时,添加相应按钮 + Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); + for (HyperlinkProvider provider : providers) { + NameableCreator nc = provider.createHyperlinkCreator(); + //todo@shine9.0 + // paneMap.put(nc.getHyperlink(), nc.getUpdatePane()); + } + + java.util.List list = refreshList(paneMap); + refreshMenuAndAddMenuAction(list); + + java.util.List hyperList = new ArrayList(); + NameJavaScriptGroup nameGroup = populateHotHyperLink(plot); + for(int i = 0; nameGroup != null && i < nameGroup.size(); i++) { + NameJavaScript javaScript = nameGroup.getNameHyperlink(i); + if(javaScript != null && javaScript.getJavaScript() != null) { + JavaScript script = javaScript.getJavaScript(); + hyperList.add(new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass()))); + } + } + + populateBean(hyperList); + doLayout(); + } + + protected NameJavaScriptGroup populateHotHyperLink(Plot plot) { + return plot.getHotHyperLink(); + } + + protected HashMap getHyperlinkMap(Plot plot){ + return HyperlinkMapFactory.getHyperlinkMap(plot); + } + + public void update(Plot plot) { + + NameJavaScriptGroup nameGroup = updateNameGroup(); + + updateHotHyperLink(plot, nameGroup); + } + + protected void updateHotHyperLink(Plot plot, NameJavaScriptGroup nameGroup) { + plot.setHotHyperLink(nameGroup); + } + + private NameJavaScriptGroup updateNameGroup() { + NameJavaScriptGroup nameGroup = new NameJavaScriptGroup(); + nameGroup.clear(); + + resetItemName(); + java.util.List list = updateBean(); + for(int i = 0; i < list.size(); i++) { + UIMenuNameableCreator menu = (UIMenuNameableCreator)list.get(i); + NameJavaScript nameJava = new NameJavaScript(menu.getName(), (JavaScript)menu.getObj()); + nameGroup.addNameHyperlink(nameJava); + } + + return nameGroup; + } + + + protected java.util.List refreshList(HashMap map) { + java.util.List list = new ArrayList(); + + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Reportlet"), + new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class))); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Mail"), new EmailJavaScript(), ChartEmailPane.class)); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Web"), + new WebHyperlink(), getUseMap(map, WebHyperlink.class))); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Dynamic_Parameters"), + new ParameterJavaScript(), getUseMap(map, ParameterJavaScript.class))); + list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); + + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Float_Chart"), + new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class))); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Cell"), + new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class))); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Float"), + new ChartHyperRelateFloatLink(), getUseMap(map, ChartHyperRelateFloatLink.class))); + + FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Form"), + hyperlink, getUseMap(map, FormHyperlinkProvider.class))); + + return list; + } + + protected Class getUseMap(HashMap map, Object key) { + if(map.get(key) != null){ + return (Class)map.get(key); + } + //引擎在这边放了个provider,当前表单对象 + for(Object tempKey : map.keySet()){ + if(((Class)tempKey).isAssignableFrom((Class)key)){ + return (Class)map.get(tempKey); + } + } + return null; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/column_area.png b/designer_chart/src/com/fr/plugin/chart/custom/images/column_area.png new file mode 100644 index 000000000..34a2c08c8 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/column_area.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/column_line.png b/designer_chart/src/com/fr/plugin/chart/custom/images/column_line.png new file mode 100644 index 000000000..8994612e0 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/column_line.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom.png new file mode 100644 index 000000000..2d272307c Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/area.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/area.png new file mode 100644 index 000000000..35fa7d218 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/area.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/bubble.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/bubble.png new file mode 100644 index 000000000..b75e78bb5 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/bubble.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/column.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/column.png new file mode 100644 index 000000000..73fe7be52 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/column.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/cuvette.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/cuvette.png new file mode 100644 index 000000000..680f9ed18 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/cuvette.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/different_pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/different_pie.png new file mode 100644 index 000000000..68d759c11 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/different_pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/line.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/line.png new file mode 100644 index 000000000..c51809554 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/line.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pie.png new file mode 100644 index 000000000..6afa8095e Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_180.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_180.png new file mode 100644 index 000000000..b20420280 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_180.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_360.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_360.png new file mode 100644 index 000000000..d4058631f Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/pointer_360.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/radar.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/radar.png new file mode 100644 index 000000000..391e2f0d5 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/radar.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/ring.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/ring.png new file mode 100644 index 000000000..f3bf1b31d Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/ring.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/same_pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/same_pie.png new file mode 100644 index 000000000..3a1485fb5 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/same_pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/scatter.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/scatter.png new file mode 100644 index 000000000..ef86df32b Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/scatter.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/area.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/area.png new file mode 100644 index 000000000..2fac0316b Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/area.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/bubble.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/bubble.png new file mode 100644 index 000000000..93f559ffd Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/bubble.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/column.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/column.png new file mode 100644 index 000000000..6481b4de1 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/column.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/cuvette.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/cuvette.png new file mode 100644 index 000000000..57847bc24 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/cuvette.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/different_pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/different_pie.png new file mode 100644 index 000000000..aec730039 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/different_pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/line.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/line.png new file mode 100644 index 000000000..4d84cf204 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/line.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pie.png new file mode 100644 index 000000000..52c6051d4 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_180.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_180.png new file mode 100644 index 000000000..2c9cc9133 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_180.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_360.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_360.png new file mode 100644 index 000000000..db13dc1a2 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/pointer_360.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/radar.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/radar.png new file mode 100644 index 000000000..8d52d5f26 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/radar.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/ring.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/ring.png new file mode 100644 index 000000000..88a25aa89 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/ring.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/same_pie.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/same_pie.png new file mode 100644 index 000000000..b5a159896 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/same_pie.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/scatter.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/scatter.png new file mode 100644 index 000000000..2a7ded617 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/scatter.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/slot.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/slot.png new file mode 100644 index 000000000..920cf6cc0 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/slot.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/stack_radar.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/stack_radar.png new file mode 100644 index 000000000..b2e5a108e Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/selected/stack_radar.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/slot.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/slot.png new file mode 100644 index 000000000..bb44ca513 Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/slot.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/stack_radar.png b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/stack_radar.png new file mode 100644 index 000000000..4019b360a Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/custom/icon/stack_radar.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/images/stack_column_line.png b/designer_chart/src/com/fr/plugin/chart/custom/images/stack_column_line.png new file mode 100644 index 000000000..adc50348a Binary files /dev/null and b/designer_chart/src/com/fr/plugin/chart/custom/images/stack_column_line.png differ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomConditionAttrPane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomConditionAttrPane.java new file mode 100644 index 000000000..abbc5133d --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomConditionAttrPane.java @@ -0,0 +1,71 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.general.Inter; +import com.fr.plugin.chart.custom.VanChartCustomPlot; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomConditionAttrPane extends BasicScrollPane { + private VanChartCustomPlotConditionAttrTabPane conditionAttrPane; + private Chart chart; + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initConditionAttrPane((VanChartCustomPlot) chart.getPlot()); + if(conditionAttrPane != null) { + contentPane.add(conditionAttrPane, BorderLayout.CENTER); + } + return contentPane; + } + + private void initConditionAttrPane(VanChartCustomPlot plot) { + conditionAttrPane = new VanChartCustomPlotConditionAttrTabPane(plot, null); + } + + @Override + public void populateBean(Chart chart) { + this.chart = chart; + if(conditionAttrPane == null) { + this.remove(leftcontentPane); + layoutContentPane(); + } + if(conditionAttrPane != null) { + conditionAttrPane.populateBean((VanChartCustomPlot)chart.getPlot()); + } + } + + @Override + public void updateBean(Chart chart) { + + if (chart == null){ + return; + } + + if (conditionAttrPane != null) { + conditionAttrPane.updateBean((VanChartCustomPlot) chart.getPlot()); + } + } + + /** + * 是否显示滚动条 + * @return + */ + @Override + protected boolean isShowScrollBar() { + return false; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Chart-Condition_Display"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomInteractivePane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomInteractivePane.java new file mode 100644 index 000000000..c4ed1ec2d --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomInteractivePane.java @@ -0,0 +1,56 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.chart.chartattr.Plot; +import com.fr.general.Inter; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.type.CustomStyle; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; +import com.fr.plugin.chart.designer.other.AutoRefreshPane; +import com.fr.plugin.chart.designer.other.AutoRefreshPaneWithoutTooltip; +import com.fr.plugin.chart.designer.other.VanChartInteractivePane; +import com.fr.plugin.chart.vanchart.VanChart; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomInteractivePane extends VanChartInteractivePane { + + private VanChartCustomPlotHyperlinkPane hyperlinkPane; + + /** + * 组合图无排序按钮 + * @return + */ + @Override + protected Component[][] createToolBarComponents() { + return createToolBarComponentsWithOutSort(); + } + + protected JPanel createHyperlinkPane() { + hyperlinkPane = new VanChartCustomPlotHyperlinkPane(); + return TableLayout4VanChartHelper.createTitlePane(Inter.getLocText("M_Insert-Hyperlink"), hyperlinkPane, 0); + } + + @Override + protected void populateHyperlink(Plot plot) { + hyperlinkPane.populateBean(chart); + } + + @Override + protected void updateHyperlink(Plot plot){ + hyperlinkPane.updateBean(chart); + } + + protected AutoRefreshPane getMoreLabelPane(VanChartPlot plot) { + boolean isLargeModel = largeModel(plot); + //自定义组合图不支持自动数据点提示 + if (((VanChartCustomPlot)plot).getCustomStyle().equals(CustomStyle.CUSTOM)) { + return new AutoRefreshPaneWithoutTooltip((VanChart) chart, isLargeModel); + } + return new AutoRefreshPane((VanChart) chart, isLargeModel); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomOtherPane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomOtherPane.java new file mode 100644 index 000000000..753869058 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomOtherPane.java @@ -0,0 +1,19 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.beans.BasicBeanPane; +import com.fr.plugin.chart.designer.other.VanChartOtherPane; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomOtherPane extends VanChartOtherPane { + protected BasicBeanPane createInteractivePane() { + return new VanChartCustomInteractivePane(); + } + + @Override + protected BasicBeanPane createConditionAttrPane() { + return new VanChartCustomConditionAttrPane(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java new file mode 100644 index 000000000..18285dfd1 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java @@ -0,0 +1,112 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.design.dialog.BasicPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.designer.other.VanChartConditionAttrPane; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotConditionAttrTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected void initTabTitle() { + List customPlotList = plot.getCustomPlotList(); + NameArray = new String[paneList.size()]; + for (int i = 0, j = 0 ; i < paneList.size() && j < customPlotList.size(); i++, j++) { + if (customPlotList.get(j).isSupportDataSeriesCondition()) { + JPanel pane = paneList.get(i); + //获取点的tooltip作为标题 + VanChartPlot vanChartPlot = customPlotList.get(j); + + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + NameArray[i] = CustomPlotFactory.getTitle(plotType); + centerPane.add(pane, NameArray[i]); + }else { + //如果不支持,则i不动 + i -- ; + } + } + } + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + if (customPlotList.get(i).isSupportDataSeriesCondition()) { + //根据不同的plot创建不同的数据配置界面 + VanChartConditionAttrPane contentPane = new VanChartConditionAttrPane(); + + paneList.add(contentPane); + } + } + + return paneList; + } + + @Override + public void populateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0, j = 0 ; i < paneList.size() && j < customPlotList.size(); i++, j++){ + if (customPlotList.get(j).isSupportDataSeriesCondition()) { + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(j); + + ((VanChartConditionAttrPane) paneList.get(i)).populateBean(vanChartPlot); + }else { + i -- ; + } + } + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0, j = 0; i < paneList.size() && j < customPlotList.size(); i++, j++){ + if (customPlotList.get(j).isSupportDataSeriesCondition()) { + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(j); + + VanChartConditionAttrPane conditionPane = (VanChartConditionAttrPane) paneList.get(i); + + conditionPane.updateBean(vanChartPlot); + }else { + i --; + } + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkPane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkPane.java new file mode 100644 index 000000000..56f5bff18 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkPane.java @@ -0,0 +1,66 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.plugin.chart.custom.VanChartCustomPlot; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomPlotHyperlinkPane extends BasicScrollPane { + private VanChartCustomPlotHyperlinkTabPane linkPane; + protected Chart chart; + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initLinkPane((VanChartCustomPlot) chart.getPlot()); + if(linkPane != null) { + contentPane.add(linkPane, BorderLayout.CENTER); + } + return contentPane; + } + + private void initLinkPane(VanChartCustomPlot plot) { + linkPane = new VanChartCustomPlotHyperlinkTabPane(plot, null); + } + + @Override + public void populateBean(Chart chart) { + this.chart = chart; + if(linkPane == null) { + this.remove(leftcontentPane); + layoutContentPane(); + } + if(linkPane != null) { + linkPane.populateBean((VanChartCustomPlot)chart.getPlot()); + } + } + + @Override + public void updateBean(Chart chart) { + this.chart = chart; + + if(linkPane != null) { + linkPane.updateBean((VanChartCustomPlot) chart.getPlot()); + } + } + + @Override + protected void layoutContentPane() { + leftcontentPane = createContentPane(); + leftcontentPane.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); + this.setLayout(new BorderLayout()); + this.add(leftcontentPane, BorderLayout.CENTER); + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkTabPane.java new file mode 100644 index 000000000..073a84520 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomPlotHyperlinkTabPane.java @@ -0,0 +1,93 @@ +package com.fr.plugin.chart.custom.other; + +import com.fr.design.dialog.BasicPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.component.VanChartHyperLinkPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/28. + */ +public class VanChartCustomPlotHyperlinkTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotHyperlinkTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected void initTabTitle() { + List 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); + String name = CustomPlotFactory.getTitle(plotType); + NameArray[i] = name.length() > 3 ? name.substring(0, 3) : name; + centerPane.add(pane, NameArray[i]); + } + } + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plot创建不同的数据配置界面 + VanChartHyperLinkPane contentPane = new VanChartHyperLinkPane(); + + paneList.add(contentPane); + } + + return paneList; + } + + @Override + public void populateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + ((VanChartHyperLinkPane)paneList.get(i)).populate(vanChartPlot); + } + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + ((VanChartHyperLinkPane)paneList.get(i)).update(vanChartPlot); + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAreaPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAreaPane.java new file mode 100644 index 000000000..61c99cd40 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAreaPane.java @@ -0,0 +1,21 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.plugin.chart.custom.component.VanChartCustomAreaBackgroundPane; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.background.VanChartAreaPane; + +/** + * Created by Fangjie on 2016/5/19. + */ +public class VanChartCustomAreaPane extends VanChartAreaPane { + public VanChartCustomAreaPane(Plot plot, VanChartStylePane parent) { + super(plot, parent); + } + + @Override + protected void initPlotPane(boolean b, AbstractAttrNoScrollPane parent) { + plotPane = new VanChartCustomAreaBackgroundPane(true, parent); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisAreaPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisAreaPane.java new file mode 100644 index 000000000..64554aa53 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisAreaPane.java @@ -0,0 +1,54 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Plot; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.designer.style.background.VanChartAxisAreaPane; + +import java.util.List; + + +/** + * Created by Fangjie on 2016/5/19. + */ +public class VanChartCustomAxisAreaPane extends VanChartAxisAreaPane { + + + @Override + public void updateBean(Plot plot){ + VanChartCustomPlot customPlot = (VanChartCustomPlot)plot; + + super.updateBean(customPlot); + + List vanChartPlotList = customPlot.getCustomPlotList(); + + //更新后同步坐标轴 + CustomPlotFactory.axisSynchronization(customPlot); + + //使用其他坐标轴的图形 + for (int i = 0; i < vanChartPlotList.size(); i++){ + if (vanChartPlotList.get(i).isSupportPlotBackground() && CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlotList.get(i))){ + super.updateBean(vanChartPlotList.get(i)); + } + } + } + + + public void populateBean(Plot plot){ + VanChartCustomPlot customPlot = (VanChartCustomPlot)plot; + + if (customPlot.isHaveStandardAxis()){ + super.populateBean(customPlot); + } else { + List vanChartPlotList = customPlot.getCustomPlotList(); + //使用其他坐標軸的圖形 + for (int i = 0; i < vanChartPlotList.size(); i++) { + if (vanChartPlotList.get(i).isSupportPlotBackground() && CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlotList.get(i))) { + super.populateBean(vanChartPlotList.get(i)); + } + } + } + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisPane.java new file mode 100644 index 000000000..b7e226d62 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisPane.java @@ -0,0 +1,84 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.vanchart.VanChart; + +import javax.swing.*; +import java.awt.*; + + +/** + * Created by Fangjie on 2016/4/27. + */ +public class VanChartCustomAxisPane extends BasicScrollPane { + private static final long serialVersionUID = -2974722365840564105L; + private VanChartCustomAxisTabPane axisPane; + private Chart chart; + protected VanChartStylePane parent; + + public VanChartCustomAxisPane(VanChartStylePane parent) { + super(); + this.parent = parent; + } + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initAxisPane((VanChartCustomPlot) chart.getPlot()); + contentPane.add(axisPane, BorderLayout.CENTER); + return contentPane; + } + + private void initAxisPane(VanChartCustomPlot plot) { + axisPane = new VanChartCustomAxisTabPane(plot, parent); + } + + @Override + public void populateBean(Chart chart) { + this.chart = chart; + + if(axisPane == null){ + this.remove(leftcontentPane); + layoutContentPane(); + parent.initAllListeners(); + } + + if(axisPane != null) { + axisPane.populateBean((VanChartCustomPlot) chart.getPlot()); + } + } + + @Override + public void updateBean(Chart chart){ + if(chart == null){ + return; + } + VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); + axisPane.updateBean(plot); + } + + @Override + protected void layoutContentPane() { + leftcontentPane = createContentPane(); + leftcontentPane.setBorder(BorderFactory.createEmptyBorder()); + this.setLayout(new BorderLayout()); + this.add(leftcontentPane, BorderLayout.CENTER); + } + + @Override + public VanChart updateBean() { + return null; + } + + @Override + protected String title4PopupWindow() { + return PaneTitleConstants.CHART_STYLE_AXIS_TITLE; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisTabPane.java new file mode 100644 index 000000000..8fc7a774c --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisTabPane.java @@ -0,0 +1,156 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.design.dialog.BasicPane; +import com.fr.general.Inter; +import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotAxisPane; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane; +import com.fr.plugin.chart.vanchart.VanChart; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/27. + */ +public class VanChartCustomAxisTabPane extends VanChartCustomPlotTabPane { + + public VanChartCustomAxisTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + VanChartCustomPlot customPlot = plot; + + List customPlotList = customPlot.getCustomPlotList(); + + /** + * 判断是否有使用标准坐标轴的点 + */ + ArrayList plotOrder = customPlot.getDiffAxisOrder(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plotOrder创建不同的数据配置界面 + if (plotOrder.contains(i)) { + VanChartAxisPane contentPane = CustomPlotDesignerPaneFactory.createAxisPane((VanChartAxisPlot) customPlotList.get(i), (VanChartStylePane) parent); + paneList.add(contentPane); + } + } + + //判断是否使用标准坐标轴系,标准坐标系即使用customPlot的坐标轴属性,如果有,放在最后 + if (customPlot.isHaveStandardAxis()){ + VanChartAxisPane contentPane = new VanChartCustomPlotAxisPane(customPlot, (VanChartStylePane) parent); + paneList.add(contentPane); + } + + return paneList; + } + + @Override + protected void initTabTitle(){ + VanChartCustomPlot customPlot = plot; + List customPlotList = customPlot.getCustomPlotList(); + ArrayList plotOrder = customPlot.getDiffAxisOrder(); + + NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; + + + for (int i = 0;i < paneList.size() && i < plotOrder.size(); i++) { + JPanel pane = paneList.get(i); + + VanChartPlot vanChartPlot = customPlotList.get(plotOrder.get(i)); + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + + NameArray[i] = CustomPlotFactory.getTitle(plotType); + centerPane.add(pane, NameArray[i]); + } + + //如果有标准坐标系,则放在最后一个tab按钮上 + if (customPlot.isHaveStandardAxis()){ + JPanel pane = paneList.get(paneList.size() - 1); + + //获取点的tooltip作为标题 + NameArray[paneList.size() - 1] = Inter.getLocText("Plugin-ChartF_Rectangular_Coordinate_System"); + centerPane.add(pane, NameArray[paneList.size() - 1]); + } + } + + @Override + /** + * 标准坐标轴属性存在最外层的customPlot的坐标轴变量中 + * 不使用标准坐标轴的坐标轴属性存在相应的plot中的坐标轴变量中 + */ + public void populateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + + ArrayList plotOrder = plot.getDiffAxisOrder(); + + for (int i = 0; i < paneList.size() && i < plotOrder.size(); i++){ + //先更新标准坐标轴界面 + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(plotOrder.get(i)); + ((VanChartAxisPane)paneList.get(i)).populateBean(vanChartPlot); + } + + if (plot.isHaveStandardAxis()){ + ((VanChartAxisPane)paneList.get(paneList.size() - 1)).populateBean(plot); + + } + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + VanChartCustomPlot customPlot = plot; + List customPlotList = customPlot.getCustomPlotList(); + + ArrayList plotOrder = customPlot.getDiffAxisOrder(); + + for (int i = 0; i < paneList.size() && i < plotOrder.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(plotOrder.get(i)); + ((VanChartAxisPane)paneList.get(i)).updateBean(vanChartPlot); + } + + if (customPlot.isHaveStandardAxis()){ + //用VanChart包裝plot + VanChart chart = new VanChart(); + chart.setPlot(customPlot); + ((VanChartAxisPane)paneList.get(paneList.size() - 1)).updateBean(chart); + + } + + //将标准坐标轴属性存入使用标准坐标轴的点的坐标轴变量中 + CustomPlotFactory.axisSynchronization(plot); + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomLabelPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomLabelPane.java new file mode 100644 index 000000000..1fc0affd5 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomLabelPane.java @@ -0,0 +1,73 @@ +package com.fr.plugin.chart.custom.style; + + +import com.fr.chart.chartattr.Chart; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; + +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomLabelPane extends BasicScrollPane { + private VanChartCustomPlotLabelTabPane labelPane; + private Chart chart; + protected VanChartStylePane parent; + private static final long serialVersionUID = -5449293740965811991L; + + public VanChartCustomLabelPane(VanChartStylePane parent) { + super(); + this.parent = parent; + } + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initLabelPane((VanChartCustomPlot) chart.getPlot()); + + contentPane.add(labelPane, BorderLayout.NORTH); + return contentPane; + } + + private void initLabelPane(VanChartCustomPlot plot) { + labelPane = new VanChartCustomPlotLabelTabPane(plot, parent); + } + + @Override + public void populateBean(Chart chart) { + this.chart = chart; + + if(labelPane == null){ + this.remove(leftcontentPane); + layoutContentPane(); + parent.initAllListeners(); + } + + if(labelPane != null) { + labelPane.populateBean((VanChartCustomPlot)chart.getPlot()); + } + } + + + @Override + public void updateBean(Chart chart) { + if(chart == null) { + return; + } + + labelPane.updateBean((VanChartCustomPlot)chart.getPlot()); + } + + @Override + protected String title4PopupWindow() { + return PaneTitleConstants.CHART_STYLE_LABEL_TITLE; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotLabelTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotLabelTabPane.java new file mode 100644 index 000000000..15cba4ff7 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotLabelTabPane.java @@ -0,0 +1,115 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.base.DataSeriesCondition; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.dialog.BasicPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.base.AttrLabel; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.designer.PlotFactory; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomPlotLabelTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotLabelTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected void initTabTitle() { + List 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 initPaneList() { + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plot创建不同的数据配置界面 + VanChartPlotLabelPane contentPane = PlotFactory.createPlotLabelPane(customPlotList.get(i), (VanChartStylePane) parent); + + paneList.add(contentPane); + } + + return paneList; + } + + @Override + public void populateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + DataSeriesCondition attr = vanChartPlot.getAttrLabelFromConditionCollection(); + ((VanChartPlotLabelPane)paneList.get(i)).populate((AttrLabel) attr); + } + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + + if (plot == null){ + return; + } + + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) { + ConditionAttr attrList = customPlotList.get(i).getConditionCollection().getDefaultAttr(); + DataSeriesCondition attr = customPlotList.get(i).getAttrLabelFromConditionCollection(); + if (attr != null) { + attrList.remove(attr); + } + + VanChartPlotLabelPane labelPane = (VanChartPlotLabelPane) paneList.get(i); + AttrLabel attrLabel = labelPane.update(); + + if (attrLabel != null) { + attrList.addDataSeriesCondition(attrLabel); + } + + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesPane.java new file mode 100644 index 000000000..767bb27ab --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesPane.java @@ -0,0 +1,84 @@ +package com.fr.plugin.chart.custom.style; + +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.style.series.AbstractPlotSeriesPane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/26. + */ +public class VanChartCustomPlotSeriesPane extends BasicBeanPane { + private static final int WIDTH = 210; + private static final int DELTA_HEIGHT = 300; + private BasicBeanPane axisPane; + private AbstractPlotSeriesPane seriesPane; + public VanChartCustomPlotSeriesPane(BasicBeanPane axisPane, AbstractPlotSeriesPane seriesPane) { + this.axisPane = axisPane; + this.seriesPane = seriesPane; + + initContentPane(); + } + + private void initContentPane() { + + seriesPane.setPreferredSize(new Dimension(WIDTH, (int) (seriesPane.getPreferredSize().getHeight() + DELTA_HEIGHT))); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double[] columnSize = {f}; + double[] rowSize = {p, p, p}; + + if (axisPane == null) { + this.add(seriesPane); + }else { + Component[][] components = new Component[][]{ + new Component[]{axisPane}, + new Component[]{new JSeparator()}, + new Component[]{seriesPane} + }; + this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize)); + } + + } + + + @Override + protected String title4PopupWindow() { + return null; + } + + @Override + public void populateBean(Plot plot) { + //获取位置信息 + if (axisPane != null) { + axisPane.populateBean(plot); + } + //获取界面信息 + seriesPane.populateBean(plot); + } + + @Override + public void updateBean(Plot plot) { + if(plot == null) { + return; + } + if(seriesPane != null) { + seriesPane.updateBean(plot); + } + if (axisPane != null){ + axisPane.updateBean(plot); + } + } + + @Override + public Plot updateBean() { + return null; + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesTabPane.java new file mode 100644 index 000000000..5171f0be2 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotSeriesTabPane.java @@ -0,0 +1,116 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.BasicPane; +import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomPlotSeriesTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotSeriesTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected void initTabTitle() { + List 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 initPaneList() { + /** + * 獲取不同plot的系列面板 + */ + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plot创建不同的数据配置界面 + AbstractPlotSeriesPane seriesPane = (AbstractPlotSeriesPane) ChartTypeInterfaceManager.getInstance().getPlotSeriesPane((VanChartStylePane)parent, customPlotList.get(i)); + //根据不同的plot获取不同的控制控制位置界面,从Factory中获取 + BasicBeanPane plotPositionPane = CustomPlotDesignerPaneFactory.createCustomPlotPositionPane(customPlotList.get(i)); + + VanChartCustomPlotSeriesPane contentPane = new VanChartCustomPlotSeriesPane(plotPositionPane, seriesPane); + + paneList.add(contentPane); + } + + return paneList; + } + + @Override + public void populateBean(VanChartCustomPlot plot) { + /** + * 更新各个点的系列界面 + */ + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + + ((VanChartCustomPlotSeriesPane)paneList.get(i)).populateBean(vanChartPlot); + } + + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + /** + * 更新每个图表的数据 + */ + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + + VanChartCustomPlotSeriesPane plotSeriesPane = (VanChartCustomPlotSeriesPane) paneList.get(i); + + plotSeriesPane.updateBean(vanChartPlot); + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotTooltipTabPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotTooltipTabPane.java new file mode 100644 index 000000000..09bdddb9f --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotTooltipTabPane.java @@ -0,0 +1,118 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.base.DataSeriesCondition; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.dialog.BasicPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.base.AttrTooltip; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.designer.PlotFactory; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane; +import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltip; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomPlotTooltipTabPane extends VanChartCustomPlotTabPane { + public VanChartCustomPlotTooltipTabPane(VanChartCustomPlot plot, BasicPane parent) { + super(plot, parent); + } + + @Override + protected void initTabTitle() { + List 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 initPaneList() { + List paneList = new ArrayList(); + + List customPlotList = plot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++){ + //根据不同的plot创建不同的数据配置界面 + VanChartPlotTooltipPane contentPane = PlotFactory.createPlotTooltipPane(customPlotList.get(i), (VanChartStylePane) parent); + paneList.add(contentPane); + } + + return paneList; + } + + @Override + public void populateBean(VanChartCustomPlot plot) { + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + DataSeriesCondition attr = vanChartPlot.getAttrTooltipFromConditionCollection(); + ((VanChartPlotTooltipPane)paneList.get(i)).populate((AttrTooltip) attr); + } + } + + @Override + public VanChartCustomPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartCustomPlot plot) { + if(plot == null) { + return; + } + + List customPlotList = plot.getCustomPlotList(); + for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ + //获取相应点的属性,并更新界面 + VanChartPlot vanChartPlot = customPlotList.get(i); + + ConditionAttr attrList = vanChartPlot.getConditionCollection().getDefaultAttr(); + + //移除所有数据点提示相关属性 + if(attrList.getExisted(AttrTooltip.class) != null){ + attrList.remove(AttrTooltip.class); + }else if (attrList.getExisted(ScatterAttrTooltip.class) != null){ + attrList.remove(ScatterAttrTooltip.class); + } + + VanChartPlotTooltipPane tooltipPane = (VanChartPlotTooltipPane) paneList.get(i); + + AttrTooltip attrTooltip = tooltipPane.update(); + if (attrTooltip != null) { + attrList.addDataSeriesCondition(attrTooltip); + } + } + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return null; + } + + @Override + public void reset() { + + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomSeriesPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomSeriesPane.java new file mode 100644 index 000000000..267f1e64c --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomSeriesPane.java @@ -0,0 +1,145 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; +import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.component.VanChartBeautyPane; + +import javax.swing.*; +import java.awt.*; + + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomSeriesPane extends ChartSeriesPane { + + private JPanel seriesPane; + protected VanChartCustomPlotSeriesTabPane plotSeriesPane; + private ChartFillStylePane fillStylePane;//配色 + private VanChartBeautyPane stylePane;//风格 + + + + public VanChartCustomSeriesPane(ChartStylePane parent) { + super(parent); + } + + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initSeriesPane((VanChartCustomPlot) chart.getPlot()); + + //公共使用的部分 + seriesPane.add(plotSeriesPane, BorderLayout.CENTER); + + //每种不同的图表单独的设置部分 + if(seriesPane != null) { + contentPane.add(seriesPane, BorderLayout.CENTER); + } + return contentPane; + } + + /** + * 创建組合图系列界面 + */ + private void initSeriesPane(VanChartCustomPlot plot) { + + seriesPane = new JPanel(new BorderLayout(0, 10)); + //获取公共的属性面板 + seriesPane.add(initCommonPane(), BorderLayout.NORTH); + + plotSeriesPane = new VanChartCustomPlotSeriesTabPane(plot, parent); + } + + private JPanel initCommonPane() { + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p,p,p,p}; + double[] col = {f}; + + fillStylePane = new ChartFillStylePane(); + + stylePane = new VanChartBeautyPane(); + + Component[][] components = new Component[][]{ + new Component[]{fillStylePane}, //配色 + new Component[]{new JSeparator()}, + new Component[]{stylePane},//风格 + new Component[]{new JSeparator()} + }; + + return TableLayoutHelper.createTableLayoutPane(components, row, col); + + } + + /** + * 保存界面属性 + */ + @Override + public void updateBean(Chart chart) { + + if(chart == null) { + return; + } + + VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); + + if (fillStylePane != null){ + plot.setPlotFillStyle(fillStylePane.updateBean()); + } + if(stylePane != null) { + plot.setPlotStyle(stylePane.updateBean()); + + //风格属性传递 + for (int i = 0; i < plot.getCustomPlotList().size(); i++){ + VanChartPlot vanChartPlot = plot.getCustomPlotList().get(i); + vanChartPlot.setPlotStyle(plot.getPlotStyle()); + } + + } + if (seriesPane != null){ + plotSeriesPane.updateBean(plot); + } + } + + /** + * 更新界面 + */ + @Override + public void populateBean(Chart chart) { + this.chart = chart; + if(seriesPane == null) { + this.remove(leftcontentPane); + layoutContentPane(); + parent.initAllListeners(); + } + if(seriesPane != null) { + //更新渐变色和风格 + VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); + if(plot == null) { + return; + } + + + if(fillStylePane != null) {//配色 + fillStylePane.populateBean(plot.getPlotFillStyle()); + } + if(stylePane != null){//风格 + stylePane.populateBean(plot.getPlotStyle()); + } + + //更新不同点的系列界面 + plotSeriesPane.populateBean(plot); + } + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomStylePane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomStylePane.java new file mode 100644 index 000000000..9ce02be6a --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomStylePane.java @@ -0,0 +1,71 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.ChartCollection; +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.attr.plot.VanChartAxisPlot; +import com.fr.plugin.chart.custom.CustomPlotFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import java.util.List; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomStylePane extends VanChartStylePane { + public VanChartCustomStylePane(AttributeChangeListener listener) { + super(listener); + } + + /** + * 根据不同的plot类型创建不同的标签界面 + * @param paneList + */ + @Override + protected void createVanChartLabelPane(List paneList) { + paneList.add(new VanChartCustomLabelPane(VanChartCustomStylePane.this)); + } + + /** + * 根据不同的plot类型创建不同的数据点提示界面 + * @param paneList + */ + @Override + protected void addVanChartTooltipPane(List paneList){ + paneList.add(new VanChartCustomTooltipPane(VanChartCustomStylePane.this)); + } + + /** + * 组合图以外的新图表类型都是使用ChartSeriesPane然后通过接口创建不同的seriesStyleContentPane + * 组合图类型不走那个接口,因为需要的系列界面完全是新的,需要像标签界面那样处理 + * @return + */ + @Override + protected ChartSeriesPane createChartSeriesPane() { + return new VanChartCustomSeriesPane(VanChartCustomStylePane.this); + } + + /** + * 当所有图表都不支持坐标轴时,则无坐标轴选项,否则创建和自定义柱形图一样的坐标轴 + * @param paneList + */ + @Override + protected void createVanChartAxisPane(List paneList, VanChartAxisPlot plot) { + paneList.add(new VanChartCustomAxisPane(VanChartCustomStylePane.this)); + } + + + @Override + protected void addVanChartAreaPane(List paneList) { + paneList.add(new VanChartCustomAreaPane(getChart().getPlot(), VanChartCustomStylePane.this)); + } + + @Override + public void update(ChartCollection collection) { + super.update(collection); + CustomPlotFactory.dataSheetSynchronization((VanChartCustomPlot) collection.getSelectedChart().getPlot()); + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomTooltipPane.java b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomTooltipPane.java new file mode 100644 index 000000000..5a2ec5bbf --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomTooltipPane.java @@ -0,0 +1,73 @@ +package com.fr.plugin.chart.custom.style; + +import com.fr.chart.chartattr.Chart; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.general.Inter; +import com.fr.plugin.chart.custom.VanChartCustomPlot; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/22. + */ +public class VanChartCustomTooltipPane extends BasicScrollPane { + + private static final long serialVersionUID = -2974722365840564105L; + private VanChartCustomPlotTooltipTabPane tooltipPane; + private Chart chart; + protected VanChartStylePane parent; + + + public VanChartCustomTooltipPane(VanChartStylePane parent){ + super(); + this.parent = parent; + } + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + if(chart == null) { + return contentPane; + } + initTooltipPane((VanChartCustomPlot) chart.getPlot()); + contentPane.add(tooltipPane, BorderLayout.NORTH); + return contentPane; + } + + private void initTooltipPane(VanChartCustomPlot plot) { + tooltipPane = new VanChartCustomPlotTooltipTabPane(plot, parent); + } + + + @Override + public void populateBean(Chart chart) { + this.chart = chart; + + if(tooltipPane == null){ + this.remove(leftcontentPane); + layoutContentPane(); + parent.initAllListeners(); + } + + if(tooltipPane != null) { + tooltipPane.populateBean((VanChartCustomPlot) chart.getPlot()); + } + } + + @Override + public void updateBean(Chart chart) { + if(chart == null) { + return; + } + + tooltipPane.updateBean((VanChartCustomPlot)chart.getPlot()); + + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Plugin-Chart_Tooltip"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/PlotFactory.java b/designer_chart/src/com/fr/plugin/chart/designer/PlotFactory.java new file mode 100644 index 000000000..3e6aff6c2 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/PlotFactory.java @@ -0,0 +1,359 @@ +package com.fr.plugin.chart.designer; + +import com.fr.base.chart.chartdata.model.LargeDataModel; +import com.fr.chart.chartattr.Plot; +import com.fr.data.core.FormatField; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; +import com.fr.design.gui.style.FormatPane; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.plugin.chart.area.VanChartAreaPlot; +import com.fr.plugin.chart.bubble.VanChartBubblePlot; +import com.fr.plugin.chart.bubble.force.VanChartBubbleRefreshTooltipPane; +import com.fr.plugin.chart.column.VanChartColumnPlot; +import com.fr.plugin.chart.designer.component.VanChartLabelContentPane; +import com.fr.plugin.chart.designer.component.VanChartRefreshTooltipContentPane; +import com.fr.plugin.chart.designer.component.VanChartTooltipContentPane; +import com.fr.plugin.chart.designer.style.*; +import com.fr.plugin.chart.designer.style.label.VanChartGaugePlotLabelPane; +import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane; +import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotRefreshTooltipPane; +import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane; +import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.funnel.VanChartFunnelPlot; +import com.fr.plugin.chart.funnel.designer.style.VanChartFunnelLabelContentPane; +import com.fr.plugin.chart.funnel.designer.style.VanChartFunnelRefreshTooltipContentPane; +import com.fr.plugin.chart.funnel.designer.style.VanChartFunnelTooltipContentPane; +import com.fr.plugin.chart.gantt.VanChartGanttPlot; +import com.fr.plugin.chart.gantt.designer.style.VanChartGanttLabelContentPane; +import com.fr.plugin.chart.gantt.designer.style.tooltip.VanChartGanttPlotTooltipPane; +import com.fr.plugin.chart.gantt.designer.style.tooltip.VanChartGanttTooltipContentPane; +import com.fr.plugin.chart.gauge.VanChartGaugePlot; +import com.fr.plugin.chart.gauge.VanChartGaugePlotRefreshTooltipPane; +import com.fr.plugin.chart.gauge.VanChartGaugePlotTooltipPane; +import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; +import com.fr.plugin.chart.line.VanChartLinePlot; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.designer.style.label.VanChartMapLabelContentPane; +import com.fr.plugin.chart.map.designer.style.tooltip.VanChartMapRefreshTooltipContentPane; +import com.fr.plugin.chart.map.designer.style.tooltip.VanChartMapTooltipContentPane; +import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot; +import com.fr.plugin.chart.multilayer.style.VanChartMultiPieLabelContentPane; +import com.fr.plugin.chart.multilayer.style.VanChartMultiPiePlotTooltipPane; +import com.fr.plugin.chart.multilayer.style.VanChartMultiPieTooltipContentPane; +import com.fr.plugin.chart.multilayer.style.VanChartMutiPieRefreshTooltipContentPane; +import com.fr.plugin.chart.scatter.VanChartScatterPlot; +import com.fr.plugin.chart.scatter.VanChartScatterPlotTooltipPane; +import com.fr.plugin.chart.scatter.VanChartScatterRefreshTooltipContentPane; +import com.fr.plugin.chart.scatter.component.label.VanChartScatterPlotLabelPane; +import com.fr.plugin.chart.structure.VanChartStructurePlot; +import com.fr.plugin.chart.structure.desinger.style.VanChartStructureLabelContentPane; +import com.fr.plugin.chart.structure.desinger.style.VanChartStructureRefreshTooltipContentPane; +import com.fr.plugin.chart.structure.desinger.style.VanChartStructureTooltipContentPane; +import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; +import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; +import com.fr.plugin.chart.wordcloud.designer.style.VanChartWordCloudRefreshTootipContentPane; +import com.fr.plugin.chart.wordcloud.designer.style.VanChartWordCloudTooltipContentPane; + +import javax.swing.*; +import java.awt.*; +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Created by Mitisky on 16/3/1. + * 图表配置界面的工厂 + */ +public class PlotFactory { + + private static Set> autoAdjustLabelPlots = new HashSet>(); + + static { + autoAdjustLabelPlots.add(VanChartColumnPlot.class); + autoAdjustLabelPlots.add(VanChartLinePlot.class); + autoAdjustLabelPlots.add(VanChartAreaPlot.class); + autoAdjustLabelPlots.add(VanChartStructurePlot.class); + } + + public static boolean plotAutoAdjustLabelPosition(Plot plot){ + return autoAdjustLabelPlots.contains(plot.getClass()); + } + /** + * + * 标签Map + */ + private static Map, Class> labelMap = new HashMap, Class>(); + static { + labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class); + labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class); + labelMap.put(VanChartBubblePlot.class, VanChartScatterPlotLabelPane.class); + } + + /** + * 图例Map + */ + private static Map, Class> legendMap = new HashMap, Class>(); + static { + legendMap.put(VanChartGaugePlot.class, VanLegendPaneWidthOutHighlight.class); + legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutHighlight.class); + legendMap.put(VanChartScatterPlot.class, VanChartRangeLegendPane.class); + legendMap.put(VanChartBubblePlot.class, VanChartRangeLegendPane.class); + legendMap.put(VanChartMapPlot.class, VanChartRangeLegendPane.class); + legendMap.put(VanChartDrillMapPlot.class, VanChartRangeLegendPane.class); + legendMap.put(VanChartHeatMapPlot.class, HeatMapRangeLegendPane.class); + legendMap.put(VanChartWordCloudPlot.class, VanChartRangeLegendPane.class); + } + + /** + * 数据点提示Map + */ + private static Map, Class> toolTipMap = new HashMap, Class>(); + static { + toolTipMap.put(VanChartGaugePlot.class, VanChartGaugePlotTooltipPane.class); + toolTipMap.put(VanChartScatterPlot.class, VanChartScatterPlotTooltipPane.class); + toolTipMap.put(VanChartBubblePlot.class, VanChartScatterPlotTooltipPane.class); + toolTipMap.put(VanChartMultiPiePlot.class, VanChartMultiPiePlotTooltipPane.class); + toolTipMap.put(VanChartTreeMapPlot.class, VanChartMultiPiePlotTooltipPane.class); + toolTipMap.put(VanChartGanttPlot.class, VanChartGanttPlotTooltipPane.class); + } + + private static Map, Class> labelContentMap = new HashMap, Class>(); + + static { + labelContentMap.put(VanChartMapPlot.class, VanChartMapLabelContentPane.class); + labelContentMap.put(VanChartDrillMapPlot.class, VanChartMapLabelContentPane.class); + labelContentMap.put(VanChartMultiPiePlot.class, VanChartMultiPieLabelContentPane.class); + labelContentMap.put(VanChartTreeMapPlot.class, VanChartMultiPieLabelContentPane.class); + labelContentMap.put(VanChartFunnelPlot.class, VanChartFunnelLabelContentPane.class); + labelContentMap.put(VanChartHeatMapPlot.class, VanChartMapLabelContentPane.class); + labelContentMap.put(VanChartGanttPlot.class, VanChartGanttLabelContentPane.class); + labelContentMap.put(VanChartStructurePlot.class, VanChartStructureLabelContentPane.class); + } + + private static Map, Class> tooltipContentMap = new HashMap, Class>(); + + static { + tooltipContentMap.put(VanChartMapPlot.class, VanChartMapTooltipContentPane.class); + tooltipContentMap.put(VanChartDrillMapPlot.class, VanChartMapTooltipContentPane.class); + tooltipContentMap.put(VanChartMultiPiePlot.class, VanChartMultiPieTooltipContentPane.class); + tooltipContentMap.put(VanChartTreeMapPlot.class, VanChartMultiPieTooltipContentPane.class); + tooltipContentMap.put(VanChartFunnelPlot.class, VanChartFunnelTooltipContentPane.class); + tooltipContentMap.put(VanChartHeatMapPlot.class, VanChartMapTooltipContentPane.class); + tooltipContentMap.put(VanChartWordCloudPlot.class, VanChartWordCloudTooltipContentPane.class); + tooltipContentMap.put(VanChartGanttPlot.class, VanChartGanttTooltipContentPane.class); + tooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureTooltipContentPane.class); + } + + + + /** + * 监控刷新 自动数据点提示Map + */ + + + private static Map, Class> refreshToolTipMap = new HashMap, Class>(); + static { + refreshToolTipMap.put(VanChartGaugePlot.class, VanChartGaugePlotRefreshTooltipPane.class); + refreshToolTipMap.put(VanChartBubblePlot.class, VanChartBubbleRefreshTooltipPane.class); + + } + private static Map, Class> refreshTooltipContentMap = new HashMap, Class>(); + + static { + refreshTooltipContentMap.put(VanChartMapPlot.class, VanChartMapRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartHeatMapPlot.class, VanChartMapRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartDrillMapPlot.class, VanChartMapRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartScatterPlot.class, VanChartScatterRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartBubblePlot.class, VanChartScatterRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartMultiPiePlot.class, VanChartMutiPieRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartTreeMapPlot.class, VanChartMutiPieRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartFunnelPlot.class, VanChartFunnelRefreshTooltipContentPane.class); + refreshTooltipContentMap.put(VanChartWordCloudPlot.class, VanChartWordCloudRefreshTootipContentPane.class); + refreshTooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureRefreshTooltipContentPane.class); + + } + + /** + * 根据图表类型创建标签界面 + * @param plot 图表 + * @param stylePane 样式界面 + * @return 标签界面 + */ + public static VanChartPlotLabelPane createPlotLabelPane(Plot plot, VanChartStylePane stylePane) { + Class key = plot.getClass(); + if(labelMap.containsKey(key)){ + try{ + Class cl = labelMap.get(key); + Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); + return constructor.newInstance(plot, stylePane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartPlotLabelPane(plot, stylePane); + } + + /** + * 根据图表类型创建图例界面 + * @param plot 图表 + * @param stylePane 样式界面 + * @return 图例界面 + */ + public static VanChartPlotLegendPane createPlotLegendPane(Plot plot, VanChartStylePane stylePane) { + Class key = plot.getClass(); + if(legendMap.containsKey(key)){ + try{ + Class cl = legendMap.get(key); + Constructor constructor = cl.getConstructor(VanChartStylePane.class); + return constructor.newInstance(stylePane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartPlotLegendPane(stylePane); + } + + /** + * 根据图表类型创建数据点提示界面 + * @param plot 图表 + * @param stylePane 样式界面 + * @return 数据点提示界面 + */ + public static VanChartPlotTooltipPane createPlotTooltipPane(Plot plot, VanChartStylePane stylePane) { + Class key = plot.getClass(); + if(toolTipMap.containsKey(key)){ + try{ + Class cl = toolTipMap.get(key); + Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); + return constructor.newInstance(plot, stylePane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartPlotTooltipPane(plot, stylePane); + } + + /** + * 根据图表类型创建标签的具体内容界面.分类名系列名等 + * @param plot 图表 + * @param parent 样式界面 + * @param showOnPane formatpane用到 + * @return 标签的具体内容界面 + */ + public static VanChartTooltipContentPane createPlotLabelContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + Class key = plot.getClass(); + if(labelContentMap.containsKey(key)){ + try{ + Class cl = labelContentMap.get(key); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + return constructor.newInstance(parent, showOnPane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartLabelContentPane(parent, showOnPane); + } + + /** + * 根据图表类型创建数据点提示的具体内容界面.分类名系列名等 + * @param plot 图表 + * @param parent 样式界面 + * @param showOnPane formatpane用到 + * @return 数据点提示的具体内容界面 + */ + public static VanChartTooltipContentPane createPlotTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + Class key = plot.getClass(); + if(tooltipContentMap.containsKey(key)){ + try{ + Class cl = tooltipContentMap.get(key); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + return constructor.newInstance(parent, showOnPane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartTooltipContentPane(parent, showOnPane); + } + + + + /** + * 根据图表类型创建数据点提示界面 + * @param plot 图表 + * @return 数据点提示界面 + */ + public static VanChartPlotTooltipPane createPlotRefreshTooltipPane(Plot plot) { + Class key = plot.getClass(); + if(refreshToolTipMap.containsKey(key)){ + try{ + Class cl = refreshToolTipMap.get(key); + Constructor constructor = cl.getConstructor(Plot.class); + return constructor.newInstance(plot); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartPlotRefreshTooltipPane(plot); + } + /** + * 根据图表类型创建监控刷新中数据点提示的具体内容界面.分类名系列名等 + * @param plot 图表 + * @param parent 交互属性界面 + * @param showOnPane formatpane用到 + * @return 数据点提示的具体内容界面 + */ + public static VanChartTooltipContentPane createPlotRefreshTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + Class key = plot.getClass(); + if(refreshTooltipContentMap.containsKey(key)){ + try{ + Class cl = refreshTooltipContentMap.get(key); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + return constructor.newInstance(parent, showOnPane); + } catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + return new VanChartRefreshTooltipContentPane(parent, showOnPane); + } + + public static FormatPane createAutoFormatPane(){ + FormatPane formatPane = new FormatPane(){ + + protected UIComboBoxRenderer createComBoxRender(){ + return new UIComboBoxRenderer() { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + if (value instanceof Integer) { + String text = ComparatorUtils.equals(value, FormatField.FormatContents.NULL) + ? Inter.getLocText("Plugin-ChartF_Auto") + : FormatField.getInstance().getName((Integer) value); + label.setText(" " + text); + } + return label; + } + }; + } + }; + + formatPane.setComboBoxModel(true); + + return formatPane; + } + + /** + * 判断是否为大数据模式 + */ + public static boolean largeDataModel(Plot plot){ + return plot != null && plot.getDataProcessor().getMark() == LargeDataModel.MARK; + } + + public static boolean lineMapLargeModel(Plot plot){ + return plot instanceof VanChartMapPlot && ((VanChartMapPlot) plot).getLineMapDataProcessor().getMark() == LargeDataModel.MARK; + } +} + diff --git a/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java b/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java new file mode 100644 index 000000000..8a16a472c --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java @@ -0,0 +1,77 @@ +package com.fr.plugin.chart.designer; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; + +import javax.swing.*; +import java.awt.*; + +/** + * 布局 标题+组件 + */ +public class TableLayout4VanChartHelper { + + private static final int SMALL_GAP = 20; + /** + * 标题布局(二级菜单距左边框46) + * @param title 标题 + * @param component 组件 + * @return 布局好的组件 + */ + public static JPanel createTableLayoutPaneWithTitle(String title, Component component){ + return TableLayout4VanChartHelper.createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN); + } + + /** + * 标题布局(二级菜单距左边框46) + * @param label 标题label + * @param component 组件 + * @return 布局好的组件 + */ + public static JPanel createTableLayoutPaneWithUILabel(UILabel label, Component component){ + return TableLayout4VanChartHelper.createTitlePaneWithUILabel(label, component, LayoutConstants.CHART_ATTR_TOMARGIN); + } + + /** + * 标题布局(三级菜单距二级左侧20) + * @param title 标题 + * @param component 组件 + * @return 布局好的组件 + */ + public static JPanel createTableLayoutPaneWithSmallTitle(String title, Component component){ + return TableLayout4VanChartHelper.createTitlePane(title, component, TableLayout4VanChartHelper.SMALL_GAP); + } + + /** + * 标题布局(指定gap) + * @param title 标题 + * @param component 组件 + * @param gap 距左侧距离 + * @return 布局好的组件 + */ + public static JPanel createTitlePane(String title, Component component, int gap){ + return createTitlePaneWithUILabel(new UILabel(title), component, gap); + } + + /** + * 标题布局(指定gap) + * @param label 标题label + * @param component 组件 + * @param gap 距左侧距离 + * @return 布局好的组件 + */ + public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap){ + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {gap, f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{label,null}, + new Component[]{null,component}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/ConditionUIMenuNameableCreator.java b/designer_chart/src/com/fr/plugin/chart/designer/component/ConditionUIMenuNameableCreator.java new file mode 100644 index 000000000..5b78f970a --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/ConditionUIMenuNameableCreator.java @@ -0,0 +1,44 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.general.FRLogger; + +import java.lang.reflect.Constructor; + +/** + * Created by hufan on 2016/11/15. + */ +public class ConditionUIMenuNameableCreator extends UIMenuNameableCreator { + private Plot plot; + + public ConditionUIMenuNameableCreator(Plot plot, String name, Object obj, Class paneClazz) { + super(name, obj, paneClazz); + this.plot = plot; + } + + public UIMenuNameableCreator clone() { + Object cloneObj = null; + try { + cloneObj = obj.getClass().newInstance(); + } catch (InstantiationException e) { + FRLogger.getLogger().error("UIMenuNameableCreator InstantiationException"); + } catch (IllegalAccessException e) { + FRLogger.getLogger().error("UIMenuNameableCreator IllegalAccessException"); + } + return new ConditionUIMenuNameableCreator(plot, name, cloneObj, (Class) this.paneClazz); + + } + + public BasicBeanPane getPane() { + try { + Constructor constructor = paneClazz.getConstructor(Plot.class); + return constructor.newInstance(plot); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage(), e); + } + return null; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartAreaSeriesFillColorPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartAreaSeriesFillColorPane.java new file mode 100644 index 000000000..0387dd365 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartAreaSeriesFillColorPane.java @@ -0,0 +1,64 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.plugin.chart.VanChartAttrHelper; +import com.fr.plugin.chart.base.AttrAreaSeriesFillColorBackground; +import com.fr.plugin.chart.designer.component.background.VanChartMarkerBackgroundPane; + +import java.awt.*; + +/** + * 面积图填充色设置界面 + */ +public class VanChartAreaSeriesFillColorPane extends BasicPane { + private static final long serialVersionUID = 9166866984438854779L; + private VanChartMarkerBackgroundPane fillColorPane; + private UINumberDragPane transparent; + + public VanChartAreaSeriesFillColorPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p,p}; + double[] col = {f}; + fillColorPane = new VanChartMarkerBackgroundPane(); + transparent = new UINumberDragPane(0, 100); + + Component[][] components = new Component[][]{ + new Component[]{fillColorPane}, + new Component[]{transparent}, + }; + + this.add(TableLayoutHelper.createTableLayoutPane(components, row, col)); + } + + protected String title4PopupWindow(){ + return Inter.getLocText("Plugin-ChartF_FillColor"); + } + + public void populate(AttrAreaSeriesFillColorBackground fillColorBackground) { + if(fillColorBackground == null){ + fillColorBackground = new AttrAreaSeriesFillColorBackground(); + } + fillColorPane.populate(fillColorBackground.getColorBackground()); + transparent.populateBean(fillColorBackground.getAlpha() * VanChartAttrHelper.PERCENT); + } + + public AttrAreaSeriesFillColorBackground update() { + AttrAreaSeriesFillColorBackground fillColorBackground = new AttrAreaSeriesFillColorBackground(); + fillColorBackground.setColorBackground(fillColorPane.update()); + fillColorBackground.setAlpha(transparent.updateBean()/VanChartAttrHelper.PERCENT); + return fillColorBackground; + } + + /** + * 检查透明的设置是否有效 + * @param enable + */ + public void checkoutAlpha(boolean enable) { + transparent.setEnabled(enable); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartBeautyPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartBeautyPane.java new file mode 100644 index 000000000..c4f58b2f3 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartBeautyPane.java @@ -0,0 +1,68 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 15/9/8. + */ +//系列-风格 +public class VanChartBeautyPane extends BasicBeanPane { + private UIComboBox styleBox; + + public VanChartBeautyPane() { + styleBox = new UIComboBox(getNameArray()); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { f }; + double[] rowSize = { p}; + Component[][] components = new Component[][]{ + new Component[]{styleBox}, + } ; + JPanel panel = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Plugin-Chart_Style"}, components, rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + protected String[] getNameArray(){ + return new String[]{Inter.getLocText("Chart-Default_Name"), + Inter.getLocText("Plugin-Chart_TopDownShade") + }; + } + @Override + public void populateBean(Integer ob) { + int finalIndex; + switch (ob){ + case ChartConstants.STYLE_NONE: finalIndex = 0; break; + case ChartConstants.STYLE_SHADE: finalIndex = 1; break; + default: finalIndex = 0; + } + styleBox.setSelectedIndex(finalIndex); + } + + @Override + public Integer updateBean() { + int index = styleBox.getSelectedIndex(); + int style; + switch (index){ + case 0: style = ChartConstants.STYLE_NONE; break; + case 1: style = ChartConstants.STYLE_SHADE; break; + default: style = ChartConstants.STYLE_NONE; + } + return style; + } + + @Override + protected String title4PopupWindow() { + return ""; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFillStylePane4Condition.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFillStylePane4Condition.java new file mode 100644 index 000000000..ee431e1c8 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFillStylePane4Condition.java @@ -0,0 +1,41 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; + +import javax.swing.*; +import java.awt.*; + +/** + * 配色 只有下拉框控件无配色title。 条件属性 配色中用到 + */ +public class VanChartFillStylePane4Condition extends ChartFillStylePane { + private static final long serialVersionUID = 2470094484790112401L; + + @Override + protected void initLayout() { + customPane.setPreferredSize(new Dimension(200, 130)); + colorGradient.setPreferredSize(new Dimension(120, 30)); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { f }; + double[] rowSize = { p, p}; + Component[][] components = new Component[][]{ + new Component[]{styleSelectBox}, + new Component[]{customPane} + } ; + JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + @Override + public Dimension getPreferredSize() { + if(styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 1) { + return new Dimension(styleSelectBox.getPreferredSize().width, 20); + } + return super.getPreferredSize(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFloatPositionPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFloatPositionPane.java new file mode 100644 index 000000000..753bcd389 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartFloatPositionPane.java @@ -0,0 +1,81 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.chart.chartattr.Chart; +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.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; + +/** + * 悬浮位置 标题和图例用到 + */ +public class VanChartFloatPositionPane extends BasicBeanPane { + private static final long serialVersionUID = -4773313488161065678L; + private UISpinner floatPosition_x; + private UISpinner floatPosition_y; + + public VanChartFloatPositionPane(){ + + this.setLayout(new BorderLayout()); + + this.add(new UILabel(Inter.getLocText("plugin-ChartF_XYFromTheUpLeft")), BorderLayout.CENTER); + + this.add(createCustomFloatPositionPane(), BorderLayout.SOUTH); + } + + private JPanel createCustomFloatPositionPane(){ + floatPosition_x = new UISpinner(0,100,1,0); + floatPosition_y = new UISpinner(0,100,1,0); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p,p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("plugin-ChartF_positionX")+": "),floatPosition_x}, + new Component[]{new UILabel(Inter.getLocText("plugin-ChartF_positionY")+": "),floatPosition_y} + }; + + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + public void setFloatPosition_x(double floatPosition_x) { + this.floatPosition_x.setValue(floatPosition_x); + } + + public void setFloatPosition_y(double floatPosition_y) { + this.floatPosition_y.setValue(floatPosition_y); + } + + public double getFloatPosition_x() { + return floatPosition_x.getValue(); + } + + public double getFloatPosition_y() { + return floatPosition_y.getValue(); + } + + + /** + * 弹出框标题 + * @return 标题 + */ + public String title4PopupWindow() { + return StringUtils.EMPTY; + } + + @Override + public Chart updateBean() { + return null; + } + + @Override + public void populateBean(Chart ob) { + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPane.java new file mode 100644 index 000000000..107ec5b66 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPane.java @@ -0,0 +1,199 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.constants.KeyWords; +import com.fr.design.gui.autocomplete.AutoCompletion; +import com.fr.design.gui.autocomplete.BasicCompletion; +import com.fr.design.gui.autocomplete.DefaultCompletionProvider; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.VanChartHtmlLabel; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by Mitisky on 16/2/19. + */ +public class VanChartHtmlLabelPane extends JPanel{ + + private static final long serialVersionUID = -5512128966013558611L; + private static final int JS_HEIGHT = 100; + + private RSyntaxTextArea contentTextArea; + private UIToggleButton useHtml; + + private UICheckBox isCustomWidth; + private UITextField customWidth; + private UICheckBox isCustomHeight; + private UITextField customHeight; + + private VanChartStylePane parent; + + public void setCustomFormatterText(String text){ + contentTextArea.setText(text); + } + + public void setParent(VanChartStylePane parent) { + this.parent = parent; + } + + public VanChartHtmlLabelPane() { + useHtml = new UIToggleButton(Inter.getLocText("Plugin-ChartF_Html")); + JPanel widthAndHeightPane = createWidthAndHeightPane(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p, p}; + + Component[][] components = new Component[][]{ + new Component[]{createJSContentPane()}, + new Component[]{useHtml}, + new Component[]{widthAndHeightPane} + }; + + JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + + this.setLayout(new BorderLayout()); + this.add(contentPane, BorderLayout.CENTER); + } + + private JComponent createJSContentPane() { + contentTextArea = new RSyntaxTextArea(); + contentTextArea.setCloseCurlyBraces(true); + contentTextArea.setLineWrap(true); + contentTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT); + contentTextArea.setCodeFoldingEnabled(true); + contentTextArea.setAntiAliasingEnabled(true); + contentTextArea.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + fireJSChange(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + fireJSChange(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + fireJSChange(); + } + }); + + DefaultCompletionProvider provider = new DefaultCompletionProvider(); + + for (String key : KeyWords.JAVASCRIPT) { + provider.addCompletion(new BasicCompletion(provider, key)); + } + + AutoCompletion ac = new AutoCompletion(provider); + String shortCuts = DesignerEnvManager.getEnvManager().getAutoCompleteShortcuts(); + + ac.setTriggerKey(KeyStroke.getKeyStroke(shortCuts.replace("+", "pressed"))); + ac.install(contentTextArea); + + return new UIScrollPane(contentTextArea){ + @Override + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, JS_HEIGHT); + } + }; + } + + private void fireJSChange() { + if(parent != null){ + parent.attributeChanged(); + } + } + + protected JPanel createWidthAndHeightPane() { + isCustomWidth = new UICheckBox(Inter.getLocText("Plugin-ChartF_Custom_Width")); + customWidth = new UITextField(6); + isCustomHeight = new UICheckBox(Inter.getLocText("Plugin-ChartF_Custom_Height")); + customHeight = new UITextField(6); + + isCustomWidth.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + checkWidth(); + } + }); + isCustomHeight.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkHeight(); + } + }); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p, f }; + double[] rowSize = { p, p}; + + Component[][] components = new Component[][]{ + new Component[]{isCustomWidth, customWidth}, + new Component[]{isCustomHeight, customHeight}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + private void checkWidth() { + customWidth.setEnabled(isCustomWidth.isSelected()); + } + + private void checkHeight() { + customHeight.setEnabled(isCustomHeight.isSelected()); + } + + private void checkBoxUse() { + checkHeight(); + checkWidth(); + } + + public void populate(VanChartHtmlLabel htmlLabel){ + if(htmlLabel == null){ + return; + } + setCustomFormatterText(htmlLabel.getCustomText()); + useHtml.setSelected(htmlLabel.isUseHtml()); + populateWidthAndHeight(htmlLabel); + } + + protected void populateWidthAndHeight(VanChartHtmlLabel htmlLabel) { + isCustomWidth.setSelected(htmlLabel.isCustomWidth()); + customWidth.setText(htmlLabel.getWidth()); + isCustomHeight.setSelected(htmlLabel.isCustomHeight()); + customHeight.setText(htmlLabel.getHeight()); + checkBoxUse(); + } + + public void update(VanChartHtmlLabel htmlLabel) { + if(htmlLabel == null){ + return; + } + htmlLabel.setCustomText(contentTextArea.getText()); + htmlLabel.setUseHtml(useHtml.isSelected()); + updateWidthAndHeight(htmlLabel); + } + + protected void updateWidthAndHeight(VanChartHtmlLabel htmlLabel) { + htmlLabel.setCustomWidth(isCustomWidth.isSelected()); + htmlLabel.setWidth(customWidth.getText()); + htmlLabel.setCustomHeight(isCustomHeight.isSelected()); + htmlLabel.setHeight(customHeight.getText()); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPaneWithOutWidthAndHeight.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPaneWithOutWidthAndHeight.java new file mode 100644 index 000000000..3204cec2a --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartHtmlLabelPaneWithOutWidthAndHeight.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.plugin.chart.base.VanChartHtmlLabel; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/2/19. + * 不能设置宽高 + */ +public class VanChartHtmlLabelPaneWithOutWidthAndHeight extends VanChartHtmlLabelPane { + private static final long serialVersionUID = -9213286452724939880L; + + protected JPanel createWidthAndHeightPane() { + return new JPanel(); + } + + protected void populateWidthAndHeight(VanChartHtmlLabel htmlLabel) { + } + protected void updateWidthAndHeight(VanChartHtmlLabel htmlLabel) { + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLabelContentPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLabelContentPane.java new file mode 100644 index 000000000..182adca90 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLabelContentPane.java @@ -0,0 +1,18 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +public class VanChartLabelContentPane extends VanChartTooltipContentPane { + + private static final long serialVersionUID = 5630276526789839288L; + + public VanChartLabelContentPane(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + protected VanChartHtmlLabelPane createHtmlLabelPane() { + return new VanChartHtmlLabelPane(); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineTypePane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineTypePane.java new file mode 100644 index 000000000..df37ecced --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineTypePane.java @@ -0,0 +1,95 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.plugin.chart.type.LineStyle; +import com.fr.plugin.chart.base.VanChartAttrLine; +import com.fr.stable.Constants; +import com.fr.stable.CoreConstants; + +import javax.swing.*; +import java.awt.*; + +/** + * line相关设置 + */ +public class VanChartLineTypePane extends BasicPane { + + private static final long serialVersionUID = -6581862503009962973L; + protected LineComboBox lineWidth;//线型 + protected UIButtonGroup lineStyle;//形态 + protected UIButtonGroup nullValueBreak;//空值断开 + + public VanChartLineTypePane() { + lineWidth = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); + + createLineStyle(); + + nullValueBreak = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), Inter.getLocText("Plugin-ChartF_Close")}); + + this.setLayout(new BorderLayout()); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + this.add(createContentPane(p, f), BorderLayout.CENTER); + } + + protected void createLineStyle() { + String[] textArray = new String[]{Inter.getLocText("Plugin-ChartF_NormalLine"), + Inter.getLocText("Plugin-ChartF_StepLine"), Inter.getLocText("Plugin-ChartF_CurveLine")}; + lineStyle = new UIButtonGroup(textArray, LineStyle.values()); + } + + protected JPanel createContentPane(double p, double f) { + double[] row = {p, p, p, p, p, p}; + double[] col = {p, f}; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle"))}, + new Component[]{lineWidth, null}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Style_Present"))}, + new Component[]{lineStyle, null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Null_Value_Break"))}, + new Component[]{nullValueBreak, null}, + }; + + return TableLayoutHelper.createTableLayoutPane(components, row, col); + } + + public void checkLarge(boolean large){ + if(large){ + lineWidth.setSelectedLineStyle(Constants.LINE_NONE); + } + lineWidth.setEnabled(!large); + lineStyle.setEnabled(!large); + } + + protected String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_Line"); + } + + public void populate(VanChartAttrLine line) { + if (line == null) { + line = initVanChartAttrLine(); + } + lineWidth.setSelectedLineStyle(line.getLineWidth()); + lineStyle.setSelectedItem(line.getLineStyle()); + nullValueBreak.setSelectedIndex(line.isNullValueBreak() ? 0 : 1); + } + + protected VanChartAttrLine initVanChartAttrLine() { + return new VanChartAttrLine(); + } + + public VanChartAttrLine update() { + VanChartAttrLine line = new VanChartAttrLine(); + line.setLineWidth(lineWidth.getSelectedLineStyle()); + line.setLineStyle(lineStyle.getSelectedItem()); + line.setNullValueBreak(nullValueBreak.getSelectedIndex() == 0); + return line; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineWidthPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineWidthPane.java new file mode 100644 index 000000000..370345844 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartLineWidthPane.java @@ -0,0 +1,27 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * 线-线型 + */ +public class VanChartLineWidthPane extends VanChartLineTypePane { + private static final long serialVersionUID = 4537158946119294689L; + + protected JPanel createContentPane(double p, double f) { + double[] row = {p, p}; + double[] col = {p,f}; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle")), lineWidth}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Null_Value_Break")), nullValueBreak}, + }; + + return TableLayoutHelper.createTableLayoutPane(components, row, col); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartMarkerPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartMarkerPane.java new file mode 100644 index 000000000..16a5dde8c --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartMarkerPane.java @@ -0,0 +1,120 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.VanChartAttrMarker; +import com.fr.plugin.chart.designer.component.marker.VanChartCommonMarkerPane; +import com.fr.plugin.chart.designer.component.marker.VanChartImageMarkerPane; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +/** + * 标记点设置界面 + */ +public class VanChartMarkerPane extends BasicPane { + private static final long serialVersionUID = 7206339620703021514L; + private UIButtonGroup commonORCustom; + private JPanel centerPane; + private CardLayout cardLayout; + + private BasicBeanPane commonMarkerPane; + + private BasicBeanPane imageMarkerPane; + + public VanChartMarkerPane() { + this.setLayout(new BorderLayout(0, 4)); + + String[] array = new String[]{Inter.getLocText("Plugin-ChartF_Rule"), Inter.getLocText("Plugin-ChartF_Custom")}; + commonORCustom = new UIButtonGroup(array, array); + + commonORCustom.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkCenterPane(); + } + }); + + commonMarkerPane = createCommonMarkerPane(); + imageMarkerPane = createImageMarkerPane(); + + cardLayout = new CardLayout(); + centerPane = new JPanel(cardLayout) { + + @Override + public Dimension getPreferredSize() { + if(commonORCustom.getSelectedIndex() == 0){ + return commonMarkerPane.getPreferredSize(); + } else { + return imageMarkerPane.getPreferredSize(); + } + } + }; + centerPane.add(commonMarkerPane, Inter.getLocText("Plugin-ChartF_Rule")); + centerPane.add(imageMarkerPane, Inter.getLocText("Plugin-ChartF_Custom")); + + layoutComponents(); + } + + public void checkLargePlot(boolean large){ + if(large){ + commonORCustom.setSelectedIndex(0); + checkCenterPane(); + } + commonORCustom.setEnabled(!large); + } + + protected BasicBeanPane createImageMarkerPane() { + return new VanChartImageMarkerPane(); + } + + protected BasicBeanPane createCommonMarkerPane() { + return new VanChartCommonMarkerPane(); + } + + protected void layoutComponents() { + this.add(commonORCustom, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } + + protected void layoutComponentsWithOutNorth() { + this.add(centerPane, BorderLayout.CENTER); + } + + private void checkCenterPane() { + cardLayout.show(centerPane, commonORCustom.getSelectedItem()); + } + + protected String title4PopupWindow(){ + return Inter.getLocText("Plugin-ChartF_Marker"); + } + + public void populate(VanChartAttrMarker marker) { + if(marker == null){ + marker = new VanChartAttrMarker(); + } + commonORCustom.setSelectedIndex(marker.isCommon() ? 0 : 1); + if(marker.isCommon()){ + commonMarkerPane.populateBean(marker); + } else { + imageMarkerPane.populateBean(marker); + } + + checkCenterPane(); + } + + public VanChartAttrMarker update() { + VanChartAttrMarker marker = new VanChartAttrMarker(); + if(commonORCustom.getSelectedIndex() == 0){ + commonMarkerPane.updateBean(marker); + } else { + imageMarkerPane.updateBean(marker); + } + return marker; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartPlotMultiTabPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartPlotMultiTabPane.java new file mode 100644 index 000000000..3e1fa02f7 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartPlotMultiTabPane.java @@ -0,0 +1,104 @@ +package com.fr.plugin.chart.designer.component; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Dimension; +import java.util.List; + +import javax.swing.JPanel; + +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.ibutton.UITabGroup; + +/** + * + * 标准的多层Tab切换类型. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-4-22 上午10:31:03 + */ +public abstract class VanChartPlotMultiTabPane extends FurtherBasicBeanPane{ + private static final long serialVersionUID = 2298609199400393886L; + protected UITabGroup tabPane; + protected String[] NameArray; + protected JPanel centerPane; + protected CardLayout cardLayout; + protected List paneList; + + //提供一个可以根据plot信息创建paneList的类 + protected E plot; + //承载该容器的父类容器 + protected BasicPane parent; + + //屬性變化的監聽器,在構造數據配置面板時用到 + protected AttributeChangeListener listener = null; + + protected abstract List initPaneList(); + + public abstract void populateBean(T ob); + public abstract void updateBean(T ob); + + public VanChartPlotMultiTabPane(E plot, BasicPane parent) { + this(plot, parent, null); + } + + public VanChartPlotMultiTabPane(E plot, BasicPane parent, AttributeChangeListener listener) { + this.plot = plot; + this.parent = parent; + this.listener = listener; + cardLayout = new CardLayout(); + paneList = initPaneList(); + relayoutWhenListChange(); + } + + public int getSelectedIndex() { + return tabPane.getSelectedIndex(); + } + + /** + * 当List中的界面变化时, 重新布局 + */ + public void relayoutWhenListChange() { + 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++) { + BasicPane pane = (BasicPane) paneList.get(i); + NameArray[i] = pane.getTitle(); + centerPane.add(pane, NameArray[i]); + } + + tabPane = new UITabGroup(NameArray) { + @Override + public void tabChanged(int index) { + dealWithTabChanged(index); + } + }; + tabPane.setSelectedIndex(0); + tabPane.tabChanged(0); + initLayout(); + } + + protected void dealWithTabChanged(int index) { + cardLayout.show(centerPane, NameArray[index]); + tabChanged(); + } + + protected void tabChanged() { + + } + + protected void initLayout() { + this.setLayout(new BorderLayout(0, 4)); + this.add(tabPane, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartRefreshTooltipContentPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartRefreshTooltipContentPane.java new file mode 100644 index 000000000..8bd8fc4e1 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartRefreshTooltipContentPane.java @@ -0,0 +1,42 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.plugin.chart.designer.component.format.ChangedPercentFormatPaneWithCheckBox; +import com.fr.plugin.chart.designer.component.format.ChangedValueFormatPaneWithCheckBox; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by mengao on 2017/6/5. + */ +public class VanChartRefreshTooltipContentPane extends VanChartTooltipContentPane { + + public VanChartRefreshTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { + super(null, showOnPane); + } + + protected double[] getRowSize(double p){ + return new double[]{p,p,p,p,p,p}; + } + + @Override + protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { + super.initFormatPane(parent, showOnPane); + + changedValueFormatPane = new ChangedValueFormatPaneWithCheckBox(parent, showOnPane); + changedPercentFormatPane = new ChangedPercentFormatPaneWithCheckBox(parent, showOnPane); + } + + protected Component[][] getPaneComponents(){ + return new Component[][]{ + new Component[]{categoryNameFormatPane,null}, + new Component[]{seriesNameFormatPane,null}, + new Component[]{valueFormatPane,null}, + new Component[]{changedValueFormatPane,null}, + new Component[]{percentFormatPane,null}, + new Component[]{changedPercentFormatPane,null}, + }; + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTooltipContentPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTooltipContentPane.java new file mode 100644 index 000000000..d36cc405d --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTooltipContentPane.java @@ -0,0 +1,226 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; +import com.fr.plugin.chart.designer.component.format.*; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * 内容界面 。数据点提示 + */ +public class VanChartTooltipContentPane extends BasicBeanPane { + + private static final long serialVersionUID = 8825929000117843641L; + + protected UIButtonGroup content; + protected ValueFormatPaneWithCheckBox valueFormatPane; + protected PercentFormatPaneWithCheckBox percentFormatPane; + protected CategoryNameFormatPaneWithCheckBox categoryNameFormatPane; + protected SeriesNameFormatPaneWithCheckBox seriesNameFormatPane; + + //监控刷新时,自动数据点提示使用 + protected ChangedValueFormatPaneWithCheckBox changedValueFormatPane; + protected ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane; + + private JPanel centerPane; + private VanChartHtmlLabelPane htmlLabelPane; + + private VanChartStylePane parent; + private JPanel showOnPane; + + public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){ + this.parent = parent; + this.showOnPane = showOnPane; + + this.setLayout(new BorderLayout()); + this.add(createLabelContentPane(),BorderLayout.CENTER); + } + + private JPanel createLabelContentPane() { + content = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Common"), + Inter.getLocText("Plugin-ChartF_Custom")}); + + initFormatPane(parent, showOnPane); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, p}; + double[] rowSize = getRowSize(p); + + final JPanel commonPanel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize); + + htmlLabelPane = createHtmlLabelPane(); + htmlLabelPane.setParent(parent); + + centerPane = new JPanel(new CardLayout()){ + @Override + public Dimension getPreferredSize() { + if(content.getSelectedIndex() == 0){ + return commonPanel.getPreferredSize(); + } else { + return new Dimension(commonPanel.getPreferredSize().width,htmlLabelPane.getPreferredSize().height); + } + } + }; + centerPane.add(htmlLabelPane, Inter.getLocText("Plugin-ChartF_Custom")); + centerPane.add(commonPanel,Inter.getLocText("Plugin-ChartF_Common")); + + initContentListener(); + + JPanel contentPane = new JPanel(new BorderLayout(0, 4)); + contentPane.add(content, BorderLayout.NORTH); + contentPane.add(centerPane, BorderLayout.CENTER); + + return createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Content"), contentPane); + } + + protected VanChartHtmlLabelPane createHtmlLabelPane() { + return new VanChartHtmlLabelPaneWithOutWidthAndHeight(); + } + + protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){ + categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); + seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); + valueFormatPane = new ValueFormatPaneWithCheckBox(parent, showOnPane); + percentFormatPane = new PercentFormatPaneWithCheckBox(parent, showOnPane); + } + + protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { + return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(title, component); + } + + protected double[] getRowSize(double p){ + return new double[]{p,p,p,p}; + } + + protected Component[][] getPaneComponents(){ + return new Component[][]{ + new Component[]{categoryNameFormatPane,null}, + new Component[]{seriesNameFormatPane,null}, + new Component[]{valueFormatPane,null}, + new Component[]{percentFormatPane,null}, + }; + } + + private void initContentListener() { + content.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkCardPane(); + } + }); + } + + + private void checkCardPane() { + CardLayout cardLayout = (CardLayout) centerPane.getLayout(); + if (content.getSelectedIndex() == 1) { + cardLayout.show(centerPane,Inter.getLocText("Plugin-ChartF_Custom")); + if(isDirty()){ + setCustomFormatterText(); + setDirty(false); + } + } else { + cardLayout.show(centerPane, Inter.getLocText("Plugin-ChartF_Common")); + } + } + + protected void setCustomFormatterText() { + htmlLabelPane.setCustomFormatterText(updateBean().getFormatterTextFromCommon()); + } + + public boolean isDirty() { + return categoryNameFormatPane.isDirty() || seriesNameFormatPane.isDirty() || valueFormatPane.isDirty() || percentFormatPane.isDirty(); + } + + public void setDirty(boolean isDirty) { + categoryNameFormatPane.setDirty(isDirty); + seriesNameFormatPane.setDirty(isDirty); + valueFormatPane.setDirty(isDirty); + percentFormatPane.setDirty(isDirty); + + if (changedValueFormatPane != null) { + changedValueFormatPane.setDirty(isDirty); + } + if (changedPercentFormatPane != null) { + changedPercentFormatPane.setDirty(isDirty); + } + } + + @Override + protected String title4PopupWindow() { + return ""; + } + + + @Override + public void populateBean(AttrTooltipContent attrTooltipContent){ + if(attrTooltipContent == null){ + return; + } + + content.setSelectedIndex(attrTooltipContent.isCommon() ? 0 : 1); + + populateFormatPane(attrTooltipContent); + + htmlLabelPane.populate(attrTooltipContent.getHtmlLabel()); + if(!attrTooltipContent.isCommon()){ + setDirty(false); + } + checkCardPane(); + } + + protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { + categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat()); + seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat()); + valueFormatPane.populate(attrTooltipContent.getValueFormat()); + percentFormatPane.populate(attrTooltipContent.getPercentFormat()); + + if (changedValueFormatPane != null) { + changedValueFormatPane.populate(attrTooltipContent.getChangedValueFormat()); + } + if (changedPercentFormatPane != null) { + changedPercentFormatPane.populate(attrTooltipContent.getChangedPercentFormat()); + } + } + + public AttrTooltipContent updateBean() { + AttrTooltipContent attrTooltipContent = createAttrTooltip(); + + attrTooltipContent.setCommon(content.getSelectedIndex() == 0); + + updateFormatPane(attrTooltipContent); + + htmlLabelPane.update(attrTooltipContent.getHtmlLabel()); + + return attrTooltipContent; + } + + protected AttrTooltipContent createAttrTooltip() { + return new AttrTooltipContent(); + } + + protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { + categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat()); + seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat()); + valueFormatPane.update(attrTooltipContent.getValueFormat()); + percentFormatPane.update(attrTooltipContent.getPercentFormat()); + + if (changedValueFormatPane != null) { + changedValueFormatPane.update(attrTooltipContent.getChangedValueFormat()); + } + if (changedPercentFormatPane != null) { + changedPercentFormatPane.update(attrTooltipContent.getChangedPercentFormat()); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTrendLinePane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTrendLinePane.java new file mode 100644 index 000000000..1bf26b3bd --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartTrendLinePane.java @@ -0,0 +1,101 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.chart.base.AttrColor; +import com.fr.chart.base.AttrLineStyle; +import com.fr.chart.base.LineStyleInfo; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.style.color.ColorSelectBox; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.TrendLineType; +import com.fr.plugin.chart.base.VanChartAttrTrendLine; +import com.fr.plugin.chart.base.VanChartConstants; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 15/10/19. + */ +public class VanChartTrendLinePane extends BasicPane{ + private static final TrendLineType[] TYPES = new TrendLineType[] {TrendLineType.EXP, TrendLineType.LINE, TrendLineType.LOG, TrendLineType.POLY}; + + private UITextField trendLineName; + private ColorSelectBox trendLineColor; + private LineComboBox trendLineStyle;//线型 + + private UIComboBox trendLineType;//趋势线函数类型 + private UISpinner prePeriod; + private UISpinner afterPeriod; + + public VanChartTrendLinePane() { + this.setLayout(new BorderLayout()); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p,p,p,p,p}; + double[] col = {p,f}; + trendLineName = new UITextField(); + trendLineColor = new ColorSelectBox(100); + trendLineStyle = new LineComboBox(VanChartConstants.ALERT_LINE_STYLE); + + trendLineType = new UIComboBox(TYPES); + prePeriod = new UISpinner(0,Integer.MAX_VALUE,1,0); + afterPeriod = new UISpinner(0,Integer.MAX_VALUE,1,0); + double[] r = {p,p}; + double[] c = {p,f,p}; + Component[][] periodComps = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Chart_TrendLine_Forward")), prePeriod, new UILabel(Inter.getLocText("Plugin-ChartF_Cycle"))}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_After_Period")), afterPeriod, new UILabel(Inter.getLocText("Plugin-ChartF_Cycle"))}, + }; + JPanel periodPane = TableLayoutHelper.createTableLayoutPane(periodComps, r, c); + + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Name")), trendLineName}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle")), trendLineStyle}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Color_Color")), trendLineColor}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_type")), trendLineType}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Period")), periodPane} + }; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); + this.add(panel, BorderLayout.CENTER); + } + protected String title4PopupWindow(){ + return Inter.getLocText("Chart-Trend_Line"); + } + + public void populate(VanChartAttrTrendLine trendLine) { + if(trendLine != null){ + trendLineName.setText(trendLine.getTrendLineName()); + LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo(); + trendLineColor.setSelectObject(lineStyleInfo.getAttrLineColor().getSeriesColor()); + trendLineStyle.setSelectedLineStyle(lineStyleInfo.getAttrLineStyle().getLineStyle()); + trendLineType.setSelectedItem(trendLine.getTrendLineType()); + prePeriod.setValue(trendLine.getPrePeriod()); + afterPeriod.setValue(trendLine.getAfterPeriod()); + } + } + + public VanChartAttrTrendLine update() { + VanChartAttrTrendLine trendLine = new VanChartAttrTrendLine(); + trendLine.setTrendLineName(trendLineName.getText()); + + LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo(); + lineStyleInfo.setAttrLineStyle(new AttrLineStyle(trendLineStyle.getSelectedLineStyle())); + lineStyleInfo.setAttrLineColor(new AttrColor(trendLineColor.getSelectObject())); + + trendLine.setTrendLineType((TrendLineType) trendLineType.getSelectedItem()); + trendLine.setPrePeriod((int) prePeriod.getValue()); + trendLine.setAfterPeriod((int) afterPeriod.getValue()); + + return trendLine; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartUIMenuNameableCreator.java b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartUIMenuNameableCreator.java new file mode 100644 index 000000000..3f41920d9 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/VanChartUIMenuNameableCreator.java @@ -0,0 +1,28 @@ +package com.fr.plugin.chart.designer.component; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.general.FRLogger; +import com.fr.stable.FCloneable; + +/** + * 新的obj是clone出来的,非new + */ +public class VanChartUIMenuNameableCreator extends UIMenuNameableCreator { + public VanChartUIMenuNameableCreator(String name, FCloneable obj, Class paneClazz) { + super(name, obj, paneClazz); + } + /** + * 覆盖的clone方法 + */ + public UIMenuNameableCreator clone() { + Object cloneObj = null; + try { + cloneObj = ((FCloneable)obj).clone(); + } catch (CloneNotSupportedException e){ + FRLogger.getLogger().error("VanChartUIMenuNameableCreator CloneNotSupportedException"); + } + return new UIMenuNameableCreator(name, cloneObj, this.paneClazz); + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPane.java new file mode 100644 index 000000000..9fa866a0d --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPane.java @@ -0,0 +1,165 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.base.background.ImageBackground; +import com.fr.chart.chartglyph.GeneralInfo; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.UINumberDragPane; +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.mainframe.backgroundpane.BackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; +import com.fr.general.Background; +import com.fr.general.Inter; +import com.fr.stable.Constants; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; + +/** + * 图表 属性表.背景设置 界面.(包括 无, 颜色, 图片, 渐变)+开启阴影 + * 图片背景没有布局方式,默认为拉伸。 + */ +public class VanChartBackgroundPane extends BasicPane { + private static final long serialVersionUID = 6955952013135176051L; + private static final double ALPHA_V = 100.0; + protected List paneList; + + protected UIComboBox typeComboBox; + protected UINumberDragPane transparent; + protected UIToggleButton shadow; + + protected JPanel centerPane; + + public VanChartBackgroundPane() { + initComponents(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double[] columnSize = {p, f}; + double[] rowSize = { p,p,p,p,p}; + + JPanel panel = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Background"}, getPaneComponents(), rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + this.add(new JSeparator(), BorderLayout.SOUTH); + } + + protected void initComponents() { + typeComboBox = new UIComboBox(); + final CardLayout cardlayout = new CardLayout(); + paneList = new ArrayList(); + + initList(); + + centerPane = new JPanel(cardlayout) { + + @Override + public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度 + int index = typeComboBox.getSelectedIndex(); + return new Dimension(super.getPreferredSize().width, paneList.get(index).getPreferredSize().height); + } + }; + for (int i = 0; i < paneList.size(); i++) { + BackgroundQuickPane pane = paneList.get(i); + typeComboBox.addItem(pane.title4PopupWindow()); + centerPane.add(pane, pane.title4PopupWindow()); + } + + typeComboBox.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + cardlayout.show(centerPane, (String)typeComboBox.getSelectedItem()); + fireStateChanged(); + } + }); + + transparent = new UINumberDragPane(0, 100); + } + + protected Component[][] getPaneComponents() { + shadow = new UIToggleButton(Inter.getLocText("plugin-ChartF_OpenShadow")); + return new Component[][]{ + new Component[]{typeComboBox, null}, + new Component[]{centerPane, null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-Chart_Alpha")), transparent}, + new Component[]{shadow, null}, + }; + } + + protected void initList() { + paneList.add(new NullBackgroundQuickPane()); + paneList.add(new ColorBackgroundQuickPane()); + paneList.add(new ImageBackgroundQuickPane(false)); + paneList.add(new VanChartGradientPane()); + } + + + private void fireStateChanged() { + Object[] listeners = listenerList.getListenerList(); + ChangeEvent e = null; + + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ChangeListener.class) { + if (e == null) { + e = new ChangeEvent(this); + } + ((ChangeListener)listeners[i + 1]).stateChanged(e); + } + } + } + + /** + * 返回标题 + * @return 标题 + */ + public String title4PopupWindow() { + return ""; + } + + public void populate(GeneralInfo attr) { + if(attr == null) { + return; + } + Background background = attr.getBackground(); + double alpha = attr.getAlpha() * ALPHA_V; + transparent.populateBean(alpha); + if(shadow != null){ + shadow.setSelected(attr.isShadow()); + } + for (int i = 0; i < paneList.size(); i++) { + BackgroundQuickPane pane = paneList.get(i); + if (pane.accept(background)) { + pane.populateBean(background); + typeComboBox.setSelectedIndex(i); + return; + } + } + } + + public void update(GeneralInfo attr) { + if (attr == null) { + attr = new GeneralInfo(); + } + attr.setBackground(paneList.get(typeComboBox.getSelectedIndex()).updateBean()); + if(attr.getBackground() instanceof ImageBackground){ + ((ImageBackground) attr.getBackground()).setLayout(Constants.IMAGE_EXTEND); + } + attr.setAlpha((float) (transparent.updateBean() / ALPHA_V)); + if(shadow != null){ + attr.setShadow(shadow.isSelected()); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java new file mode 100644 index 000000000..99c853edf --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundPaneWithOutImageAndShadow.java @@ -0,0 +1,58 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 16/6/29. + * 默认+颜色.+透明度 + */ +public class VanChartBackgroundPaneWithOutImageAndShadow extends VanChartBackgroundPane { + + public VanChartBackgroundPaneWithOutImageAndShadow() { + initComponents(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double[] columnSize = {p, f}; + double[] rowSize = { p,p,p,p,p}; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(),rowSize,columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + @Override + protected void initList() { + paneList.add(new NullBackgroundQuickPane(){ + /** + * 名称 + * + * @return 名称 + */ + @Override + public String title4PopupWindow() { + return Inter.getLocText("Chart-Default_Name"); + } + }); + paneList.add(new ColorBackgroundQuickPane()); + } + + @Override + protected Component[][] getPaneComponents() { + return new Component[][]{ + new Component[]{typeComboBox, null}, + new Component[]{centerPane, null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-Chart_Alpha")), transparent}, + }; + } +} + diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java new file mode 100644 index 000000000..b39aa918a --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java @@ -0,0 +1,22 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; + +/** + * 图表 属性表.背景设置 界面.(包括 无, 颜色, 渐变)+开启阴影 + */ + +public class VanChartBackgroundWithOutImagePane extends VanChartBackgroundPane { + private static final long serialVersionUID = 1322979785605013853L; + + public VanChartBackgroundWithOutImagePane() { + super(); + } + + protected void initList() { + paneList.add(new NullBackgroundQuickPane()); + paneList.add(new ColorBackgroundQuickPane()); + paneList.add(new VanChartGradientPane()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java new file mode 100644 index 000000000..46b9a283e --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java @@ -0,0 +1,49 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.chart.chartglyph.GeneralInfo; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.general.Inter; + +import java.awt.*; + +/** + * 图表 属性表.背景设置 界面.(包括 无, 颜色, 渐变) + 圆角半径 + */ +public class VanChartBackgroundWithOutShadowWithRadiusPane extends VanChartBackgroundWithOutImagePane { + private static final long serialVersionUID = -3387661350545592763L; + + private UISpinner radius; + + public VanChartBackgroundWithOutShadowWithRadiusPane(){ + super(); + } + + protected Component[][] getPaneComponents() { + radius = new UISpinner(0,1000,1,0); + return new Component[][]{ + new Component[]{typeComboBox, null}, + new Component[]{centerPane, null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-Chart_Alpha")), transparent}, + new Component[]{new UILabel(Inter.getLocText("plugin-ChartF_Radius")+":"),radius} + }; + } + + public void populate(GeneralInfo attr) { + if(attr == null) { + return; + } + super.populate(attr); + radius.setValue(attr.getRoundRadius()); + + } + + public void update(GeneralInfo attr) { + super.update(attr); + if (attr == null) { + attr = new GeneralInfo(); + } + attr.setRoundRadius((int)radius.getValue()); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartGradientPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartGradientPane.java new file mode 100644 index 000000000..b4adb6606 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartGradientPane.java @@ -0,0 +1,105 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.base.background.GradientBackground; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; +import com.fr.design.style.background.gradient.FixedGradientBar; +import com.fr.general.Background; +import com.fr.general.Inter; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +/** + * 渐变色设置界面,bar无法拖拽 + */ +public class VanChartGradientPane extends GradientBackgroundQuickPane { + protected static final int CHART_GRADIENT_WIDTH = 150; + private static final long serialVersionUID = 256594362341221087L; + + private FixedGradientBar gradientBar; + private UIButtonGroup directionPane; + + public VanChartGradientPane() { + constructPane(); + } + + protected void constructPane(){ + String[] textArray = {Inter.getLocText("Utils-Left_to_Right"), Inter.getLocText("Utils-Top_to_Bottom")}; + Integer[] valueArray = {GradientBackground.LEFT2RIGHT, GradientBackground.TOP2BOTTOM}; + directionPane = new UIButtonGroup(textArray, valueArray); + directionPane.setSelectedIndex(0); + gradientBar = new FixedGradientBar(4, CHART_GRADIENT_WIDTH); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p, p, p}; + + Component[][] components = new Component[][]{ + new Component[]{gradientBar, null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-Chart_Gradient_Direction") + ":")}, + new Component[]{directionPane} + }; + JPanel Gradient = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(Gradient, BorderLayout.CENTER); + } + + public void populateBean(Background background) { + GradientBackground bg = (GradientBackground) background; + this.gradientBar.getSelectColorPointBtnP1().setColorInner(bg.getStartColor()); + this.gradientBar.getSelectColorPointBtnP2().setColorInner(bg.getEndColor()); + directionPane.setSelectedItem(bg.getDirection()); + this.gradientBar.repaint(); + } + + public GradientBackground updateBean() { + GradientBackground gb = new GradientBackground(gradientBar.getSelectColorPointBtnP1().getColorInner(), gradientBar.getSelectColorPointBtnP2().getColorInner()); + gb.setDirection(directionPane.getSelectedItem()); + + return gb; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(final UIObserverListener listener) { + gradientBar.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + directionPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + } + + /** + * 是否接受 + * @param background 背景 + * @return 是则返回true + */ + public boolean accept(Background background) { + return background instanceof GradientBackground; + } + + /** + * 名称 + * @return 名称 + */ + public String title4PopupWindow() { + return Inter.getLocText("Plugin-Chart_Gradient_Color"); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartMarkerBackgroundPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartMarkerBackgroundPane.java new file mode 100644 index 000000000..9bd5c773e --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/background/VanChartMarkerBackgroundPane.java @@ -0,0 +1,70 @@ +package com.fr.plugin.chart.designer.component.background; + +import com.fr.base.background.ColorBackground; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * 系列色(无背景颜色)、颜色面板 + */ +public class VanChartMarkerBackgroundPane extends VanChartBackgroundPane { + private static final long serialVersionUID = -1032221277140976934L; + + public VanChartMarkerBackgroundPane(){ + initComponents(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double[] columnSize = {p, f}; + double[] rowSize = {p, p}; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + protected Component[][] getPaneComponents() { + return new Component[][]{ + new Component[]{typeComboBox, null}, + new Component[]{centerPane, null} + }; + } + + protected void initList() { + paneList.add(new NullBackgroundQuickPane(){ + @Override + public String title4PopupWindow() { + return Inter.getLocText("Plugin-ChartF_SeriesColor"); + } + + }); + paneList.add(new ColorBackgroundQuickPane()); + } + + public void populate(ColorBackground colorBackground) { + if(colorBackground == null) { + return; + } + + for (int i = 0; i < paneList.size(); i++) { + BackgroundQuickPane pane = paneList.get(i); + if (pane.accept(colorBackground)) { + pane.populateBean(colorBackground); + typeComboBox.setSelectedIndex(i); + return; + } + } + } + + public ColorBackground update() { + return (ColorBackground)paneList.get(typeComboBox.getSelectedIndex()).updateBean(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderPane.java new file mode 100644 index 000000000..c70689287 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderPane.java @@ -0,0 +1,98 @@ +package com.fr.plugin.chart.designer.component.border; + + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.chartglyph.GeneralInfo; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.style.color.ColorSelectBox; +import com.fr.general.Inter; +import com.fr.stable.CoreConstants; + +import javax.swing.*; +import java.awt.*; + +//线型 + 颜色 +public class VanChartBorderPane extends BasicPane { + private static final long serialVersionUID = -7770029552989609464L; + protected LineComboBox currentLineCombo; + protected ColorSelectBox currentLineColorPane; + + public VanChartBorderPane() { + initComponents(); + } + + protected void initComponents() { + currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); + currentLineColorPane = new ColorSelectBox(100); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p,f }; + double[] rowSize = {p, p, p}; + Component[][] components = getUseComponent(); + JPanel panel = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Border"}, components, rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + } + + protected Component[][] getUseComponent() { + return new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle")+":"),currentLineCombo}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Color_Color")+":"),currentLineColorPane}, + }; + } + + /** + * 标题 + * @return 标题 + */ + public String title4PopupWindow() { + return null; + } + + public void populate(GeneralInfo attr) { + if(attr == null) { + return; + } + currentLineCombo.setSelectedLineStyle(attr.getBorderStyle()); + currentLineColorPane.setSelectObject(attr.getBorderColor()); + + } + + public void update(GeneralInfo attr) { + if(attr == null) { + attr = new GeneralInfo(); + } + attr.setBorderStyle(currentLineCombo.getSelectedLineStyle()); + attr.setBorderColor(currentLineColorPane.getSelectObject()); + + } + + public void update(AttrBorder attrBorder){ + if(attrBorder == null){ + return; + } + attrBorder.setBorderStyle(currentLineCombo.getSelectedLineStyle()); + attrBorder.setBorderColor(currentLineColorPane.getSelectObject()); + } + + public void populate(AttrBorder attr) { + if(attr == null) { + return; + } + currentLineCombo.setSelectedLineStyle(attr.getBorderStyle()); + currentLineColorPane.setSelectObject(attr.getBorderColor()); + } + + public AttrBorder update() { + AttrBorder attr = new AttrBorder(); + + attr.setBorderStyle(currentLineCombo.getSelectedLineStyle()); + attr.setBorderColor(currentLineColorPane.getSelectObject()); + + return attr; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithAlphaPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithAlphaPane.java new file mode 100644 index 000000000..a794f0cbc --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithAlphaPane.java @@ -0,0 +1,51 @@ +package com.fr.plugin.chart.designer.component.border; + +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.general.Inter; +import com.fr.plugin.chart.VanChartAttrHelper; +import com.fr.plugin.chart.base.AttrBorderWithAlpha; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Mitisky on 16/5/19. + * 边框,线型/颜色/不透明度 + */ +public class VanChartBorderWithAlphaPane extends VanChartBorderPane{ + private UINumberDragPane transparent; + + @Override + protected void initComponents() { + transparent = new UINumberDragPane(0,100); + this.add(new JSeparator(), BorderLayout.SOUTH); + + super.initComponents(); + } + + @Override + protected Component[][] getUseComponent() { + return new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle")+":"),currentLineCombo}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Color_Color")+":"),currentLineColorPane}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Alpha")+":"), transparent} + }; + } + + public void populate(AttrBorderWithAlpha attr) { + if(attr == null){ + return; + } + super.populate(attr); + transparent.populateBean(attr.getAlpha() * VanChartAttrHelper.PERCENT); + } + + @Override + public AttrBorderWithAlpha update() { + AttrBorderWithAlpha attrBorderWithAlpha = new AttrBorderWithAlpha(); + super.update(attrBorderWithAlpha); + attrBorderWithAlpha.setAlpha(transparent.updateBean()/ VanChartAttrHelper.PERCENT); + return attrBorderWithAlpha; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithRadiusPane.java b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithRadiusPane.java new file mode 100644 index 000000000..9f6fa8ee2 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/border/VanChartBorderWithRadiusPane.java @@ -0,0 +1,66 @@ +package com.fr.plugin.chart.designer.component.border; + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.chartglyph.GeneralInfo; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * 线型 + 颜色 + 圆角半径 + */ +public class VanChartBorderWithRadiusPane extends VanChartBorderPane { + private static final long serialVersionUID = -3937853702118283803L; + private UISpinner radius; + + @Override + protected void initComponents() { + radius = new UISpinner(0,1000,1,0); + this.add(new JSeparator(), BorderLayout.SOUTH); + super.initComponents(); + } + + @Override + protected Component[][] getUseComponent() { + return new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_LineStyle")+":"),currentLineCombo}, + new Component[]{new UILabel(Inter.getLocText("FR-Chart-Color_Color")+":"),currentLineColorPane}, + new Component[]{new UILabel(Inter.getLocText("plugin-ChartF_Radius")+":"),radius} + } ; + } + + public void populate(GeneralInfo attr) { + super.populate(attr); + if(attr == null) { + return; + } + radius.setValue(attr.getRoundRadius()); + } + + public void update(GeneralInfo attr) { + super.update(attr); + attr.setRoundRadius((int)radius.getValue()); + } + + public void update(AttrBorder attrBorder) { + super.update(attrBorder); + attrBorder.setRoundRadius((int)radius.getValue()); + } + + public void populate(AttrBorder attr) { + super.populate(attr); + if(attr == null) { + return; + } + radius.setValue(attr.getRoundRadius()); + } + + public AttrBorder update() { + AttrBorder attr = super.update(); + attr.setRoundRadius((int)radius.getValue()); + return attr; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java new file mode 100644 index 000000000..c96f64d49 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/2/23. + */ +public class CategoryNameFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + private static final long serialVersionUID = -782523079199004032L; + + public CategoryNameFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Chart-Category_Name"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedPercentFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedPercentFormatPaneWithCheckBox.java new file mode 100644 index 000000000..2f510e465 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedPercentFormatPaneWithCheckBox.java @@ -0,0 +1,25 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by mengao on 2017/6/5. + */ +public class ChangedPercentFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + public ChangedPercentFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Plugin-ChartF_Change_Percent"); + } + + protected boolean isPercent() { + return true; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedValueFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedValueFormatPaneWithCheckBox.java new file mode 100644 index 000000000..2c5832493 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ChangedValueFormatPaneWithCheckBox.java @@ -0,0 +1,21 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by mengao on 2017/6/9. + */ +public class ChangedValueFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox{ + + public ChangedValueFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Plugin-ChartF_Change_Value"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/MapAreaNameFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/MapAreaNameFormatPaneWithCheckBox.java new file mode 100644 index 000000000..01fdaade9 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/MapAreaNameFormatPaneWithCheckBox.java @@ -0,0 +1,21 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/5/20. + * 地图的标签区域名只是改了之前的分类名的名字,读写什么的都一样 + */ +public class MapAreaNameFormatPaneWithCheckBox extends CategoryNameFormatPaneWithCheckBox { + public MapAreaNameFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("FR-Chart-Area_Name"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/PercentFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/PercentFormatPaneWithCheckBox.java new file mode 100644 index 000000000..1324456a3 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/PercentFormatPaneWithCheckBox.java @@ -0,0 +1,27 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/2/23. + */ +public class PercentFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + private static final long serialVersionUID = 566737138492111631L; + + public PercentFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Chart-Use_Percent"); + } + + protected boolean isPercent() { + return true; + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/SeriesNameFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/SeriesNameFormatPaneWithCheckBox.java new file mode 100644 index 000000000..b2ad7bb6e --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/SeriesNameFormatPaneWithCheckBox.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/2/23. + */ +public class SeriesNameFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + private static final long serialVersionUID = 6456517419221601327L; + + public SeriesNameFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Chart-Series_Name"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/ValueFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ValueFormatPaneWithCheckBox.java new file mode 100644 index 000000000..f076cd9d3 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/ValueFormatPaneWithCheckBox.java @@ -0,0 +1,23 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.general.Inter; +import com.fr.plugin.chart.designer.style.VanChartStylePane; + +import javax.swing.*; + +/** + * Created by Mitisky on 16/2/23. + */ +public class ValueFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + private static final long serialVersionUID = -8793617093976412625L; + + public ValueFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Inter.getLocText("Chart-Use_Value"); + } +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/component/format/VanChartFormatPaneWithCheckBox.java b/designer_chart/src/com/fr/plugin/chart/designer/component/format/VanChartFormatPaneWithCheckBox.java new file mode 100644 index 000000000..c91bb4495 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/component/format/VanChartFormatPaneWithCheckBox.java @@ -0,0 +1,137 @@ +package com.fr.plugin.chart.designer.component.format; + +import com.fr.base.Style; +import com.fr.design.gui.frpane.UIBubbleFloatPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.style.FormatPane; +import com.fr.general.Inter; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.designer.style.VanChartStylePane; +import com.fr.stable.Constants; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.text.Format; + +/** + * Created by Mitisky on 16/2/23. + */ +public abstract class VanChartFormatPaneWithCheckBox extends JPanel{ + private static final long serialVersionUID = -6563172546340480058L; + + private UICheckBox isSelectedBox; + private UIButton formatButton; + private FormatPane formatPane; + private Format format; + + private VanChartStylePane parent; + private JPanel showOnPane; + + private boolean isDirty; + + public VanChartFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + this.parent = parent; + this.showOnPane = showOnPane; + this.isDirty = true; + + this.setLayout(new BorderLayout()); + isSelectedBox = new UICheckBox(getCheckBoxText()); + formatButton = new UIButton(Inter.getLocText("Chart-Use_Format")); + this.add(isSelectedBox, BorderLayout.CENTER); + this.add(formatButton, BorderLayout.EAST); + + initFormatListener(); + isSelectedBox.addMouseListener(new MouseListener() { + @Override + public void mouseClicked(MouseEvent e) { + isDirty = true; + } + + @Override + public void mousePressed(MouseEvent e) { + + } + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } + }); + } + + protected abstract String getCheckBoxText(); + + protected boolean isPercent() { + return false; + } + + private void initFormatListener() { + if(formatButton != null) { + formatButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent e) { + if (!formatButton.isEnabled()) { + return; + } + + if(formatPane == null) { + formatPane = createFormatPane(); + } + Point comPoint = formatButton.getLocationOnScreen(); + Point arrowPoint = new Point(comPoint.x + formatButton.getWidth(), comPoint.y + formatButton.getHeight()); + UIBubbleFloatPane