diff --git a/.gitattributes b/.gitattributes index 8e948c534..9b9bf8f8a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,529 @@ * text=auto !eol +designer_chart/.classpath -text +designer_chart/.project -text +designer_chart/designer_chart.iml -text +designer_chart/src/com/fr/design/ChartEnvManager.java -text +designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java -text +designer_chart/src/com/fr/design/chart/ChartAxisFactory.java -text +designer_chart/src/com/fr/design/chart/ChartCommonWizardPane.java -text +designer_chart/src/com/fr/design/chart/ChartComponentPane.java -text +designer_chart/src/com/fr/design/chart/ChartControlPane.java -text +designer_chart/src/com/fr/design/chart/ChartDialog.java -text +designer_chart/src/com/fr/design/chart/ChartPlotFactory.java -text +designer_chart/src/com/fr/design/chart/ChartSwingUtils.java -text +designer_chart/src/com/fr/design/chart/ChartTypePane.java -text +designer_chart/src/com/fr/design/chart/ChartWizardPane.java -text +designer_chart/src/com/fr/design/chart/FactoryObject.java -text +designer_chart/src/com/fr/design/chart/axis/AxisStyleObject.java -text +designer_chart/src/com/fr/design/chart/axis/AxisStylePane.java -text +designer_chart/src/com/fr/design/chart/axis/BinaryChartStyleAxisPane.java -text +designer_chart/src/com/fr/design/chart/axis/ChartAlertLinePane.java -text +designer_chart/src/com/fr/design/chart/axis/ChartAlertValueInTopBottomPane.java -text +designer_chart/src/com/fr/design/chart/axis/ChartAlertValuePane.java -text +designer_chart/src/com/fr/design/chart/axis/ChartStyleAxisPane.java -text +designer_chart/src/com/fr/design/chart/axis/CustomChartStyleAxisPane.java -text +designer_chart/src/com/fr/design/chart/axis/GanntChartStyleAxisPane.java -text +designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java -text +designer_chart/src/com/fr/design/chart/axis/RadarChartStyleAxisPane.java -text +designer_chart/src/com/fr/design/chart/axis/TernaryChartStyleAxisPane.java -text +designer_chart/src/com/fr/design/chart/axis/ValueChartStyleAxisPane.java -text +designer_chart/src/com/fr/design/chart/axis/XYChartStyleAxisPane.java -text +designer_chart/src/com/fr/design/chart/comp/BorderAttriPane.java -text +designer_chart/src/com/fr/design/chart/demo/GlyphDemo.java -text +designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java -text +designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java -text +designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java -text +designer_chart/src/com/fr/design/chart/gui/ActiveGlyphFactory.java -text +designer_chart/src/com/fr/design/chart/gui/ChartComponent.java -text +designer_chart/src/com/fr/design/chart/gui/ChartWidgetOption.java -text +designer_chart/src/com/fr/design/chart/gui/active/ActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/AlertValueActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/AxisActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/CategoryAxisActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/ChartActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/DataLabelActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/DataSheetActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/DateAxisActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/LegendActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/PlotActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/RadarAxisActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/RangeAxisActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/TextActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/TrendLineActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/ValueAxisActiveGlyph.java -text +designer_chart/src/com/fr/design/chart/gui/active/action/ChartComponentAction.java -text +designer_chart/src/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java -text +designer_chart/src/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java -text +designer_chart/src/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java -text +designer_chart/src/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java -text +designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSeriesAttrAction.java -text +designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSheetAction.java -text +designer_chart/src/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java -text +designer_chart/src/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java -text +designer_chart/src/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java -text +designer_chart/src/com/fr/design/chart/javascript/ChartEmailPane.java -text +designer_chart/src/com/fr/design/chart/report/GisMapDataPane.java -text +designer_chart/src/com/fr/design/chart/report/GisMapDataPane4Chart.java -text +designer_chart/src/com/fr/design/chart/report/GisMapReportDataContentPane.java -text +designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane.java -text +designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane4Chart.java -text +designer_chart/src/com/fr/design/chart/report/MapCubeDataPane.java -text +designer_chart/src/com/fr/design/chart/report/MapCubeDataPane4Chart.java -text +designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java -text +designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java -text +designer_chart/src/com/fr/design/chart/report/MapDataPane.java -text +designer_chart/src/com/fr/design/chart/report/MapDataPane4Chart.java -text +designer_chart/src/com/fr/design/chart/report/MapMoreCubeLayerPane.java -text +designer_chart/src/com/fr/design/chart/report/MapMoreCubeLayerPane4Chart.java -text +designer_chart/src/com/fr/design/chart/report/MapMoreReportIndexPane.java -text +designer_chart/src/com/fr/design/chart/report/MapMoreTableIndexPane.java -text +designer_chart/src/com/fr/design/chart/report/MapReportCubeDataPane.java -text +designer_chart/src/com/fr/design/chart/report/MapReportDataSinglePane.java -text +designer_chart/src/com/fr/design/chart/report/MapReportEditor.java -text +designer_chart/src/com/fr/design/chart/report/MapReportRenderer.java -text +designer_chart/src/com/fr/design/chart/report/MapSinglePane.java -text +designer_chart/src/com/fr/design/chart/report/MapSinglePane4Chart.java -text +designer_chart/src/com/fr/design/chart/report/MapTableCubeDataPane.java -text +designer_chart/src/com/fr/design/chart/report/MapTableCubeDataPane4Chart.java -text +designer_chart/src/com/fr/design/chart/report/MapTableDataSinglePane.java -text +designer_chart/src/com/fr/design/chart/report/MapTableDataSinglePane4Chart.java -text +designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java -text +designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java -text +designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java -text +designer_chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java -text +designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java -text +designer_chart/src/com/fr/design/chart/series/PlotSeries/MapSelectShape.java -text +designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java -text +designer_chart/src/com/fr/design/chart/series/PlotStyle/ChartSelectDemoPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/BubblePlotChartConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/ChartConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/ChartConditionPaneFactory.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/ConditionTrendLinePane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataLabelContentsPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataLabelStylePane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrCustomPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesCustomConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/GanttPlotChartConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelAxisPositionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBackgroundPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBorderAttrPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBorderPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelColorPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelContentsPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelLineStylePane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/LineMarkerTypePane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/MapPlotChartConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/PiePlotChartConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/TooltipContentsPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLineControlPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLinePane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/XYPlotChartConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/AreaDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/Bar2DDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/Bar3DDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/BubbleDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/DataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/GanttDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/LineDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MapDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MeterDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/PieDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/RadarDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/RangeDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/StockDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/XYDataLabelPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Area3DPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/AreaPlotDataSeriesCondtionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Bar2DTrendLineDSConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Bar3DPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/BarPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/BubblePlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPopAttrPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4AreaConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4BarNoTrendLineConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4BarTrendLineConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4LineConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/DataSeriesConditionPaneFactory.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Donut2DPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/GanttPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/LinePlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/MapPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/MeterPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Pie3DPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/PiePlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/RadarPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/StockPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/XYScatterPlotDataSeriesConditionPane.java -text +designer_chart/src/com/fr/design/chartinterface/AreaIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/BarIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/BubbleIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/ColumnIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/CustomIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/DonutIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/GanttIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/GisMapIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/LineIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/MapIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/MeterIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/PieIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/RadarIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/RangeIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/StockIndependentChartInterface.java -text +designer_chart/src/com/fr/design/chartinterface/XYScatterIndependentChartInterface.java -text +designer_chart/src/com/fr/design/gui/xcombox/ComboBoxUseEditor.java -text +designer_chart/src/com/fr/design/gui/xcombox/MarkerComboBox.java -text +designer_chart/src/com/fr/design/images/add.png -text +designer_chart/src/com/fr/design/images/chart.png -text +designer_chart/src/com/fr/design/images/copyjs.png -text +designer_chart/src/com/fr/design/images/del.png -text +designer_chart/src/com/fr/design/images/exportimg.png -text +designer_chart/src/com/fr/design/images/newchart_normal.png -text +designer_chart/src/com/fr/design/images/newchart_over.png -text +designer_chart/src/com/fr/design/images/newchart_press.png -text +designer_chart/src/com/fr/design/images/splash4Chart.png -text +designer_chart/src/com/fr/design/images/toolbar/area/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/area/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/area/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/area/1_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/area/1_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/area/1_over.png -text +designer_chart/src/com/fr/design/images/toolbar/area/2_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/area/2_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/area/2_over.png -text +designer_chart/src/com/fr/design/images/toolbar/area/3_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/area/3_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/area/3_over.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/1_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/1_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/1_over.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/2_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/2_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/2_over.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/3_gary.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/3_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/3_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/3_over.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/4_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/4_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/4_over.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/5_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/5_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/5_over.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/6_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/6_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/bar/6_over.png -text +designer_chart/src/com/fr/design/images/toolbar/border.png -text +designer_chart/src/com/fr/design/images/toolbar/bubble/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/bubble/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/bubble/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/column/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/column/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/column/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/column/1_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/column/1_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/column/1_over.png -text +designer_chart/src/com/fr/design/images/toolbar/column/2_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/column/2_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/column/2_over.png -text +designer_chart/src/com/fr/design/images/toolbar/column/3_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/column/3_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/column/3_over.png -text +designer_chart/src/com/fr/design/images/toolbar/column/4_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/column/4_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/column/4_over.png -text +designer_chart/src/com/fr/design/images/toolbar/column/5_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/column/5_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/column/5_over.png -text +designer_chart/src/com/fr/design/images/toolbar/column/6_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/column/6_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/column/6_over.png -text +designer_chart/src/com/fr/design/images/toolbar/custom/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/custom/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/custom/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/donut/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/donut/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/donut/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/donut/1_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/donut/1_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/donut/1_over.png -text +designer_chart/src/com/fr/design/images/toolbar/funnel/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/funnel/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/funnel/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/gantt/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/gantt/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/gantt/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/gis/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/gis/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/gis/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/gis/1_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/gis/1_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/gis/1_over.png -text +designer_chart/src/com/fr/design/images/toolbar/line/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/line/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/line/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/map/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/map/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/map/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/meter/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/meter/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/meter/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/meter/1_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/meter/1_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/meter/1_over.png -text +designer_chart/src/com/fr/design/images/toolbar/meter/2_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/meter/2_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/meter/2_over.png -text +designer_chart/src/com/fr/design/images/toolbar/pie/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/pie/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/pie/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/pie/1_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/pie/1_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/pie/1_over.png -text +designer_chart/src/com/fr/design/images/toolbar/radar/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/radar/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/radar/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/range/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/range/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/range/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/stock/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/stock/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/stock/0_over.png -text +designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_gray.png -text +designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_normal.png -text +designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_over.png -text +designer_chart/src/com/fr/design/mainframe/AbstractChartDataPane4Chart.java -text +designer_chart/src/com/fr/design/mainframe/AbstractMapPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/ChartAndWidgetPropertyPane.java -text +designer_chart/src/com/fr/design/mainframe/ChartArea.java -text +designer_chart/src/com/fr/design/mainframe/ChartDesigner.java -text +designer_chart/src/com/fr/design/mainframe/ChartDesignerPropertyPane.java -text +designer_chart/src/com/fr/design/mainframe/ChartDesignerUI.java -text +designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java -text +designer_chart/src/com/fr/design/mainframe/ChartToolBarPane.java -text +designer_chart/src/com/fr/design/mainframe/ChartUndoState.java -text +designer_chart/src/com/fr/design/mainframe/DesignerFrame4Chart.java -text +designer_chart/src/com/fr/design/mainframe/GisMapPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/JChart.java -text +designer_chart/src/com/fr/design/mainframe/MapArrayPane.java -text +designer_chart/src/com/fr/design/mainframe/MapEditPane.java -text +designer_chart/src/com/fr/design/mainframe/MapPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java -text +designer_chart/src/com/fr/design/mainframe/PlotToolBarFactory.java -text +designer_chart/src/com/fr/design/mainframe/TargetComponentContainer.java -text +designer_chart/src/com/fr/design/mainframe/ToolTip4Chart.java -text +designer_chart/src/com/fr/design/mainframe/actions/AbstractExportAction4JChart.java -text +designer_chart/src/com/fr/design/mainframe/actions/ChartDownLoadWorker.java -text +designer_chart/src/com/fr/design/mainframe/actions/ChartFeedBackAciton.java -text +designer_chart/src/com/fr/design/mainframe/actions/ChartUpdateAction.java -text +designer_chart/src/com/fr/design/mainframe/actions/ChartWebAction.java -text +designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java -text +designer_chart/src/com/fr/design/mainframe/actions/JChartAction.java -text +designer_chart/src/com/fr/design/mainframe/actions/NewChartAction.java -text +designer_chart/src/com/fr/design/mainframe/actions/OpenChartAction.java -text +designer_chart/src/com/fr/design/mainframe/actions/PDFExportAction4Chart.java -text +designer_chart/src/com/fr/design/mainframe/actions/PNGExportAction4Chart.java -text +designer_chart/src/com/fr/design/mainframe/actions/UpdateOnlineAction.java -text +designer_chart/src/com/fr/design/mainframe/actions/UpdateVersion.java -text +designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/AttributeChange.java -text +designer_chart/src/com/fr/design/mainframe/chart/ChartDesignEditPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/ChartHyperEditPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/PaneTitleConstants.java -text +designer_chart/src/com/fr/design/mainframe/chart/UpdateOnLinePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDesignerDataPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDesignerOtherPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/ChartOtherPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/ChartStylePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/StylePane4Chart.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/ChartDesignDataLoadPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/DataContentsPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/EmbbeddDataPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/ExcelDataPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/ImportSetChartDataPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/JSONDataPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/PresentComboBox.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/BubblePlotReportDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/GanttPlotReportDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/PiePlotReportDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/StockPlotReportDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/XYScatterPlotReportDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/BubblePlotTableDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/Factory4TableDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/GanttPlotTableDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/PiePlotTableDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/StockPlotTableDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/XYScatterPlotTableDataContentPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartConditionAttrPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerConditionAttrPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerInteractivePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/other/TimeSwitchPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/AbstractChartTabPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartAccColorPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartAxisLabelPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartAxisLineStylePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartAxisTitleNoFormulaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartAxisTitlePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartAxisValueTypePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartBackgroundNoImagePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartBackgroundPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartBeautyPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartBorderPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4GisPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartDataPointLabel4MapPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartPreFillStylePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/DateAxisValuePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/analysisline/ChartAnalysisLinePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartAreaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartAxisAreaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartPlotAreaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/ChartWholeAreaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/DefaultAxisAreaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/Plot3DAxisAreaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/area/RadarAxisAreaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisNoFormulaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartAxisUsePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartCategoryNoFormulaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartCategoryPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartPercentValueNoFormulaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartPercentValuePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartRadarPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartSecondValueNoFormulaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartSecondValuePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartValueNoFormulaPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/datalabel/ChartDataLabelPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/datalabel/ChartLabelFontPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/datasheet/ChartDatasheetPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/legend/AutoSelectedPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/legend/ChartLegendPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/AbstractPlotSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/Area3DSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/AreaSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/Bar2DSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/Bar3DSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/BubbleSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/ChartSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneWithFormula.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/CombinedBar2DSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/CombinedBubbleSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/CombinedPie2DSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/CustomSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/Donut2DSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/FunnelSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/MapColorPickerPaneWithFormula.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/MapSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/MapSeriesPane4ChartDesigner.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/MeterSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/MeterSeriesPane4ChartDesigner.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/Pie2DSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/Pie3DSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/RangeSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/SeriesPane4ChartDesigner.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/StockSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane4Map.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/series/XYScatterSeriesPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/style/title/ChartTitlePaneNoFormula.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/AreaPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/BarPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/BarPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/BubblePlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartDesignerImagePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartTabPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/ColumnPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/ColumnPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/CustomPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/DonutPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/GanttPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/LinePlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/MeterPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/PiePlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/PlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/RadarPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/RangePlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/StockPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/XYSCatterPlotPane4ToolBar.java -text +designer_chart/src/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java -text +designer_chart/src/com/fr/design/mainframe/exporter/ExcelExporter4Chart.java -text +designer_chart/src/com/fr/design/mainframe/exporter/Exporter4Chart.java -text +designer_chart/src/com/fr/design/mainframe/exporter/ImageExporter4Chart.java -text +designer_chart/src/com/fr/design/mainframe/exporter/PdfExporter4Chart.java -text +designer_chart/src/com/fr/design/module/ChartDesignerModule.java -text +designer_chart/src/com/fr/design/module/ChartHyperlinkGroup.java -text +designer_chart/src/com/fr/design/module/ChartPreStyleAction.java -text +designer_chart/src/com/fr/design/module/ChartPreStyleManagerPane.java -text +designer_chart/src/com/fr/design/module/ChartPreStylePane.java -text +designer_chart/src/com/fr/design/module/ChartStartModule.java -text +designer_chart/src/com/fr/design/module/FormHyperlinkGroup.java -text +designer_chart/src/com/fr/file/FILEChooserPane4Chart.java -text +designer_chart/src/com/fr/start/ChartSplashPane.java -text +designer_chart/src/com/fr/start/Designer4Chart.java -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..d61aea28b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +designer_chart/bin diff --git a/designer_chart/.classpath b/designer_chart/.classpath new file mode 100644 index 000000000..9cb17f77c --- /dev/null +++ b/designer_chart/.classpath @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/designer_chart/.project b/designer_chart/.project new file mode 100644 index 000000000..b539f4c45 --- /dev/null +++ b/designer_chart/.project @@ -0,0 +1 @@ + designer_chart org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature \ No newline at end of file diff --git a/designer_chart/designer_chart.iml b/designer_chart/designer_chart.iml new file mode 100644 index 000000000..cde6262d7 --- /dev/null +++ b/designer_chart/designer_chart.iml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/ChartEnvManager.java b/designer_chart/src/com/fr/design/ChartEnvManager.java new file mode 100644 index 000000000..0f32ed408 --- /dev/null +++ b/designer_chart/src/com/fr/design/ChartEnvManager.java @@ -0,0 +1,188 @@ +package com.fr.design; + +import com.fr.base.FRContext; +import com.fr.base.Utils; +import com.fr.general.ComparatorUtils; +import com.fr.general.DateUtils; +import com.fr.general.IOUtils; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; +import com.fr.stable.xml.*; + +import java.io.*; +import java.util.Date; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class ChartEnvManager implements XMLReadable, XMLWriter { + public static final String ACTIVE_KEY = "RXWY-A25421-K58F47757-7373"; + private static final int ONE_MONTH_SECOND = 30*24*60*60;//30天,以秒为单位 + private static final int MS =1000; + + boolean isPushUpdateAuto = true; //是否自动推送更新 + + private String activationKey = null; + + private static ChartEnvManager chartEnvManager; + + private Date lastCheckDate; + + private long checkTimeSpan =ONE_MONTH_SECOND; + + /** + * DesignerEnvManager. + */ + public static ChartEnvManager getEnvManager() { + if(chartEnvManager == null){ + chartEnvManager = new ChartEnvManager(); + try { + XMLTools.readFileXML(chartEnvManager, chartEnvManager.getDesignerEnvFile()); + }catch (Exception exp){ + FRContext.getLogger().error(exp.getMessage(), exp); + } + } + return chartEnvManager; + } + + private static File envFile = new File(ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "ChartEnv.xml"); + + private File getEnvFile() { + return envFile; + } + + + private File getDesignerEnvFile() { + File envFile = getEnvFile(); + if (!envFile.exists()) { + createEnvFile(envFile); + } + + return envFile; + } + + + private void createEnvFile(File envFile) { + try { + FileWriter fileWriter = new FileWriter(envFile); + StringReader stringReader = new StringReader(""); + Utils.copyCharTo(stringReader, fileWriter); + stringReader.close(); + fileWriter.close(); + } catch (IOException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + + /** + * 返回激活码 + */ + public String getActivationKey() { + return activationKey; + } + + /** + * 设置激活码 + */ + public void setActivationKey(String activationKey) { + this.activationKey = activationKey; + } + + public void setPushUpdateAuto(boolean isPushUpdateAuto){ + this.isPushUpdateAuto = isPushUpdateAuto; + if(!this.isPushUpdateAuto){ + lastCheckDate = new Date(); + } + } + + /** + * 是否设置了自动推送图表设计器在线更行 + * @return 是则返回true + */ + public boolean isPushUpdateAuto(){ + return isPushUpdateAuto; + } + + /** + *在设置不自动推送在线更新的情况下,每30天自动检测一次 + * @return 是否需要检测 + */ + public boolean isOverOneMonth(){ + return !isPushUpdateAuto && ((new Date().getTime()-lastCheckDate.getTime())/MS>=checkTimeSpan); + } + + /*** + * 重新设置最新检查的日期 + */ + public void resetCheckDate(){ + this.lastCheckDate = new Date(); + } + + @Override + public void readXML(XMLableReader reader) { + if (reader.isChildNode()) { + String name = reader.getTagName(); + if(ComparatorUtils.equals(name,"ChartAttributes")){ + activationKey = reader.getAttrAsString("activationKey",null); + isPushUpdateAuto = reader.getAttrAsBoolean("isPushUpdateAuto",true); + checkTimeSpan = reader.getAttrAsLong("checkTimeSpan",ONE_MONTH_SECOND); + String date = reader.getAttrAsString("lastCheckDate", null); + if(!StringUtils.isEmpty(date)){ + lastCheckDate = DateUtils.string2Date(date,true); + } else { + lastCheckDate = new Date(); + } + } + } + + } + + @Override + public void writeXML(XMLPrintWriter writer) { + writer.startTAG("ChartDesigner"); + writer.startTAG("ChartAttributes").attr("activationKey",activationKey) + .attr("isPushUpdateAuto",isPushUpdateAuto) + .attr("checkTimeSpan",checkTimeSpan) + .attr("lastCheckDate", DateUtils.getDate2LStr(lastCheckDate)) + .end(); + writer.end(); + } + + /** + * 保存设计器的配置文件, 该文件不在env的resource目录下 + * 而是在Consts.getEnvHome() + File.separator + Consts.APP_NAME + * + * + * @date 2014-9-29-上午11:04:23 + */ + public void saveXMLFile() { + File xmlFile = this.getDesignerEnvFile(); + if (xmlFile == null) { + return; + } + if (!xmlFile.getParentFile().exists()) {//建立目录. + StableUtils.mkdirs(xmlFile.getParentFile()); + } + + String tempName = xmlFile.getName() + ProjectConstants.TEMP_SUFFIX; + File tempFile = new File(xmlFile.getParentFile(), tempName); + + writeTempFile(tempFile); + IOUtils.renameTo(tempFile, xmlFile); + } + + private void writeTempFile(File tempFile){ + try{ + OutputStream fout = new FileOutputStream(tempFile); + XMLTools.writeOutputStreamXML(this, fout); + fout.flush(); + fout.close(); + }catch (Exception e) { + FRContext.getLogger().error(e.getMessage()); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java new file mode 100644 index 000000000..a4947058d --- /dev/null +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -0,0 +1,211 @@ +package com.fr.design; + +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.chart.fun.IndependentChartUIProvider; +import com.fr.design.chartinterface.*; +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.table.AbstractTableDataContentPane; +import com.fr.file.XMLFileManager; +import com.fr.general.FRLogger; +import com.fr.general.GeneralContext; +import com.fr.plugin.PluginCollector; +import com.fr.plugin.PluginLicenseManager; +import com.fr.plugin.PluginMessage; +import com.fr.stable.EnvChangedListener; +import com.fr.stable.StringUtils; +import com.fr.stable.fun.Authorize; +import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; +import com.fr.stable.plugin.PluginSimplify; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLableReader; + +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by eason on 14/12/29. + */ +public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider { + + private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); + + private static ChartTypeInterfaceManager classManager = null; + + private static LinkedHashMap chartTypeInterfaces = new LinkedHashMap(); + + public synchronized static ChartTypeInterfaceManager getInstance() { + if (classManager == null) { + classManager = new ChartTypeInterfaceManager(); + chartTypeInterfaces.clear(); + classManager.readDefault(); + classManager.readXMLFile(); + } + return classManager; + } + + static { + GeneralContext.addEnvChangedListener(new EnvChangedListener() { + public void envChanged() { + ChartTypeInterfaceManager.envChanged(); + } + }); + } + + private synchronized static void envChanged() { + classManager = null; + } + + private static void readDefault() { + + chartTypeInterfaces.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.PIE_CHART, new PieIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.METER_CHART, new MeterIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); + + + } + + public String getIconPath(String plotID) { + return chartTypeInterfaces.get(plotID).getIconPath(); + } + + /** + * 增加界面接口定义 + * + * @param className 类名 + * @param plotID 标志ID + */ + public void addChartInterface(String className, String plotID, PluginSimplify simplify) { + if (StringUtils.isNotBlank(className)) { + try { + Class clazz = loader.loadClass(className); + Authorize authorize = clazz.getAnnotation(Authorize.class); + if (authorize != null) { + PluginLicenseManager.getInstance().registerPaid(authorize, simplify); + } + IndependentChartUIProvider provider = (IndependentChartUIProvider) clazz.newInstance(); + if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) { + PluginMessage.remindUpdate(className); + } else if (!chartTypeInterfaces.containsKey(plotID)) { + chartTypeInterfaces.put(plotID, provider); + } + } catch (ClassNotFoundException e) { + FRLogger.getLogger().error("class not found:" + e.getMessage()); + } catch (IllegalAccessException | InstantiationException e) { + FRLogger.getLogger().error("object create error:" + e.getMessage()); + } + } + } + + //UI对应的chart如果没有加载,UI也不必加进去了 + private boolean containsChart(String plotID) { + return ChartTypeManager.getInstance().containsPlot(plotID); + } + + /** + * 把所有的pane加到list里 + * + * @param paneList pane容器 + */ + public void addPlotTypePaneList(List> paneList) { + + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = (Map.Entry) iterator.next(); + IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue(); + paneList.add(creator.getPlotTypePane()); + } + + } + + public AbstractChartAttrPane[] getAttrPaneArray(String plotID, AttributeChangeListener listener) { + return chartTypeInterfaces.get(plotID).getAttrPaneArray(listener); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { + return chartTypeInterfaces.get(plot.getPlotID()).getTableDataSourcePane(plot, parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { + return chartTypeInterfaces.get(plot.getPlotID()).getReportDataSourcePane(plot, parent); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot) { + return chartTypeInterfaces.get(plot.getPlotID()).getPlotConditionPane(plot); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { + return chartTypeInterfaces.get(plot.getPlotID()).getPlotSeriesPane(parent, plot); + } + + /** + * 是否使用默认的界面,为了避免界面来回切换 + * + * @param plotID 序号 + * @return 是否使用默认的界面 + */ + public boolean isUseDefaultPane(String plotID) { + + if (chartTypeInterfaces.containsKey(plotID)) { + return chartTypeInterfaces.get(plotID).isUseDefaultPane(); + } + + return true; + } + + public void readXML(XMLableReader reader) { + readXML(reader, null, PluginSimplify.NULL); + } + + @Override + public void readXML(XMLableReader reader, List extraChartDesignInterfaceList, PluginSimplify simplify) { + if (reader.isChildNode()) { + String tagName = reader.getTagName(); + if (extraChartDesignInterfaceList != null) { + extraChartDesignInterfaceList.add(tagName); + } + if (IndependentChartUIProvider.XML_TAG.equals(tagName)) { + addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("plotID", ""), simplify); + } + } + } + + /** + * 文件名 + * + * @return 文件名 + */ + public String fileName() { + return "chart.xml"; + } + + @Override + public void writeXML(XMLPrintWriter writer) { + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/ChartAxisFactory.java b/designer_chart/src/com/fr/design/chart/ChartAxisFactory.java new file mode 100644 index 000000000..52233bb6d --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/ChartAxisFactory.java @@ -0,0 +1,55 @@ +package com.fr.design.chart; + +import com.fr.base.FRContext; +import com.fr.chart.chartattr.Axis; +import com.fr.chart.chartattr.CategoryAxis; +import com.fr.chart.chartattr.RadarAxis; +import com.fr.chart.chartattr.ValueAxis; +import com.fr.design.mainframe.chart.gui.style.axis.*; +import com.fr.general.ComparatorUtils; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-6 + * Time : 上午11:19 + */ +public class ChartAxisFactory { + private static final String PERCENT = "Percent"; + private static final String SECOND = "Second"; + + private static Map> map = new HashMap>(); + + static { + map.put(ValueAxis.class.getName(), ChartValuePane.class); + map.put(RadarAxis.class.getName(), ChartRadarPane.class); + map.put(CategoryAxis.class.getName(), ChartCategoryPane.class); + map.put(ValueAxis.class.getName() + PERCENT, ChartPercentValuePane.class); + map.put(ValueAxis.class.getName() + SECOND, ChartSecondValuePane.class); + } + private ChartAxisFactory() { + + } + + public static ChartAxisUsePane createAxisStylePane(Axis axis, String axisType) { + String clsName = axis.getClass().getName(); + if (axis.isPercentage()) { + clsName += PERCENT; + } else if(ComparatorUtils.equals(axisType, "secondAxis")) { + clsName += SECOND; + } + Class cls = map.get(clsName); + try { + return cls.newInstance(); + } catch (InstantiationException e) { + FRContext.getLogger().error(e.getMessage(), e); + } catch (IllegalAccessException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + return new ChartCategoryPane(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/ChartCommonWizardPane.java b/designer_chart/src/com/fr/design/chart/ChartCommonWizardPane.java new file mode 100644 index 000000000..2698398d0 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/ChartCommonWizardPane.java @@ -0,0 +1,22 @@ +package com.fr.design.chart; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; + +public abstract class ChartCommonWizardPane extends ChartWizardPane { + private static final long serialVersionUID = 2467967841657570498L; + + @Override + public void populate(ChartCollection cc) { + if (cc == null) { + return; + } + + populate(cc.getSelectedChart()); + } + + public abstract void populate(Chart chart); + + public abstract void update(Chart oldChart); + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/ChartComponentPane.java b/designer_chart/src/com/fr/design/chart/ChartComponentPane.java new file mode 100644 index 000000000..40a96f21c --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/ChartComponentPane.java @@ -0,0 +1,170 @@ +package com.fr.design.chart; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JPanel; +import javax.swing.border.AbstractBorder; +import javax.swing.border.Border; + +import com.fr.stable.core.PropertyChangeAdapter; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.layout.FRGUIPaneFactory; + +/** + * 存放ChartComponent, 可调整大小的Pane. + */ +public class ChartComponentPane extends JPanel implements MouseMotionListener, MouseListener { + private static final long serialVersionUID = -77093070905580457L; + + // 给设计界面加一个边框,方便拖拽 + private static final int BORDER_STYLE = 10; + + private List listeners = new ArrayList(); + private List slisteners = new ArrayList(); + + private ChartComponent chartComponent; + + private boolean select = false; + + public ChartComponentPane(ChartComponent chartComponent) { + initComponents(chartComponent); + } + + private void initComponents(ChartComponent chartComponent) { + this.chartComponent = chartComponent; + this.chartComponent.setLocation(this.getLocation()); + + this.setBorder(designBorder); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.chartComponent.addStopEditingListener(new PropertyChangeAdapter() { + @Override + public void propertyChange() { + stopEditing(); + } + }); + this.add(chartComponent); + + this.addMouseListener(this); + this.addMouseMotionListener(this); + } + + public void addSizeChangedListener(PropertyChangeAdapter l) { + slisteners.add(l); + } + + public void addStopListener(PropertyChangeAdapter l) { + listeners.add(l); + } + + private void stopEditing() { + fireChanged(listeners); + } + + private Border designBorder = new AbstractBorder() { + private static final long serialVersionUID = 1802897702350872754L; + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { + Color oldColor = g.getColor(); + g.setColor(new Color(157, 228, 245)); + for (int i = 0; i < BORDER_STYLE; i++) { + g.drawRect(x + i, y + i, width - i - i - 1, height - i - i - 1); + } + g.setColor(oldColor); + } + + @Override + public Insets getBorderInsets(Component c) { + return new Insets(0, 0, BORDER_STYLE, BORDER_STYLE); + } + }; + + @Override + public void mouseDragged(MouseEvent e) { + if (select) { + if (this.getCursor() == Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)) { + this.setSize(e.getX(), getSize().height); + this.setPreferredSize(new Dimension(e.getX(), getSize().height)); + } else if (this.getCursor() == Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR)) { + this.setSize(getSize().width, e.getY()); + this.setPreferredSize(new Dimension(getSize().width, e.getY())); + } else if (this.getCursor() == Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR)) { + this.setSize(e.getX(), e.getY()); + this.setPreferredSize(new Dimension(e.getX(), e.getY())); + } + } + fireSizeChanged(); + super.repaint(); + } + + public void mouseMoved(MouseEvent e) { + Rectangle rect = this.getBounds(); + if (atCorner(e, rect)) { + setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR)); + } else if (atBottomLine(e, rect)) { + setCursor(Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR)); + } else if (atRightLine(e, rect)) { + setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); + } else { + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + } + + private boolean atBottomLine(MouseEvent e, Rectangle rect) { + return e.getY() < rect.height && e.getY() > rect.height - BORDER_STYLE; + } + + private boolean atRightLine(MouseEvent e, Rectangle rect) { + return e.getX() < rect.width && e.getX() > rect.width - BORDER_STYLE; + } + + private boolean atCorner(MouseEvent e, Rectangle rect) { + return atBottomLine(e, rect) && atRightLine(e, rect); + } + + public void mouseClicked(MouseEvent e) { + + } + + public void mouseEntered(MouseEvent e) { + + } + + public void mouseExited(MouseEvent e) { + + } + + public void mousePressed(MouseEvent e) { + if (this.getCursor() == Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR) + || this.getCursor() == Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR) + || this.getCursor() == Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR)) { + this.select = true; + } + } + + public void mouseReleased(MouseEvent e) { + this.select = false; + this.repaint(); + } + + private void fireSizeChanged() { + fireChanged(slisteners); + } + + private void fireChanged(List ls) { + for (int len = ls.size(), i = len; i > 0; i--) { + ls.get(i - 1).propertyChange(); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/ChartControlPane.java b/designer_chart/src/com/fr/design/chart/ChartControlPane.java new file mode 100644 index 000000000..390d780fb --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/ChartControlPane.java @@ -0,0 +1,128 @@ +package com.fr.design.chart; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.controlpane.JControlPane; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.general.NameObject; +import com.fr.stable.Nameable; + +import java.awt.*; +import java.util.HashMap; + +/** + * 管理图表类型Pane + * @author kunsnat: ChartComponent移出. + */ +public class ChartControlPane extends JControlPane { + private static final long serialVersionUID = 7336270815128413184L; + + public ChartControlPane() { + super(); + // 重新设定大小. 因为JControlPane默认的(450,450) 不适合图表这边 @ChartSize +// this.setPreferredSize(new Dimension(770, 520)); + } + + @Override + public NameableCreator[] createNameableCreators() { + return new NameableCreator[] { + new NameObjectCreator(Inter.getLocText("Chart"), Chart.class, ChartTypeUpdatePane.class) + }; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Chart-Manage_Chart_Type"); + } + + public void populate(ChartCollection cc) { + if(cc == null)return; + + NameObject[] nameObjects = new NameObject[cc.getChartCount()]; + for (int i = 0; i < nameObjects.length; i++) { + nameObjects[i] = new NameObject(cc.getChartName(i), cc.getChart(i)); + } + + populate(nameObjects); + // kunsnat: 选中当前图表选中的name + String chartSelectedName = cc.getChartName(cc.getSelectedIndex() < cc.getChartCount() ? cc.getSelectedIndex() : 0); + setSelectedName(chartSelectedName); + } + + public void update(ChartCollection cc) { + HashMap namesChart = new HashMap();// 暂存判断是否有必要更新 + for(int i = 0; i < cc.getChartCount(); i++) { + try { + namesChart.put(cc.getChartName(i), cc.getChart(i).clone()); + } catch (CloneNotSupportedException e) { + + } + } + + Nameable[] nameables = update(); + if (nameables.length == 0 || cc == null) { + return; + } + + cc.removeAllNameObject(); + String select = getSelectedName(); + for (int i = 0; i < nameables.length; i++) { + if (nameables[i] instanceof NameObject && ((NameObject)nameables[i]).getObject() instanceof Chart) { + NameObject no = (NameObject)nameables[i]; + + String name = no.getName(); + Chart chart = (Chart)no.getObject(); + if(namesChart.containsKey(name)) { + Chart tmpChart = (Chart)namesChart.get(name); + if(chart.getPlot() != null && tmpChart.getPlot() != null + && chart.getPlot().match4GUI(tmpChart.getPlot())) { + chart = tmpChart;// 代替之前做过编辑的Chart + } + } + cc.addNamedChart(name, chart); + if(no.getName().equals(select)) { + cc.setSelectedIndex(i); + } + } + } + } + + /* + * alex:继承UpdatePane的ChartTypePane + */ + public static class ChartTypeUpdatePane extends BasicBeanPane { + private static final long serialVersionUID = -7058348930816218415L; + private Chart editing; + + private ChartTypePane typePane; + + public ChartTypeUpdatePane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + typePane = new ChartTypePane(); + this.add(typePane, BorderLayout.CENTER); + } + + @Override + protected String title4PopupWindow() { + return "Chart Type"; + } + + @Override + public void populateBean(Chart ob) { + editing = ob; + typePane.populate(ob); + } + + @Override + public Chart updateBean() { + typePane.update(editing); + + return editing; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/ChartDialog.java b/designer_chart/src/com/fr/design/chart/ChartDialog.java new file mode 100644 index 000000000..d4f3b4781 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/ChartDialog.java @@ -0,0 +1,102 @@ +package com.fr.design.chart; + +import java.awt.BorderLayout; +import java.awt.Dialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JPanel; + +import com.fr.base.chart.BaseChartCollection; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.chart.MiddleChartDialog; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.dialog.BasicDialog; +import com.fr.general.Inter; +import com.fr.design.utils.gui.GUICoreUtils; + +/** + * 封装一层 图表新建的对话框, 配合属性表确定: 先单独只要一种图表类型的对话框. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-1-7 下午07:29:15 + */ +public class ChartDialog extends MiddleChartDialog { + + private BaseChartCollection cc; + + private UIButton ok; + private UIButton cancel; + + public ChartDialog(Frame owner) { + super(owner); + initComponent(); + } + + public ChartDialog(Dialog owner) { + super(owner); + initComponent(); + } + + private void initComponent() { + this.setLayout(new BorderLayout()); + final ChartTypePane chartTypePane = new ChartTypePane(); + setTitle(Inter.getLocText("M-Popup_ChartType")); + + this.applyClosingAction(); + this.applyEscapeAction(); + this.setBasicDialogSize(BasicDialog.DEFAULT); + this.add(chartTypePane, BorderLayout.CENTER); + + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + + this.add(buttonPane, BorderLayout.SOUTH); + + ok = new UIButton(Inter.getLocText("OK")); + cancel = new UIButton(Inter.getLocText("Cancel")); + + buttonPane.add(ok); + buttonPane.add(cancel); + + ok.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + chartTypePane.update((ChartCollection)cc); + doOK(); + } + }); + + cancel.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + doCancel(); + } + }); + + GUICoreUtils.setWindowCenter(getOwner(), this); + } + + /** + * 不处理 + */ + public void checkValid() throws Exception { + + } + + /** + * 更新新建的图表 ChartCollection + */ + public void populate(BaseChartCollection cc) { + if (cc == null) { + return; + } + this.cc = cc; + } + + /** + * 返回当前正在编辑的图表ChartCollection + */ + public BaseChartCollection getChartCollection() { + return this.cc; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/ChartPlotFactory.java b/designer_chart/src/com/fr/design/chart/ChartPlotFactory.java new file mode 100644 index 000000000..48e018a59 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/ChartPlotFactory.java @@ -0,0 +1,132 @@ +package com.fr.design.chart; + +import com.fr.base.FRContext; +import com.fr.chart.chartattr.*; +import com.fr.design.chart.axis.*; +import com.fr.design.chart.series.SeriesCondition.dlp.*; +import com.fr.design.mainframe.chart.gui.style.axis.*; + +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-2 + * Time : 上午11:27 + */ +public class ChartPlotFactory { + + private static Map map = new HashMap(); + + private static Map axisPane = new HashMap(){ + { + put(ChartValuePane.class.getName(), ChartValueNoFormulaPane.class); + put(ChartSecondValuePane.class.getName(), ChartSecondValueNoFormulaPane.class); + put(ChartPercentValuePane.class.getName(), ChartPercentValueNoFormulaPane.class); + put(ChartCategoryPane.class.getName(), ChartCategoryNoFormulaPane.class); + } + }; + + static { + map.put(AreaPlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(AreaDataLabelPane.class)); + map.put(Area3DPlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(AreaDataLabelPane.class)); + map.put(Bar2DPlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(Bar2DDataLabelPane.class)); + map.put(Bar3DPlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(Bar2DDataLabelPane.class)); + map.put(BubblePlot.class.getName(), new FactoryObject() + .setAxisPaneCls(XYChartStyleAxisPane.class) + .setDataLabelPaneClass(BubbleDataLabelPane.class)); + map.put(CustomPlot.class.getName(), new FactoryObject() + .setAxisPaneCls(CustomChartStyleAxisPane.class) + .setDataLabelPaneClass(Bar2DDataLabelPane.class)); + map.put(GanttPlot.class.getName(), new FactoryObject() + .setAxisPaneCls(GanntChartStyleAxisPane.class)); + map.put(LinePlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(LineDataLabelPane.class)); + map.put(MapPlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(MapDataLabelPane.class)); + map.put(MeterBluePlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(MeterDataLabelPane.class)); + map.put(MeterPlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(MeterDataLabelPane.class)); + map.put(PiePlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(PieDataLabelPane.class)); + map.put(Pie3DPlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(PieDataLabelPane.class)); + map.put(RadarPlot.class.getName(), new FactoryObject() + .setAxisPaneCls(RadarChartStyleAxisPane.class) + .setDataLabelPaneClass(RadarDataLabelPane.class)); + map.put(StockPlot.class.getName(), new FactoryObject() + .setAxisPaneCls(TernaryChartStyleAxisPane.class) + .setDataLabelPaneClass(StockDataLabelPane.class)); + map.put(RangePlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(RangeDataLabelPane.class) + .setAxisPaneCls(ValueChartStyleAxisPane.class)); + map.put(XYScatterPlot.class.getName(), new FactoryObject() + .setAxisPaneCls(XYChartStyleAxisPane.class) + .setDataLabelPaneClass(XYDataLabelPane.class)); + map.put(FunnelPlot.class.getName(), new FactoryObject() + .setDataLabelPaneClass(PieDataLabelPane.class)); + } + + private ChartPlotFactory() { + + } + + /** + * 创建对应的坐标轴界面 + * @param plot plot类型 + * @return 返回坐标轴界面 + */ + public static ChartStyleAxisPane createChartStyleAxisPaneByPlot(Plot plot) { + FactoryObject factoryObject = map.get(plot.getClass().getName()); + if (factoryObject != null && factoryObject.getAxisPaneClass() != null) { + try { + Constructor c = factoryObject.getAxisPaneClass().getConstructor(Plot.class); + return c.newInstance(plot); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + return new BinaryChartStyleAxisPane(plot); + } + + /** + * 创建对应的标签Plot + * @param plotClass plot的类 + * @return 对应的标签界面 + */ + public static DataLabelPane createDataLabelPane4Plot(Class plotClass) { + FactoryObject factoryObject = map.get(plotClass.getName()); + if (factoryObject != null && factoryObject.getDataLabelPaneClass() != null) { + try { + Constructor c = factoryObject.getDataLabelPaneClass().getConstructor(); + return (DataLabelPane) c.newInstance(); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + return new DataLabelPane(); + } + + public static ChartAxisUsePane getNoFormulaPane(ChartAxisUsePane pane){ + Class aClass = axisPane.get(pane.getClass().getName()); + if(aClass != null){ + try { + Constructor c = aClass.getConstructor(); + return (ChartAxisUsePane) c.newInstance(); + }catch (Exception e){ + FRContext.getLogger().error(e.getMessage(), e); + } + } + + return pane; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/ChartSwingUtils.java b/designer_chart/src/com/fr/design/chart/ChartSwingUtils.java new file mode 100644 index 000000000..0f60814cc --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/ChartSwingUtils.java @@ -0,0 +1,76 @@ +package com.fr.design.chart; + +import com.fr.base.Formula; +import com.fr.base.Utils; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.formula.FormulaFactory; +import com.fr.design.formula.UIFormula; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; + +import javax.swing.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * 这里打算是放一些图表用的界面控件的. + */ +public class ChartSwingUtils { + + + public static void addListener(final UICheckBox box, final UITextField textField) { + textField.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + if (box.isSelected()) { + showFormulaPane(textField, null); + } + } + }); + textField.addKeyListener(new KeyAdapter() { + public void keyTyped(KeyEvent e) { + if(box.isSelected()) { + e.consume(); + showFormulaPane(textField, null); + } + } + }); + } + + public static UITextField createFormulaUITextField(final OKListener l) { + final UITextField textField = new UITextField(); + textField.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + showFormulaPane(textField, l); + } + }); + textField.addKeyListener(new KeyAdapter() { + public void keyTyped(KeyEvent e) { + e.consume(); + showFormulaPane(textField, l); + } + }); + + return textField; + } + + private static void showFormulaPane(final UITextField jTextField, final OKListener l) { + final UIFormula formulaPane = FormulaFactory.createFormulaPane(); + formulaPane.populate(new Formula(jTextField.getText())); + formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane()), new DialogActionAdapter(){ + public void doOk() { + Formula formula = formulaPane.update(); + jTextField.setText(Utils.objectToString(formula)); + if (l != null) { + l.action(); + } + } + }).setVisible(true); + } + + public interface OKListener { + public void action(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/ChartTypePane.java b/designer_chart/src/com/fr/design/chart/ChartTypePane.java new file mode 100644 index 000000000..5a1e0ead4 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/ChartTypePane.java @@ -0,0 +1,186 @@ +package com.fr.design.chart; +/** + * the Pane of the Chart + * + */ + +import com.fr.base.FRContext; +import com.fr.chart.base.ChartInternationalNameContentBean; +import com.fr.chart.chartattr.*; +import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; +import com.fr.general.RegistEditionException; +import com.fr.general.VT4FR; +import com.fr.stable.StableUtils; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import java.awt.*; + +public class ChartTypePane extends ChartCommonWizardPane { + private static final long serialVersionUID = -1175602484968520546L; + + private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); + private Chart[][] charts4Icon = null; + + { + charts4Icon = new Chart[this.typeName.length][]; + for (int i = 0; i < this.typeName.length; i++) { + Chart[] rowCharts = ChartTypeManager.getInstance().getChartTypes(this.typeName[i].getPlotID()); + charts4Icon[i] = new Chart[1]; + for (int j = 0; j < 1; j++) { + try { + charts4Icon[i][j] = (Chart) rowCharts[j].clone(); + charts4Icon[i][j].setTitle(null); + if(charts4Icon[i][j].getPlot() != null){ + charts4Icon[i][j].getPlot().setLegend(null); + } + } catch (CloneNotSupportedException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + } + } + + private JList mainTypeList = null; + private JList iconViewList = null; + private DefaultListModel iconListModel = null; + + public ChartTypePane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + DefaultListModel defaultListModel = new DefaultListModel(); + mainTypeList = new JList(defaultListModel); + + for (int i = 0; i < typeName.length; i++) { + defaultListModel.insertElementAt(Inter.getLocText(typeName[i].getName()), i); + } + mainTypeList.addListSelectionListener(listSelectionListener); + + JScrollPane typeScrollPane = new JScrollPane(mainTypeList); + typeScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + + iconViewList = new JList(); + + iconListModel = new DefaultListModel(); + iconViewList.setModel(iconListModel); + iconViewList.setVisibleRowCount(0); + iconViewList.setLayoutOrientation(JList.HORIZONTAL_WRAP); + iconViewList.setCellRenderer(iconCellRenderer); + + JScrollPane subListPane = new JScrollPane(iconViewList); + //iconPane.add + mainTypeList.setSelectedIndex(0); + + JSplitPane spane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, typeScrollPane, subListPane); + spane.setDividerLocation(120); + spane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("M-Popup_ChartType"))); + this.add(spane); + + iconViewList.setSelectedIndex(0); + } + + ListCellRenderer iconCellRenderer = new DefaultListCellRenderer() { + private static final long serialVersionUID = 956888843609479566L; + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + this.setText(""); + if (value instanceof ChartIcon) { + this.setIcon((ChartIcon) value); + setHorizontalAlignment(UILabel.CENTER); + if (isSelected) { + // 深蓝色. + this.setBackground(new Color(57, 107, 181)); + } + ChartIcon chartIcon = (ChartIcon) value; + this.setBorder(GUICoreUtils.createTitledBorder(getChartName(chartIcon), null)); + } + return this; + } + }; + + protected ListSelectionListener listSelectionListener = new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + int main_index = mainTypeList.getSelectedIndex(); + Chart[] sub_charts = ChartTypePane.this.charts4Icon[main_index]; + ChartTypePane.this.iconListModel.clear(); + for (int i = 0; i < sub_charts.length; i++) { + ChartTypePane.this.iconListModel.addElement(new ChartIcon(sub_charts[i])); + } + iconViewList.setSelectedIndex(0); + } + }; + + public String getChartName(ChartIcon chartIcon) { + Chart chart = (Chart)chartIcon.getChart(); + return chart.getChartName(); + } + + public void populate(Chart chart) { + if (chart == null) { + return; + } + Plot plot = chart.getPlot(); + + int mainIndex = 0; + int subIndex = 0; + + for (int i = 0; i < typeName.length; i++) { + Chart [] charts = ChartTypeManager.getInstance().getChartTypes(typeName[i].getPlotID()); + for (int j = 0; j < charts.length; j++) { + if (charts[j].getPlot().match4GUI(plot)) { + mainIndex = i; + subIndex = j; + // 一旦匹配 立马中断 + break; + } + } + } + + mainTypeList.setSelectedIndex(mainIndex); + iconViewList.setSelectedIndex(subIndex); + } + + public void update(Chart oldChart) { + String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID(); + Chart chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; + if(chart.getPlot() != null){ + if(chart.getPlot() instanceof MapPlot && !(VT4FR.isLicAvailable(StableUtils.getBytes()) && VT4FR.CHART_MAP.support())){ + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Chart-Map_Not_Supported")); + throw new RegistEditionException(VT4FR.CHART_MAP); + } + + if (chart.getPlot() != null) { + try { + oldChart.changePlotInNewType((Plot) chart.getPlot().clone()); + } catch (CloneNotSupportedException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + } + } + + public void update(ChartCollection cc) { + if (cc == null) { + return; + } + + Chart chart4Update = cc.getSelectedChart(); + if (chart4Update == null) { + String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID(); + Chart chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; + try{ + chart4Update = (Chart)chart.clone(); + cc.addChart(chart4Update); + }catch (CloneNotSupportedException ex){ + FRContext.getLogger().error(ex.getMessage(), ex); + } + } + + update(chart4Update); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/ChartWizardPane.java b/designer_chart/src/com/fr/design/chart/ChartWizardPane.java new file mode 100644 index 000000000..640ddecd0 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/ChartWizardPane.java @@ -0,0 +1,20 @@ +package com.fr.design.chart; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.dialog.JWizardPanel; + +/** +* @author kunsnat E-mail:kunsnat@gmail.com +* @version 创建时间:2012-4-23 下午03:07:52 +* 类说明: 图表向导界面 + */ +public abstract class ChartWizardPane extends JWizardPanel { + + public ChartWizardPane() { + super(); + } + + public abstract void update(ChartCollection cc); + + public abstract void populate(ChartCollection cc); +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/FactoryObject.java b/designer_chart/src/com/fr/design/chart/FactoryObject.java new file mode 100644 index 000000000..2fb898f98 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/FactoryObject.java @@ -0,0 +1,40 @@ +package com.fr.design.chart; + +import com.fr.design.chart.axis.ChartStyleAxisPane; +import com.fr.design.chart.series.SeriesCondition.dlp.DataLabelPane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-5 + * Time : 下午5:29 + */ +public class FactoryObject { + private Class axisPaneClass; + private Class dataLabelPaneClass; + + public FactoryObject() { + + } + + public Class getAxisPaneClass() { + return axisPaneClass; + } + + public FactoryObject setAxisPaneCls(Class axisPaneClass) { + this.axisPaneClass = axisPaneClass; + return this; + } + + public Class getDataLabelPaneClass() { + return dataLabelPaneClass; + } + + public FactoryObject setDataLabelPaneClass(Class dataLabelPaneClass) { + this.dataLabelPaneClass = dataLabelPaneClass; + return this; + } + + public static FactoryObject EMPTY = new FactoryObject(); +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/AxisStyleObject.java b/designer_chart/src/com/fr/design/chart/axis/AxisStyleObject.java new file mode 100644 index 000000000..dd70ec5f7 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/AxisStyleObject.java @@ -0,0 +1,29 @@ +package com.fr.design.chart.axis; + +import com.fr.design.mainframe.chart.gui.style.axis.ChartAxisUsePane; + + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-2 + * Time : 下午2:40 + */ +public class AxisStyleObject { + private String name; + private ChartAxisUsePane axisStylePane; + + public AxisStyleObject(String name, ChartAxisUsePane axisStylePane) { + this.name = name; + this.axisStylePane = axisStylePane; + } + + public String getName() { + return name; + } + + public ChartAxisUsePane getAxisStylePane() { + return axisStylePane; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/AxisStylePane.java b/designer_chart/src/com/fr/design/chart/axis/AxisStylePane.java new file mode 100644 index 000000000..94c413879 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/AxisStylePane.java @@ -0,0 +1,17 @@ +package com.fr.design.chart.axis; + +import com.fr.general.Inter; +import com.fr.design.dialog.BasicPane; + +public abstract class AxisStylePane extends BasicPane { + private static final long serialVersionUID = 8969849654720197617L; + + public abstract void populate(T axis); + + public abstract void update(T axis); + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Set", "ChartF-Axis", "Format"}); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/BinaryChartStyleAxisPane.java b/designer_chart/src/com/fr/design/chart/axis/BinaryChartStyleAxisPane.java new file mode 100644 index 000000000..6e80df06d --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/BinaryChartStyleAxisPane.java @@ -0,0 +1,63 @@ +package com.fr.design.chart.axis; + +import com.fr.chart.chartattr.Axis; +import com.fr.chart.chartattr.CategoryPlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.mainframe.chart.gui.style.axis.ChartAxisUsePane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartCategoryPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartPercentValuePane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartValuePane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-6 + * Time : 上午8:57 + */ +public class BinaryChartStyleAxisPane extends ChartStyleAxisPane { + + public BinaryChartStyleAxisPane(Plot plot) { + super(plot); + } + + /** + * 创建坐标轴样式面板 + * @param plot 图表 + * @return 面板 + */ + public final AxisStyleObject[] createAxisStyleObjects(Plot plot) { + return new AxisStyleObject[]{ + getXAxisPane(plot), + getYAxisPane(plot) + }; + } + + protected AxisStyleObject getXAxisPane(final Plot plot) { + //是否支持坐标轴轴样式 + return new AxisStyleObject(CATE_AXIS, new ChartCategoryPane(){ + protected boolean isSupportLineStyle(){ + return plot.isSupportAxisLineStyle(); + } + }); + } + + protected AxisStyleObject getYAxisPane(final Plot plot) { + Axis axis = plot.getyAxis(); + // 堆积情况时 + boolean isStack = false; + if(plot instanceof CategoryPlot) { + isStack = ((CategoryPlot)plot).isStacked(); + } + + ChartValuePane valuePane = new ChartValuePane(){ + protected boolean isSupportLineStyle(){ + return plot.isSupportAxisLineStyle(); + } + }; + boolean usePercentPane = axis.isPercentage() && isStack; + ChartAxisUsePane p = usePercentPane ? new ChartPercentValuePane() : valuePane; + + return new AxisStyleObject(VALUE_AXIS, p); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/ChartAlertLinePane.java b/designer_chart/src/com/fr/design/chart/axis/ChartAlertLinePane.java new file mode 100644 index 000000000..28a06e22a --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/ChartAlertLinePane.java @@ -0,0 +1,63 @@ +package com.fr.design.chart.axis; + +import com.fr.general.Inter; +import com.fr.general.NameObject; +import com.fr.stable.Nameable; +import com.fr.chart.chartattr.ChartAlertValue; +import com.fr.design.gui.controlpane.JControlPane; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; + +import java.util.ArrayList; +import java.util.List; + +public class ChartAlertLinePane extends JControlPane { + + public NameableCreator[] createNameableCreators() { + return new NameableCreator[]{ + new NameObjectCreator(Inter.getLocText("ChartF-Alert-Line"), + ChartAlertValue.class, ChartAlertValuePane.class) + }; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Edit", "ChartF-Alert-Line"}); + } + + public void populate(ChartAlertValue[] alertList) { + if (alertList == null) { + alertList = new ChartAlertValue[0]; + } + List nameObjectList = new ArrayList(); + + for (int i = 0; i < alertList.length; i++) { + ChartAlertValue value = alertList[i]; + nameObjectList.add(new NameObject(value.getAlertPaneSelectName(), value)); + } + + if (!nameObjectList.isEmpty()) { + populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); + } + } + + public ChartAlertValue[] updateAlertValues() { + Nameable[] res = update(); + + NameObject[] res_array = new NameObject[res.length]; + java.util.Arrays.asList(res).toArray(res_array); + + if (res_array.length < 1) { + return new ChartAlertValue[0]; + } + + List alertValueList = new ArrayList(); + for (int i = 0; i < res_array.length; i++) { + NameObject nameObject = res_array[i]; + ChartAlertValue chartAlertValue = (ChartAlertValue) nameObject.getObject(); + chartAlertValue.setAlertPaneSelectName(nameObject.getName()); + alertValueList.add(chartAlertValue); + } + return (ChartAlertValue[]) alertValueList.toArray(new ChartAlertValue[alertValueList.size()]); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/ChartAlertValueInTopBottomPane.java b/designer_chart/src/com/fr/design/chart/axis/ChartAlertValueInTopBottomPane.java new file mode 100644 index 000000000..f94968882 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/ChartAlertValueInTopBottomPane.java @@ -0,0 +1,20 @@ +package com.fr.design.chart.axis; + +import com.fr.general.Inter; + + +/** + * 警戒线 居上 居下界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-5-22 上午09:53:28 + */ +public class ChartAlertValueInTopBottomPane extends ChartAlertValuePane { + + protected String getLeftName() { + return Inter.getLocText("Chart_Alert_Bottom"); + } + + protected String getRightName() { + return Inter.getLocText("Chart_Alert_Top"); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/ChartAlertValuePane.java b/designer_chart/src/com/fr/design/chart/axis/ChartAlertValuePane.java new file mode 100644 index 000000000..c38d2eb73 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/ChartAlertValuePane.java @@ -0,0 +1,229 @@ +package com.fr.design.chart.axis; + +import com.fr.base.Formula; +import com.fr.base.Utils; +import com.fr.chart.chartattr.ChartAlertValue; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.formula.FormulaFactory; +import com.fr.design.formula.UIFormula; +import com.fr.design.gui.ibutton.UIRadioButton; +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.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.style.AlphaPane; +import com.fr.design.style.FRFontPane; +import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; +import com.fr.general.Inter; +import com.fr.stable.Constants; +import com.fr.stable.CoreConstants; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * 图表 坐标轴 警戒线值 编辑界面. (默认 位置居左居右) +* @author kunsnat E-mail:kunsnat@gmail.com +* @version 创建时间:2013-5-22 上午09:49:54 + */ +public class ChartAlertValuePane extends BasicBeanPane { + private static final int DE_FONT = 9; + private static final double ALPH_PER = 100; + + private UITextField textField; + private LineComboBox lineCombo; + private ColorSelectBox colorBox; + private AlphaPane alphaPane; + + private UITextField contentField; + private UIComboBox fontNameBox; + private UIComboBox fontSizeBox; + + private UIRadioButton leftButton; + private UIRadioButton rightButton; + + public ChartAlertValuePane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + JPanel pane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + this.add(pane, BorderLayout.CENTER); + + JPanel alertLinePane =FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + pane.add(alertLinePane); + + alertLinePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"ChartF-Alert-Line", "Set"}))); + + JPanel valuePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + alertLinePane.add(valuePane); + + valuePane.add(new UILabel(Inter.getLocText(new String[]{"ChartF_Alert", "Value"}) + ":")); + + textField = new UITextField(); + textField.setColumns(4); + valuePane.add(textField); + + textField.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + showFormulaPane(); + } + }); + + textField.addKeyListener(new KeyAdapter() { + public void keyTyped(KeyEvent e) { + e.consume(); + showFormulaPane(); + } + }); + + JPanel lineStylePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + alertLinePane.add(lineStylePane); + + lineStylePane.add(new UILabel(Inter.getLocText("Line-Style") + ":")); + lineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); + lineStylePane.add(lineCombo); + + JPanel lineColorPane =FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + alertLinePane.add(lineColorPane); + + lineColorPane.add(new UILabel(Inter.getLocText(new String[]{"ChartF-Alert-Line", "Color"}) + ":")); + colorBox = new ColorSelectBox(80); + lineColorPane.add(colorBox); + + alphaPane = new AlphaPane(); + alertLinePane.add(alphaPane); + + JPanel tipPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + pane.add(tipPane); + + tipPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Chart_Alert_Tip") + ":", null)); + + JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + tipPane.add(centerPane); + + fontNameBox = new UIComboBox(); + fontNameBox.setPreferredSize(new Dimension(80,20)); + + fontNameBox.addItem("SimSun"); // TODO 这边字体中没有在列表内 + String[] names = Utils.getAvailableFontFamilyNames4Report(); + for(int i = 0; i < names.length; i++) { + fontNameBox.addItem(names[i]); + } + + fontSizeBox = new UIComboBox(); + fontSizeBox.setPreferredSize(new Dimension(80,20)); + Integer[] sizes = FRFontPane.Font_Sizes; + for(int i = 0; i < sizes.length; i++) { + fontSizeBox.addItem(sizes[i]); + } + + double t = TableLayout.FILL; + double[] rowSize = {t, t, t, t, t}; + double[] columnSize = {0.1, 0.2, 0.5, 0.2}; + Component[][] components= { + {null, new UILabel(Inter.getLocText("Content") + ":"), contentField = new UITextField(3)}, + {null, new UILabel(Inter.getLocText("FRFont") + ":"), fontNameBox}, + {null, new UILabel(Inter.getLocText("FRFont-Size") + ":"), fontSizeBox}, + {null, new UILabel(Inter.getLocText("Layout") + ": "), leftButton = new UIRadioButton(getLeftName())}, + {null, null, rightButton = new UIRadioButton(getRightName())}, + + }; + JPanel tablePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + centerPane.add(tablePane); + + ButtonGroup bg = new ButtonGroup(); + bg.add(leftButton); + bg.add(rightButton); + + leftButton.setSelected(true); + } + + protected String getLeftName() {// 居左 居右 + return Inter.getLocText("Chart_Alert_Left"); + } + + protected String getRightName() { + return Inter.getLocText("Chart_Alert_Right"); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("ChartF-Alert-Line"); + } + + private void showFormulaPane() { + final UIFormula formulaPane = FormulaFactory.createFormulaPane(); + formulaPane.populate(new Formula(textField.getText())); + formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(ChartAlertValuePane.this), new DialogActionAdapter(){ + public void doOk() { + Formula formula = formulaPane.update(); + textField.setText(Utils.objectToString(formula)); + } + }).setVisible(true); + } + + @Override + public void populateBean(ChartAlertValue ob) { + //兼容以前设置的虚线 + if (ob.getLineStyle().getLineStyle() != Constants.LINE_NONE + && ob.getLineStyle().getLineStyle() != Constants.LINE_THIN + && ob.getLineStyle().getLineStyle() != Constants.LINE_MEDIUM + && ob.getLineStyle().getLineStyle() != Constants.LINE_THICK) { + ob.getLineStyle().setLineStyle(Constants.LINE_THIN); + } + textField.setText(Utils.objectToString(ob.getAlertValueFormula())); + lineCombo.setSelectedLineStyle(ob.getLineStyle().getLineStyle()); + colorBox.setSelectObject(ob.getLineColor().getSeriesColor()); + alphaPane.populate((int)(ob.getAlertLineAlpha() * ALPH_PER)); + + contentField.setText(ob.getAlertContent()); + fontNameBox.setSelectedItem(ob.getAlertFont().getName()); + fontSizeBox.setSelectedItem(ob.getAlertFont().getSize()); + + if(ob.getAlertPosition() == Constants.LEFT) { + leftButton.setSelected(true); + } else { + rightButton.setSelected(true); + } + } + + @Override + public ChartAlertValue updateBean() { + ChartAlertValue chartAlertValue = new ChartAlertValue(); + + updateBean(chartAlertValue); + return chartAlertValue; + } + + public void updateBean(ChartAlertValue chartAlertValue) { + + chartAlertValue.setAlertValueFormula(new Formula(textField.getText())); + chartAlertValue.getLineColor().setSeriesColor(colorBox.getSelectObject()); + chartAlertValue.getLineStyle().setLineStyle(lineCombo.getSelectedLineStyle()); + chartAlertValue.setAlertLineAlpha(alphaPane.update()); + chartAlertValue.setAlertContent(contentField.getText()); + + String fontName = Utils.objectToString(fontNameBox.getSelectedItem()); + int fontSize = DE_FONT; + Number number = Utils.objectToNumber(fontSizeBox.getSelectedItem(), true); + if(number != null) { + fontSize = number.intValue(); + } + chartAlertValue.setAlertFont(FRFont.getInstance(fontName, Font.PLAIN, fontSize)); + + if(leftButton.isSelected()) { + chartAlertValue.setAlertPosition(Constants.LEFT); + } else if(rightButton.isSelected()) { + chartAlertValue.setAlertPosition(Constants.RIGHT); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/ChartStyleAxisPane.java b/designer_chart/src/com/fr/design/chart/axis/ChartStyleAxisPane.java new file mode 100644 index 000000000..4a8d84cc4 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/ChartStyleAxisPane.java @@ -0,0 +1,87 @@ +package com.fr.design.chart.axis; + +import java.awt.CardLayout; +import java.util.ArrayList; + +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import com.fr.chart.chartattr.Axis; +import com.fr.chart.chartattr.Plot; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.chart.gui.style.axis.ChartAxisUsePane; +import com.fr.design.dialog.BasicPane; +import com.fr.general.Inter; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-2 + * Time : 上午8:48 + */ +public abstract class ChartStyleAxisPane extends BasicPane implements ListSelectionListener { + protected static final String CATE_AXIS = Inter.getLocText("ChartF-Category_Axis"); + protected static final String VALUE_AXIS = Inter.getLocText("Chart_F_Radar_Axis"); + protected static final String SECOND_AXIS = Inter.getLocText(new String[]{"Second", "Chart_F_Radar_Axis"}); + private JList mainList; + private CardLayout cardLayout; + private JPanel cardDisplayPane = null; + private java.util.List axisStylePaneList = new ArrayList(); + + public ChartStyleAxisPane(Plot plot) { + initComponents(plot); + } + + private void initComponents(Plot plot) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + DefaultListModel listModel = new DefaultListModel(); + mainList = new JList(listModel); + AxisStyleObject[] axisStyleObjects = createAxisStyleObjects(plot); + cardLayout = new CardLayout(); + cardDisplayPane = FRGUIPaneFactory.createCardLayout_S_Pane(); + cardDisplayPane.setLayout(cardLayout); + for (int i = 0; i < axisStyleObjects.length; i ++) { + AxisStyleObject as = axisStyleObjects[i]; + listModel.addElement(as.getName()); + ChartAxisUsePane axisStylePane = as.getAxisStylePane(); + axisStylePaneList.add(axisStylePane); + cardDisplayPane.add(axisStylePane, as.getName()); + } + mainList.setSelectedIndex(0); + mainList.addListSelectionListener(this); + this.add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, mainList, cardDisplayPane)); + } + + @Override + protected String title4PopupWindow() { + return "Axis"; + } + + public void valueChanged(ListSelectionEvent e) { + cardLayout.show(cardDisplayPane, (String)mainList.getSelectedValue()); + } + + public abstract AxisStyleObject[] createAxisStyleObjects(Plot plot); + + public void populate(Plot plot) { + for (int i = 0, len = axisStylePaneList.size(); i < len; i++) { +// axisStylePaneList.get(i).populate(getAxisFromPlotByListIndex(plot, i)); + } + } + + public void update(Plot plot) { + for (int i = 0, len = axisStylePaneList.size(); i < len; i++) { +// axisStylePaneList.get(i).update(getAxisFromPlotByListIndex(plot, i)); + } + } + + private Axis getAxisFromPlotByListIndex(Plot plot, int index) { + return plot.getAxis(index); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/CustomChartStyleAxisPane.java b/designer_chart/src/com/fr/design/chart/axis/CustomChartStyleAxisPane.java new file mode 100644 index 000000000..e10895e89 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/CustomChartStyleAxisPane.java @@ -0,0 +1,19 @@ +package com.fr.design.chart.axis; + +import com.fr.chart.chartattr.Plot; +import com.fr.general.Inter; + +public class CustomChartStyleAxisPane extends TernaryChartStyleAxisPane { + + public CustomChartStyleAxisPane(Plot plot) { + super(plot); + } + + protected String getValueAxisName() { + return Inter.getLocText("Main_Axis"); + } + + protected String getSecondValueAxisName() { + return Inter.getLocText("Second_Axis"); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/GanntChartStyleAxisPane.java b/designer_chart/src/com/fr/design/chart/axis/GanntChartStyleAxisPane.java new file mode 100644 index 000000000..f15b46457 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/GanntChartStyleAxisPane.java @@ -0,0 +1,28 @@ +package com.fr.design.chart.axis; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.mainframe.chart.gui.style.axis.ChartCategoryPane; +import com.fr.general.Inter; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-6 + * Time : 上午9:50 + */ +public class GanntChartStyleAxisPane extends BinaryChartStyleAxisPane { + public GanntChartStyleAxisPane(Plot plot) { + super(plot); + } + + protected AxisStyleObject getXAxisPane(Plot plot) { + ChartCategoryPane categoryPane = new ChartCategoryPane(); + categoryPane.getAxisValueTypePane().removeTextAxisPane(); + return new AxisStyleObject(Inter.getLocText("Chart_Date_Axis"), categoryPane); + } + + protected AxisStyleObject getYAxisPane(Plot plot) { + return new AxisStyleObject(CATE_AXIS, new ChartCategoryPane()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java b/designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java new file mode 100644 index 000000000..d717d31a8 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java @@ -0,0 +1,193 @@ +package com.fr.design.chart.axis; + +import com.fr.base.Formula; +import com.fr.chart.base.ChartBaseUtils; +import com.fr.chart.chartattr.Axis; +import com.fr.design.chart.ChartSwingUtils; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.itextfield.UITextField; +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.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class MinMaxValuePane extends JPanel { + private static final long serialVersionUID = 3353266754022091576L; + protected UICheckBox maxCheckBox; + protected UITextField maxValueField; + protected UICheckBox minCheckBox; + protected UITextField minValueField; + + // 主次要刻度单位 + protected UICheckBox isCustomMainUnitBox; + protected UITextField mainUnitField; + + protected UICheckBox isCustomSecUnitBox; + protected UITextField secUnitField; + + public MinMaxValuePane() { + minCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Custom", "Min_Value"})); + minValueField = new UITextField(6); + maxCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Custom", "Max_Value"})); + maxValueField = new UITextField(6); + isCustomMainUnitBox = new UICheckBox(Inter.getLocText("FR-Chart_MainGraduationUnit")); + mainUnitField = new UITextField(6); + isCustomSecUnitBox = new UICheckBox(Inter.getLocText("FR-Chart_SecondGraduationUnit")); + secUnitField = new UITextField(6); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p, f }; + double[] rowSize = { p, p, p, p}; + + Component[][] components = getPanelComponents(); + JPanel panel = TableLayoutHelper.createTableLayoutPane(components ,rowSize,columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + + for(int i = 0; i < components.length; i++) { + ((UICheckBox)components[i][0]).addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + checkBoxUse(); + } + }); + ChartSwingUtils.addListener((UICheckBox)components[i][0], (UITextField)components[i][1]); + } + } + + protected Component[][] getPanelComponents() { + return new Component[][]{ + new Component[]{minCheckBox, minValueField}, + new Component[]{maxCheckBox, maxValueField}, + new Component[]{isCustomMainUnitBox, mainUnitField}, + new Component[]{isCustomSecUnitBox, secUnitField}, + }; + } + + private void checkBoxUse() { + minValueField.setEnabled(minCheckBox.isSelected()); + maxValueField.setEnabled(maxCheckBox.isSelected()); + + mainUnitField.setEnabled(isCustomMainUnitBox.isSelected()); + secUnitField.setEnabled(isCustomSecUnitBox.isSelected()); + } + + public void setPaneEditable(boolean isEditable) { + minCheckBox.setEnabled(isEditable); + maxCheckBox.setEnabled(isEditable); + minValueField.setEnabled(isEditable); + maxValueField.setEnabled(isEditable); + + mainUnitField.setEnabled(isEditable); + secUnitField.setEnabled(isEditable); + isCustomMainUnitBox.setEnabled(isEditable); + isCustomSecUnitBox.setEnabled(isEditable); + checkBoxUse(); + } + + public void populate(Axis axis) { + if(axis == null) { + return; + } + + if (axis.isCustomMinValue()) { + minCheckBox.setSelected(true); + if(axis.getMinValue() != null) { + minValueField.setText(axis.getMinValue().toString()); + } + } + + // 最大值 + if (axis.isCustomMaxValue()) { + maxCheckBox.setSelected(true); + if(axis.getMaxValue() != null) { + maxValueField.setText(axis.getMaxValue().toString()); + } + } + + // 主次刻度单位 + if (axis.isCustomMainUnit()) { + isCustomMainUnitBox.setSelected(true); + if(axis.getMainUnit() != null) { + mainUnitField.setText(axis.getMainUnit().toString()); + } + } + + if(axis.isCustomSecUnit()) { + isCustomSecUnitBox.setSelected(true); + if(axis.getSecUnit() != null) { + secUnitField.setText(axis.getSecUnit().toString()); + } + } + + checkBoxUse(); + } + + public void update(Axis axis) { + if (axis == null) { + return; + } + // 最大最小值 + if (minCheckBox.isSelected()) { + axis.setCustomMinValue(StringUtils.isNotEmpty(minValueField.getText())); + axis.setMinValue(new Formula(minValueField.getText())); + } else { + axis.setCustomMinValue(false); + } + if (maxCheckBox.isSelected()) { + axis.setCustomMaxValue(StringUtils.isNotEmpty(maxValueField.getText())); + axis.setMaxValue(new Formula(maxValueField.getText())); + } else { + axis.setCustomMaxValue(false); + } + + updateUnit(axis); + } + + private void updateUnit(Axis axis) { + // 主要刻度 + if (isCustomMainUnitBox.isSelected()){ + String increment = mainUnitField.getText(); + if(StringUtils.isEmpty(increment)) { + axis.setCustomMainUnit(false); + axis.setMainUnit(null); + } else { + axis.setCustomMainUnit(true); + Formula formula = new Formula(increment); + Number number = ChartBaseUtils.formula2Number(formula); + if(number != null && number.doubleValue() < 0) { + axis.setMainUnit(new Formula("10")); + } else { + axis.setMainUnit(formula); + } + } + } else { + axis.setCustomMainUnit(false); + } + + if (isCustomSecUnitBox.isSelected()){ + String increment = secUnitField.getText(); + if(StringUtils.isEmpty(increment)) { + axis.setCustomSecUnit(false); + axis.setSecUnit(null); + } else { + axis.setCustomSecUnit(true); + Formula formula = new Formula(increment); + Number number = ChartBaseUtils.formula2Number(formula); + if(number != null && number.doubleValue() < 0) { + axis.setSecUnit(new Formula("10")); + } else { + axis.setSecUnit(formula); + } + } + } else { + axis.setCustomSecUnit(false); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/RadarChartStyleAxisPane.java b/designer_chart/src/com/fr/design/chart/axis/RadarChartStyleAxisPane.java new file mode 100644 index 000000000..ec240525c --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/RadarChartStyleAxisPane.java @@ -0,0 +1,26 @@ +package com.fr.design.chart.axis; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.mainframe.chart.gui.style.axis.ChartRadarPane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-5 + * Time : 下午7:18 + * 雷达图的图表样式--> 坐标轴界面 + */ +public class RadarChartStyleAxisPane extends ChartStyleAxisPane { + private static final long serialVersionUID = 8919941507725513032L; + + public RadarChartStyleAxisPane(Plot plot) { + super(plot); + } + + public final AxisStyleObject[] createAxisStyleObjects(Plot plot) { + return new AxisStyleObject[]{new AxisStyleObject( + CATE_AXIS, + new ChartRadarPane())}; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/TernaryChartStyleAxisPane.java b/designer_chart/src/com/fr/design/chart/axis/TernaryChartStyleAxisPane.java new file mode 100644 index 000000000..fdfb25ef5 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/TernaryChartStyleAxisPane.java @@ -0,0 +1,42 @@ +package com.fr.design.chart.axis; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.mainframe.chart.gui.style.axis.ChartCategoryPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartSecondValuePane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartValuePane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-6 + * Time : 上午8:58 + * 三元坐标设置界面 + */ +public class TernaryChartStyleAxisPane extends ChartStyleAxisPane { + private static final long serialVersionUID = 539802340384090324L; + + public TernaryChartStyleAxisPane(Plot plot) { + super(plot); + } + + @Override + public AxisStyleObject[] createAxisStyleObjects(Plot plot) { + return new AxisStyleObject[]{ + new AxisStyleObject(CATE_AXIS, + new ChartCategoryPane()), + new AxisStyleObject(getValueAxisName(), + new ChartValuePane()), + new AxisStyleObject(getSecondValueAxisName(), + new ChartSecondValuePane()) + }; + } + + protected String getValueAxisName() { + return VALUE_AXIS; + } + + protected String getSecondValueAxisName() { + return SECOND_AXIS; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/ValueChartStyleAxisPane.java b/designer_chart/src/com/fr/design/chart/axis/ValueChartStyleAxisPane.java new file mode 100644 index 000000000..9320e1c25 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/ValueChartStyleAxisPane.java @@ -0,0 +1,25 @@ +package com.fr.design.chart.axis; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.mainframe.chart.gui.style.axis.ChartValuePane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-6 + * Time : 上午9:02 + */ +public class ValueChartStyleAxisPane extends ChartStyleAxisPane { + private static final long serialVersionUID = 8513685484255363315L; + + public ValueChartStyleAxisPane(Plot plot) { + super(plot); + } + + public final AxisStyleObject[] createAxisStyleObjects(Plot plot) { + return new AxisStyleObject[]{new AxisStyleObject( + CATE_AXIS, + new ChartValuePane())}; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/axis/XYChartStyleAxisPane.java b/designer_chart/src/com/fr/design/chart/axis/XYChartStyleAxisPane.java new file mode 100644 index 000000000..6730962ac --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/axis/XYChartStyleAxisPane.java @@ -0,0 +1,26 @@ +package com.fr.design.chart.axis; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.mainframe.chart.gui.style.axis.ChartValuePane; +import com.fr.general.Inter; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-6 + * Time : 上午9:51 + */ +public class XYChartStyleAxisPane extends BinaryChartStyleAxisPane { + public XYChartStyleAxisPane(Plot plot) { + super(plot); + } + + protected AxisStyleObject getXAxisPane(Plot plot) { + return new AxisStyleObject(Inter.getLocText("ChartF-X_Axis"), new ChartValuePane()); + } + + protected AxisStyleObject getYAxisPane(Plot plot) { + return new AxisStyleObject(Inter.getLocText("ChartF-Y_Axis"), new ChartValuePane()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/comp/BorderAttriPane.java b/designer_chart/src/com/fr/design/chart/comp/BorderAttriPane.java new file mode 100644 index 000000000..6eae928c7 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/comp/BorderAttriPane.java @@ -0,0 +1,59 @@ +package com.fr.design.chart.comp; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.general.Inter; +import com.fr.stable.Constants; +import com.fr.stable.CoreConstants; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.dialog.BasicPane; +import com.fr.design.style.color.ColorSelectBox; + +import java.awt.*; + +public class BorderAttriPane extends BasicPane { + + private LineComboBox lineCombo; + private ColorSelectBox colorSelectBox; + + public BorderAttriPane() { + this(Inter.getLocText("Line-Style"), Inter.getLocText("Color")); + } + + public BorderAttriPane(String lineString, String colorSting) { + this.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0)); + + this.add(new UILabel(lineString + ":")); + this.add(lineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART)); + lineCombo.setPreferredSize(new Dimension(60, 18)); + + this.add(new UILabel(colorSting + ":")); + this.add(colorSelectBox = new ColorSelectBox(80)); + colorSelectBox.setPreferredSize(new Dimension(60, 18)); + colorSelectBox.setSelectObject(null); + } + + public void setLineColor(Color color) { + this.colorSelectBox.setSelectObject(color); + } + + public Color getLineColor() { + return this.colorSelectBox.getSelectObject(); + } + + public void setLineStyle(int style) { + if (style != Constants.LINE_NONE && style != Constants.LINE_THICK + && style != Constants.LINE_THIN && style != Constants.LINE_MEDIUM) { + style = Constants.LINE_THIN; + } + this.lineCombo.setSelectedLineStyle(style); + } + + public int getLineStyle() { + return lineCombo.getSelectedLineStyle(); + } + + @Override + protected String title4PopupWindow() { + return "Border"; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/demo/GlyphDemo.java b/designer_chart/src/com/fr/design/chart/demo/GlyphDemo.java new file mode 100644 index 000000000..feced08a4 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/demo/GlyphDemo.java @@ -0,0 +1,123 @@ +package com.fr.design.chart.demo; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.charttypes.*; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.layout.FRGUIPaneFactory; + +import javax.swing.*; +import java.awt.*; + +public class GlyphDemo extends JFrame { + private static final long serialVersionUID = -3174315376448330927L; + + /** + * 主函数 + * @param args 参数 + */ + public static void main(String[] args) { + new GlyphDemo(); + } + + public GlyphDemo() { + JPanel contentPane = (JPanel)this.getContentPane(); + contentPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + UITabbedPane tab = new UITabbedPane(); + contentPane.add(tab, BorderLayout.CENTER); + + tab.add("Line", createGlyphLinePanel()); + tab.add("Bar", createBarPanel()); + tab.add("Area", createAreaPanel()); + tab.add("Meter", createMeterPanel()); + tab.add("Pie", createPiePanel()); + tab.add("Radar", createRadarPanel()); + tab.add("Stock", createStockPanel()); + tab.add("XYScatter", createXYScatterPanel()); + tab.add("Range", createRangePanel()); + tab.add("Mix", createCustomPanel()); + tab.add("Gantt", createGanttPanel()); + tab.add("Bubble", createBubblePane()); + + setSize(1200, 600); + // 关闭时退出 + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + + setTitle("Line Glyph Demo"); + setVisible(true); + } + + private JPanel createGlyphLinePanel() { + Chart[] chr = LineIndependentChart.lineChartTypes; + + return contentPane(chr,2,4); + } + + private JPanel createBarPanel() { + Chart[] chr= ColumnIndependentChart.columnChartTypes; + return contentPane(chr,2,4); + } + + private JPanel createAreaPanel() { + Chart[] chr= AreaIndependentChart.areaChartTypes; + return contentPane(chr,2,4); + } + + private JPanel createMeterPanel() { + Chart[] chr= MeterIndependentChart.meterChartTypes; + return contentPane(chr,2,4); + } + + private JPanel createPiePanel() { + Chart[] chr = PieIndependentChart.pieChartTypes; + JPanel contentPane = contentPane(chr,2,4); + + return contentPane; + } + + private JPanel createRadarPanel() { + Chart[] chr = RadarIndependentChart.radarChartTypes; + return contentPane(chr,2,4); + } + + private JPanel createStockPanel() { + Chart[] chr = StockIndependentChart.stockChartTypes; + return contentPane(chr,2,4); + } + + private JPanel createXYScatterPanel() { + Chart[] chr = XYScatterIndependentChart.XYScatterChartTypes; + return contentPane(chr,2,4); + } + + private JPanel createRangePanel() { + Chart[] chr = RangeIndependentChart.rangeChartTypes; + return contentPane(chr,2,4); + } + + private JPanel createCustomPanel() { + Chart[] chr = CustomIndependentChart.combChartTypes; + return contentPane(chr,2,4); + } + + private JPanel createGanttPanel() { + Chart[] chr = GanttIndependentChart.ganttChartTypes; + return contentPane(chr,2,4); + } + + private JPanel createBubblePane() { + Chart[] chr = BubbleIndependentChart.bubbleChartTypes; + return contentPane(chr,2,4); + } + + private JPanel contentPane(Chart[] chr,int x,int y){ + JPanel contentPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + contentPane.setLayout(new /**/ GridLayout(x, y)); + for(int i=0;i getPlotSeriesPane(ChartStylePane parent, Plot plot); + + + /** + * 图表的属性界面数组 + * + * @return 属性界面 + */ + AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener); + + /** + * 是否使用默认的界面,为了避免界面来回切换 + * + * @return 是否使用默认的界面 + */ + boolean isUseDefaultPane(); + + /** + * 图标路径 + * + * @return 图标路径 + */ + String getIconPath(); + + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java new file mode 100644 index 000000000..8322bdba4 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java @@ -0,0 +1,52 @@ +package com.fr.design.chart.fun.impl; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.IndependentChartUIProvider; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +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.general.ComparatorUtils; + + +/** + * Created by eason on 15/4/23. + */ +@Deprecated +public abstract class AbstractIndependentChartUI implements IndependentChartUIProvider { + + @Override + public int currentAPILevel() { + return -1; + } + + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + return new AbstractChartAttrPane[0]; + } + + /** + * 是否使用默认的界面,为了避免界面来回切换 + * @return 是否使用默认的界面 + */ + public boolean isUseDefaultPane(){ + return true; + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return getPlotSeriesPane(); + } + + public BasicBeanPane getPlotSeriesPane(){ + return null; + } + + public boolean equals(Object obj) { + return obj != null && ComparatorUtils.equals(obj.getClass(), this.getClass()); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new DataSeriesConditionPane(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java new file mode 100644 index 000000000..e0e5e8f7d --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java @@ -0,0 +1,49 @@ +package com.fr.design.chart.fun.impl; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.IndependentChartUIProvider; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +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.general.ComparatorUtils; + +/** + * Created by Mitisky on 16/3/7. + */ +public abstract class AbstractIndependentChartUIWithAPILevel implements IndependentChartUIProvider { + @Override + public int currentAPILevel() { + return CURRENT_API_LEVEL; + } + + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + return new AbstractChartAttrPane[0]; + } + + /** + * 是否使用默认的界面,为了避免界面来回切换 + * @return 是否使用默认的界面 + */ + public boolean isUseDefaultPane(){ + return true; + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return getPlotSeriesPane(); + } + + public BasicBeanPane getPlotSeriesPane(){ + return null; + } + + public boolean equals(Object obj) { + return obj != null && ComparatorUtils.equals(obj.getClass(), this.getClass()); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new DataSeriesConditionPane(); + } +} diff --git a/designer_chart/src/com/fr/design/chart/gui/ActiveGlyphFactory.java b/designer_chart/src/com/fr/design/chart/gui/ActiveGlyphFactory.java new file mode 100644 index 000000000..873a9ed40 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/ActiveGlyphFactory.java @@ -0,0 +1,97 @@ +package com.fr.design.chart.gui; + +import java.util.HashMap; +import java.util.Map; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.CategoryAxisGlyph; +import com.fr.chart.chartglyph.ChartAlertValueGlyph; +import com.fr.chart.chartglyph.ChartGlyph; +import com.fr.chart.chartglyph.DataSeries; +import com.fr.chart.chartglyph.DataSheetGlyph; +import com.fr.chart.chartglyph.DateAxisGlyph; +import com.fr.chart.chartglyph.LegendGlyph; +import com.fr.chart.chartglyph.PlotGlyph; +import com.fr.chart.chartglyph.RadarAxisGlyph; +import com.fr.chart.chartglyph.RangeAxisGlyph; +import com.fr.chart.chartglyph.TextGlyph; +import com.fr.chart.chartglyph.TitleGlyph; +import com.fr.chart.chartglyph.TrendLineGlyph; +import com.fr.chart.chartglyph.ValueAxisGlyph; +import com.fr.design.chart.gui.active.ActiveGlyph; +import com.fr.design.chart.gui.active.AlertValueActiveGlyph; +import com.fr.design.chart.gui.active.CategoryAxisActiveGlyph; +import com.fr.design.chart.gui.active.ChartActiveGlyph; +import com.fr.design.chart.gui.active.DataLabelActiveGlyph; +import com.fr.design.chart.gui.active.DataSeriesActiveGlyph; +import com.fr.design.chart.gui.active.DataSheetActiveGlyph; +import com.fr.design.chart.gui.active.DateAxisActiveGlyph; +import com.fr.design.chart.gui.active.LegendActiveGlyph; +import com.fr.design.chart.gui.active.PlotActiveGlyph; +import com.fr.design.chart.gui.active.RadarAxisActiveGlyph; +import com.fr.design.chart.gui.active.RangeAxisActiveGlyph; +import com.fr.design.chart.gui.active.TextActiveGlyph; +import com.fr.design.chart.gui.active.TrendLineActiveGlyph; +import com.fr.design.chart.gui.active.ValueAxisActiveGlyph; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-23 + * Time : 上午9:08 + */ +public class ActiveGlyphFactory { + private static Map glyphMap = new HashMap(); + + static { + glyphMap.put(DataSeries.class.getName(), DataSeriesActiveGlyph.class); + glyphMap.put(RadarAxisGlyph.class.getName(), RadarAxisActiveGlyph.class); + glyphMap.put(RangeAxisGlyph.class.getName(), RangeAxisActiveGlyph.class); + glyphMap.put(TitleGlyph.class.getName(), TextActiveGlyph.class); + glyphMap.put(DateAxisGlyph.class.getName(), DateAxisActiveGlyph.class); + glyphMap.put(ValueAxisGlyph.class.getName(), ValueAxisActiveGlyph.class); + glyphMap.put(CategoryAxisGlyph.class.getName(), CategoryAxisActiveGlyph.class); + glyphMap.put(ChartGlyph.class.getName(), ChartActiveGlyph.class); + glyphMap.put(DataSheetGlyph.class.getName(), DataSheetActiveGlyph.class); + glyphMap.put(LegendGlyph.class.getName(), LegendActiveGlyph.class); + glyphMap.put(TextGlyph.class.getName(), DataLabelActiveGlyph.class); + glyphMap.put(TrendLineGlyph.class.getName(), TrendLineActiveGlyph.class); + glyphMap.put(ChartAlertValueGlyph.class.getName(), AlertValueActiveGlyph.class); + } + + private ActiveGlyphFactory() { + + } + + public static ActiveGlyph createActiveGlyph(ChartComponent chartComponent, Object glyph) { + return createActiveGlyph(chartComponent, glyph, null); + } + + public static ActiveGlyph createActiveGlyph(ChartComponent chartComponent, Object glyph, Glyph parentGlyph) { + if (glyph == null) { + return null; + } + String clsName = glyph.getClass().getName(); + Class cls = glyphMap.get(clsName); + Class parameterCls = glyph.getClass(); + if (cls == null) { + if (clsName.endsWith("PlotGlyph")) { + cls = PlotActiveGlyph.class; + parameterCls = PlotGlyph.class; + } else if (clsName.endsWith("DataSeries4Area")) { + cls = DataSeriesActiveGlyph.class; + parameterCls = DataSeries.class; + } else { + cls = ChartActiveGlyph.class; + parameterCls = ChartGlyph.class; + } + } + try { + Class[] argsClass = new Class[]{ChartComponent.class, parameterCls, Glyph.class}; + return (ActiveGlyph) cls.getConstructor(argsClass).newInstance(new Object[]{chartComponent, glyph, parentGlyph}); + } catch (Exception e) { + return null; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java new file mode 100644 index 000000000..3700299c0 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java @@ -0,0 +1,322 @@ +package com.fr.design.chart.gui; + +import com.fr.base.FRContext; +import com.fr.base.ScreenResolution; +import com.fr.base.chart.BaseChart; +import com.fr.base.chart.BaseChartCollection; +import com.fr.base.chart.BaseChartGlyph; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartattr.Axis; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartglyph.AxisGlyph; +import com.fr.design.chart.gui.active.ActiveGlyph; +import com.fr.design.chart.gui.active.ChartActiveGlyph; +import com.fr.design.gui.chart.MiddleChartComponent; +import com.fr.stable.ArrayUtils; +import com.fr.stable.core.PropertyChangeListener; + +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.geom.Rectangle2D; +import java.awt.geom.RoundRectangle2D; +import java.util.ArrayList; +import java.util.List; + +/** +* @author kunsnat E-mail:kunsnat@gmail.com +* @version 创建时间:2012-7-3 下午02:46:45 +* 类说明: 事件说明: 工具栏编辑--> 是刷新ChartComponent 然后响应整个设计块的改变事件 + 右键编辑 ---> 刷新ChartCompment 刷新对应的工具栏(加入事件) 然后响应整个设计块的改变事件 + */ +public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener { + private static final long serialVersionUID = 744164838619052097L; + private final List listeners = new ArrayList(); + private ChartCollection chartCollection4Design; + private Chart editingChart; + private BaseChartGlyph chartGlyph; + private int chartWidth = -1; + private int chartHeight = -1; + private Point point; + + private ActiveGlyph activeGlyph; + + private boolean supportEdit = true; + + private final int[] resizeCursors = new int[]{ + Cursor.NW_RESIZE_CURSOR, Cursor.N_RESIZE_CURSOR, Cursor.NE_RESIZE_CURSOR, + Cursor.E_RESIZE_CURSOR, Cursor.W_RESIZE_CURSOR, + Cursor.SE_RESIZE_CURSOR, Cursor.S_RESIZE_CURSOR, Cursor.SW_RESIZE_CURSOR + }; + + public ChartComponent() { + super(); + addMouseListener(this); + addMouseMotionListener(this); + } + + /** + * 必须加入 响应事件, 停止当前的选中元素编辑 && 获取焦点 + * @author kunsnat E-mail kunsnat@gmail.com + * @param cc + */ + public ChartComponent(ChartCollection cc) { + this(); + populate(cc); + } + + public ChartComponent(BaseChartCollection cc) { + this(); + populate(cc); + } + + public ChartComponent(ChartCollection cc, PropertyChangeListener l) { + this(); + populate(cc); + addStopEditingListener(l); + } + + + /** + * 右键编辑 图表编辑层的监听事件, 在停止编辑时 响应整个编辑模板(form, sheet)的改变. + * @param l 监听事件 + */ + public void addStopEditingListener(PropertyChangeListener l) { + if (!listeners.contains(l)) { + listeners.add(l); + } + } + + private void fireStopEditing() { + for (int len = listeners.size(), i = len; i > 0; i--) { + listeners.get(i - 1).propertyChange(); + } + } + + /** + * 停止编辑, 通知事情, 刷新画出新界面. + */ + public void reset() { + fireStopEditing(); + + this.editingChart = null; + this.chartGlyph = null; + this.activeGlyph = null; + this.point = null; + this.chartHeight = this.chartWidth = -1; + + this.editingChart = this.chartCollection4Design.getSelectedChart(); + + refreshChartGlyph(); + this.activeGlyph = ActiveGlyphFactory.createActiveGlyph(this, chartGlyph); + + repaint(); + } + + public void populate(BaseChartCollection cc) { // kunsnat_bug: 5471 实现设置的即时预览 + try {// clone 为了判断编辑前后的值. + this.chartCollection4Design = (ChartCollection)cc; +// this.chartCollection4Design = (ChartCollection)cc.clone(); + } catch (Exception e) { + FRContext.getLogger().error("ChartCollection clone is Error"); + } + reset(); + } + + public BaseChartCollection update() { + return this.chartCollection4Design; + } + + /** + * 设置是否支持编辑, 如:弹出对话框, 右键选中列表 + */ + public void setSupportEdit(boolean supportEdit) { + this.supportEdit = supportEdit; + } + + /** + * 返回是否支持编辑, 如:弹出对话框, 右键选中列表 + * @return 返回是否支持编辑. + */ + public boolean isSupportEdit() { + return supportEdit; + } + + public ChartCollection getChartCollection() { + return chartCollection4Design; + } + + public int getChartSize() { + return (this.chartCollection4Design == null) ? 0 : this.chartCollection4Design.getChartCount(); + } + + public BaseChart getEditingChart() { + return editingChart; + } + + public BaseChartGlyph getChartGlyph() { + return chartGlyph; + } + + public void paintComponent(Graphics g) { // + super.paintComponent(g); + + Graphics2D g2d = (Graphics2D) g; + + Paint oldPaint = g2d.getPaint(); + + g2d.setPaint(Color.white); + g2d.fillRect(0, 0, this.getBounds().width, this.getBounds().height); + g2d.setPaint(oldPaint); + + g2d.translate(ChartConstants.PREGAP4BOUNDS/2, ChartConstants.PREGAP4BOUNDS/2); + + if (needRefreshChartGlyph()) { + refreshChartGlyph(); + } + + Object lastHint = g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING); + // 反锯齿 + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + drawChartGlyph(g2d); + + ActiveGlyph ag = this.getActiveGlyph(); + if (ag != null) { + ag.paint4ActiveGlyph(g2d, chartGlyph); + } + + g2d.translate(-ChartConstants.PREGAP4BOUNDS/2, -ChartConstants.PREGAP4BOUNDS/2); + if (lastHint == null) { + lastHint = RenderingHints.VALUE_ANTIALIAS_OFF; + } + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, lastHint); + } + + /* + * ChartGlyph改变大小的时候做的操作 + */ + private void refreshChartGlyph() { + Dimension d = getBounds().getSize(); + this.editingChart = this.chartCollection4Design.getSelectedChart();// kunsnat: 切换选中时 同步切换Plot + if (editingChart != null) { + this.chartGlyph = editingChart.createGlyph(editingChart.defaultChartData()); + this.activeGlyph = ActiveGlyphFactory.createActiveGlyph(this, chartGlyph); + } + this.chartWidth = d.width - ChartConstants.PREGAP4BOUNDS; + this.chartHeight = d.height - ChartConstants.PREGAP4BOUNDS; + } + + private ActiveGlyph getActiveGlyph() { + if (point == null) { + this.activeGlyph = new ChartActiveGlyph(this, chartGlyph); + } else { + this.activeGlyph = new ChartActiveGlyph(this, chartGlyph).findActionGlyphFromChildren(point.x, point.y); + } + return this.activeGlyph; + } + + /** + * 鼠标点击 + * @param event 鼠标事件 + */ + public void mouseClicked(MouseEvent event) { + int click = event.getClickCount(); + if (click >= 1 && activeGlyph != null && this.isSupportEdit()) { + activeGlyph.goRightPane(); + } + } + + /** + * 鼠标按压 + * @param e 鼠标事件 + */ + public void mousePressed(MouseEvent e) { + point = new Point(e.getX(),e.getY()); + if (!ArrayUtils.contains(resizeCursors, this.getCursor().getType())) { + this.activeGlyph = new ChartActiveGlyph(this, chartGlyph).findActionGlyphFromChildren(point.x, point.y); + } + + if (this.activeGlyph == null) { + return; + } + + repaint(); + + } + + /** + * 鼠标松开 + * @param e 鼠标事件 + */ + public void mouseReleased(MouseEvent e) { + } + + /** + * 鼠标进入 + * @param e 鼠标事件 + */ + public void mouseEntered(MouseEvent e) { + + } + + /** + * 鼠标退出 + * @param e 鼠标事件 + */ + public void mouseExited(MouseEvent e) { + + } + + /** + * 鼠标拖拽 + * @param e 鼠标事件 + */ + public void mouseDragged(MouseEvent e) { + } + + /** + * 鼠标移动 + * @param e 鼠标事件 + */ + public void mouseMoved(MouseEvent e) { + ActiveGlyph ag = this.getActiveGlyph(); + if (ag != null) { + ag.onMouseMove(e); + } + } + + public AxisGlyph getActiveAxisGlyph() { + return (AxisGlyph) activeGlyph.getGlyph(); + } + + public Axis getActiveAxis() { + AxisGlyph axisGlyph = getActiveAxisGlyph(); + if (editingChart.getPlot() != null) { + return editingChart.getPlot().getAxis(axisGlyph.getAxisType()); + } + return null; + } + + private boolean needRefreshChartGlyph() { + return chartGlyph == null || chartWidth != this.getBounds().width || chartHeight != this.getBounds().height; + } + + private void drawChartGlyph(Graphics2D g2d) { + if (chartGlyph != null) { + if (chartGlyph.isRoundBorder()) { + chartGlyph.setBounds(new RoundRectangle2D.Double(0, 0, chartWidth, chartHeight, 10, 10)); + } else { + chartGlyph.setBounds(new Rectangle2D.Double(0, 0, chartWidth, chartHeight)); + } + // chartGlyph.draw(g2d, ScreenResolution.getScreenResolution()); + //不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单 + //其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边 + Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution()); + g2d.drawImage(chartImage, 0, 0, chartWidth, chartHeight, null); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartWidgetOption.java b/designer_chart/src/com/fr/design/chart/gui/ChartWidgetOption.java new file mode 100644 index 000000000..a740a202a --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/ChartWidgetOption.java @@ -0,0 +1,79 @@ +package com.fr.design.chart.gui; + +import com.fr.base.FRContext; +import com.fr.chart.chartattr.Chart; +import com.fr.design.gui.core.WidgetOption; +import com.fr.form.ui.ChartEditor; +import com.fr.form.ui.Widget; + +import javax.swing.*; + +/** + * 表单中 图表控件信息, 名称, class, form中通过XcreatorUtils反射类 实现XChartEditor的初始化. + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-7-5 上午09:59:39 + */ +public class ChartWidgetOption extends WidgetOption { + private static final long serialVersionUID = -6576352405047132226L; + private String optionName; + private Icon optionIcon; + private Class widgetClass; + private Chart chart; + + public ChartWidgetOption(String optionName, Icon optionIcon, Class widgetClass, Chart chart) { + this.optionName = optionName; + this.optionIcon = optionIcon; + this.widgetClass = widgetClass; + this.chart = chart; + } + + /** + * 通过类 信息等 创建对应的控件编辑器. + * + * @return 返回控件编辑器. + */ + public Widget createWidget() { + Class clz = widgetClass(); + try { + ChartEditor widget = clz.newInstance(); + widget.addChart((Chart) chart.clone()); + return widget; + } catch (InstantiationException e) { + FRContext.getLogger().error(e.getMessage(), e); + } catch (IllegalAccessException e) { + FRContext.getLogger().error(e.getMessage(), e); + } catch (CloneNotSupportedException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + + return null; + } + + /** + * 信息名称, 一般是图表的类型名称. + * + * @return 返回名称. + */ + public String optionName() { + return this.optionName; + } + + /** + * 信息图片, 一般是图表按钮的缩略图. + * + * @return 信息图片. + */ + public Icon optionIcon() { + return this.optionIcon; + } + + /** + * 图表控件对应Editor的类. + * + * @return 返回类. + */ + public Class widgetClass() { + return this.widgetClass; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/ActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/ActiveGlyph.java new file mode 100644 index 000000000..c0fa1e193 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/ActiveGlyph.java @@ -0,0 +1,161 @@ +package com.fr.design.chart.gui.active; + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.Shape; +import java.awt.event.MouseEvent; +import java.awt.geom.Point2D; + +import com.fr.base.ScreenResolution; +import com.fr.base.chart.BaseChartGlyph; +import com.fr.base.chart.Glyph; +import com.fr.design.chart.gui.ActiveGlyphFactory; +import com.fr.design.chart.gui.ChartComponent; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午3:51 + * 选中的Glyph + */ +public abstract class ActiveGlyph { + protected Glyph parentGlyph; + protected ChartComponent chartComponent; + + public ActiveGlyph(ChartComponent chartComponent, Glyph parentGlyph) { + this.chartComponent = chartComponent; + this.parentGlyph = parentGlyph; + } + + public abstract Glyph getGlyph(); + + public void drawAllGlyph(Graphics2D g2d, int resolution){ + Point2D offset4Paint = offset4Paint(); + g2d.translate(offset4Paint.getX(), offset4Paint.getY()); + this.getGlyph().draw(g2d, resolution); + g2d.translate(-offset4Paint.getX(), -offset4Paint.getY()); + }; + + /** + * 属性表中, 通过点击 展开到对应的界面. + */ + public abstract void goRightPane(); + + /** + * 画的偏移的 + * @return 偏移的 + */ + public Point2D offset4Paint() { + return new Point2D.Double( + this.parentGlyph.getShape().getBounds().getX(), + this.parentGlyph.getShape().getBounds().getY() + ); + } + + public void paint4ActiveGlyph(Graphics2D g2d, BaseChartGlyph chartGlyph) { + if(this.parentGlyph == null) { + return; + } + + Paint oldPaint = g2d.getPaint(); + Composite oldComposite = g2d.getComposite(); + g2d.setPaint(Color.white); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); + + g2d.fill(chartGlyph.getShape()); + drawAllGlyph(g2d, ScreenResolution.getScreenResolution()); + + g2d.setPaint(oldPaint); + g2d.setComposite(oldComposite); + } + + protected void drawSelectedBounds4Active(Graphics2D g2d) { + if (this.getGlyph() != null) { + Shape shape = this.getGlyph().getShape(); + if (shape != null) { + g2d.draw(shape); + } + } + } + + + /** + *当前的ActiveGlyph是否包含坐标mouseX, mouseY + * @param mouseX 坐标X + * @param mouseY 坐标Y + * @return 包含则返回true + */ + public boolean contains(int mouseX, int mouseY) { + if (getGlyph() == null || getGlyph().getShape() == null){ + return false; + } + + Point2D offset = this.offset4Paint(); + + /* + * alex:因为Line2D.contains(x, y)必然返回false + * 所以用intersect一个区域,这个区域大小用4 * 4的,区域大一些,就灵敏一些 + */ + return getGlyph().getShape().intersects(mouseX - offset.getX() - 2, mouseY - offset.getY() - 2, 4, 4); + } + + /** + * 在当前选中的ActiveGlyph中,仅仅在其Children中找与mouseX, mouseY匹配的ActiveGlyph + * @param mouseX 坐标X + * @param mouseY 坐标Y + * @return 当前ativeGlyph + */ + public ActiveGlyph findActionGlyphFromChildren(int mouseX, int mouseY) { + Glyph currentGlyph = getGlyph(); + // 报错应对. + if (currentGlyph == null) { + return null; + } + java.util.Iterator selectableChildren = currentGlyph.selectableChildren(); + + ActiveGlyph resAG = null; + while (selectableChildren.hasNext() && resAG == null) { + ActiveGlyph childActiveGlyph = ActiveGlyphFactory.createActiveGlyph(chartComponent, selectableChildren.next(), currentGlyph); + + // 如果childActiveGlyph不为null,找一下其子辈有没有符合条件 + if (childActiveGlyph != null) { + resAG = childActiveGlyph.findActionGlyphFromChildren(mouseX, mouseY); + } + + // 如果childActiveGlyph的子辈没有符合条件的,就看一下这个childGlyph是否符合条件 + if (resAG == null && childActiveGlyph != null && childActiveGlyph.contains(mouseX, mouseY)) { + resAG = childActiveGlyph; + } + } + + // 如果当前ActiveGlyph的所有子辈都没有与mouseX, mouseY相匹配的,看一下它自己是否匹配 + if (resAG == null) { + if (this.contains(mouseX, mouseY)) { + resAG = this; + } + } + + return resAG; + } + + /** + * 拖拽 + * @param e 事件 + */ + public void onMouseDragged(MouseEvent e) { + + } + + /** + * 移动事件 + * @param e 事件 + */ + public void onMouseMove(MouseEvent e) { + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/AlertValueActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/AlertValueActiveGlyph.java new file mode 100644 index 000000000..dacf9e773 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/AlertValueActiveGlyph.java @@ -0,0 +1,38 @@ +package com.fr.design.chart.gui.active; + +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.ChartAlertValueGlyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.gui.active.action.SetAnalysisLineStyleAction; + +public class AlertValueActiveGlyph extends ActiveGlyph{ + ChartAlertValueGlyph alertValueGlyph; + + public AlertValueActiveGlyph(ChartComponent chartComponent,ChartAlertValueGlyph alertLine, Glyph parentGlyph) { + super(chartComponent, parentGlyph); + this.alertValueGlyph = alertLine; + } + + public Point2D offset4Paint() { + Rectangle2D valueAxisBoudns = this.alertValueGlyph.getValueAxisGlyph().getBounds(); + + return new Point2D.Double( + this.parentGlyph.getShape().getBounds().getX() + valueAxisBoudns.getX(), + this.parentGlyph.getShape().getBounds().getY() + valueAxisBoudns.getY() + ); + } + + @Override + public Glyph getGlyph() { + return this.alertValueGlyph; + } + + @Override + public void goRightPane() { + new SetAnalysisLineStyleAction(chartComponent).showAnalysisLineStylePane(); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/AxisActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/AxisActiveGlyph.java new file mode 100644 index 000000000..4ddcc02cc --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/AxisActiveGlyph.java @@ -0,0 +1,43 @@ +package com.fr.design.chart.gui.active; + +import java.awt.Graphics2D; +import java.awt.geom.Point2D; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.AxisGlyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.gui.active.action.SetAxisStyleAction; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午4:00 + */ +public abstract class AxisActiveGlyph extends ActiveGlyph { + protected AxisGlyph axis; + + public AxisActiveGlyph(ChartComponent chartComponent, AxisGlyph axis, Glyph parentGlyph) { + super(chartComponent, parentGlyph); + this.axis = axis; + } + + public void drawAllGlyph(Graphics2D g2d, int resolution){ + Point2D offset4Paint = offset4Paint(); + g2d.translate(offset4Paint.getX(), offset4Paint.getY()); + this.axis.drawWithOutAlert(g2d, resolution); + g2d.translate(-offset4Paint.getX(), -offset4Paint.getY()); + }; + + public void goRightPane() { + new SetAxisStyleAction(chartComponent).showAxisStylePane(); + } + + /** + * 返回 对应的属性Axis + */ + public Glyph getGlyph() { + return this.axis; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/CategoryAxisActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/CategoryAxisActiveGlyph.java new file mode 100644 index 000000000..c7028f6d5 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/CategoryAxisActiveGlyph.java @@ -0,0 +1,19 @@ +package com.fr.design.chart.gui.active; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.CategoryAxisGlyph; +import com.fr.design.chart.gui.ChartComponent; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午4:01 + */ +public class CategoryAxisActiveGlyph extends AxisActiveGlyph { + + public CategoryAxisActiveGlyph(ChartComponent chartComponent, CategoryAxisGlyph axis, Glyph parentGlyph) { + super(chartComponent, axis, parentGlyph); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/ChartActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/ChartActiveGlyph.java new file mode 100644 index 000000000..6fa626ce1 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/ChartActiveGlyph.java @@ -0,0 +1,39 @@ +package com.fr.design.chart.gui.active; + +import java.awt.geom.Point2D; + +import com.fr.base.chart.BaseChartGlyph; +import com.fr.base.chart.Glyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.gui.active.action.SetChartStyleAciton; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午3:54 + */ +public class ChartActiveGlyph extends ActiveGlyph { + private BaseChartGlyph glyphChart; + + public ChartActiveGlyph(ChartComponent chartComponent, BaseChartGlyph chart) { + this(chartComponent, chart, null); + } + public ChartActiveGlyph(ChartComponent chartComponent, BaseChartGlyph chart, Glyph parentGlyph) { + super(chartComponent, parentGlyph); + this.glyphChart = chart; + } + + public Glyph getGlyph() { + return this.glyphChart; + } + + public Point2D offset4Paint() { + return new java.awt.Point(0, 0); + } + + public void goRightPane() { + new SetChartStyleAciton(chartComponent).showChartStylePane(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/DataLabelActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/DataLabelActiveGlyph.java new file mode 100644 index 000000000..6603ba4e0 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/DataLabelActiveGlyph.java @@ -0,0 +1,44 @@ +package com.fr.design.chart.gui.active; + +import java.awt.Graphics2D; +import java.awt.geom.Point2D; +import java.util.ArrayList; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.PlotGlyph; +import com.fr.chart.chartglyph.TextGlyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.gui.active.action.SetDataLabelStyleAction; + +public class DataLabelActiveGlyph extends ActiveGlyph{ + private TextGlyph dataLabel; + + public DataLabelActiveGlyph(ChartComponent chartComponent, TextGlyph dataLabel, Glyph parentGlyph) { + super(chartComponent, parentGlyph); + this.dataLabel = dataLabel; + } + + public void drawAllGlyph(Graphics2D g2d, int resolution){ + Point2D offset4Paint = offset4Paint(); + g2d.translate(offset4Paint.getX(), offset4Paint.getY()); + + ArrayList allDataPointLableGlyph = new ArrayList(); + PlotGlyph plotGlyph = (PlotGlyph)(this.parentGlyph); + plotGlyph.getAllDataPointGlyph(allDataPointLableGlyph); + for(int index = 0; index < allDataPointLableGlyph.size(); index++){ + allDataPointLableGlyph.get(index).draw(g2d, resolution); + } + g2d.translate(-offset4Paint.getX(), -offset4Paint.getY()); + }; + + @Override + public Glyph getGlyph() { + return this.dataLabel; + } + + @Override + public void goRightPane() { + new SetDataLabelStyleAction(chartComponent).showDataLabelStylePane(); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java new file mode 100644 index 000000000..0543764e3 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java @@ -0,0 +1,53 @@ +package com.fr.design.chart.gui.active; + +import java.awt.Graphics2D; +import java.awt.geom.Point2D; +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.DataSeries; +import com.fr.chart.chartglyph.PlotGlyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午3:59 + */ +public class DataSeriesActiveGlyph extends ActiveGlyph { + private DataSeries series; + + public DataSeriesActiveGlyph(ChartComponent chartComponent, DataSeries series, Glyph parentGlyph) { + super(chartComponent, parentGlyph); + this.series = series; + } + + public Glyph getGlyph() { + return this.series; + } + + /** + * 界面条状 + */ + public void goRightPane() { + if(chartComponent.getEditingChart() == null) { + return; + } + + ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_SERIES_TITLE); + } + + @Override + public void drawAllGlyph(Graphics2D g2d, int resolution) { + Point2D offset4Paint = offset4Paint(); + g2d.translate(offset4Paint.getX(), offset4Paint.getY()); + if(this.parentGlyph != null && this.parentGlyph instanceof PlotGlyph){ + PlotGlyph plotGlyph = (PlotGlyph)this.parentGlyph; + plotGlyph.drawShape4Series(g2d, resolution); + } + g2d.translate(-offset4Paint.getX(), -offset4Paint.getY()); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/DataSheetActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/DataSheetActiveGlyph.java new file mode 100644 index 000000000..c74d07770 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/DataSheetActiveGlyph.java @@ -0,0 +1,30 @@ +package com.fr.design.chart.gui.active; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.DataSheetGlyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.gui.active.action.SetDataSheetAction; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午3:57 + */ +public class DataSheetActiveGlyph extends ActiveGlyph { + private DataSheetGlyph dataSheetGlyph; + + public DataSheetActiveGlyph(ChartComponent chartComponent, DataSheetGlyph dataSheetGlyph, Glyph parentGlyph) { + super(chartComponent, parentGlyph); + this.dataSheetGlyph = dataSheetGlyph; + } + + public Glyph getGlyph() { + return this.dataSheetGlyph; + } + + public void goRightPane() { + new SetDataSheetAction(chartComponent).showDataSheetStylePane(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/DateAxisActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/DateAxisActiveGlyph.java new file mode 100644 index 000000000..22d145d9e --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/DateAxisActiveGlyph.java @@ -0,0 +1,18 @@ +package com.fr.design.chart.gui.active; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.DateAxisGlyph; +import com.fr.design.chart.gui.ChartComponent; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午4:03 + */ +public class DateAxisActiveGlyph extends AxisActiveGlyph { + public DateAxisActiveGlyph(ChartComponent chartComponent, DateAxisGlyph axis, Glyph parentGlyph) { + super(chartComponent, axis, parentGlyph); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/LegendActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/LegendActiveGlyph.java new file mode 100644 index 000000000..496009923 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/LegendActiveGlyph.java @@ -0,0 +1,30 @@ +package com.fr.design.chart.gui.active; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.LegendGlyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.gui.active.action.SetLegendStyleAction; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午3:58 + */ +public class LegendActiveGlyph extends ActiveGlyph { + private LegendGlyph legendGlyph; + + public LegendActiveGlyph(ChartComponent chartComponent, LegendGlyph legendGlyph, Glyph parentGlyph) { + super(chartComponent, parentGlyph); + this.legendGlyph = legendGlyph; + } + + public Glyph getGlyph() { + return this.legendGlyph; + } + + public void goRightPane() { + new SetLegendStyleAction(chartComponent).showLegendStylePane(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/PlotActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/PlotActiveGlyph.java new file mode 100644 index 000000000..bf23cc839 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/PlotActiveGlyph.java @@ -0,0 +1,34 @@ +package com.fr.design.chart.gui.active; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.PlotGlyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.gui.active.action.SetPlotStyleAction; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午3:55 + */ +public class PlotActiveGlyph extends ActiveGlyph { + private PlotGlyph plotGlyph; + + public PlotActiveGlyph(ChartComponent chartComponent, PlotGlyph plotGlyph, Glyph parentGlyph) { + super(chartComponent, parentGlyph); + this.plotGlyph = plotGlyph; + } + + public Glyph getGlyph() { + return this.plotGlyph; + } + + public void goRightPane() { + new SetPlotStyleAction(chartComponent).showPlotPane(); + } + + public java.awt.Point offset4Paint() { + return new java.awt.Point(0, 0); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/RadarAxisActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/RadarAxisActiveGlyph.java new file mode 100644 index 000000000..682a0ae3b --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/RadarAxisActiveGlyph.java @@ -0,0 +1,18 @@ +package com.fr.design.chart.gui.active; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.RadarAxisGlyph; +import com.fr.design.chart.gui.ChartComponent; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午4:03 + */ +public class RadarAxisActiveGlyph extends AxisActiveGlyph { + public RadarAxisActiveGlyph(ChartComponent chartComponent, RadarAxisGlyph axis, Glyph parentGlyph) { + super(chartComponent, axis, parentGlyph); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/RangeAxisActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/RangeAxisActiveGlyph.java new file mode 100644 index 000000000..071d42ab5 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/RangeAxisActiveGlyph.java @@ -0,0 +1,18 @@ +package com.fr.design.chart.gui.active; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.ValueAxisGlyph; +import com.fr.design.chart.gui.ChartComponent; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午4:02 + */ +public class RangeAxisActiveGlyph extends AxisActiveGlyph { + public RangeAxisActiveGlyph(ChartComponent chartComponent, ValueAxisGlyph axis, Glyph parentGlyph) { + super(chartComponent, axis, parentGlyph); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/TextActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/TextActiveGlyph.java new file mode 100644 index 000000000..9c989ea45 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/TextActiveGlyph.java @@ -0,0 +1,35 @@ +package com.fr.design.chart.gui.active; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.TitleGlyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.gui.active.action.SetTitleStyleAction; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午3:57 + */ +public class TextActiveGlyph extends ActiveGlyph { + private TitleGlyph titleGlyph; + + public TextActiveGlyph(ChartComponent chartComponent, TitleGlyph titleGlyph, Glyph parentGlyph) { + super(chartComponent, parentGlyph); + this.titleGlyph = titleGlyph; + } + + public Glyph getGlyph() { + return this.titleGlyph; + } + + public java.awt.Point offset4Paint() { + return new java.awt.Point(0, 0); + } + + public void goRightPane() { + new SetTitleStyleAction(chartComponent).showTitlePane(); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/TrendLineActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/TrendLineActiveGlyph.java new file mode 100644 index 000000000..9bd457d68 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/TrendLineActiveGlyph.java @@ -0,0 +1,43 @@ +package com.fr.design.chart.gui.active; + +import java.awt.Graphics2D; +import java.awt.geom.Point2D; +import java.util.ArrayList; +import java.util.List; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.PlotGlyph; +import com.fr.chart.chartglyph.TrendLineGlyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.gui.active.action.SetAnalysisLineStyleAction; + +public class TrendLineActiveGlyph extends ActiveGlyph{ + private TrendLineGlyph trendLine; + public TrendLineActiveGlyph(ChartComponent chartComponent,TrendLineGlyph trendLine, Glyph parentGlyph) { + super(chartComponent, parentGlyph); + this.trendLine = trendLine; + } + + @Override + public Glyph getGlyph() { + return this.trendLine; + } + + public void drawAllGlyph(Graphics2D g2d, int resolution){ + Point2D offset4Paint = offset4Paint(); + g2d.translate(offset4Paint.getX(), offset4Paint.getY()); + PlotGlyph plotGlyph = (PlotGlyph)this.parentGlyph; + List list = new ArrayList(); + plotGlyph.getAllTrendLineGlyph(list); + for(int index = 0; index < list.size(); index++){ + list.get(index).draw(g2d, resolution); + } + g2d.translate(-offset4Paint.getX(), -offset4Paint.getY()); + }; + + @Override + public void goRightPane() { + new SetAnalysisLineStyleAction(chartComponent).showAnalysisLineStylePane(); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/ValueAxisActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/ValueAxisActiveGlyph.java new file mode 100644 index 000000000..cc37df5ca --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/ValueAxisActiveGlyph.java @@ -0,0 +1,19 @@ +package com.fr.design.chart.gui.active; + +import com.fr.base.chart.Glyph; +import com.fr.chart.chartglyph.ValueAxisGlyph; +import com.fr.design.chart.gui.ChartComponent; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午4:02 + */ +public class ValueAxisActiveGlyph extends AxisActiveGlyph { + + public ValueAxisActiveGlyph(ChartComponent chartComponent, ValueAxisGlyph axis, Glyph parentGlyph) { + super(chartComponent, axis, parentGlyph); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/ChartComponentAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/ChartComponentAction.java new file mode 100644 index 000000000..061f87cd6 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/ChartComponentAction.java @@ -0,0 +1,47 @@ +package com.fr.design.chart.gui.active.action; + +import com.fr.base.chart.BaseChart; +import com.fr.chart.chartattr.Axis; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartglyph.AxisGlyph; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.actions.UpdateAction; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午5:05 + */ +public abstract class ChartComponentAction extends UpdateAction { + protected ChartComponent chartComponent; + + public ChartComponentAction(ChartComponent chartComponent) { + this.chartComponent = chartComponent; + } + + public void reset() { + chartComponent.reset(); + } + + public void repaint() { + chartComponent.repaint(); + } + + public BaseChart getEditingChart() { + return chartComponent.getEditingChart(); + } + + public ChartCollection getChartCollection() { + return chartComponent.getChartCollection(); + } + + public Axis getActiveAxis() { + return chartComponent.getActiveAxis(); + } + + public AxisGlyph getActiveAxisGlyph() { + return chartComponent.getActiveAxisGlyph(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java new file mode 100644 index 000000000..b4ca9a1c8 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java @@ -0,0 +1,27 @@ +package com.fr.design.chart.gui.active.action; + +import java.awt.event.ActionEvent; + +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.general.Inter; + +public class SetAnalysisLineStyleAction extends ChartComponentAction{ + + public SetAnalysisLineStyleAction(ChartComponent chartComponent) { + super(chartComponent); + this.setName(Inter.getLocText(new String[]{"Set", "AnalysisLine"})); + } + + @Override + public void actionPerformed(ActionEvent e) { + showAnalysisLineStylePane(); + } + + public void showAnalysisLineStylePane(){ + ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LINE_TITLE); + } + + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java new file mode 100644 index 000000000..26484bfb5 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java @@ -0,0 +1,33 @@ +package com.fr.design.chart.gui.active.action; + +import java.awt.event.ActionEvent; + +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午5:10 + */ +public class SetAxisStyleAction extends ChartComponentAction { + public SetAxisStyleAction(ChartComponent chartComponent) { + super(chartComponent); + this.setName(Inter.getLocText(new String[]{"Set", "ChartF-Axis", "Format"})); + } + + public void actionPerformed(ActionEvent e) { + showAxisStylePane(); + } + + public void showAxisStylePane() { + String axisType = getActiveAxisGlyph() == null ? StringUtils.EMPTY : getActiveAxisGlyph().getAxisType(); + + ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AXIS_TITLE, axisType); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java new file mode 100644 index 000000000..b3effe37a --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java @@ -0,0 +1,31 @@ +package com.fr.design.chart.gui.active.action; + +import java.awt.event.ActionEvent; + +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.general.Inter; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午5:00 + */ +public class SetChartStyleAciton extends ChartComponentAction { + + public SetChartStyleAciton(ChartComponent chartComponent) { + super(chartComponent); + this.setName(Inter.getLocText(new String[]{"DashBoard-ChartFloat", "Style"})); + } + + public void actionPerformed(ActionEvent e) { + showChartStylePane(); + } + + public void showChartStylePane() { + ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_AREA_TITLE); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java new file mode 100644 index 000000000..e565d8e16 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java @@ -0,0 +1,26 @@ +package com.fr.design.chart.gui.active.action; + +import java.awt.event.ActionEvent; + +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.general.Inter; + +public class SetDataLabelStyleAction extends ChartComponentAction{ + + public SetDataLabelStyleAction(ChartComponent chartComponent) { + super(chartComponent); + this.setName(Inter.getLocText(new String[]{"Set", "Data-Label"})); + } + + @Override + public void actionPerformed(ActionEvent e) { + showDataLabelStylePane(); + } + + public void showDataLabelStylePane() { + ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LABEL_TITLE); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSeriesAttrAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSeriesAttrAction.java new file mode 100644 index 000000000..96480ebd8 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSeriesAttrAction.java @@ -0,0 +1,26 @@ +package com.fr.design.chart.gui.active.action; + +import java.awt.event.ActionEvent; + +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.general.Inter; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午5:28 + */ +public class SetDataSeriesAttrAction extends ChartComponentAction { + public SetDataSeriesAttrAction(ChartComponent chartComponent) { + super(chartComponent); + this.setName(Inter.getLocText(new String[]{"Set", "ChartF-Series", "Format"})); + } + + public void actionPerformed(ActionEvent e) { + ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_SERIES_TITLE); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSheetAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSheetAction.java new file mode 100644 index 000000000..6aedd01b1 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSheetAction.java @@ -0,0 +1,33 @@ +package com.fr.design.chart.gui.active.action; + +import java.awt.event.ActionEvent; + +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.general.Inter; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午4:49 + */ +public class SetDataSheetAction extends ChartComponentAction { + + private static final long serialVersionUID = -4763886493273213850L; + + public SetDataSheetAction(ChartComponent chartComponent) { + super(chartComponent); + this.setName(Inter.getLocText("Chart_Set_Data_Sheet")); + } + + public void actionPerformed(ActionEvent e) { + showDataSheetStylePane(); + } + + public void showDataSheetStylePane() { + ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_DATA_TITLE); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java new file mode 100644 index 000000000..0a203db88 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java @@ -0,0 +1,32 @@ +package com.fr.design.chart.gui.active.action; + +import java.awt.event.ActionEvent; + +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.general.Inter; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午4:56 + */ +public class SetLegendStyleAction extends ChartComponentAction { + private static final long serialVersionUID = 3253190503195130478L; + + public SetLegendStyleAction(ChartComponent chartComponent) { + super(chartComponent); + this.setName(Inter.getLocText("Set_Legend_Sytle")); + } + + public void actionPerformed(ActionEvent e) { + showLegendStylePane(); + } + + public void showLegendStylePane() { + ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LEGNED_TITLE); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java new file mode 100644 index 000000000..b49fb6ac6 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java @@ -0,0 +1,32 @@ +package com.fr.design.chart.gui.active.action; + +import java.awt.event.ActionEvent; + +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.general.Inter; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午4:58 + */ +public class SetPlotStyleAction extends ChartComponentAction { + private static final long serialVersionUID = 2894127568015714372L; + + public SetPlotStyleAction(ChartComponent chartComponent) { + super(chartComponent); + this.setName(Inter.getLocText(new String[]{"Set", "ChartF-Plot"})); + } + + public void actionPerformed(ActionEvent e) { + showPlotPane(); + } + + public void showPlotPane() { + ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_PLOT_TITLE); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java new file mode 100644 index 000000000..f86f302a5 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java @@ -0,0 +1,32 @@ +package com.fr.design.chart.gui.active.action; + +import java.awt.event.ActionEvent; + +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.general.Inter; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-22 + * Time : 下午4:52 + */ +public class SetTitleStyleAction extends ChartComponentAction { + private static final long serialVersionUID = -4763886493273213850L; + + public SetTitleStyleAction(ChartComponent chartComponent) { + super(chartComponent); + this.setName(Inter.getLocText(new String[]{"Set", "Title", "Style"})); + } + + public void actionPerformed(ActionEvent e) { + showTitlePane(); + } + + public void showTitlePane() { + ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_TITLE_TITLE); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/javascript/ChartEmailPane.java b/designer_chart/src/com/fr/design/chart/javascript/ChartEmailPane.java new file mode 100644 index 000000000..040a24fed --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/javascript/ChartEmailPane.java @@ -0,0 +1,81 @@ +package com.fr.design.chart.javascript; + +import javax.swing.JComponent; +import javax.swing.JScrollPane; +import javax.swing.SwingConstants; + +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.javascript.EmailPane; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.general.Inter; +import com.fr.js.EmailJavaScript; + +/** + * + * @author jim + * + */ +public class ChartEmailPane extends EmailPane{ + + private UITextField itemNameTextField; + + @Override + protected void initCenterPane(UILabel mainTextLabel, JScrollPane scrollPane, double fill, double preferred) { + double[] columnSize = { preferred, fill}; + itemNameTextField = new UITextField(); + JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); + // 是否支持导出控制图表的超链邮件是否显示showTplContent + boolean supportExport = jTemplate.isJWorkBook(); + if (supportExport) { + double[] rSizes = { preferred, preferred, preferred, preferred, preferred, preferred, fill, preferred, preferred}; + showTplContent = new UICheckBox(Inter.getLocText("Email-Can_Preview_Report_Content")); + centerPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ + {new UILabel(Inter.getLocText("Name") + ":", SwingConstants.RIGHT), itemNameTextField}, + {new UILabel(), tipsPane1}, + createLinePane(Inter.getLocText("HJS-Mail_to"), maitoEditor = new UITextField()), + createLinePane(Inter.getLocText("HJS-CC_to"), ccEditor = new UITextField()), + createLinePane(Inter.getLocText("EmailPane-BCC"), bccEditor = new UITextField()), + createLinePane(Inter.getLocText("EmailPane-mailSubject"), titleEditor = new UITextField()), + {mainTextLabel, scrollPane}, + {new UILabel(), showTplContent}, + {new UILabel(), tipsPane2}},rSizes, columnSize, 6); + } else { + double[] rSizes = { preferred, preferred, preferred, preferred, preferred, preferred, fill, preferred}; + centerPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ + {new UILabel(Inter.getLocText("Name") + ":", SwingConstants.RIGHT), itemNameTextField}, + {new UILabel(), tipsPane1}, + createLinePane(Inter.getLocText("HJS-Mail_to"), maitoEditor = new UITextField()), + createLinePane(Inter.getLocText("HJS-CC_to"), ccEditor = new UITextField()), + createLinePane(Inter.getLocText("EmailPane-BCC"), bccEditor = new UITextField()), + createLinePane(Inter.getLocText("EmailPane-mailSubject"), titleEditor = new UITextField()), + {mainTextLabel, scrollPane}, + {new UILabel(), tipsPane2}},rSizes, columnSize, 8); + } + } + + protected void checkEmailConfig(boolean valid) { + super.checkEmailConfig(valid); + if(itemNameTextField != null){ + itemNameTextField.setEnabled(valid); + } + } + + public void populateBean(EmailJavaScript ob) { + if(itemNameTextField != null){ + itemNameTextField.setName(ob == null ? null : ob.getItemName()); + } + super.populateBean(ob); + } + + public void updateBean(EmailJavaScript email) { + if(itemNameTextField != null){ + email.setItemName(itemNameTextField.getText()); + } + super.updateBean(email); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/GisMapDataPane.java b/designer_chart/src/com/fr/design/chart/report/GisMapDataPane.java new file mode 100644 index 000000000..6910681e0 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/GisMapDataPane.java @@ -0,0 +1,155 @@ +package com.fr.design.chart.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.GisMapReportDefinition; +import com.fr.chart.chartdata.GisMapTableDefinition; +import com.fr.chart.chartdata.TopDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.data.DataContentsPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class GisMapDataPane extends DataContentsPane{ + private static final long serialVersionUID = -190573722921978406L; + + private UIComboBoxPane dataFromPane;// 数据来源的box界面 + + private GisMapReportDataContentPane reportPane; + private GisMapTableDataContentPane tablePane; + private AttributeChangeListener listener; + + public GisMapDataPane(AttributeChangeListener listener) { + super(); + this.listener = listener; + } + + + /** + * 判断准许的情况 + * @param ob 传入的对象 + * @return 返回是否允许 + */ + public boolean accept(Object ob) { + return ob instanceof TopDefinition; + } + + /** + * 重置 + */ + public void reset() { + + } + + /** + * 界面标题 + * @return 界面标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("ChartF-Gis"); + } + + public void setSupportCellData(boolean surpportCellData) { + dataFromPane.justSupportOneSelect(surpportCellData); + } + + + @Override + public void populate(ChartCollection collection) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + + if(definition instanceof GisMapTableDefinition) { + dataFromPane.setSelectedIndex(0); + tablePane.populateBean((GisMapTableDefinition)definition); + }else if(definition instanceof GisMapReportDefinition) { + dataFromPane.setSelectedIndex(1); + reportPane.populateBean((GisMapReportDefinition)definition); + } + + this.initAllListeners(); + this.addAttributeChangeListener(listener); + } + + @Override + public void update(ChartCollection collection) { + if(dataFromPane.getSelectedIndex() == 0){ + collection.getSelectedChart().setFilterDefinition(tablePane.updateBean()); + }else if(dataFromPane.getSelectedIndex() == 1){ + collection.getSelectedChart().setFilterDefinition(reportPane.updateBean()); + } + } + + @Override + protected JPanel createContentPane() { + return new BasicScrollPane() { + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(); + contentPane.setLayout(new BorderLayout()); + + contentPane.add(dataFromPane = new UIComboBoxPane() { + protected void initLayout() { + this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE,6)); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p,f }; + double[] rowSize = { p}; + Component[][] components = new Component[][]{ + new Component[]{new BoldFontTextLabel(Inter.getLocText("ChartF-Data-Resource") + ":"), jcb}, + } ; + + JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + + this.add(northPane, BorderLayout.NORTH); + this.add(cardPane, BorderLayout.CENTER); + } + + @Override + protected List> initPaneList() { + List list = new ArrayList(); + + list.add(tablePane = new GisMapTableDataContentPane());// 数据集界面 + list.add(reportPane = new GisMapReportDataContentPane());// 单元格界面 + + return list; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Data_Setting"); + } + }, BorderLayout.CENTER); + + dataFromPane.setBorder(BorderFactory.createEmptyBorder(10 ,0, 0, 0)); + return contentPane; + } + + @Override + public void populateBean(Chart ob) { + // TODO Auto-generated method stub + + } + + @Override + protected String title4PopupWindow() { + // TODO Auto-generated method stub + return null; + }}; + + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/GisMapDataPane4Chart.java b/designer_chart/src/com/fr/design/chart/report/GisMapDataPane4Chart.java new file mode 100644 index 000000000..00aced486 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/GisMapDataPane4Chart.java @@ -0,0 +1,69 @@ +package com.fr.design.chart.report; + +import com.fr.base.TableData; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.*; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.AbstractChartDataPane4Chart; +import com.fr.design.mainframe.chart.gui.ChartDataPane; + +import javax.swing.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class GisMapDataPane4Chart extends AbstractChartDataPane4Chart { + + private GisMapTableDataContentPane4Chart tablePane = new GisMapTableDataContentPane4Chart(); + + public GisMapDataPane4Chart(AttributeChangeListener listener, ChartDataPane parent) { + super(listener, parent); + } + + protected JPanel getDataContentPane() { + return tablePane; + } + + @Override + public void populate(ChartCollection collection) { + tablePane = new GisMapTableDataContentPane4Chart(); + if (collection != null && collection.getSelectedChart() != null) { + Chart chart = collection.getSelectedChart(); + TopDefinitionProvider definition = chart.getFilterDefinition(); + if (definition instanceof TableDataDefinition) { + TableData tableData = ((TableDataDefinition) definition).getTableData(); + if (tableData != null) { + populateChoosePane(tableData); + fireTableDataChange(); + } + } + if (definition instanceof GisMapTableDefinition) { + tablePane.populateBean((GisMapTableDefinition) definition); + } + } + this.remove(leftContentPane); + this.initContentPane(); + this.validate(); + dataSource.addItemListener(dsListener); + initAllListeners(); + initSelfListener(tablePane); + this.addAttributeChangeListener(attributeChangeListener); + } + + @Override + public void update(ChartCollection collection) { + collection.getSelectedChart().setFilterDefinition(tablePane.updateBean()); + } + + + /** + * 数据集数据改变 + */ + public void fireTableDataChange() { + tablePane.fireTableDataChange(choosePane.getTableDataWrapper()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/GisMapReportDataContentPane.java b/designer_chart/src/com/fr/design/chart/report/GisMapReportDataContentPane.java new file mode 100644 index 000000000..1c2a97027 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/GisMapReportDataContentPane.java @@ -0,0 +1,301 @@ +package com.fr.design.chart.report; + +import java.awt.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import com.fr.base.Formula; +import com.fr.base.Utils; +import com.fr.chart.chartdata.BaseSeriesDefinition; +import com.fr.chart.chartdata.GisMapReportDefinition; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.constants.UIConstants; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; + +/** + * 属性表gis地图单元格数据源设置界面 + * + * @author eason + */ +public class GisMapReportDataContentPane extends FurtherBasicBeanPane implements UIObserver { + private UIButtonGroup addressType; + private UIButtonGroup lnglatOrder; + private TinyFormulaPane addressPane; + private TinyFormulaPane addressNamePane; + private UICorrelationPane seriesPane; + private JPanel orderPane; + private ArrayList changeListeners = new ArrayList(); + + public GisMapReportDataContentPane() { + initCom(); + } + + private void initCom() { + this.setLayout(new BorderLayout(0, 0)); + addressType = new UIButtonGroup(new String[]{Inter.getLocText("Chart-Address"), Inter.getLocText("Chart-LngLat")}); + lnglatOrder = new UIButtonGroup(new String[]{Inter.getLocText("Chart-LngFirst"), Inter.getLocText("Chart-LatFirst")}); + addressPane = new TinyFormulaPane(); + addressNamePane = new TinyFormulaPane(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = new double[]{p, f}; + double[] rowSize = new double[]{p, p, p}; + + orderPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM, 0)) { + @Override + public Dimension getPreferredSize() { + if (this.isVisible()) { + return super.getPreferredSize(); + } else { + return new Dimension(0, 0); + } + } + }; + orderPane.add(new UILabel(Inter.getLocText("Chart-LatLngOrder")), BorderLayout.WEST); + orderPane.add(lnglatOrder, BorderLayout.CENTER); + orderPane.setVisible(false); + lnglatOrder.setSelectedIndex(0); + addressType.setSelectedIndex(0); + Component[][] components = new Component[][]{ + new Component[]{addressType, addressPane}, + new Component[]{orderPane, null}, + new Component[]{new UILabel(" " +Inter.getLocText("Chart-Address-Name")+":", SwingConstants.RIGHT), addressNamePane}, + }; + JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + + this.add(northPane, BorderLayout.NORTH); + + String[] columnNames = new String[]{Inter.getLocText(new String[]{"Filed", "Title"}), Inter.getLocText("Area_Value")}; + seriesPane = new UICorrelationPane(columnNames) { + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + }; + + this.add(seriesPane, BorderLayout.CENTER); + } + + /** + * 界面接入. + * @param ob 对象 + * @return true表示接受 + */ + public boolean accept(Object ob) { + return true; + } + + /** + * 重置 + */ + public void reset() { + + } + + /** + * 界面弹出标题. + * @return 标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("Cell"); + } + + @Override + public void populateBean(GisMapReportDefinition ob) { + if (ob.getCategoryName() != null) { + if (ob.isAddress()) { + addressType.setSelectedIndex(0); + orderPane.setVisible(false); + } else { + addressType.setSelectedIndex(1); + orderPane.setVisible(true); + } + + if (ob.isLngFirst()) { + lnglatOrder.setSelectedIndex(0); + } else { + lnglatOrder.setSelectedIndex(1); + } + + addressPane.populateBean(Utils.objectToString(ob.getCategoryName())); + if (ob.getAddressName() != null) { + addressNamePane.populateBean(Utils.objectToString(ob.getAddressName())); + } + int size = ob.getTitleValueSize(); + List paneList = new ArrayList(); + for (int i = 0; i < size; i++) { + BaseSeriesDefinition first = ob.getTitleValueWithIndex(i); + if (first != null && first.getSeriesName() != null && first.getValue() != null) { + paneList.add(new Object[]{first.getSeriesName(), first.getValue()}); + } + } + if (!paneList.isEmpty()) { + seriesPane.populateBean(paneList); + } + } + } + + @Override + public GisMapReportDefinition updateBean() { + GisMapReportDefinition reportDefinition = new GisMapReportDefinition(); + if (this.addressType.getSelectedIndex() == 0) { + reportDefinition.setAddressType(true); + orderPane.setVisible(false); + } else { + reportDefinition.setAddressType(false); + orderPane.setVisible(true); + } + + if (this.lnglatOrder.getSelectedIndex() == 0) { + reportDefinition.setLnglatOrder(true); + } else { + reportDefinition.setLnglatOrder(false); + } + + String address = addressPane.updateBean(); + if (StringUtils.isBlank(address)) { + return null; + } + if (StableUtils.canBeFormula(address)) { + reportDefinition.setCategoryName(new Formula(address)); + } else { + reportDefinition.setCategoryName(address); + } + + String addressName = addressNamePane.updateBean(); + if (addressName != null && !StringUtils.isBlank(addressName)) { + if (StableUtils.canBeFormula(addressName)) { + reportDefinition.setAddressName(addressName); + } else { + reportDefinition.setAddressName(addressName); + } + } + List values = seriesPane.updateBean(); + if (values != null && !values.isEmpty()) { + for (int i = 0, size = values.size(); i < size; i++) { + Object[] objects = (Object[]) values.get(i); + Object name = objects[0]; + Object value = objects[1]; + + if (StableUtils.canBeFormula(value)) { + value = new Formula(Utils.objectToString(value)); + } + SeriesDefinition definition = new SeriesDefinition(name, value); + reportDefinition.addTitleValue(definition); + } + } + return reportDefinition; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(final UIObserverListener listener) { + changeListeners.add(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + private class InnerTableEditor extends UITableEditor { + private JComponent editorComponent; + + /** + * 返回当前编辑器的值 + */ + public Object getCellEditorValue() { + if (editorComponent instanceof TinyFormulaPane) { + return ((TinyFormulaPane) editorComponent).getUITextField().getText(); + } else if (editorComponent instanceof UITextField) { + return ((UITextField) editorComponent).getText(); + } + + return super.getCellEditorValue(); + } + + /** + * 返回当前编辑器.. + */ + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (column == table.getModel().getColumnCount()) { + return null; + } + return getEditorComponent(column, value); + } + + private JComponent getEditorComponent(int column, Object value) { + if (column == 0) { + UITextField field = new UITextField(); + addListener4UITextFiled(field); + + if (value != null) { + field.setText(Utils.objectToString(value)); + } + editorComponent = field; + } else { + TinyFormulaPane tinyPane = new TinyFormulaPane() { + @Override + public void okEvent() { + seriesPane.stopCellEditing(); + seriesPane.fireTargetChanged(); + } + }; + tinyPane.setBackground(UIConstants.FLESH_BLUE); + + addListener4UITextFiled(tinyPane.getUITextField()); + + if (value != null) { + tinyPane.getUITextField().setText(Utils.objectToString(value)); + } + + editorComponent = tinyPane; + } + return editorComponent; + } + + private void addListener4UITextFiled(UITextField textField) { + + textField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { +// seriesPane.stopCellEditing(); //kunsnat: 不stop是因为可能直接点击公式编辑按钮, 否则需要点击两次才能弹出. + seriesPane.fireTargetChanged(); + } + }); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane.java b/designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane.java new file mode 100644 index 000000000..4e0443c9f --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane.java @@ -0,0 +1,350 @@ +package com.fr.design.chart.report; + +import com.fr.base.Utils; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartdata.GisMapTableDefinition; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.constants.LayoutConstants; +import com.fr.data.impl.NameTableData; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; +import com.fr.general.Inter; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; + +/** + * 属性表gis地图数据集数据源定义面板 + * @author eason + * + */ +public class GisMapTableDataContentPane extends FurtherBasicBeanPane implements UIObserver { + + private DatabaseTableDataPane fromTableData; + + private ArrayList changeListeners = new ArrayList(); + private String[] initNames = {""}; + + private UIButtonGroup addressType; + private UIButtonGroup lnglatOrder; + private UIComboBox addressBox; + private UIComboBox addressNameBox; + private UICorrelationPane titleValuePane; + private JPanel orderPane; + + public GisMapTableDataContentPane() { + this.setLayout(new BorderLayout()); + + JPanel northPane = new JPanel(); + this.add(northPane, BorderLayout.NORTH); + + northPane.setLayout(new FlowLayout(FlowLayout.LEFT)); + + UILabel label = new UILabel(Inter.getLocText("Chart-Select_Data_Set") + ":", SwingConstants.LEFT); + + northPane.add(fromTableData = new DatabaseTableDataPane(label) { + @Override + protected void userEvent() { + refresh2ComboBox(); + } + }); + fromTableData.setPreferredSize(new Dimension(218, 20)); + northPane.add(fromTableData); + + addressType = new UIButtonGroup(new String[]{Inter.getLocText("Chart-Gis_Address"), Inter.getLocText("Chart-Gis_LatLng")}); + lnglatOrder = new UIButtonGroup(new String[]{Inter.getLocText("Chart-Lng_First"),Inter.getLocText("Chart-Lat_First")}); + addressBox = new UIComboBox(); + addressNameBox = new UIComboBox(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = new double[]{p, f}; + double[] rowSize = new double[]{p, p, p}; + orderPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM,0)){ + @Override + public Dimension getPreferredSize() { + if(this.isVisible()){ + return super.getPreferredSize(); + }else{ + return new Dimension(0,0); + } + } + }; + orderPane.add(new UILabel(Inter.getLocText("Chart-LatLng_Order")), BorderLayout.WEST); + orderPane.add(lnglatOrder, BorderLayout.CENTER); + orderPane.setVisible(false); + lnglatOrder.setSelectedIndex(0); + addressType.setSelectedIndex(0); + + addressNameBox.removeAllItems(); + addressNameBox.addItem(Inter.getLocText("Chart-Use_None")); + + Component[][] components = new Component[][]{ + new Component[]{addressType, addressBox}, + new Component[]{orderPane,null}, + new Component[]{new UILabel(Inter.getLocText("Chart-Address_Name") + ":", SwingConstants.RIGHT), addressNameBox}, + }; + JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + + JPanel pane = new JPanel(); + this.add(pane, BorderLayout.CENTER); + pane.setLayout(new BorderLayout()); + + pane.add(centerPane, BorderLayout.NORTH); + + String[] titles = {Inter.getLocText("Chart-Area_Title"), Inter.getLocText("Chart-Area_Value")}; + titleValuePane = new UICorrelationPane(titles){ + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + }; + + pane.add(titleValuePane, BorderLayout.CENTER); + } + + private void refresh2ComboBox() {// 刷新地址 地址名 名称列表 + TableDataWrapper tableDataWrappe = fromTableData.getTableDataWrapper(); + if (tableDataWrappe == null) { + return; + } + List columnNameList = tableDataWrappe.calculateColumnNameList(); + initNames = columnNameList.toArray(new String[columnNameList.size()]); + + addressBox.removeAllItems(); + addressNameBox.removeAllItems(); + addressNameBox.addItem(Inter.getLocText("Chart-Use_None")); + + for(int i = 0, size = initNames.length; i < size; i++) { + addressBox.addItem(initNames[i]); + addressNameBox.addItem(initNames[i]); + } + + addressBox.getModel().setSelectedItem(null); + addressNameBox.getModel().setSelectedItem(null); + + stopEditing(); + } + /** + * 界面接入 + * @param ob 对象 + * @return true表示接受 + */ + public boolean accept(Object ob) { + return false; + } + + /** + * 界面重置 + */ + public void reset() { + + } + + /** + * 界面弹出标题 + * @return 标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("Chart-DS_TableData"); + } + + private void stopEditing() { + } + + @Override + public void populateBean(GisMapTableDefinition ob) { + stopEditing(); + if (ob instanceof GisMapTableDefinition) { + GisMapTableDefinition mapDefinition = (GisMapTableDefinition) ob; + fromTableData.populateBean(((NameTableData) mapDefinition.getTableData())); + + if(ob.isAddress()){ + addressType.setSelectedIndex(0); + orderPane.setVisible(false); + }else{ + addressType.setSelectedIndex(1); + orderPane.setVisible(true); + } + + if(ob.isLngFirst()){ + lnglatOrder.setSelectedIndex(0); + }else{ + lnglatOrder.setSelectedIndex(1); + } + + addressBox.setSelectedItem(mapDefinition.getAddress()); + + if(StringUtils.isEmpty(mapDefinition.getAddressName())) { + addressNameBox.setSelectedItem(Inter.getLocText("Chart-Use_None")); + } else { + addressNameBox.setSelectedItem(mapDefinition.getAddressName()); + } + + List paneList = new ArrayList(); + int titleValueSize = mapDefinition.getTittleValueSize(); + for(int i = 0; i < titleValueSize; i++) { + SeriesDefinition definition = mapDefinition.getTittleValueWithIndex(i); + if(definition != null && definition.getSeriesName() != null && definition.getValue() != null) { + paneList.add(new Object[]{definition.getSeriesName(), definition.getValue()}); + } + } + + if(!paneList.isEmpty()) { + titleValuePane.populateBean(paneList); + } + } + } + + @Override + public GisMapTableDefinition updateBean() {// 从一行内容中update + stopEditing(); + + GisMapTableDefinition definition = new GisMapTableDefinition(); + + TableDataWrapper tableDataWrappe = fromTableData.getTableDataWrapper(); + if (tableDataWrappe == null || addressBox.getSelectedItem() == null) { + return null; + } + + definition.setTableData(new NameTableData(tableDataWrappe.getTableDataName())); + definition.setAddress(Utils.objectToString(addressBox.getSelectedItem())); + + if(this.addressType.getSelectedIndex() == 0){ + definition.setAddressType(true); + lnglatOrder.setVisible(false); + }else{ + definition.setAddressType(false); + lnglatOrder.setVisible(true); + } + + if(this.lnglatOrder.getSelectedIndex() == 0){ + definition.setLnglatOrder(true); + }else{ + definition.setLnglatOrder(false); + } + + if(addressNameBox.getSelectedItem() != null){ + String adName = Utils.objectToString(addressNameBox.getSelectedItem()); + if(ArrayUtils.contains(ChartConstants.NONE_KEYS, adName)) { + definition.setAddressName(StringUtils.EMPTY); + } else { + definition.setAddressName(adName); + } + } + + List paneList = titleValuePane.updateBean(); + for(int i = 0, size = paneList.size(); i < size; i++) { + Object[] values = (Object[])paneList.get(i); + if(values.length == 2) { + SeriesDefinition seriesDefinition = new SeriesDefinition(); + seriesDefinition.setSeriesName(values[0]); + seriesDefinition.setValue(values[1]); + definition.addTittleValue(seriesDefinition); + } + } + + return definition; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(final UIObserverListener listener) { + changeListeners.add(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + private class InnerTableEditor extends UITableEditor { + private JComponent editorComponent; + + /** + * 返回当前编辑器的值 + */ + public Object getCellEditorValue() { + if(editorComponent instanceof UITextField) { + UITextField textField = (UITextField)editorComponent; + return textField.getText(); + } else if(editorComponent instanceof UIComboBox) { + UIComboBox boxPane = (UIComboBox)editorComponent; + return boxPane.getSelectedItem(); + } + return super.getCellEditorValue(); + } + + /** + * 返回当前编辑器.. + */ + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (column == table.getModel().getColumnCount()) { + return null; + } + if(column == 0 ) { + UITextField text = new UITextField(); + if(value != null) { + text.setText(Utils.objectToString(value)); + } + + text.addFocusListener(new FocusAdapter() { + public void focusLost(FocusEvent e) { + titleValuePane.stopCellEditing(); + titleValuePane.fireTargetChanged(); + } + }); + + this.editorComponent = text; + } else { + UIComboBox box = new UIComboBox(initNames); + box.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + titleValuePane.fireTargetChanged(); + titleValuePane.stopCellEditing(); + } + }); + + if (value != null && StringUtils.isNotEmpty(value.toString())) { + box.setSelectedItem(value); + } else { + box.setSelectedItem(value); + } + + this.editorComponent = box; + } + return this.editorComponent; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane4Chart.java b/designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane4Chart.java new file mode 100644 index 000000000..2f2f869b9 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/GisMapTableDataContentPane4Chart.java @@ -0,0 +1,341 @@ +package com.fr.design.chart.report; + +import com.fr.base.Utils; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartdata.GisMapTableDefinition; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class GisMapTableDataContentPane4Chart extends FurtherBasicBeanPane implements UIObserver { + + private ArrayList changeListeners = new ArrayList(); + private String[] initNames = {""}; + + private UIButtonGroup addressType; + private UIButtonGroup lnglatOrder; + private UIComboBox addressBox; + private UIComboBox addressNameBox; + private UICorrelationPane titleValuePane; + private JPanel orderPane; + private TableDataWrapper tableDataWrapper; + + public GisMapTableDataContentPane4Chart() { + this.setLayout(new BorderLayout()); + + addressType = new UIButtonGroup(new String[]{Inter.getLocText("Chart-Gis_Address"), Inter.getLocText("Chart-Gis_LatLng")}); + lnglatOrder = new UIButtonGroup(new String[]{Inter.getLocText("Chart-Lng_First"), Inter.getLocText("Chart-Lat_First")}); + addressBox = new UIComboBox(); + addressNameBox = new UIComboBox(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = new double[]{p, f}; + double[] rowSize = new double[]{p, p, p}; + orderPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM, 0)) { + @Override + public Dimension getPreferredSize() { + if (this.isVisible()) { + return super.getPreferredSize(); + } else { + return new Dimension(0, 0); + } + } + }; + orderPane.add(new UILabel(Inter.getLocText("Chart-LatLng_Order")), BorderLayout.WEST); + orderPane.add(lnglatOrder, BorderLayout.CENTER); + orderPane.setVisible(false); + lnglatOrder.setSelectedIndex(0); + addressType.setSelectedIndex(0); + + addressNameBox.removeAllItems(); + addressNameBox.addItem(Inter.getLocText("Chart-Use_None")); + + Component[][] components = new Component[][]{ + new Component[]{addressType, addressBox}, + new Component[]{orderPane, null}, + new Component[]{new UILabel(Inter.getLocText("Chart-Address_Name") + ":", SwingConstants.RIGHT), addressNameBox}, + }; + JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + + JPanel pane = new JPanel(); + this.add(pane, BorderLayout.CENTER); + pane.setLayout(new BorderLayout()); + + pane.add(centerPane, BorderLayout.NORTH); + + String[] titles = {Inter.getLocText("Chart-Area_Title"), Inter.getLocText("Chart-Area_Value")}; + titleValuePane = new UICorrelationPane(titles) { + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + }; + + pane.add(titleValuePane, BorderLayout.CENTER); + } + + private void refresh2ComboBox() {// 刷新地址 地址名 名称列表 + TableDataWrapper tableDataWrappe =tableDataWrapper; + if (tableDataWrappe == null) { + return; + } + java.util.List columnNameList = tableDataWrappe.calculateColumnNameList(); + initNames = columnNameList.toArray(new String[columnNameList.size()]); + + addressBox.removeAllItems(); + addressNameBox.removeAllItems(); + addressNameBox.addItem(Inter.getLocText("Chart-Use_None")); + + for (int i = 0, size = initNames.length; i < size; i++) { + addressBox.addItem(initNames[i]); + addressNameBox.addItem(initNames[i]); + } + if(initNames.length > 0){ + addressBox.setSelectedIndex(0); + } + addressNameBox.setSelectedIndex(0); + stopEditing(); + } + + /** + * 界面接入 + * + * @param ob 对象 + * @return true表示接受 + */ + public boolean accept(Object ob) { + return false; + } + + /** + * 界面重置 + */ + public void reset() { + + } + + /** + * 界面弹出标题 + * + * @return 标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("Chart-DS_TableData"); + } + + private void stopEditing() { + } + + @Override + public void populateBean(GisMapTableDefinition ob) { + stopEditing(); + if (ob instanceof GisMapTableDefinition) { + GisMapTableDefinition mapDefinition = (GisMapTableDefinition) ob; + if (ob.isAddress()) { + addressType.setSelectedIndex(0); + orderPane.setVisible(false); + } else { + addressType.setSelectedIndex(1); + orderPane.setVisible(true); + } + + if (ob.isLngFirst()) { + lnglatOrder.setSelectedIndex(0); + } else { + lnglatOrder.setSelectedIndex(1); + } + + addressBox.setSelectedItem(mapDefinition.getAddress()); + + if (StringUtils.isEmpty(mapDefinition.getAddressName())) { + addressNameBox.setSelectedItem(Inter.getLocText("Chart-Use_None")); + } else { + addressNameBox.setSelectedItem(mapDefinition.getAddressName()); + } + + java.util.List paneList = new ArrayList(); + int titleValueSize = mapDefinition.getTittleValueSize(); + for (int i = 0; i < titleValueSize; i++) { + SeriesDefinition definition = mapDefinition.getTittleValueWithIndex(i); + if (definition != null && definition.getSeriesName() != null && definition.getValue() != null) { + paneList.add(new Object[]{definition.getSeriesName(), definition.getValue()}); + } + } + + if (!paneList.isEmpty()) { + titleValuePane.populateBean(paneList); + } + } + } + + @Override + public GisMapTableDefinition updateBean() {// 从一行内容中update + stopEditing(); + + GisMapTableDefinition definition = new GisMapTableDefinition(); + + TableDataWrapper tableDataWrappe = tableDataWrapper; + if (tableDataWrappe == null || addressBox.getSelectedItem() == null) { + return null; + } + + definition.setTableData(tableDataWrapper.getTableData()); + definition.setAddress(Utils.objectToString(addressBox.getSelectedItem())); + + if (this.addressType.getSelectedIndex() == 0) { + definition.setAddressType(true); + lnglatOrder.setVisible(false); + } else { + definition.setAddressType(false); + lnglatOrder.setVisible(true); + } + + if (this.lnglatOrder.getSelectedIndex() == 0) { + definition.setLnglatOrder(true); + } else { + definition.setLnglatOrder(false); + } + + if (addressNameBox.getSelectedItem() != null) { + String adName = Utils.objectToString(addressNameBox.getSelectedItem()); + if (ArrayUtils.contains(ChartConstants.NONE_KEYS, adName)) { + definition.setAddressName(StringUtils.EMPTY); + } else { + definition.setAddressName(adName); + } + } + + java.util.List paneList = titleValuePane.updateBean(); + for (int i = 0, size = paneList.size(); i < size; i++) { + Object[] values = (Object[]) paneList.get(i); + if (values.length == 2) { + SeriesDefinition seriesDefinition = new SeriesDefinition(); + seriesDefinition.setSeriesName(values[0]); + seriesDefinition.setValue(values[1]); + definition.addTittleValue(seriesDefinition); + } + } + + return definition; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(final UIObserverListener listener) { + changeListeners.add(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + private class InnerTableEditor extends UITableEditor { + private JComponent editorComponent; + + /** + * 返回当前编辑器的值 + */ + public Object getCellEditorValue() { + if (editorComponent instanceof UITextField) { + UITextField textField = (UITextField) editorComponent; + return textField.getText(); + } else if (editorComponent instanceof UIComboBox) { + UIComboBox boxPane = (UIComboBox) editorComponent; + return boxPane.getSelectedItem(); + } + return super.getCellEditorValue(); + } + + /** + * 返回当前编辑器.. + */ + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (column == table.getModel().getColumnCount()) { + return null; + } + if (column == 0) { + UITextField text = new UITextField(); + if (value != null) { + text.setText(Utils.objectToString(value)); + } + + text.addFocusListener(new FocusAdapter() { + public void focusLost(FocusEvent e) { + titleValuePane.stopCellEditing(); + titleValuePane.fireTargetChanged(); + } + }); + + this.editorComponent = text; + } else { + UIComboBox box = new UIComboBox(initNames); + box.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + titleValuePane.fireTargetChanged(); + titleValuePane.stopCellEditing(); + } + }); + + if (value != null && StringUtils.isNotEmpty(value.toString())) { + box.setSelectedItem(value); + } else { + box.setSelectedItem(value); + } + + this.editorComponent = box; + } + return this.editorComponent; + } + } + + /** + * 出发数据集改变 + * @param wrapper 数据集 + */ + public void fireTableDataChange(TableDataWrapper wrapper){ + this.tableDataWrapper = wrapper; + refresh2ComboBox(); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapCubeDataPane.java b/designer_chart/src/com/fr/design/chart/report/MapCubeDataPane.java new file mode 100644 index 000000000..fa75392b5 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapCubeDataPane.java @@ -0,0 +1,76 @@ +package com.fr.design.chart.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartdata.MapMoreLayerReportDefinition; +import com.fr.chart.chartdata.MapMoreLayerTableDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +/** + * 钻取数据 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-21 下午11:02:02 + */ +public class MapCubeDataPane extends UIComboBoxPane { + + private MapReportCubeDataPane reportPane; + private MapTableCubeDataPane tablePane; + + protected void initLayout() { + this.setLayout(new BorderLayout(0, 0)); + JPanel northPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + northPane.add(new BoldFontTextLabel(Inter.getLocText("ChartF-Data-Resource") + ":")); + northPane.add(jcb); + + this.add(northPane, BorderLayout.NORTH); + this.add(cardPane, BorderLayout.CENTER); + } + + @Override + protected List> initPaneList() { + List list = new ArrayList(); + + list.add(tablePane = new MapTableCubeDataPane()); + list.add(reportPane = new MapReportCubeDataPane()); + + return list; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("LayerData"); + } + + /** + * 对数据集或者单元格数据加载界面 + */ + public void populateBean(TopDefinitionProvider definition) { + if(definition instanceof MapMoreLayerReportDefinition) { + this.setSelectedIndex(1); + MapMoreLayerReportDefinition reportDefinition = (MapMoreLayerReportDefinition)definition; + reportPane.populateBean(reportDefinition); + } else if(definition instanceof MapMoreLayerTableDefinition) { + MapMoreLayerTableDefinition tableDefinition = (MapMoreLayerTableDefinition)definition; + this.setSelectedIndex(0); + tablePane.populateBean(tableDefinition); + } + } + + /** + * 根据界面 下载保存数据 + */ + public TopDefinitionProvider update() { + if(this.getSelectedIndex() == 0) { + return tablePane.updateBean(); + } else { + return reportPane.updateBean(); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapCubeDataPane4Chart.java b/designer_chart/src/com/fr/design/chart/report/MapCubeDataPane4Chart.java new file mode 100644 index 000000000..96c659d50 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapCubeDataPane4Chart.java @@ -0,0 +1,68 @@ +package com.fr.design.chart.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartdata.MapMoreLayerTableDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.general.Inter; + +import java.awt.*; +import java.util.*; +import java.util.List; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class MapCubeDataPane4Chart extends UIComboBoxPane { + private MapTableCubeDataPane4Chart tablePane; + + protected void initLayout() { + this.setLayout(new BorderLayout(0, 0)); + this.add(cardPane, BorderLayout.CENTER); + } + + @Override + protected List> initPaneList() { + List list = new ArrayList(); + + list.add(tablePane = new MapTableCubeDataPane4Chart()); + + return list; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Map_LayerData"); + } + + /** + * 对数据集或者单元格数据加载界面 + */ + public void populateBean(TopDefinitionProvider definition) { + if(definition instanceof MapMoreLayerTableDefinition) { + MapMoreLayerTableDefinition tableDefinition = (MapMoreLayerTableDefinition)definition; + this.setSelectedIndex(0); + tablePane.populateBean(tableDefinition); + } + } + + /** + * 根据界面 下载保存数据 + */ + public TopDefinitionProvider update() { + return tablePane.updateBean(); + } + + /** + * 出发数据集改变 + * @param tableDataWrapper 数据集 + */ + public void fireTableDataChanged(TableDataWrapper tableDataWrapper) { + tablePane.setTableDataWrapper(tableDataWrapper); + tablePane.refreshAreaNameBox(); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java b/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java new file mode 100644 index 000000000..cffddfd67 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java @@ -0,0 +1,309 @@ +package com.fr.design.chart.report; + +import com.fr.base.MapXMLHelper; +import com.fr.base.Utils; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.base.MapSvgAttr; +import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.chart.chartglyph.MapAttr; +import com.fr.design.DesignerEnvManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.UIDialog; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.*; +import java.util.List; + +/** + * 地图钻取层级界面, 默认钻取到同名的地图 +* @author kunsnat E-mail:kunsnat@gmail.com +* @version 创建时间:2012-11-20 下午03:39:08 + */ +public class MapCubeLayerPane extends BasicBeanPane{ + + private JTree mapTree; + private DefaultMutableTreeNode root; + + private String editingMap = ""; + + private Set editedMap = new HashSet(); + + private List fireWhenTreeChange = new ArrayList(); + + private List hasDealNames = new ArrayList(); + + private boolean isSvg = true; + + public MapCubeLayerPane() { + initCom(); + } + + private void initCom() { + this.setLayout(new BorderLayout()); + + root = new DefaultMutableTreeNode(); + + mapTree = new JTree(root); + mapTree.setRootVisible(false); + mapTree.addMouseListener(mapListener); + + JScrollPane treePane = new JScrollPane(mapTree); + treePane.setPreferredSize(new Dimension(100, 100)); + this.add(treePane, BorderLayout.CENTER); + } + + public void setSvg(boolean isSvg) { + this.isSvg = isSvg; + } + + /** + * 返回节点路径 + */ + public int getTreeDepth() { + return root.getDepth(); + } + + /** + * 初始化节点界面. + * @param mapName 地图名称. + */ + public void initRootTree(String mapName) { + editingMap = mapName; + + root.removeAllChildren(); + + DefaultMutableTreeNode node = new DefaultMutableTreeNode(mapName); + + root.add(node); + + // 每个节点都要去判断是否有地图再包含 默认钻取到同名的地图 + if(isSvg) { + MapSvgAttr mapAttr = MapSvgXMLHelper.getInstance().getMapAttr(mapName); + hasDealNames.clear(); + add4Node(mapAttr, node, mapName); + } else { + MapAttr mapAttr = (MapAttr)MapXMLHelper.getInstance().getMapAttr(mapName); + hasDealNames.clear(); + addBitMap4Node(mapAttr, node, mapName); + } + + mapTree.doLayout(); + mapTree.validate(); + + ((DefaultTreeModel)mapTree.getModel()).reload(); + + for(int i = 0; i < fireWhenTreeChange.size(); i++) { + fireWhenTreeChange.get(i).stateChanged(new ChangeEvent(this)); + } + } + + /** + * 添加响应事件. + * @param change 改变的事件. + */ + public void addChangeListener(ChangeListener change) { + fireWhenTreeChange.add(change); + } + + private void addBitMap4Node(MapAttr editingMapAttr, DefaultMutableTreeNode node, String mapName) { + MapAttr mapAttr = (MapAttr)MapXMLHelper.getInstance().getMapAttr(mapName); + if(mapAttr != null) { + Iterator namesValue = mapAttr.shapeValuesIterator(); + while(namesValue.hasNext()) { + Object names = namesValue.next(); + String nextToName = Utils.objectToString(editingMapAttr.getLayerTo(Utils.objectToString(names))); + + MapAttr tmpAttr = (MapAttr)MapXMLHelper.getInstance().getMapAttr(nextToName); + if(tmpAttr != null) { + DefaultMutableTreeNode currentName = new DefaultMutableTreeNode(names); + node.add(currentName);// 有钻取内容的地图才添加节点 + + if(!hasDealNames.contains(Utils.objectToString(currentName.getUserObject()))) { + hasDealNames.add(Utils.objectToString(currentName.getUserObject())); + addBitMap4Node(editingMapAttr, currentName, nextToName); + } + } + } + } + } + + private void add4Node(MapSvgAttr editingMapAttr, DefaultMutableTreeNode node, String mapName) { + MapSvgAttr mapAttr = MapSvgXMLHelper.getInstance().getMapAttr(mapName); + if(mapAttr != null) { + Iterator namesValue = mapAttr.shapeValuesIterator(); + while(namesValue.hasNext()) { + Object names = namesValue.next(); + String nextToName = Utils.objectToString(editingMapAttr.getLayerTo(Utils.objectToString(names))); + + MapSvgAttr tmpAttr = MapSvgXMLHelper.getInstance().getMapAttr(nextToName); + if(tmpAttr != null) { + DefaultMutableTreeNode currentName = new DefaultMutableTreeNode(names); + node.add(currentName);// 有钻取内容的地图才添加节点 + + if(!hasDealNames.contains(Utils.objectToString(currentName.getUserObject()))) { + hasDealNames.add(Utils.objectToString(currentName.getUserObject())); + add4Node(editingMapAttr, currentName, nextToName); + } + } + } + } + } + + MouseListener mapListener = new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + final TreePath visiblePath = mapTree.getSelectionPath(); // 取得当前选中的节点 selectTreeName + if(visiblePath == null) { + return; + } + final String selectTreeName = Utils.objectToString(((DefaultMutableTreeNode)visiblePath.getLastPathComponent()).getUserObject()); + if(SwingUtilities.isRightMouseButton(e)) { + if(!isSvg){ + popBitMapDialog(e, selectTreeName); + return; + } + final MapSvgAttr editingAttr = MapSvgXMLHelper.getInstance().getMapAttr(editingMap); + editedMap.add(editingMap); + final MapCubeSetDataPane setDataPane = new MapCubeSetDataPane(); + setDataPane.freshComboxNames(); + MapSvgAttr mapAttr = MapSvgXMLHelper.getInstance().getMapAttr(selectTreeName); + editedMap.add(selectTreeName); + if(mapAttr != null) {// 从中取出对应关系 // 取出当前节点名称所对应的地图 + List list = new ArrayList(); + Iterator names = mapAttr.shapeValuesIterator();//行: 地图区域名(String) + 对应地图名(String) + while(names.hasNext()) { + Object name = names.next(); + String layName = editingAttr.getLayerTo(Utils.objectToString(name)); + if(ArrayUtils.contains(ChartConstants.NONE_KEYS, layName)) {// kunsnat: 考虑切换设计器语言. + layName = StringUtils.EMPTY; + } + list.add(new Object[]{name, layName}); + } + setDataPane.populateBean(list); + } + + int x = (int)(mapTree.getLocationOnScreen().getX() + mapTree.getWidth()); + int y = (int)e.getLocationOnScreen().getY(); + + UIDialog dialog = setDataPane.showUnsizedWindow(SwingUtilities.getWindowAncestor(setDataPane), new DialogActionAdapter() { + public void doOk() { + List list = setDataPane.updateBean(); // 更新当前的 地图名所对应的 区域名钻取关系 重新inittree + for(int i = 0; i < list.size(); i++) { + Object[] values = (Object[])list.get(i); + editingAttr.putLayerTo(Utils.objectToString(values[0]), Utils.objectToString(values[1])); + } + initRootTree(editingMap); + saveMapInfo(); + } + }); + dialog.setSize(300, 300); + GUICoreUtils.centerWindow(dialog); + dialog.setVisible(true); + } + } + }; + + + private void popBitMapDialog(MouseEvent e, final String selectTreeName) { + final MapAttr editingAttr = (MapAttr)MapXMLHelper.getInstance().getMapAttr(editingMap); + editedMap.add(editingMap); + final MapCubeSetDataPane setDataPane = new MapCubeSetDataPane(); + setDataPane.freshBitMapComboxNames(); + MapAttr mapAttr = (MapAttr)MapXMLHelper.getInstance().getMapAttr(selectTreeName); + if(mapAttr != null) {// 从中取出对应关系 // 取出当前节点名称所对应的地图 + List list = new ArrayList(); + Iterator names = mapAttr.shapeValuesIterator();//行: 地图区域名(String) + 对应地图名(String) + while(names.hasNext()) { + Object name = names.next(); + String layName = editingAttr.getLayerTo(Utils.objectToString(name)); + if(ArrayUtils.contains(ChartConstants.NONE_KEYS, layName)) {// kunsnat: 考虑切换设计器语言. + layName = StringUtils.EMPTY; + } + list.add(new Object[]{name, layName}); + } + setDataPane.populateBean(list); + } + + int x = (int)(mapTree.getLocationOnScreen().getX() + mapTree.getWidth()); + int y = (int)e.getLocationOnScreen().getY(); + + UIDialog dialog = setDataPane.showUnsizedWindow(SwingUtilities.getWindowAncestor(setDataPane), new DialogActionAdapter() { + public void doOk() { + List list = setDataPane.updateBean(); // 更新当前的 地图名所对应的 区域名钻取关系 重新inittree + for(int i = 0; i < list.size(); i++) { + Object[] values = (Object[])list.get(i); + editingAttr.putLayerTo(values[0], values[1]); + } + initRootTree(editingMap); + saveMapInfo(); + } + }); + dialog.setSize(300, 300); + GUICoreUtils.centerWindow(dialog); + dialog.setVisible(true); + } + + private void saveMapInfo() { + final String[] mapNames = editedMap.toArray(new String[0]); + if(isSvg){ + editedMap.clear(); + } + SwingWorker worker = new SwingWorker() { + @Override + protected Integer doInBackground() throws Exception { + if(isSvg){ + MapSvgXMLHelper.getInstance().saveEditedMaps(mapNames); + } else { + MapXMLHelper.getInstance().writerMapSourceWhenEditMap(); + } + return 0; + } + + @Override + protected void done() { + FRLogger.getLogger().info("Map Save End"); + } + + }; + worker.execute(); + DesignerEnvManager.addWorkers(worker); + } + + @Override + public void populateBean(String rootMapName) {// 更节点的地图名称 只有根节点是确定的 + // 从数据库中取出地图名称 和 层级关系 刷新列表 + initRootTree(rootMapName); + } + + public void updateBean(String rootMapName) {// HashMap --> 对应层级的 地图名称 + // 刷新列表, 更新数据库中的地图名称 + + } + + @Override + public String updateBean() { + return ""; + } + + /** + * 返回界面标题. + */ + protected String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Map_Drill"); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java b/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java new file mode 100644 index 000000000..4c175500e --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java @@ -0,0 +1,130 @@ +package com.fr.design.chart.report; + +import com.fr.base.MapXMLHelper; +import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.editor.ValueEditorPane; +import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.editor.editor.Editor; +import com.fr.design.editor.editor.TextEditor; +import com.fr.design.gui.itableeditorpane.UIArrayTableModel; +import com.fr.design.gui.itableeditorpane.UITableEditorPane; +import com.fr.design.gui.xcombox.ComboBoxUseEditor; +import com.fr.general.Inter; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellEditor; +import java.awt.*; +import java.util.List; + +/** + * 地图, 下层钻取设置 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-19 下午03:19:53 + */ +public class MapCubeSetDataPane extends BasicBeanPane{ + + private UITableEditorPane tableEditorPane;// 地图名称 + 地图类型列表 + + private String[] initNames = new String[]{""}; + + public MapCubeSetDataPane() { + initCom(); + } + + private void initCom() { + this.setLayout(new BorderLayout(0, 0)); + + UIArrayTableModel model = new UIArrayTableModel(new String[]{Inter.getLocText("FR-Chart-Area_Name"), Inter.getLocText("FR-Chart-Drill_Map")}, new int[] {}) { + public boolean isCellEditable(int row, int col) { + return col != 0; + } + }; + model.setDefaultEditor(Object.class, new DefaultComboBoxEditor()); + model.setDefaultRenderer(Object.class, new DefaultComboBoxRenderer()); + + tableEditorPane = new UITableEditorPane(model); + this.add(tableEditorPane); + + model.addRow(new Object[]{"", ""}); + } + + /** + * 刷新下拉列表 + */ + public void freshComboxNames() { + initNames = MapSvgXMLHelper.getInstance().mapAllNames(); + } + + /** + * 位图地图刷新下拉列表 + */ + public void freshBitMapComboxNames() { + initNames = MapXMLHelper.getInstance().mapAllNames(); + } + + // 需要得到地图 所有区域名称. 以及对应好的名字. + @Override + public void populateBean(List ob) { + tableEditorPane.populate(ob.toArray()); + } + + @Override + public List updateBean() { + return tableEditorPane.update(); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Drill_Setting"); + } + + /** + * refresh TODO 只是需要随时更新initNames + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-11-20 下午05:12:20 + */ + + private class DefaultComboBoxEditor extends AbstractCellEditor implements TableCellEditor { + private static final long serialVersionUID = -3239789564820528730L; + private ValueEditorPane cellEditor; + + public DefaultComboBoxEditor() { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ComboBoxUseEditor(initNames)}); + } + + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if(column == 0) { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new TextEditor()}); + } else { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ComboBoxUseEditor(initNames)}); + } + cellEditor.populate(value == null ? "" : value); + return cellEditor; + } + + public Object getCellEditorValue() { + return cellEditor.update(); + } + } + + private class DefaultComboBoxRenderer extends DefaultTableCellRenderer { + private static final long serialVersionUID = -695450455731718014L; + private ValueEditorPane cellEditor; + + public DefaultComboBoxRenderer() { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ComboBoxUseEditor(initNames)}); + } + + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + if(column == 0) { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new TextEditor()}); + } else { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ComboBoxUseEditor(initNames)}); + } + cellEditor.populate(value == null ? "" : value); + return cellEditor; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapDataPane.java b/designer_chart/src/com/fr/design/chart/report/MapDataPane.java new file mode 100644 index 000000000..26842d83e --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapDataPane.java @@ -0,0 +1,139 @@ +package com.fr.design.chart.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartdata.TopDefinition; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.MapMoreLayerReportDefinition; +import com.fr.chart.chartdata.MapMoreLayerTableDefinition; +import com.fr.chart.chartdata.MapSingleLayerReportDefinition; +import com.fr.chart.chartdata.MapSingleLayerTableDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.mainframe.chart.gui.data.DataContentsPane; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +/** + * 选择地图类型后 使用的地图数据界面 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-21 下午10:49:13 + */ +public class MapDataPane extends DataContentsPane { + + private UIComboBoxPane mainPane; + private MapMoreCubeLayerPane morePane; + private MapSinglePane singlePane; + + private AttributeChangeListener listener; + + public MapDataPane(AttributeChangeListener listener) { + super(); + this.listener = listener; + } + + /** + * 加载界面, 更新地图数据 + */ + public void populate(ChartCollection collection) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + + morePane.init4PopuMapTree(collection); + + if(definition instanceof MapSingleLayerTableDefinition) { + mainPane.setSelectedIndex(0); + singlePane.populateBean(definition); + } + else if(definition instanceof MapMoreLayerTableDefinition) { + mainPane.setSelectedIndex(1); + morePane.populateBean(collection); + } else if(definition instanceof MapMoreLayerReportDefinition) { + mainPane.setSelectedIndex(1); + morePane.populateBean(collection); + } else if(definition instanceof MapSingleLayerReportDefinition) { + mainPane.setSelectedIndex(0); + singlePane.populateBean(definition); + } + + this.initAllListeners(); + this.addAttributeChangeListener(listener); + } + + /** + * 下载保存数据 + */ + public void update(ChartCollection collection) { + if(mainPane.getSelectedIndex() == 0) { + collection.getSelectedChart().setFilterDefinition(singlePane.updateBean()); + } else { + morePane.updateBean(collection); + } + } + + @Override + protected JPanel createContentPane() { + BasicScrollPane scroll = new BasicScrollPane() { + + protected JPanel createContentPane() { + JPanel pane = new JPanel(); + pane.setLayout(new BorderLayout()); + mainPane = new UIComboBoxPane() { + protected void initLayout() { + this.setLayout(new BorderLayout(0, 6)); + JPanel northPane = new JPanel(new FlowLayout(FlowLayout.LEFT)); + northPane.add(new BoldFontTextLabel(Inter.getLocText("Map Show Type") + ":")); + northPane.add(jcb); + this.add(northPane, BorderLayout.NORTH); + this.add(cardPane, BorderLayout.CENTER); + } + protected List> initPaneList() { + List list = new ArrayList(); + list.add(singlePane = new MapSinglePane()); + list.add(morePane = new MapMoreCubeLayerPane()); + return list; + } + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Chart-Map", "Data"}); + } + }; + pane.add(mainPane, BorderLayout.CENTER); + return pane; + } + public void populateBean(Chart ob) { + } + protected String title4PopupWindow() { + return null; + } + }; + return scroll; + } + + + /** + * 返回界面使用图标路径 + */ + public String getIconPath() { + return "com/fr/design/images/chart/ChartData.png"; + } + + /** + * 返回界面标题 + * @return 标题 + */ + public String title4PopupWindow() { + return Inter.getLocText(new String[]{"Chart-Map", "Data"}); + } + + @Override + public void setSupportCellData(boolean surpportCellData) { + morePane.setSurpportCellData(surpportCellData); + singlePane.setSurpportCellData(surpportCellData); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapDataPane4Chart.java b/designer_chart/src/com/fr/design/chart/report/MapDataPane4Chart.java new file mode 100644 index 000000000..d7329b3c9 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapDataPane4Chart.java @@ -0,0 +1,133 @@ +package com.fr.design.chart.report; + +import com.fr.base.TableData; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.*; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.mainframe.AbstractChartDataPane4Chart; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + * Date: 14/12/3 + * Time: 下午6:49 + */ +public class MapDataPane4Chart extends AbstractChartDataPane4Chart { + private UIComboBoxPane dataContentPane; + private MapMoreCubeLayerPane4Chart morePane = new MapMoreCubeLayerPane4Chart(); + private MapSinglePane4Chart singlePane = new MapSinglePane4Chart(); + private ChartCollection currentCollection; + private ItemListener itemListener = new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + fireTableDataChange(); + } + }; + + public MapDataPane4Chart(AttributeChangeListener listener, ChartDataPane parent) { + super(listener, parent); + dataContentPane = new UIComboBoxPane() { + protected void initLayout() { + this.setLayout(new BorderLayout(0, 6)); + JPanel northPane = new JPanel(new FlowLayout(FlowLayout.LEFT)); + northPane.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Map_ShowWay") + ":")); + northPane.add(jcb); + this.add(northPane, BorderLayout.NORTH); + this.add(cardPane, BorderLayout.CENTER); + } + protected java.util.List> initPaneList() { + java.util.List list = new ArrayList(); + list.add(singlePane); + list.add(morePane); + return list; + } + + protected void comboBoxItemStateChanged() { + if(currentCollection == null){ + return; + } + fireTableDataChange(); + morePane.init4PopuMapTree(currentCollection); + } + + + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Chart-Map", "Data"}); + } + }; + } + + + protected JPanel getDataContentPane(){ + return dataContentPane; + } + + @Override + public void populate(ChartCollection collection) { + currentCollection = collection; + morePane.init4PopuMapTree(collection); + if (collection != null && collection.getSelectedChart() != null) { + Chart chart = collection.getSelectedChart(); + TopDefinitionProvider definition = chart.getFilterDefinition(); + if (definition instanceof TableDataDefinition) { + TableData tableData = ((TableDataDefinition) definition).getTableData(); + if(tableData != null){ + populateChoosePane(tableData); + fireTableDataChange(); + } + } + if(definition instanceof MapSingleLayerTableDefinition) { + singlePane.populateBean(definition); + } else if(definition instanceof MapMoreLayerTableDefinition) { + morePane.populateBean(collection); + } + } + this.remove(leftContentPane); + this.initContentPane(); + this.validate(); + dataSource.addItemListener(dsListener); + initAllListeners(); + initSelfListener(dataContentPane); + this.addAttributeChangeListener(attributeChangeListener); + } + + @Override + public void update(ChartCollection collection) { + if(dataContentPane.getSelectedIndex() == 0) { + collection.getSelectedChart().setFilterDefinition(singlePane.updateBean()); + } else { + morePane.updateBean(collection); + } + currentCollection = collection; + } + + /** + * 数据集数据改变 + */ + public void fireTableDataChange() { + if (dataContentPane == null) { + return; + } + if(dataContentPane.getSelectedIndex() == 0) { + singlePane.fireTableDataChanged(choosePane.getTableDataWrapper()); + } else { + morePane.fireTableDataChanged(choosePane.getTableDataWrapper()); + } + + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapMoreCubeLayerPane.java b/designer_chart/src/com/fr/design/chart/report/MapMoreCubeLayerPane.java new file mode 100644 index 000000000..56e32d8b5 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapMoreCubeLayerPane.java @@ -0,0 +1,106 @@ +package com.fr.design.chart.report; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.MapPlot; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.MultiTabPane; +import com.fr.general.Inter; + +import java.util.ArrayList; +import java.util.List; + +/** + * 地图多层钻取界面, 就是一个多层Tab切换界面 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-22 上午10:23:37 + */ +public class MapMoreCubeLayerPane extends MultiTabPane{ + private static final long serialVersionUID = -174286187746442527L; + + private MapCubeLayerPane layerPane; + private MapCubeDataPane dataPane; + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + paneList.add(layerPane = new MapCubeLayerPane()); + paneList.add(dataPane = new MapCubeDataPane()); + + return paneList; + } + + public ChartCollection updateBean() { + return null;// do nothing + } + + public void populateBean(ChartCollection collection) { + Chart selectChart = collection.getSelectedChart(); + if(selectChart != null && selectChart.getPlot() instanceof MapPlot) { + MapPlot map = (MapPlot)selectChart.getPlot(); + layerPane.setSvg(map.isSvgMap()); + layerPane.populateBean(map.getMapName()); + } + + // 确认层级关系 + dataPane.populateBean(collection.getSelectedChart().getFilterDefinition()); + } + + public void updateBean(ChartCollection collection) { + + collection.getSelectedChart().setFilterDefinition(dataPane.update()); + + Chart selectChart = collection.getSelectedChart(); + if(selectChart != null && selectChart.getPlot() instanceof MapPlot) { + MapPlot map = (MapPlot)selectChart.getPlot(); + layerPane.updateBean(map.getMapName());// 确定更新地图名称所对应的层级关系 + } + } + + /** + * 刷新层级树 和 数据中populate 数据的层数 + * @param collection 图表收集器. + */ + public void init4PopuMapTree(ChartCollection collection) { + Chart selectChart = collection.getSelectedChart(); + if(selectChart != null && selectChart.getPlot() instanceof MapPlot) { + MapPlot map = (MapPlot)selectChart.getPlot(); + if(layerPane != null) { + layerPane.setSvg(map.isSvgMap()); + layerPane.initRootTree(map.getMapName()); + } + } + } + + /** + * 判断是否合格 + * @param ob 参数判断 + * @return 默认合格. + */ + public boolean accept(Object ob) { + return true; + } + + /** + * 界面标题 + * @return 返回标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Muiti_In"); + } + + /** + * 重置 + */ + public void reset() { + + } + + /** + * 设置是否支持单元格数据. + */ + public void setSurpportCellData(boolean surpportCellData) { + dataPane.justSupportOneSelect(surpportCellData); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapMoreCubeLayerPane4Chart.java b/designer_chart/src/com/fr/design/chart/report/MapMoreCubeLayerPane4Chart.java new file mode 100644 index 000000000..7a13e17a4 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapMoreCubeLayerPane4Chart.java @@ -0,0 +1,113 @@ +package com.fr.design.chart.report; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.MapPlot; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.MultiTabPane; +import com.fr.general.Inter; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class MapMoreCubeLayerPane4Chart extends MultiTabPane { + private static final long serialVersionUID = -174286187746442527L; + + private MapCubeLayerPane layerPane; + private MapCubeDataPane4Chart dataPane; + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + paneList.add(layerPane = new MapCubeLayerPane()); + paneList.add(dataPane = new MapCubeDataPane4Chart()); + + return paneList; + } + + public ChartCollection updateBean() { + return null;// do nothing + } + + public void populateBean(ChartCollection collection) { + Chart selectChart = collection.getSelectedChart(); + if(selectChart != null && selectChart.getPlot() instanceof MapPlot) { + MapPlot map = (MapPlot)selectChart.getPlot(); + layerPane.populateBean(map.getMapName()); + } + + // 确认层级关系 + dataPane.populateBean(collection.getSelectedChart().getFilterDefinition()); + } + + public void updateBean(ChartCollection collection) { + + collection.getSelectedChart().setFilterDefinition(dataPane.update()); + + Chart selectChart = collection.getSelectedChart(); + if(selectChart != null && selectChart.getPlot() instanceof MapPlot) { + MapPlot map = (MapPlot)selectChart.getPlot(); + layerPane.updateBean(map.getMapName());// 确定更新地图名称所对应的层级关系 + } + } + + /** + * 刷新层级树 和 数据中populate 数据的层数 + * @param collection 图表收集器. + */ + public void init4PopuMapTree(ChartCollection collection) { + Chart selectChart = collection.getSelectedChart(); + if(selectChart != null && selectChart.getPlot() instanceof MapPlot) { + MapPlot map = (MapPlot)selectChart.getPlot(); + if(layerPane != null) { + layerPane.initRootTree(map.getMapName()); + } + } + } + + /** + * 判断是否合格 + * @param ob 参数判断 + * @return 默认合格. + */ + public boolean accept(Object ob) { + return true; + } + + /** + * 界面标题 + * @return 返回标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Map_Multilayer"); + } + + /** + * 重置 + */ + public void reset() { + + } + + /** + * 设置是否支持单元格数据. + */ + public void setSurpportCellData(boolean surpportCellData) { + dataPane.justSupportOneSelect(surpportCellData); + } + + /** + * 出发数据集改变 + * @param tableDataWrapper 数据集 + */ + public void fireTableDataChanged(TableDataWrapper tableDataWrapper) { + dataPane.fireTableDataChanged(tableDataWrapper); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapMoreReportIndexPane.java b/designer_chart/src/com/fr/design/chart/report/MapMoreReportIndexPane.java new file mode 100644 index 000000000..70f11f8b4 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapMoreReportIndexPane.java @@ -0,0 +1,202 @@ +package com.fr.design.chart.report; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JTable; + +import com.fr.base.Formula; +import com.fr.base.Utils; +import com.fr.chart.chartdata.BaseSeriesDefinition; +import com.fr.chart.chartdata.MapSingleLayerReportDefinition; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.constants.UIConstants; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.general.Inter; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; + +/** + * 多层地图, 单元格, 多层切换 单界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-4-22 下午04:26:10 + */ +public class MapMoreReportIndexPane extends BasicBeanPane implements UIObserver{ + private String title = StringUtils.EMPTY; + + private TinyFormulaPane areaNamePane; + private UICorrelationPane tabPane; + + public MapMoreReportIndexPane() { + initPane(); + } + + public MapMoreReportIndexPane(String titleName) { + title = titleName; + initPane(); + } + + private void initPane() { + this.setLayout(new BorderLayout(0, 0)); + + JPanel northPane = new JPanel(); + this.add(northPane, BorderLayout.NORTH); + northPane.setLayout(new FlowLayout(FlowLayout.LEFT)); + + northPane.add(new UILabel(Inter.getLocText("Area_Name") + ":")); + + areaNamePane = new TinyFormulaPane(); + areaNamePane.setPreferredSize(new Dimension(120, 20)); + northPane.add(areaNamePane); + + tabPane = new UICorrelationPane(new String[]{Inter.getLocText(new String[]{"Filed", "Title"}), Inter.getLocText("Area_Value")}){ + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + }; + + this.add(tabPane, BorderLayout.CENTER); + } + + @Override + public void populateBean(MapSingleLayerReportDefinition definition) { + if(definition != null && definition.getCategoryName() != null) { + areaNamePane.populateBean(Utils.objectToString(definition.getCategoryName())); + + List paneList = new ArrayList(); + int titleValueSize = definition.getTitleValueSize(); + for(int i = 0; i < titleValueSize; i++) { + BaseSeriesDefinition sd = definition.getTitleValueWithIndex(i); + if(sd != null && sd.getSeriesName() != null && sd.getValue() != null) { + paneList.add(new Object[]{sd.getSeriesName(), sd.getValue()}); + } + } + + if(!paneList.isEmpty()) { + tabPane.populateBean(paneList); + } + } + } + + public MapSingleLayerReportDefinition updateBean() { + MapSingleLayerReportDefinition definition = new MapSingleLayerReportDefinition(); + + String areaName = areaNamePane.updateBean(); + if(StableUtils.canBeFormula(areaName)) { + definition.setCategoryName(new Formula(areaName)); + } else { + definition.setCategoryName(areaName); + } + + List paneList = tabPane.updateBean(); + for(int i = 0, size = paneList.size(); i < size; i++) { + Object[] values = (Object[])paneList.get(i); + if(values.length == 2) { + SeriesDefinition seriesDefinition = new SeriesDefinition(); + seriesDefinition.setSeriesName(values[0]); + seriesDefinition.setValue(values[1]); + definition.addTitleValue(seriesDefinition); + } + } + + return definition; + } + + @Override + protected String title4PopupWindow() { + return title; + } + + private class InnerTableEditor extends UITableEditor { + private JComponent editorComponent; + + /** + * 返回当前编辑器的值 + */ + public Object getCellEditorValue() { + if(editorComponent instanceof TinyFormulaPane) { + return ((TinyFormulaPane)editorComponent).getUITextField().getText(); + } else if(editorComponent instanceof UITextField) { + return ((UITextField)editorComponent).getText(); + } + + return super.getCellEditorValue(); + } + + /** + * 返回当前编辑器.. + */ + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (column == table.getModel().getColumnCount()) { + return null; + } + return getEditorComponent(column, value); + } + + private JComponent getEditorComponent(int column, Object value) { + if(column == 0) { + UITextField field = new UITextField(); + editorComponent = field; + + if(value != null) { + field.setText(Utils.objectToString(value)); + } + } else { + TinyFormulaPane tinyPane = new TinyFormulaPane() { + @Override + public void okEvent() { + tabPane.stopCellEditing(); + tabPane.fireTargetChanged(); + } + }; + tinyPane.setBackground(UIConstants.FLESH_BLUE); + + tinyPane.getUITextField().addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { +// tabPane.stopCellEditing();//kunsnat: 不stop是因为可能直接点击公式编辑按钮, 否则需要点击两次才能弹出. + tabPane.fireTargetChanged(); + } + }); + + if(value != null) { + tinyPane.getUITextField().setText(Utils.objectToString(value)); + } + + editorComponent = tinyPane; + } + return editorComponent; + } + } + + @Override + public void registerChangeListener(UIObserverListener listener) { + if(tabPane != null) { + tabPane.registerChangeListener(listener); + } + if(areaNamePane != null) { + areaNamePane.registerChangeListener(listener); + } + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapMoreTableIndexPane.java b/designer_chart/src/com/fr/design/chart/report/MapMoreTableIndexPane.java new file mode 100644 index 000000000..05d09bdd3 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapMoreTableIndexPane.java @@ -0,0 +1,209 @@ +package com.fr.design.chart.report; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JTable; + +import com.fr.base.Utils; +import com.fr.chart.chartdata.MapSingleLayerTableDefinition; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +/** + * 多层地图, 数据集定义, 多层切换 界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-4-22 下午03:27:51 + */ +public class MapMoreTableIndexPane extends BasicBeanPane implements UIObserver{ + private static final long serialVersionUID = 8135457041761804584L; + + private String title = StringUtils.EMPTY; + + private UIComboBox areaNameBox; + private UICorrelationPane tabPane;// 文本框 + 下拉框 + + private Object[] boxItems = new Object[]{""}; + + public MapMoreTableIndexPane() { + initPane(); + } + + public MapMoreTableIndexPane(String titleName) { + title = titleName; + initPane(); + } + + @Override + protected String title4PopupWindow() { + return title; + } + + private void initPane() { + this.setLayout(new BorderLayout()); + + JPanel northPane = new JPanel(); + this.add(northPane, BorderLayout.NORTH); + northPane.setLayout(new FlowLayout(FlowLayout.LEFT)); + + northPane.add(new UILabel(Inter.getLocText("Area_Name") + ":")); + + areaNameBox = new UIComboBox(); + areaNameBox.setPreferredSize(new Dimension(120, 20)); + northPane.add(areaNameBox); + + tabPane = new UICorrelationPane(new String[]{Inter.getLocText(new String[]{"Filed", "Title"}), Inter.getLocText("Area_Value")}){ + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + }; + + this.add(tabPane, BorderLayout.CENTER); + } + + /** + * 初始化 Box的选项. + */ + public void initAreaComBox(Object[] values) { + Object oldSelected = areaNameBox.getSelectedItem(); + areaNameBox.removeAllItems(); + boxItems = values; + if(values != null) { + for(int i = 0, size = values.length; i < size; i++) { + areaNameBox.addItem(values[i]); + } + } + areaNameBox.getModel().setSelectedItem(oldSelected); + } + + @Override + public void populateBean(MapSingleLayerTableDefinition ob) { + if(ob != null) { + areaNameBox.setSelectedItem(ob.getAreaName()); + + List paneList = new ArrayList(); + int titleValueSize = ob.getTitleValueSize(); + for(int i = 0; i < titleValueSize; i++) { + SeriesDefinition definition = ob.getTitleValueWithIndex(i); + if(definition != null && definition.getSeriesName() != null && definition.getValue() != null) { + paneList.add(new Object[]{definition.getSeriesName(), definition.getValue()}); + } + } + + if(!paneList.isEmpty()) { + tabPane.populateBean(paneList); + } + } + } + + public MapSingleLayerTableDefinition updateBean() {// 不需要数据集, + MapSingleLayerTableDefinition definition = new MapSingleLayerTableDefinition(); + + if(areaNameBox.getSelectedItem() != null) { + definition.setAreaName(Utils.objectToString(areaNameBox.getSelectedItem())); + } + + List paneList = tabPane.updateBean(); + for(int i = 0, size = paneList.size(); i < size; i++) { + Object[] values = (Object[])paneList.get(i); + if(values.length == 2) { + SeriesDefinition seriesDefinition = new SeriesDefinition(); + seriesDefinition.setSeriesName(values[0]); + seriesDefinition.setValue(values[1]); + definition.addTitleValue(seriesDefinition); + } + } + + return definition; + } + + private class InnerTableEditor extends UITableEditor {// 文本框 + 下拉框 + private JComponent editorComponent; + + /** + * 返回当前编辑器的值 + */ + public Object getCellEditorValue() { + if(editorComponent instanceof UIComboBox) { + return ((UIComboBox)editorComponent).getSelectedItem(); + } else if(editorComponent instanceof UITextField) { + return ((UITextField)editorComponent).getText(); + } + + return super.getCellEditorValue(); + } + + /** + * 返回当前编辑器.. + */ + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (column == table.getModel().getColumnCount()) { + return null; + } + return getEditorComponent(column, value); + } + + private JComponent getEditorComponent(int column, Object value) { + if(column == 0) { + UITextField field = new UITextField(); + editorComponent = field; + + if(value != null) { + field.setText(value.toString()); + } + } else { + UIComboBox box = new UIComboBox(boxItems); + + box.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + tabPane.fireTargetChanged(); + tabPane.stopCellEditing(); + } + }); + + if (value != null && StringUtils.isNotEmpty(value.toString())) { + box.setSelectedItem(value); + } else { + box.setSelectedItem(value); + } + + editorComponent = box; + } + return editorComponent; + } + } + + @Override + public void registerChangeListener(UIObserverListener listener) { + if(areaNameBox != null) { + areaNameBox.registerChangeListener(listener); + } + if(tabPane != null) { + tabPane.registerChangeListener(listener); + } + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapReportCubeDataPane.java b/designer_chart/src/com/fr/design/chart/report/MapReportCubeDataPane.java new file mode 100644 index 000000000..e4620fd36 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapReportCubeDataPane.java @@ -0,0 +1,74 @@ +package com.fr.design.chart.report; + +import com.fr.chart.chartdata.MapMoreLayerReportDefinition; +import com.fr.chart.chartdata.MapSingleLayerReportDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.general.Inter; + +import java.awt.*; + +/** + * 多层钻取 单元格的数据设置界面 + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-23 上午10:07:41 + */ +public class MapReportCubeDataPane extends FurtherBasicBeanPane { + + private MapMoreReportIndexPane reportPane; + + public MapReportCubeDataPane() { + this.setLayout(new BorderLayout(0, 0)); + + reportPane = new MapMoreReportIndexPane(); + this.add(reportPane, BorderLayout.CENTER); + } + + /** + * 能够展示界面的判断. + * @param ob 界面类型 + * @return 返回是否符合. + */ + public boolean accept(Object ob) { + return ob instanceof MapMoreLayerReportDefinition; + } + + /** + * 界面重置 + */ + public void reset() { + + } + + /** + * 界面弹出标题 + * @return 返回标题. + */ + public String title4PopupWindow() { + return Inter.getLocText("Cell"); + } + + @Override + public void populateBean(MapMoreLayerReportDefinition ob) {// 根据Populate 决定层级的个数, 表现为row的个数 + + if (ob != null) { + + MapSingleLayerReportDefinition[] values = ob.getNameValues(); + + if(values != null && values.length > 0) { + reportPane.populateBean(values[0]); + } + } + } + + @Override + public MapMoreLayerReportDefinition updateBean() { + MapMoreLayerReportDefinition reportDefinition = new MapMoreLayerReportDefinition(); + + reportDefinition.clearNameValues(); + reportDefinition.addNameValue(reportPane.updateBean()); + + return reportDefinition; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapReportDataSinglePane.java b/designer_chart/src/com/fr/design/chart/report/MapReportDataSinglePane.java new file mode 100644 index 000000000..c8f1b4f1e --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapReportDataSinglePane.java @@ -0,0 +1,233 @@ +package com.fr.design.chart.report; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import com.fr.base.Formula; +import com.fr.base.Utils; +import com.fr.chart.chartdata.BaseSeriesDefinition; +import com.fr.chart.chartdata.MapSingleLayerReportDefinition; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.constants.UIConstants; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.general.Inter; +import com.fr.stable.StableUtils; + +/** + * 地图 单元格数据 单层地图 界面 + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-22 下午05:16:23 + */ +public class MapReportDataSinglePane extends FurtherBasicBeanPane implements UIObserver { + + private TinyFormulaPane areaNamePane; + private UICorrelationPane seriesPane; + private ArrayList changeListeners = new ArrayList(); + + public MapReportDataSinglePane() { + initCom(); + } + + private void initCom() { + this.setLayout(new BorderLayout(0, 0)); + + JPanel northPane = new JPanel(); + this.add(northPane, BorderLayout.NORTH); + + northPane.setLayout(new FlowLayout(FlowLayout.CENTER)); + + northPane.add(new UILabel(Inter.getLocText("Area_Name") + ":", SwingConstants.RIGHT)); + areaNamePane = new TinyFormulaPane(); + areaNamePane.setPreferredSize(new Dimension(120, 20)); + northPane.add(areaNamePane); + + String[] columnNames = new String[]{Inter.getLocText(new String[]{"Filed", "Title"}), Inter.getLocText("Area_Value")}; + seriesPane = new UICorrelationPane(columnNames) { + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + }; + + this.add(seriesPane, BorderLayout.CENTER); + } + + /** + * 界面接入. + */ + public boolean accept(Object ob) { + return true; + } + + /** + * 重置 + */ + public void reset() { + + } + + /** + * 界面弹出标题. + */ + public String title4PopupWindow() { + return Inter.getLocText("Cell"); + } + + @Override + public void populateBean(MapSingleLayerReportDefinition ob) { + if(ob.getCategoryName() != null) { + areaNamePane.populateBean(Utils.objectToString(ob.getCategoryName())); + + int size = ob.getTitleValueSize(); + List paneList = new ArrayList(); + for(int i = 0; i < size; i++) { + BaseSeriesDefinition first = ob.getTitleValueWithIndex(i); + if (first != null && first.getSeriesName() != null && first.getValue() != null) { + paneList.add(new Object[]{first.getSeriesName(), first.getValue()}); + } + } + if (!paneList.isEmpty()) { + seriesPane.populateBean(paneList); + } + } + } + + @Override + public MapSingleLayerReportDefinition updateBean() { + MapSingleLayerReportDefinition reportDefinition = new MapSingleLayerReportDefinition(); + + String areaName = areaNamePane.updateBean(); + if(StableUtils.canBeFormula(areaName)) { + reportDefinition.setCategoryName(new Formula(areaName)); + } else { + reportDefinition.setCategoryName(areaName); + } + + List values = seriesPane.updateBean(); + if(values != null && !values.isEmpty() ) { + for (int i = 0, size = values.size(); i < size; i++) { + Object[] objects = (Object[]) values.get(i); + Object name = objects[0]; + Object value = objects[1]; + + if (StableUtils.canBeFormula(value)) { + value = new Formula(Utils.objectToString(value)); + } + SeriesDefinition definition = new SeriesDefinition(name, value); + reportDefinition.addTitleValue(definition); + } + } + + return reportDefinition; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(final UIObserverListener listener) { + changeListeners.add(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + private class InnerTableEditor extends UITableEditor { + private JComponent editorComponent; + + /** + * 返回当前编辑器的值 + */ + public Object getCellEditorValue() { + if(editorComponent instanceof TinyFormulaPane) { + return ((TinyFormulaPane)editorComponent).getUITextField().getText(); + } else if(editorComponent instanceof UITextField) { + return ((UITextField)editorComponent).getText(); + } + + return super.getCellEditorValue(); + } + + /** + * 返回当前编辑器.. + */ + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (column == table.getModel().getColumnCount()) { + return null; + } + return getEditorComponent(column, value); + } + + private JComponent getEditorComponent(int column, Object value) { + if(column == 0) { + UITextField field = new UITextField(); + addListener4UITextFiled(field); + + if(value != null) { + field.setText(Utils.objectToString(value)); + } + editorComponent = field; + } else { + TinyFormulaPane tinyPane = new TinyFormulaPane() { + @Override + public void okEvent() { + seriesPane.stopCellEditing(); + seriesPane.fireTargetChanged(); + } + }; + tinyPane.setBackground(UIConstants.FLESH_BLUE); + + addListener4UITextFiled(tinyPane.getUITextField()); + + if(value != null) { + tinyPane.getUITextField().setText(Utils.objectToString(value)); + } + + editorComponent = tinyPane; + } + return editorComponent; + } + + private void addListener4UITextFiled(UITextField textField) { + + textField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { +// seriesPane.stopCellEditing(); //kunsnat: 不stop是因为可能直接点击公式编辑按钮, 否则需要点击两次才能弹出. + seriesPane.fireTargetChanged(); + } + }); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapReportEditor.java b/designer_chart/src/com/fr/design/chart/report/MapReportEditor.java new file mode 100644 index 000000000..82eb68a59 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapReportEditor.java @@ -0,0 +1,62 @@ +package com.fr.design.chart.report; + +import java.awt.Component; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.AbstractCellEditor; +import javax.swing.JTable; +import javax.swing.event.ChangeListener; +import javax.swing.table.TableCellEditor; + +import com.fr.design.editor.ValueEditorPane; +import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.editor.editor.Editor; +import com.fr.design.editor.editor.FormulaEditor; +import com.fr.design.editor.editor.TextEditor; +import com.fr.general.Inter; + +/** + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-23 上午10:31:22 + */ +public class MapReportEditor extends AbstractCellEditor implements TableCellEditor { + private ValueEditorPane cellEditor; + + private List list = new ArrayList(); + + public MapReportEditor() { + } + + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + cellEditor = createPane(); + cellEditor.populate(value == null ? "" : value); + return cellEditor; + } + + public Object getCellEditorValue() { + return cellEditor.update(); + } + + public void addChangeListener(ChangeListener l) { + list.add(l); + } + + private ValueEditorPane createPane() { + TextEditor textEidtor = new TextEditor(); + initListeners(textEidtor); + + FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); + initListeners(formulaEditor); + + Editor[] editors = new Editor[]{textEidtor, formulaEditor}; + cellEditor = ValueEditorPaneFactory.createValueEditorPane(editors); + return cellEditor; + } + + private void initListeners(Editor editor) { + for(int i = 0; i < list.size(); i++) { + editor.addChangeListener(list.get(i)); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapReportRenderer.java b/designer_chart/src/com/fr/design/chart/report/MapReportRenderer.java new file mode 100644 index 000000000..2571906cc --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapReportRenderer.java @@ -0,0 +1,32 @@ +package com.fr.design.chart.report; + +import java.awt.Component; + +import javax.swing.JTable; +import javax.swing.table.DefaultTableCellRenderer; + +import com.fr.design.editor.ValueEditorPane; +import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.editor.editor.Editor; +import com.fr.design.editor.editor.FormulaEditor; +import com.fr.design.editor.editor.TextEditor; +import com.fr.general.Inter; + +/** + * 简要提供 文本和公式两种编辑器 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-23 上午10:30:16 + */ +public class MapReportRenderer extends DefaultTableCellRenderer { + private ValueEditorPane cellEditor; + + public MapReportRenderer() { + Editor[] editors = new Editor[]{new TextEditor(), new FormulaEditor(Inter.getLocText("Parameter-Formula"))}; + cellEditor = ValueEditorPaneFactory.createValueEditorPane(editors); + } + + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + cellEditor.populate(value == null ? "" : value); + return cellEditor; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapSinglePane.java b/designer_chart/src/com/fr/design/chart/report/MapSinglePane.java new file mode 100644 index 000000000..635382910 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapSinglePane.java @@ -0,0 +1,113 @@ +package com.fr.design.chart.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartdata.MapSingleLayerReportDefinition; +import com.fr.chart.chartdata.MapSingleLayerTableDefinition; +import com.fr.chart.chartdata.TopDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +/** + * 数据定义: 地图单层设置 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-22 上午10:41:03 + */ +public class MapSinglePane extends FurtherBasicBeanPane { + + private UIComboBoxPane dataFromPane;// 数据来源的box界面 + + private MapReportDataSinglePane reportSinglePane; + private MapTableDataSinglePane tableSinglePane; + + public MapSinglePane() { + initCom(); + } + + private void initCom() { + this.setLayout(new BorderLayout()); + + this.add(dataFromPane = new UIComboBoxPane() { + protected void initLayout() { + this.setLayout(new BorderLayout(0, 6)); + JPanel northPane = new JPanel(new FlowLayout(FlowLayout.LEFT)); + northPane.add(new BoldFontTextLabel(Inter.getLocText("ChartF-Data-Resource") + ":")); + northPane.add(jcb); + + this.add(northPane, BorderLayout.NORTH); + this.add(cardPane, BorderLayout.CENTER); + } + + @Override + protected List> initPaneList() { + List list = new ArrayList(); + + list.add(tableSinglePane = new MapTableDataSinglePane());// 数据集界面 + list.add(reportSinglePane = new MapReportDataSinglePane());// 单元格界面 + + return list; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Data_Setting"); + } + }, BorderLayout.CENTER); + } + + /** + * 判断准许的情况 + */ + public boolean accept(Object ob) { + return ob instanceof TopDefinition; + } + + /** + * 重置 + */ + public void reset() { + + } + + /** + * 界面标题 + */ + public String title4PopupWindow() { + return Inter.getLocText(new String[]{"SingleLayer", "Chart-Map"}); + } + + /** + * 加载单层地图时的 数据来源界面 + */ + public void populateBean(TopDefinitionProvider ob) { + if(ob instanceof MapSingleLayerReportDefinition) { + dataFromPane.setSelectedIndex(1); + reportSinglePane.populateBean((MapSingleLayerReportDefinition)ob); + } else if(ob instanceof MapSingleLayerTableDefinition) { + dataFromPane.setSelectedIndex(0); + tableSinglePane.populateBean((MapSingleLayerTableDefinition)ob); + } + } + + /** + * 保存下载 单层数据界面 + */ + public TopDefinitionProvider updateBean() { + if(dataFromPane.getSelectedIndex() == 0) { + return tableSinglePane.updateBean(); + } else { + return reportSinglePane.updateBean(); + } + } + + public void setSurpportCellData(boolean surpportCellData) { + dataFromPane.justSupportOneSelect(surpportCellData); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapSinglePane4Chart.java b/designer_chart/src/com/fr/design/chart/report/MapSinglePane4Chart.java new file mode 100644 index 000000000..46a4ba223 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapSinglePane4Chart.java @@ -0,0 +1,79 @@ +package com.fr.design.chart.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartdata.MapSingleLayerTableDefinition; +import com.fr.chart.chartdata.TopDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.general.Inter; + +import java.awt.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class MapSinglePane4Chart extends FurtherBasicBeanPane { + + private MapTableDataSinglePane4Chart tableSinglePane; + + public MapSinglePane4Chart() { + initCom(); + } + + private void initCom() { + this.setLayout(new BorderLayout()); + + this.add(tableSinglePane = new MapTableDataSinglePane4Chart(), BorderLayout.CENTER); + } + + /** + * 判断准许的情况 + * @param ob 数据集 + * @return 是不是顶层数据 + */ + public boolean accept(Object ob) { + return ob instanceof TopDefinition; + } + + /** + * 重置 + */ + public void reset() { + + } + + /** + *界面标题 + * @return 界面标题 + */ + public String title4PopupWindow() { + return Inter.getLocText(new String[]{"SingleLayer", "Chart-Map"}); + } + + /** + * 加载单层地图时的 数据来源界面 + */ + public void populateBean(TopDefinitionProvider ob) { + if(ob instanceof MapSingleLayerTableDefinition) { + tableSinglePane.populateBean((MapSingleLayerTableDefinition)ob); + } + } + + /** + * 保存下载 单层数据界面 + */ + public TopDefinitionProvider updateBean() { + return tableSinglePane.updateBean(); + } + + /** + * 出发数据集改变 + * @param tableDataWrapper 数据集 + */ + public void fireTableDataChanged(TableDataWrapper tableDataWrapper) { + tableSinglePane.setTableDataWrapper(tableDataWrapper); + tableSinglePane.refreshAreaNameBox(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapTableCubeDataPane.java b/designer_chart/src/com/fr/design/chart/report/MapTableCubeDataPane.java new file mode 100644 index 000000000..62221b73a --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapTableCubeDataPane.java @@ -0,0 +1,110 @@ +package com.fr.design.chart.report; + +import com.fr.chart.chartdata.MapMoreLayerTableDefinition; +import com.fr.chart.chartdata.MapSingleLayerTableDefinition; +import com.fr.data.impl.NameTableData; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.util.List; + +/** + * 地图 多层钻取 数据集定义界面 + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-23 上午10:55:39 + */ +public class MapTableCubeDataPane extends FurtherBasicBeanPane { + + private DatabaseTableDataPane dataFromBox; + + private MapMoreTableIndexPane tablePane; + + public MapTableCubeDataPane() { + this.setLayout(new BorderLayout()); + + JPanel pane = new JPanel(); + this.add(pane, BorderLayout.NORTH); + + pane.setLayout(new FlowLayout(FlowLayout.LEFT)); + + UILabel label = new UILabel(Inter.getLocText("Select_Data_Set") + ":", SwingConstants.RIGHT); + + dataFromBox = new DatabaseTableDataPane(label) { + protected void userEvent() { + refreshAreaNameBox(); + } + }; + dataFromBox.setPreferredSize(new Dimension(180, 20)); + pane.add(dataFromBox); + + tablePane = new MapMoreTableIndexPane(); + this.add(tablePane, BorderLayout.CENTER); + } + + private void refreshAreaNameBox() {// 刷新区域名称列表 + TableDataWrapper tableDataWrappe = dataFromBox.getTableDataWrapper(); + if (tableDataWrappe == null) { + return; + } + + List columnNameList = tableDataWrappe.calculateColumnNameList(); + tablePane.initAreaComBox(columnNameList.toArray(new String[columnNameList.size()])); + } + + /** + * 界面接入 + * @param ob 界面 + * @return 返回接入. + */ + public boolean accept(Object ob) { + return true; + } + + /** + * 重置 + */ + public void reset() { + } + + /** + * 界面弹出标题 + * @return 返回标题. + */ + public String title4PopupWindow() { + return Inter.getLocText("DS-TableData"); + } + + @Override + public void populateBean(MapMoreLayerTableDefinition tableDefinition) {// editingLayerCout + + if (tableDefinition != null) { + dataFromBox.populateBean(tableDefinition.getTableData()); + + MapSingleLayerTableDefinition[] values = tableDefinition.getNameValues(); + if(values != null && values.length > 0) { + tablePane.populateBean(values[0]); + } + } + } + + @Override + public MapMoreLayerTableDefinition updateBean() { + MapMoreLayerTableDefinition tableDefinition = new MapMoreLayerTableDefinition(); + + TableDataWrapper tableDataWrappe = dataFromBox.getTableDataWrapper(); + if (tableDataWrappe != null) { + tableDefinition.setTableData(new NameTableData(tableDataWrappe.getTableDataName())); + + tableDefinition.clearNameValues(); + tableDefinition.addNameValue(tablePane.updateBean()); + } + + return tableDefinition; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapTableCubeDataPane4Chart.java b/designer_chart/src/com/fr/design/chart/report/MapTableCubeDataPane4Chart.java new file mode 100644 index 000000000..2da1d6840 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapTableCubeDataPane4Chart.java @@ -0,0 +1,93 @@ +package com.fr.design.chart.report; + +import com.fr.chart.chartdata.MapMoreLayerTableDefinition; +import com.fr.chart.chartdata.MapSingleLayerTableDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.general.Inter; + +import java.awt.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class MapTableCubeDataPane4Chart extends FurtherBasicBeanPane { + + private MapMoreTableIndexPane tablePane; + private TableDataWrapper tableDataWrapper; + + public MapTableCubeDataPane4Chart() { + this.setLayout(new BorderLayout()); + tablePane = new MapMoreTableIndexPane(); + this.add(tablePane, BorderLayout.CENTER); + } + + /** + * 刷新区域名称列表 + */ + public void refreshAreaNameBox() { + TableDataWrapper tableDataWrappe = tableDataWrapper; + if (tableDataWrappe == null) { + return; + } + + java.util.List columnNameList = tableDataWrappe.calculateColumnNameList(); + tablePane.initAreaComBox(columnNameList.toArray(new String[columnNameList.size()])); + } + + public void setTableDataWrapper(TableDataWrapper wrapper){ + this.tableDataWrapper = wrapper; + } + + /** + * 界面接入 + * @param ob 界面 + * @return 返回接入. + */ + public boolean accept(Object ob) { + return true; + } + + /** + * 重置 + */ + public void reset() { + } + + /** + * 界面弹出标题 + * @return 返回标题. + */ + public String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Table_Data"); + } + + @Override + public void populateBean(MapMoreLayerTableDefinition tableDefinition) { + + if (tableDefinition != null) { + MapSingleLayerTableDefinition[] values = tableDefinition.getNameValues(); + if(values != null && values.length > 0) { + tablePane.populateBean(values[0]); + } + } + } + + @Override + public MapMoreLayerTableDefinition updateBean() { + MapMoreLayerTableDefinition tableDefinition = new MapMoreLayerTableDefinition(); + + TableDataWrapper tableDataWrappe =tableDataWrapper; + if (tableDataWrappe != null) { + tableDefinition.setTableData(tableDataWrappe.getTableData()); + + tableDefinition.clearNameValues(); + tableDefinition.addNameValue(tablePane.updateBean()); + } + + return tableDefinition; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapTableDataSinglePane.java b/designer_chart/src/com/fr/design/chart/report/MapTableDataSinglePane.java new file mode 100644 index 000000000..1f9463e7c --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapTableDataSinglePane.java @@ -0,0 +1,271 @@ +package com.fr.design.chart.report; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import com.fr.base.Utils; +import com.fr.chart.chartdata.MapSingleLayerTableDefinition; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.data.impl.NameTableData; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +/** + * 单层地图时: 数据集 定义界面 + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-22 上午11:14:59 + */ +public class MapTableDataSinglePane extends FurtherBasicBeanPane implements UIObserver { + + private DatabaseTableDataPane fromTableData; + + private ArrayList changeListeners = new ArrayList(); + private String[] initNames = {""}; + + private UIComboBox areaNameBox; + private UICorrelationPane titleValuePane; + + public MapTableDataSinglePane() { + this.setLayout(new BorderLayout()); + + JPanel northPane = new JPanel(); + this.add(northPane, BorderLayout.NORTH); + + northPane.setLayout(new FlowLayout(FlowLayout.LEFT)); + + UILabel label = new UILabel(Inter.getLocText("Select_Data_Set") + ":", SwingConstants.RIGHT); + + northPane.add(fromTableData = new DatabaseTableDataPane(label) { + @Override + protected void userEvent() { + refreshAreaNameBox(); + } + }); + fromTableData.setPreferredSize(new Dimension(180, 20)); + northPane.add(fromTableData); + + UILabel nameLabel = new UILabel(" " + Inter.getLocText("Area_Name") + ":", SwingConstants.RIGHT); + areaNameBox = new UIComboBox(); + areaNameBox.setPreferredSize(new Dimension(80, 20)); + + JPanel areaNamePane = new JPanel(); + areaNamePane.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0)); + + areaNamePane.add(nameLabel); + areaNamePane.add(areaNameBox); + + JPanel pane = new JPanel(); + this.add(pane, BorderLayout.CENTER); + pane.setLayout(new BorderLayout()); + + pane.add(areaNamePane, BorderLayout.NORTH); + + String[] titles = {Inter.getLocText(new String[]{"Filed", "Title"}), Inter.getLocText("Area_Value")}; + titleValuePane = new UICorrelationPane(titles){ + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + }; + + pane.add(titleValuePane, BorderLayout.CENTER); + } + + private void refreshAreaNameBox() {// 刷新区域名称列表 + TableDataWrapper tableDataWrappe = fromTableData.getTableDataWrapper(); + if (tableDataWrappe == null) { + return; + } + List columnNameList = tableDataWrappe.calculateColumnNameList(); + initNames = columnNameList.toArray(new String[columnNameList.size()]); + + Object oldSelected = areaNameBox.getSelectedItem(); + areaNameBox.removeAllItems(); + for(int i = 0, size = initNames.length; i < size; i++) { + areaNameBox.addItem(initNames[i]); + } + areaNameBox.getModel().setSelectedItem(oldSelected); + stopEditing(); + } + + /** + * 界面接入 + */ + public boolean accept(Object ob) { + return false; + } + + /** + * 界面重置 + */ + public void reset() { + + } + + /** + * 界面弹出标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("DS-TableData"); + } + + private void stopEditing() { + } + + @Override + public void populateBean(MapSingleLayerTableDefinition ob) { + stopEditing(); + if (ob instanceof MapSingleLayerTableDefinition) { + MapSingleLayerTableDefinition mapDefinition = (MapSingleLayerTableDefinition) ob; + + fromTableData.populateBean(((NameTableData) mapDefinition.getTableData())); + areaNameBox.setSelectedItem(mapDefinition.getAreaName()); + + List paneList = new ArrayList(); + int titleValueSize = mapDefinition.getTitleValueSize(); + for(int i = 0; i < titleValueSize; i++) { + SeriesDefinition definition = mapDefinition.getTitleValueWithIndex(i); + if(definition != null && definition.getSeriesName() != null && definition.getValue() != null) { + paneList.add(new Object[]{definition.getSeriesName(), definition.getValue()}); + } + } + + if(!paneList.isEmpty()) { + titleValuePane.populateBean(paneList); + } + } + } + + @Override + public MapSingleLayerTableDefinition updateBean() {// 从一行内容中update + stopEditing(); + + MapSingleLayerTableDefinition definition = new MapSingleLayerTableDefinition(); + + TableDataWrapper tableDataWrappe = fromTableData.getTableDataWrapper(); + if (tableDataWrappe == null || areaNameBox.getSelectedItem() == null) { + return null; + } + + definition.setTableData(new NameTableData(tableDataWrappe.getTableDataName())); + definition.setAreaName(Utils.objectToString(areaNameBox.getSelectedItem())); + + List paneList = titleValuePane.updateBean(); + for(int i = 0, size = paneList.size(); i < size; i++) { + Object[] values = (Object[])paneList.get(i); + if(values.length == 2) { + SeriesDefinition seriesDefinition = new SeriesDefinition(); + seriesDefinition.setSeriesName(values[0]); + seriesDefinition.setValue(values[1]); + definition.addTitleValue(seriesDefinition); + } + } + + return definition; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(final UIObserverListener listener) { + changeListeners.add(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + private class InnerTableEditor extends UITableEditor { + private JComponent editorComponent; + + /** + * 返回当前编辑器的值 + */ + public Object getCellEditorValue() { + if(editorComponent instanceof UITextField) { + UITextField textField = (UITextField)editorComponent; + return textField.getText(); + } else if(editorComponent instanceof UIComboBox) { + UIComboBox boxPane = (UIComboBox)editorComponent; + return boxPane.getSelectedItem(); + } + return super.getCellEditorValue(); + } + + /** + * 返回当前编辑器.. + */ + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (column == table.getModel().getColumnCount()) { + return null; + } + if(column == 0 ) { + UITextField text = new UITextField(); + if(value != null) { + text.setText(Utils.objectToString(value)); + } + + text.registerChangeListener(new UIObserverListener() { + @Override + public void doChange() { + titleValuePane.fireTargetChanged(); + } + }); + + this.editorComponent = text; + } else { + UIComboBox box = new UIComboBox(initNames); + box.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + titleValuePane.fireTargetChanged(); + titleValuePane.stopCellEditing(); + } + }); + + if (value != null && StringUtils.isNotEmpty(value.toString())) { + box.setSelectedItem(value); + } else { + box.setSelectedItem(value); + } + + this.editorComponent = box; + } + return this.editorComponent; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/report/MapTableDataSinglePane4Chart.java b/designer_chart/src/com/fr/design/chart/report/MapTableDataSinglePane4Chart.java new file mode 100644 index 000000000..df0dca928 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/report/MapTableDataSinglePane4Chart.java @@ -0,0 +1,268 @@ +package com.fr.design.chart.report; + +import com.fr.base.Utils; +import com.fr.chart.chartdata.MapSingleLayerTableDefinition; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.UICorrelationPane; +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.gui.itable.UITableEditor; +import com.fr.design.gui.itextfield.UITextField; +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 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.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class MapTableDataSinglePane4Chart extends FurtherBasicBeanPane implements UIObserver { + + private static final int LABEL_WIDTH_GAP = 5; + private static final int COM_HEIGHT = 20; + private ArrayList changeListeners = new ArrayList(); + private String[] initNames = {""}; + + private UIComboBox areaNameBox; + private UICorrelationPane titleValuePane; + private TableDataWrapper tableDataWrapper; + + public MapTableDataSinglePane4Chart() { + this.setLayout(new BorderLayout()); + JPanel pane = new JPanel(); + this.add(pane, BorderLayout.CENTER); + pane.setLayout(new BorderLayout()); + + pane.add(getAreaNamePane(), BorderLayout.NORTH); + + String[] titles = {Inter.getLocText("FR-Chart-Area_Title"), Inter.getLocText("FR-Chart-Area_Value")}; + titleValuePane = new UICorrelationPane(titles){ + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + }; + + pane.add(titleValuePane, BorderLayout.CENTER); + } + + + private JPanel getAreaNamePane(){ + final UILabel label = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Map_ShowWay") + ":"); + UILabel nameLabel = new UILabel(Inter.getLocText("FR-Chart-Area_Name") + ":", SwingConstants.RIGHT){ + public Dimension getPreferredSize() { + return new Dimension(label.getPreferredSize().width+LABEL_WIDTH_GAP,COM_HEIGHT); + } + }; + areaNameBox = new UIComboBox(); + areaNameBox.setPreferredSize(new Dimension(80, 20)); + double p =TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p}; + Component[][] components = new Component[][]{ + new Component[]{nameLabel, areaNameBox}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + /** + *刷新区域名称列表 + */ + public void refreshAreaNameBox() {// 刷新区域名称列表 + TableDataWrapper tableDataWrappe = tableDataWrapper; + if (tableDataWrappe == null) { + return; + } + java.util.List columnNameList = tableDataWrappe.calculateColumnNameList(); + initNames = columnNameList.toArray(new String[columnNameList.size()]); + + Object oldSelected = areaNameBox.getSelectedItem(); + areaNameBox.removeAllItems(); + for(int i = 0, size = initNames.length; i < size; i++) { + areaNameBox.addItem(initNames[i]); + } + areaNameBox.getModel().setSelectedItem(oldSelected); + stopEditing(); + } + + + /** + * 是否接受数据集 + * @param ob 具体变量 + * @return 不是 + */ + public boolean accept(Object ob) { + return false; + } + + /** + * 界面重置 + */ + public void reset() { + + } + + /** + * 界面弹出标题 + * @return 标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Table_Data"); + } + + private void stopEditing() { + } + + @Override + public void populateBean(MapSingleLayerTableDefinition ob) { + stopEditing(); + if (ob instanceof MapSingleLayerTableDefinition) { + MapSingleLayerTableDefinition mapDefinition = (MapSingleLayerTableDefinition) ob; + +// fromTableData.populateBean(((NameTableData) mapDefinition.getTableData())); + areaNameBox.setSelectedItem(mapDefinition.getAreaName()); + + java.util.List paneList = new ArrayList(); + int titleValueSize = mapDefinition.getTitleValueSize(); + for(int i = 0; i < titleValueSize; i++) { + SeriesDefinition definition = mapDefinition.getTitleValueWithIndex(i); + if(definition != null && definition.getSeriesName() != null && definition.getValue() != null) { + paneList.add(new Object[]{definition.getSeriesName(), definition.getValue()}); + } + } + + if(!paneList.isEmpty()) { + titleValuePane.populateBean(paneList); + } + } + } + + @Override + public MapSingleLayerTableDefinition updateBean() {// 从一行内容中update + stopEditing(); + + MapSingleLayerTableDefinition definition = new MapSingleLayerTableDefinition(); + + TableDataWrapper tableDataWrappe = tableDataWrapper; +// = fromTableData.getTableDataWrapper(); + if (tableDataWrappe == null || areaNameBox.getSelectedItem() == null) { + return null; + } + + definition.setTableData(tableDataWrapper.getTableData()); + definition.setAreaName(Utils.objectToString(areaNameBox.getSelectedItem())); + + java.util.List paneList = titleValuePane.updateBean(); + for(int i = 0, size = paneList.size(); i < size; i++) { + Object[] values = (Object[])paneList.get(i); + if(values.length == 2) { + SeriesDefinition seriesDefinition = new SeriesDefinition(); + seriesDefinition.setSeriesName(values[0]); + seriesDefinition.setValue(values[1]); + definition.addTitleValue(seriesDefinition); + } + } + + return definition; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(final UIObserverListener listener) { + changeListeners.add(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + private class InnerTableEditor extends UITableEditor { + private JComponent editorComponent; + + /** + * 返回当前编辑器的值 + */ + public Object getCellEditorValue() { + if(editorComponent instanceof UITextField) { + UITextField textField = (UITextField)editorComponent; + return textField.getText(); + } else if(editorComponent instanceof UIComboBox) { + UIComboBox boxPane = (UIComboBox)editorComponent; + return boxPane.getSelectedItem(); + } + return super.getCellEditorValue(); + } + + /** + * 返回当前编辑器.. + */ + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (column == table.getModel().getColumnCount()) { + return null; + } + if(column == 0 ) { + UITextField text = new UITextField(); + if(value != null) { + text.setText(Utils.objectToString(value)); + } + + text.registerChangeListener(new UIObserverListener() { + @Override + public void doChange() { + titleValuePane.fireTargetChanged(); + } + }); + + this.editorComponent = text; + } else { + UIComboBox box = new UIComboBox(initNames); + box.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + titleValuePane.fireTargetChanged(); + titleValuePane.stopCellEditing(); + } + }); + + if (value != null && StringUtils.isNotEmpty(value.toString())) { + box.setSelectedItem(value); + } else { + box.setSelectedItem(value); + } + + this.editorComponent = box; + } + return this.editorComponent; + } + } + + public void setTableDataWrapper(TableDataWrapper wrapper){ + this.tableDataWrapper = wrapper; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java new file mode 100644 index 000000000..d2d61909b --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java @@ -0,0 +1,23 @@ +package com.fr.design.chart.series.PlotSeries; + +import com.fr.chart.base.MapSvgAttr; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public interface AbstrctMapAttrEditPane { + + /** + * 更新界面 + * @param attr 地图属性 + */ + public void populateMapAttr(MapSvgAttr attr); + + /** + * 更新MapSvgAttr + * @return 返回属性 + */ + public MapSvgAttr updateCurrentAttr(); +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java new file mode 100644 index 000000000..0a922d34e --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java @@ -0,0 +1,217 @@ +package com.fr.design.chart.series.PlotSeries; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JFileChooser; +import javax.swing.JPanel; +import javax.swing.SwingConstants; + +import com.fr.base.Utils; +import com.fr.chart.base.MapSvgAttr; +import com.fr.design.data.DesignTableDataManager; +import com.fr.data.TableDataSource; +import com.fr.data.core.DataCoreUtils; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.FilterComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; +import org.apache.batik.swing.svg.SVGFileFilter; + +/** + * 自定义地图界面. + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-15 下午03:38:15 + */ +public class MapCustomPane extends BasicBeanPane implements AbstrctMapAttrEditPane{ // 储存地图对应的字段. 名称, 类型. shape (点 用圆形代替) + + private FilterComboBox areaString;// 区域字段 + private DatabaseTableDataPane tableDataNameBox;// 数据集名称 + 后面跟随预览按钮 + private MapImageEditPane imageShowPane; // 图片展示编辑的界面 + private String lastSelectPath; + private boolean isNeedDataSource = true; + + public MapCustomPane() { + initComp(); + } + + public MapCustomPane(boolean isNeedDataSource){ + this.isNeedDataSource = isNeedDataSource; + initComp(); + } + + private void initComp() { + this.setLayout(new BorderLayout(0, 0)); + + JPanel pane = new JPanel(); + this.add(pane, BorderLayout.NORTH); + + pane.setLayout(new BorderLayout()); + + pane.add(northPaneCreate(), BorderLayout.NORTH); + + imageShowPane = new MapImageEditPane(); + + pane.add(imageShowPane, BorderLayout.CENTER); + } + + private JPanel northPaneCreate() { + JPanel northPane = new JPanel(); + + northPane.setLayout(new FlowLayout(FlowLayout.LEFT)); + + UIButton loadMap = new UIButton(Inter.getLocText("FR-Chart-Import_Map")); + loadMap.setPreferredSize(new Dimension(160, 20)); + northPane.add(loadMap); + + loadMap.addActionListener(selectPictureActionListener); + + if(isNeedDataSource){ + UILabel label =new UILabel(Inter.getLocText("FR-Chart-Table_Data") + ":", SwingConstants.RIGHT) ; + + tableDataNameBox = new DatabaseTableDataPane(label) { + protected void userEvent() { +refreshAreaNameBox(); +} + }; + tableDataNameBox.setPreferredSize(new Dimension(200, 20)); + northPane.add(tableDataNameBox); + + northPane.add(new BoldFontTextLabel(Inter.getLocText(new String[]{"Filed", "Field"}) + ":")); + + areaString = new FilterComboBox(); + areaString.setPreferredSize(new Dimension(120, 20)); + areaString.addItemListener(areaChange); + northPane.add(areaString); + } + + + return northPane; + } + + private ActionListener selectPictureActionListener = new ActionListener() { + + public void actionPerformed(ActionEvent evt) { + JFileChooser svgFileChooser = new JFileChooser(); + svgFileChooser.addChoosableFileFilter(new SVGFileFilter()); + if (StringUtils.isNotBlank(lastSelectPath)) { + svgFileChooser.setSelectedFile(new File(lastSelectPath)); + } + int returnVal = svgFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); + if (returnVal != JFileChooser.CANCEL_OPTION) { + File selectedFile = svgFileChooser.getSelectedFile(); + lastSelectPath = selectedFile.getAbsolutePath(); + if (selectedFile != null && selectedFile.isFile()) { + imageShowPane.setSvgMap(selectedFile.getPath()); + imageShowPane.repaint(); + } + } + } + }; + + private ItemListener areaChange = new ItemListener() { + public void itemStateChanged(ItemEvent e) { + Object select = areaString.getSelectedItem(); + if (select != null) { + String colName = Utils.objectToString(areaString.getSelectedItem()); + + TableDataWrapper tableDataWrappe = tableDataNameBox.getTableDataWrapper(); + TableDataSource source = DesignTableDataManager.getEditingTableDataSource(); + if (tableDataWrappe == null || source == null) { + return; + } + + String[] values = DataCoreUtils.getColValuesInData(source, tableDataWrappe.getTableDataName(), colName); + ArrayList list = new ArrayList(); + for(int i = 0; i < values.length; i++) { + list.add(values[i]); + } + + imageShowPane.refreshFromDataList(list); + } + } + }; + + /** + * 选中方式: 区域或者点 + */ + public void setImageSelectType(int selectType) { + if (imageShowPane != null) { + imageShowPane.setEditType(selectType); + } + } + + private void refreshAreaNameBox() {// 刷新区域名称列表 + if(!isNeedDataSource){ + return; + } + TableDataWrapper tableDataWrappe = tableDataNameBox.getTableDataWrapper(); + if (tableDataWrappe == null) { + return; + } + List columnNameList = tableDataWrappe.calculateColumnNameList(); + + areaString.removeAllItems(); + areaString.setItemList(columnNameList); + } + + /** + * 当前正在编辑的条目的类别(国家,省市)名和地图名 + * @param typeName 类别名 + * @param mapName 地图名 + */ + public void setTypeNameAndMapName(String typeName, String mapName){ + imageShowPane.setTypeNameAndMapName(typeName, mapName); + } + + /** + * 根据地图名称 加载信息 + */ + public void populateBean(String list) { + imageShowPane.populateBean(list); + } + + /** + * 根据地图名称 保存信息 + */ + public String updateBean() { + // 地图类型等 加入Helper + return imageShowPane.updateBean(); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Datasource-User_Defined", "Chart-Map"}); + } + + /** + * 更新界面 + * @param attr 地图属性 + */ + public void populateMapAttr(MapSvgAttr attr) { + imageShowPane.populateMapSvgAttr(attr); + } + + /** + * 更新MapSvgAttr + * @return 返回属性 + */ + public MapSvgAttr updateCurrentAttr() { + return imageShowPane.updateWithOutSave(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java new file mode 100644 index 000000000..515527eaf --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java @@ -0,0 +1,250 @@ +package com.fr.design.chart.series.PlotSeries; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.swing.AbstractCellEditor; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellEditor; + +import com.fr.chart.base.MapSvgAttr; +import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.base.Utils; +import com.fr.design.data.DesignTableDataManager; +import com.fr.data.TableDataSource; +import com.fr.data.core.DataCoreUtils; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icombobox.FilterComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itableeditorpane.UIArrayTableModel; +import com.fr.design.gui.itableeditorpane.UITableEditorPane; +import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; +import com.fr.design.editor.ValueEditorPane; +import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.gui.xcombox.ComboBoxUseEditor; +import com.fr.design.editor.editor.Editor; +import com.fr.design.editor.editor.TextEditor; +import com.fr.general.Inter; +import com.fr.third.org.apache.poi.hssf.record.formula.functions.T; + +/** + * 地图, 定义区域名. + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-19 下午03:19:53 + */ +public class MapDefiAreaNamePane extends BasicBeanPane implements AbstrctMapAttrEditPane{ + + private DatabaseTableDataPane tableDataBox; + private FilterComboBox columnBox; + + // 双列: 左侧Label, 数据列表(全部都是UIComboBox, 支持自定义). + private UITableEditorPane tableEditorPane; + private UIArrayTableModel tableEditorModel; + + private String[] initNames = new String[]{}; + + private String editName = ""; + private boolean isNeedDataSource = true; + private MapSvgAttr currentSvg; + + public MapDefiAreaNamePane(boolean isNeedDataSource){ + this.isNeedDataSource = isNeedDataSource; + initCom(); + } + + public MapDefiAreaNamePane() { + initCom(); + } + + private void initCom() { + this.setLayout(new BorderLayout(0, 0)); + + JPanel northPane = new JPanel(); + if(this.isNeedDataSource){ + this.add(northPane, BorderLayout.NORTH); + } + + northPane.setLayout(new FlowLayout(FlowLayout.LEFT)); + + UILabel lable = new UILabel(Inter.getLocText("Chart-DS_TableData") + ":", SwingConstants.RIGHT); + + // 数据集, 字段, 数据列表, 使用该数据进行自动命名 + tableDataBox = new DatabaseTableDataPane(lable) { + protected void userEvent() { + refreshAreaNameBox(); + } + }; + + tableDataBox.setPreferredSize(new Dimension(200, 20)); + northPane.add(tableDataBox); + + columnBox = new FilterComboBox(); + columnBox.setPreferredSize(new Dimension(40, 20)); + columnBox.addItemListener(columnChange); + + northPane.add(new UILabel(Inter.getLocText("FR-Chart-Map_Field")+":")); + northPane.add(columnBox); + + tableEditorModel = new UIArrayTableModel(new String[]{Inter.getLocText("FR-Chart-Map_Use_Field"), Inter.getLocText("FR-Chart-Area_Name")}, new int[]{}) { + public boolean isCellEditable(int row, int col) { + return col != 0; + } + }; + tableEditorModel.setDefaultEditor(Object.class, new DefaultComboBoxEditor()); + tableEditorModel.setDefaultRenderer(Object.class, new DefaultComboBoxRenderer()); + tableEditorPane = new UITableEditorPane(tableEditorModel); + this.add(tableEditorPane); + } + + ItemListener columnChange = new ItemListener() { + public void itemStateChanged(ItemEvent e) { + if (columnBox.getSelectedItem() != null) { + String columnName = Utils.objectToString(columnBox.getSelectedItem()); + + TableDataWrapper tableDataWrappe = tableDataBox.getTableDataWrapper(); + TableDataSource source = DesignTableDataManager.getEditingTableDataSource(); + if (tableDataWrappe == null || source == null) { + return; + } + + initNames = DataCoreUtils.getColValuesInData(source, tableDataWrappe.getTableDataName(), columnName); + + if (tableEditorModel != null) { + tableEditorModel.stopCellEditing();// 只是用来刷新列表的combox + } + } + } + }; + + private void refreshAreaNameBox() {// 刷新区域名称列表 + TableDataWrapper tableDataWrappe = tableDataBox.getTableDataWrapper(); + if (tableDataWrappe == null) { + return; + } + List columnNameList = tableDataWrappe.calculateColumnNameList(); + + columnBox.setItemList(columnNameList); + } + + // 对应地图的名称 + public void populateBean(String mapName) { + if (MapSvgXMLHelper.getInstance().containsMapName(mapName)) { + MapSvgAttr editingMapAttr = MapSvgXMLHelper.getInstance().getMapAttr(mapName); + this.editName = mapName; + this.populateMapAttr(editingMapAttr); + } + } + + @Override + public String updateBean() { + // 固定存储 下 区域名 对应值 列表 MapHelper + updateMapAttr(); + MapSvgXMLHelper.getInstance().removeMapAttr(currentSvg.getName()); + MapSvgXMLHelper.getInstance().pushMapAttr(currentSvg.getName(),currentSvg); + return ""; + } + + private void updateMapAttr(){ + if(currentSvg != null){ + tableEditorModel.stopCellEditing(); + List list = tableEditorPane.update(); + for(int i = 0, size = list.size(); i < size; i++) { + Object[] tmp = (Object[]) list.get(i); + String name = Utils.objectToString(tmp[0]); + String nameTo = Utils.objectToString(tmp[1]); + currentSvg.setNameTo(name, nameTo); + } + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Define", "Area_Name"}); + } + + /** + * 更新界面 + * @param editingMapAttr 地图属性 + */ + public void populateMapAttr(MapSvgAttr editingMapAttr) { + List popuValues = new ArrayList(); + if(editingMapAttr == null) { + currentSvg = null; + tableEditorPane.populate(popuValues.toArray()); + return; + } + currentSvg =editingMapAttr; + List namesList = new ArrayList(); + Iterator shapeNames = editingMapAttr.shapeValuesIterator(); + while (shapeNames.hasNext()) { + namesList.add(shapeNames.next());// 先得到所有的处理名字, 然后再处理对应关系 + } + for (int i = 0; i < namesList.size(); i++) { + Object name = namesList.get(i); + Object value = editingMapAttr.getNameToValue(Utils.objectToString(name)); + popuValues.add(new Object[]{name, value}); + } + tableEditorPane.populate(popuValues.toArray()); + } + + /** + * 更新MapSvgAttr + * @return 返回属性 + */ + public MapSvgAttr updateCurrentAttr() { + updateMapAttr(); + return currentSvg; + } + + private class DefaultComboBoxEditor extends AbstractCellEditor implements TableCellEditor { + private ValueEditorPane cellEditor; + + public DefaultComboBoxEditor() { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ComboBoxUseEditor(initNames)}); + } + + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (column == 0) { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new TextEditor()}); + } else { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ComboBoxUseEditor(initNames)}); + } + cellEditor.populate(value == null ? "" : value); + return cellEditor; + } + + public Object getCellEditorValue() { + return cellEditor.update(); + } + } + + private class DefaultComboBoxRenderer extends DefaultTableCellRenderer { + private ValueEditorPane cellEditor; + + public DefaultComboBoxRenderer() { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ComboBoxUseEditor(initNames)}); + } + + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + if (column == 0) { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new TextEditor()}); + } else { + cellEditor = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ComboBoxUseEditor(initNames)}); + } + cellEditor.populate(value == null ? "" : value); + return cellEditor; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java new file mode 100644 index 000000000..f1f1b3deb --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java @@ -0,0 +1 @@ +package com.fr.design.chart.series.PlotSeries; import com.fr.base.*; import com.fr.chart.base.MapSvgAttr; import com.fr.chart.base.MapSvgXMLHelper; import com.fr.chart.chartattr.MapPlot; import com.fr.chart.chartglyph.MapShapeValue; import com.fr.design.constants.UIConstants; import com.fr.design.DesignerEnvManager; import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.SvgProvider; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.geom.RoundRectangle2D; import java.util.ArrayList; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 12-12-29 * Time: 下午2:41 */ public class MapGroupExtensionPane extends BasicPane implements UIObserver { private static final String[] TYPE_NAMES = new String[]{ Inter.getLocText("FR-Chart-World_Map"), Inter.getLocText("FR-Chart-State_Map"), Inter.getLocText("FR-Chart-Province_Map"), Inter.getLocText("FR-Chart-Custom_Map")}; private static final int WORD = 0; private static final int NATION = 1; private static final int STATE = 2; private static final int USER = 3; private static final int OFFSET_X = 800; private static final int OFFSET_Y = 200; private UIGroupExtensionPane groupExtensionPane; private UIButton addButton; private JPopupMenu popupMenu; private ArrayList changeListeners = new ArrayList(); private boolean hasPopulated = false; @Override protected String title4PopupWindow() { return "Map"; } public MapGroupExtensionPane() { setLayout(new BorderLayout()); groupExtensionPane = new UIGroupExtensionPane(TYPE_NAMES){ /** * 新添加的数据的序号 * @param data 数据 */ protected void dealNewAddedDataIndex(Object data){ String newName = (String)data; MapSvgXMLHelper helper = MapSvgXMLHelper.getInstance(); if(helper.getNewMapAttr(newName) != null){ return; } MapSvgAttr attr = new MapSvgAttr(); attr.setFilePath(MapSvgXMLHelper.customMapPath() + CoreConstants.SEPARATOR + newName + ".svg"); helper.addNewSvgMaps(attr.getName(), attr); } /** * 一次鼠标的点击会有两次事件响应(按下和释放)。前者的事件属性中getValueIsAdjusting()=true,后者是false。 * 是否响应list值改变 * @return 鼠标按下时不响应,先响应mousePress事件,在鼠标释放是再响应list值改编的事件,并且点击删除不触发更新,并且populate后触发更新 */ protected boolean isRespondToValueChange(ListSelectionEvent e){ return !e.getValueIsAdjusting() && !this.isPressOnDelete() && hasPopulated; } }; groupExtensionPane.addSelectionChangeListener(new ChangeListener() { @Override public void fireChanged(ChangeEvent event) { fireStateChange(); } }); groupExtensionPane.addItemEditListener(new ChangeListener() { @Override public void fireChanged(ChangeEvent event) { doEdit(event); } }); groupExtensionPane.addDeleteListener(new ChangeListener() { @Override public void fireChanged(ChangeEvent event) { //这么写有点问题 String oldName = Utils.objectToString(groupExtensionPane.getSelectedObject()); saveMapInfo(oldName); } }); setPreferredSize(new Dimension(400, 210)); add(groupExtensionPane, BorderLayout.CENTER); addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")) { @Override protected void paintBorder(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setStroke(UIConstants.BS); Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); g2d.setColor(UIConstants.LINE_COLOR); g2d.draw(shape); } }; addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { popupMenu.show(MapGroupExtensionPane.this, addButton.getX() + 1, addButton.getY() + addButton.getHeight()); } }); add(addButton, BorderLayout.SOUTH); initPopupMenu(); } private void initPopupMenu() { popupMenu = new JPopupMenu() { @Override public Dimension getPreferredSize() { Dimension dimension = new Dimension(); dimension.height = super.getPreferredSize().height; dimension.width = addButton.getWidth() - 2; return dimension; } }; JMenuItem worldMap = new JMenuItem(TYPE_NAMES[WORD]); popupMenu.add(worldMap); worldMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { groupExtensionPane.addData(TYPE_NAMES[WORD], TYPE_NAMES[WORD], true); } }); JMenuItem countMap = new JMenuItem(TYPE_NAMES[NATION]); popupMenu.add(countMap); countMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { groupExtensionPane.addData(TYPE_NAMES[NATION], TYPE_NAMES[NATION], true); } }); JMenuItem proMap = new JMenuItem(TYPE_NAMES[STATE]); popupMenu.add(proMap); proMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { groupExtensionPane.addData(TYPE_NAMES[STATE], TYPE_NAMES[STATE], true); } }); JMenuItem menu = new JMenuItem(TYPE_NAMES[USER]); popupMenu.add(menu); menu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { groupExtensionPane.addData(TYPE_NAMES[USER], TYPE_NAMES[USER], true); } }); } private void doEdit(ChangeEvent e) { MouseEvent event = (MouseEvent) e.getSource(); JPopupMenu editPopMenu = new JPopupMenu(); final String oldName = Utils.objectToString(groupExtensionPane.getSelectedObject()); editPopMenu.add(createAreaItem(oldName)); editPopMenu.add(createMarkerItem(oldName)); editPopMenu.add(createLayerItem(oldName)); editPopMenu.add(createRenameItem()); editPopMenu.show(MapGroupExtensionPane.this, event.getXOnScreen() - OFFSET_X, event.getYOnScreen() - OFFSET_Y); } private void mapCheckBeforeEdit(String name){ if(MapSvgXMLHelper.getInstance().containsMapName(name) || MapSvgXMLHelper.getInstance().getNewMapAttr(name)!=null){ return; } MapSvgAttr attr = new MapSvgAttr(); attr.setFilePath(MapSvgXMLHelper.customMapPath() + CoreConstants.SEPARATOR + name + ".svg"); MapSvgXMLHelper.getInstance().addNewSvgMaps(name,attr); } private JMenuItem createAreaItem(final String oldName) { JMenuItem editFileItem = new JMenuItem(Inter.getLocText(new String[]{"Edit", "Image", "Filed"})); editFileItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final MapCustomPane image = new MapCustomPane(); image.setImageSelectType(MapShapeValue.AREA); image.populateBean(oldName); image.setTypeNameAndMapName(groupExtensionPane.getSelectedType(), Utils.objectToString(groupExtensionPane.getSelectedObject())); mapCheckBeforeEdit(oldName); final Image oldImage = getMapImage(oldName); BasicDialog dialog = image.showMediumWindow(SwingUtilities.getWindowAncestor(MapGroupExtensionPane.this), new DialogActionAdapter() { public void doOk() { image.updateBean(); // 比较两个前后的名字是否相同, 是图片 如果图片不同, 则直接比较 Image newImage = getMapImage(oldName); if(!ComparatorUtils.equals(oldImage, newImage)) { fireStateChange(); } //versionID递增 MapSvgAttr old = MapSvgXMLHelper.getInstance().getMapAttr(oldName); if(old != null) { old.addVersionID(); } saveMapInfo(oldName); refresh(); } }); dialog.setVisible(true); } }); return editFileItem; } //根据地图的名字返回地图的图片 private Image getMapImage(String mapName) { if (MapSvgXMLHelper.getInstance().containsMapName(mapName)) { MapSvgAttr mapAttr = MapSvgXMLHelper.getInstance().getMapAttr(mapName); if(mapAttr == null) { return null; } return mapAttr.getMapImage(); } return null; } private JMenuItem createMarkerItem(final String oldName) { JMenuItem editMarkerItem = new JMenuItem(Inter.getLocText(new String[]{"Edit", "Image", "Marker"})); editMarkerItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final MapCustomPane image = new MapCustomPane(); image.setImageSelectType(MapShapeValue.POINT); image.populateBean(oldName); mapCheckBeforeEdit(oldName); final Image oldImage = getMapImage(oldName); BasicDialog dialog = image.showMediumWindow(SwingUtilities.getWindowAncestor(image), new DialogActionAdapter() { public void doOk() { image.updateBean(); Image newImage = getMapImage(oldName); if(!ComparatorUtils.equals(oldImage, newImage)) { fireStateChange(); } //versionID递增 MapSvgAttr old = MapSvgXMLHelper.getInstance().getMapAttr(oldName); if(old != null) { old.addVersionID(); } saveMapInfo(oldName); refresh(); } }); dialog.setVisible(true); } }); return editMarkerItem; } private JMenuItem createLayerItem(final String oldName) { JMenuItem corrItem = new JMenuItem(Inter.getLocText(new String[]{"Filed", "Corresponding_Fields"})); corrItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final MapDefiAreaNamePane namedPane = new MapDefiAreaNamePane(); namedPane.populateBean(oldName); mapCheckBeforeEdit(oldName); BasicDialog dialog = namedPane.showMediumWindow(SwingUtilities.getWindowAncestor(namedPane), new DialogActionAdapter() { public void doOk() { namedPane.updateBean();// 地图的名称 value对应情况 MapSvgAttr old = MapSvgXMLHelper.getInstance().getMapAttr(oldName); if(old != null) { old.addVersionID(); } saveMapInfo(oldName); } }); dialog.setVisible(true); refresh(); } }); return corrItem; } private void showRenameWaring(String newName){ JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), "\"" + newName + "\"" + Inter.getLocText("Utils-has_been_existed") + "!", Inter.getLocText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE); } private JMenuItem createRenameItem() { JMenuItem renameItem = new JMenuItem(Inter.getLocText("FR-Chart-Map_Rename")); renameItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newName = JOptionPane.showInputDialog(DesignerContext.getDesignerFrame().getContentPane(), Inter.getLocText("FR-Chart-Map_Rename"), groupExtensionPane.getSelectedObject()); if (StringUtils.isNotBlank(newName)) { String oldName = Utils.objectToString(groupExtensionPane.getSelectedObject()); if(ComparatorUtils.equals(oldName, newName)){ return; } //本地在看看临时的helper里面有没有 if(MapSvgXMLHelper.getInstance().getNewMapAttr(newName) != null){ showRenameWaring(newName); return; } try{//提醒名字已存在 if(FRContext.getCurrentEnv().fileExists(StableUtils.pathJoin( new String[]{MapSvgXMLHelper.relativeDefaultMapPath(),newName+SvgProvider.EXTENSION}))){ showRenameWaring(newName); return; } if(FRContext.getCurrentEnv().fileExists(StableUtils.pathJoin( new String[]{MapSvgXMLHelper.relativeCustomMapPath(), newName + SvgProvider.EXTENSION}))){ showRenameWaring(newName); return; } MapSvgAttr editingAttr = MapSvgXMLHelper.getInstance().getMapAttr(oldName); if(editingAttr == null){ editingAttr = MapSvgXMLHelper.getInstance().getNewMapAttr(oldName); } if( editingAttr == null) { return; } editingAttr.renameMap(newName); groupExtensionPane.setValueAtCurrentSelectIndex(newName); fireStateChange(); saveMapInfo(newName); FRContext.getCurrentEnv().deleteFile( StableUtils.pathJoin(new String[]{MapSvgXMLHelper.relativeDefaultMapPath(),oldName+SvgProvider.EXTENSION})); FRContext.getCurrentEnv().deleteFile( StableUtils.pathJoin(new String[]{MapSvgXMLHelper.relativeCustomMapPath(),oldName+SvgProvider.EXTENSION})); refresh(); }catch (Exception exp){ FRLogger.getLogger().error(exp.getMessage()); } } } }); return renameItem; } private void refresh() { this.validate(); this.repaint(); DesignerFrame frame = DesignerContext.getDesignerFrame(); if(frame != null) { frame.repaint();//kunsnat: 图表属性没变, 只是读取时 内容变化. } } //保存修改过的地图信息 private void saveMapInfo(final String mapName) { SwingWorker worker = new SwingWorker() { @Override protected Integer doInBackground() throws Exception { MapSvgAttr attr = MapSvgXMLHelper.getInstance().getMapAttr(mapName);// 只有在编辑地图时才需要储存相关数据 @kuns if(attr != null){ attr.writeBack(mapName); } return 0; } @Override protected void done() { FRLogger.getLogger().info(Inter.getLocText("FR-Chart-Map_Saved")); // 地图已经保存. } }; worker.execute(); DesignerEnvManager.addWorkers(worker); } private void fireStateChange() { for (int i = changeListeners.size(); i > 0; i--) { changeListeners.get(i - 1).stateChanged(new javax.swing.event.ChangeEvent(this)); } } /** * 更新地图属性 * @return 返回地图名称. */ public String updateBean(MapPlot plot) { if(!hasPopulated){ this.populateBean(plot); hasPopulated = true; } MapHelper helper = plot.isSvgMap() ? MapSvgXMLHelper.getInstance() : MapXMLHelper.getInstance(); helper.clearCateNames(); for (String type : TYPE_NAMES) { Object[] datas = groupExtensionPane.getData(type); for (Object name : datas) { helper.addCateNames(type, name); } } return Utils.objectToString(groupExtensionPane.getSelectedObject()); } /** * 更新地图名称 * @param mapPlot 地图 */ public void populateBean(MapPlot mapPlot) { hasPopulated = false; groupExtensionPane.clearData(); for (String type : TYPE_NAMES) { MapHelper helper = mapPlot.isSvgMap() ? MapSvgXMLHelper.getInstance() : MapXMLHelper.getInstance(); java.util.List list = helper.getNamesListWithCateName(type); for (Object name : list) { groupExtensionPane.addData(name, type); } } groupExtensionPane.setSelectedObject(mapPlot.getMapName()); hasPopulated = true; } /** * 给组件登记一个观察者监听事件 * * @param listener 观察者监听事件 */ public void registerChangeListener(final UIObserverListener listener) { changeListeners.add(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent e) { listener.doChange(); } }); } /** * 组件是否需要响应添加的观察者事件 * * @return 如果需要响应观察者事件则返回true,否则返回false */ public boolean shouldResponseChangeListener() { return true; } public void setEnabled(boolean isEnabled){ super.setEnabled(isEnabled); addButton.setEnabled(isEnabled); popupMenu.setEnabled(isEnabled); groupExtensionPane.setEnabled(isEnabled); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java new file mode 100644 index 000000000..6f9c15c55 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java @@ -0,0 +1,763 @@ +package com.fr.design.chart.series.PlotSeries; + +import java.awt.AlphaComposite; +import java.awt.BasicStroke; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.geom.GeneralPath; +import java.util.*; + +import javax.swing.BoxLayout; +import javax.swing.DefaultListModel; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +import com.fr.base.*; +import com.fr.chart.base.MapSvgAttr; +import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.chart.chartglyph.MapShapeValue; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.event.ChangeEvent; +import com.fr.design.event.ChangeListener; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itable.UISelectTable; +import com.fr.design.gui.itable.UITableNoOptionUI; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.UIDialog; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; +import com.fr.stable.CoreGraphHelper; +import com.fr.stable.StringUtils; +import com.fr.design.utils.gui.GUICoreUtils; + +/** + * 地图 图片编辑界面 选中图片 编辑. 支持鼠标选中等事件 + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-15 下午04:17:28 + */ +public class MapImageEditPane extends BasicBeanPane { + private static final long serialVersionUID = -5925535686784344616L; + private static final double ARCSIZE = 7; + private static final int LOCATIONOFFSET = 10; + private static final int NAME_EDIT_PANE_WIDTH = 130; + private static final int NAME_EDIT_PANE_HEIGHT = 225; + + private ImageEditPane imageEditPane; + private UISelectTable recordTable; + private int editType = 0;// 只标记mark或者标记出路径 + private List fromDataList = new ArrayList();// 编辑时从数据集中取出的使用字段. + + private HashMap> resultAreaShape = new HashMap>();// 名字 对应图形 // 已编辑区全都用指定颜色 + private String currentNodeName ; //当前选中的节点的名字 + private String typeName = ""; + private String mapName = ""; + + private String mouseSelectListName = ""; + private String editMapName = ""; + + public MapImageEditPane() { + initCom(); + } + + private void initCom() { + this.setLayout(new BorderLayout(0, 0)); + + imageEditPane = new ImageEditPane(); + this.add(imageEditPane, BorderLayout.CENTER); + + recordTable = new UISelectTable(1){ + public int columnAtPoint(Point point) { + //只有一列 + return 0; + } + }; + recordTable.addSelectionChangeListener(new ChangeListener() { + @Override + public void fireChanged(ChangeEvent event) { + mouseSelectListName = Utils.objectToString(event.getSource()); + + imageEditPane.repaint(); + MapImageEditPane.this.repaint(); + } + }); + + recordTable.setUI(new UITableNoOptionUI()); + + recordTable.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + List names = recordTable.updateBean();// 得到所有的List + + List test = new ArrayList(); + for (int i = 0; i < names.size(); i++) { + test.add(Utils.objectToString(recordTable.getValueAt(i, 0))); + } + + Iterator keys = resultAreaShape.keySet().iterator(); + while (keys.hasNext()) { + String key = keys.next(); + if (!test.contains(key)) { + keys.remove(); + } + } + recordTable.revalidate(); + repaint(); + } + }); + + UIScrollPane pane = new UIScrollPane(recordTable); + pane.setPreferredSize(new Dimension(150, 320)); + pane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"Filed", "WF-Name"}))); + + this.add(pane, BorderLayout.EAST); + } + + /** + * 设置编辑的类型: 区域 或者 点 + */ + public void setEditType(int editType) { + this.editType = editType; + } + + /** + * 返回编辑的类型: 区域 或者 点 + */ + public int getEditType() { + return editType; + } + + /** + * 设置正在编辑的svg文件 + */ + public void setSvgMap(String filePath){ + resultAreaShape.clear(); + mouseSelectListName = StringUtils.EMPTY; + recordTable.populateBean(new ArrayList()); + recordTable.revalidate(); + + imageEditPane.setSvgMap(filePath); + + repaint(); + } + + /** + * 清空图片内容 + */ + public void clearSvgMap(){ + resultAreaShape.clear(); + mouseSelectListName = StringUtils.EMPTY; + recordTable.populateBean(new ArrayList()); + recordTable.revalidate(); + + imageEditPane.clearSvgMap(); + + repaint(); + } + + /** + * 设置正在编辑的svg文件 + * @param attr 已经读取过的文件 + */ + public void setSvgMap(MapSvgAttr attr){ + resultAreaShape.clear(); + mouseSelectListName = StringUtils.EMPTY; + recordTable.populateBean(new ArrayList()); + recordTable.revalidate(); + + imageEditPane.setSvgMap(attr); + + repaint(); + } + + /** + * 刷新数据列表中的数据 + * @param list 列表 + */ + public void refreshFromDataList(List list) { + fromDataList.clear(); + + for (Object aList : list) { + fromDataList.add(Utils.objectToString(aList)); + } + } + + /** + * 当前正在编辑的条目的类别(国家,省市)名和地图名 + * @param typeName 类别名 + * @param mapName 地图名 + */ + public void setTypeNameAndMapName(String typeName, String mapName){ + this.typeName = typeName; + this.mapName = mapName; + } + + private class ImageEditPane extends JComponent implements MouseListener, MouseMotionListener { + + private MapSvgAttr currentSvgMap;//当前选中的svg地图 + private GeneralPath selectedShape; // 当前选中的Shape + private Image image = BaseUtils.readImage("");// 所选择的图片 + + //平移的位置 + private double moveLeft = 0; + private double moveTop = 0; + + //鼠标落点的位置 + private double mouseStartX; + private double mouseStartY; + + private boolean dragged = false; + + public ImageEditPane() { + this.addMouseListener(this); + this.addMouseMotionListener(this); + } + + public void paintComponent(Graphics g) {// 选中图片之后, 记录选中的区域, 点中的 标记点 + Rectangle bounds = this.getBounds(); + if (bounds == null || this.image == null) { + return; + } + + dealReady4Paint(g, bounds); + + int imageWidth = this.image.getWidth(new JPanel()); + int imageHeight = this.image.getHeight(new JPanel()); + + Graphics2D g2d = (Graphics2D) g; + if (this.image != null) {// 太小会放大, 太大, 则默认拖动 + g2d.drawImage(this.image, (int) moveLeft, (int) moveTop, imageWidth, imageHeight, new JPanel()); // 只是移动起始位置 + } + + g2d.translate(moveLeft, moveTop); + g2d.setStroke(new BasicStroke(1)); + if (resultAreaShape != null && !resultAreaShape.isEmpty()) { + for (String key : resultAreaShape.keySet()) { + + GeneralPath selectShape = getSelectedNodePath(key); + g2d.setColor(Color.green); + g2d.draw(selectShape); + } + } + + g2d.setColor(Color.blue); + if (StringUtils.isNotEmpty(mouseSelectListName) && resultAreaShape.containsKey(mouseSelectListName)) {// 当前悬浮选中的 list, 自己画的悬浮提示, 背景 边框, 文字 + GeneralPath highSelect = getSelectedNodePath(mouseSelectListName); + if (highSelect != null) { + g2d.fill(highSelect); + } + } else if (selectedShape != null) { + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); + g2d.fill(selectedShape); + } + + g2d.translate(-moveLeft, -moveTop); + } + + private void dealReady4Paint(Graphics g, Rectangle bounds) { + super.paintComponent(g); + + int x = (int) bounds.getX(); + int y = (int) bounds.getY(); + int width = (int) bounds.getWidth(); + int height = (int) bounds.getHeight(); + g.clipRect(x, y, width, height); + } + + + //初始化下图片的状态 + private void initImage() { + this.image = currentSvgMap.getMapImage(); + CoreGraphHelper.waitForImage(this.image); + + this.selectedShape = null; + this.moveLeft = 0; + this.moveTop = 0; + } + + /** + * 设置当前正在编辑的文件 + * @param filePath 文件路径 + */ + public void setSvgMap(String filePath){ + currentSvgMap = new MapSvgAttr(filePath); + currentSvgMap.setMapTypeAndName(typeName, mapName); + initImage(); + } + + /** + * 设置当前正在编辑的文件 + * @param attr 读取过的文件 + */ + public void setSvgMap(MapSvgAttr attr){ + currentSvgMap = attr; + + initImage(); + } + + public void clearSvgMap(){ + currentSvgMap = null; + this.image = BaseUtils.readImage("");; + this.selectedShape = null; + this.moveLeft = 0; + this.moveTop = 0; + this.dragged = false; + this.mouseStartX = 0; + this.mouseStartY = 0; + } + + + public Image getImage() { + return this.image; + } + + @Override + public void mouseClicked(MouseEvent e) { + drawSelectShape(e); + if (e.getClickCount() == 2) {// 2次编辑, 不然很容易错乱 和 update 错误 + showEditNamePane(e); + } + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void mousePressed(MouseEvent e) { + this.mouseStartX = e.getPoint().getX(); + this.mouseStartY = e.getPoint().getY(); + } + + @Override + public void mouseReleased(MouseEvent e) { + drawWhenDragEnd(e); + } + + public void mouseDragged(MouseEvent e) { + this.dragged = true; + } + + public void mouseMoved(MouseEvent e) { + + } + + private void drawWhenDragEnd(MouseEvent e) { + if (this.image == null || this.getBounds() == null) { + return; + } + + if (dragged) { + double endX = e.getPoint().getX(); + double endY = e.getPoint().getY(); + + int imageWidth = image.getWidth(new JPanel()); + int imageHeight = image.getHeight(new JPanel()); + + int paneWidth = (int) this.getBounds().getWidth(); + int paneHeight = (int) this.getBounds().getHeight(); + + if (imageWidth > paneWidth) { + double offX = endX - this.mouseStartX; + this.moveLeft += offX; + + this.moveLeft = Math.max(this.moveLeft, paneWidth - imageWidth); + this.moveLeft = Math.min(0, this.moveLeft); + } else { + this.moveLeft = 0; + } + + if (imageHeight > paneHeight) { + double offY = endY - this.mouseStartY; + this.moveTop += offY; + + this.moveTop = Math.max(this.moveTop, paneHeight - imageHeight); + this.moveTop = Math.min(0, this.moveTop); + } else { + this.moveTop = 0; + } + this.repaint(); + } + + this.dragged = false; + } + + //画鼠标点击的区域 + private void drawSelectShape(MouseEvent e) { + selectedShape = null; + mouseSelectListName = StringUtils.EMPTY; + if (this.image == null) { + return; + } + + Point ePoint = e.getPoint(); + Point select = new Point((int) (ePoint.getX() - moveLeft), (int) (ePoint.getY() - moveTop));// 支持ctrl 选定时的多选.. 只是记录多个鼠标位置 然后shape合并 + boolean gotSelectedShape = false; + for (String key : resultAreaShape.keySet()) { + GeneralPath mapSelect = getSelectedNodePath(key); + if (mapSelect.contains(select)) { + selectedShape = mapSelect; + currentNodeName = currentSvgMap.getSelectedPathName(select); + gotSelectedShape = true; + break; + } + } + + if (!gotSelectedShape) {// 根据坐标重新在图片中选取Shape + + if (getEditType() == MapShapeValue.AREA) { + selectedShape = currentSvgMap.getSelectPath(select); + currentNodeName = currentSvgMap.getSelectedPathName(select); + } else { + //标记点类型的要不要待定 + + } + } + this.repaint(); + } + + private void showEditNamePane(MouseEvent e) { + if (this.image == null || selectedShape == null) { + return; + } + final EditNamePane namePane = new EditNamePane(); + Point ePoint = e.getPoint(); + final Point select = new Point((int) (ePoint.getX() - moveLeft), (int) (ePoint.getY() - moveTop)); + namePane.setEditViewRow(getEditViewRow(select)); + String isSelectName = StringUtils.EMPTY; + for (String name : resultAreaShape.keySet()) { + GeneralPath shape = getSelectedNodePath(name); + if (shape.contains(select)) { + isSelectName = name; + break; + } + } + namePane.populateBean(isSelectName); + namePane.resetPaneWithNewNameList(fromDataList); + UIDialog bg = namePane.showUnsizedWindow(SwingUtilities.getWindowAncestor(ImageEditPane.this), new DialogActionAdapter() { + public void doOk() { + namePane.changeList(); + String endName = namePane.updateBean(); + if (resultAreaShape.containsKey(endName)) { + if(ComparatorUtils.equals(endName,namePane.startName)) { + return; + } + ArrayList pathID = resultAreaShape.get(endName); + if(!pathID.contains(currentNodeName)){ + pathID.add(currentNodeName); + } + }else{ + ArrayList paths = new ArrayList(); + resultAreaShape.put(endName,paths); + paths.add(currentNodeName); + ArrayList exists = resultAreaShape.get(namePane.startName); + if(exists!= null){ + for(String id:exists){ + paths.add(id); + } + resultAreaShape.remove(namePane.startName); + } + } + } + }); + bg.setSize(NAME_EDIT_PANE_WIDTH, NAME_EDIT_PANE_HEIGHT); + bg.setLocation((int) (e.getLocationOnScreen().getX()) + LOCATIONOFFSET, (int) e.getLocationOnScreen().getY()); + bg.setTitle(Inter.getLocText(new String[]{"Edit", "Filed", "WF-Name"})); + bg.setVisible(true); + } + + // viewList 根据内容名称 得到是哪一行. + public int getEditViewRow(Point point) { + int rowIndex = recordTable.getRowCount();// 最差 没有找到应该也是返回 row + 1 + + // 根据编辑的位置, 是否有shape对应, 有则找出, 没有则是新的行 + String isSelectName = StringUtils.EMPTY; + for (String name : resultAreaShape.keySet()) { + GeneralPath shape = getSelectedNodePath(name); + if (shape.contains(point)) { + isSelectName = name; + break; + } + } + + if (resultAreaShape.containsKey(isSelectName)) { + for (int i = 0; i < recordTable.getRowCount(); i++) { + String tmp = (String) recordTable.getValueAt(i, 0); + if (ComparatorUtils.equals(isSelectName, tmp)) { + rowIndex = i; + break; + } + } + }// 没有则添加一行 + + return rowIndex; + } + } + + // 图片界面 悬浮点击弹出的名称列表 + private class EditNamePane extends BasicBeanPane {// 点击编辑名称 + + private UITextField nameText; // 文本框 + private JList dataList; + private String startName; + + private JList hasNamedList; + + private int editViewRow = -1;// 所对应的view的index行 , 确定当前正在编辑的viewList的行, 然后改变值 + + private UILabel namedLabel = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Pre_Defined") + "------"); + private JPanel listPane = new JPanel(); + + public EditNamePane() { + initCom(); + } + + public void setEditViewRow(int index) { + this.editViewRow = index; + } + + private void initCom() { + this.setLayout(new BorderLayout(0, 0)); + + nameText = new UITextField(); + nameText.setPreferredSize(new Dimension(100, 20)); + + this.add(nameText, BorderLayout.NORTH); + + listPane.setLayout(new BoxLayout(listPane, BoxLayout.Y_AXIS)); + this.add(listPane, BorderLayout.CENTER); + + listPane.add(new UIScrollPane(dataList = new JList(new DefaultListModel()))); + dataList.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() >= 2 && dataList.getSelectedValue() != null) { + String value = Utils.objectToString(dataList.getSelectedValue()); + nameText.setText(value);// 直接对文本值改变, 让文本去触发事件 + } + } + }); + + listPane.add(namedLabel); + listPane.add(new UIScrollPane(hasNamedList = new JList(new DefaultListModel()))); + + hasNamedList.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() >= 2 && hasNamedList.getSelectedValue() != null) { + nameText.setText(Utils.objectToString(hasNamedList.getSelectedValue())); + } + } + }); + } + + private void relayoutList() { + listPane.removeAll(); + + listPane.setLayout(new BoxLayout(listPane, BoxLayout.Y_AXIS)); + listPane.add(new UIScrollPane(dataList)); + + if (hasNamedList.getModel().getSize() > 0) { + listPane.add(namedLabel); + listPane.add(new UIScrollPane(hasNamedList)); + } + } + + + //列表改变,选中的时候添加shape信息 + private void changeList() { + String textValue = nameText.getText(); + if (editViewRow >= recordTable.getRowCount()) {// 添加一行 确定的行数 即时大于viewCount + recordTable.addLine(new String[]{textValue}); + } else if (editViewRow > -1) { + recordTable.setValueAt(textValue, editViewRow, 0); + } + recordTable.revalidate(); + recordTable.repaint(); + + resetPaneWithNewNameList(fromDataList); + } + + public void resetPaneWithNewNameList(List list) {// 界面不变, 只是刷新重置list + DefaultListModel model = (DefaultListModel) dataList.getModel(); + model.removeAllElements(); + + DefaultListModel hasNameModel = (DefaultListModel) hasNamedList.getModel(); + hasNameModel.removeAllElements(); + + for (int i = 0; list != null && i < list.size(); i++) { + String value = list.get(i); + if (!resultAreaShape.containsKey(value)) { + model.addElement(value); + } + } + + for (String name : resultAreaShape.keySet()) { + if (!hasNameModel.contains(name)) { + hasNameModel.addElement(name); + } + } + + relayoutList(); + } + + public void populateBean(String list) { + nameText.setText(list); + startName = list; + nameText.setCaretPosition(list == null ? 0 : list.length()); + } + + @Override + public String updateBean() { + return nameText.getText(); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Edit", "Image"}); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Edit", "Image"}); + } + + /** + * 更新地图 名称列表以及正在编辑的图片 + */ + public void populateBean(String ob) {// 确定要编辑的地图名称 + this.editMapName = ob;// 当前编辑的地图名称 + MapSvgXMLHelper mapHelper = MapSvgXMLHelper.getInstance(); + if (mapHelper.containsMapName(editMapName)) { + MapSvgAttr svgAttr = mapHelper.getMapAttr(editMapName); + populateMapSvgAttr(svgAttr); + }else if(mapHelper.getNewMapAttr(editMapName) != null ){ + clearSvgMap(); + imageEditPane.currentSvgMap = mapHelper.getMapAttr(editMapName); + }else { + clearSvgMap(); + } + } + + /** + * 保存编辑的地图 形状等信息. + */ + public String updateBean() { + if(imageEditPane.currentSvgMap !=null){ + this.editMapName = imageEditPane.currentSvgMap.getName(); + } + // 将地图加入helper 固定存储 记录固定的hShape 原图片的坐标位置, 然后在根据现在现实的 实际坐标 展示 + if (StringUtils.isNotEmpty(editMapName) && this.imageEditPane.getImage() != null) { + MapSvgXMLHelper mapHelper = MapSvgXMLHelper.getInstance(); + MapSvgAttr mapAttr = imageEditPane.currentSvgMap; + if(mapHelper.getNewMapAttr(editMapName)!=null){ + mapHelper.removeNewMapAttr(editMapName); + mapHelper.pushMapAttr(editMapName,mapAttr); + } + if(mapHelper.containsMapName(editMapName)){ + //处理下mapAttr存节点name属性 + updateMapShapePath(mapAttr); + mapHelper.addCustomSvgMap(editMapName, mapAttr); + + //设置以后要写回 + mapAttr.writeBack(editMapName); + } + } + + return editMapName; + } + + /** + * 更新界面 + * @param svgAttr 地图属性 + * */ + public void populateMapSvgAttr(MapSvgAttr svgAttr){ + if(svgAttr == null || svgAttr.getMapImage() == null){ + clearSvgMap(); + return; + } + setSvgMap(svgAttr); + Iterator names = svgAttr.shapeValuesIterator(); + while (names.hasNext()) { + String name = Utils.objectToString(names.next()); + ArrayList pathIDs= svgAttr.getExistedShapePathID(name); + if (name != null) { + resultAreaShape.put(name,pathIDs); + recordTable.addLine(new String[]{name}); + } + } + recordTable.revalidate(); + } + + /** + * 更新MapSvgAttr + * @return 返回属性 + * */ + public MapSvgAttr updateWithOutSave(){ + if(imageEditPane.currentSvgMap !=null){ + this.editMapName = imageEditPane.currentSvgMap.getName(); + } + // 将地图加入helper 固定存储 记录固定的hShape 原图片的坐标位置, 然后在根据现在现实的 实际坐标 展示 + if (StringUtils.isNotEmpty(editMapName) && this.imageEditPane.getImage() != null) { + MapSvgXMLHelper mapHelper = MapSvgXMLHelper.getInstance(); + MapSvgAttr mapAttr = imageEditPane.currentSvgMap; + if(mapHelper.getNewMapAttr(editMapName)!=null){ + mapHelper.removeNewMapAttr(editMapName); + mapHelper.pushMapAttr(editMapName,mapAttr); + } + if(mapHelper.containsMapName(editMapName)){ + //处理下mapAttr存节点name属性 + updateMapShapePath(mapAttr); + mapHelper.addCustomSvgMap(editMapName, mapAttr); + } + return mapAttr; + } + return null; + } + + private void updateMapShapePath(MapSvgAttr mapSvgAttr){ + mapSvgAttr.clearExistShape(); + for(String key : resultAreaShape.keySet()){ + ArrayList nodeName = resultAreaShape.get(key); + if(nodeName == null){ + continue; + } + for(String node :nodeName){ + mapSvgAttr.setNodeName(node, key); + } + } + } + + private GeneralPath getSelectedNodePath(String nodeName){ + if(imageEditPane.currentSvgMap == null){ + return new GeneralPath(); + } + MapSvgAttr attr = imageEditPane.currentSvgMap; + ArrayList pathsID = resultAreaShape.get(nodeName); + GeneralPath unionPath =new GeneralPath(); + //这边必须在新建的一个path上append,不然直接在存的path上append,不然后面删除组合了,也不能正常的选单个 + for(String id :pathsID){ + unionPath.append(attr.getPath4PathID(id),false); + + } + return unionPath; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapSelectShape.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapSelectShape.java new file mode 100644 index 000000000..c27af5c23 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapSelectShape.java @@ -0,0 +1,86 @@ +package com.fr.design.chart.series.PlotSeries; + +import java.awt.Point; +import java.awt.Shape; +import java.util.ArrayList; +import java.util.List; + +/** + * 地图选中的shape, 封装选中的点, GeneralPath 做处理 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-11-12 下午05:00:34 + */ +public class MapSelectShape { + + private List selectPoint = new ArrayList(); + private List selectShape = new ArrayList(); + + private int selectType; + + public MapSelectShape(Shape[] shape, Point[] point, int selectType) { + + for(int i = 0; i < shape.length; i++) { + this.selectShape.add(shape[i]); + } + for(int i = 0; i < point.length; i++) { + this.selectPoint.add(point[i]); + } + this.selectType = selectType; + } + + /** + * 判断多个区域中 是否包含Point + */ + public boolean containsPoint(Point point) { + boolean contains = false; + for(int i = 0; selectShape != null && i < selectShape.size(); i++) { + Shape shape = (Shape)selectShape.get(i); + contains = shape.contains(point); + if(contains) { + break; + } + } + + return contains; + } + + /** + * 添加对应的选中点和选中的区域 + */ + public void addSelectValue(Point point, Shape shape) { + if(!selectShape.contains(shape)) { + this.selectShape.add(shape); + } + if(!this.selectPoint.contains(point)) { + this.selectPoint.add(point); + } + } + + /** + * 返回选中的点 数组 + */ + public Point[] getSelectPoints() { + return (Point[])this.selectPoint.toArray(new Point[selectPoint.size()]); + } + + /** + * 返回选中的区域 数组 + */ + public Shape[] getSelectShapes() { + return (Shape[])this.selectShape.toArray(new Shape[selectShape.size()]); + } + + /** + * 设置选中的类型: 区域 或者点 + */ + public void setSelectType(int selectType) { + this.selectType = selectType; + } + + /** + * 返回选中的类型: 区域 或者点 + */ + public int getSelectType() { + return selectType; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java new file mode 100644 index 000000000..2ad670341 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java @@ -0,0 +1 @@ +package com.fr.design.chart.series.PlotSeries; import com.fr.chart.base.MapSvgXMLHelper; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.gui.frpane.UIExtensionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UISearchTextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import javax.swing.*; import javax.swing.border.Border; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; import java.util.List; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 12-12-29 * Time: 上午11:14 * 可收缩的面板,只有两层 */ public class UIGroupExtensionPane extends BasicPane { public static final String EDIT = "edit"; public static final String DELETE = "delete"; private static final int BUTTONWIDTH = 16; private static final int DIALOG_WIDTH = 140; private static final int DIALOG_HEIGHT = 100; private UISearchTextField searchTextFiled; private JList[] contentViews; private Component[][] components; private String[] titles; private java.util.List selectionListeners = new ArrayList(); private java.util.List editListeners = new ArrayList(); private List deleteListeners = new ArrayList(); private boolean isPressOnDelete = false; // 是否点击在删除按钮上 @Override protected String title4PopupWindow() { return "group"; } public UIGroupExtensionPane(String[] titles) { this.titles = titles; if (ArrayUtils.isEmpty(titles)) { return; } initComponents(titles); } private void initComponents(String[] titles) { setBackground(null); searchTextFiled = initSearchTextField(); int count = titles.length; contentViews = new JList[count]; components = new Component[count + 1][]; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] rowSize = new double[count + 1]; double[] columnSize = {f}; for (int i = 0; i < count + 1; i++) { rowSize[i] = p; if (i == 0) { components[i] = new Component[]{searchTextFiled}; } else if (i > 0 && i < count + 1) { JList li = new JList(new DefaultListModel()); li.addListSelectionListener(listSelectionListener); li.addMouseListener(mouseListener); li.setCellRenderer(listCellRenderer); li.setBackground(null); contentViews[i - 1] = li; components[i] = new UIExtensionPane[]{new UIExtensionPane(titles[i - 1], li, false)}; } } JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); setLayout(new BorderLayout()); add(new UIScrollPane(centerPane), BorderLayout.CENTER); } private UISearchTextField initSearchTextField() { UISearchTextField searchTextFiled = new UISearchTextField() { public Dimension getPreferredSize() { return new Dimension(120, 22); } }; searchTextFiled.setIconPosition(SwingConstants.RIGHT); searchTextFiled.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { doFilter(); } @Override public void removeUpdate(DocumentEvent e) { doFilter(); } @Override public void changedUpdate(DocumentEvent e) { doFilter(); } }); return searchTextFiled; } /** * 返回index列表的数据 */ public Object[] getData(int index) { if (index < 0 || index > contentViews.length) { return ArrayUtils.EMPTY_OBJECT_ARRAY; } ListModel model = contentViews[index].getModel(); Object[] items = new Object[model.getSize()]; for (int i = 0, len = model.getSize(); i < len; i++) { items[i] = model.getElementAt(i); } return items; } /** * 返回对应Title的列表数组 */ public Object[] getData(String title) { int dataIndex = ArrayUtils.indexOf(titles, title); if (dataIndex != ArrayUtils.INDEX_NOT_FOUND) { return getData(dataIndex); } return ArrayUtils.EMPTY_OBJECT_ARRAY; } private void doFilter() { for (JList list : contentViews) { ListDataListener[] ls = ((DefaultListModel) list.getModel()).getListDataListeners(); for (ListDataListener l : ls) { l.contentsChanged(new ListDataEvent(l, ListDataEvent.CONTENTS_CHANGED, 0, list.getModel().getSize())); } } for (int i = 1, len = components.length; i < len; i++) { ((UIExtensionPane) components[i][0]).setExpand(true); } } /** * 获取选中的值 * * @return 选中的值 */ public Object getSelectedObject() { for (JList list : contentViews) { if (list.getSelectedValue() != null) { return list.getSelectedValue(); } } return null; } /** * 返回选中的类别 * @return 类别 */ public String getSelectedType(){ for (int i = 0, len = contentViews.length; i < len; i++) { if(contentViews[i].getSelectedValue() != null){ return titles[i]; } } return ""; } /** * 设置选中的数据 */ public void setSelectedObject(Object value) { for (int i = 0, len = contentViews.length; i < len; i++) { UIExtensionPane extensionPane = (UIExtensionPane) components[i + 1][0]; JList list = contentViews[i]; DefaultListModel model = (DefaultListModel) list.getModel(); extensionPane.setExpand(model.contains(value)); if (model.contains(value)) { list.setSelectedValue(value, true); } } } /** * 设置数据选中的序号. */ public void setValueAtCurrentSelectIndex(Object value) { for (JList list : contentViews) { if (list.getSelectedIndex() != -1) { ((DefaultListModel) list.getModel()).setElementAt(value, list.getSelectedIndex()); } } } /** * 根据索引来添加数据 * * @param data 要添加的数据 * @param index 要添加的数据向的索引 */ public void addData(Object data, int index) { addData(data, index, false); } /** * 根据索引来添加数据 * * @param data 要添加的数据 * @param index 要添加的数据向的索引 * @param checkRepeat 是否检查名字重复 */ public void addData(Object data, int index, boolean checkRepeat) { if (contentViews == null || index < 0 || index > contentViews.length - 1) { return; } JList list = contentViews[index]; DefaultListModel model = (DefaultListModel) list.getModel(); if (data instanceof String) { model.addElement(createUnrepeatedName(model, (String) data, checkRepeat)); } if (checkRepeat) { // 将添加类型以外的其他类型都收起来 for (int i = 1, len = components.length; i < len; i++) { ((UIExtensionPane) components[i][0]).setExpand(false); } ((UIExtensionPane) components[index + 1][0]).setExpand(true); int selectedIndex = list.getModel().getSize() - 1; list.setSelectedIndex(selectedIndex); dealNewAddedDataIndex(((DefaultListModel) list.getModel()).elementAt(selectedIndex)); } } /** * 新添加的数据的序号 * @param data 数据 */ protected void dealNewAddedDataIndex(Object data){ } /** * 根据标题来添加数据 * * @param data 要添加的数据 * @param title 要添加数据的项的标题文字 */ public void addData(Object data, String title) { addData(data, title, false); } /** * 根据标题来添加数据 * * @param data 要添加的数据 * @param title 要添加数据的项的标题文字 * @param checkRepeat 是否检查名字重复 */ public void addData(Object data, String title, boolean checkRepeat) { int addIndex = ArrayUtils.indexOf(titles, title); if (addIndex != ArrayUtils.INDEX_NOT_FOUND) { addData(data, addIndex, checkRepeat); } } /** * 清除所有的数据 */ public void clearData() { for (JList list : contentViews) { ((DefaultListModel) list.getModel()).clear(); } } private String createUnrepeatedName(DefaultListModel model, String name, boolean checkRepeat) { if (!checkRepeat) { return name; } int count = model.getSize(); int extra = 1; String newName = name + (count + extra); boolean hasRepeated = false; do { hasRepeated = false; newName = name + (count + extra); for (int i = 0; i < count; i++) { if (ComparatorUtils.equals(model.getElementAt(i), newName)) { hasRepeated = true; extra++; } } } while (hasRepeated); return name + (count + extra); } /** * 判断该控件是否应该有编辑操作 * * @param list 列表组件 * @return 如果有编辑操作则需要显示相应的图标 */ private boolean hasEditOperation(JList list) { return true; } private DefaultListCellRenderer listCellRenderer = new DefaultListCellRenderer() { public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JComponent c = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (!hasEditOperation(list)) { return c; } Border border = null; c.setBorder(border); UILabel editLabel = new UILabel(UIConstants.EDIT_ICON); UILabel deleteLabel = new UILabel(UIConstants.DELETE_ICON); JPanel editPane = GUICoreUtils.createFlowPane(new Component[]{editLabel, deleteLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE); editPane.setBackground(isSelected ? c.getBackground() : null); editPane.setBorder(border); JPanel renderPane = GUICoreUtils.createBorderLayoutPane(c, BorderLayout.CENTER, editPane, BorderLayout.EAST); if (shouldFilter(value)) { renderPane.setPreferredSize(new Dimension(0, 0)); } return renderPane; } }; //事件发生的顺序是ListSelection、MousePressed、ListSelection、MouseReleased private ListSelectionListener listSelectionListener = new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { //在鼠标按下的时候的值改变事件,重置属性 if(e.getValueIsAdjusting()){ isPressOnDelete = false; } if(!isRespondToValueChange(e)){ return; } fireSelectionChangeListener(new ChangeEvent(e.getSource())); if (((JList) e.getSource()).getSelectedIndex() == -1) { return; } for (JList list : contentViews) { if (list.getSelectedIndex() != -1 && !ComparatorUtils.equals(list, e.getSource())) { try { list.setSelectedIndices(null); } catch (Exception ee) { } } } } }; /** * 是否响应list值改变 * @return 响应 */ protected boolean isRespondToValueChange(ListSelectionEvent e){ return true; } private boolean shouldFilter(Object value) { return !GeneralUtils.objectToString(value).toLowerCase().contains(searchTextFiled.getText().toLowerCase()); } private MouseListener mouseListener = new MouseAdapter() { /** * {@inheritDoc} */ @Override public void mousePressed(final MouseEvent e) { isPressOnDelete = false; final JList list = (JList) e.getSource(); Point point = e.getPoint(); final int index = list.locationToIndex(point); int width = list.getWidth(); if (hasEditOperation(list)) { // 删除按钮 if (point.x > width - (BUTTONWIDTH + LayoutConstants.HGAP_LARGE)) { BasicPane bp = new BasicPane() { protected String title4PopupWindow() { return ""; } }; isPressOnDelete = true; bp.setLayout(new BorderLayout()); bp.add(new BoldFontTextLabel(Inter.getLocText(new String[]{"Delete", "Chart-Map"}) + "?", SwingConstants.CENTER)); clearLastListSelection(list); final String selectedType = UIGroupExtensionPane.this.getSelectedType(); UIDialog dialog = bp.showUnsizedWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { public void doOk() { Object name = getSelectedObject(); ((DefaultListModel) list.getModel()).removeElementAt(index); MapSvgXMLHelper.getInstance().removeMapAttr(GeneralUtils.objectToString(name)); MapSvgXMLHelper.getInstance().removeCateNames(selectedType,GeneralUtils.objectToString(name)); fireDeleteListener(new ChangeEvent(e)); } }); dialog.setResizable(true); dialog.setSize(DIALOG_WIDTH, DIALOG_HEIGHT); dialog.setResizable(false); GUICoreUtils.centerWindow(dialog); dialog.setVisible(true); } // 编辑按钮 else if (point.x > width - (BUTTONWIDTH * 2 + 2 * LayoutConstants.HGAP_LARGE) && point.x < width - (BUTTONWIDTH + LayoutConstants.HGAP_LARGE)) { fireItemEditListener(new ChangeEvent(e)); } } } public void mouseReleased(MouseEvent e) { isPressOnDelete = false; } }; /** * 直接跨list点击删除按钮,要置之前list的选中项为空(因为删除操作不触发更新) * @param currentList 当前选中的list */ public void clearLastListSelection (JList currentList) { for (JList list : contentViews) { if (list.getSelectedIndex() != -1 && !ComparatorUtils.equals(list, currentList)) { try { list.setSelectedIndices(null); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); } } } } /** * 是否点击在删除按钮上 * @return 是则返回true */ public boolean isPressOnDelete(){ return isPressOnDelete; } /** * 添加选中变化监听事件 * @param listener 监听 */ public void addSelectionChangeListener(ChangeListener listener) { selectionListeners.add(listener); } private void fireSelectionChangeListener(ChangeEvent e) { for (int i = selectionListeners.size(); i > 0; i--) { selectionListeners.get(i - 1).fireChanged(e); } } /** * 添加Item的监听事件 * @param listener 监听器 */ public void addItemEditListener(ChangeListener listener) { editListeners.add(listener); } private void fireItemEditListener(ChangeEvent e) { for (int i = editListeners.size(); i > 0; i--) { editListeners.get(i - 1).fireChanged(e); } } /** * 添加删除事件的监听事件 * @param listener 监听 */ public void addDeleteListener(ChangeListener listener) { deleteListeners.add(listener); } private void fireDeleteListener(ChangeEvent e) { for(int i = deleteListeners.size(); i > 0; i--) { deleteListeners.get(i - 1).fireChanged(e); } } public void setEnabled(boolean isEnabled){ super.setEnabled(isEnabled); if(searchTextFiled != null){ searchTextFiled.setEnabled(isEnabled); } if(this.components != null){ for(int i = 0; i < this.components.length; i++){ Component[] comp = this.components[i]; for(int j = 0; j < comp.length; j++){ comp[j].setEnabled(isEnabled); } } } } /** * 测试程序 * @param args 参数 */ public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = f.getContentPane(); c.setBackground(Color.WHITE); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); final UIGroupExtensionPane g = new UIGroupExtensionPane(new String[]{"title1", "title2", "title3"}); c.add(g, BorderLayout.CENTER); JPanel pp = new JPanel(new FlowLayout()); c.add(pp, BorderLayout.SOUTH); UIButton test = new UIButton("add1"); test.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { g.addData("test111", 0); } }); pp.add(test); UIButton test2 = new UIButton("add2"); test2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { g.addData("test222", 1); } }); pp.add(test2); f.setSize(360, 500); f.setLocation(200, 100); f.setVisible(true); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/PlotStyle/ChartSelectDemoPane.java b/designer_chart/src/com/fr/design/chart/series/PlotStyle/ChartSelectDemoPane.java new file mode 100644 index 000000000..37d0758fc --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/PlotStyle/ChartSelectDemoPane.java @@ -0,0 +1,173 @@ +package com.fr.design.chart.series.PlotStyle; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.ArrayList; + +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.dialog.BasicPane; +import com.fr.stable.ArrayUtils; + +/** + * 图表选中demo的类. 用于 选中点击, 悬浮状态, 可以继承, 改变画的内容. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2011-10-27 下午03:50:28 + */ +public class ChartSelectDemoPane extends BasicPane implements UIObserver, MouseListener { + private static final long serialVersionUID = 7715973616632567352L; + + public boolean isPressing; + + // 所有统一参与的点击状态类. 相当于Group + protected ChartSelectDemoPane[] demoList = new ChartSelectDemoPane[0]; + + private boolean isRollOver; + private ArrayList changeListeners = new ArrayList(); + + public void setDemoGroup(ChartSelectDemoPane[] demos) { + this.demoList = demos; + } + + @Override + protected String title4PopupWindow() { + return ""; + } + + /** + * 鼠标点击 + * @param e 事件 + */ + public void mouseClicked(MouseEvent e) { + // list中的所有的都弄成非选中状态. + if(this.isEnabled()){ + for (int i = 0; i < ArrayUtils.getLength(demoList); i++) { + demoList[i].isRollOver = false; + demoList[i].isPressing = false; + } + + this.isPressing = true; + + fireStateChange(); + + for (int i = 0; i < ArrayUtils.getLength(demoList); i++) { + demoList[i].checkBackground(); + demoList[i].repaint(); + } + } + } + + /** + * 注册监听 + * @param l 监听 + */ + public void addChangeListener(ChangeListener l) { + changeListeners.add(l); + } + + private void fireStateChange() { + for (int i = 0; i < changeListeners.size(); i++) { + changeListeners.get(i).stateChanged(new ChangeEvent(this)); + } + } + + /** + * 鼠标按压 + * @param me 事件 + */ + public void mousePressed(MouseEvent me) { + } + + /** + * 鼠标放开 + * @param me 事件 + */ + public void mouseReleased(MouseEvent me) { + } + + /** + * 鼠标进入 + * @param me 事件 + */ + public void mouseEntered(MouseEvent me) { + if(this.isEnabled()){ + for (int i = 0; i < ArrayUtils.getLength(demoList); i++) { + demoList[i].isRollOver = false; + } + isRollOver = true; + + for (int i = 0; i < ArrayUtils.getLength(demoList); i++) { + demoList[i].checkBackground(); + demoList[i].repaint(); + } + } + } + + /** + * 鼠标移出 + * @param me 事件 + */ + public void mouseExited(MouseEvent me) { + // 限制在pane范围内! + if(this.isEnabled()){ + int x = me.getX(); + int y = me.getY(); + + Dimension d = this.getPreferredSize(); + if (inDimension(d, x, y)) { + isRollOver = true; + } else { + isRollOver = false; + } + + for (int i = 0; i < ArrayUtils.getLength(demoList); i++) { + demoList[i].checkBackground(); + demoList[i].repaint(); + } + } + } + + private boolean inDimension(Dimension d, int x, int y) { + return x < d.getWidth() && y < d.getHeight() && x > 0 && y > 0; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(final UIObserverListener listener) { + changeListeners.add(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + listener.doChange(); + } + }); + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + /** + * 修改背景颜色 + */ + public void checkBackground() { + if (!isRollOver && !isPressing) { + this.setBackground(null); + } else if(isRollOver && !isPressing){ + this.setBackground(new Color(182, 217, 253)); + } else { + this.setBackground(new Color(164, 192, 220)); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/BubblePlotChartConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/BubblePlotChartConditionPane.java new file mode 100644 index 000000000..06dc7f9d2 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/BubblePlotChartConditionPane.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.ChartConstants; + +/** + * 气泡图 条件显示 参数 控制界面. + * Created by kunsnat on 14-3-11. + * kunsnat@gmail.com + */ +public class BubblePlotChartConditionPane extends ChartConditionPane{ + + /** + * 界面条件序号 列表 + * @return 返回条件列表. + */ + public String[] columns2Populate() { + return new String[]{ + ChartConstants.SERIES_INDEX, + ChartConstants.SERIES_NAME, + ChartConstants.VALUE + }; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/ChartConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/ChartConditionPane.java new file mode 100644 index 000000000..5857249a8 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/ChartConditionPane.java @@ -0,0 +1,25 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.condition.DSColumnLiteConditionPane; + +public class ChartConditionPane extends DSColumnLiteConditionPane { + + public ChartConditionPane() { + super(); + conditonTypePane.setVisible(false); + + populateColumns(columns2Populate()); + } + + public String[] columns2Populate() { + return new String[]{ + ChartConstants.CATEGORY_INDEX, + ChartConstants.CATEGORY_NAME, + ChartConstants.SERIES_INDEX, + ChartConstants.SERIES_NAME, + ChartConstants.VALUE + }; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/ChartConditionPaneFactory.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/ChartConditionPaneFactory.java new file mode 100644 index 000000000..b7fa70461 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/ChartConditionPaneFactory.java @@ -0,0 +1,46 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.design.chart.series.SeriesCondition.impl.*; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : ����3:16 + */ +public class ChartConditionPaneFactory { + private static Map> map = new HashMap>(); + + static { + map.put(GanttPlotDataSeriesConditionPane.class.getName(), GanttPlotChartConditionPane.class); + map.put(MapPlotDataSeriesConditionPane.class.getName(), MapPlotChartConditionPane.class); + map.put(PiePlotDataSeriesConditionPane.class.getName(), PiePlotChartConditionPane.class); + map.put(Pie3DPlotDataSeriesConditionPane.class.getName(),PiePlotChartConditionPane.class); + map.put(XYScatterPlotDataSeriesConditionPane.class.getName(), XYPlotChartConditionPane.class); + map.put(BubblePlotDataSeriesConditionPane.class.getName(), BubblePlotChartConditionPane.class); + } + + private ChartConditionPaneFactory() { + + } + + /** + * �������ɶ�Ӧ��������. + * @param clazz ��Ӧ���� + * @return ������������. + */ + public static ChartConditionPane createChartConditionPane(Class clazz) { + String plotClsName = clazz.getName(); + Class cls = map.get(plotClsName); + cls = cls != null ? cls : ChartConditionPane.class; + try { + return cls.newInstance(); + } catch (Exception e) { + return new ChartConditionPane(); + } + } +} diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/ConditionTrendLinePane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/ConditionTrendLinePane.java new file mode 100644 index 000000000..b67929c9a --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/ConditionTrendLinePane.java @@ -0,0 +1,233 @@ +package com.fr.design.chart.series.SeriesCondition; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.ParseException; + +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.SpinnerNumberModel; + +import com.fr.base.FRContext; +import com.fr.base.Utils; +import com.fr.chart.base.ChartEquationType; +import com.fr.chart.base.ConditionTrendLine; +import com.fr.design.chart.comp.BorderAttriPane; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.design.utils.gui.GUICoreUtils; + +public class ConditionTrendLinePane extends BasicBeanPane { + private static final long serialVersionUID = 3867164332100351117L; + + private ConditionTrendLine editing; + + private UITextField nameLabel; + + private BorderAttriPane linePane; + + private UIRadioButton linearButton; + private UIRadioButton polynomialButton; + private UIRadioButton logButton; + private UIRadioButton exponentButton; + private UIRadioButton powerButton; + private UIRadioButton maButton; + private UIBasicSpinner maSpinner; + + private UITextField forwardLabel; + private UITextField backwardLabel; + + public ConditionTrendLinePane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + JPanel pane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + this.add(pane, BorderLayout.NORTH); + + JPanel namePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + pane.add(namePane); + namePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"Chart_TrendLine" , "WF-Name"}), null)); + namePane.add(new UILabel(Inter.getLocText(new String[]{"Define", "WF-Name"}))); + namePane.add(nameLabel = new UITextField("", 6)); + + pane.add(linePane = new BorderAttriPane()); + linePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"Chart_Trend", "Line-Style"}), null)); + + JPanel typePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + pane.add(typePane); + + typePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"Chart_Trend", "Type"}), null)); + + JPanel buttonPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); + typePane.add(buttonPane); + + buttonPane.add(exponentButton = new UIRadioButton(Inter.getLocText("Chart_Exponent"))); + buttonPane.add(linearButton = new UIRadioButton(Inter.getLocText("Chart_Linear"))); + buttonPane.add(logButton = new UIRadioButton(Inter.getLocText("Chart_Log"))); + buttonPane.add(polynomialButton = new UIRadioButton(Inter.getLocText("Chart_Polynomial"))); + buttonPane.add(powerButton = new UIRadioButton(Inter.getLocText("Chart_Power"))); + + JPanel maPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); + typePane.add(maPane); + + maPane.add(maButton = new UIRadioButton(Inter.getLocText("Chart_Move_Average"))); + maPane.add(new UILabel(Inter.getLocText("cycle") + ":")); + maPane.add(maSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 999, 1))); + maSpinner.setEnabled(false); + + ButtonGroup bg = new ButtonGroup(); + bg.add(exponentButton); + bg.add(linearButton); + bg.add(logButton); + bg.add(polynomialButton); + bg.add(powerButton); + bg.add(maButton); + + pane.add(initExtendsPane()); + + initListeners(); + } + + private JPanel initExtendsPane() { + JPanel extendsPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); // 前推倒推设置 + extendsPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"Chart_Trend", "Forecast"}), null)); + + extendsPane.add(new UILabel(Inter.getLocText("Chart_TrendLine_Forward") + ":")); + extendsPane.add(forwardLabel = new UITextField("0", 5)); + extendsPane.add(new UILabel(Inter.getLocText("cycle"))); + extendsPane.add(new UILabel(Inter.getLocText("Chart_TrendLine_Backward") + ":")); + extendsPane.add(backwardLabel = new UITextField("0", 5)); + extendsPane.add(new UILabel(Inter.getLocText("cycle"))); + + return extendsPane; + } + + private void initListeners() { + exponentButton.addActionListener(listener); + linearButton.addActionListener(listener); + logButton.addActionListener(listener); + polynomialButton.addActionListener(listener); + powerButton.addActionListener(listener); + + maButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if(maButton.isSelected()) { + maSpinner.setEnabled(true); + } + } + }); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Chart_TrendLine"); + } + + ActionListener listener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + if(e.getSource() instanceof JRadioButton) { + JRadioButton selectedButton = (JRadioButton)e.getSource(); + if(selectedButton.isSelected()) { + maSpinner.setEnabled(false); + } + } + } + }; + + @Override + public void populateBean(ConditionTrendLine ob) { + editing = ob; + + nameLabel.setText(ob.getLine().getTrendLineName()); + + forwardLabel.setText(Integer.toString(ob.getForward())); + backwardLabel.setText(Integer.toString(ob.getBackward())); + + if (ob.getLine() != null) { + linePane.setLineStyle(ob.getLine().getLineStyleInfo().getAttrLineStyle().getLineStyle()); + Color trendLineColor = ob.getLine().getLineStyleInfo().getAttrLineColor().getSeriesColor(); + trendLineColor = (trendLineColor == null ? new Color(128,128,128) : trendLineColor); + linePane.setLineColor(trendLineColor); + + ChartEquationType current = ob.getLine().getEquation(); + + maSpinner.setEnabled(false); + + switch (current){ + case EXPONENT: + exponentButton.setSelected(true); + break; + case LINEAR: + linearButton.setSelected(true); + break; + case LOG: + logButton.setSelected(true); + break; + case POLYNOMIAL: + polynomialButton.setSelected(true); + break; + case POWER: + powerButton.setSelected(true); + break; + case MA: + maButton.setSelected(true); + maSpinner.setEnabled(true); + maSpinner.setValue(ob.getLine().getMoveAverage()); + break; + } + + } + } + + @Override + public ConditionTrendLine updateBean() { + updateBean(editing); + + return editing; + } + + public void updateBean(ConditionTrendLine trendLine) { + try { + maSpinner.commitEdit(); + } catch (ParseException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + + trendLine.getLine().setTrendLineName(nameLabel.getText()); + + trendLine.setForward(Utils.string2Number(forwardLabel.getText()).intValue()); + trendLine.setBackward(Utils.string2Number(backwardLabel.getText()).intValue()); + + if(trendLine.getLine() != null) { + if (exponentButton.isSelected()) { + trendLine.getLine().setEquation(ChartEquationType.EXPONENT); + } else if (linearButton.isSelected()) { + trendLine.getLine().setEquation(ChartEquationType.LINEAR); + } + else if (logButton.isSelected()) { + trendLine.getLine().setEquation(ChartEquationType.LOG); + } + else if (polynomialButton.isSelected()) { + trendLine.getLine().setEquation(ChartEquationType.POLYNOMIAL); + } + else if (powerButton.isSelected()) { + trendLine.getLine().setEquation(ChartEquationType.POWER); + } + else if (maButton.isSelected()) { + trendLine.getLine().setEquation(ChartEquationType.MA); + trendLine.getLine().setMoveAverage( + Utils.string2Number(Utils.objectToString(maSpinner.getValue())).intValue()); + } + + trendLine.getLine().getLineStyleInfo().getAttrLineColor().setSeriesColor(linePane.getLineColor()); + trendLine.getLine().getLineStyleInfo().getAttrLineStyle().setLineStyle(linePane.getLineStyle()); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataLabelContentsPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataLabelContentsPane.java new file mode 100644 index 000000000..f02ab3d12 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataLabelContentsPane.java @@ -0,0 +1,53 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.design.chart.ChartPlotFactory; +import com.fr.chart.base.AttrContents; +import com.fr.design.chart.series.SeriesCondition.dlp.DataLabelPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.dialog.BasicPane; + +import javax.swing.*; +import java.awt.*; + +public class DataLabelContentsPane extends BasicPane { + private static final long serialVersionUID = -7935543122227508109L; + private DataLabelPane dataLabelPane; + + public DataLabelContentsPane(Class plotClass) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + JPanel pane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + this.add(pane, BorderLayout.NORTH); + + // 分类, 系列, 值, 百分比 + pane.add(createLabelPane(plotClass), BorderLayout.NORTH); + } + + @Override + protected String title4PopupWindow() { + return "Label"; + } + + /** + * 一般: 分类 系列 值 + * 饼图: 分类 系列 值 百分比 牵引线. + */ + private JPanel createLabelPane(Class plotClass) { + JPanel pane = FRGUIPaneFactory.createBorderLayout_L_Pane();// border 不适合 + pane.setBorder(BorderFactory.createEmptyBorder(2, 0, 10, 10)); + pane.add(dataLabelPane = ChartPlotFactory.createDataLabelPane4Plot(plotClass), BorderLayout.CENTER); + return pane; + } + + public void checkGuidBox() { + dataLabelPane.checkGuidBox(); + } + + public void populate(AttrContents seriesAttrContents) { + dataLabelPane.populate(seriesAttrContents); + } + + public void update(AttrContents seriesAttrContents) { + dataLabelPane.update(seriesAttrContents); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataLabelStylePane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataLabelStylePane.java new file mode 100644 index 000000000..35cb979c9 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataLabelStylePane.java @@ -0,0 +1,121 @@ +package com.fr.design.chart.series.SeriesCondition; + +import java.awt.Color; +import java.awt.Dimension; + +import com.fr.base.Utils; +import com.fr.chart.base.AttrContents; +import com.fr.chart.base.TextAttr; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.dialog.BasicPane; +import com.fr.general.FRFont; +import com.fr.general.Inter; +import com.fr.design.style.FRFontPane; +import com.fr.design.style.color.ColorSelectBox; + +public class DataLabelStylePane extends BasicPane { + private static final long serialVersionUID = 6762567785276287745L; + + private UIComboBox nameBox; + private UIComboBox fontStyleBox; + private UIComboBox sizeBox; + private ColorSelectBox colorBox; + + public DataLabelStylePane() { + this.initPane(true); + } + + /** + * 是否支持字体颜色的设置 + */ + public DataLabelStylePane(boolean isSurpportFontColor) { + this.initPane(isSurpportFontColor); + } + + private void initPane(boolean isSurpportFontColor) { + this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); + + this.add(nameBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report())); + nameBox.setPreferredSize(new Dimension(80, 20)); + + String[] styles = { + Inter.getLocText("FRFont-plain"), + Inter.getLocText("FRFont-bold"), + Inter.getLocText("FRFont-italic"), + Inter.getLocText("FRFont-bolditalic")}; + this.add(fontStyleBox = new UIComboBox(styles)); + fontStyleBox.setPreferredSize(new Dimension(80, 20)); + + this.add(sizeBox = new UIComboBox(FRFontPane.Font_Sizes)); + sizeBox.setPreferredSize(new Dimension(80, 20)); + + if (isSurpportFontColor) { + this.add(colorBox = new ColorSelectBox(60)); + } + + // 默认字体选择. + FRFont defaultFont = FRFont.getInstance(); + nameBox.setSelectedItem(defaultFont.getFontName()); + fontStyleBox.setSelectedIndex(defaultFont.getStyle()); + sizeBox.setSelectedItem(defaultFont.getSize()); + if(colorBox != null) { + colorBox.setSelectObject(defaultFont.getForeground()); + } + } + + @Override + protected String title4PopupWindow() { + return "Label"; + } + + public void populate(AttrContents seriesAttrContents) { + if(seriesAttrContents == null) { + return; + } + + populate(seriesAttrContents.getTextAttr()); + } + + public void populate(TextAttr textAttr) { + if (textAttr == null) { + return; + } + FRFont frFont = textAttr.getFRFont(); + populate(frFont); + } + + public void populate(FRFont frFont) { + if(frFont == null) { + return; + } + nameBox.setSelectedItem(frFont.getFamily()); + fontStyleBox.setSelectedIndex(frFont.getStyle()); + sizeBox.setSelectedItem(frFont.getSize()); + if(colorBox != null) { + colorBox.setSelectObject(frFont.getForeground()); + } + } + + public void update(AttrContents seriesAttrContents) { + if(seriesAttrContents.getTextAttr() == null) { + seriesAttrContents.setTextAttr(new TextAttr()); + } + update(seriesAttrContents.getTextAttr()); + } + + public void update(TextAttr textAttr) { + textAttr.setFRFont(getInstanceFont()); + } + + /** + * 获取当前面板中设置的文本字体样式 + * @return FRFont + */ + public FRFont getInstanceFont() { + float fs = Utils.objectToNumber(sizeBox.getSelectedItem(), false).floatValue(); + String name = Utils.objectToString(nameBox.getSelectedItem()); + Color fontColor = (colorBox != null) ? colorBox.getSelectObject() : Color.black; + return FRFont.getInstance(name, fontStyleBox.getSelectedIndex(), fs, fontColor); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrCustomPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrCustomPane.java new file mode 100644 index 000000000..ea8857824 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrCustomPane.java @@ -0,0 +1,25 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.general.Inter; +import com.fr.chart.chartglyph.CustomAttr; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; + +import java.awt.*; + +public class DataSeriesAttrCustomPane extends DataSeriesAttrPane { + private static final long serialVersionUID = -9046019835977910412L; + + public DataSeriesAttrCustomPane() { + super(); + + // 重新设定大小. JControlPane中的(450, 450) 稍小 @ChartSize + this.setPreferredSize(new Dimension(640,450)); + } + + public NameableCreator[] createNameableCreators() { + return new NameableCreator[] { + new NameObjectCreator(Inter.getLocText("Condition_Attributes"), CustomAttr.class, DataSeriesCustomConditionPane.class) + }; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrPane.java new file mode 100644 index 000000000..7fb006c84 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesAttrPane.java @@ -0,0 +1,80 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.general.Inter; +import com.fr.general.NameObject; +import com.fr.stable.Nameable; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.design.chart.series.SeriesCondition.impl.DataSeriesConditionPaneFactory; +import com.fr.design.gui.controlpane.JControlPane; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; + +import java.util.ArrayList; +import java.util.List; + +/** + * 系列属性的设置界面. + * 主要是对系列的DataSeriesCondition进行设置. + * + * @see DataSeriesConditionPane + */ +public class DataSeriesAttrPane extends JControlPane { + private static final long serialVersionUID = -7265389532959632525L; + + private Plot plot; + + public DataSeriesAttrPane() { + super(); + } + + public DataSeriesAttrPane(Plot plot) { + this.plot = plot; + this.initComponentPane(); + } + + @Override + public NameableCreator[] createNameableCreators() { + return new NameableCreator[]{ + new NameObjectCreator(Inter.getLocText("Condition_Attributes"), ConditionAttr.class, DataSeriesConditionPaneFactory.findConfitionPane4DataSeries(plot)) + }; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Condition", "Display"}); + } + + public void populate(Plot plot) { + List nameObjectList = new ArrayList(); + + ConditionCollection cc = plot.getConditionCollection(); + for (int i = 0, len = cc.getConditionAttrSize(); i < len; i++) { + ConditionAttr attr = cc.getConditionAttr(i); + nameObjectList.add(new NameObject(attr.getName(), attr)); + } + if (nameObjectList.size() > 0) { + populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); + } + } + + public void update(Plot plot) { + Nameable[] res = update(); + NameObject[] res_array = new NameObject[res.length]; + java.util.Arrays.asList(res).toArray(res_array); + ConditionCollection cc = plot.getConditionCollection(); + cc.clearConditionAttr(); + + if (res_array.length < 1) { + return; + } + + for (int i = 0; i < res_array.length; i++) { + NameObject nameObject = res_array[i]; + ConditionAttr attr = (ConditionAttr) nameObject.getObject(); + attr.setName(nameObject.getName()); + cc.addConditionAttr(attr); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java new file mode 100644 index 000000000..70c6b3b4f --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java @@ -0,0 +1,177 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.base.FRContext; +import com.fr.chart.base.AttrAlpha; +import com.fr.chart.base.AttrBackground; +import com.fr.chart.base.AttrContents; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.data.condition.AbstractCondition; +import com.fr.data.condition.ListCondition; +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.util.Iterator; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午9:16 + */ +public class DataSeriesConditionPane extends ConditionAttributesPane { + + + public DataSeriesConditionPane() { + initAvailableActionList(); + initComponents(); + } + + private void initAvailableActionList() { + addBasicAction(); + addAxisPositionAction(); + addStyleAction(); + addBorderAction(); + addTrendLineAction(); + addAction2UseAbleActionList(); + } + + protected void initComponents() { + super.initComponents(); + JPanel pane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + this.add(pane); + pane.setBorder(BorderFactory.createEmptyBorder()); + + // 条件界面 + pane.add(liteConditionPane = ChartConditionPaneFactory.createChartConditionPane(getClass()), BorderLayout.CENTER); + // kunsnat_size 加载属性之后 被遮挡, 最少的高度为300, 5个按钮 + liteConditionPane.setPreferredSize(new Dimension(300, 300)); + } + + protected void addBasicAction() { + classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); + classPaneMap.put(AttrContents.class, new LabelContentsPane(this, class4Correspond())); + } + + protected void addStyleAction() { + classPaneMap.put(AttrBackground.class, new LabelBackgroundPane(this)); + } + + protected void addAxisPositionAction() { + + } + + protected void addBorderAction() { + + } + + protected void addTrendLineAction() { + + } + + /** + * 返回class对象 + * @return class对象 + */ + public Class class4Correspond() { + return Plot.class; + } + + protected void addAction2UseAbleActionList() { + useAbleActionList.clear(); + Iterator iterator = classPaneMap.values().iterator(); + + while (iterator.hasNext()) { + useAbleActionList.add(iterator.next().getHighLightConditionAction()); + } + } + + /** + * 创建条件单独的属性. + * @param clazz 单独条件属性面板 + * @return 单独条件属性面板 + */ + public ConditionAttrSingleConditionPane createConditionAttrSingleConditionPane(Class clazz) { + try { + return clazz.newInstance(); + } catch (InstantiationException e) { + FRContext.getLogger().error(e.getMessage(), e); + } catch (IllegalAccessException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + return null; + } + + @Override + public void populateBean(ConditionAttr ob) { + this.selectedItemPane.removeAll(); + this.initAvailableActionList(); + + if (ob.getCondition() == null) { + this.liteConditionPane.populateBean(new ListCondition()); + } else { + this.liteConditionPane.populateBean(ob.getCondition()); + } + + for (int i = 0; i < ob.getDataSeriesConditionCount(); i++) { + DataSeriesCondition condition = ob.getDataSeriesCondition(i); + + ConditionAttrSingleConditionPane pane = classPaneMap.get(condition.getClass()); + + if (pane != null && useAbleActionList.contains(pane.getHighLightConditionAction())) { + pane.populate(condition); + this.selectedItemPane.add(pane); + useAbleActionList.remove(pane.getHighLightConditionAction()); + } + } + + updateMenuDef(); + validate(); + repaint(10); + } + + @Override + public ConditionAttr updateBean() { + ConditionAttr ca = new ConditionAttr(); + + updateBeanInvoked(ca); + + return ca; + } + + public void updateBean(ConditionAttr condition) { + condition.removeAll(); + updateBeanInvoked(condition); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Condition", "Display"}); + } + + /** + * 为了给DataSeriesCustomConditionPane调用,不得不加了这么个方法 + * @param ca 条件属性 + */ + public void updateBeanInvoked(ConditionAttr ca) { + ca.removeAll(); + Iterator iterator = this.classPaneMap.values().iterator(); + + while (iterator.hasNext()) { + ConditionAttrSingleConditionPane pane = iterator.next(); + if (pane.getParent() == this.selectedItemPane) { + ca.addDataSeriesCondition(pane.update()); + } + } + + AbstractCondition con = (AbstractCondition) this.liteConditionPane.updateBean(); + ca.setCondition(con); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesCustomConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesCustomConditionPane.java new file mode 100644 index 000000000..91a888a87 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesCustomConditionPane.java @@ -0,0 +1,21 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.chartattr.CustomPlot; +import com.fr.chart.chartattr.Plot; + +/** + * 类说明 组合图 条件属性界面. +* @author kunsnat E-mail:kunsnat@gmail.com +* @version 创建时间:2013-8-19 上午09:50:05 + */ +public class DataSeriesCustomConditionPane extends DataSeriesConditionPane{ + private static final long serialVersionUID = -6568508006201353211L; + + /** + * 返回class对象 + * @return class对象 + */ + public Class class4Correspond() { + return CustomPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/GanttPlotChartConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/GanttPlotChartConditionPane.java new file mode 100644 index 000000000..b78356b54 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/GanttPlotChartConditionPane.java @@ -0,0 +1,21 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.ChartConstants; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 下午3:13 + */ +public class GanttPlotChartConditionPane extends ChartConditionPane { + + public String[] columns2Populate() { + return new String[]{ + ChartConstants.PROJECT_ID, + ChartConstants.STEP_INDEX, + ChartConstants.STEP_NAME + }; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java new file mode 100644 index 000000000..3ba731693 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelAlphaPane.java @@ -0,0 +1,56 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.AttrAlpha; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.style.AlphaPane; +import com.fr.general.Inter; + +/** +* @author richie +* @date 2015-03-26 +* @since 8.0 +*/ +public class LabelAlphaPane extends ConditionAttrSingleConditionPane { + private static final int ALPHASIZE = 100; + + private UILabel nameLabel; + private AlphaPane alphaPane; + + private AttrAlpha attrAlpha = new AttrAlpha(); + + public LabelAlphaPane(ConditionAttributesPane conditionAttributesPane) { + super(conditionAttributesPane, true); + + nameLabel = new UILabel(Inter.getLocText("ChartF-Alpha")); + alphaPane = new AlphaPane(); + + this.add(nameLabel); + this.add(alphaPane); + } + + @Override + public String nameForPopupMenuItem() { + return Inter.getLocText("ChartF-Alpha"); + } + + @Override + protected String title4PopupWindow() { + return nameForPopupMenuItem(); + } + + public void populate(DataSeriesCondition condition) { + if (condition instanceof AttrAlpha) { + attrAlpha = (AttrAlpha) condition; + alphaPane.populate((int) (attrAlpha.getAlpha() * ALPHASIZE)); + } + } + + public DataSeriesCondition update() { + attrAlpha.setAlpha(this.alphaPane.update()); + + return attrAlpha; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelAxisPositionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelAxisPositionPane.java new file mode 100644 index 000000000..bcd6f5e75 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelAxisPositionPane.java @@ -0,0 +1,74 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.AttrAxisPosition; +import com.fr.chart.base.ChartAxisPosition; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; + +/** +* @author richie +* @date 2015-03-26 +* @since 8.0 +*/ +public class LabelAxisPositionPane extends ConditionAttrSingleConditionPane { + + private UILabel nameLabel; + private AttrAxisPosition axisPosition = new AttrAxisPosition(); + + private UIButtonGroup positionGroup; + + public LabelAxisPositionPane(ConditionAttributesPane conditionAttributesPane) { + this(conditionAttributesPane, true); + } + + public LabelAxisPositionPane(ConditionAttributesPane conditionAttributesPane, boolean isRemove) { + super(conditionAttributesPane, isRemove); + + nameLabel = new UILabel(Inter.getLocText(new String[]{"ChartF-Axis", "Selection"})); + if (isRemove) { + this.add(nameLabel); + } + + String[] names = new String[]{Inter.getLocText("ChartF-MainAxis"), Inter.getLocText("ChartF-SecondAxis")}; + String[] values = new String[]{ChartAxisPosition.AXIS_LEFT.getAxisPosition(), ChartAxisPosition.AXIS_RIGHT.getAxisPosition()}; + + positionGroup = new UIButtonGroup(names, values); + positionGroup.setAllToolTips(names); + + this.add(positionGroup); + + positionGroup.setSelectedItem(ChartAxisPosition.AXIS_LEFT.getAxisPosition()); + + } + + @Override + public String nameForPopupMenuItem() { + return Inter.getLocText(new String[]{"Owner", "time(s)", "ChartF-Axis"}); + } + + @Override + protected String title4PopupWindow() { + return nameForPopupMenuItem(); + } + + public void populate(DataSeriesCondition condition) { + if (condition instanceof AttrAxisPosition) { + axisPosition = (AttrAxisPosition) condition; + if (ComparatorUtils.equals(axisPosition.getAxisPosition(), ChartAxisPosition.AXIS_LEFT)) { + positionGroup.setSelectedItem(ChartAxisPosition.AXIS_LEFT.getAxisPosition()); + } else { + positionGroup.setSelectedItem(ChartAxisPosition.AXIS_RIGHT.getAxisPosition()); + } + } + } + + public DataSeriesCondition update() { + axisPosition.setAxisPosition(ChartAxisPosition.parse(positionGroup.getSelectedItem())); + return axisPosition; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBackgroundPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBackgroundPane.java new file mode 100644 index 000000000..3e79aca65 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBackgroundPane.java @@ -0,0 +1,83 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.base.background.ColorBackground; +import com.fr.chart.base.AttrBackground; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.style.background.BackgroundPane; +import com.fr.design.style.background.BackgroundPreviewLabel; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** +* @author richie +* @date 2015-03-26 +* @since 8.0 +*/ +public class LabelBackgroundPane extends ConditionAttrSingleConditionPane { + + private UILabel backgroundLabel; + private BackgroundPreviewLabel backgroundPreviewPane; + + private AttrBackground attrBackground = new AttrBackground(); + + public LabelBackgroundPane(final ConditionAttributesPane conditionAttributesPane) { + super(conditionAttributesPane, true); + backgroundLabel = new UILabel(Inter.getLocText("Background")); + this.backgroundPreviewPane = new BackgroundPreviewLabel(); + this.backgroundPreviewPane.setPreferredSize(new Dimension(80, 20)); + UIButton editBackgroundButton = new UIButton(Inter.getLocText("Edit")); + MouseAdapter mouseListener = new MouseAdapter() { + public void mousePressed(MouseEvent evt) { + final BackgroundPane backgroundPane = new BackgroundPane(); + BasicDialog styleDialog = backgroundPane.showWindow( + SwingUtilities.getWindowAncestor(conditionAttributesPane)); // 调整(400,300) 比较合适. + backgroundPane.populate(backgroundPreviewPane.getBackgroundObject()); + styleDialog.addDialogActionListener(new DialogActionAdapter() { + public void doOk() { + backgroundPreviewPane.setBackgroundObject(backgroundPane.update()); + backgroundPreviewPane.repaint(); + } + }); + styleDialog.setVisible(true); + } + }; + editBackgroundButton.addMouseListener(mouseListener); + backgroundPreviewPane.addMouseListener(mouseListener); + this.add(backgroundLabel); + this.add(backgroundPreviewPane); + this.add(editBackgroundButton); + this.backgroundPreviewPane.setBackgroundObject(ColorBackground.getInstance(Color.white)); + } + + @Override + public String nameForPopupMenuItem() { + return Inter.getLocText("ChartF-Background_Color"); + } + + @Override + protected String title4PopupWindow() { + return nameForPopupMenuItem(); + } + + public void populate(DataSeriesCondition condition) { + if (condition instanceof AttrBackground) { + attrBackground = (AttrBackground) condition; + this.backgroundPreviewPane.setBackgroundObject(attrBackground.getSeriesBackground()); + } + } + + public DataSeriesCondition update() { + attrBackground.setSeriesBackground(this.backgroundPreviewPane.getBackgroundObject()); + return attrBackground; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBorderAttrPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBorderAttrPane.java new file mode 100644 index 000000000..86e958623 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBorderAttrPane.java @@ -0,0 +1,40 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.chart.comp.BorderAttriPane; +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.stable.StringUtils; + +/** +* @author richie +* @date 2015-03-26 +* @since 8.0 +*/ +public abstract class LabelBorderAttrPane extends ConditionAttrSingleConditionPane { + protected UILabel nameLabel; + protected BorderAttriPane linePane; + private String labelName; + + public LabelBorderAttrPane(ConditionAttributesPane conditionAttributesPane) { + this(conditionAttributesPane, false, StringUtils.EMPTY); + } + + public LabelBorderAttrPane(ConditionAttributesPane conditionAttributesPane, boolean isRemove, String label) { + super(conditionAttributesPane, isRemove); + nameLabel = new UILabel(label); + linePane = new BorderAttriPane(); + + if (isRemove) { + this.add(nameLabel); + } + this.add(linePane); + this.labelName = label; + } + + @Override + public String nameForPopupMenuItem() { + return labelName; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBorderPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBorderPane.java new file mode 100644 index 000000000..cc9385d3a --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelBorderPane.java @@ -0,0 +1,34 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.general.Inter; + +/** +* @author richie +* @date 2015-03-26 +* @since 8.0 +*/ +public class LabelBorderPane extends LabelBorderAttrPane { + + private AttrBorder attrBorder = new AttrBorder(); + + public LabelBorderPane(ConditionAttributesPane conditionAttributesPane) { + super(conditionAttributesPane, true, Inter.getLocText(new String[]{"Border", "Format"})); + } + + public void populate(DataSeriesCondition condition) { + if (condition instanceof AttrBorder) { + attrBorder = (AttrBorder) condition; + linePane.setLineColor(attrBorder.getBorderColor()); + linePane.setLineStyle(attrBorder.getBorderStyle()); + } + } + + public DataSeriesCondition update() { + attrBorder.setBorderColor(linePane.getLineColor()); + attrBorder.setBorderStyle(linePane.getLineStyle()); + return attrBorder; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelColorPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelColorPane.java new file mode 100644 index 000000000..30d50b2f0 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelColorPane.java @@ -0,0 +1,63 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.AttrColor; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.style.color.ColorSelectBox; +import com.fr.general.Inter; + +/** +* @author richie +* @date 2015-03-26 +* @since 8.0 +*/ +public class LabelColorPane extends ConditionAttrSingleConditionPane { + + protected UILabel nameLabel; + private ColorSelectBox colorSelectionPane; + private AttrColor attrColor = new AttrColor(); + + public LabelColorPane(ConditionAttributesPane conditionAttributesPane) { + this(conditionAttributesPane, true); + } + + public LabelColorPane(ConditionAttributesPane conditionAttributesPane, boolean isRemove) { + super(conditionAttributesPane, isRemove); + nameLabel = new UILabel(Inter.getLocText("ChartF-Background_Color")); + colorSelectionPane = new ColorSelectBox(80); + + if (isRemove) { + this.add(nameLabel); + } + this.add(colorSelectionPane); + + } + + /** + * 条目名称 + * @return 名称 + */ + @Override + public String nameForPopupMenuItem() { + return Inter.getLocText("Color"); + } + + @Override + protected String title4PopupWindow() { + return nameForPopupMenuItem(); + } + + public void populate(DataSeriesCondition condition) { + if (condition instanceof AttrColor) { + attrColor = (AttrColor) condition; + this.colorSelectionPane.setSelectObject(this.attrColor.getSeriesColor()); + } + } + + public DataSeriesCondition update() { + attrColor.setSeriesColor(this.colorSelectionPane.getSelectObject()); + return attrColor; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelContentsPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelContentsPane.java new file mode 100644 index 000000000..b76fc7dc7 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelContentsPane.java @@ -0,0 +1,87 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.AttrContents; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** +* @author richie +* @date 2015-03-26 +* @since 8.0 +*/ +public class LabelContentsPane extends ConditionAttrSingleConditionPane { + + private UILabel nameLabel; + private DataLabelContentsPane dataLabelContentsPane; + + private AttrContents attrContents = new AttrContents(); + + public LabelContentsPane(ConditionAttributesPane conditionAttributesPane, Class plotClass) { + this(conditionAttributesPane, true, plotClass); + } + + public LabelContentsPane(ConditionAttributesPane conditionAttributesPane, boolean isRemove, final Class plotClass) { + super(conditionAttributesPane, isRemove); + nameLabel = new UILabel(Inter.getLocText(new String[]{"Label", "HJS-Message"})); + + JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + if (isRemove) { + this.removeAll(); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + // 重新布局 + JPanel northPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + northPane.setPreferredSize(new Dimension(300, 30)); + this.add(northPane, BorderLayout.NORTH); + + northPane.add(cancel); + northPane.add(nameLabel); + + pane.setBorder(BorderFactory.createEmptyBorder(6, 25, 0, 0)); + } + + this.dataLabelContentsPane = new DataLabelContentsPane(plotClass); + + pane.add(dataLabelContentsPane); + + this.add(pane); + } + + @Override + public String nameForPopupMenuItem() { + return Inter.getLocText(new String[]{"Label", "HJS-Message"}); + } + + @Override + protected String title4PopupWindow() { + return nameForPopupMenuItem(); + } + + /** + * 检查是否使用牵引线box. + */ + public void checkGuidBox() { + if (this.dataLabelContentsPane != null) { + this.dataLabelContentsPane.checkGuidBox(); + } + } + + public void populate(DataSeriesCondition condition) { + if (condition instanceof AttrContents) { + attrContents = (AttrContents) condition; + this.dataLabelContentsPane.populate(attrContents); + } + } + + public DataSeriesCondition update() { + this.dataLabelContentsPane.update(attrContents); + return attrContents; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelLineStylePane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelLineStylePane.java new file mode 100644 index 000000000..5fe73d631 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LabelLineStylePane.java @@ -0,0 +1,69 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.AttrLineStyle; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.general.Inter; +import com.fr.stable.Constants; +import com.fr.stable.CoreConstants; + +/** +* @author richie +* @date 2015-03-26 +* @since 8.0 +*/ +public class LabelLineStylePane extends ConditionAttrSingleConditionPane { + + private UILabel nameLabel; + private LineComboBox lineCombo; + private AttrLineStyle attrLineStyle = new AttrLineStyle(); + + public LabelLineStylePane(ConditionAttributesPane conditionAttributesPane) { + this(conditionAttributesPane, true); + } + + public LabelLineStylePane(ConditionAttributesPane conditionAttributesPane, boolean isRemove) { + super(conditionAttributesPane, isRemove); + + + nameLabel = new UILabel(Inter.getLocText("Line-Style") + ":"); + if (isRemove) { + this.add(nameLabel); + } + + lineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); + this.add(lineCombo); + } + + @Override + public String nameForPopupMenuItem() { + return Inter.getLocText("Line-Style"); + } + + @Override + protected String title4PopupWindow() { + return nameForPopupMenuItem(); + } + + @Override + public void populate(DataSeriesCondition condition) { + if (condition instanceof AttrLineStyle) { + attrLineStyle = (AttrLineStyle) condition; + int lineStyle = attrLineStyle.getLineStyle(); + if(lineStyle != Constants.LINE_THICK && lineStyle != Constants.LINE_THIN + && lineStyle != Constants.LINE_MEDIUM && lineStyle != Constants.LINE_NONE) { + lineStyle = Constants.LINE_THIN; + } + lineCombo.setSelectedLineStyle(lineStyle); + } + } + + @Override + public DataSeriesCondition update() { + attrLineStyle.setLineStyle(lineCombo.getSelectedLineStyle()); + return attrLineStyle; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LineMarkerTypePane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LineMarkerTypePane.java new file mode 100644 index 000000000..59dcced53 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/LineMarkerTypePane.java @@ -0,0 +1,62 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.AttrMarkerType; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.chart.chartglyph.MarkerFactory; +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.xcombox.MarkerComboBox; +import com.fr.general.Inter; + +/** +* @author richie +* @date 2015-03-26 +* @since 8.0 +*/ +public class LineMarkerTypePane extends ConditionAttrSingleConditionPane { + + private UILabel nameLabel; + private MarkerComboBox markerBox; + + private AttrMarkerType markerType = new AttrMarkerType(); + + public LineMarkerTypePane(ConditionAttributesPane conditionAttributesPane) { + this(conditionAttributesPane, true); + } + + public LineMarkerTypePane(ConditionAttributesPane conditionAttributesPane, boolean isRemove) { + super(conditionAttributesPane, isRemove); + + nameLabel = new UILabel(Inter.getLocText(new String[]{"ChartF-Marker", "FS_Report_Type"})); + markerBox = new MarkerComboBox(MarkerFactory.getMarkerArray()); + + if (isRemove) { + this.add(nameLabel); + } + this.add(markerBox); + } + + @Override + public String nameForPopupMenuItem() { + return Inter.getLocText(new String[]{"ChartF-Marker", "FS_Report_Type"}); + } + + @Override + protected String title4PopupWindow() { + return nameForPopupMenuItem(); + } + + public void populate(DataSeriesCondition condition) { + if (condition instanceof AttrMarkerType) { + markerType = (AttrMarkerType) condition; + markerBox.setSelectedMarker(MarkerFactory.createMarker(markerType.getMarkerType())); + } + } + + public DataSeriesCondition update() { + this.markerType.setMarkerType(markerBox.getSelectedMarkder().getMarkerType()); + return this.markerType; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/MapPlotChartConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/MapPlotChartConditionPane.java new file mode 100644 index 000000000..75795ce6f --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/MapPlotChartConditionPane.java @@ -0,0 +1,18 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.ChartConstants; + +/** + * 地图的条件 参数下拉. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-1-11 下午03:44:40 + */ +public class MapPlotChartConditionPane extends ChartConditionPane { + + public String[] columns2Populate() { + return new String[]{ + ChartConstants.AREA_NAME, + ChartConstants.AREA_VALUE + }; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/PiePlotChartConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/PiePlotChartConditionPane.java new file mode 100644 index 000000000..10b11ab95 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/PiePlotChartConditionPane.java @@ -0,0 +1,20 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.ChartConstants; + + +/** + * 饼图 条件显示 参数. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-1-11 下午03:48:32 + */ +public class PiePlotChartConditionPane extends ChartConditionPane { + + public String[] columns2Populate() { + return new String[]{ + ChartConstants.SERIES_INDEX, + ChartConstants.SERIES_NAME, + ChartConstants.VALUE + }; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TooltipContentsPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TooltipContentsPane.java new file mode 100644 index 000000000..0be84de39 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TooltipContentsPane.java @@ -0,0 +1,186 @@ +package com.fr.design.chart.series.SeriesCondition; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.Format; + +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +import com.fr.chart.base.AttrContents; +import com.fr.chart.base.ChartConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; +import com.fr.design.style.FormatPane; + +/** + * 数据点提示内容面板,包含系列值、系列百分比 + * @author jerry + * + */ +public class TooltipContentsPane extends BasicPane{ + protected UICheckBox showValueCB; + protected UICheckBox showPercent; + protected Format format; + protected Format percentFormat; + protected JPanel contentPane; + + + public TooltipContentsPane() { + setLayout(FRGUIPaneFactory.createBorderLayout()); + contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + add(contentPane, BorderLayout.CENTER); + contentPane.add(createJPanel4Label()); + } + + private JPanel createJPanel4Label() { + return createTableLayoutPane(new Component[][]{ + createComponents4Value(), + createComponents4PercentValue(), + new Component[0] + }); + } + + protected Component[] createComponents4Value() { + return new Component[]{null, createJPanel4Value()}; + } + + protected JPanel createJPanel4Value() { + if (showValueCB == null) { + showValueCB = new UICheckBox(Inter.getLocText("Value")); + } + showValueCB.setSelected(true); + + JPanel valuePane = new JPanel(); + valuePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));// 默认左未0对齐. + + valuePane.add(showValueCB); + + UIButton valueFormatButton = new UIButton(Inter.getLocText("Format")); + valuePane.add(valueFormatButton); + + valueFormatButton.addActionListener(listener); + valueFormatButton.setPreferredSize(new Dimension(60, 20));//默认太高了. + return valuePane; + } + + + + protected Component[] createComponents4PercentValue() { + if (showPercent == null) { + showPercent = new UICheckBox(Inter.getLocText("Chart_ValueIntPercent")); + } + + JPanel percentValuePane = new JPanel(); + percentValuePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));// 默认左未0对齐. + + percentValuePane.add(showPercent); + + UIButton valueFormatButton = new UIButton(Inter.getLocText("Format")); + percentValuePane.add(valueFormatButton); + + valueFormatButton.addActionListener(percentListener); + valueFormatButton.setPreferredSize(new Dimension(60, 20));//默认太高了. + return new Component[]{null, percentValuePane}; + } + + protected JPanel createTableLayoutPane(Component[][] components) { + double[] colSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; + double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, + TableLayout.PREFERRED, TableLayout.PREFERRED}; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, colSize); + } + + public String title4PopupWindow() { + return "DataLabel"; + } + + private ActionListener listener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + final FormatPane formatPane = new FormatPane(); + if (format != null) { + formatPane.populate(format); + } + + paneActionPerformed(formatPane, false); + } + }; + + private ActionListener percentListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + final FormatPane percentPane = new FormatPane(); + percentPane.percentFormatPane(); + + if (percentFormat != null) { + percentPane.populate(percentFormat); + } + paneActionPerformed(percentPane, true); + } + }; + + private void paneActionPerformed(final FormatPane formatPane, final boolean isPercent) { + + formatPane.showWindow(SwingUtilities.getWindowAncestor(TooltipContentsPane.this), + new DialogActionAdapter() { + public void doOk() { + if (isPercent) { + percentFormat = formatPane.update(); + } else { + format = formatPane.update(); + } + } + }).setVisible(true); + } + + public void populate(AttrContents seriesAttrContents) { + format = seriesAttrContents.getFormat(); + percentFormat = seriesAttrContents.getPercentFormat(); + String dataLabel = seriesAttrContents.getSeriesLabel(); + if (dataLabel != null) { + if (showValueCB != null) { + showValueCB.setSelected(dataLabel.contains(ChartConstants.VALUE_PARA)); + } + if (showPercent != null) { + showPercent.setSelected(dataLabel.contains(ChartConstants.PERCENT_PARA)); + } + } else { + if (showValueCB != null) { + showValueCB.setSelected(false); + } + if (showPercent != null) { + showPercent.setSelected(false); + } + } + } + + public void update(AttrContents seriesAttrContents) { + String contents = StringUtils.EMPTY; + contents += ChartConstants.SERIES_PARA + ChartConstants.BREAKLINE_PARA + ChartConstants.CATEGORY_PARA; + if (showValueCB.isSelected() && !showPercent.isSelected()) { + contents += ChartConstants.BREAKLINE_PARA + ChartConstants.VALUE_PARA; + } else if (!showValueCB.isSelected() && showPercent.isSelected()){ + contents += ChartConstants.BREAKLINE_PARA + ChartConstants.PERCENT_PARA; + } else if (showValueCB.isSelected() && showPercent.isSelected()) { + contents += ChartConstants.BREAKLINE_PARA + ChartConstants.VALUE_PARA + + ChartConstants.BREAKLINE_PARA + ChartConstants.PERCENT_PARA; + } else { + contents = null; + } + seriesAttrContents.setSeriesLabel(contents); + seriesAttrContents.setFormat(format); + seriesAttrContents.setPercentFormat(percentFormat); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLineControlPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLineControlPane.java new file mode 100644 index 000000000..583d2c3bd --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLineControlPane.java @@ -0,0 +1,64 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.general.Inter; +import com.fr.general.NameObject; +import com.fr.stable.Nameable; +import com.fr.chart.base.AttrTrendLine; +import com.fr.chart.base.ConditionTrendLine; +import com.fr.design.gui.controlpane.JControlPane; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; + +import java.util.ArrayList; +import java.util.List; + +public class TrendLineControlPane extends JControlPane { + + public NameableCreator[] createNameableCreators() { + return new NameableCreator[] { + new NameObjectCreator( + Inter.getLocText("Chart_TrendLine"), + ConditionTrendLine.class, + ConditionTrendLinePane.class + ) + }; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Edit", "Chart_TrendLine"}); + } + + public void populate(AttrTrendLine trendLineList) { + List nameObjectList = new ArrayList(); + + for(int i = 0; i < trendLineList.size(); i++) { + ConditionTrendLine value = trendLineList.get(i); + nameObjectList.add(new NameObject(value.getPaneName(), value)); + } + + if(nameObjectList.size() > 0) { + populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); + } + } + + public void update(AttrTrendLine trendLineList) { + Nameable[] res = update(); + NameObject[] res_array = new NameObject[res.length]; + java.util.Arrays.asList(res).toArray(res_array); + + trendLineList.clear(); + + if (res_array.length < 1) { + return; + } + + for (int i = 0; i < res_array.length; i++) { + NameObject nameObject = res_array[i]; + + ConditionTrendLine trendLine = (ConditionTrendLine)nameObject.getObject(); + trendLine.setPaneName(nameObject.getName()); + trendLineList.add(trendLine); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLinePane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLinePane.java new file mode 100644 index 000000000..b0cdd1413 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TrendLinePane.java @@ -0,0 +1,74 @@ +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.AttrTrendLine; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.condition.ConditionAttrSingleConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** +* @author richie +* @date 2015-03-26 +* @since 8.0 +*/ +public class TrendLinePane extends ConditionAttrSingleConditionPane { + + private UILabel nameLabel; + + private UIButton editTrendLineButton; + private AttrTrendLine attrTrendLine = new AttrTrendLine(); + + public TrendLinePane(ConditionAttributesPane conditionAttributesPane) { + this(conditionAttributesPane, true); + } + + public TrendLinePane(ConditionAttributesPane conditionAttributesPane, boolean isRemove) { + super(conditionAttributesPane, isRemove); + nameLabel = new UILabel(Inter.getLocText("Chart_TrendLine")); + + editTrendLineButton = new UIButton(Inter.getLocText(new String[]{"Edit", "Chart_TrendLine"})); + editTrendLineButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + final TrendLineControlPane controlPane = new TrendLineControlPane(); + + controlPane.populate(attrTrendLine); + BasicDialog bg = controlPane.showWindow(SwingUtilities.getWindowAncestor(TrendLinePane.this), + new DialogActionAdapter() { + public void doOk() { + controlPane.update(attrTrendLine); + } + }); + + bg.setVisible(true); + } + }); + if (isRemove) { + this.add(nameLabel); + } + this.add(editTrendLineButton); + } + + @Override + public String nameForPopupMenuItem() { + return Inter.getLocText("Chart_TrendLine"); + } + + public void populate(DataSeriesCondition condition) { + if (condition instanceof AttrTrendLine) { + attrTrendLine = (AttrTrendLine) condition; + } + } + + public DataSeriesCondition update() { + + return attrTrendLine; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/XYPlotChartConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/XYPlotChartConditionPane.java new file mode 100644 index 000000000..9e3fd232a --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/XYPlotChartConditionPane.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.chart.series.SeriesCondition; + +import com.fr.chart.base.ChartConstants; + +/** + * 散点图 条件属性 显示参数 界面. + * Created by kunsnat on 14-3-10. + * kunsnat@gmail.com + */ +public class XYPlotChartConditionPane extends ChartConditionPane { + + /** + * 界面条件序号 列表 + * @return 返回条件列表. + */ + public String[] columns2Populate() { + return new String[]{ + ChartConstants.SERIES_INDEX, + ChartConstants.SERIES_NAME, + ChartConstants.VALUE + }; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/AreaDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/AreaDataLabelPane.java new file mode 100644 index 000000000..1f5641f13 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/AreaDataLabelPane.java @@ -0,0 +1,16 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import javax.swing.*; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-29 + * Time : 下午2:44 + */ +public class AreaDataLabelPane extends DataLabelPane { + protected JPanel createJPanel4Position() { + return null; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/Bar2DDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/Bar2DDataLabelPane.java new file mode 100644 index 000000000..60cea60b4 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/Bar2DDataLabelPane.java @@ -0,0 +1,70 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import javax.swing.ButtonGroup; +import javax.swing.JPanel; + +import com.fr.chart.base.AttrContents; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.stable.Constants; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-29 + * Time : 下午2:36 + * + * 柱形和条形图的 图表样式--"标签"界面 + */ +public class Bar2DDataLabelPane extends DataLabelPane { + private static final long serialVersionUID = -1422949139632959981L; + private UIRadioButton insideButton; + private UIRadioButton outSideButton; + + protected JPanel createJPanel4Position() { + centerButton = new UIRadioButton(Inter.getLocText("FR-Designer-StyleAlignment_Center")); + insideButton = new UIRadioButton(Inter.getLocText("FR-Chart_DataLabelInside")); + outSideButton = new UIRadioButton(Inter.getLocText("FR-Chart_DataLabelOutSide")); + + ButtonGroup bg = new ButtonGroup(); + bg.add(insideButton); + bg.add(outSideButton); + bg.add(centerButton); + + outSideButton.setSelected(true); + + JPanel buttonPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + buttonPane.add(new UILabel(Inter.getLocText(new String[]{"Label", "Layout"}) + ":")); + buttonPane.add(outSideButton); + buttonPane.add(insideButton); + buttonPane.add(centerButton); + + return buttonPane; + } + + public void populate(AttrContents seriesAttrContents) { + super.populate(seriesAttrContents); + int position = seriesAttrContents.getPosition(); + if (insideButton != null && position == Constants.INSIDE) { + insideButton.setSelected(true); + } else if (outSideButton != null && position == Constants.OUTSIDE) { + outSideButton.setSelected(true); + } else if (centerButton != null) { + //柱形图除了内外都是居中。 + //组合图条件显示16.1.4之前是上下左右中,现改为内外中。之前存的上下左右都当做中。 + centerButton.setSelected(true); + } + } + + public void update(AttrContents seriesAttrContents) { + super.update(seriesAttrContents); + if (insideButton != null && insideButton.isSelected()) { + seriesAttrContents.setPosition(Constants.INSIDE); + } else if (outSideButton != null && outSideButton.isSelected()) { + seriesAttrContents.setPosition(Constants.OUTSIDE); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/Bar3DDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/Bar3DDataLabelPane.java new file mode 100644 index 000000000..b9436bc2c --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/Bar3DDataLabelPane.java @@ -0,0 +1,16 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import javax.swing.*; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-29 + * Time : 下午2:45 + */ +public class Bar3DDataLabelPane extends DataLabelPane { + protected JPanel createJPanel4Position() { + return null; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/BubbleDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/BubbleDataLabelPane.java new file mode 100644 index 000000000..c4618dad0 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/BubbleDataLabelPane.java @@ -0,0 +1,68 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import com.fr.chart.base.AttrContents; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.stable.Constants; + +import javax.swing.*; +import java.awt.*; + +/** + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-4-13 上午10:08:39 + * 类说明: 气泡系列标签界面 + */ +public class BubbleDataLabelPane extends DataLabelPane { + private static final long serialVersionUID = 6122072293885219893L; + + private UIButton insideButton; + private UIButton outSideButton; + + protected JPanel createJPanel4Position() { + insideButton = new UIButton(Inter.getLocText("Chart_Bubble_Inside")); + outSideButton = new UIButton(Inter.getLocText("Chart_Bubble_Outside")); + + ButtonGroup bg = new ButtonGroup(); + bg.add(insideButton); + bg.add(outSideButton); + + outSideButton.setSelected(true); + + JPanel buttonPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + buttonPane.add(new UILabel(Inter.getLocText(new String[]{"Label", "Layout"}) + ":")); + buttonPane.add(outSideButton); + buttonPane.add(insideButton); + + return buttonPane; + } + + protected Component[] createComponents4ShowCategoryName() { + return new Component[0]; + } + + protected Component[] createComponents4PercentValue() { + return new Component[0]; + } + + public void populate(AttrContents seriesAttrContents) { + super.populate(seriesAttrContents); + int position = seriesAttrContents.getPosition(); + if (insideButton != null && position == Constants.INSIDE) { + insideButton.setSelected(true); + } else if (outSideButton != null && position == Constants.OUTSIDE) { + outSideButton.setSelected(true); + } + } + + public void update(AttrContents seriesAttrContents) { + super.update(seriesAttrContents); + if (insideButton != null && insideButton.isSelected()) { + seriesAttrContents.setPosition(Constants.INSIDE); + } else if (outSideButton != null && outSideButton.isSelected()) { + seriesAttrContents.setPosition(Constants.OUTSIDE); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/DataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/DataLabelPane.java new file mode 100644 index 000000000..33f2dccb7 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/DataLabelPane.java @@ -0,0 +1,243 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; + +import javax.swing.ButtonGroup; +import javax.swing.JPanel; + +import com.fr.base.Utils; +import com.fr.chart.base.AttrContents; +import com.fr.chart.base.ChartConstants; +import com.fr.design.chart.series.SeriesCondition.DataLabelStylePane; +import com.fr.design.chart.series.SeriesCondition.TooltipContentsPane; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.stable.Constants; +import com.fr.stable.StringUtils; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-29 + * Time : 上午9:12 + * + * 系列标签界面 + */ +public class DataLabelPane extends TooltipContentsPane { + private static final int SPACE = 4; + + protected UICheckBox showSeriesNameCB; + protected UICheckBox showCategoryNameCB; + protected UIComboBox delimiterBox; + private DataLabelStylePane stylePane; + private UIRadioButton bottomButton; + private UIRadioButton leftButton; + private UIRadioButton rigtButton; + private UIRadioButton topButton; + protected UIRadioButton centerButton; + + public DataLabelPane() { + setLayout(FRGUIPaneFactory.createBorderLayout()); + contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); + add(contentPane, BorderLayout.CENTER); + contentPane.add(createJPanel4Label()); + contentPane.add(createJPanel4Delimiter()); + JPanel jPanel4FontStyle = createJPanel4FontStyle(); + if (jPanel4FontStyle != null) { + contentPane.add(jPanel4FontStyle); + } + JPanel jPanel4Position = createJPanel4Position(); + if (jPanel4Position != null) { + contentPane.add(jPanel4Position); + + } + } + + private JPanel createJPanel4Label() { + return createTableLayoutPane(new Component[][]{ + createComponents4ShowSeriesName(), + createComponents4ShowCategoryName(), + createComponents4Value(), + createComponents4PercentValue(), + createComponents4ShowGuidLine() + }); + + } + + protected Component[] createComponents4ShowSeriesName() { + if (showSeriesNameCB == null) { + showSeriesNameCB = new UICheckBox(Inter.getLocText(new String[]{"ChartF-Series", "WF-Name"})); + } + return new Component[]{new UILabel(Inter.getLocText(new String[]{"Label", "Include"}) + ":"), showSeriesNameCB}; + } + + protected Component[] createComponents4ShowCategoryName() { + if (showCategoryNameCB == null) { + showCategoryNameCB = new UICheckBox(Inter.getLocText(new String[]{"StyleFormat-Category", "WF-Name"})); + } + return new Component[]{null, showCategoryNameCB}; + } + + + + protected Component[] createComponents4ShowGuidLine() { + return new Component[0]; + } + + private JPanel createJPanel4Delimiter() { + if (delimiterBox == null) { + delimiterBox = new UIComboBox(ChartConstants.DELIMITERS); + } + delimiterBox.setPreferredSize(new Dimension(70, 20)); + JPanel boxPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); + boxPane.add(new UILabel(Inter.getLocText("Form-Delimiter") + ":")); + boxPane.add(delimiterBox); + return boxPane; + } + + private JPanel createJPanel4FontStyle() { + JPanel labelStylePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel westPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); + labelStylePane.add(westPane, BorderLayout.WEST); + westPane.add(new UILabel(Inter.getLocText(new String[]{"Label", "FRFont"}) + ":")); + labelStylePane.add(stylePane = new DataLabelStylePane(), BorderLayout.CENTER); + return labelStylePane; + } + + protected JPanel createJPanel4Position() { + // 标签位置:上下左右中. + bottomButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Bottom")); + leftButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Left")); + rigtButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Right")); + topButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Top")); + centerButton = new UIRadioButton(Inter.getLocText("Center")); + + ButtonGroup bg = new ButtonGroup(); + bg.add(bottomButton); + bg.add(leftButton); + bg.add(rigtButton); + bg.add(topButton); + bg.add(centerButton); + topButton.setSelected(true); + + JPanel buttonPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + buttonPane.add(new UILabel(Inter.getLocText(new String[]{"Label", "Layout"}) + ":")); + buttonPane.add(bottomButton); + buttonPane.add(leftButton); + buttonPane.add(rigtButton); + buttonPane.add(topButton); + buttonPane.add(centerButton); + + return buttonPane; + } + + + + public void populate(AttrContents seriesAttrContents) { + super.populate(seriesAttrContents); + String dataLabel = seriesAttrContents.getSeriesLabel(); + if (dataLabel != null) { + for (int i = 0; i < ChartConstants.DELIMITERS.length; i++) { + String delimiter = ChartConstants.DELIMITERS[i]; + if (delimiterBox != null && dataLabel.contains(delimiter)) { + delimiterBox.setSelectedItem(delimiter); + break; + } + } + // 以前的换行符 ${BR} + if (delimiterBox != null && dataLabel.contains(ChartConstants.BREAKLINE_PARA)) { + delimiterBox.setSelectedItem(ChartConstants.DELIMITERS[3]); + } + + if (showCategoryNameCB != null) { + showCategoryNameCB.setSelected(dataLabel.contains(ChartConstants.CATEGORY_PARA)); + } + if (showSeriesNameCB != null) { + showSeriesNameCB.setSelected(dataLabel.contains(ChartConstants.SERIES_PARA)); + } + } else { + if (showCategoryNameCB != null) { + showCategoryNameCB.setSelected(false); + } + if (showSeriesNameCB != null) { + showSeriesNameCB.setSelected(false); + } + } + + int position = seriesAttrContents.getPosition(); + if (bottomButton != null && position == Constants.BOTTOM) { + bottomButton.setSelected(true); + } else if (topButton != null && position == Constants.TOP) { + topButton.setSelected(true); + } else if (rigtButton != null && position == Constants.RIGHT) { + rigtButton.setSelected(true); + } else if (leftButton != null && position == Constants.LEFT) { + leftButton.setSelected(true); + } else if (centerButton != null && position == Constants.CENTER) { + centerButton.setSelected(true); + } + + if (stylePane != null) { + stylePane.populate(seriesAttrContents); + } + } + + + + public void update(AttrContents seriesAttrContents) { + String contents = StringUtils.EMPTY; + String delString = Utils.objectToString(delimiterBox.getSelectedItem()); + if (delString.contains(ChartConstants.DELIMITERS[3])) { + delString = ChartConstants.BREAKLINE_PARA; + } else if (delString.contains(ChartConstants.DELIMITERS[SPACE])) { + delString = StringUtils.BLANK; + } + // 处理间隔符 在label中添加 + if ((showCategoryNameCB != null && showCategoryNameCB.isSelected())) { + contents += ChartConstants.CATEGORY_PARA + delString; + } + if (showSeriesNameCB != null && showSeriesNameCB.isSelected()) { + contents += ChartConstants.SERIES_PARA + delString; + } + if (showValueCB != null && showValueCB.isSelected()) { + contents += ChartConstants.VALUE_PARA + delString; + } + if (showPercent != null && showPercent.isSelected()) { + contents += ChartConstants.PERCENT_PARA + delString; + } + if (contents.contains(delString)) { + contents = contents.substring(0, contents.lastIndexOf(delString)); + } + + if (topButton != null && topButton.isSelected()) { + seriesAttrContents.setPosition(Constants.TOP); + } else if (leftButton != null && leftButton.isSelected()) { + seriesAttrContents.setPosition(Constants.LEFT); + } else if (bottomButton != null && bottomButton.isSelected()) { + seriesAttrContents.setPosition(Constants.BOTTOM); + } else if (rigtButton != null && rigtButton.isSelected()) { + seriesAttrContents.setPosition(Constants.RIGHT); + } else if (centerButton != null && centerButton.isSelected()) { + seriesAttrContents.setPosition(Constants.CENTER); + } + + if (stylePane != null) { + stylePane.update(seriesAttrContents); + } + + seriesAttrContents.setSeriesLabel(contents); + seriesAttrContents.setFormat(format); + seriesAttrContents.setPercentFormat(percentFormat); + } + + public void checkGuidBox() { + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/GanttDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/GanttDataLabelPane.java new file mode 100644 index 000000000..f76eb8c6f --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/GanttDataLabelPane.java @@ -0,0 +1,30 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import java.awt.Component; + +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.general.Inter; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-29 + * Time : 上午10:35 + * + * 甘特图的标签界面 + */ +public class GanttDataLabelPane extends DataLabelPane { + private static final long serialVersionUID = 5409845868543668181L; + + protected Component[] createComponents4ShowCategoryName() { + if (showCategoryNameCB == null) { + showCategoryNameCB = new UICheckBox(Inter.getLocText("Chart_Step_Name")); + } + return new Component[]{null, showCategoryNameCB}; + } + + protected Component[] createComponents4Value() { + return new Component[0]; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/LineDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/LineDataLabelPane.java new file mode 100644 index 000000000..849153f92 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/LineDataLabelPane.java @@ -0,0 +1,16 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import javax.swing.*; + +/** + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-4-13 上午11:01:35 + * 类说明: 折线的标签界面 + */ +public class LineDataLabelPane extends DataLabelPane { + + protected JPanel createJPanel4Position() { + return null; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MapDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MapDataLabelPane.java new file mode 100644 index 000000000..355ec9eee --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MapDataLabelPane.java @@ -0,0 +1,19 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import javax.swing.*; + + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-29 + * Time : 上午10:34 + * 地图系列标签界面 + */ +public class MapDataLabelPane extends DataLabelPane { + + protected JPanel createJPanel4Position() { + return null; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MeterDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MeterDataLabelPane.java new file mode 100644 index 000000000..846070d2e --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MeterDataLabelPane.java @@ -0,0 +1,17 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import java.awt.*; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-29 + * Time : 上午10:37 + */ +public class MeterDataLabelPane extends DataLabelPane { + + protected Component[] createComponents4PercentValue() { + return new Component[0]; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/PieDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/PieDataLabelPane.java new file mode 100644 index 000000000..b8c291670 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/PieDataLabelPane.java @@ -0,0 +1,118 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.general.Inter; +import com.fr.stable.Constants; +import com.fr.chart.base.AttrContents; +import com.fr.design.layout.FRGUIPaneFactory; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-29 + * Time : 上午10:39 + */ +public class PieDataLabelPane extends DataLabelPane { + private JRadioButton insideButton; + private JRadioButton outSideButton; + private JCheckBox showGuidLine; + + protected Component[] createComponents4ShowGuidLine() { + if (showGuidLine == null) { + showGuidLine = new JCheckBox(Inter.getLocText("ChartF-Show_GuidLine")); + } + return new Component[]{null, showGuidLine}; + } + + private ActionListener getPositionListener() { + return new ActionListener() { + public void actionPerformed(ActionEvent e) { + checkGuidBox(); + } + }; + } + + public void checkGuidBox() { + if(insideButton != null && insideButton.isSelected()) { + showGuidLine.setSelected(false); + showGuidLine.setEnabled(false); + } + + if(outSideButton != null && outSideButton.isSelected()) { + showGuidLine.setEnabled(true); + showGuidLine.setSelected(true); + } + } + + protected JPanel createJPanel4Position() { + insideButton = new JRadioButton(Inter.getLocText("Chart_In_Pie")); + outSideButton = new JRadioButton(Inter.getLocText("Chart_Out_Pie")); + outSideButton.addActionListener(getPositionListener()); + insideButton.addActionListener(getPositionListener()); + showPercent.addActionListener(getPieLeadActionListener()); + showSeriesNameCB.addActionListener(getPieLeadActionListener()); + showCategoryNameCB.addActionListener(getPieLeadActionListener()); + showValueCB.addActionListener(getPieLeadActionListener()); + + ButtonGroup bg = new ButtonGroup(); + bg.add(insideButton); + bg.add(outSideButton); + insideButton.setSelected(true); + + JPanel buttonPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + buttonPane.add(new UILabel(Inter.getLocText(new String[]{"Label", "Layout"}) + ":")); + buttonPane.add(insideButton); + buttonPane.add(outSideButton); + + return buttonPane; + } + + private ActionListener getPieLeadActionListener() { + return new ActionListener() { + public void actionPerformed(ActionEvent e) { + checkShowLineBox(); + } + }; + } + + private void checkShowLineBox() { + if (showGuidLine != null) { + showGuidLine.setEnabled((showCategoryNameCB.isSelected() + || showSeriesNameCB.isSelected() + || showValueCB.isSelected() + || showPercent.isSelected())); + } + } + + public void populate(AttrContents seriesAttrContents) { + super.populate(seriesAttrContents); + if (showGuidLine != null) { + showGuidLine.setSelected(seriesAttrContents.isShowGuidLine()); + showGuidLine.setEnabled(showSeriesNameCB.isSelected() || showCategoryNameCB.isSelected() || showValueCB.isSelected() || showPercent.isSelected()); + } + int position = seriesAttrContents.getPosition(); + if (insideButton != null && position == Constants.INSIDE) { + insideButton.setSelected(true); + } else if (outSideButton != null && position == Constants.OUTSIDE) { + outSideButton.setSelected(true); + } + } + + public void update(AttrContents seriesAttrContents) { + super.update(seriesAttrContents); + if (showGuidLine != null && showGuidLine.isEnabled()) { + seriesAttrContents.setShowGuidLine(showGuidLine.isSelected()); + } + if (insideButton != null && insideButton.isSelected()) { + seriesAttrContents.setPosition(Constants.INSIDE); + } else if (outSideButton != null && outSideButton.isSelected()) { + seriesAttrContents.setPosition(Constants.OUTSIDE); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/RadarDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/RadarDataLabelPane.java new file mode 100644 index 000000000..ba903b05e --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/RadarDataLabelPane.java @@ -0,0 +1,17 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import javax.swing.*; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-29 + * Time : 下午2:45 + */ +public class RadarDataLabelPane extends DataLabelPane { + + protected JPanel createJPanel4Position() { + return null; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/RangeDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/RangeDataLabelPane.java new file mode 100644 index 000000000..994e5de6e --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/RangeDataLabelPane.java @@ -0,0 +1,65 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.stable.Constants; +import com.fr.general.Inter; +import com.fr.chart.base.AttrContents; +import com.fr.design.layout.FRGUIPaneFactory; + +import javax.swing.*; + +/** + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-4-13 上午10:54:56 + * 类说明: 全距图的标签界面 + */ +public class RangeDataLabelPane extends DataLabelPane { + + private JRadioButton topButton; + private JRadioButton centerButton; + private JRadioButton bottomButton; + + protected JPanel createJPanel4Position() { + topButton = new JRadioButton(Inter.getLocText("StyleAlignment-Top")); + bottomButton = new JRadioButton(Inter.getLocText("StyleAlignment-Bottom")); + centerButton = new JRadioButton(Inter.getLocText("Center")); + + ButtonGroup bg = new ButtonGroup(); + bg.add(topButton); + bg.add(bottomButton); + bg.add(centerButton); + + topButton.setSelected(true); + + JPanel buttonPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + buttonPane.add(new UILabel(Inter.getLocText(new String[]{"Label", "Layout"}) + ":")); + buttonPane.add(topButton); + buttonPane.add(bottomButton); + buttonPane.add(centerButton); + + return buttonPane; + } + + public void populate(AttrContents seriesAttrContents) { + super.populate(seriesAttrContents); + int position = seriesAttrContents.getPosition(); + if (centerButton != null && position == Constants.CENTER) { + centerButton.setSelected(true); + } else if (bottomButton != null && position == Constants.BOTTOM) { + bottomButton.setSelected(true); + } else if(topButton != null){ + topButton.setSelected(true); + } + } + + public void update(AttrContents seriesAttrContents) { + super.update(seriesAttrContents); + if (centerButton != null && centerButton.isSelected()) { + seriesAttrContents.setPosition(Constants.CENTER); + } else if (bottomButton != null && bottomButton.isSelected()) { + seriesAttrContents.setPosition(Constants.BOTTOM); + } else { + seriesAttrContents.setPosition(Constants.TOP); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/StockDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/StockDataLabelPane.java new file mode 100644 index 000000000..0560c181d --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/StockDataLabelPane.java @@ -0,0 +1,29 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import java.awt.*; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-29 + * Time : 上午10:31 + */ +public class StockDataLabelPane extends DataLabelPane { + + protected Component[] createComponents4ShowSeriesName() { + return new Component[0]; + } + + protected Component[] createComponents4ShowCategoryName() { + return new Component[0]; + } + + protected Component[] createComponents4PercentValue() { + return new Component[0]; + } + + protected Component[] createComponents4Value() { + return new Component[0]; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/XYDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/XYDataLabelPane.java new file mode 100644 index 000000000..92f428836 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/XYDataLabelPane.java @@ -0,0 +1,25 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import javax.swing.*; +import java.awt.*; + +/** + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-4-13 上午11:03:35 + * 类说明: 散点的标签界面 + */ +public class XYDataLabelPane extends DataLabelPane { + + protected JPanel createJPanel4Position() { + return null; + } + + protected Component[] createComponents4ShowCategoryName() { + return new Component[0]; + } + + protected Component[] createComponents4PercentValue() { + return new Component[0]; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Area3DPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Area3DPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..22a58aa4b --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Area3DPlotDataSeriesConditionPane.java @@ -0,0 +1,38 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.base.AttrColor; +import com.fr.chart.chartattr.Area3DPlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelBorderPane; +import com.fr.design.chart.series.SeriesCondition.LabelColorPane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午9:58 + * 三维面积图中的条件属性界面 + */ +public class Area3DPlotDataSeriesConditionPane extends DataSeriesConditionPane { + + private static final long serialVersionUID = -6553187235124152023L; + + protected void addStyleAction() { + classPaneMap.put(AttrColor.class, new LabelColorPane(this)); + } + + protected void addBorderAction() { + classPaneMap.put(AttrBorder.class, new LabelBorderPane(this)); + } + + /** + * 对应的Class + * @return 返回对应的class + */ + public Class class4Correspond() { + return Area3DPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/AreaPlotDataSeriesCondtionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/AreaPlotDataSeriesCondtionPane.java new file mode 100644 index 000000000..32d1ea9e5 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/AreaPlotDataSeriesCondtionPane.java @@ -0,0 +1,25 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.chartattr.AreaPlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午10:00 + * 面积图的条件属性界面 + */ +public class AreaPlotDataSeriesCondtionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = -7003756827950382930L; + + /** + * 返回对应的class + * @return 返回对应的class + */ + public Class class4Correspond() { + return AreaPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Bar2DTrendLineDSConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Bar2DTrendLineDSConditionPane.java new file mode 100644 index 000000000..5848ab5e3 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Bar2DTrendLineDSConditionPane.java @@ -0,0 +1,20 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrTrendLine; +import com.fr.design.chart.series.SeriesCondition.TrendLinePane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午11:19 + * 柱形图 非堆积 带趋势线的 条件属性界面 + */ +public class Bar2DTrendLineDSConditionPane extends BarPlotDataSeriesConditionPane { + private static final long serialVersionUID = -5888582645195218536L; + + protected void addTrendLineAction() { + classPaneMap.put(AttrTrendLine.class, new TrendLinePane(this)); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Bar3DPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Bar3DPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..c947322b2 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Bar3DPlotDataSeriesConditionPane.java @@ -0,0 +1,19 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.chartattr.Bar3DPlot; +import com.fr.chart.chartattr.Plot; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-1 + * Time : 上午9:27 + */ +public class Bar3DPlotDataSeriesConditionPane extends BarPlotDataSeriesConditionPane { + private static final long serialVersionUID = -2701123736889274105L; + + public Class class4Correspond() { + return Bar3DPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/BarPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/BarPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..39c8c4379 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/BarPlotDataSeriesConditionPane.java @@ -0,0 +1,27 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.chartattr.Bar2DPlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelBorderPane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6r + * Date : 11-11-30 + * Time : 上午9:59 + * 柱形图中的条件属性界面 + */ +public class BarPlotDataSeriesConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = 7887246749323167953L; + + protected void addBorderAction() { + classPaneMap.put(AttrBorder.class, new LabelBorderPane(this)); + } + + public Class class4Correspond() { + return Bar2DPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/BubblePlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/BubblePlotDataSeriesConditionPane.java new file mode 100644 index 000000000..297a553dd --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/BubblePlotDataSeriesConditionPane.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrColor; +import com.fr.chart.chartattr.BubblePlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelColorPane; + +/** + * 气泡图 条件显示 界面. + * Created by kunsnat on 14-3-11. + * kunsnat@gmail.com + */ +public class BubblePlotDataSeriesConditionPane extends DataSeriesConditionPane { + + protected void addStyleAction() { + classPaneMap.put(AttrColor.class, new LabelColorPane(this)); + } + + /** + * 返回对应的class + * @return 返回class + */ + public Class class4Correspond() { + return BubblePlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPopAttrPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPopAttrPane.java new file mode 100644 index 000000000..14008cf9a --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPopAttrPane.java @@ -0,0 +1,152 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.util.List; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; + +import com.fr.base.Parameter; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.web.ChartHyperPoplink; +import com.fr.design.gui.frpane.ReportletParameterViewPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.itextfield.UINumberField; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.general.Inter; +import com.fr.stable.ParameterProvider; +import com.fr.stable.StringUtils; +import com.fr.design.utils.gui.GUICoreUtils; + +/** + * 图表弹出超链, 悬浮窗属性设置界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-8-6 上午09:39:22 + */ +public class ChartHyperPopAttrPane extends AbstractChartAttrPane { + + private UITextField titleField; + private UINumberField widthField; + private UINumberField heightField; + private ReportletParameterViewPane parameterViewPane; + + public static final int DEFAULT_H_VALUE = 270; + public static final int DEFAULT_V_VALUE = 500; + + private int paraType; + + public ChartHyperPopAttrPane(int paraType) { + this.paraType = paraType; + + initAll(); + } + + @Override + protected JPanel createContentPane() { + JPanel pane = new JPanel(); + pane.setLayout(FRGUIPaneFactory.createBorderLayout()); + + titleField = new UITextField(15); + titleField.setPreferredSize(new Dimension(200, 20)); + + widthField = new UINumberField(4); + widthField.setColumns(10); + widthField.setPreferredSize(new Dimension(200, 20)); + + heightField = new UINumberField(4); + heightField.setColumns(10); + heightField.setPreferredSize(new Dimension(200, 20)); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + double[] columnSize = { p,f}; + double[] rowSize = { p,p,p,p,p,p}; + + Component[][] components = new Component[][]{ + new Component[]{new BoldFontTextLabel(Inter.getLocText("FR-Designer-Widget-Style_Title") + ":", SwingConstants.RIGHT), titleField}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("FR-Designer_Width") + ":", SwingConstants.RIGHT), widthField}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("FR-Designer_Height") + ":", SwingConstants.RIGHT), heightField}, + }; + + widthField.setText(String.valueOf(DEFAULT_V_VALUE)); + heightField.setText(String.valueOf(DEFAULT_H_VALUE)); + + JPanel northPane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + pane.add(northPane, BorderLayout.NORTH); + + parameterViewPane = new ReportletParameterViewPane(paraType); + parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Parameter"))); + parameterViewPane.setPreferredSize(new Dimension(200, 200)); + pane.add(parameterViewPane, BorderLayout.CENTER); + + return pane; + } + + public void populateBean(ChartHyperPoplink chartHyperlink) { + + titleField.setText(chartHyperlink.getChartDigTitle()); + widthField.setText(String.valueOf(chartHyperlink.getWidth())); + heightField.setText(String.valueOf(chartHyperlink.getHeight())); + + List parameterList = this.parameterViewPane.update(); + parameterList.clear(); + + ParameterProvider[] parameters = chartHyperlink.getParameters(); + parameterViewPane.populate(parameters); + } + + /** + * 属性表 对应update + */ + public void updateBean(ChartHyperPoplink chartHyperlink) { + String title = titleField.getText(); + if (StringUtils.isBlank(title)) { + title = "Chart"; + } + chartHyperlink.setChartDigTitle(title); + chartHyperlink.setWidth((int)widthField.getValue()); + chartHyperlink.setHeight((int)heightField.getValue()); + + List parameterList = this.parameterViewPane.update(); + if (!parameterList.isEmpty()) { + Parameter[] parameters = new Parameter[parameterList.size()]; + parameterList.toArray(parameters); + + chartHyperlink.setParameters(parameters); + } else { + chartHyperlink.setParameters(null); + } + } + + @Override + public void populate(ChartCollection collection) { + // do nothing + } + + @Override + public void update(ChartCollection collection) { + // do nothing + } + + @Override + public String getIconPath() { + return "com/fr/design/images/chart/link.png"; + } + + + /** + * 界面标题 + * @return 标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("FR-Hyperlink_ChartHyperlink"); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java new file mode 100644 index 000000000..c0fe8d914 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java @@ -0,0 +1,174 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.base.chart.BaseChartCollection; +import com.fr.chart.chartattr.Bar2DPlot; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.ChartFactory; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.chart.web.ChartHyperPoplink; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.itableeditorpane.ParameterTableModel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.ChartHyperEditPane; +import com.fr.general.Inter; +import com.fr.design.utils.gui.GUICoreUtils; + +import java.awt.*; + +/** + * 类说明: 图表超链 -- 弹出 悬浮窗. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2011-12-28 上午10:41:39 + */ +public class ChartHyperPoplinkPane extends BasicBeanPane { + private static final long serialVersionUID = 2469115951510144738L; + private UITextField itemNameTextField; + private ChartHyperEditPane hyperEditPane; + private ChartComponent chartComponent; + + public ChartHyperPoplinkPane() { + this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); + + if(this.needRenamePane()){ + itemNameTextField = new UITextField(); + this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("FR-Chart-Use_Name") + ":"), BorderLayout.NORTH); + } + + hyperEditPane = new ChartHyperEditPane(getChartParaType()); + this.add(hyperEditPane, BorderLayout.CENTER); + + ChartCollection cc = new ChartCollection(); + cc.addChart(new Chart(new Bar2DPlot())); + + chartComponent = new ChartComponent(); + chartComponent.setPreferredSize(new Dimension(220, 170));// 在单元格弹出时 需要调整保证属性表的大小. + chartComponent.setSupportEdit(false); + chartComponent.populate(cc); + + this.add(chartComponent, BorderLayout.EAST); + + hyperEditPane.populate(cc); + + hyperEditPane.useChartComponent(chartComponent); + } + + protected int getChartParaType() { + return ParameterTableModel.CHART_NORMAL_USE; + } + + /** + * 是否需要加载重命名的空间 + * @return 默认需要加载 + */ + protected boolean needRenamePane(){ + return true; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Pop_Chart"); + } + + @Override + public void populateBean(ChartHyperPoplink chartHyperlink) { + if(itemNameTextField != null){ + this.itemNameTextField.setText(chartHyperlink.getItemName()); + } + + BaseChartCollection cc = chartHyperlink.getChartCollection(); + if (cc == null || cc.getChartCount() < 1) { + cc = new ChartCollection(); + cc.addChart(new Chart(ChartFactory.createBar2DPlot())); + chartHyperlink.setChartCollection(cc); + } + + hyperEditPane.populateHyperLink(chartHyperlink); + chartComponent.populate(cc); + } + + /** + * 超链数组HyperlinkGoup切换时 updateBean. + * @return 返回的弹出超链. + */ + public ChartHyperPoplink updateBean() { + ChartHyperPoplink chartLink = new ChartHyperPoplink(); + updateBean(chartLink); + if(itemNameTextField != null){ + chartLink.setItemName(this.itemNameTextField.getText()); + } + return chartLink; + } + + /** + * 属性表 对应update + */ + public void updateBean(ChartHyperPoplink chartHyperlink) { + hyperEditPane.updateHyperLink(chartHyperlink); + chartHyperlink.setChartCollection(chartComponent.update()); + + ChartEditPane.getInstance().fire();// 响应整个图表保存事件等. + if(itemNameTextField != null){ + chartHyperlink.setItemName(this.itemNameTextField.getText()); + } + } + + public static class CHART_NO_RENAME extends ChartHyperPoplinkPane{ + protected boolean needRenamePane(){ + return false; + } + } + + public static class CHART_MAP extends ChartHyperPoplinkPane { + + protected int getChartParaType() { + return ParameterTableModel.CHART_MAP_USE; + } + } + + public static class CHART_GIS extends ChartHyperPoplinkPane { + + protected int getChartParaType() { + return ParameterTableModel.CHART_GIS_USE; + } + } + + public static class CHART_PIE extends ChartHyperPoplinkPane { + @Override + protected int getChartParaType() { + return ParameterTableModel.CHART_PIE_USE; + } + } + + public static class CHART_XY extends ChartHyperPoplinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART__XY_USE; + } + } + + public static class CHART_BUBBLE extends ChartHyperPoplinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_BUBBLE_USE; + } + } + + public static class CHART_STOCK extends ChartHyperPoplinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_STOCK_USE; + } + } + + public static class CHART_GANTT extends ChartHyperPoplinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_GANTT_USE; + } + } + + public static class CHART_METER extends ChartHyperPoplinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_METER_USE; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java new file mode 100644 index 000000000..a0b161a0f --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java @@ -0,0 +1,182 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.base.Utils; +import com.fr.chart.web.ChartHyperRelateCellLink; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.columnrow.ColumnRowVerticalPane; +import com.fr.design.gui.frpane.ReportletParameterViewPane; +import com.fr.design.gui.itableeditorpane.ParameterTableModel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.stable.ColumnRow; +import com.fr.stable.ParameterProvider; +import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.*; +import java.awt.*; +import java.util.List; + +/** + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2011-12-28 下午02:51:10 + * 类说明: 图表超链 -- 关联单元格图表. + */ +public class ChartHyperRelateCellLinkPane extends BasicBeanPane{ + private static final long serialVersionUID = 7874948047886548990L; + + private UITextField itemNameTextField; + private ColumnRowVerticalPane colRowPane; + private ReportletParameterViewPane parameterViewPane; + + public ChartHyperRelateCellLinkPane() { + this.initComponent(); + } + + private void initComponent() { + this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); + if(needRenamePane()){ + itemNameTextField = new UITextField(); + this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("Name") + ":"), BorderLayout.NORTH); + } + + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + this.add(centerPane, BorderLayout.CENTER); + + centerPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"Related", "Cell"}))); + + colRowPane = new ColumnRowVerticalPane(); + centerPane.add(colRowPane, BorderLayout.NORTH); + + parameterViewPane = new ReportletParameterViewPane(getChartParaType()); + parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Parameters"))); + parameterViewPane.setPreferredSize(new Dimension(500, 200)); + this.add(parameterViewPane, BorderLayout.SOUTH); + } + + protected int getChartParaType() { + return ParameterTableModel.CHART_NORMAL_USE; + } + + /** + * 是否需要加载重命名的空间 + * @return 默认需要加载 + */ + protected boolean needRenamePane(){ + return true; + } + + @Override + public void populateBean(ChartHyperRelateCellLink ob) { + if(ob == null) { + return; + } + if(itemNameTextField != null){ + itemNameTextField.setText(ob.getItemName()); + } + if(ob.getRelateCCName() != null) { + ColumnRow colRow = ColumnRow.valueOf(ob.getRelateCCName()); + colRowPane.populate(colRow); + } else { + colRowPane.populate(ColumnRow.valueOf("A1")); + } + + List parameterList = this.parameterViewPane.update(); + parameterList.clear(); + + ParameterProvider[] parameters = ob.getParameters(); + parameterViewPane.populate(parameters); + } + + @Override + public ChartHyperRelateCellLink updateBean() { + ChartHyperRelateCellLink chartLink = new ChartHyperRelateCellLink(); + updateBean(chartLink); + if(itemNameTextField != null){ + chartLink.setItemName(this.itemNameTextField.getText()); + } + return chartLink; + } + + /** + * 属性表 对应update + */ + public void updateBean(ChartHyperRelateCellLink chartLink) { + chartLink.setRelateCCName(Utils.objectToString(colRowPane.update())); + + List parameterList = this.parameterViewPane.update(); + if (parameterList != null && !parameterList.isEmpty()) { + ParameterProvider[] parameters = new ParameterProvider[parameterList.size()]; + parameterList.toArray(parameters); + + chartLink.setParameters(parameters); + } else { + chartLink.setParameters(null); + } + if(itemNameTextField != null){ + chartLink.setItemName(this.itemNameTextField.getText()); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Related", "Cell"}); + } + + public static class CHART_NO_RENAME extends ChartHyperRelateCellLinkPane{ + protected boolean needRenamePane(){ + return false; + } + } + + public static class CHART_MAP extends ChartHyperRelateCellLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_MAP_USE; + } + } + + public static class CHART_GIS extends ChartHyperRelateCellLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_GIS_USE; + } + } + + public static class CHART_PIE extends ChartHyperRelateCellLinkPane { + @Override + protected int getChartParaType() { + return ParameterTableModel.CHART_PIE_USE; + } + }; + + + public static class CHART_XY extends ChartHyperRelateCellLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART__XY_USE; + } + } + + public static class CHART_BUBBLE extends ChartHyperRelateCellLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_BUBBLE_USE; + } + } + + public static class CHART_STOCK extends ChartHyperRelateCellLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_STOCK_USE; + } + } + + public static class CHART_GANTT extends ChartHyperRelateCellLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_GANTT_USE; + } + } + + public static class CHART_METER extends ChartHyperRelateCellLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_METER_USE; + } + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java new file mode 100644 index 000000000..2a13a6e37 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java @@ -0,0 +1,199 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.base.Utils; +import com.fr.chart.web.ChartHyperRelateFloatLink; +import com.fr.design.DesignModelAdapter; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.frpane.ReportletParameterViewPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itableeditorpane.ParameterTableModel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.stable.ParameterProvider; +import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.*; +import javax.swing.border.Border; +import javax.swing.border.TitledBorder; +import java.awt.*; +import java.util.List; + +/** + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2011-12-28 下午03:02:43 + * 类说明: 图表超链 关联悬浮元素 + */ +public class ChartHyperRelateFloatLinkPane extends BasicBeanPane { + private static final long serialVersionUID = -3308412003405587689L; + + private UITextField itemNameTextField; + + private UIComboBox floatNameBox; + private ReportletParameterViewPane parameterViewPane; + + public ChartHyperRelateFloatLinkPane() { + this.initComponent(); + } + + private void initComponent() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + + if(needRenamePane()){ + itemNameTextField = new UITextField(); + this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("Name") + ":"), BorderLayout.NORTH); + } + + this.add(centerPane, BorderLayout.CENTER); + floatNameBox = new UIComboBox(getFloatNames()); + floatNameBox.setPreferredSize(new Dimension(90, 20)); + + JPanel pane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); + pane.add(new UILabel(Inter.getLocText("M_Insert-Float") + ":")); + pane.add(floatNameBox); + + Border boder = null; + Font font = null; + TitledBorder border = new TitledBorder(boder, Inter.getLocText(new String[]{"Related", "M_Insert-Float"}), 4, 2, font, new Color(1, 159, 222)); + // 圆角不行 + centerPane.setBorder(border); + + centerPane.add(pane, BorderLayout.NORTH); + + parameterViewPane = new ReportletParameterViewPane(getChartParaType()); + parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Parameters"))); + parameterViewPane.setPreferredSize(new Dimension(500, 200)); + this.add(parameterViewPane, BorderLayout.SOUTH); + } + + protected int getChartParaType() { + return ParameterTableModel.CHART_NORMAL_USE; + } + + /** + * 是否需要加载重命名的空间 + * @return 默认需要加载 + */ + protected boolean needRenamePane(){ + return true; + } + + private String[] getFloatNames() { + DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); + if(adapter != null ) { + return adapter.getFloatNames(); + } + return new String[0]; + } + + @Override + public void populateBean(ChartHyperRelateFloatLink ob) { + if(ob == null) { + return ; + } + + if(itemNameTextField != null){ + itemNameTextField.setText(ob.getItemName()); + } + + floatNameBox.setSelectedItem(ob.getRelateCCName()); + + List parameterList = this.parameterViewPane.update(); + parameterList.clear(); + + ParameterProvider[] parameters = ob.getParameters(); + parameterViewPane.populate(parameters); + } + + @Override + public ChartHyperRelateFloatLink updateBean() { + ChartHyperRelateFloatLink chartLink = new ChartHyperRelateFloatLink(); + updateBean(chartLink); + if(itemNameTextField != null){ + chartLink.setItemName(this.itemNameTextField.getText()); + } + return chartLink; + } + + public void updateBean(ChartHyperRelateFloatLink chartLink) { + + if(floatNameBox.getSelectedItem() != null) { + chartLink.setRelateCCName(Utils.objectToString(floatNameBox.getSelectedItem())); + } + + List parameterList = this.parameterViewPane.update(); + if (parameterList != null && !parameterList.isEmpty()) { + ParameterProvider[] parameters = new ParameterProvider[parameterList.size()]; + parameterList.toArray(parameters); + + chartLink.setParameters(parameters); + } else { + chartLink.setParameters(null); + } + if(itemNameTextField != null){ + chartLink.setItemName(this.itemNameTextField.getText()); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"Related", "M_Insert-Float"}); + } + + public static class CHART_NO_RENAME extends ChartHyperRelateFloatLinkPane{ + protected boolean needRenamePane(){ + return false; + } + } + + public static final class CHART_MAP extends ChartHyperRelateFloatLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_MAP_USE; + } + } + + public static final class CHART_GIS extends ChartHyperRelateFloatLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_GIS_USE; + } + } + + public static final class CHART_PIE extends ChartHyperRelateFloatLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_PIE_USE; + } + } + + public static class CHART_XY extends ChartHyperRelateFloatLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART__XY_USE; + } + } + + public static class CHART_BUBBLE extends ChartHyperRelateFloatLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_BUBBLE_USE; + } + } + + public static class CHART_STOCK extends ChartHyperRelateFloatLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_STOCK_USE; + } + } + + public static class CHART_GANTT extends ChartHyperRelateFloatLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_GANTT_USE; + } + } + + public static class CHART_METER extends ChartHyperRelateFloatLinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_METER_USE; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4AreaConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4AreaConditionPane.java new file mode 100644 index 000000000..383ab0ec0 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4AreaConditionPane.java @@ -0,0 +1,17 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrAxisPosition; +import com.fr.design.chart.series.SeriesCondition.LabelAxisPositionPane; + +/** + * 类说明: 组合图中 堆积面积图(无趋势线)条件属性界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-4-20 下午05:28:52 + */ +public class CustomPlot4AreaConditionPane extends AreaPlotDataSeriesCondtionPane { + private static final long serialVersionUID = 6938149100125099651L; + + protected void addAxisPositionAction() { + classPaneMap.put(AttrAxisPosition.class, new LabelAxisPositionPane(this)); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4BarNoTrendLineConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4BarNoTrendLineConditionPane.java new file mode 100644 index 000000000..316009763 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4BarNoTrendLineConditionPane.java @@ -0,0 +1,17 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrAxisPosition; +import com.fr.design.chart.series.SeriesCondition.LabelAxisPositionPane; + +/** + * 类说明: 组合图中 柱形的条件属性界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-4-20 下午05:14:44 + */ +public class CustomPlot4BarNoTrendLineConditionPane extends BarPlotDataSeriesConditionPane { + private static final long serialVersionUID = -6960758805042551364L; + + protected void addAxisPositionAction() { + classPaneMap.put(AttrAxisPosition.class, new LabelAxisPositionPane(this)); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4BarTrendLineConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4BarTrendLineConditionPane.java new file mode 100644 index 000000000..9683c9765 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4BarTrendLineConditionPane.java @@ -0,0 +1,17 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrAxisPosition; +import com.fr.design.chart.series.SeriesCondition.LabelAxisPositionPane; + +/** + * 类说明: 组合图中 非堆积 带趋势线的条件属性界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-4-20 下午05:23:38 + */ +public class CustomPlot4BarTrendLineConditionPane extends Bar2DTrendLineDSConditionPane { + private static final long serialVersionUID = 5216036756293601852L; + + protected void addAxisPositionAction() { + classPaneMap.put(AttrAxisPosition.class, new LabelAxisPositionPane(this)); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4LineConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4LineConditionPane.java new file mode 100644 index 000000000..79322ecd9 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlot4LineConditionPane.java @@ -0,0 +1,17 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrAxisPosition; +import com.fr.design.chart.series.SeriesCondition.LabelAxisPositionPane; + +/** + * 类说明: 组合图中 折线类型 非堆积 带趋势线的条件属性界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-4-20 下午05:27:35 + */ +public class CustomPlot4LineConditionPane extends LinePlotDataSeriesConditionPane { + private static final long serialVersionUID = -5614266090158187836L; + + protected void addAxisPositionAction() { + classPaneMap.put(AttrAxisPosition.class, new LabelAxisPositionPane(this)); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..306c9e86c --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/CustomPlotDataSeriesConditionPane.java @@ -0,0 +1,22 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrAxisPosition; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelAxisPositionPane; + +/** + * 组合图 条件属性界面. + * + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午10:01 + */ +public class CustomPlotDataSeriesConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = -6140023104743692628L; + + protected void addAxisPositionAction() { + classPaneMap.put(AttrAxisPosition.class, new LabelAxisPositionPane(this)); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/DataSeriesConditionPaneFactory.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/DataSeriesConditionPaneFactory.java new file mode 100644 index 000000000..b40d1161d --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/DataSeriesConditionPaneFactory.java @@ -0,0 +1,75 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.chartattr.*; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.DataSeriesCustomConditionPane; +import com.fr.design.condition.ConditionAttributesPane; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午10:25 + * 系列的条件属性 工厂. + * 不包括组合图.(ps 组合图是用组合类型界面拼凑的) + */ +public class DataSeriesConditionPaneFactory { + private static final String TREND = ".TrendLine"; + + private static Map> map = new HashMap>(); + + static { + map.put(Area3DPlot.class.getName(), Area3DPlotDataSeriesConditionPane.class); + map.put(AreaPlot.class.getName(), AreaPlotDataSeriesCondtionPane.class); + map.put(BarPlot.class.getName(), BarPlotDataSeriesConditionPane.class); + map.put(Bar3DPlot.class.getName(), Bar3DPlotDataSeriesConditionPane.class); + map.put(Bar2DPlot.class.getName() + TREND, Bar2DTrendLineDSConditionPane.class); + map.put(BubblePlot.class.getName(), BubblePlotDataSeriesConditionPane.class); + map.put(GanttPlot.class.getName(), GanttPlotDataSeriesConditionPane.class); + map.put(LinePlot.class.getName() + TREND, LinePlotDataSeriesConditionPane.class); + map.put(PiePlot.class.getName(), PiePlotDataSeriesConditionPane.class); + map.put(Pie3DPlot.class.getName(), Pie3DPlotDataSeriesConditionPane.class); + map.put(RadarPlot.class.getName(), RadarPlotDataSeriesConditionPane.class); + map.put(StockPlot.class.getName(), StockPlotDataSeriesConditionPane.class); + map.put(XYScatterPlot.class.getName() + TREND, XYScatterPlotDataSeriesConditionPane.class); + map.put(MapPlot.class.getName(), MapPlotDataSeriesConditionPane.class); + map.put(CustomPlot.class.getName(), DataSeriesCustomConditionPane.class); + map.put(Donut2DPlot.class.getName(), Donut2DPlotDataSeriesConditionPane.class); + } + + private DataSeriesConditionPaneFactory() { + + } + + /** + * 找到Plot条件界面对应的DataSeries的. + * @param plot 对应Plot + * @return 返回class对应的属性界面. + */ + public static Class findConfitionPane4DataSeries(Plot plot) { + if (plot == null) { + return DataSeriesConditionPane.class; + } + boolean isSupportTrendLine = plot.isSupportTrendLine(); + return searchSuitableClass(plot.getClass(), isSupportTrendLine); + } + + private static Class searchSuitableClass(Class plotCls, boolean isSupportTrendLine) { + if (plotCls == null) { + return DataSeriesConditionPane.class; + } + String plotClsName = plotCls.getName(); + if (isSupportTrendLine) { + plotClsName += TREND; + } + Class resClass = map.get(plotClsName); + if (resClass != null) { + return resClass; + } + return searchSuitableClass(plotCls.getSuperclass(), isSupportTrendLine); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Donut2DPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Donut2DPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..dc9af083e --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Donut2DPlotDataSeriesConditionPane.java @@ -0,0 +1,20 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.chartattr.Donut2DPlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelBorderPane; + +public class Donut2DPlotDataSeriesConditionPane extends DataSeriesConditionPane{ + private static final long serialVersionUID = -8816067568992838526L; + + protected void addBorderAction() { + classPaneMap.put(AttrBorder.class, new LabelBorderPane(this)); + } + + public Class class4Correspond() { + return Donut2DPlot.class; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java new file mode 100644 index 000000000..39d3d17b9 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java @@ -0,0 +1,135 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + + +import java.awt.BorderLayout; +import java.awt.Component; + +import javax.swing.DefaultListCellRenderer; +import javax.swing.JList; +import javax.swing.JPanel; + +import com.fr.design.DesignModelAdapter; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.form.ui.Widget; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; +import com.fr.js.FormHyperlinkProvider; +import com.fr.stable.bridge.StableFactory; + +/** + + * Created with IntelliJ IDEA. + + * User: zx + + * Date: 14-8-6 + + * Time: 下午2:53 + + */ +public class FormHyperlinkNorthPane extends BasicBeanPane { + + private UITextField itemNameTextField; + private boolean needRenamePane = false; + private Widget[] formHyperlinkEditors; + private UIComboBox targetFrameComboBox; + + public FormHyperlinkNorthPane(boolean needRenamePane) { + this.needRenamePane = needRenamePane; + this.initComponents(); + } + + protected void initComponents() { + this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + + this.add(centerPane, BorderLayout.CENTER); + formHyperlinkEditors = getFormHyperlinkEditors(); + targetFrameComboBox = formHyperlinkEditors == null ? new UIComboBox() : new UIComboBox(getFormHyperlinkEditNames()); + targetFrameComboBox.setRenderer(new DefaultListCellRenderer() { + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + return this; + } + }); + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p}; + double[] columnSize = {p, TableLayout.FILL}; + Component[][] components; + if(!this.needRenamePane){ + components = new Component[][]{ + {new UILabel(Inter.getLocText("FR-Designer_Form-Object")), targetFrameComboBox}, + }; + }else{ + itemNameTextField = new UITextField(); + components = new Component[][]{ + {new UILabel(Inter.getLocText("FR-Designer_Name_has_Colon")), itemNameTextField}, + {new UILabel(Inter.getLocText("FR-Designer_Form-Object")), targetFrameComboBox}, + }; + } + JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + centerPane.add(northPane, BorderLayout.NORTH); + } + + public Widget getEditingEditor(){ + if (formHyperlinkEditors == null){ + return null; + } + String editingEditorName = (String)targetFrameComboBox.getSelectedItem(); + for (Widget editor : formHyperlinkEditors){ + if (ComparatorUtils.equals(editingEditorName,editor.getWidgetName())){ + return editor; + } + } + return null; + } + + private Widget[] getFormHyperlinkEditors(){ + return DesignModelAdapter.getCurrentModelAdapter().getLinkableWidgets(); + } + + + private String[] getFormHyperlinkEditNames(){ + String[] editorNames = new String[formHyperlinkEditors.length]; + int i =0; + for(Widget editor : formHyperlinkEditors){ + editorNames[i] = editor.getWidgetName(); + i++; + } + return editorNames; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Hyperlink-Form_link"); + } + + @Override + public void populateBean(FormHyperlinkProvider formHyperlink) { + if(itemNameTextField != null){ + this.itemNameTextField.setText(formHyperlink.getItemName()); + } + String editorName = formHyperlink.getRelateEditorName(); + //防止初始的时候有空白选项 + if (editorName == null){ + return; + } + targetFrameComboBox.setSelectedItem(editorName); + } + + + @Override + public FormHyperlinkProvider updateBean() { + FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); + updateBean(formHyperlink); + return formHyperlink; + } + + public void updateBean(FormHyperlinkProvider formHyperlink) { + if(itemNameTextField != null){ + formHyperlink.setItemName(this.itemNameTextField.getText()); + } + formHyperlink.setRelateEditorName((String) targetFrameComboBox.getSelectedItem()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java new file mode 100644 index 000000000..d87ccbb8f --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java @@ -0,0 +1,161 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import java.awt.BorderLayout; + +import javax.swing.BorderFactory; + +import com.fr.base.Parameter; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.frpane.ReportletParameterViewPane; +import com.fr.design.gui.itableeditorpane.ParameterTableModel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.form.ui.ElementCaseEditorProvider; +import com.fr.general.Inter; +import com.fr.js.FormHyperlinkProvider; +import com.fr.stable.ParameterProvider; +import com.fr.stable.bridge.StableFactory; + +public class FormHyperlinkPane extends BasicBeanPane { + + private ReportletParameterViewPane parameterViewPane; + private FormHyperlinkNorthPane northPane; + + public FormHyperlinkPane() { + super(); + this.initComponents(); + } + + protected void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + northPane = new FormHyperlinkNorthPane(needRenamePane()); + this.add(northPane, BorderLayout.NORTH); + + parameterViewPane = new ReportletParameterViewPane(getChartParaType()); + this.add(parameterViewPane, BorderLayout.CENTER); + parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Parameters"), null)); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Hyperlink-Form_link"); + } + + protected int getChartParaType() { + return ParameterTableModel.NO_CHART_USE; + } + + protected boolean needRenamePane(){ + return getChartParaType() != ParameterTableModel.NO_CHART_USE; + } + + protected int getHyperlinkType() { + if (northPane.getEditingEditor() != null){ + if (northPane.getEditingEditor().acceptType(ElementCaseEditorProvider.class)) { + return FormHyperlinkProvider.ELEMENTCASE; + } + } + return FormHyperlinkProvider.CHART; + } + + @Override + public void populateBean(FormHyperlinkProvider formHyperlink) { + northPane.populateBean(formHyperlink); + //parameter + java.util.List parameterList = this.parameterViewPane.update(); + parameterList.clear(); + + ParameterProvider[] parameters = formHyperlink.getParameters(); + parameterViewPane.populate(parameters); + } + + @Override + public FormHyperlinkProvider updateBean() { + FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); + formHyperlink.setType(getHyperlinkType()); + updateBean(formHyperlink); + + return formHyperlink; + } + + public void updateBean(FormHyperlinkProvider formHyperlink) { + formHyperlink.setType(getHyperlinkType()); + + northPane.updateBean(formHyperlink); + //Parameter. + java.util.List parameterList = this.parameterViewPane.update(); + if (!parameterList.isEmpty()) { + Parameter[] parameters = new Parameter[parameterList.size()]; + parameterList.toArray(parameters); + + formHyperlink.setParameters(parameters); + } + } + + public static class CHART_NO_RENAME extends FormHyperlinkPane{ + protected boolean needRenamePane(){ + return false; + } + protected int getChartParaType() { + return ParameterTableModel.CHART_NORMAL_USE; + } + } + + public static class CHART extends FormHyperlinkPane { + @Override + protected int getChartParaType() { + return ParameterTableModel.CHART_NORMAL_USE; + } + } + + public static class CHART_MAP extends FormHyperlinkPane { + @Override + protected int getChartParaType() { + return ParameterTableModel.CHART_MAP_USE; + } + } + + public static class CHART_GIS extends FormHyperlinkPane{ + protected int getChartParaType() { + return ParameterTableModel.CHART_GIS_USE; + } + } + + public static class CHART_PIE extends FormHyperlinkPane { + @Override + protected int getChartParaType() { + return ParameterTableModel.CHART_PIE_USE; + } + }; + + public static class CHART_XY extends FormHyperlinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART__XY_USE; + } + } + + public static class CHART_BUBBLE extends FormHyperlinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_BUBBLE_USE; + } + } + + public static class CHART_STOCK extends FormHyperlinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_STOCK_USE; + } + } + + public static class CHART_GANTT extends FormHyperlinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_GANTT_USE; + } + } + + public static class CHART_METER extends FormHyperlinkPane { + protected int getChartParaType() { + return ParameterTableModel.CHART_METER_USE; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/GanttPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/GanttPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..c58b50a57 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/GanttPlotDataSeriesConditionPane.java @@ -0,0 +1,41 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrAlpha; +import com.fr.chart.base.AttrColor; +import com.fr.chart.chartattr.GanttPlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane; +import com.fr.design.chart.series.SeriesCondition.LabelColorPane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午9:56 + */ +public class GanttPlotDataSeriesConditionPane extends DataSeriesConditionPane { + + private static final long serialVersionUID = 2558855009849187262L; + + protected void addBasicAction() { + classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); + } + + protected void addStyleAction() { + classPaneMap.put(AttrColor.class, new LabelColorPane(this)); + } + + protected void addBorderAction() { + + } + + protected void addTrendLineAction() { + + } + + public Class class4Correspond() { + return GanttPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/LinePlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/LinePlotDataSeriesConditionPane.java new file mode 100644 index 000000000..a12c552ac --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/LinePlotDataSeriesConditionPane.java @@ -0,0 +1,30 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrColor; +import com.fr.chart.base.AttrLineStyle; +import com.fr.chart.base.AttrMarkerType; +import com.fr.chart.base.AttrTrendLine; +import com.fr.chart.chartattr.LinePlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.*; + +/** + * 折线图(无趋势线)中的条件属性界面. + */ +public class LinePlotDataSeriesConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = 90767073697041627L; + + protected void addStyleAction() { + classPaneMap.put(AttrColor.class, new LabelColorPane(this)); + classPaneMap.put(AttrLineStyle.class, new LabelLineStylePane(this)); + classPaneMap.put(AttrMarkerType.class, new LineMarkerTypePane(this)); + } + + protected void addTrendLineAction() { + classPaneMap.put(AttrTrendLine.class, new TrendLinePane(this)); + } + + public Class class4Correspond() { + return LinePlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/MapPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/MapPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..5ed5fb62e --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/MapPlotDataSeriesConditionPane.java @@ -0,0 +1,31 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrContents; +import com.fr.chart.chartattr.MapPlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelContentsPane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-1 + * Time : 上午9:32 + * 地图 条件属性界面 + */ +public class MapPlotDataSeriesConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = 3698292568618077981L; + + protected void addBasicAction() { + classPaneMap.put(AttrContents.class, new LabelContentsPane(this, class4Correspond())); + } + + /** + * 返回界面对应的class + * @return 返回界面对应class + */ + public Class class4Correspond() { + return MapPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/MeterPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/MeterPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..c42d5f775 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/MeterPlotDataSeriesConditionPane.java @@ -0,0 +1,21 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.chartattr.MeterPlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-12-1 + * Time : 上午9:34 + * 仪表盘 条件属性界面 + */ +public class MeterPlotDataSeriesConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = -1476436318592049848L; + + public Class class4Correspond() { + return MeterPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Pie3DPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Pie3DPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..790f6d0cc --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/Pie3DPlotDataSeriesConditionPane.java @@ -0,0 +1,27 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrColor; +import com.fr.chart.chartattr.PiePlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelColorPane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午9:59 + * 三维饼图的条件属性界面 + */ +public class Pie3DPlotDataSeriesConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = 4137513003721586526L; + + protected void addStyleAction() { + classPaneMap.put(AttrColor.class, new LabelColorPane(this)); + } + + public Class class4Correspond() { + return PiePlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/PiePlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/PiePlotDataSeriesConditionPane.java new file mode 100644 index 000000000..59493955a --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/PiePlotDataSeriesConditionPane.java @@ -0,0 +1,28 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.chartattr.PiePlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelBorderPane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午10:01 + * 饼图 条件属性界面 + */ + +public class PiePlotDataSeriesConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = 7442193860514835962L; + + protected void addBorderAction() { + classPaneMap.put(AttrBorder.class, new LabelBorderPane(this)); + } + + public Class class4Correspond() { + return PiePlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/RadarPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/RadarPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..578d300b6 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/RadarPlotDataSeriesConditionPane.java @@ -0,0 +1,33 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrColor; +import com.fr.chart.base.AttrLineStyle; +import com.fr.chart.base.AttrMarkerType; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartattr.RadarPlot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.LabelColorPane; +import com.fr.design.chart.series.SeriesCondition.LabelLineStylePane; +import com.fr.design.chart.series.SeriesCondition.LineMarkerTypePane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午9:57 + * 雷达图条件属性界面 + */ +public class RadarPlotDataSeriesConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = 4134539843311969532L; + + protected void addStyleAction() { + classPaneMap.put(AttrColor.class, new LabelColorPane(this)); + classPaneMap.put(AttrLineStyle.class, new LabelLineStylePane(this)); + classPaneMap.put(AttrMarkerType.class, new LineMarkerTypePane(this)); + } + + public Class class4Correspond() { + return RadarPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/StockPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/StockPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..b33f44cbd --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/StockPlotDataSeriesConditionPane.java @@ -0,0 +1,27 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrTrendLine; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartattr.StockPlot; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.TrendLinePane; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午9:56 + * 股价图的条件属性界面 + */ +public class StockPlotDataSeriesConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = 1348842506599776627L; + + protected void addTrendLineAction() { + classPaneMap.put(AttrTrendLine.class, new TrendLinePane(this)); + } + + public Class class4Correspond() { + return StockPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/XYScatterPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/XYScatterPlotDataSeriesConditionPane.java new file mode 100644 index 000000000..26dfb6712 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/XYScatterPlotDataSeriesConditionPane.java @@ -0,0 +1,35 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.base.AttrColor; +import com.fr.chart.base.AttrLineStyle; +import com.fr.chart.base.AttrMarkerType; +import com.fr.chart.base.AttrTrendLine; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartattr.XYScatterPlot; +import com.fr.design.chart.series.SeriesCondition.*; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date : 11-11-30 + * Time : 上午9:53 + * 散点图的条件属性界面 + */ +public class XYScatterPlotDataSeriesConditionPane extends DataSeriesConditionPane { + private static final long serialVersionUID = -2552214303519434824L; + + protected void addStyleAction() { + classPaneMap.put(AttrColor.class, new LabelColorPane(this)); + classPaneMap.put(AttrLineStyle.class, new LabelLineStylePane(this)); + classPaneMap.put(AttrMarkerType.class, new LineMarkerTypePane(this)); + } + + protected void addTrendLineAction() { + classPaneMap.put(AttrTrendLine.class, new TrendLinePane(this)); + } + + public Class class4Correspond() { + return XYScatterPlot.class; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/AreaIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/AreaIndependentChartInterface.java new file mode 100644 index 000000000..ff8a06ac7 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/AreaIndependentChartInterface.java @@ -0,0 +1,53 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.impl.Area3DPlotDataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.impl.AreaPlotDataSeriesCondtionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.CategoryPlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.Area3DSeriesPane; +import com.fr.design.mainframe.chart.gui.style.series.AreaSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.AreaPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class AreaIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new AreaPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return plot.isSupport3D() ? new Area3DSeriesPane(parent, plot) : new AreaSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return plot.isSupport3D() ? new Area3DPlotDataSeriesConditionPane() : new AreaPlotDataSeriesCondtionPane(); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Area.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/BarIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/BarIndependentChartInterface.java new file mode 100644 index 000000000..de1160b10 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/BarIndependentChartInterface.java @@ -0,0 +1,55 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.impl.Bar2DTrendLineDSConditionPane; +import com.fr.design.chart.series.SeriesCondition.impl.Bar3DPlotDataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.impl.BarPlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.CategoryPlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.Bar2DSeriesPane; +import com.fr.design.mainframe.chart.gui.style.series.Bar3DSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.BarPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class BarIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new BarPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return plot.isSupport3D() ? new Bar3DSeriesPane(parent, plot) : new Bar2DSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return plot.isSupport3D() ? new Bar3DPlotDataSeriesConditionPane() + : (plot.isSupportTrendLine() ? new Bar2DTrendLineDSConditionPane() : new BarPlotDataSeriesConditionPane()); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Bar.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/BubbleIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/BubbleIndependentChartInterface.java new file mode 100644 index 000000000..b9d0b232c --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/BubbleIndependentChartInterface.java @@ -0,0 +1,51 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.impl.BubblePlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.data.table.BubblePlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.BubbleSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.BubblePlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class BubbleIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new BubblePlotPane(); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/Chart_BubbleChart.png"; + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new BubblePlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new BubblePlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new BubbleSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new BubblePlotDataSeriesConditionPane(); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/ColumnIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/ColumnIndependentChartInterface.java new file mode 100644 index 000000000..fcbfbc6b2 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/ColumnIndependentChartInterface.java @@ -0,0 +1,54 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.impl.Bar2DTrendLineDSConditionPane; +import com.fr.design.chart.series.SeriesCondition.impl.Bar3DPlotDataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.impl.BarPlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.CategoryPlotMoreCateReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotMoreCateTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.Bar2DSeriesPane; +import com.fr.design.mainframe.chart.gui.style.series.Bar3DSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.ColumnPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class ColumnIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + public AbstractChartTypePane getPlotTypePane(){ + return new ColumnPlotPane(); + } + + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotMoreCateTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotMoreCateReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return plot.isSupport3D() ? new Bar3DSeriesPane(parent, plot) : new Bar2DSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return plot.isSupport3D() ? new Bar3DPlotDataSeriesConditionPane() + : (plot.isSupportTrendLine() ? new Bar2DTrendLineDSConditionPane() : new BarPlotDataSeriesConditionPane()); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Column.png"; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/CustomIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/CustomIndependentChartInterface.java new file mode 100644 index 000000000..3d2af6812 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/CustomIndependentChartInterface.java @@ -0,0 +1,51 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.DataSeriesCustomConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.CategoryPlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.CustomSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.CustomPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class CustomIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new CustomPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new CustomSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new DataSeriesCustomConditionPane(); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Comb_Chart.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/DonutIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/DonutIndependentChartInterface.java new file mode 100644 index 000000000..fa9d537c6 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/DonutIndependentChartInterface.java @@ -0,0 +1,52 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.impl.Donut2DPlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.CategoryPlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.Donut2DSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.DonutPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class DonutIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new DonutPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return plot.isSupport3D() ? null : new Donut2DSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return plot.isSupport3D() ? new DataSeriesConditionPane() : new Donut2DPlotDataSeriesConditionPane(); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Donut.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java new file mode 100644 index 000000000..43c71b46c --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java @@ -0,0 +1,45 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +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.PiePlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.PiePlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.FunnelSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.FunnelPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class FunnelIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new FunnelPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new PiePlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new PiePlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new FunnelSeriesPane(parent, plot); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Funnel.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/GanttIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/GanttIndependentChartInterface.java new file mode 100644 index 000000000..5c8c6f6d5 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/GanttIndependentChartInterface.java @@ -0,0 +1,44 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.impl.GanttPlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.report.GanttPlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.GanttPlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.GanttPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class GanttIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new GanttPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new GanttPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new GanttPlotReportDataContentPane(parent); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new GanttPlotDataSeriesConditionPane(); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Gantt.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/GisMapIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/GisMapIndependentChartInterface.java new file mode 100644 index 000000000..1e172750a --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/GisMapIndependentChartInterface.java @@ -0,0 +1,35 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.GisMapPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class GisMapIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new GisMapPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return null; + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return null; + } + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Gis.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/LineIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/LineIndependentChartInterface.java new file mode 100644 index 000000000..413ed6b52 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/LineIndependentChartInterface.java @@ -0,0 +1,52 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.impl.LinePlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.CategoryPlotMoreCateReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotMoreCateTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.LineSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.LinePlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class LineIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new LinePlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotMoreCateTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotMoreCateReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new LineSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return plot.isSupportTrendLine() ? new LinePlotDataSeriesConditionPane() : new DataSeriesConditionPane(); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Line.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/MapIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/MapIndependentChartInterface.java new file mode 100644 index 000000000..a1f933a1c --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/MapIndependentChartInterface.java @@ -0,0 +1,49 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.impl.MapPlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.MapSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.MapPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class MapIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new MapPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return null; + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return null; + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new MapSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new MapPlotDataSeriesConditionPane(); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/Chart-Map.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/MeterIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/MeterIndependentChartInterface.java new file mode 100644 index 000000000..513107556 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/MeterIndependentChartInterface.java @@ -0,0 +1,45 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +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.MeterPlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.MeterPlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.MeterSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.MeterPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class MeterIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new MeterPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new MeterPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new MeterPlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new MeterSeriesPane(parent, plot); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Meter.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/PieIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/PieIndependentChartInterface.java new file mode 100644 index 000000000..fabd3f265 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/PieIndependentChartInterface.java @@ -0,0 +1,53 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.impl.Pie3DPlotDataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.impl.PiePlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.PiePlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.PiePlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.Pie2DSeriesPane; +import com.fr.design.mainframe.chart.gui.style.series.Pie3DSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.PiePlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class PieIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new PiePlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new PiePlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new PiePlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return plot.isSupport3D() ? new Pie3DSeriesPane(parent, plot) : new Pie2DSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return plot.isSupport3D() ? new Pie3DPlotDataSeriesConditionPane() : new PiePlotDataSeriesConditionPane(); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Pie.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/RadarIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/RadarIndependentChartInterface.java new file mode 100644 index 000000000..d0320f8fd --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/RadarIndependentChartInterface.java @@ -0,0 +1,52 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.impl.RadarPlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.CategoryPlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.RadarSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.RadarPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class RadarIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new RadarPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new RadarSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new RadarPlotDataSeriesConditionPane(); + } + + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Radar.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/RangeIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/RangeIndependentChartInterface.java new file mode 100644 index 000000000..04f238192 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/RangeIndependentChartInterface.java @@ -0,0 +1,45 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +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.CategoryPlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.RangeSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.RangePlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class RangeIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new RangePlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new CategoryPlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new RangeSeriesPane(parent, plot); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Range_Chart.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/StockIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/StockIndependentChartInterface.java new file mode 100644 index 000000000..647c11a91 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/StockIndependentChartInterface.java @@ -0,0 +1,52 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.impl.StockPlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.StockPlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.StockPlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.StockSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.StockPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class StockIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new StockPlotPane(); + } + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new StockPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new StockPlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new StockSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return plot.isSupportTrendLine() ? new StockPlotDataSeriesConditionPane() : new DataSeriesConditionPane(); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-Stock.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chartinterface/XYScatterIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/XYScatterIndependentChartInterface.java new file mode 100644 index 000000000..23f363083 --- /dev/null +++ b/designer_chart/src/com/fr/design/chartinterface/XYScatterIndependentChartInterface.java @@ -0,0 +1,53 @@ +package com.fr.design.chartinterface; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.impl.XYScatterPlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; +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.XYScatterPlotReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.XYScatterPlotTableDataContentPane; +import com.fr.design.mainframe.chart.gui.style.series.XYScatterSeriesPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.gui.type.XYScatterPlotPane; + +/** + * Created by eason on 15/4/21. + */ +public class XYScatterIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + + public AbstractChartTypePane getPlotTypePane(){ + return new XYScatterPlotPane(); + } + + + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new XYScatterPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new XYScatterPlotReportDataContentPane(parent); + } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + return new XYScatterSeriesPane(parent, plot); + } + + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return plot.isSupportTrendLine() ? new XYScatterPlotDataSeriesConditionPane() : new DataSeriesConditionPane(); + } + + /** + *图标路径 + * @return 图标路径 + */ + public String getIconPath(){ + return "com/fr/design/images/form/toolbar/ChartF-XYScatter.png"; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/gui/xcombox/ComboBoxUseEditor.java b/designer_chart/src/com/fr/design/gui/xcombox/ComboBoxUseEditor.java new file mode 100644 index 000000000..577d6549f --- /dev/null +++ b/designer_chart/src/com/fr/design/gui/xcombox/ComboBoxUseEditor.java @@ -0,0 +1,160 @@ +package com.fr.design.gui.xcombox; + +import java.awt.*; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Enumeration; + +import com.fr.design.editor.editor.Editor; +import com.fr.design.gui.icombobox.FRTreeComboBox; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; + +import javax.swing.*; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; +import javax.swing.tree.*; + +/** + * 下拉列表 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-10-22 下午03:14:25 + */ +public class ComboBoxUseEditor extends Editor { + private FRTreeComboBox comBox; + private String[] items = new String[0]; + + private PopupMenuListener popupMenuListener = new PopupMenuListener() { + + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + new Thread() { + + public void run() { + calculateComboBoxNames(items); + } + }.start(); + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + + } + + public void popupMenuCanceled(PopupMenuEvent e) { + + } + }; + + TreeCellRenderer treeRenderer = new DefaultTreeCellRenderer() { + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { + super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); + if (value instanceof DefaultMutableTreeNode) { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; + Object userObj = node.getUserObject(); + if (userObj instanceof String) { + this.setIcon(null); + } + } + return this; + } + }; + + public ComboBoxUseEditor(String[] useNames) { + this.setLayout(new BorderLayout(0, 0)); + comBox = new FRTreeComboBox(){ + protected void dealSamePath(TreePath parent,TreeNode node,UITextField textField){ + for (Enumeration e = node.children(); e.hasMoreElements(); ) { + TreeNode n = (TreeNode) e.nextElement(); + TreePath path = parent.pathByAddingChild(n); + if (pathToString(path).toUpperCase().startsWith(textField.getText().toUpperCase())) { + tree.scrollPathToVisible(path); + tree.setSelectionPath(path); + break; + } + } + } + }; + comBox.getTree().setCellRenderer(treeRenderer); + comBox.setEditable(true); + comBox.setEnabled(true); + items = useNames; + + this.comBox.addPopupMenuListener(popupMenuListener); + comBox.setRenderer(new UIComboBoxRenderer()); + this.add(comBox, BorderLayout.CENTER); + this.setName(""); + comBox.setBorder(null); + + comBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + fireStateChanged(); + } + }); + + comBox.getEditor().getEditorComponent().addFocusListener(new FocusListener() { + public void focusLost(FocusEvent e) { + fireStateChanged(); + } + + @Override + public void focusGained(FocusEvent e) { + + } + }); + } + + /** + * 是否是String类型 + * @param object 要判断的 + * @return 是则返回true + */ + public boolean accept(Object object) { + return object instanceof String; + } + + @Override + public String getValue() { + if(comBox.getSelectedItem() != null) { + return comBox.getSelectedItem().toString(); + } + return ""; + } + + @Override + public void setValue(String value) { + comBox.setSelectedItem(value); + } + + private void calculateComboBoxNames(String[] useNames) { + JTree tree = comBox.getTree(); + if (tree == null) { + return; + } + DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode) tree.getModel().getRoot(); + rootTreeNode.removeAllChildren(); + + if (useNames.length == 0) { + return; + } + + for (int i = 0; i < useNames.length; i++) { + ExpandMutableTreeNode tableChildTreeNode = new ExpandMutableTreeNode(useNames[i]); + rootTreeNode.add(tableChildTreeNode); + } + + ((DefaultTreeModel) tree.getModel()).reload(); + + TreeNode root = (TreeNode) tree.getModel().getRoot(); + TreePath parent = new TreePath(root); + TreeNode node = (TreeNode) parent.getLastPathComponent(); + for (Enumeration e = node.children(); e.hasMoreElements(); ) { + TreeNode n = (TreeNode) e.nextElement(); + TreePath path = parent.pathByAddingChild(n); + tree.expandPath(path); + } + } + + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/gui/xcombox/MarkerComboBox.java b/designer_chart/src/com/fr/design/gui/xcombox/MarkerComboBox.java new file mode 100644 index 000000000..d6f794362 --- /dev/null +++ b/designer_chart/src/com/fr/design/gui/xcombox/MarkerComboBox.java @@ -0,0 +1,102 @@ +/* + * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. + */ +package com.fr.design.gui.xcombox; + +import com.fr.base.FRContext; +import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; +import com.fr.base.background.ColorBackground; +import com.fr.chart.chartglyph.Marker; +import com.fr.chart.chartglyph.NullMarker; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; +import com.fr.general.FRFont; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Combobox for selecting marker. + */ +public class MarkerComboBox extends UIComboBox { + /** + * Constructor. + * + * @param markerArray the array of marker. + */ + public MarkerComboBox(Marker[] markerArray) { + this.setModel(new DefaultComboBoxModel(markerArray)); + this.setRenderer(new MarkerCellRenderer()); + } + + /** + * Get selected marker. + */ + public Marker getSelectedMarkder() { + return (Marker) getSelectedItem(); + } + + /** + * Set the selected marker. + */ + public void setSelectedMarker(Marker marker) { + setSelectedItem(marker); + } + + /** + * CellRenderer. + */ + class MarkerCellRenderer extends UIComboBoxRenderer { + public Component getListCellRendererComponent(JList list, + Object value, int index, boolean isSelected, boolean cellHasFocus) { + this.marker = (Marker) value; + this.isSelected = isSelected; + + return this; + } + + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + + Dimension d = getSize(); + g2d.setColor(Color.black); + g2d.setFont(FRContext.getDefaultValues().getFRFont()); + + if (marker != null) { + if (marker instanceof NullMarker) { + g2d.setColor(Color.black); + FRFont font = FRContext.getDefaultValues().getFRFont(); + int resolution = ScreenResolution.getScreenResolution(); + Font rfont = font.applyResolutionNP(resolution); + g2d.setFont(rfont); + FontMetrics fm = GraphHelper.getFontMetrics(rfont); + + GraphHelper.drawString(g2d, Inter.getLocText("None"), 12, (d.height - fm.getHeight()) / 2 + fm.getAscent()); + } else { + if (marker.getBackground() == null) { + marker.setBackground(ColorBackground.getInstance(Color.black)); + } + marker.paint(g2d, d.width / 2, d.height / 2); + } + } + + if (isSelected) { + g2d.setColor(Color.blue); + GraphHelper.drawRect(g2d, 0, 0, d.width - 1, d.height - 1); + } + } + + public Dimension getPreferredSize() { + return new Dimension(36, 16); + } + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + private Marker marker = null; + private boolean isSelected = false; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/images/add.png b/designer_chart/src/com/fr/design/images/add.png new file mode 100644 index 000000000..113de462b Binary files /dev/null and b/designer_chart/src/com/fr/design/images/add.png differ diff --git a/designer_chart/src/com/fr/design/images/chart.png b/designer_chart/src/com/fr/design/images/chart.png new file mode 100644 index 000000000..db02b0bc8 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/chart.png differ diff --git a/designer_chart/src/com/fr/design/images/copyjs.png b/designer_chart/src/com/fr/design/images/copyjs.png new file mode 100644 index 000000000..d4b51fec4 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/copyjs.png differ diff --git a/designer_chart/src/com/fr/design/images/del.png b/designer_chart/src/com/fr/design/images/del.png new file mode 100644 index 000000000..f7e584e8f Binary files /dev/null and b/designer_chart/src/com/fr/design/images/del.png differ diff --git a/designer_chart/src/com/fr/design/images/exportimg.png b/designer_chart/src/com/fr/design/images/exportimg.png new file mode 100644 index 000000000..3f039124c Binary files /dev/null and b/designer_chart/src/com/fr/design/images/exportimg.png differ diff --git a/designer_chart/src/com/fr/design/images/newchart_normal.png b/designer_chart/src/com/fr/design/images/newchart_normal.png new file mode 100644 index 000000000..2c53cce60 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/newchart_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/newchart_over.png b/designer_chart/src/com/fr/design/images/newchart_over.png new file mode 100644 index 000000000..a26a47e12 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/newchart_over.png differ diff --git a/designer_chart/src/com/fr/design/images/newchart_press.png b/designer_chart/src/com/fr/design/images/newchart_press.png new file mode 100644 index 000000000..b0e0c4637 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/newchart_press.png differ diff --git a/designer_chart/src/com/fr/design/images/splash4Chart.png b/designer_chart/src/com/fr/design/images/splash4Chart.png new file mode 100644 index 000000000..ec3e897ea Binary files /dev/null and b/designer_chart/src/com/fr/design/images/splash4Chart.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/area/0_gray.png new file mode 100644 index 000000000..32be57ac3 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/area/0_normal.png new file mode 100644 index 000000000..140cbba82 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/area/0_over.png new file mode 100644 index 000000000..3f7dc1c7f Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/1_gray.png b/designer_chart/src/com/fr/design/images/toolbar/area/1_gray.png new file mode 100644 index 000000000..1df354176 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/1_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/1_normal.png b/designer_chart/src/com/fr/design/images/toolbar/area/1_normal.png new file mode 100644 index 000000000..37f18c9e7 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/1_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/1_over.png b/designer_chart/src/com/fr/design/images/toolbar/area/1_over.png new file mode 100644 index 000000000..f52ea6a48 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/1_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/2_gray.png b/designer_chart/src/com/fr/design/images/toolbar/area/2_gray.png new file mode 100644 index 000000000..90f6436af Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/2_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/2_normal.png b/designer_chart/src/com/fr/design/images/toolbar/area/2_normal.png new file mode 100644 index 000000000..5622dc837 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/2_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/2_over.png b/designer_chart/src/com/fr/design/images/toolbar/area/2_over.png new file mode 100644 index 000000000..f24e513b3 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/2_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/3_gray.png b/designer_chart/src/com/fr/design/images/toolbar/area/3_gray.png new file mode 100644 index 000000000..f9b401c99 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/3_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/3_normal.png b/designer_chart/src/com/fr/design/images/toolbar/area/3_normal.png new file mode 100644 index 000000000..e54c00a28 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/3_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/area/3_over.png b/designer_chart/src/com/fr/design/images/toolbar/area/3_over.png new file mode 100644 index 000000000..092ff8292 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/area/3_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/bar/0_gray.png new file mode 100644 index 000000000..baa6debf8 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/bar/0_normal.png new file mode 100644 index 000000000..d489dc4da Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/bar/0_over.png new file mode 100644 index 000000000..b2db29c3e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/1_gray.png b/designer_chart/src/com/fr/design/images/toolbar/bar/1_gray.png new file mode 100644 index 000000000..3e9230770 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/1_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/1_normal.png b/designer_chart/src/com/fr/design/images/toolbar/bar/1_normal.png new file mode 100644 index 000000000..a9a5425c6 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/1_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/1_over.png b/designer_chart/src/com/fr/design/images/toolbar/bar/1_over.png new file mode 100644 index 000000000..c57635c7e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/1_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/2_gray.png b/designer_chart/src/com/fr/design/images/toolbar/bar/2_gray.png new file mode 100644 index 000000000..2789e3ae3 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/2_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/2_normal.png b/designer_chart/src/com/fr/design/images/toolbar/bar/2_normal.png new file mode 100644 index 000000000..3b1b6972a Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/2_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/2_over.png b/designer_chart/src/com/fr/design/images/toolbar/bar/2_over.png new file mode 100644 index 000000000..0fcc0df51 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/2_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/3_gary.png b/designer_chart/src/com/fr/design/images/toolbar/bar/3_gary.png new file mode 100644 index 000000000..ffd5e545b Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/3_gary.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/3_gray.png b/designer_chart/src/com/fr/design/images/toolbar/bar/3_gray.png new file mode 100644 index 000000000..ffd5e545b Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/3_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/3_normal.png b/designer_chart/src/com/fr/design/images/toolbar/bar/3_normal.png new file mode 100644 index 000000000..669ccffe1 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/3_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/3_over.png b/designer_chart/src/com/fr/design/images/toolbar/bar/3_over.png new file mode 100644 index 000000000..d7194a6a2 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/3_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/4_gray.png b/designer_chart/src/com/fr/design/images/toolbar/bar/4_gray.png new file mode 100644 index 000000000..70e4683d0 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/4_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/4_normal.png b/designer_chart/src/com/fr/design/images/toolbar/bar/4_normal.png new file mode 100644 index 000000000..82cc074b5 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/4_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/4_over.png b/designer_chart/src/com/fr/design/images/toolbar/bar/4_over.png new file mode 100644 index 000000000..259422a65 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/4_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/5_gray.png b/designer_chart/src/com/fr/design/images/toolbar/bar/5_gray.png new file mode 100644 index 000000000..046aa24d2 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/5_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/5_normal.png b/designer_chart/src/com/fr/design/images/toolbar/bar/5_normal.png new file mode 100644 index 000000000..01dc29107 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/5_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/5_over.png b/designer_chart/src/com/fr/design/images/toolbar/bar/5_over.png new file mode 100644 index 000000000..63dee58b1 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/5_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/6_gray.png b/designer_chart/src/com/fr/design/images/toolbar/bar/6_gray.png new file mode 100644 index 000000000..ce1ce75d0 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/6_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/6_normal.png b/designer_chart/src/com/fr/design/images/toolbar/bar/6_normal.png new file mode 100644 index 000000000..d96752098 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/6_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bar/6_over.png b/designer_chart/src/com/fr/design/images/toolbar/bar/6_over.png new file mode 100644 index 000000000..c0a5737c7 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bar/6_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/border.png b/designer_chart/src/com/fr/design/images/toolbar/border.png new file mode 100644 index 000000000..5a945581a Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/border.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bubble/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/bubble/0_gray.png new file mode 100644 index 000000000..da9f60e28 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bubble/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bubble/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/bubble/0_normal.png new file mode 100644 index 000000000..72823ae19 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bubble/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/bubble/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/bubble/0_over.png new file mode 100644 index 000000000..2ddec442a Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/bubble/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/column/0_gray.png new file mode 100644 index 000000000..08e9cefc1 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/column/0_normal.png new file mode 100644 index 000000000..27c077ab9 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/column/0_over.png new file mode 100644 index 000000000..e79ec9971 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/1_gray.png b/designer_chart/src/com/fr/design/images/toolbar/column/1_gray.png new file mode 100644 index 000000000..9b6b56a79 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/1_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/1_normal.png b/designer_chart/src/com/fr/design/images/toolbar/column/1_normal.png new file mode 100644 index 000000000..ffbc24d86 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/1_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/1_over.png b/designer_chart/src/com/fr/design/images/toolbar/column/1_over.png new file mode 100644 index 000000000..5ac0dd420 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/1_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/2_gray.png b/designer_chart/src/com/fr/design/images/toolbar/column/2_gray.png new file mode 100644 index 000000000..aaf4f5a8d Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/2_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/2_normal.png b/designer_chart/src/com/fr/design/images/toolbar/column/2_normal.png new file mode 100644 index 000000000..ba7cf13c2 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/2_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/2_over.png b/designer_chart/src/com/fr/design/images/toolbar/column/2_over.png new file mode 100644 index 000000000..eb88fb67e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/2_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/3_gray.png b/designer_chart/src/com/fr/design/images/toolbar/column/3_gray.png new file mode 100644 index 000000000..c35e61c25 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/3_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/3_normal.png b/designer_chart/src/com/fr/design/images/toolbar/column/3_normal.png new file mode 100644 index 000000000..5842bccb9 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/3_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/3_over.png b/designer_chart/src/com/fr/design/images/toolbar/column/3_over.png new file mode 100644 index 000000000..bd9f6497e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/3_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/4_gray.png b/designer_chart/src/com/fr/design/images/toolbar/column/4_gray.png new file mode 100644 index 000000000..4c4958c20 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/4_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/4_normal.png b/designer_chart/src/com/fr/design/images/toolbar/column/4_normal.png new file mode 100644 index 000000000..191789551 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/4_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/4_over.png b/designer_chart/src/com/fr/design/images/toolbar/column/4_over.png new file mode 100644 index 000000000..44cd8063e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/4_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/5_gray.png b/designer_chart/src/com/fr/design/images/toolbar/column/5_gray.png new file mode 100644 index 000000000..9a1de0259 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/5_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/5_normal.png b/designer_chart/src/com/fr/design/images/toolbar/column/5_normal.png new file mode 100644 index 000000000..2bfa3d33b Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/5_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/5_over.png b/designer_chart/src/com/fr/design/images/toolbar/column/5_over.png new file mode 100644 index 000000000..1d8505510 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/5_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/6_gray.png b/designer_chart/src/com/fr/design/images/toolbar/column/6_gray.png new file mode 100644 index 000000000..db9ff17d6 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/6_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/6_normal.png b/designer_chart/src/com/fr/design/images/toolbar/column/6_normal.png new file mode 100644 index 000000000..6218c9102 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/6_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/column/6_over.png b/designer_chart/src/com/fr/design/images/toolbar/column/6_over.png new file mode 100644 index 000000000..a5cc6c056 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/column/6_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/custom/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/custom/0_gray.png new file mode 100644 index 000000000..e3a78d4f1 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/custom/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/custom/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/custom/0_normal.png new file mode 100644 index 000000000..059e5f643 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/custom/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/custom/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/custom/0_over.png new file mode 100644 index 000000000..a80fbd377 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/custom/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/donut/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/donut/0_gray.png new file mode 100644 index 000000000..8cf435bb1 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/donut/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/donut/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/donut/0_normal.png new file mode 100644 index 000000000..bb561d1e5 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/donut/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/donut/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/donut/0_over.png new file mode 100644 index 000000000..e69217b24 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/donut/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/donut/1_gray.png b/designer_chart/src/com/fr/design/images/toolbar/donut/1_gray.png new file mode 100644 index 000000000..d21c01965 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/donut/1_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/donut/1_normal.png b/designer_chart/src/com/fr/design/images/toolbar/donut/1_normal.png new file mode 100644 index 000000000..d006f15cb Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/donut/1_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/donut/1_over.png b/designer_chart/src/com/fr/design/images/toolbar/donut/1_over.png new file mode 100644 index 000000000..acf9eba36 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/donut/1_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/funnel/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/funnel/0_gray.png new file mode 100644 index 000000000..9fefbb1c0 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/funnel/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/funnel/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/funnel/0_normal.png new file mode 100644 index 000000000..fb50bbe29 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/funnel/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/funnel/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/funnel/0_over.png new file mode 100644 index 000000000..af504b8c7 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/funnel/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/gantt/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/gantt/0_gray.png new file mode 100644 index 000000000..612be8581 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/gantt/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/gantt/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/gantt/0_normal.png new file mode 100644 index 000000000..b5b9088cb Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/gantt/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/gantt/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/gantt/0_over.png new file mode 100644 index 000000000..3d9aad856 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/gantt/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/gis/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/gis/0_gray.png new file mode 100644 index 000000000..ebc7c23cb Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/gis/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/gis/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/gis/0_normal.png new file mode 100644 index 000000000..7be42c740 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/gis/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/gis/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/gis/0_over.png new file mode 100644 index 000000000..e730f993e Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/gis/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/gis/1_gray.png b/designer_chart/src/com/fr/design/images/toolbar/gis/1_gray.png new file mode 100644 index 000000000..9d4bcfed4 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/gis/1_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/gis/1_normal.png b/designer_chart/src/com/fr/design/images/toolbar/gis/1_normal.png new file mode 100644 index 000000000..9d97b8242 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/gis/1_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/gis/1_over.png b/designer_chart/src/com/fr/design/images/toolbar/gis/1_over.png new file mode 100644 index 000000000..337ae8d2f Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/gis/1_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/line/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/line/0_gray.png new file mode 100644 index 000000000..894c6ec04 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/line/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/line/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/line/0_normal.png new file mode 100644 index 000000000..764b9bac9 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/line/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/line/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/line/0_over.png new file mode 100644 index 000000000..d91e0ea6c Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/line/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/map/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/map/0_gray.png new file mode 100644 index 000000000..3865ace74 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/map/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/map/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/map/0_normal.png new file mode 100644 index 000000000..a1492da8f Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/map/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/map/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/map/0_over.png new file mode 100644 index 000000000..dec831942 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/map/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/meter/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/meter/0_gray.png new file mode 100644 index 000000000..8e24efd5d Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/meter/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/meter/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/meter/0_normal.png new file mode 100644 index 000000000..62327bb2b Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/meter/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/meter/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/meter/0_over.png new file mode 100644 index 000000000..4fab1f077 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/meter/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/meter/1_gray.png b/designer_chart/src/com/fr/design/images/toolbar/meter/1_gray.png new file mode 100644 index 000000000..ca7262cdd Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/meter/1_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/meter/1_normal.png b/designer_chart/src/com/fr/design/images/toolbar/meter/1_normal.png new file mode 100644 index 000000000..bedd67c1a Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/meter/1_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/meter/1_over.png b/designer_chart/src/com/fr/design/images/toolbar/meter/1_over.png new file mode 100644 index 000000000..6f2824dfe Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/meter/1_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/meter/2_gray.png b/designer_chart/src/com/fr/design/images/toolbar/meter/2_gray.png new file mode 100644 index 000000000..e0df53225 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/meter/2_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/meter/2_normal.png b/designer_chart/src/com/fr/design/images/toolbar/meter/2_normal.png new file mode 100644 index 000000000..36783e9e9 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/meter/2_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/meter/2_over.png b/designer_chart/src/com/fr/design/images/toolbar/meter/2_over.png new file mode 100644 index 000000000..76f3404b4 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/meter/2_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/pie/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/pie/0_gray.png new file mode 100644 index 000000000..c05918239 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/pie/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/pie/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/pie/0_normal.png new file mode 100644 index 000000000..1b1363b5f Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/pie/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/pie/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/pie/0_over.png new file mode 100644 index 000000000..60e08dfa7 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/pie/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/pie/1_gray.png b/designer_chart/src/com/fr/design/images/toolbar/pie/1_gray.png new file mode 100644 index 000000000..80058c5ec Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/pie/1_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/pie/1_normal.png b/designer_chart/src/com/fr/design/images/toolbar/pie/1_normal.png new file mode 100644 index 000000000..5524fa143 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/pie/1_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/pie/1_over.png b/designer_chart/src/com/fr/design/images/toolbar/pie/1_over.png new file mode 100644 index 000000000..09a1c2e50 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/pie/1_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/radar/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/radar/0_gray.png new file mode 100644 index 000000000..eed538adf Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/radar/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/radar/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/radar/0_normal.png new file mode 100644 index 000000000..b8fa24288 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/radar/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/radar/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/radar/0_over.png new file mode 100644 index 000000000..76550b6a5 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/radar/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/range/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/range/0_gray.png new file mode 100644 index 000000000..614f6f142 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/range/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/range/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/range/0_normal.png new file mode 100644 index 000000000..0877a3a74 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/range/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/range/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/range/0_over.png new file mode 100644 index 000000000..c94bc34cc Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/range/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/stock/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/stock/0_gray.png new file mode 100644 index 000000000..acf6a462c Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/stock/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/stock/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/stock/0_normal.png new file mode 100644 index 000000000..e6acf8b0a Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/stock/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/stock/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/stock/0_over.png new file mode 100644 index 000000000..24fba1e0b Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/stock/0_over.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_gray.png b/designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_gray.png new file mode 100644 index 000000000..b755a7226 Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_gray.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_normal.png b/designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_normal.png new file mode 100644 index 000000000..d29e0eabe Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_normal.png differ diff --git a/designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_over.png b/designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_over.png new file mode 100644 index 000000000..2bb5013ce Binary files /dev/null and b/designer_chart/src/com/fr/design/images/toolbar/xyscatter/0_over.png differ diff --git a/designer_chart/src/com/fr/design/mainframe/AbstractChartDataPane4Chart.java b/designer_chart/src/com/fr/design/mainframe/AbstractChartDataPane4Chart.java new file mode 100644 index 000000000..f7c3ca189 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/AbstractChartDataPane4Chart.java @@ -0,0 +1,244 @@ +package com.fr.design.mainframe; + +import com.fr.base.TableData; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.JSONTableData; +import com.fr.data.impl.EmbeddedTableData; +import com.fr.data.impl.ExcelTableData; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.*; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + * Date: 14/12/3 + * Time: 下午6:53 + */ +public class AbstractChartDataPane4Chart extends DataContentsPane implements UIObserver { + + private static final int DATA_SOURCE_GAP = 18; + private static final int WIDTH = 262; + + protected ChartDataPane parentPane; + protected ChartDesignDataLoadPane choosePane; + protected JComponent choose = new UILabel(); + + protected UIObserverListener observerListener; + + protected UIComboBox dataSource = new UIComboBox( + new String[]{"JSON" + Inter.getLocText("Chart-DS_TableData"), Inter.getLocText("Chart-Use_Local") + "EXCEL", Inter.getLocText("Chart-DS_Embedded_TableData")}); + + protected ItemListener dsListener = new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + int index = dataSource.getSelectedIndex(); + if (index == 0) { + initJSON(); + } else if (index == 1) { + initExcel(); + } else { + initEmbbed(); + } + remove(leftContentPane); + clearTableDataSetting(); + initContentPane(); + AbstractChartDataPane4Chart.this.validate(); + } + }; + + protected AttributeChangeListener attributeChangeListener; + + public AbstractChartDataPane4Chart(final AttributeChangeListener listener, ChartDataPane parent) { + this.parentPane = parent; + this.attributeChangeListener = listener; + initJSON(); + initAll(); + } + + protected void populateChoosePane(TableData tableData) { + dataSource.removeItemListener(dsListener); + if (tableData instanceof JSONTableData) { + initJSON(); + dataSource.setSelectedIndex(0); + } else if (tableData instanceof ExcelTableData) { + initExcel(); + dataSource.setSelectedIndex(1); + } else if (tableData instanceof EmbeddedTableData) { + initEmbbed(); + dataSource.setSelectedIndex(2); + } + choosePane.populateChartTableData(tableData); + dataSource.addItemListener(dsListener); + } + + + protected void initJSON() { + choosePane = new JSONDataPane(this); + UILabel url = new UILabel("URL:"); + url.setHorizontalAlignment(SwingConstants.RIGHT); + choose = url; + } + + protected void initExcel() { + choose = new UIButton(Inter.getLocText("Chart-Select_Path")); + choosePane = new ExcelDataPane(this, choose); + } + + protected void initEmbbed() { + choosePane = new EmbbeddDataPane(this); + choose = null; + } + + @Override + public void setSupportCellData(boolean supportCellData) { + + } + + @Override + protected JPanel createContentPane() { + double p = TableLayout.PREFERRED; + double[] columnSize = {WIDTH}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Chart-Data_Import"))}, + new Component[]{createDataImportPane()} + }; + + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + private JPanel createDataImportPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p, p}; + Component[][] components = new Component[][]{ + new Component[]{createDataSourcePane()}, + new Component[]{new JSeparator()}, + new Component[]{createDataSetPane()} + }; + + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + + /** + * 数据配置面板 + * + * @return + */ + protected JPanel createDataSetPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Chart-Data_Configuration"))}, + new Component[]{getDataContentPane()} + }; + + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + protected JPanel getDataContentPane() { + return new JPanel(); + } + + + private JPanel createDataSourcePane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {DATA_SOURCE_GAP, f}; + double[] rowSize = {p,}; + Component[][] components = new Component[][]{ + new Component[]{null, createChooseBoxPane()}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + private JPanel createChooseBoxPane() { + UILabel dataSourceLabel = new UILabel(Inter.getLocText("Chart-Data_Resource") + ":"); + dataSourceLabel.setHorizontalAlignment(SwingConstants.RIGHT); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{dataSourceLabel, dataSource}, + new Component[]{choose, choosePane} + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + + /** + * 注册观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(UIObserverListener listener) { + this.observerListener = listener; + } + + /** + * 使用应该响应listener + * + * @return 应该响应 + */ + public boolean shouldResponseChangeListener() { + return true; + } + + + protected void initSelfListener(Container parentComponent) { + for (int i = 0; i < parentComponent.getComponentCount(); i++) { + Component tmpComp = parentComponent.getComponent(i); + if (tmpComp instanceof Container) { + initListener((Container) tmpComp); + } + if (tmpComp instanceof UIObserver) { + ((UIObserver) tmpComp).registerChangeListener(observerListener); + } + } + } + + + @Override + public void populate(ChartCollection collection) { + + } + + @Override + public void update(ChartCollection collection) { + + } + + /** + * 清空数据集的设置 + */ + public void clearTableDataSetting() { + + } + + /** + * 数据集数据改变 + */ + public void fireTableDataChange() { + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/AbstractMapPlotPane4ToolBar.java b/designer_chart/src/com/fr/design/mainframe/AbstractMapPlotPane4ToolBar.java new file mode 100644 index 000000000..d2da88c83 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/AbstractMapPlotPane4ToolBar.java @@ -0,0 +1,111 @@ +package com.fr.design.mainframe; + +import com.fr.chart.base.ChartConstants; +import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.chart.chartattr.*; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.mainframe.chart.ChartDesignEditPane; +import com.fr.general.ComparatorUtils; +import com.fr.stable.Constants; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + * Date: 14/12/1 + * Time: 下午3:15 + */ +public abstract class AbstractMapPlotPane4ToolBar extends JPanel{ + + + protected static final int COM_HEIGHT = 22; + protected static final int COM_GAP = 14; + protected static final int COMBOX_WIDTH = 230; + + protected ChartDesigner chartDesigner; + protected UIComboBox mapTypeComboBox; + + protected ItemListener mapTypeListener = new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + calculateDetailMaps(mapTypeComboBox.getSelectedIndex()); + } + }; + + + public AbstractMapPlotPane4ToolBar(ChartDesigner designer){ + this.chartDesigner = designer; + this.setLayout(new FlowLayout(FlowLayout.LEFT, COM_GAP, 0)); + this.setBorder(new EmptyBorder(2, 0, 2, 0)); + mapTypeComboBox = new UIComboBox(getMapTypes()) { + public Dimension getPreferredSize() { + return new Dimension(COMBOX_WIDTH, COM_HEIGHT); + } + }; + mapTypeComboBox.addItemListener(mapTypeListener); + this.add(mapTypeComboBox); + } + + + protected abstract void calculateDetailMaps(int mapType); + + /** + * 更新地图面板 + * @param mapType 地图名字 + */ + public void populateMapPane(String mapType){ + mapTypeComboBox.removeItemListener(mapTypeListener); + for (String type : getMapTypes()) { + java.util.List list = MapSvgXMLHelper.getInstance().getNamesListWithCateName(type); + for (Object name : list) { + if(ComparatorUtils.equals(name,mapType)){ + mapTypeComboBox.setSelectedItem(type); + break; + } + } + } + mapTypeComboBox.addItemListener(mapTypeListener); + } + + public abstract String[] getMapTypes(); + + /** + * 切换图表类型 + */ + public void fireChange(){ + ChartCollection chartCollection = (ChartCollection)chartDesigner.getTarget().getChartCollection(); + Chart chart =chartCollection.getSelectedChart(); + if(chart.getPlot().getPlotStyle() != ChartConstants.STYLE_NONE){ + resetChart(chart); + } + chart.switchPlot(getSelectedClonedPlot()); + + if(chart.getPlot().getPlotStyle() != ChartConstants.STYLE_NONE){ + resetChart(chart); + } + chartDesigner.fireTargetModified(); + ChartDesignEditPane.getInstance().populateSelectedTabPane(); + } + + protected void resetChart(Chart chart){ + chart.setTitle(new Title(chart.getTitle().getTextObject())); + chart.setBorderStyle(Constants.LINE_NONE); + chart.setBorderColor(new Color(150, 150, 150)); + chart.setBackground(null); + } + + protected abstract Plot getSelectedClonedPlot(); + + /** + * 触发更新 + */ + public void fireTargetModified() { + chartDesigner.fireTargetModified(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartAndWidgetPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/ChartAndWidgetPropertyPane.java new file mode 100644 index 000000000..f5547b7e6 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/ChartAndWidgetPropertyPane.java @@ -0,0 +1,143 @@ +/* + * Copyright(c) 2001-2011, FineReport Inc, All Rights Reserved. + */ +package com.fr.design.mainframe; + +import java.awt.BorderLayout; +import java.awt.Component; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.constants.UIConstants; +import com.fr.design.designer.TargetComponent; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itabpane.TitleChangeListener; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.module.DesignModuleFactory; +import com.fr.general.Inter; + +public class ChartAndWidgetPropertyPane extends MiddleChartPropertyPane { + + public synchronized static ChartAndWidgetPropertyPane getInstance(BaseFormDesigner formEditor) { + if(singleton == null) { + singleton = new ChartAndWidgetPropertyPane(formEditor); + } + + singleton.setWidgetPropertyPane(DesignModuleFactory.getWidgetPropertyPane(formEditor)); + singleton.setSureProperty(); + return singleton; + } + + public static ChartAndWidgetPropertyPane getInstance() { + if(singleton == null) { + singleton = new ChartAndWidgetPropertyPane(); + } + return singleton; + } + + private static ChartAndWidgetPropertyPane singleton; + + private BaseWidgetPropertyPane widgetpane = null; + + private UIToggleButton hisButton; + + public ChartAndWidgetPropertyPane() { + + } + + public ChartAndWidgetPropertyPane(BaseFormDesigner formEditor) { + super(); + this.widgetpane = DesignModuleFactory.getWidgetPropertyPane(formEditor); + } + + public void setWidgetPropertyPane(BaseWidgetPropertyPane pane) { + this.widgetpane = pane; + } + + @Override + protected void createMainPane() { + this.add(chartEditPane, BorderLayout.CENTER); + } + + @Override + protected void createNameLabel() { + nameLabel = new UILabel(); + nameLabel.setHorizontalAlignment(SwingConstants.LEFT); + nameLabel.setBorder(BorderFactory.createEmptyBorder(-2, 6, 2, 0)); + } + + @Override + protected JComponent createNorthComponent() { + JPanel toolPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + JPanel hisPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + hisPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); + hisButton = new UIToggleButton(Inter.getLocText(new String[]{"Widget", "Attribute"}), UIConstants.HISTORY_ICON); + hisButton.setNormalPainted(false); + hisButton.setBorderPaintedOnlyWhenPressed(true); + hisPane.add(hisButton, BorderLayout.CENTER); + + hisButton.addChangeListener(new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + cardChange(); + } + }); + + toolPane.add(nameLabel, BorderLayout.CENTER); + toolPane.add(hisPane, BorderLayout.EAST); + + titleListener = new TitleChangeListener() { + + @Override + public void fireTitleChange(String addName) { + if(hisButton.isSelected()) { + nameLabel.setText(Inter.getLocText(new String[]{"Widget", "Form-Widget_Property_Table"})); + }else { + nameLabel.setText(Inter.getLocText("Chart-Property_Table") + '-' + addName); + } + } + }; + + return toolPane; + } + + /** + * 感觉ChartCollection加载图表属性界面. + * @param collection 收集图表 + * @param ePane 面板 + */ + public void populateChartPropertyPane(ChartCollection collection, TargetComponent ePane) { + super.populateChartPropertyPane(collection, ePane); + //表单中的图表切换界面上得更新 + resetChartEditPane(); + } + + protected void resetChartEditPane() { + cardChange(); + } + + private void cardChange() { + remove(chartEditPane); + remove((Component)widgetpane); + if(hisButton.isSelected()) { + nameLabel.setText(Inter.getLocText(new String[]{"Widget", "Form-Widget_Property_Table"})); + add((Component)widgetpane, BorderLayout.CENTER); + } else { + String tabname = chartEditPane.getSelectedTabName(); + nameLabel.setText(Inter.getLocText(new String[]{"Utils-The-Chart", "Form-Widget_Property_Table"}) + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : "")); + add(chartEditPane, BorderLayout.CENTER); + } + validate(); + repaint(); + revalidate(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartArea.java b/designer_chart/src/com/fr/design/mainframe/ChartArea.java new file mode 100644 index 000000000..e30f15ea5 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/ChartArea.java @@ -0,0 +1,521 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UINumberField; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.scrollruler.*; +import com.fr.general.FRScreen; +import com.fr.general.Inter; + +import javax.swing.*; +import javax.swing.border.LineBorder; +import java.awt.*; +import java.awt.event.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-13 + * Time: 下午5:08 + */ +public class ChartArea extends JComponent implements ScrollRulerComponent { + + private static final int TOPGAP = 8; + private static final int MIN_WIDTH = 36; + private static final int MIN_HEIGHT = 21; + private static final double SLIDER_FLOAT = 120.0; + private static final double SLIDER_MIN = 60.0; + private static final double DEFAULT_SLIDER = 100.0; + private static final int ROTATIONS = 50; + private int designerwidth = 810; + private int designerheight = 500; + private int customWidth = 810; + private int customHeight = 500; + private ChartDesigner designer; + private int horizontalValue = 0; + private int verticalValue = 0; + private int verticalMax = 0; + private int horicalMax = 0; + private FormScrollBar verScrollBar; + private FormScrollBar horScrollBar; + //显示和设置图表界面大小的控件 + private UINumberField widthPane; + private UINumberField heightPane; + private boolean isValid = true; + private double START_VALUE = DEFAULT_SLIDER; + + public ChartArea(ChartDesigner designer) { + this(designer, true); + } + + public ChartArea(ChartDesigner designer, boolean useScrollBar) { + this.designer = designer; + this.designer.setParent(this); + this.customWidth = designer.getTarget().getWidth(); + this.customHeight = designer.getTarget().getHeight(); + this.designerwidth = this.customWidth; + this.designerheight = this.customHeight; + isValid = useScrollBar; + verScrollBar = new FormScrollBar(Adjustable.VERTICAL, this); + horScrollBar = new FormScrollBar(Adjustable.HORIZONTAL, this); + if (useScrollBar) { + this.setLayout(new FormRulerLayout()); + designer.setBorder(new LineBorder(new Color(198, 198, 198))); + this.add(FormRulerLayout.CENTER, designer); + addFormSize(); + this.add(FormRulerLayout.VERTICAL, verScrollBar); + this.add(FormRulerLayout.HIRIZONTAL, horScrollBar); + enableEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK); + } else { + // 报表参数界面只要标尺和中心pane + this.setLayout(new RulerLayout()); + this.add(RulerLayout.CENTER, designer); + addFormRuler(); + } + this.setFocusTraversalKeysEnabled(false); + } + + /** + * 增加表单的页面大小控制界面,包括手动修改和滑块拖动 + */ + private void addFormSize() { + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {f}; + double[] columnSize = {p, f, p, p, p, p, p,f,p}; + UILabel tipsPane = new UILabel("chart"); + tipsPane.setPreferredSize(new Dimension(200, 0)); + widthPane = new UINumberField(); + widthPane.setPreferredSize(new Dimension(60, 0)); + heightPane = new UINumberField(); + heightPane.setPreferredSize(new Dimension(60, 0)); + JPanel panel = new JPanel(){ + public Dimension getPreferredSize(){ + return new Dimension(200,0); + } + }; + JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ + {tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("Indent-Pixel")), new UILabel("x"), + heightPane, new UILabel(Inter.getLocText("Indent-Pixel")),new UILabel(),panel}}, + rowSize, columnSize, 8 + ); + this.add(FormRulerLayout.BOTTOM, resizePane); + setWidgetsConfig(); + // 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小 + initCalculateSize(); + } + + private void setWidgetsConfig() { + widthPane.setHorizontalAlignment(widthPane.CENTER); + heightPane.setHorizontalAlignment(heightPane.CENTER); + widthPane.setMaxDecimalLength(0); + heightPane.setMaxDecimalLength(0); + //控件初始值就是根节点组件初始的宽和高 + widthPane.setValue(designerwidth); + heightPane.setValue(designerheight); + addWidthPaneListener(); + addHeightPaneListener(); + } + + private void initCalculateSize() { + Toolkit toolkit = Toolkit.getDefaultToolkit(); + Dimension scrnsize = toolkit.getScreenSize(); + double value = FRScreen.getByDimension(scrnsize).getValue(); + if (value != DEFAULT_SLIDER) { + reCalculateRoot(value, true); + } + } + + //设置宽度的控件及响应事件 + private void addWidthPaneListener() { + widthPane.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent evt) { + reCalculateWidth((int) ((UINumberField) evt.getSource()).getValue()); + } + } + ); + widthPane.addFocusListener( + new FocusAdapter() { + public void focusLost(FocusEvent e) { + // 失去焦点时,可以认为输入结束 + reCalculateWidth((int) ((UINumberField) e.getSource()).getValue()); + } + } + ); + } + + private void addHeightPaneListener() { + heightPane.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent evt) { + reCalculateHeight((int) ((UINumberField) evt.getSource()).getValue()); + } + } + ); + heightPane.addFocusListener( + new FocusAdapter() { + public void focusLost(FocusEvent e) { + // 失去焦点时,可以认为输入结束 + reCalculateHeight((int) ((UINumberField) e.getSource()).getValue()); + } + } + ); + } + + private void reCalculateWidth(int width) { + int dW = width - designerwidth; + if (dW == 0) { + return; + } + // 图表设计器先设大小为实际的高和当前的宽,然后按此调整内部的组件 + designer.setSize(width, designerheight); + designerwidth = width; + customWidth = width; + designer.getTarget().setWidth(width); + ChartArea.this.validate(); + designer.fireTargetModified(); + } + + private void reCalculateHeight(int height) { + int dW = height - designerwidth; + if (dW == 0) { + return; + } + // 图表设计器先设大小为实际的高和当前的宽,然后按此调整内部的组件 + designer.setSize(designerwidth, height); + designerheight = height; + customHeight = height; + this.designer.getTarget().setHeight(height); + ChartArea.this.validate(); + designer.fireTargetModified(); + } + + /** + * 按照界面大小的百分比值调整root大小 + * + * @param needCalculateParaHeight 是否需要调整参数界面高度 + * @param value + */ + private void reCalculateRoot(double value, boolean needCalculateParaHeight) { + if (value == START_VALUE) { + return; + } + double percent = (value - START_VALUE) / START_VALUE; + Dimension d = new Dimension(designerwidth, designerheight); + // 调整自适应布局大小后,同步调整参数界面和border大小,此时刷新下formArea + ChartArea.this.validate(); + START_VALUE = value; + } + + /** + * 增加刻度条 + */ + public void addFormRuler() { + BaseRuler vRuler = new VerticalRuler(this); + BaseRuler hRuler = new HorizontalRuler(this); + this.add(RulerLayout.VRULER, vRuler); + this.add(RulerLayout.HRULER, hRuler); + } + + /** + * 鼠标滚轮事件 + * 由于表单设计界面要求: 容器大小大于界面时,滚动条才可以拖动,所以不支持滚动无限往下滚 + */ + @Override + protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent evt) { + int id = evt.getID(); + switch (id) { + case MouseEvent.MOUSE_WHEEL: { + int rotations = evt.getWheelRotation(); + int value = this.verScrollBar.getValue() + rotations * ROTATIONS; + value = Math.min(value, verticalMax); + value = Math.max(0, value); + doLayout(); //加dolayout是因为每次滚动都要重置 Max的大小 + this.verScrollBar.setValue(value); + break; + } + } + } + + /** + * 容器布局 + */ + public void doLayout() { + layout(); + if (isValid) { + setScrollBarProperties(customWidth - designer.getWidth(), horScrollBar); + //计算滚动条值的时候应该算上参数面板的高度 + setScrollBarProperties(customHeight - designer.getHeight(), verScrollBar); + } + } + + /** + * 设置滚动条的属性 + */ + private void setScrollBarProperties(int value, FormScrollBar bar) { + if (value <= 0) { + // 界面有滚动条时,手动缩小容器宽度到界面内,重置滚动条值和max + setScrollBarMax(0, bar); + bar.setMaximum(0); + bar.setValue(0); + bar.setEnabled(false); + } else { + //参数面板拖拽过程中value一直为当前value + int oldValue = verticalValue; + setScrollBarMax(value, bar); + bar.setEnabled(true); + bar.setMaximum(value); + bar.setValue(value); + bar.setValue(oldValue); + } + } + + private boolean isScrollNotVisible(FormScrollBar bar) { + if (bar.getOrientation() == Adjustable.VERTICAL) { + return verticalMax == 0; + } else { + return horicalMax == 0; + } + } + + private void setScrollBarMax(int max, FormScrollBar bar) { + if (bar.getOrientation() == Adjustable.VERTICAL) { + verticalMax = max; + } else { + horicalMax = max; + } + } + + /** + * 返回designer的最小高度 + * + * @return int + */ + public int getMinHeight() { + return MIN_HEIGHT; + } + + /** + * 返回designer的最小宽度 + * + * @return int + */ + public int getMinWidth() { + return MIN_WIDTH; + } + + /** + * getRulerLengthUnit + * + * @return short + */ + public short getRulerLengthUnit() { + return -1; + } + + /** + * 返回水平滚动条的value + * + * @return int + */ + public int getHorizontalValue() { + return horizontalValue; + } + + /** + * 设置水平滚动条的value + * + * @param newValue + */ + public void setHorizontalValue(int newValue) { + this.horizontalValue = newValue; + } + + /** + * 返回竖直滚动条的value + * + * @return + */ + public int getVerticalValue() { + return verticalValue; + } + + /** + * 竖直滚动条赋值 + * + * @param newValue + */ + public void setVerticalValue(int newValue) { + this.verticalValue = newValue; + } + + /** + * 返回当前designer的高度 + * + * @return height + */ + public int getDesignerHeight() { + return designer.getHeight(); + } + + /** + * 返回当前designer的宽度 + * + * @return + */ + public int getDesignerWidth() { + return designer.getWidth(); + } + + /** + * 返回宽度控件的value + * + * @return 宽度 + */ + public double getWidthPaneValue() { + return widthPane.getValue(); + } + + /** + * 设置宽度值 + * + * @param value 值 + */ + public void setWidthPaneValue(int value) { + widthPane.setValue(value); + } + + /** + * 设置高度值 + * + * @param value 值 + */ + public void setHeightPaneValue(int value) { + heightPane.setValue(value); + } + + /** + * 返回高度控件的value + * + * @return 高度 + */ + public double getHeightPaneValue() { + return heightPane.getValue(); + } + + /** + * 返回界面区域大小 + * + * @return Dimension + */ + public Dimension getAreaSize() { + return new Dimension(horScrollBar.getMaximum(), verScrollBar.getMaximum()); + } + + /** + * setAreaSize + * + * @param totalSize + * @param horizontalValue + * @param verticalValue + */ + public void setAreaSize(Dimension totalSize, int horizontalValue, int verticalValue, double width, double height, double slide) { + horScrollBar.setMaximum((int) totalSize.getWidth()); + verScrollBar.setMaximum((int) totalSize.getHeight()); + horScrollBar.setValue(horizontalValue); + verScrollBar.setValue(verticalValue); + // 撤销会refresh底层容器,需要按照之前的宽高和百分比重置下容器size + if (width != widthPane.getValue()) { + widthPane.setValue(width); + reCalculateWidth((int) width); + } + if (height != heightPane.getValue()) { + heightPane.setValue(height); + reCalculateHeight((int) height); + } + // undo时会重新refreshRoot,需要再次按照百分比调整下 + START_VALUE = DEFAULT_SLIDER; + reCalculateRoot(slide, true); + } + + public int getCustomWidth(){ + return this.customWidth; + } + + public int getCustomHeight(){ + return this.customHeight; + } + + /** + * 计算滚动条的值和max + * + * @param oldmax 之前最大值 + * @param max 当前最大值 + * @param newValue 当前value + * @param oldValue 之前value + * @param visi designer的大小 + * @param orientation 滚动条方向 + * @return 计算后的值和max + */ + @Override + public Point calculateScroll(int oldmax, int max, int newValue, int oldValue, int visi, int orientation) { + int scrollMax = orientation == 1 ? verticalMax : horicalMax; + //防止滚动条到达低端还可以继续点击移动(滚动条最大范围不变时,newValue要在范围之内) + if (oldmax == scrollMax + visi && newValue > scrollMax) { + return new Point(oldValue, oldmax); + } + return new Point(newValue, max); + } + + private class FormRulerLayout extends RulerLayout { + public FormRulerLayout() { + super(); + } + + /** + * 表单用的layout,当前不需要标尺 + */ + public void layoutContainer(Container target) { + synchronized (target.getTreeLock()) { + Insets insets = target.getInsets(); + int top = insets.top; + int left = insets.left; + int bottom = target.getHeight() - insets.bottom; + int right = target.getWidth() - insets.right; + Dimension resize = resizePane.getPreferredSize(); + Dimension hbarPreferredSize = null; + Dimension vbarPreferredSize = null; + + resizePane.setBounds(left, bottom - resize.height, right, resize.height); + if (horScrollBar != null) { + hbarPreferredSize = horScrollBar.getPreferredSize(); + vbarPreferredSize = verScrollBar.getPreferredSize(); + horScrollBar.setBounds(left, bottom - hbarPreferredSize.height - resize.height, right - BARSIZE, hbarPreferredSize.height); + verScrollBar.setBounds(right - vbarPreferredSize.width, top, vbarPreferredSize.width, bottom - BARSIZE - resize.height); + } + ChartDesigner dg = ((ChartDesigner) designer); + Rectangle rec = new Rectangle(left + (right - designerwidth) / 2, TOPGAP, right, bottom); + //是否为图表 + if (isValid) { + int maxHeight = bottom - hbarPreferredSize.height - resize.height - TOPGAP * 2; + int maxWidth = right - vbarPreferredSize.width; + designerwidth = designerwidth> maxWidth ? maxWidth : designerwidth; + designerheight = designerheight > maxHeight ? maxHeight : designerheight; + int designerLeft = left + (verScrollBar.getX() - designerwidth) / 2; + rec = new Rectangle(designerLeft, TOPGAP, designerwidth, designerheight); + } + // designer是整个表单设计界面中的面板部分,目前只放自适应布局和参数界面。 + designer.setBounds(rec); + } + } + + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartDesigner.java b/designer_chart/src/com/fr/design/mainframe/ChartDesigner.java new file mode 100644 index 000000000..715c02a32 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/ChartDesigner.java @@ -0,0 +1,264 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe; +import com.fr.form.ui.ChartBook; +import com.fr.design.designer.TargetComponent; +import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; +import com.fr.design.menu.MenuDef; +import com.fr.design.menu.ShortCut; +import com.fr.design.menu.ToolBarDef; + +import javax.swing.*; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionAdapter; +import java.util.ArrayList; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-13 + * Time: 下午4:30 + */ +public class ChartDesigner extends TargetComponent implements MouseListener{ + + private ChartArea chartArea;//上层区域 + private boolean hasCalGap = false; + private ChartDesignerUI designerUI; + private ArrayList changeListeners = new ArrayList(); + private ChartToolBarPane chartToolBarPane; + + public ChartDesigner(ChartBook chartBook) { + super(chartBook); + this.addMouseListener(this); + designerUI = new ChartDesignerUI(); + chartToolBarPane = new ChartToolBarPane(this){ + public Dimension getPreferredSize() { + Dimension size = super.getPreferredSize(); + return new Dimension(size.width, ChartToolBarPane.TOTAL_HEIGHT); + } + }; + this.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseMoved(MouseEvent e) { + if(designerUI!=null){ + designerUI.mouseMoved(e); + ChartDesigner.this.repaint(); + } + } + }); + updateUI();// 初始化界面设计工具的UI实例 + } + + /** + * 设置其UI类为DesignerUI,负责渲染 + */ + @Override + public void updateUI() { + setUI(designerUI); + } + + /** + * 设置上层区域 + * @param chartArea 图表区域 + */ + public void setParent(ChartArea chartArea) { + this.chartArea = chartArea; + } + + /** + * 复制 + */ + public void copy() { + + } + + /** + * 黏贴 + * @return 成功返回true + */ + public boolean paste() { + return false; + } + + /** + * 剪切 + * @return 成功返回TRUE + */ + public boolean cut() { + return false; + } + + /** + * 停止编辑 + */ + public void stopEditing() { + + } + + /** + * 权限编辑面板 + * @return 面板 + */ + public AuthorityEditPane createAuthorityEditPane() { + return null; + } + + /** + * 工具条 + * @return 工具条 + */ + public ToolBarMenuDockPlus getToolBarMenuDockPlus() { + return null; + } + + /** + * 菜单状态 + * @return 状态 + */ + public int getMenuState() { + return 0; + } + + /** + * 东上面板 + * @return 面板 + */ + public JPanel getEastUpPane() { + return null; + } + + /** + * 东下面板 + * @return 面板 + */ + public JPanel getEastDownPane() { + return null; + } + + /** + * 取消格式 + */ + public void cancelFormat() { + + } + + /** + * 图表设计器得工具条项 + * @return 图表设计器得工具条项 + */ + public ToolBarDef[] toolbars4Target() { + return new ToolBarDef[0]; + } + + /** + * 菜单 + * @return 菜单 + */ + public MenuDef[] menus4Target() { + return new MenuDef[0]; + } + + /** + * 菜单项 + * @return 菜单项 + */ + public ShortCut[] shortcut4TemplateMenu() { + return new ShortCut[0]; + } + + /** + * 权限编辑得菜单项 + * @return 菜单项 + */ + public ShortCut[] shortCuts4Authority() { + return new ShortCut[0]; + } + + /** + * 表单得工具条按钮 + * @return 表单得工具条按钮 + */ + public JComponent[] toolBarButton4Form() { + return new JComponent[0]; + } + + + /** + * 返回表单区域 + * @return 表单区域 + */ + public ChartArea getArea() { + return chartArea; + } + + + /** + * 鼠标点击 + * @param e 事件 + */ + public void mouseClicked(MouseEvent e) { + designerUI.mouseClicked(e); + this.chartToolBarPane.populate(); + } + + /** + * 鼠标按下 + * @param e 事件 + */ + public void mousePressed(MouseEvent e) { + + } + + /** + * 鼠标释放 + * @param e 事件 + */ + public void mouseReleased(MouseEvent e) { + + } + + /** + * 鼠标进入 + * @param e 事件 + */ + public void mouseEntered(MouseEvent e) { + + } + + /** + * 鼠标退出 + * @param e 事件 + */ + public void mouseExited(MouseEvent e) { + + } + + + private void registerChangeListener(ChangeListener changeListener){ + if(changeListener == null){ + return; + } + this.changeListeners.add(changeListener); + } + + public ChartToolBarPane getChartToolBarPane(){ + return this.chartToolBarPane; + } + + public void populate(){ + this.chartToolBarPane.populate(); + } + + /** + * 清除工具栏上面全局风格按钮的选中 + */ + public void clearToolBarStyleChoose(){ + chartToolBarPane.clearStyleChoose(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartDesignerPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/ChartDesignerPropertyPane.java new file mode 100644 index 000000000..efa1eea62 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/ChartDesignerPropertyPane.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe; + +import com.fr.base.chart.BaseChartCollection; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.designer.TargetComponent; +import com.fr.design.gui.chart.BaseChartPropertyPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itabpane.TitleChangeListener; +import com.fr.design.mainframe.chart.ChartDesignEditPane; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.general.Inter; + + +import javax.swing.*; +import java.awt.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 下午12:43 + */ +public class ChartDesignerPropertyPane extends BaseChartPropertyPane { + private static ChartDesignerPropertyPane instance; + private TargetComponentContainer container = new TargetComponentContainer(); + private ChartEditPane chartEditPane; + private UILabel nameLabel; + private TitleChangeListener titleListener = new TitleChangeListener() { + + @Override + public void fireTitleChange(String addName) { + nameLabel.setText(Inter.getLocText("Chart-Property_Table") + '-' + addName); + } + }; + + public synchronized static ChartDesignerPropertyPane getInstance() { + if (instance == null) { + instance = new ChartDesignerPropertyPane(); + } + instance.setSureProperty(); + return instance; + } + + public ChartDesignerPropertyPane() { + this.setLayout(new BorderLayout()); + this.setBorder(null); + + createNameLabel(); + this.add(nameLabel, BorderLayout.NORTH); + chartEditPane = ChartDesignEditPane.getInstance(); + this.add(chartEditPane, BorderLayout.CENTER); + } + + private void createNameLabel() { + nameLabel = new UILabel() { + @Override + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, 18); + } + }; + nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0)); + nameLabel.setHorizontalAlignment(SwingConstants.CENTER); + } + + @Override + public void setSureProperty() { + chartEditPane.setContainer(container); + chartEditPane.addTitleChangeListener(titleListener); + String tabname = chartEditPane.getSelectedTabName(); + nameLabel.setText(Inter.getLocText("Chart-Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : "")); + resetChartEditPane(); + + } + + protected void resetChartEditPane() { + remove(chartEditPane); + add(chartEditPane, BorderLayout.CENTER); + validate(); + repaint(); + revalidate(); + } + + @Override + public void setSupportCellData(boolean supportCellData){ + + } + + /** + * 感觉ChartCollection加载图表属性界面. + * @param collection 收集图表 + * @param chartDesigner 图表设计 + */ + public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent chartDesigner) { + if (collection instanceof ChartCollection) { + this.container.setEPane(chartDesigner); + chartEditPane.populate((ChartCollection) collection); + } + } + + @Override + public void setWidgetPropertyPane(BaseWidgetPropertyPane pane) { + + } + + /** + * 刷新 + */ + public void refreshDockingView() { + + } + + @Override + public String getViewTitle() { + return null; + } + + @Override + public Icon getViewIcon() { + return null; + } + + /** + * 位置 + * @return 位置 + */ + public Location preferredLocation() { + return null; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartDesignerUI.java b/designer_chart/src/com/fr/design/mainframe/ChartDesignerUI.java new file mode 100644 index 000000000..5ba44f735 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/ChartDesignerUI.java @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe; + +import com.fr.base.BaseUtils; +import com.fr.base.ScreenResolution; +import com.fr.base.chart.BaseChartGlyph; +import com.fr.chart.chartattr.*; +import com.fr.chart.charttypes.ColumnIndependentChart; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.chart.ChartDesignEditPane; +import com.fr.general.FRLogger; + +import javax.swing.*; +import javax.swing.plaf.ComponentUI; +import java.awt.*; +import java.awt.event.MouseEvent; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-13 + * Time: 下午4:55 + */ +public class ChartDesignerUI extends ComponentUI { + private static final Icon ADD = BaseUtils.readIcon("/com/fr/design/images/add.png"); + private static final Icon DEL = BaseUtils.readIcon("/com/fr/design/images/del.png"); + private static final int ICON_SIZE = 22; + private static final int H_GAP = 2; + private static final int V_GAP = 6; + private Rectangle[] iconLocations; + private Rectangle add; + private Rectangle del; + private UILabel tooltipLabel; + private int overIndex = -1;//鼠标悬浮上去的图表的INDEX + + // 图表当前的设计器 + private ChartDesigner designer; + + public ChartDesignerUI() { + + + } + + /** + * 加载界面 + * + * @param c 组件 + */ + public void installUI(JComponent c) { + designer = (ChartDesigner) c; + } + + /** + * 渲染当前的设计界面以及设计辅助状态 + * + * @param g 画图类 + * @param c 组件 + */ + @Override + public void paint(Graphics g, JComponent c) { + ChartCollection chartCollection = (ChartCollection) designer.getTarget().getChartCollection(); + Chart editingChart = chartCollection.getSelectedChart(); + BaseChartGlyph chartGlyph = null; + if (editingChart != null && editingChart.getPlot() != null) { + chartGlyph = editingChart.createGlyph(editingChart.defaultChartData()); + } + int parentWidth = designer.getSize().width; + int parentHeight = designer.getSize().height; + int chartWidth = designer.getArea().getCustomWidth(); + int chartHeight = designer.getArea().getCustomHeight(); + Graphics clipg; + clipg = g.create(-designer.getArea().getHorizontalValue(), -designer.getArea().getVerticalValue(), parentWidth + designer.getArea().getHorizontalValue(), parentHeight + designer.getArea().getVerticalValue()); + clipg = clipg.create(1, 1, designer.getArea().getCustomWidth(), designer.getArea().getCustomHeight()); + g.setColor(Color.white); + g.fillRect(0, 0, chartWidth, chartHeight); + chartGlyph.setUseChangeChart(true); + Image chartImage = chartGlyph.toImage(chartWidth, chartHeight, ScreenResolution.getScreenResolution()); + clipg.drawImage(chartImage, 0, 0, chartWidth, chartHeight, null); + paintChange(clipg, c); + } + + + //绘制切换的东西 + private void paintChange(Graphics g, JComponent c) { + int chartWidth = designer.getArea().getCustomWidth(); + ChartCollection collection = (ChartCollection) designer.getTarget().getChartCollection(); + int chartCount = collection.getChartCount(); + iconLocations = new Rectangle[chartCount]; + int startX = chartWidth - V_GAP - ICON_SIZE; + if (chartCount == 1) { + //只有一个时,只绘制新增按钮,不绘制删除按钮 + ADD.paintIcon(c, g, startX, H_GAP); + add = new Rectangle(startX, H_GAP, ICON_SIZE, ICON_SIZE); + del = null; + } else { + DEL.paintIcon(c, g, startX, H_GAP); + del = new Rectangle(startX, H_GAP, ICON_SIZE, ICON_SIZE); + startX -= (V_GAP + ICON_SIZE); + ADD.paintIcon(c, g, startX, H_GAP); + add = new Rectangle(startX, H_GAP, ICON_SIZE, ICON_SIZE); + } + + for (int i = chartCount - 1; i >= 0; i--) { + Plot plot = collection.getChart(i).getPlot(); + if (plot == null) { + continue; + } + if (collection.getSelectedIndex() == i) { + Icon ploticon = BaseUtils.readIcon(plot.getPlotSmallIconPath() + "_normal.png"); + if (ploticon != null) { + startX -= (V_GAP + ICON_SIZE); + ploticon.paintIcon(c, g, startX, H_GAP); + } + + }else if(overIndex == i){ + Icon ploticon = BaseUtils.readIcon(plot.getPlotSmallIconPath() + "_over.png"); + if (ploticon != null) { + startX -= (V_GAP + ICON_SIZE); + ploticon.paintIcon(c, g, startX, H_GAP); + } + } else { + Icon ploticon = BaseUtils.readIcon(plot.getPlotSmallIconPath() + "_gray.png"); + if (ploticon != null) { + startX -= (V_GAP + ICON_SIZE); + ploticon.paintIcon(c, g, startX, H_GAP); + } + } + + iconLocations[i] = new Rectangle(startX, H_GAP, ICON_SIZE, ICON_SIZE); + } + } + + /** + * 鼠标点击 + * + * @param e 事件 + */ + public void mouseClicked(MouseEvent e) { + Point clikPoint = new Point(e.getPoint().x + designer.getArea().getHorizontalValue(), e.getPoint().y + designer.getArea().getVerticalValue()); + ChartCollection collection = (ChartCollection) designer.getTarget().getChartCollection(); + for (int i = 0; i < iconLocations.length; i++) { + if (iconLocations[i].contains(clikPoint)) { + if (i == collection.getSelectedIndex()) { + return; + } + collection.setSelectedIndex(i); + designer.repaint(); + ChartDesignEditPane.getInstance().populateSelectedTabPane(); + return; + } + } + + if (add.contains(clikPoint)) { + Chart[] barChart = ColumnIndependentChart.columnChartTypes; + try { + Chart newChart = (Chart) barChart[0].clone(); + int select = collection.getSelectedIndex(); + collection.addNamedChartAtIndex(newChart.getTitle().getTextObject().toString(), newChart,select+1); + collection.setSelectedIndex(select+1); + ChartDesignEditPane.getInstance().populateSelectedTabPane(); + } catch (CloneNotSupportedException e1) { + FRLogger.getLogger().error("Error in Clone"); + } + designer.fireTargetModified(); + ChartDesignEditPane.getInstance().populateSelectedTabPane(); + return; + } + + if (del != null && del.contains(clikPoint)) { + int selectedIndex = collection.getSelectedIndex(); + collection.removeNameObject(selectedIndex); + if (selectedIndex > 0) { + collection.setSelectedIndex(selectedIndex - 1); + } else { + collection.setSelectedIndex(0); + } + designer.fireTargetModified(); + ChartDesignEditPane.getInstance().populateSelectedTabPane(); + } + } + + /** + * 鼠标悬浮上时的数据点提示 + * + * @param e 事件 + */ + public void mouseMoved(MouseEvent e) { + Point clikPoint = new Point(e.getPoint().x + designer.getArea().getHorizontalValue(), e.getPoint().y + designer.getArea().getVerticalValue()); + if (clikPoint.getY() < H_GAP || clikPoint.getY() > H_GAP + ICON_SIZE) { + ToolTip4Chart.getInstance().hideToolTip(); + overIndex = -1; + return; + } + ChartCollection collection = (ChartCollection) designer.getTarget().getChartCollection(); + for (int i = 0; i < iconLocations.length; i++) { + if (iconLocations[i].contains(clikPoint)) { + overIndex = i; + String chartName = collection.getChartName(i); + ToolTip4Chart.getInstance().showToolTip(chartName,e.getXOnScreen(),e.getYOnScreen()); + return; + } + } + ToolTip4Chart.getInstance().hideToolTip(); + overIndex = -1; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java new file mode 100644 index 000000000..d11279fed --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java @@ -0,0 +1,57 @@ +/* + * Copyright(c) 2001-2011, FineReport Inc, All Rights Reserved. + */ +package com.fr.design.mainframe; + +import java.awt.BorderLayout; +import java.awt.Dimension; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.SwingConstants; + +import com.fr.design.gui.ilable.UILabel; + +public class ChartPropertyPane extends MiddleChartPropertyPane{ + + /** + * 创建图表属性表实例. + */ + public synchronized static ChartPropertyPane getInstance() { + if(singleton == null) { + singleton = new ChartPropertyPane(); + } + + singleton.setSureProperty(); + return singleton; + } + + private static ChartPropertyPane singleton; + + @Override + protected void createNameLabel() { + nameLabel = new UILabel() { + @Override + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, 18); + } + }; + nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0)); + nameLabel.setHorizontalAlignment(SwingConstants.CENTER); + } + + @Override + protected void createMainPane() { + this.add(chartEditPane, BorderLayout.CENTER); + } + + @Override + protected JComponent createNorthComponent() { + return nameLabel; + } + + @Override + public void setWidgetPropertyPane(BaseWidgetPropertyPane pane) { + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartToolBarPane.java b/designer_chart/src/com/fr/design/mainframe/ChartToolBarPane.java new file mode 100644 index 000000000..0550c463c --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/ChartToolBarPane.java @@ -0,0 +1,558 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe; + +import com.fr.base.ChartPreStyleManagerProvider; +import com.fr.base.ChartPreStyleServerManager; +import com.fr.base.background.ColorBackground; +import com.fr.chart.base.*; +import com.fr.chart.chartattr.*; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.mainframe.chart.ChartDesignEditPane; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.gui.type.ColumnPlotPane4ToolBar; +import com.fr.design.mainframe.chart.gui.type.PlotPane4ToolBar; +import com.fr.general.FRFont; +import com.fr.general.Inter; +import com.fr.stable.Constants; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-13 + * Time: 下午8:32 + */ +public class ChartToolBarPane extends JPanel { + public static final int TOTAL_HEIGHT = 42; + private static final int COM_HEIGHT = 22; + private static final int GAP = 7; + private static final int COM_GAP = 14; + private static final int COMBOX_WIDTH = 230; + + private static final String[] CHOOSEITEM = new String[]{ + Inter.getLocText("FR-Chart-Type_Column"), + Inter.getLocText("FR-Chart-Type_Line"), + Inter.getLocText("FR-Chart-Type_Bar"), + Inter.getLocText("FR-Chart-Type_Pie"), + Inter.getLocText("FR-Chart-Type_Area"), + Inter.getLocText("FR-Chart-Type_XYScatter"), + Inter.getLocText("FR-Chart-Chart_BubbleChart"), + Inter.getLocText("FR-Chart-Type_Radar"), + Inter.getLocText("FR-Chart-Type_Stock"), + Inter.getLocText("FR-Chart-Type_Meter"), + Inter.getLocText("FR-Chart-Type_Range"), + Inter.getLocText("FR-Chart-Type_Comb"), + Inter.getLocText("FR-Chart-Type_Gantt"), + Inter.getLocText("FR-Chart-Type_Donut"), + Inter.getLocText("FR-Chart-Map_Map"), + "gis"+Inter.getLocText("FR-Chart-Map_Map") + }; + + private UIComboBox chooseComboBox = new UIComboBox(CHOOSEITEM) { + public Dimension getPreferredSize() { + return new Dimension(COMBOX_WIDTH, COM_HEIGHT); + } + }; + + private JPanel stylePane; + private JPanel plotTypeComboBoxPane; + private UIButton topDownShade = new UIButton(Inter.getLocText("FR-Chart-Style_TopDownShade")); + private UIButton transparent = new UIButton(Inter.getLocText("FR-Chart-Style_Transparent")); + private UIButton plane3D = new UIButton(Inter.getLocText("FR-Chart-Style_Plane3D")); + private UIButton gradient = new UIButton(Inter.getLocText("FR-Chart-Style_GradientHighlight")); + private ItemListener itemListener = new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.DESELECTED) { + ChartToolBarPane.this.remove(centerPane); + ChartToolBarPane.this.remove(stylePane); + if(chooseComboBox.getSelectedIndex() < ChartTypeValueCollection.MAP.toInt()){ + calSubChartTypesPane(chooseComboBox.getSelectedIndex()); + ChartToolBarPane.this.add(subChartTypesPane,BorderLayout.CENTER); + centerPane = subChartTypesPane; + ChartToolBarPane.this.add(stylePane, BorderLayout.EAST); + } else{ + calMapSubChartTypesPane(chooseComboBox.getSelectedIndex()); + ChartToolBarPane.this.add(mapTypePane, BorderLayout.CENTER); + centerPane = mapTypePane; + } + ChartCollection chartCollection = (ChartCollection) chartDesigner.getTarget().getChartCollection(); + Chart chart = chartCollection.getSelectedChart(); + ChartToolBarPane.this.validate(); + fireTypeChange(); + + if(chooseComboBox.getSelectedIndex() == ChartTypeValueCollection.MAP.toInt()){ + mapTypePane.populateMapPane(((MapPlot) chart.getPlot()).getMapName()); + }else if(chooseComboBox.getSelectedIndex() == ChartTypeValueCollection.GIS.toInt()){ + mapTypePane.populateMapPane(chart.getChartName()); + } + } + } + }; + private PlotPane4ToolBar subChartTypesPane;//默认柱形图 + + private AbstractMapPlotPane4ToolBar mapTypePane;//地图类型选择的面板 + private JPanel centerPane; + + private ChartDesigner chartDesigner; + private int lastStyleIndex = -1; + private MouseAdapter styleListener = new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + ChartCollection chartCollection = (ChartCollection) chartDesigner.getTarget().getChartCollection(); + Chart chart = chartCollection.getSelectedChart(); + Plot newPlot; + int chartType =chart.getPlot().getPlotType().toInt(); + if(chartType >= ChartTypeValueCollection.MAP.toInt()){ + return; + } + newPlot = subChartTypesPane.setSelectedClonedPlotWithCondition(chart.getPlot()); + chartDesigner.fireTargetModified(); + UIButton button = (UIButton)e.getSource(); + //如果是第二次选中,就是消除 + if(button.isSelected()){ + button.setSelected(false); + chart.setPlot(newPlot); + resetChart(chart); + lastStyleIndex = -1; + ChartDesignEditPane.getInstance().populateSelectedTabPane(); + return; + } + clearStyleChoose(); + setStyle(chart,e,newPlot); + lastStyleIndex = chart.getPlot().getPlotStyle(); + } + }; + + private void setStyle( Chart chart,MouseEvent e,Plot newPlot){ + if (e.getSource() == topDownShade) { + topDownShade.setSelected(true); + chart.setPlot(newPlot); + chart.getPlot().setPlotStyle(ChartConstants.STYLE_SHADE); + resetChart(chart); + createCondition4Shade(chart); + setPlotFillStyle(chart); + } else if (e.getSource() == transparent) { + transparent.setSelected(true); + chart.setPlot(newPlot); + chart.getPlot().setPlotStyle(ChartConstants.STYLE_TRANSPARENT); + resetChart(chart); + createCondition4Transparent(chart); + setPlotFillStyle(chart); + } else if (e.getSource() == plane3D) { + plane3D.setSelected(true); + chart.setPlot(newPlot); + chart.getPlot().setPlotStyle(ChartConstants.STYLE_3D); + resetChart(chart); + createCondition4Plane3D(chart); + setPlotFillStyle(chart); + } else if (e.getSource() == gradient) { + gradient.setSelected(true); + chart.setPlot(newPlot); + chart.getPlot().setPlotStyle(ChartConstants.STYLE_OUTER); + resetChart(chart); + createCondition4HighLight(chart); + setPlotFillStyle(chart); + } + chart.setStyleGlobal(true); + ChartEditPane pane = ChartDesignEditPane.getInstance(); + pane.styleChange(true); + ChartDesignEditPane.getInstance().populate((ChartCollection)chartDesigner.getTarget().getChartCollection()); + pane.styleChange(false); + } + + public ChartToolBarPane(ChartDesigner designer) { + chartDesigner = designer; + subChartTypesPane = new ColumnPlotPane4ToolBar(designer);//默认柱形图 + this.setLayout(new BorderLayout()); + this.setBorder(new EmptyBorder(GAP, COM_GAP, GAP, 0)); + plotTypeComboBoxPane = new JPanel(); + plotTypeComboBoxPane.setBorder(new EmptyBorder(2, 0, 2, 0)); + plotTypeComboBoxPane.setLayout(new BorderLayout()); + plotTypeComboBoxPane.add(chooseComboBox, BorderLayout.CENTER); + chooseComboBox.addItemListener(itemListener); + //默认选择第一个 + chooseComboBox.setSelectedIndex(0); + this.add(plotTypeComboBoxPane, BorderLayout.WEST); + initStylePane(); + this.add(stylePane, BorderLayout.EAST); + this.add(subChartTypesPane, BorderLayout.CENTER); + this.centerPane = subChartTypesPane; + topDownShade.addMouseListener(styleListener); + transparent.addMouseListener(styleListener); + plane3D.addMouseListener(styleListener); + gradient.addMouseListener(styleListener); + } + + private void initStylePane(){ + stylePane = new JPanel() { + public Dimension getPreferredSize() { + Dimension size = super.getPreferredSize(); + return new Dimension(size.width, COM_HEIGHT); + } + }; + stylePane.setLayout(new FlowLayout(FlowLayout.LEFT, COM_GAP, 0)); + stylePane.setBorder(new EmptyBorder(3, 0, 3, 0)); + stylePane.add(topDownShade); + stylePane.add(transparent); + stylePane.add(plane3D); + stylePane.add(gradient); + } + + /** + * 清除工具栏上面全局风格按钮的选中 + */ + public void clearStyleChoose() { + topDownShade.setSelected(false); + transparent.setSelected(false); + plane3D.setSelected(false); + gradient.setSelected(false); + } + + + private void calMapSubChartTypesPane(int index){ + ChartTypeValueCollection type = ChartTypeValueCollection.parse(index); + mapTypePane = PlotToolBarFactory.createToolBar4MapPlot(type,chartDesigner); + } + + private void calSubChartTypesPane(int index) { + ChartTypeValueCollection type = ChartTypeValueCollection.parse(index); + subChartTypesPane = PlotToolBarFactory.createToolBar4NormalPlot(type,chartDesigner); + } + + + private void fireTypeChange() { + if(chooseComboBox.getSelectedIndex() < ChartTypeValueCollection.MAP.toInt()){ + subChartTypesPane.fireChange(); + }else{ + mapTypePane.fireChange(); + } + } + + //图表区属性清空 + private void resetChart(Chart chart) { + chart.setTitle(new Title(chart.getTitle().getTextObject())); + chart.setBorderStyle(Constants.LINE_NONE); + chart.setBorderColor(new Color(150, 150, 150)); + chart.setBackground(null); + setPlotFillStyle(chart); + } + + //高光渐变的默认属性设置 + private void createCondition4HighLight(Chart chart) { + if (chart != null) { + //标题 + Title title = new Title(chart.getTitle().getTextObject()); + chart.setTitle(title); + title.setTitleVisible(true); + TextAttr textAttr = title.getTextAttr(); + if (textAttr == null) { + textAttr = new TextAttr(); + title.setTextAttr(textAttr); + } + title.setPosition(Constants.LEFT); + textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(51, 51, 51))); + + //图例 + Legend legend = new Legend(); + legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138, 140, 139))); + legend.setPosition(Constants.RIGHT_TOP); + chart.getPlot().setLegend(legend); + + //分类轴,现在只有柱形图,条形图,面积图 + if (chart.getPlot() instanceof CategoryPlot) { + CategoryPlot plot = (CategoryPlot) chart.getPlot(); + + //分类轴设置 + Axis cateAxis = plot.getxAxis(); + cateAxis.setAxisStyle(Constants.LINE_THICK); + cateAxis.setAxisColor(new Color(204, 220, 228)); + cateAxis.setTickMarkType(Constants.TICK_MARK_INSIDE); + cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setShowAxisLabel(true); + cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(138, 140, 139))); + + //值轴 + Axis valueAxis = plot.getyAxis(); + valueAxis.setAxisStyle(Constants.NONE); + valueAxis.setAxisColor(null); + valueAxis.setTickMarkType(Constants.TICK_MARK_INSIDE); + valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + valueAxis.setShowAxisLabel(true); + valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(138, 140, 139))); + + //绘图区 + plot.setBorderStyle(Constants.LINE_THIN); + plot.setBorderColor(new Color(204, 220, 228)); + plot.setBackground(ColorBackground.getInstance(new Color(248, 247, 245))); + plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); + plot.getyAxis().setMainGridColor(new Color(192, 192, 192)); + } + + } + } + + //平面3D的默认属性设置 + private void createCondition4Plane3D(Chart chart) { + if (chart != null) { + //标题 + Title title = new Title(chart.getTitle().getTextObject()); + chart.setTitle(title); + title.setTitleVisible(true); + TextAttr textAttr = title.getTextAttr(); + if (textAttr == null) { + textAttr = new TextAttr(); + title.setTextAttr(textAttr); + } + title.setPosition(Constants.CENTER); + textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 16f, new Color(51, 51, 51))); + + //图例 + Legend legend = new Legend(); + legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128, 128, 128))); + legend.setPosition(Constants.TOP); + chart.getPlot().setLegend(legend); + + //分类轴,现在只有柱形图,条形图,面积图 + if (chart.getPlot() instanceof CategoryPlot) { + CategoryPlot plot = (CategoryPlot) chart.getPlot(); + //分类轴设置 + Axis cateAxis = plot.getxAxis(); + cateAxis.setAxisStyle(Constants.LINE_THICK); + cateAxis.setAxisColor(new Color(57, 57, 57)); + cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setShowAxisLabel(true); + cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(57, 57, 57))); + + //值轴设置 + Axis valueAxis = plot.getyAxis(); + valueAxis.setAxisStyle(Constants.LINE_NONE); + valueAxis.setTickMarkType(Constants.TICK_MARK_NONE); + valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + valueAxis.setShowAxisLabel(false); + + //绘图区 + plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); + plot.getyAxis().setMainGridColor(new Color(192, 192, 192)); + chart.setBorderStyle(Constants.LINE_NONE); + + //数据标签 + ConditionAttr attrList = plot.getConditionCollection().getDefaultAttr(); + DataSeriesCondition attr = attrList.getExisted(AttrContents.class); + if (attr != null) { + attrList.remove(attr); + } + AttrContents attrContents = new AttrContents(); + attrContents.setPosition(Constants.OUTSIDE); + attrContents.setSeriesLabel(ChartConstants.VALUE_PARA); + attrContents.setTextAttr(new TextAttr(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(51, 51, 51)))); + attrList.addDataSeriesCondition(attrContents); + } + } + } + + //透明风格的默认属性设置 + private void createCondition4Transparent(Chart chart) { + if (chart != null) { + //标题 + Title title = new Title(chart.getTitle().getTextObject()); + chart.setTitle(title); + title.setTitleVisible(true); + TextAttr textAttr = title.getTextAttr(); + if (textAttr == null) { + textAttr = new TextAttr(); + title.setTextAttr(textAttr); + } + title.setPosition(Constants.LEFT); + textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(192, 192, 192))); + + //图例 + Legend legend = new Legend(); + legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138, 140, 139))); + legend.setPosition(Constants.RIGHT_TOP); + chart.getPlot().setLegend(legend); + + Plot plot = chart.getPlot(); + //绘图区 + chart.setBackground(ColorBackground.getInstance(new Color(51, 51, 51))); + + //分类轴,现在只有柱形图,条形图,面积图 + if (plot instanceof CategoryPlot) { + //边框 + plot.setBorderStyle(Constants.LINE_THIN); + plot.setBorderColor(new Color(65, 65, 65)); + + //分类轴设置 + Axis cateAxis = plot.getxAxis(); + cateAxis.setAxisStyle(Constants.LINE_THICK); + cateAxis.setAxisColor(new Color(192, 192, 192)); + cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setShowAxisLabel(true); + cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(150, 150, 150))); + + //值轴 + Axis valueAxis = plot.getyAxis(); + valueAxis.setShowAxisLabel(true); + valueAxis.setAxisStyle(Constants.LINE_NONE); + valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(150, 150, 150))); + valueAxis.setMainGridStyle(Constants.LINE_THIN); + valueAxis.setMainGridColor(new Color(63, 62, 62)); + } + } + } + + //渐变的默认属性设置 + private void createCondition4Shade(Chart chart) { + if (chart != null) { + //标题 + Title title = new Title(chart.getTitle().getTextObject()); + chart.setTitle(title); + title.setTitleVisible(true); + TextAttr textAttr = title.getTextAttr(); + if (textAttr == null) { + textAttr = new TextAttr(); + title.setTextAttr(textAttr); + } + title.setPosition(Constants.CENTER); + textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(0, 51, 102))); + + //图例 + Legend legend = new Legend(); + legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128, 128, 128))); + legend.setPosition(Constants.BOTTOM); + chart.getPlot().setLegend(legend); + + //分类轴,现在只有柱形图,条形图,面积图 + if (chart.getPlot() instanceof CategoryPlot) { + CategoryPlot plot = (CategoryPlot) chart.getPlot(); + + //分类轴设置 + Axis cateAxis = plot.getxAxis(); + cateAxis.setAxisStyle(Constants.LINE_THICK); + cateAxis.setAxisColor(new Color(73, 100, 117)); + cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setShowAxisLabel(true); + cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(128, 128, 128))); + + //值轴 + Axis valueAxis = plot.getyAxis(); + valueAxis.setShowAxisLabel(true); + valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(128, 128, 128))); + valueAxis.setAxisStyle(Constants.LINE_NONE); + + //绘图区 + plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); + plot.getyAxis().setMainGridColor(new Color(192, 192, 192)); + plot.setHorizontalIntervalBackgroundColor(new Color(243, 243, 243)); + } + } + } + + private void setPlotFillStyle(Chart chart) { + ChartPreStyleManagerProvider manager = ChartPreStyleServerManager.getProviderInstance(); + Plot plot = chart.getPlot(); + Object preStyle = null; + String name = ""; + if (topDownShade.isSelected()) { + name = Inter.getLocText("FR-Chart-Style_Retro"); + preStyle = manager.getPreStyle(name); + } else if (transparent.isSelected()) { + name = Inter.getLocText("FR-Chart-Style_Fresh"); + preStyle = manager.getPreStyle(name); + } else if (plane3D.isSelected()) { + name = Inter.getLocText("FR-Chart-Style_Bright"); + preStyle = manager.getPreStyle(name); + } else if (gradient.isSelected()) { + name = Inter.getLocText("FR-Chart-Style_Bright"); + preStyle = manager.getPreStyle(name); + }else{ + preStyle = null; + } + if (preStyle == null) { + plot.getPlotFillStyle().setColorStyle(ChartConstants.COLOR_DEFAULT); + } else { + AttrFillStyle fillStyle = ((ChartPreStyle) preStyle).getAttrFillStyle(); + fillStyle.setFillStyleName(name); + plot.setPlotFillStyle(fillStyle); + } + + } + + public void populate(){ + ChartCollection chartCollection = (ChartCollection) chartDesigner.getTarget().getChartCollection(); + Chart chart = chartCollection.getSelectedChart(); + chooseComboBox.removeItemListener(itemListener); + chooseComboBox.setSelectedIndex(chart.getPlot().getPlotType().toInt()); + int chartType =chart.getPlot().getPlotType().toInt(); + this.removeAll(); + populateStyle(); + this.add(plotTypeComboBoxPane, BorderLayout.WEST); + initStylePane(); + if(chartType < ChartTypeValueCollection.MAP.toInt()){ + calSubChartTypesPane(chartType); + subChartTypesPane.setSelectedIndex(chart.getPlot().getDetailType()); + ChartToolBarPane.this.add(subChartTypesPane, BorderLayout.CENTER); + this.add(subChartTypesPane, BorderLayout.CENTER); + centerPane = subChartTypesPane; + this.add(stylePane, BorderLayout.EAST); + }else if(chartType == ChartTypeValueCollection.MAP.toInt()){ + calMapSubChartTypesPane(chartType); + mapTypePane.populateMapPane(((MapPlot) chart.getPlot()).getMapName()); + ChartToolBarPane.this.add(mapTypePane, BorderLayout.CENTER); + centerPane = mapTypePane; + }else{ + calMapSubChartTypesPane(chartType); + mapTypePane.populateMapPane((chart.getPlot()).getPlotName()); + ChartToolBarPane.this.add(mapTypePane, BorderLayout.CENTER); + centerPane = mapTypePane; + } + ChartToolBarPane.this.validate(); + chooseComboBox.addItemListener(itemListener); + } + + + + private void populateStyle() { + clearStyleChoose(); + ChartCollection chartCollection = (ChartCollection) chartDesigner.getTarget().getChartCollection(); + Chart chart = chartCollection.getSelectedChart(); + int plotStyle = chart.getPlot().getPlotStyle(); + switch (plotStyle) { + case ChartConstants.STYLE_SHADE: + topDownShade.setSelected(chart.isStyleGlobal() && true); + break; + case ChartConstants.STYLE_TRANSPARENT: + transparent.setSelected(chart.isStyleGlobal() && true); + break; + case ChartConstants.STYLE_3D: + plane3D.setSelected(chart.isStyleGlobal() && true); + break; + case ChartConstants.STYLE_OUTER: + gradient.setSelected(chart.isStyleGlobal() && true); + break; + default: + clearStyleChoose(); + break; + } + lastStyleIndex = plotStyle; + } + + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartUndoState.java b/designer_chart/src/com/fr/design/mainframe/ChartUndoState.java new file mode 100644 index 000000000..04809b0de --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/ChartUndoState.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe; + +import com.fr.form.ui.ChartBook; + +import java.awt.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-13 + * Time: 下午2:32 + */ +public class ChartUndoState extends BaseUndoState { + private ChartBook chartBook; + private Dimension designerSize; + private double widthValue; + private double heightValue; + + public ChartUndoState(JChart t,ChartArea area) { + super(t); + try { + this.chartBook = (ChartBook) t.getTarget().clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + this.widthValue =area.getCustomWidth(); + this.heightValue = area.getCustomHeight(); + } + + + public ChartBook getChartBook(){ + return this.chartBook; + } + + /** + * 应用状态 + */ + public void applyState() { + this.getApplyTarget().applyUndoState(this); + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/DesignerFrame4Chart.java b/designer_chart/src/com/fr/design/mainframe/DesignerFrame4Chart.java new file mode 100644 index 000000000..d282aa104 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/DesignerFrame4Chart.java @@ -0,0 +1,98 @@ +package com.fr.design.mainframe; + +import com.fr.design.ChartEnvManager; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.mainframe.actions.UpdateVersion; +import com.fr.design.mainframe.chart.UpdateOnLinePane; +import com.fr.design.mainframe.toolbar.ToolBarMenuDock; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.json.JSONObject; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; + +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.util.ArrayList; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class DesignerFrame4Chart extends DesignerFrame { + + /** + * Constructor. + * + * @param ad + */ + public DesignerFrame4Chart(ToolBarMenuDock ad) { + super(ad); + } + + + + + + protected ArrayList getFrameListeners(){ + ArrayList listeners = super.getFrameListeners(); + listeners.add(0, new WindowAdapter() { + @Override + public void windowOpened(WindowEvent e) { + super.windowOpened(e); + judgeFirstUseWhenStart(); + } + }); + return listeners; + } + + /** + * 退出 + */ + public void exit() { + ChartEnvManager.getEnvManager().saveXMLFile(); + super.exit(); + } + + //不需要西侧的文件树面板 + protected void laoyoutWestPane(){ + + } + + protected void judgeFirstUseWhenStart(){ + boolean isNeed2Check =ChartEnvManager.getEnvManager().isPushUpdateAuto() || ChartEnvManager.getEnvManager().isOverOneMonth(); + if(!StableUtils.checkDesignerActive(ChartEnvManager.getEnvManager().getActivationKey()) + || isNeed2Check){ + ChartEnvManager.getEnvManager().setActivationKey(ChartEnvManager.ACTIVE_KEY); + checkVersion(); + if(ChartEnvManager.getEnvManager().isOverOneMonth()){ + ChartEnvManager.getEnvManager().resetCheckDate(); + } + } + } + + private void checkVersion(){ + + new UpdateVersion(){ + protected void done() { + try { + JSONObject serverVersion = get(); + String version = serverVersion.getString(UpdateVersion.VERSION); + if(!ComparatorUtils.equals(ProductConstants.RELEASE_VERSION, version)){ + UpdateOnLinePane updateOnLinePane = new UpdateOnLinePane(version); + BasicDialog dg = updateOnLinePane.showWindow4UpdateOnline(DesignerContext.getDesignerFrame()); + updateOnLinePane.setParentDialog(dg); + dg.setVisible(true); + } + }catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + }.execute(); + } + + + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/GisMapPlotPane4ToolBar.java b/designer_chart/src/com/fr/design/mainframe/GisMapPlotPane4ToolBar.java new file mode 100644 index 000000000..4cf8da691 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/GisMapPlotPane4ToolBar.java @@ -0,0 +1,203 @@ +package com.fr.design.mainframe; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartattr.*; +import com.fr.chart.charttypes.GisMapIndependentChart; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.FRLogger; +import com.fr.general.Inter; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + * Date: 14/12/1 + * Time: 下午3:11 + */ +public class GisMapPlotPane4ToolBar extends AbstractMapPlotPane4ToolBar { + private static final int BAIDU = 0; + private static final int GOOGLE= 1; + + + private static final String[] TYPE_NAMES = new String[]{ + Inter.getLocText("FR-Chart-Map_Baidu"), + Inter.getLocText("FR-Chart-Map_Google")}; + + + private UITextField keyField = new UITextField(){ + public Dimension getPreferredSize() { + return new Dimension(COMBOX_WIDTH, COM_HEIGHT); + } + }; + + private DocumentListener keyListener = new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + fireKeyChange(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + fireKeyChange(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + fireKeyChange(); + } + } ; + + private void fireKeyChange(){ + ChartCollection chartCollection = (ChartCollection)chartDesigner.getTarget().getChartCollection(); + Chart chart =chartCollection.getSelectedChart(); + GisMapPlot plot =(GisMapPlot) chart.getPlot(); + String key = this.keyField.getText().trim(); + if(plot.isGisType() && key != plot.getBaiduKey()){ + plot.setBaiduKey(key); + }else if(!plot.isGisType() && key != plot.getGoogleKey()){ + plot.setGoogleKey(key); + } + chartDesigner.fireTargetModified(); + } + + public GisMapPlotPane4ToolBar(final ChartDesigner chartDesigner){ + super(chartDesigner); + this.add(getKeyPane()); + keyField.getDocument().addDocumentListener(keyListener); + } + + private JPanel getKeyPane(){ + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p,f}; + double[] rowSize = {p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel("key"),keyField}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + + protected void calculateDetailMaps(int mapType){ + switch (mapType) { + case BAIDU: + populateDetilMaps(Inter.getLocText("FR-Chart-Map_Baidu")); + break; + case GOOGLE: + populateDetilMaps(Inter.getLocText("FR-Chart-Map_Google")); + break; + default: + populateDetilMaps(Inter.getLocText("FR-Chart-Map_Baidu")); + } + fireMapChange(); + + } + + /** + * 更新地图面板 + * @param mapType 地图名字 + */ + public void populateMapPane(String mapType){ + super.populateMapPane(mapType); + populateDetilMaps(mapTypeComboBox.getSelectedItem().toString()); + } + + protected void populateDetilMaps(String mapType){ + mapTypeComboBox.removeItemListener(mapTypeListener); + ChartCollection chartCollection = (ChartCollection)chartDesigner.getTarget().getChartCollection(); + Chart chart =chartCollection.getSelectedChart(); + GisMapPlot plot = (GisMapPlot) chart.getPlot(); + keyField.getDocument().removeDocumentListener(keyListener); + if(plot.isGisType()){ + keyField.setText(plot.getBaiduKey()); + mapTypeComboBox.setSelectedIndex(0); + }else{ + keyField.setText(plot.getGoogleKey()); + mapTypeComboBox.setSelectedIndex(1); + } + keyField.getDocument().addDocumentListener(keyListener); + mapTypeComboBox.addItemListener(mapTypeListener); + } + + private void fireMapChange(){ + ChartCollection chartCollection = (ChartCollection)chartDesigner.getTarget().getChartCollection(); + Chart chart =chartCollection.getSelectedChart(); + if(chart.getPlot().getPlotStyle() != ChartConstants.STYLE_NONE){ + resetChart(chart); + } + + Chart[] cs = GisMapIndependentChart.gisChartTypes; + GisMapPlot plot; + if (cs.length > 0) { + try { + plot = (GisMapPlot)cs[0].getPlot().clone(); + } catch (Exception e) { + plot = new GisMapPlot(); + } + } else { + plot = new GisMapPlot(); + } + + try { + chart.switchPlot((Plot)plot.clone()); + } catch (CloneNotSupportedException e) { + FRLogger.getLogger().error("Error In GisChart"); + chart.switchPlot(new GisMapPlot()); + } + + plot = (GisMapPlot) chart.getPlot(); + boolean index = plot.isGisType(); + plot.setGisType(mapTypeComboBox.getSelectedIndex() == 1); + + if(index != plot.isGisType()){ + if(plot.isGisType()){ + this.keyField.setText(plot.getBaiduKey()); + }else{ + this.keyField.setText(plot.getGoogleKey()); + } + }else{ + String key = this.keyField.getText().trim(); + if(plot.isGisType() && key != plot.getBaiduKey()){ + plot.setBaiduKey(key); + }else if(!plot.isGisType() && key != plot.getGoogleKey()){ + plot.setGoogleKey(key); + } + } + chartDesigner.fireTargetModified(); + } + + protected Plot getSelectedClonedPlot() { + Chart[] mapChart = GisMapIndependentChart.gisChartTypes; + GisMapPlot newPlot; + if (mapChart.length > 0) { + try { + newPlot = (GisMapPlot)mapChart[0].getPlot().clone(); + } catch (Exception e) { + newPlot = new GisMapPlot(); + } + } else { + newPlot = new GisMapPlot(); + } + + Plot cloned = null; + try { + cloned = (Plot) newPlot.clone(); + } catch (CloneNotSupportedException e) { + FRLogger.getLogger().error("Error In GisMapChart"); + } + return cloned; + } + + public String[] getMapTypes(){ + return TYPE_NAMES; + } + + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/JChart.java b/designer_chart/src/com/fr/design/mainframe/JChart.java new file mode 100644 index 000000000..147c4d1b3 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/JChart.java @@ -0,0 +1,376 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + * 图表类型文件 + */ + +package com.fr.design.mainframe; + +import com.fr.base.BaseUtils; +import com.fr.base.FRContext; +import com.fr.file.FILEChooserPane; +import com.fr.file.FILEChooserPane4Chart; +import com.fr.form.ui.ChartBook; +import com.fr.design.DesignModelAdapter; +import com.fr.design.event.TargetModifiedEvent; +import com.fr.design.event.TargetModifiedListener; +import com.fr.design.gui.imenu.UIMenuItem; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.actions.ExcelExportAction4Chart; +import com.fr.design.mainframe.actions.PDFExportAction4Chart; +import com.fr.design.mainframe.actions.PNGExportAction4Chart; +import com.fr.design.mainframe.form.FormECCompositeProvider; +import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; +import com.fr.design.menu.ShortCut; +import com.fr.design.menu.ToolBarDef; +import com.fr.file.FILE; +import com.fr.general.Inter; +import com.fr.json.JSONArray; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.datatransfer.StringSelection; + +/** + * 图表crt文件 + *

+ * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-13 + * Time: 下午2:28 + */ +public class JChart extends JTemplate { + public static final String XML_TAG = "JChart"; + private static final String CHART_CARD = "FORM"; + private static final String ELEMENTCASE_CARD = "ELEMENTCASE"; + + private static final String[] CARDNAME = new String[]{CHART_CARD, ELEMENTCASE_CARD}; + private static final int TOOLBARPANEDIMHEIGHT_FORM = 60; + //图表设计器 + ChartDesigner chartDesigner; + + //中间编辑区域, carllayout布局 + private JPanel tabCenterPane; + private CardLayout cardLayout; + //当前编辑的组件对象 + private JComponent editingComponent; + private FormECCompositeProvider reportComposite; + + public JChart() { + super(new ChartBook(), "Chart"); + } + + public JChart(ChartBook chartFile, FILE file) { + super(chartFile, file); + } + + @Override + protected JPanel createCenterPane() { + tabCenterPane = FRGUIPaneFactory.createCardLayout_S_Pane(); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + centerPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, new Color(85, 85, 85))); + chartDesigner = new ChartDesigner(this.getTarget()); + ChartArea area = new ChartArea(chartDesigner); + centerPane.add(area, BorderLayout.CENTER); + tabCenterPane.add(centerPane, CHART_CARD, 0); + chartDesigner.addTargetModifiedListener(new TargetModifiedListener() { + public void targetModified(TargetModifiedEvent e) { + JChart.this.fireTargetModified();// 调用保存*, 调用刷新界面, 刷新工具栏按钮 + } + }); + + this.add(tabCenterPane, BorderLayout.CENTER); + return tabCenterPane; + } + + /** + * 移除选择 + */ + public void removeTemplateSelection() { + + } + + /** + * 刷新容器 + */ + public void refreshContainer() { + + } + + /** + * 移除参数面板选择 + */ + public void removeParameterPaneSelection() { + + } + + /** + * 创建设计模式 + * + * @return 返回模式 + */ + protected DesignModelAdapter createDesignModel() { + return null; + } + + /** + * 创建预览得菜单 + * + * @return 菜单 + */ + public UIMenuItem[] createMenuItem4Preview() { + return new UIMenuItem[0]; + } + + /** + * 创建撤销状态 + * + * @return 状态 + */ + protected ChartUndoState createUndoState() { + return new ChartUndoState(this,chartDesigner.getArea()); + } + + /** + * 应用撤销状态 + * + * @param chartUndoState 撤销状态 + */ + protected void applyUndoState(ChartUndoState chartUndoState) { + try { + this.setTarget((ChartBook)chartUndoState.getChartBook().clone()); + chartDesigner.setTarget(this.getTarget()); + chartDesigner.populate(); + }catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + } + + /** + * 后缀 + * + * @return 后缀 + */ + public String suffix() { + return ".crt"; + } + + /** + * 复制 + */ + public void copy() { + + } + + /** + * 黏贴 + * + * @return 是否鸟贴成功 + */ + public boolean paste() { + return false; + } + + /** + * 是否剪切 + * + * @return 剪切成功 + */ + public boolean cut() { + return false; + } + + /** + * 创建权限编辑面板 + * + * @return 面板 + */ + public AuthorityEditPane createAuthorityEditPane() { + return null; + } + + /** + * 工具栏 + * + * @return 工具栏 + */ + public ToolBarMenuDockPlus getToolBarMenuDockPlus() { + return null; + } + + /** + * 东上面板 + * + * @return 面板 + */ + public JPanel getEastUpPane() { + return null; + } + + /** + * 东下面板 + * + * @return 面板 + */ + public JPanel getEastDownPane() { + return null; + } + + /** + * 工具栏菜单 + * + * @return 菜单 + */ + public ToolBarDef[] toolbars4Target() { + return new ToolBarDef[0]; + } + + /** + * 表单面板 + * + * @return 面板 + */ + public JPanel[] toolbarPanes4Form() { + return new JPanel[0]; + } + + /** + * 模版菜单 + * + * @return 模版菜单 + */ + public ShortCut[] shortcut4TemplateMenu() { + return new ShortCut[0]; + } + + /** + * 权限编辑菜单 + * + * @return 菜单 + */ + public ShortCut[] shortCuts4Authority() { + return new ShortCut[0]; + } + + /** + * 工具条表单 + * + * @return 表单 + */ + public JComponent[] toolBarButton4Form() { + return new JComponent[0]; + } + + /** + * 权限编辑工具栏,但是图表设计器里面用于正常工具栏不是全县编辑 + * + * @return 工具条 + */ + public JComponent toolBar4Authority() { + return chartDesigner.getChartToolBarPane(); + } + + /** + * 工具条高度 + * + * @return 工具条高度 + */ + public int getToolBarHeight() { + return 0; + } + + /** + * 是否是报表 + * + * @return 不是 + */ + public boolean isJWorkBook() { + return false; + } + + /** + * 是否是图表 + * + * @return 是则返回true + */ + public boolean isChartBook() { + return true; + } + + /** + * 设置权限编辑模式 + * + * @param isUpMode 没有权限编辑 + */ + public void setAuthorityMode(boolean isUpMode) { + + } + + /** + * 刷新工具区域 + */ + public void refreshToolArea() { + DesignerContext.getDesignerFrame().resetToolkitByPlus(JChart.this); + chartDesigner.populate(); + ChartDesignerPropertyPane.getInstance().populateChartPropertyPane(getTarget().getChartCollection(), chartDesigner); + EastRegionContainerPane.getInstance().replaceUpPane(ChartDesignerPropertyPane.getInstance()); + } + + /** + * 导出菜单的子菜单 ,目前用于图表设计器 + * + * @return 子菜单 + */ + public ShortCut[] shortcut4ExportMenu() { + return new ShortCut[]{new PNGExportAction4Chart(this), new ExcelExportAction4Chart(this), new PDFExportAction4Chart(this)}; + } + + public Icon getIcon() { + return BaseUtils.readIcon("/com/fr/design/images/chart.png"); + } + + public ChartDesigner getChartDesigner(){ + return chartDesigner; + } + + /** + * 复制JS代码 + */ + public void copyJS(){ + JSONObject jsonObject =this.getTarget().createExportConfig(); + String jsonString = StringUtils.EMPTY; + if(jsonObject != null){ + try{ + if(jsonObject.has("charts")){ + JSONArray charts = jsonObject.getJSONArray("charts"); + jsonString = charts.toString(2); + }else{ + jsonString = jsonObject.toString(2); + } + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Chart-CopyJS_Message"), Inter.getLocText("FR-Chart-Action_Copy")+"JS", JOptionPane.INFORMATION_MESSAGE); + }catch (JSONException ex){ + FRContext.getLogger().error(ex.getMessage()); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Chart-CopyJS_Failed")+"!", Inter.getLocText("Error"), JOptionPane.ERROR_MESSAGE); + } + }else{ + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Chart-CopyJS_Failed")+"!", Inter.getLocText("Error"), JOptionPane.ERROR_MESSAGE); + } + StringSelection stringSelection = new StringSelection(jsonString); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null); + }; + + /** + * 系列风格改动 + */ + public void styleChange(){ + chartDesigner.clearToolBarStyleChoose(); + } + + protected FILEChooserPane getFILEChooserPane(boolean isShowLoc){ + return new FILEChooserPane4Chart(true, isShowLoc); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/MapArrayPane.java b/designer_chart/src/com/fr/design/mainframe/MapArrayPane.java new file mode 100644 index 000000000..14926e71c --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/MapArrayPane.java @@ -0,0 +1,339 @@ +package com.fr.design.mainframe; + +import com.fr.chart.base.MapSvgAttr; +import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.design.DesignerEnvManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.controlpane.*; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilist.JNameEdList; +import com.fr.design.gui.ilist.ListModelElement; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.stable.CoreConstants; +import com.fr.stable.Nameable; +import com.fr.stable.StringUtils; +import com.fr.stable.core.PropertyChangeAdapter; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + * Date: 14/12/3 + * Time: 上午10:00 + */ +public class MapArrayPane extends JControlPane { + private static final int LEFT_WIDTH = 180; + private static final Color LINE_COLOR = new Color(176, 176, 176); + private static final int TOP_GAP = 5; + + private static final String[] TYPE_NAMES = new String[]{ + Inter.getLocText("FR-Chart-World_Map"), + Inter.getLocText("FR-Chart-State_Map"), + Inter.getLocText("FR-Chart-Province_Map"), + Inter.getLocText("FR-Chart-Custom_Map")}; + + private String mapType; + private String mapDetailName; + + MapPlotPane4ToolBar toolBar; + UIComboBox mapTypeBox; + private ArrayList editedNames = new ArrayList(); + + private ItemListener typeListener = new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + MapArrayPane.this.updateBeans(); + mapType = mapTypeBox.getSelectedItem().toString(); + MapArrayPane.this.populate(MapSvgXMLHelper.getInstance().getAllMapObjects4Cate(mapType)); + } + }; + + + private ArrayList removeNames = new ArrayList(); + private MapEditPane mapEditPane; + private ChartDesigner chartDesigner; + + public MapArrayPane(String mapType, String mapDetailName,ChartDesigner chartDesigner) { + this.mapDetailName = mapDetailName; + this.mapType = mapType; + if (mapTypeBox != null) { + mapTypeBox.setSelectedItem(mapType); + } + this.chartDesigner = chartDesigner; + mapTypeBox.addItemListener(typeListener); + this.setBorder(new EmptyBorder(TOP_GAP, 0, 0, 0)); + this.addEditingListner(new PropertyChangeAdapter() { + public void propertyChange() { + dealPropertyChange(); + } + }); + } + + public void setToolBarPane(MapPlotPane4ToolBar pane) { + this.toolBar = pane; + } + + protected void doWhenPopulate(BasicBeanPane beanPane) { + mapEditPane = (MapEditPane)beanPane; + mapEditPane.dealWidthMap(mapType); + String editingName = ((MapEditPane)beanPane).getCurrentMapName(); + if(!editedNames.contains(editingName)){ + editedNames.add(editingName); + } + } + + protected JPanel getLeftPane() { + JPanel centerPane = super.getLeftPane(); + mapTypeBox = new UIComboBox(TYPE_NAMES); + JPanel leftPane = new JPanel(); + leftPane.setLayout(new BorderLayout()); + leftPane.setBorder(new EmptyBorder(3, 0, 0, 0)); + leftPane.add(mapTypeBox, BorderLayout.NORTH); + leftPane.add(centerPane, BorderLayout.CENTER); + return leftPane; + } + + + private void dealPropertyChange() { + MapSvgXMLHelper helper = MapSvgXMLHelper.getInstance(); + java.util.List nameList =helper.getNamesListWithCateName(mapType); + String[] allListNames = nameableList.getAllNames(); + allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; + String tempName = getEditingName(); + if (StringUtils.isEmpty(tempName)) { + String[] warning = new String[]{"NOT_NULL_Des", "Please_Rename"}; + String[] sign = new String[]{",", "!"}; + nameableList.stopEditing(); + JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(MapArrayPane.this), Inter.getLocText(warning, sign)); + setWarnigText(editingIndex); + return; + } + if (!ComparatorUtils.equals(tempName, selectedName) + && isNameRepeted(new List[]{nameList, Arrays.asList(allListNames)}, tempName)) { + nameableList.stopEditing(); + JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(MapArrayPane.this), + Inter.getLocText(new String[]{"FR-Chart-Map_NameAlreadyExist", "Please_Rename"}, new String[]{",", "!"})); + setWarnigText(editingIndex); + return; + } + String oldname = mapEditPane.getCurrentMapName(); + mapEditPane.setCurrentMapName(tempName); + mapEditPane.dealWidthMap(mapType); + if(editedNames.contains(oldname)){ + editedNames.remove(oldname); + editedNames.add(tempName); + } + if(helper.getNewMapAttr(oldname) != null){ + MapSvgAttr attr = helper.getNewMapAttr(oldname); + attr.renameMap(tempName); + helper.removeNewMapAttr(oldname); + helper.addNewSvgMaps(tempName,attr); + } + this.toolBar.fireTargetModified(); + this.saveMapInfo(tempName); + } + + protected void doAfterRemove(){ + for(String map2Remove : removeNames){ + MapSvgXMLHelper.getInstance().removeMapAttr(map2Remove); + MapSvgXMLHelper.getInstance().removeNewMapAttr(map2Remove); + } + update4AllType(); + } + + protected void doBeforeRemove(){ + removeNames.clear(); + for(int index : nameableList.getSelectedIndices()){ + removeNames.add(nameableList.getNameAt(index)); + } + } + + //保存修改过的地图信息 + private void saveMapInfo(final String mapName) { + SwingWorker worker = new SwingWorker() { + @Override + protected Integer doInBackground() throws Exception { + MapSvgAttr attr = MapSvgXMLHelper.getInstance().getMapAttr(mapName);// 只有在编辑地图时才需要储存相关数据 @kuns + if (attr != null) { + attr.writeBack(mapName); + } + return 0; + } + + @Override + protected void done() { + FRLogger.getLogger().info(Inter.getLocText("FR-Chart-Map_Saved")); // 地图已经保存. + } + + }; + worker.execute(); + DesignerEnvManager.addWorkers(worker); + } + + private void update4AllType() { + MapSvgXMLHelper helper = MapSvgXMLHelper.getInstance(); + helper.clearNames4Cate(mapType); + for(String name : nameableList.getAllNames()){ + MapSvgAttr attr = helper.getMapAttr(name); + if(attr == null){ + continue; + } + helper.addCateNames(attr.getMapType(),attr.getName()); + } + } + + + /** + * 创建菜单 + * + * @return 菜单 + */ + public NameableCreator[] createNameableCreators() { + return new NameableCreator[]{ + new NameableSelfCreator(Inter.getLocText("FR-Chart-Custom_Map"), MapSvgAttr.class, MapEditPane.class) { + public MapSvgAttr createNameable(UnrepeatedNameHelper helper) { + MapSvgAttr attr = new MapSvgAttr(); + attr.setFilePath(MapSvgXMLHelper.customMapPath() + CoreConstants.SEPARATOR + helper.createUnrepeatedName(Inter.getLocText("FR-Chart-Custom_Map")) + ".svg"); + MapSvgXMLHelper.getInstance().addNewSvgMaps(attr.getName(), attr); + update4Edited(attr.getName()); + // 返回参数设置面板. + return attr; + } + + @Override + public String createTooltip() { + return null; + } + + public void saveUpdatedBean(ListModelElement wrapper, Object bean) { + wrapper.wrapper = (Nameable)bean; + } + } + }; + } + + protected boolean isCreatorNeedIocn() { + return false; + } + + protected ShortCut4JControlPane[] createShortcuts() { + return new ShortCut4JControlPane[]{ + addItemShortCut(), + removeItemShortCut(), + }; + } + + protected int getLeftPreferredSize() { + return LEFT_WIDTH; + } + + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"FR-Chart-Map_Map", "FR-Chart-Data_Edit"}); + } + + /** + * 更新 + */ + public void updateBeans() { + super.update(); + this.update4AllType(); + this.updateAllEditedAttrMaps(); + MapSvgXMLHelper.getInstance().clearTempAttrMaps(); + //versionID递增 + this.toolBar.fireTargetModified(); + this.saveMapInfo(selectedName); + } + + /** + * 创建list + * @return 返回list + */ + public JNameEdList createJNameList() { + JNameEdList nameEdList = new JNameEdList(new DefaultListModel()) { + + public Rectangle createRect(Rectangle rect, int iconWidth) { + return rect; + } + + protected void doAfterLostFocus() { + MapArrayPane.this.updateControlUpdatePane(); + } + + public void setNameAt(String name, int index) { + super.setNameAt(name,index); + update4Edited(name); + } + + }; + nameEdList.setCellRenderer(new NameableListCellRenderer()); + return nameEdList; + } + + + protected void update4Edited(String editingName){ + + } + + private void updateAllEditedAttrMaps(){ + MapSvgXMLHelper helper = MapSvgXMLHelper.getInstance(); + for(String editedName : editedNames){ + if(helper.getMapAttr(editedName)!=null){ + helper.getMapAttr(editedName).writeBack(editedName); + }else if(helper.getNewMapAttr(editedName)!=null){ + helper.getNewMapAttr(editedName).writeBack(editedName); + } + } + } + + //根据地图的名字返回地图的图片 + private Image getMapImage(String mapName) { + if (MapSvgXMLHelper.getInstance().containsMapName(mapName)) { + MapSvgAttr mapAttr = MapSvgXMLHelper.getInstance().getMapAttr(mapName); + if (mapAttr == null) { + return null; + } + return mapAttr.getMapImage(); + } + + return null; + } + + /* + * Nameable的ListCellRenerer + */ + private class NameableListCellRenderer extends + DefaultListCellRenderer { + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, + cellHasFocus); + + if (value instanceof ListModelElement) { + Nameable wrappee = ((ListModelElement) value).wrapper; + this.setText(((ListModelElement) value).wrapper.getName()); + + for (NameableCreator creator : MapArrayPane.this.creators()) { + if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) { + this.setIcon(creator.menuIcon()); + this.setToolTipText(creator.createTooltip()); + break; + } + } + } + return this; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/MapEditPane.java b/designer_chart/src/com/fr/design/mainframe/MapEditPane.java new file mode 100644 index 000000000..4c137afb7 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/MapEditPane.java @@ -0,0 +1,121 @@ +package com.fr.design.mainframe; + +import com.fr.chart.base.MapSvgAttr; +import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.chart.chartglyph.MapShapeValue; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.series.PlotSeries.AbstrctMapAttrEditPane; +import com.fr.design.chart.series.PlotSeries.MapCustomPane; +import com.fr.design.chart.series.PlotSeries.MapDefiAreaNamePane; +import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.general.Inter; +import com.fr.stable.CoreConstants; +import com.fr.stable.StringUtils; + +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + * Date: 14/12/2 + * Time: 下午7:17 + */ +public class MapEditPane extends BasicBeanPane{ + + private UITabbedPane tabbedPane; + private MapCustomPane areaPane ; +// private MapCustomPane pointPane; + private MapDefiAreaNamePane namedPane; + private String currentMapName; + private AbstrctMapAttrEditPane editingPane; + + private ChangeListener tabbedChangeListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + switch ( tabbedPane.getSelectedIndex()){ + case 1: + namedPane.populateMapAttr(editingPane.updateCurrentAttr()); + editingPane = namedPane; + break; + default: + areaPane.populateMapAttr(editingPane.updateCurrentAttr()); + editingPane = areaPane; + } + } + } ; + + public MapEditPane(){ + initTabbedPane(); + this.setLayout(new BorderLayout()); + this.add(tabbedPane,BorderLayout.CENTER); + } + + private void initTabbedPane(){ + tabbedPane = new UITabbedPane(); + areaPane = new MapCustomPane(false); +// pointPane = new MapCustomPane(false); + namedPane= new MapDefiAreaNamePane(false); + areaPane.setImageSelectType(MapShapeValue.AREA); +// pointPane.setImageSelectType(MapShapeValue.POINT); + tabbedPane.add(Inter.getLocText("FR-Chart-Map_ImageArea"),areaPane); +// tabbedPane.add(Inter.getLocText("FR-Chart-Map_ImagePoint"),pointPane); + tabbedPane.add(Inter.getLocText("FR-Chart-Map_Corresponding_Fields"),namedPane); + editingPane = areaPane; + } + + @Override + protected String title4PopupWindow() { + return null; + } + + @Override + public void populateBean(MapSvgAttr ob) { + if(!StringUtils.isEmpty(ob.getName()) && !MapSvgXMLHelper.getInstance().containsMapName(ob.getName())){ + MapSvgAttr mapSvgAttr = new MapSvgAttr(); + mapSvgAttr.setFilePath(MapSvgXMLHelper.customMapPath()+ CoreConstants.SEPARATOR+ob.getName()+".svg"); + MapSvgXMLHelper.getInstance().addNewSvgMaps(ob.getName(), mapSvgAttr); + } + + currentMapName = ob.getName(); + if(editingPane == null){ + editingPane = areaPane; + } + editingPane.populateMapAttr(ob); + tabbedPane.addChangeListener(tabbedChangeListener); + } + + public String getCurrentMapName(){ + return currentMapName; + } + + public void setCurrentMapName(String currentMapName){ + this.currentMapName = currentMapName; + + } + + /** + * 再图片面板设置类型和名字 + * @param mapType 地图类型 + */ + public void dealWidthMap(String mapType){ + areaPane.setTypeNameAndMapName(mapType,currentMapName); +// pointPane.setTypeNameAndMapName(mapType,currentMapName); + } + + @Override + public MapSvgAttr updateBean() { + MapSvgAttr currentAttr = editingPane.updateCurrentAttr(); + currentMapName =currentAttr != null ? currentAttr.getName() : currentMapName; + MapSvgAttr attr = MapSvgXMLHelper.getInstance().getMapAttr(currentMapName); + if(attr != null ){ + MapSvgXMLHelper.getInstance().removeNewMapAttr(currentMapName); + MapSvgXMLHelper.getInstance().pushMapAttr(currentMapName,currentAttr); + return currentAttr; + }else{ + return MapSvgXMLHelper.getInstance().getNewMapAttr(currentMapName); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/MapPlotPane4ToolBar.java b/designer_chart/src/com/fr/design/mainframe/MapPlotPane4ToolBar.java new file mode 100644 index 000000000..62a149647 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/MapPlotPane4ToolBar.java @@ -0,0 +1,210 @@ +package com.fr.design.mainframe; + +import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.chart.chartattr.*; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.mainframe.chart.ChartDesignEditPane; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + * Date: 14/12/1 + * Time: 上午11:57 + */ +public class MapPlotPane4ToolBar extends AbstractMapPlotPane4ToolBar{ + + private static final int WORLD_MAP = 0; + private static final int STATE_MAP = 1; + private static final int PROVINCE_MAP = 2; + private static final int CUSTOM_MAP = 3; + private static final int BUTTON_WIDTH = 44; + + + private static final String[] TYPE_NAMES = new String[]{ + Inter.getLocText("FR-Chart-World_Map"), + Inter.getLocText("FR-Chart-State_Map"), + Inter.getLocText("FR-Chart-Province_Map"), + Inter.getLocText("FR-Chart-Custom_Map")}; + + private String lastEditingName =StringUtils.EMPTY; + + private UIButton mapEditButton = new UIButton(Inter.getLocText("FR-Chart-Data_Edit")){ + public Dimension getPreferredSize() { + return new Dimension(BUTTON_WIDTH, COM_HEIGHT); + } + }; + + protected UIComboBox detailMaps = new UIComboBox(){ + public Dimension getPreferredSize() { + return new Dimension(COMBOX_WIDTH, COM_HEIGHT); + } + }; + + private ItemListener detailListener = new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + fireMapChange(); + } + }; + + private ActionListener mapEditListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String selectedName =StringUtils.EMPTY; + if(detailMaps.getSelectedItem() != null){ + selectedName = detailMaps.getSelectedItem().toString(); + } + final MapArrayPane mapArrayPane = new MapArrayPane(mapTypeComboBox.getSelectedItem().toString(),selectedName,chartDesigner){ + public void updateBeans() { + super.updateBeans(); + if(reCalculateDetailsMaps(mapTypeComboBox.getSelectedItem().toString(),lastEditingName) || + ComparatorUtils.equals(StringUtils.EMPTY,lastEditingName)){ + detailMaps.setSelectedItem(lastEditingName); + ChartCollection chartCollection = (ChartCollection)chartDesigner.getTarget().getChartCollection(); + com.fr.chart.chartattr.Chart chart =chartCollection.getSelectedChart(); + if(chart.getPlot().isMapPlot()){ + MapPlot mapPlot = (MapPlot) chart.getPlot(); + mapPlot.setMapName(lastEditingName); + } + } + } + + protected void update4Edited(String editingName){ + lastEditingName = editingName; + } + }; + + BasicDialog mapArrayDialog = mapArrayPane.showWindow4ChartMapArray(DesignerContext.getDesignerFrame(), + new DialogActionAdapter() { + + @Override + public void doOk() { + mapArrayPane.updateBeans(); + } + }); + mapArrayDialog.setModal(true); + mapArrayPane.setToolBarPane(MapPlotPane4ToolBar.this); + mapArrayPane.populate(MapSvgXMLHelper.getInstance().getAllMapObjects4Cate(mapTypeComboBox.getSelectedItem().toString())); + if(detailMaps.getSelectedItem() != null){ + mapArrayPane.setSelectedName(detailMaps.getSelectedItem().toString()); + } + mapArrayDialog.setVisible(true); + } + }; + + public MapPlotPane4ToolBar(ChartDesigner chartDesigner){ + super(chartDesigner); + this.add(detailMaps); + detailMaps.addItemListener(detailListener); + mapEditButton.addActionListener(mapEditListener); + this.add(mapEditButton); + } + + /** + * 更新地图面板 + * @param mapType 地图名字 + */ + public void populateMapPane(String mapType){ + super.populateMapPane(mapType); + populateDetilMaps(mapTypeComboBox.getSelectedItem().toString()); + detailMaps.removeItemListener(detailListener); + detailMaps.setSelectedItem(mapType); + detailMaps.addItemListener(detailListener); + } + + /** + * 触发地图改变 + */ + public void fireMapChange(){ + MapPlot plot = new MapPlot(); + String selectedName = StringUtils.EMPTY; + if(detailMaps.getSelectedItem() !=null ){ + selectedName = detailMaps.getSelectedItem().toString(); + } + plot.setMapName(selectedName);// 名字问题 + ChartCollection chartCollection = (ChartCollection)chartDesigner.getTarget().getChartCollection(); + Chart chart =chartCollection.getSelectedChart(); + chart.setPlot(plot); + ChartDesignEditPane.getInstance().populate(chartCollection); + chartDesigner.fireTargetModified(); + } + + + + //默认选中国家地图 + protected void calculateDetailMaps(int mapType){ + switch (mapType) { + case WORLD_MAP: + populateDetilMaps(Inter.getLocText("FR-Chart-World_Map")); + break; + case STATE_MAP: + populateDetilMaps(Inter.getLocText("FR-Chart-State_Map")); + break; + case PROVINCE_MAP: + populateDetilMaps(Inter.getLocText("FR-Chart-Province_Map")); + break; + case CUSTOM_MAP: + populateDetilMaps(Inter.getLocText("FR-Chart-Custom_Map")); + break; + default: + populateDetilMaps(Inter.getLocText("FR-Chart-State_Map")); + } + fireMapChange(); + } + + private boolean reCalculateDetailsMaps(String mapType ,String detailMap){ + detailMaps.removeItemListener(detailListener); + detailMaps.removeAllItems(); + java.util.List list = MapSvgXMLHelper.getInstance().getNamesListWithCateName(mapType); + boolean isContains = false; + for (Object name : list) { + detailMaps.addItem(name); + if(ComparatorUtils.equals(detailMap,name)){ + isContains = true; + } + } + detailMaps.addItemListener(detailListener); + return isContains; + } + + + protected void populateDetilMaps(String mapType){ + detailMaps.removeItemListener(detailListener); + detailMaps.removeAllItems(); + java.util.List list = MapSvgXMLHelper.getInstance().getNamesListWithCateName(mapType); + for (Object name : list) { + detailMaps.addItem(name); + } + detailMaps.addItemListener(detailListener); + if(detailMaps.getSelectedItem() != null){ + lastEditingName = detailMaps.getSelectedItem().toString(); + } + } + + protected Plot getSelectedClonedPlot() { + MapPlot mapPlot = new MapPlot(); + populateDetilMaps(Inter.getLocText("FR-Chart-State_Map")); + if(detailMaps.getSelectedItem()!= null && !StringUtils.isEmpty(detailMaps.getSelectedItem().toString())){ + mapPlot.setMapName(detailMaps.getSelectedItem().toString()); + } + return mapPlot; + } + + public String[] getMapTypes(){ + return TYPE_NAMES; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java new file mode 100644 index 000000000..59cfb383e --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java @@ -0,0 +1,142 @@ +/* + * Copyright(c) 2001-2011, FineReport Inc, All Rights Reserved. + */ +package com.fr.design.mainframe; + +import java.awt.BorderLayout; + +import javax.swing.Icon; +import javax.swing.JComponent; + +import com.fr.base.BaseUtils; +import com.fr.base.chart.BaseChartCollection; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.designer.TargetComponent; +import com.fr.design.gui.chart.BaseChartPropertyPane; +import com.fr.design.gui.frpane.UITitlePanel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itabpane.TitleChangeListener; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.general.Inter; + +public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ + + protected TargetComponentContainer container = new TargetComponentContainer(); + protected UILabel nameLabel; + + protected ChartEditPane chartEditPane; + + public MiddleChartPropertyPane() { + initComponenet(); + } + + protected void initComponenet() { + this.setLayout(new BorderLayout()); + this.setBorder(null); + + createNameLabel(); + this.add(createNorthComponent(), BorderLayout.NORTH); + + chartEditPane = ChartEditPane.getInstance(); + chartEditPane.setSupportCellData(true); + this.createMainPane(); + } + + protected abstract void createNameLabel(); + + protected abstract JComponent createNorthComponent(); + + protected abstract void createMainPane(); + + public void setSureProperty() { + chartEditPane.setContainer(container); + chartEditPane.addTitleChangeListener(titleListener); + String tabname = chartEditPane.getSelectedTabName(); + nameLabel.setText(Inter.getLocText("Chart-Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : "")); + resetChartEditPane(); + } + + protected void resetChartEditPane() { + remove(chartEditPane); + add(chartEditPane, BorderLayout.CENTER); + validate(); + repaint(); + revalidate(); + } + + protected TitleChangeListener titleListener = new TitleChangeListener() { + + @Override + public void fireTitleChange(String addName) { + nameLabel.setText(Inter.getLocText("Chart-Property_Table") + '-' + addName); + } + }; + + /** + * 感觉ChartCollection加载图表属性界面. + * @param collection 收集图表 + * @param ePane 面板 + */ + public void populateChartPropertyPane(ChartCollection collection, TargetComponent ePane) { + this.container.setEPane(ePane); + chartEditPane.populate(collection); + } + + /** + * 感觉ChartCollection加载图表属性界面. + * @param collection 收集图表 + * @param ePane 面板 + */ + public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent ePane) { + if (collection instanceof ChartCollection) { + populateChartPropertyPane((ChartCollection)collection, ePane); + } + } + + /** + * 返回View的标题. + */ + public String getViewTitle() { + return Inter.getLocText("CellElement-Property_Table"); + } + + /** + * 返回View的Icon地址. + */ + public Icon getViewIcon() { + return BaseUtils.readIcon("/com/fr/design/images/m_report/qb.png"); + } + + /** + * 预定义定位 + * @return 定位 + */ + public Location preferredLocation() { + return Location.WEST_BELOW; + } + + /** + * 创建标题Panel + * @return 标题panel + */ + public UITitlePanel createTitlePanel() { + return new UITitlePanel(this); + } + + /** + * 刷新Dockview + */ + public void refreshDockingView() { + // TODO Auto-generated method stub + + } + + /** + * 设置是否支持单元格数据. + */ + public void setSupportCellData(boolean supportCellData) { + if(chartEditPane != null) { + chartEditPane.setSupportCellData(supportCellData); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/PlotToolBarFactory.java b/designer_chart/src/com/fr/design/mainframe/PlotToolBarFactory.java new file mode 100644 index 000000000..1bb67547d --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/PlotToolBarFactory.java @@ -0,0 +1,90 @@ +package com.fr.design.mainframe; + +import com.fr.chart.base.ChartTypeValueCollection; +import com.fr.design.mainframe.chart.gui.type.*; +import com.fr.general.FRLogger; + +import java.lang.reflect.Constructor; +import java.util.HashMap; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + * 图表设计器工具栏面板的工厂类 + */ +public class PlotToolBarFactory { + private static HashMap> panes4NormalPlot = + new HashMap>(); + + private static HashMap> panes4MapPlot = + new HashMap>(); + + static { + panes4NormalPlot.put(ChartTypeValueCollection.COLUMN, ColumnPlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.LINE, LinePlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.BAR, BarPlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.PIE, PiePlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.AREA,AreaPlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.XYSCATTER,XYSCatterPlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.BUBBLE,BubblePlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.RADAR,RadarPlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.STOCK,StockPlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.METER,MeterPlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.RANGE,RangePlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.COMB,CustomPlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.GANTT,GanttPlotPane4ToolBar.class); + panes4NormalPlot.put(ChartTypeValueCollection.DONUT,DonutPlotPane4ToolBar.class); + + panes4MapPlot.put(ChartTypeValueCollection.MAP,MapPlotPane4ToolBar.class); + panes4MapPlot.put(ChartTypeValueCollection.GIS,GisMapPlotPane4ToolBar.class); + } + + private PlotToolBarFactory(){ + + } + + /** + * 为了地图和gis以外的图表类型创建工具栏 + * @param type 图表类型 + * @param chartDesigner 图表设计器 + * @return 工具栏 + */ + public static PlotPane4ToolBar createToolBar4NormalPlot(ChartTypeValueCollection type,ChartDesigner chartDesigner){ + if(!panes4NormalPlot.containsKey(type)){ + return new ColumnPlotPane4ToolBar(chartDesigner); + } + try { + Class cls = panes4NormalPlot.get(type); + Constructor constructor = cls.getConstructor(ChartDesigner.class); + return constructor.newInstance(chartDesigner); + }catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + return new ColumnPlotPane4ToolBar(chartDesigner); + } + } + + /** + *为地图和gis创建工具栏 + * @param type 类型 + * @param chartDesigner 图表设计器 + * @return 工具栏 + */ + public static AbstractMapPlotPane4ToolBar createToolBar4MapPlot(ChartTypeValueCollection type,ChartDesigner chartDesigner){ + if(!panes4MapPlot.containsKey(type)){ + return new MapPlotPane4ToolBar(chartDesigner); + } + try { + Class cls = panes4MapPlot.get(type); + Constructor constructor = cls.getConstructor(ChartDesigner.class); + return constructor.newInstance(chartDesigner); + }catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + return new MapPlotPane4ToolBar(chartDesigner); + } + } + + + + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/TargetComponentContainer.java b/designer_chart/src/com/fr/design/mainframe/TargetComponentContainer.java new file mode 100644 index 000000000..cd14411f6 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/TargetComponentContainer.java @@ -0,0 +1,15 @@ +package com.fr.design.mainframe; + +import com.fr.design.designer.TargetComponent; + +public class TargetComponentContainer { + private TargetComponent ePane; + + public TargetComponent getEPane() { + return ePane; + } + + public void setEPane(TargetComponent ePane) { + this.ePane = ePane; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ToolTip4Chart.java b/designer_chart/src/com/fr/design/mainframe/ToolTip4Chart.java new file mode 100644 index 000000000..83761022a --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/ToolTip4Chart.java @@ -0,0 +1,91 @@ +package com.fr.design.mainframe; + +import com.fr.base.GraphHelper; +import com.fr.base.background.ColorBackground; +import com.fr.stable.CoreConstants; + +import javax.swing.*; +import java.awt.*; +import java.awt.geom.Dimension2D; +import java.awt.geom.RoundRectangle2D; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-25 + * Time: 下午4:11 + */ +public class ToolTip4Chart extends JWindow { + private static ToolTip4Chart instance = new ToolTip4Chart(); + private static final int HGAP = 5; + private static final int VGAP = 3; + private static final int FONT_SIZE = 12; + private ToolTipStringPane stringPane; + private Font font = new Font("Dialog", Font.PLAIN, FONT_SIZE); + + public ToolTip4Chart() { + stringPane = new ToolTipStringPane(); + this.getContentPane().add(stringPane); + } + + public static ToolTip4Chart getInstance() { + if (instance == null) { + instance = new ToolTip4Chart(); + } + return instance; + } + + /** + * 现实提示信息 + * + * @param toolTip 提示信息 + * @param xAbs 绝对位置x + * @param yAbs 绝对位置Y + */ + public void showToolTip(String toolTip, int xAbs, int yAbs) { + stringPane.text = toolTip.trim(); + Dimension2D dim = GraphHelper.stringDimensionWithRotation(toolTip, font, 0, CoreConstants.DEFAULT_FRC); + this.setSize(new Dimension((int) dim.getWidth() + HGAP * 2, (int) dim.getHeight() + VGAP * 2)); + stringPane.setPreferredSize(new Dimension((int) dim.getWidth(), (int) dim.getHeight())); + if (!this.isVisible()) { + this.setVisible(true); + if (xAbs + this.getWidth() > Toolkit.getDefaultToolkit().getScreenSize().width) { + xAbs -= this.getWidth(); + } + this.setLocation(xAbs, yAbs+HGAP*2); + } + } + + /** + * 隐藏弹出框 + */ + public void hideToolTip() { + this.setVisible(false); + } + + + private class ToolTipStringPane extends JPanel { + String text; + + public ToolTipStringPane() { + + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + if (!isOpaque()) { + return; + } + g.setFont(font); + Rectangle r = new Rectangle(0, 0, this.getWidth(), this.getHeight()); + ColorBackground background = ColorBackground.getInstance(Color.white); + background.paint(g, new RoundRectangle2D.Double(r.getX(), r.getY(), r.getWidth(), r.getHeight(), HGAP, HGAP)); + Graphics2D g2d = (Graphics2D) g; + g2d.drawString(text, HGAP, this.getHeight() - HGAP); + } + + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/AbstractExportAction4JChart.java b/designer_chart/src/com/fr/design/mainframe/actions/AbstractExportAction4JChart.java new file mode 100644 index 000000000..0601bd4f4 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/AbstractExportAction4JChart.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.actions; + +import com.fr.base.FRContext; +import com.fr.design.gui.iprogressbar.FRProgressBar; +import com.fr.form.ui.ChartBook; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; +import com.fr.design.mainframe.JChart; +import com.fr.design.mainframe.exporter.Exporter4Chart; +import com.fr.file.FILE; +import com.fr.file.FILEChooserPane; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.general.FRLogger; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.io.FileOutputStream; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 上午9:48 + */ +public abstract class AbstractExportAction4JChart extends JChartAction { + protected AbstractExportAction4JChart(JChart chart){ + super(chart); + } + + private FRProgressBar progressbar; + + protected ChartBook getChartBook(){ + return this.getEditingComponent().getTarget(); + } + + /** + * 执行方法 + * @param e 事件 + */ + public void actionPerformed(ActionEvent e) { + JChart chart = this.getEditingComponent(); + FILE editingFILE = chart.getEditingFILE(); + DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); + + // 弹出参数 + final java.util.Map parameterMap = new java.util.HashMap(); + final ChartBook chartBook = getChartBook(); + + // Choose a file name.... + FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); + fileChooserPane.setFILEFilter(this.getChooseFileFilter()); + + // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc + String filenName = editingFILE.getName(); + if (filenName.indexOf('.') != -1) { + filenName = filenName.substring(0, editingFILE.getName().lastIndexOf('.')); + } + fileChooserPane.setFileNameTextField(filenName, "." + this.getDefaultExtension()); + int saveValue = fileChooserPane.showSaveDialog(designerFrame, "." + this.getDefaultExtension()); + if (saveValue == FILEChooserPane.CANCEL_OPTION || saveValue == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION) { + fileChooserPane = null; + return; + } else if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { + FILE file = fileChooserPane.getSelectedFILE(); + try { + file.mkfile(); + } catch (Exception e1) { + FRLogger.getLogger().error("Error In Make New File"); + } + fileChooserPane = null; + FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("Prepare_Export") + "!"); + + (progressbar = new FRProgressBar(createExportWork(file, chartBook), designerFrame, + Inter.getLocText("Exporting"), "", 0, 100)).start(); + } + + } + + private SwingWorker createExportWork(FILE file, final ChartBook chartBook) { + final String filePath = file.getPath(); + final String fileGetName = file.getName(); + + SwingWorker exportWorker = new SwingWorker() { + protected Void doInBackground() throws Exception { + Thread.sleep(100); //bug 10516 + try { + final FileOutputStream fileOutputStream = new FileOutputStream(filePath); + + this.setProgress(10); + dealExporter(fileOutputStream,chartBook); + this.setProgress(80); + fileOutputStream.close(); + this.setProgress(100); + + FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("Finish_Export") + "!"); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Inter.getLocText("Exported_successfully") + "\n" + filePath); + } catch (Exception exp) { + this.setProgress(100); + FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Export_failed") + "\n" + filePath); + } + return null; + } + + public void done() { + progressbar.close(); + } + }; + return exportWorker; + } + + private void dealExporter(FileOutputStream fileOutputStream, final ChartBook chartBook) throws Exception { + final Exporter4Chart exporter = AbstractExportAction4JChart.this.getExporter(); + exporter.export(fileOutputStream,this.getEditingComponent()); + } + + + + protected abstract ChooseFileFilter getChooseFileFilter(); + + protected abstract String getDefaultExtension(); + + protected abstract Exporter4Chart getExporter(); + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/ChartDownLoadWorker.java b/designer_chart/src/com/fr/design/mainframe/actions/ChartDownLoadWorker.java new file mode 100644 index 000000000..ddcf70aa7 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/ChartDownLoadWorker.java @@ -0,0 +1,170 @@ +package com.fr.design.mainframe.actions; + +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.SaveSomeTemplatePane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.json.JSONObject; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Set; +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class ChartDownLoadWorker extends SwingWorker{ + private static final String FILE_PATH = "http://chart.finedevelop.com/update/"; + private static final String VERSION = "version"; + private static final String TEMP = "_temp"; + private static final int BYTE = 153600; + private static final int FILE_BYTE = 1024; + private HashMap files = new HashMap(); + + public ChartDownLoadWorker() { + } + + private void loadFilesPaths() throws Exception { + files.clear(); + final String installHome = StableUtils.getInstallHome(); + + JSONObject serverVersion = UpdateVersion.getJsonContent(); + if(serverVersion == null){ + return; + } + Iterator keys = serverVersion.keys(); + while (keys.hasNext()){ + String jarName = keys.next(); + if(!ComparatorUtils.equals(jarName, VERSION)){ + String filePath = (String) serverVersion.get(jarName); + String path =installHome + filePath.substring(2); + files.put(jarName,path); + } + } + files.isEmpty(); + } + + @Override + protected Void doInBackground() throws Exception { + try { + loadFilesPaths(); + Set key = files.keySet(); + Iterator iterator = key.iterator(); + int totalSize = 0; + //先得到所有的长度,方便计算百分比 + while (iterator.hasNext()) { + String jarName = (String) iterator.next(); + String jarUrl = FILE_PATH + jarName; + URL url = new URL(jarUrl); + URLConnection connection = url.openConnection(); + totalSize += connection.getContentLength(); + } + + int totalBytesRead = 0; + iterator = key.iterator(); + while (iterator.hasNext()) { + String jarName = (String) iterator.next(); + String jarUrl = FILE_PATH + jarName; + URL url = new URL(jarUrl); + InputStream reader = url.openStream(); + String filePath = files.get(jarName); + int point = filePath.lastIndexOf("."); + //先写临时文件,防止更新一半意外中止 + String tmpFilePath = filePath.substring(0,point)+TEMP+filePath.substring(point); + FileOutputStream writer = new FileOutputStream(tmpFilePath); + byte[] buffer = new byte[BYTE]; + int bytesRead = 0; + while ((bytesRead = reader.read(buffer)) > 0) { + writer.write(buffer, 0, bytesRead); + buffer = new byte[BYTE]; + totalBytesRead += bytesRead; + publish(totalBytesRead/(double)totalSize); + } + } + + + } catch (Exception e) { + throw new Exception("Update Failed !" + e.getMessage()); + } + + return null; + } + + //替换更新下来的临时文件 + protected void replaceFiles(){ + try { + Set key = files.keySet(); + Iterator iterator = key.iterator(); + while (iterator.hasNext()) { + String jarName = (String) iterator.next(); + String filePath = files.get(jarName); + int point = filePath.lastIndexOf("."); + //先写临时文件,防止更新一半意外中止 + String tmpFilePath = filePath.substring(0,point)+TEMP+filePath.substring(point); + FileInputStream inputStream = new FileInputStream(tmpFilePath); + FileOutputStream writer = new FileOutputStream(filePath); + byte[] buffer = new byte[FILE_BYTE]; + int bytesRead = 0; + while ((bytesRead = inputStream.read(buffer))>0){ + writer.write(buffer,0,bytesRead); + buffer = new byte[FILE_BYTE]; + } + writer.flush(); + writer.close(); + inputStream.close(); + } + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + } + + /** + * 完成时的动作 + */ + public void done() { + //检测是否没有保存的模版 + SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); + // 只有一个文件未保存时 + if (HistoryTemplateListPane.getInstance().getHistoryCount() == 1) { + int choose = saveSomeTempaltePane.saveLastOneTemplate(); + if (choose != JOptionPane.CANCEL_OPTION) { + restartChartDesigner(); + } + } else { + if (saveSomeTempaltePane.showSavePane()) { + restartChartDesigner(); + } + } + } + + private void restartChartDesigner(){ + String installHome = StableUtils.getInstallHome(); + if(StringUtils.isEmpty(installHome) || ComparatorUtils.equals(".",installHome)){ + DesignerContext.getDesignerFrame().exit(); + return; + } + + try { + String path = installHome + File.separator + "bin" + File.separator + "restart.bat"; + ProcessBuilder builder = new ProcessBuilder(path,installHome); + builder.start(); + DesignerContext.getDesignerFrame().exit(); + }catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + + + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/ChartFeedBackAciton.java b/designer_chart/src/com/fr/design/mainframe/actions/ChartFeedBackAciton.java new file mode 100644 index 000000000..782d1a400 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/ChartFeedBackAciton.java @@ -0,0 +1,51 @@ +package com.fr.design.mainframe.actions; + +import com.fr.design.actions.help.FeedBackAction; +import com.fr.design.actions.help.FeedBackPane; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class ChartFeedBackAciton extends FeedBackAction{ + + /** + * 动作 + * @param e 事件 + */ + public void actionPerformed(ActionEvent e) { + final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); + ChartFeedBackPane feedBackPane = new ChartFeedBackPane(); + BasicDialog basicDialog =feedBackPane.showWindow(designerFrame,false); + feedBackPane.setFeedbackDialog(basicDialog); + basicDialog.setVisible(true); + } + + private class ChartFeedBackPane extends FeedBackPane{ + protected JPanel getContactPane() { + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("email") + ":", SwingConstants.RIGHT), email}, + new Component[]{new UILabel(Inter.getLocText("mobile_number") + ":", SwingConstants.RIGHT), phone} + }; + double[] rowSize = {p, p, p}; + double[] columnSize = {p, p}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/ChartUpdateAction.java b/designer_chart/src/com/fr/design/mainframe/actions/ChartUpdateAction.java new file mode 100644 index 000000000..05cb46b14 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/ChartUpdateAction.java @@ -0,0 +1,25 @@ +package com.fr.design.mainframe.actions; + +import com.fr.design.actions.UpdateAction; + +import java.awt.event.ActionEvent; + +/** + * @author : richie + * @since : 8.0 + */ +public class ChartUpdateAction extends UpdateAction { + + private static final String DOWNLOAD_DESIGNER=""; + private static final String DOWNLOAD_CHART=""; + private static final String DOWNLOAD_THIRD=""; + + public ChartUpdateAction() { + + } + + @Override + public void actionPerformed(ActionEvent e) { + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/ChartWebAction.java b/designer_chart/src/com/fr/design/mainframe/actions/ChartWebAction.java new file mode 100644 index 000000000..24218c876 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/ChartWebAction.java @@ -0,0 +1,56 @@ +package com.fr.design.mainframe.actions; + +import com.fr.base.BaseUtils; +import com.fr.design.actions.UpdateAction; +import com.fr.design.menu.MenuKeySet; +import com.fr.general.Inter; +import com.fr.start.StartServer; + +import javax.swing.*; +import java.awt.event.ActionEvent; + +/** + * 图表设计器得产品演示 + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-27 + * Time: 下午9:01 + */ +public class ChartWebAction extends UpdateAction { + public ChartWebAction() { + this.setMenuKeySet(getSelfMenuKeySet()); + this.setName(getMenuKeySet().getMenuName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_help/demo.png")); + } + + private MenuKeySet getSelfMenuKeySet(){ + return new MenuKeySet() { + @Override + public char getMnemonic() { + return 'D'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("FR-Chart-Product_Demo"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; + } + + + /** + * 动作 + * @param e 事件 + */ + public void actionPerformed(ActionEvent e) { + StartServer.browerURLWithLocalEnv("http://www.vancharts.com/demo.html"); + return; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java b/designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java new file mode 100644 index 000000000..aa703f311 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.actions; + +import com.fr.base.BaseUtils; +import com.fr.base.ExcelUtils; +import com.fr.design.mainframe.JChart; +import com.fr.design.mainframe.exporter.ExcelExporter4Chart; +import com.fr.design.mainframe.exporter.Exporter4Chart; +import com.fr.design.menu.MenuKeySet; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.event.KeyEvent; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 上午9:52 + */ +public class ExcelExportAction4Chart extends AbstractExportAction4JChart { + + private MenuKeySet excel= new MenuKeySet() { + @Override + public char getMnemonic() { + return 'E'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("FR-Chart-Format_Excel"); + } + + @Override + public KeyStroke getKeyStroke() { + return KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_MASK); + } + }; + + public ExcelExportAction4Chart(JChart chart) { + super(chart); + this.setMenuKeySet(excel); + this.setName(getMenuKeySet().getMenuKeySetName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); + } + + + @Override + protected ChooseFileFilter getChooseFileFilter() { + return new ChooseFileFilter(new String[]{"xls", "xlsx"}, Inter.getLocText("Export-Excel")); + } + + @Override + protected String getDefaultExtension() { + return ExcelUtils.checkPOIJarExist() ? "xlsx" : "xls"; + } + + @Override + protected Exporter4Chart getExporter() { + return new ExcelExporter4Chart(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/JChartAction.java b/designer_chart/src/com/fr/design/mainframe/actions/JChartAction.java new file mode 100644 index 000000000..ba4667875 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/JChartAction.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.actions; + +import com.fr.design.actions.JTemplateAction; +import com.fr.design.mainframe.JChart; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 上午9:47 + */ +public abstract class JChartAction extends JTemplateAction { + public JChartAction(JChart jChart) { + super(jChart); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/NewChartAction.java b/designer_chart/src/com/fr/design/mainframe/actions/NewChartAction.java new file mode 100644 index 000000000..bd62a689b --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/NewChartAction.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.actions; + +import com.fr.base.BaseUtils; +import com.fr.design.actions.UpdateAction; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JChart; +import com.fr.design.menu.MenuKeySet; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-13 + * Time: 下午3:22 + */ +public class NewChartAction extends UpdateAction{ + + public NewChartAction(){ + this.setMenuKeySet(NEW_CHART); + this.setName(getMenuKeySet().getMenuKeySetName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/newchart_normal.png")); + this.setAccelerator(getMenuKeySet().getKeyStroke()); + } + + + /** + * 执行事件 + * @param e 事件 + */ + public void actionPerformed(ActionEvent e) { + DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JChart()); + } + + public static final MenuKeySet NEW_CHART = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'F'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("M-New_ChartBook"); + } + + @Override + public KeyStroke getKeyStroke() { + return KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK); + } + }; +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/OpenChartAction.java b/designer_chart/src/com/fr/design/mainframe/actions/OpenChartAction.java new file mode 100644 index 000000000..82b95c736 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/OpenChartAction.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.actions; + +import com.fr.design.actions.file.OpenTemplateAction; +import com.fr.design.mainframe.DesignerContext; +import com.fr.file.FILE; +import com.fr.file.FILEChooserPane; +import com.fr.file.FILEChooserPane4Chart; + +import java.awt.event.ActionEvent; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-20 + * Time: 下午7:35 + */ +public class OpenChartAction extends OpenTemplateAction { + /** + * 动作 + * @param evt 事件 + */ + public void actionPerformed(ActionEvent evt) { + FILEChooserPane fileChooser = FILEChooserPane4Chart.getInstance(true, true); + + if (fileChooser.showOpenDialog(DesignerContext.getDesignerFrame(),".crt") + == FILEChooserPane.OK_OPTION) { + final FILE file = fileChooser.getSelectedFILE(); + if (file == null) {//选择的文件不能是 null + return; + } + DesignerContext.getDesignerFrame().openTemplate(file); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/PDFExportAction4Chart.java b/designer_chart/src/com/fr/design/mainframe/actions/PDFExportAction4Chart.java new file mode 100644 index 000000000..df2f95598 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/PDFExportAction4Chart.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.actions; + +import com.fr.base.BaseUtils; +import com.fr.design.mainframe.JChart; +import com.fr.design.mainframe.exporter.Exporter4Chart; +import com.fr.design.mainframe.exporter.PdfExporter4Chart; +import com.fr.design.menu.MenuKeySet; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.general.Inter; + +import javax.swing.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 上午10:16 + */ +public class PDFExportAction4Chart extends AbstractExportAction4JChart { + + private MenuKeySet pdf = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'P'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("FR-Chart-Format_PDF"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; + + public PDFExportAction4Chart(JChart chart) { + super(chart); + this.setMenuKeySet(pdf); + this.setName(getMenuKeySet().getMenuKeySetName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/pdf.png")); + } + + @Override + protected ChooseFileFilter getChooseFileFilter() { + return new ChooseFileFilter(new String[]{"pdf"}, Inter.getLocText("Export-PDF")); + } + + @Override + protected String getDefaultExtension() { + return "pdf"; + } + + @Override + protected Exporter4Chart getExporter() { + return new PdfExporter4Chart(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/PNGExportAction4Chart.java b/designer_chart/src/com/fr/design/mainframe/actions/PNGExportAction4Chart.java new file mode 100644 index 000000000..2b04f80d4 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/PNGExportAction4Chart.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.actions; + +import com.fr.base.BaseUtils; +import com.fr.design.mainframe.JChart; +import com.fr.design.mainframe.exporter.Exporter4Chart; +import com.fr.design.mainframe.exporter.ImageExporter4Chart; +import com.fr.design.menu.MenuKeySet; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.event.KeyEvent; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 上午10:18 + */ +public class PNGExportAction4Chart extends AbstractExportAction4JChart { + + private MenuKeySet menuSet = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'M'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("FR-Chart-Format_Image"); + } + + @Override + public KeyStroke getKeyStroke() { + return KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_MASK); + } + }; + + public PNGExportAction4Chart(JChart chart) { + super(chart); + this.setMenuKeySet(menuSet); + this.setName(getMenuKeySet().getMenuKeySetName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/exportimg.png")); + } + + @Override + protected ChooseFileFilter getChooseFileFilter() { + return new ChooseFileFilter(new String[]{"png"}, Inter.getLocText("Image")); + } + + @Override + protected String getDefaultExtension() { + return "png"; + } + + @Override + protected Exporter4Chart getExporter() { + return new ImageExporter4Chart(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/UpdateOnlineAction.java b/designer_chart/src/com/fr/design/mainframe/actions/UpdateOnlineAction.java new file mode 100644 index 000000000..42419128e --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/UpdateOnlineAction.java @@ -0,0 +1,74 @@ +package com.fr.design.mainframe.actions; + +import com.fr.design.ChartEnvManager; +import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.chart.UpdateOnLinePane; +import com.fr.design.menu.MenuKeySet; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.json.JSONObject; +import com.fr.stable.ProductConstants; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.event.ActionEvent; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + * 图表设计器在线更新 + */ +public class UpdateOnlineAction extends UpdateAction { + + public UpdateOnlineAction() { + this.setMenuKeySet(getKeySet()); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + } + + private MenuKeySet getKeySet() { + return new MenuKeySet() { + @Override + public char getMnemonic() { + return 'U'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("FR-Chart-Help_UpdateOnline"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; + } + + + /** + *动作 + * @param e 事件 + */ + public void actionPerformed(ActionEvent e) { + new UpdateVersion(){ + protected void done() { + try { + ChartEnvManager.getEnvManager().resetCheckDate(); + JSONObject serverVersion = get(); + String version = serverVersion.getString(UpdateVersion.VERSION); + UpdateOnLinePane updateOnLinePane = new UpdateOnLinePane(StringUtils.isEmpty(version)? ProductConstants.RELEASE_VERSION:version); + BasicDialog dg = updateOnLinePane.showWindow4UpdateOnline(DesignerContext.getDesignerFrame()); + updateOnLinePane.setParentDialog(dg); + dg.setVisible(true); + }catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + } + } + }.execute(); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/UpdateVersion.java b/designer_chart/src/com/fr/design/mainframe/actions/UpdateVersion.java new file mode 100644 index 000000000..0d5088ee7 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/actions/UpdateVersion.java @@ -0,0 +1,69 @@ +package com.fr.design.mainframe.actions; + +import com.fr.general.FRLogger; +import com.fr.json.JSONObject; + +import javax.swing.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class UpdateVersion extends SwingWorker { + + private static final String VERSION_URL ="http://chart.finedevelop.com/update/update.json"; + private static final int TIME_OUT = 300;//5s + public static final String VERSION = "version"; + + public UpdateVersion(){ + + } + + + @Override + protected JSONObject doInBackground() throws Exception { + return getJsonContent(); + } + + public static JSONObject getJsonContent() throws Exception{ + String res = null; + try { + res = readVersionFromServer(TIME_OUT); + } catch (IOException e) { + FRLogger.getLogger().error(e.getMessage()); + } + return new JSONObject(res); + } + + /** + * 从服务器读取版本 + */ + private static String readVersionFromServer(int timeOut) throws IOException { + URL getUrl = new URL(VERSION_URL); + // 根据拼凑的URL,打开连接,URL.openConnection函数会根据URL的类型, + // 返回不同的URLConnection子类的对象,这里URL是一个http,因此实际返回的是HttpURLConnection + HttpURLConnection connection = (HttpURLConnection) getUrl + .openConnection(); + connection.setReadTimeout(timeOut); + // 进行连接,但是实际上get request要在下一句的connection.getInputStream()函数中才会真正发到 + // 服务器 + connection.connect(); + // 取得输入流,并使用Reader读取 + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf8"));//设置编码,否则中文乱码 + String lines; + StringBuffer sb = new StringBuffer(); + while ((lines = reader.readLine()) != null) { + sb.append(lines); + } + reader.close(); + // 断开连接 + connection.disconnect(); + return sb.toString(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java b/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java new file mode 100644 index 000000000..23f21463b --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.chart; + + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; + +public abstract class AbstractChartAttrPane extends AbstractAttrNoScrollPane { + public abstract void populate(ChartCollection collection); + + public abstract void update(ChartCollection collection); + + public void populateBean(ChartCollection collection) { + if (collection == null) { + return; + } + removeAttributeChangeListener(); + populate(collection); + } + + /** + * 注册图表切换按钮 改变的 事件. + * @param isFromChartHyper 编辑面板 + */ + public void registerChartEditPane(ChartEditPane isFromChartHyper) { + + } + + /** + * 刷新图表数据界面 + * @param collection 图表收集器 + */ + public void refreshChartDataPane(ChartCollection collection){ + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/AttributeChange.java b/designer_chart/src/com/fr/design/mainframe/chart/AttributeChange.java new file mode 100644 index 000000000..ddd4bdf4e --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/AttributeChange.java @@ -0,0 +1,8 @@ +package com.fr.design.mainframe.chart; + + +public interface AttributeChange { + + public void fire(); + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartDesignEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartDesignEditPane.java new file mode 100644 index 000000000..c5190b9bc --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartDesignEditPane.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.chart; + +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.mainframe.chart.gui.*; + +import java.util.ArrayList; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 下午5:47 + */ +public class ChartDesignEditPane extends ChartEditPane { + + private static ChartDesignEditPane instance; + + private boolean isFromToolBar = false; + + public synchronized static ChartEditPane getInstance() { + if (instance == null) { + instance = new ChartDesignEditPane(); + } + return instance; + } + + public ChartDesignEditPane() { + paneList = new ArrayList(); + dataPane4SupportCell = new ChartDesignerDataPane(listener); + paneList.add(dataPane4SupportCell); + paneList.add(new StylePane4Chart(listener, false)); + paneList.add(new ChartDesignerOtherPane()); + createTabsPane(); + } + + protected void dealWithStyleChange(){ + if(!isFromToolBar){ + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().styleChange(); + } + } + + /** + *主要用于图表设计器,判断样式改变是否来自工具栏的全局样式按钮 + * @param isFromToolBar 是否来自工具栏 + */ + public void styleChange(boolean isFromToolBar){ + this.isFromToolBar = isFromToolBar; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java new file mode 100644 index 000000000..204062e44 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -0,0 +1,343 @@ +package com.fr.design.mainframe.chart; + + +import com.fr.base.BaseUtils; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.tabledata.Prepare4DataSourceChange; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.gui.itabpane.TitleChangeListener; +import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.TargetComponentContainer; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.ChartOtherPane; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.ChartTypePane; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.Inter; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4DataSourceChange { + public synchronized static ChartEditPane getInstance() { + if (singleton == null) { + singleton = new ChartEditPane(); + } + return singleton; + } + + private final static int CHANGE_MIN_TIME = 80; + + protected ChartCollection collection; + protected boolean isDefaultPane = true;//是否是默认的界面 + + private static ChartEditPane singleton; + protected List paneList; + + protected ChartTypePane typePane; + protected ChartDataPane dataPane4SupportCell = null; + protected ChartStylePane stylePane; + protected ChartOtherPane otherPane; + + protected UIHeadGroup tabsHeaderIconPane; + private ChartCollection lastCollection; + protected CardLayout card; + protected JPanel center; + private TargetComponentContainer container = null; + private TitleChangeListener titleChangeListener = null; + + private Calendar lastTime; + + protected ChartEditPane() { + this.setLayout(new BorderLayout()); + + paneList = new ArrayList(); + typePane = new ChartTypePane(); + dataPane4SupportCell = new ChartDataPane(listener); + dataPane4SupportCell.setSupportCellData(true); + stylePane = new ChartStylePane(listener); + otherPane = new ChartOtherPane(); + + paneList.add(typePane); + paneList.add(dataPane4SupportCell); + paneList.add(stylePane); + paneList.add(otherPane); + + createTabsPane(); + registerDSChangeListener(); + } + + //构建主面板 + protected void createTabsPane() { + Icon[] iconArray = new Icon[paneList.size()]; + card = new CardLayout(); + center = new JPanel(card); + for (int i = 0; i < paneList.size(); i++) { + AbstractChartAttrPane pane = paneList.get(i); + iconArray[i] = BaseUtils.readIcon(pane.getIconPath()); + center.add(pane, pane.title4PopupWindow()); + } + + tabsHeaderIconPane = new UIHeadGroup(iconArray) { + @Override + public void tabChanged(int index) { + paneList.get(index).populateBean(collection); + paneList.get(index).addAttributeChangeListener(listener); + card.show(center, paneList.get(index).title4PopupWindow()); + if (titleChangeListener != null) { + titleChangeListener.fireTitleChange(getSelectedTabName()); + } + } + }; + tabsHeaderIconPane.setNeedLeftRightOutLine(false); + this.add(tabsHeaderIconPane, BorderLayout.NORTH); + this.add(center, BorderLayout.CENTER); + } + + AttributeChangeListener listener = new AttributeChangeListener() { + @Override + public void attributeChange() { + if (lastTime != null && Calendar.getInstance().getTimeInMillis() - lastTime.getTimeInMillis() < CHANGE_MIN_TIME) { + return; + } + AbstractChartAttrPane selectedPane = paneList.get(tabsHeaderIconPane.getSelectedIndex()); + selectedPane.update(collection); + if (!ComparatorUtils.equals(collection, lastCollection)) { + try { + lastCollection = (ChartCollection) collection.clone(); + } catch (CloneNotSupportedException e) { + FRLogger.getLogger().error("error in clone ChartEditPane"); + } + if(ComparatorUtils.equals(selectedPane.title4PopupWindow(),PaneTitleConstants.CHART_STYLE_TITLE)){ + dealWithStyleChange(); + } + + fire(); + } + } + }; + + /** + * 重新构造面板 + * @param currentChart 图表 + */ + public void reLayout(Chart currentChart){ + if(currentChart != null){ + int chartIndex = getSelectedChartIndex(currentChart); + this.removeAll(); + this.setLayout(new BorderLayout()); + paneList = new ArrayList(); + addTypeAndDataPane(); + + boolean isDefault = true; + String plotID = ""; + if(currentChart.getPlot() != null){ + plotID = currentChart.getPlot().getPlotID(); + isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); + } + + if(isDefault){ + paneList.add(stylePane); + paneList.add(otherPane); + this.isDefaultPane = true; + }else{ + AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(plotID, listener); + for(int i = 0; i < otherPaneList.length; i++){ + otherPaneList[i].addAttributeChangeListener(listener); + paneList.add(otherPaneList[i]); + } + this.isDefaultPane = false; + } + createTabsPane(); + setSelectedTab(); + } + } + + protected void addTypeAndDataPane() { + paneList.add(typePane); + paneList.add(dataPane4SupportCell); + + } + + protected void setSelectedTab() { + } + + /** + * 设置是否支持单元格 + */ + public void setSupportCellData(boolean supportCellData) { + if (dataPane4SupportCell != null) { + dataPane4SupportCell.setSupportCellData(supportCellData); + } + } + + /** + * 返回选中的tab名称. + */ + public String getSelectedTabName() { + int index = Math.min(tabsHeaderIconPane.getSelectedIndex(), paneList.size() - 1); + return paneList.get(index).title4PopupWindow(); + } + + /** + * 添加标题变化监听事件. + * + * @param titleChangeListener 标题的ChangeListener + */ + public void addTitleChangeListener(TitleChangeListener titleChangeListener) { + this.titleChangeListener = titleChangeListener; + } + + /** + * 设置容器. + */ + public void setContainer(TargetComponentContainer container) { + this.container = container; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Property_Table"); + } + + public void populate(ChartCollection collection) { + if (collection.getChartCount() <= 0) { + return; + } + + if(checkNeedsReLayout(collection.getSelectedChart())){ + reLayout(collection.getSelectedChart()); + } + + this.collection = collection; + paneList.get(tabsHeaderIconPane.getSelectedIndex()).populateBean(collection); + paneList.get(tabsHeaderIconPane.getSelectedIndex()).addAttributeChangeListener(listener); + + for (int i = 0; i < paneList.size(); i++) { + paneList.get(i).registerChartEditPane(getCurrentChartEditPane()); + } + } + + protected ChartEditPane getCurrentChartEditPane() { + return this; + } + + + /** + * 响应事件. + */ + public void fire() { + if (container != null && container.getEPane() != null) { + container.getEPane().fireTargetModified(); + } + } + + public int getSelectedChartIndex(Chart chart){ + int index = 0; + if(typePane != null){ + FurtherBasicBeanPane[] paneList = typePane.getPaneList(); + for(; index < paneList.length; index++){ + if(paneList[index].accept(chart)){ + return index; + } + } + } + return index; + } + + //populate的时候看看要不要重构面板 + private boolean checkNeedsReLayout(Chart chart){ + if(chart != null){ + int lastIndex = typePane.getSelectedIndex(); + int currentIndex = getSelectedChartIndex(chart); + boolean currentPane = true; + if(chart.getPlot() != null){ + String plotID = chart.getPlot().getPlotID(); + currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); + } + return (currentPane != isDefaultPane) || (!currentPane && lastIndex != currentIndex); + } + return false; + } + + /** + * 当前界面是否是默认的界面 + * @return 是否是默认的界面 + */ + public boolean isDefaultPane(){ + return this.isDefaultPane; + } + + /** + * 展开到对应id的pane. + * + * @param id 界面的标志.id + */ + public void GoToPane(String... id) { + this.setSelectedIndex(id); + EastRegionContainerPane.getInstance().setWindow2PreferWidth(); + } + + /** + * 设置选中的id + * + * @param id 界面的标志.id + */ + public void setSelectedIndex(String... id) { + String firstid = id[0]; + for (int i = 0; i < paneList.size(); i++) { + if (ComparatorUtils.equals(firstid, paneList.get(i).title4PopupWindow())) { + tabsHeaderIconPane.setSelectedIndex(i); + if (id.length >= 2) { + paneList.get(i).setSelectedByIds(1, id); + } + break; + } + } + } + + protected void dealWithStyleChange(){ + + } + + /** + *主要用于图表设计器,判断样式改变是否来自工具栏的全局样式按钮 + * @param isFromToolBar 是否来自工具栏 + */ + public void styleChange(boolean isFromToolBar){ + + } + + /** + * 图表设计器,显示选中的面板 + */ + public void populateSelectedTabPane() { + int index = tabsHeaderIconPane.getSelectedIndex(); + paneList.get(index).populateBean(collection); + paneList.get(index).addAttributeChangeListener(listener); + } + + /** + * 数据集改变的事件监听 + */ + public void registerDSChangeListener() { + DesignTableDataManager.addDsChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + AbstractChartAttrPane attrPane = paneList.get(tabsHeaderIconPane.getSelectedIndex()); + attrPane.refreshChartDataPane(collection); + } + }); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartHyperEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartHyperEditPane.java new file mode 100644 index 000000000..3c99eff5d --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartHyperEditPane.java @@ -0,0 +1,96 @@ +package com.fr.design.mainframe.chart; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.web.ChartHyperPoplink; +import com.fr.design.chart.gui.ChartComponent; +import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPopAttrPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.ChartOtherPane; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.ChartTypePane; + +import java.util.ArrayList; + + +/** + * 图表 超级链接 tab 切换 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-8-6 下午02:18:23 + */ +public class ChartHyperEditPane extends ChartEditPane { + + private ChartComponent useChartComponent; + private ChartHyperPopAttrPane attrPane; + + public ChartHyperEditPane(int paraType) { + paneList = new ArrayList(); + + paneList.add(attrPane = new ChartHyperPopAttrPane(paraType)); + paneList.add(new ChartTypePane()); + + dataPane4SupportCell = new ChartDataPane(listener); + dataPane4SupportCell.setSupportCellData(false); + paneList.add(dataPane4SupportCell); + paneList.add(new ChartStylePane(listener)); + paneList.add(new ChartOtherPane()); + + createTabsPane(); + } + + + protected void addTypeAndDataPane() { + paneList.add(attrPane); + paneList.add(typePane); + paneList.add(dataPane4SupportCell); + + } + + + protected void setSelectedTab() { + tabsHeaderIconPane.setSelectedIndex(1); + card.show(center, getSelectedTabName()); + for (int i = 0; i < paneList.size(); i++) { + paneList.get(i).registerChartEditPane(getCurrentChartEditPane()); + } + } + + protected ChartEditPane getCurrentChartEditPane() { + return this; + } + + /** + * 关联 对应的ChartComponent + * @param chartComponent 对应的ChartComponent + */ + public void useChartComponent(ChartComponent chartComponent) { + this.useChartComponent = chartComponent; + } + + /** + * 响应超级链接中的demo变化. + */ + public void fire() { + if(useChartComponent != null) { + useChartComponent.populate(this.collection); + useChartComponent.reset(); + } + } + + /** + * 取 + * @param hyperlink 超链 + */ + public void populateHyperLink(ChartHyperPoplink hyperlink) { + attrPane.populateBean(hyperlink); + populate((ChartCollection)hyperlink.getChartCollection()); + } + + /** + * 存 + * @param hyperlink 超链 + */ + public void updateHyperLink(ChartHyperPoplink hyperlink) { + attrPane.updateBean(hyperlink); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/PaneTitleConstants.java b/designer_chart/src/com/fr/design/mainframe/chart/PaneTitleConstants.java new file mode 100644 index 000000000..0a9176030 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/PaneTitleConstants.java @@ -0,0 +1,25 @@ +package com.fr.design.mainframe.chart; + +import com.fr.general.Inter; + +public class PaneTitleConstants { + public final static String CHART_TYPE_TITLE = Inter.getLocText("Type"); + public final static String CHART_DATA_TITLE = Inter.getLocText("Data"); + public final static String CHART_STYLE_TITLE = Inter.getLocText("Style"); + public final static String CHART_OTHER_TITLE = Inter.getLocText("Animation_Special"); + + public final static String CHART_STYLE_TITLE_TITLE = Inter.getLocText("Title"); + public final static String CHART_STYLE_LEGNED_TITLE = Inter.getLocText("ChartF-Legend"); + public final static String CHART_STYLE_SERIES_TITLE = Inter.getLocText("ChartF-Series"); + public final static String CHART_STYLE_AXIS_TITLE = Inter.getLocText("ChartF-Axis"); + public final static String CHART_STYLE_AREA_TITLE = Inter.getLocText("Background"); + public final static String CHART_STYLE_DATA_TITLE = Inter.getLocText("Chart_Data_Sheet"); + public final static String CHART_STYLE_LABEL_TITLE = Inter.getLocText("Data-Label"); + public final static String CHART_STYLE_LINE_TITLE = Inter.getLocText("AnalysisLine"); + + public final static String CHART_STYLE_AREA_AREA_TITLE = Inter.getLocText("D-ChartArea"); + public final static String CHART_STYLE_AREA_PLOT_TITLE = Inter.getLocText("ChartF-Plot"); + + public final static String CHART_OTHER_TITLE_CHANGE = Inter.getLocText("Chart-Switch"); + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/UpdateOnLinePane.java b/designer_chart/src/com/fr/design/mainframe/chart/UpdateOnLinePane.java new file mode 100644 index 000000000..c889ddc71 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/UpdateOnLinePane.java @@ -0,0 +1,238 @@ +package com.fr.design.mainframe.chart; + +import com.fr.design.ChartEnvManager; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.actions.ChartDownLoadWorker; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; +import com.fr.stable.ProductConstants; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + * 在线更新面板 + */ +public class UpdateOnLinePane extends BasicPane{ + private static final int GAP = 40; + private static final int H_GAP = 16; + private static final int SIDE_GAP =30; + private static final int RIGHT_BORDER_GAP = 34; + private static final Color LABEL_COLOR = new Color(114,114,114); + private static final int MESSAGE_FONT_SIZE = 20; + private static final int PUSH_FONT_SIZE = 12; + private static final int PROGRESS_WIDTH = 500; + private static final int PROGRESS_HEIGHT = 14; + private static final NumberFormat NUMBER_FORMAT = new DecimalFormat("##.##"); + private static final int PRECENT =100; + private static final Color FOREGROUNG = new Color(23,190,86); + private static final Color BACKGROUND = new Color(210,210,210); + + String serverVersion = ProductConstants.RELEASE_VERSION; + UIButton okButton = new UIButton(Inter.getLocText("FR-Chart-Dialog_OK")); + UIButton updateButton = new UIButton(Inter.getLocText("FR-Chart-App_Update")); + UIButton cancleButton = new UIButton(Inter.getLocText("FR-Chart-Dialog_Cancle")); + UICheckBox pushAuto = new UICheckBox(Inter.getLocText("FR-Chart-UpdateMessage_PushAuto")); + private JPanel messagePane; + private JPanel optionsPane; + private BasicDialog parentDialog; + private ChartDownLoadWorker downLoadWorker = null; + private boolean isUpdateCancle = false; + + private ActionListener updateListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + final JProgressBar progressBar = init4UpdatingPane(); + downLoadWorker = new ChartDownLoadWorker(){ + protected void process(java.util.List v) { + progressBar.setValue((int)(v.get(v.size() - 1) * PRECENT)); + } + + public void done() { + try { + get(); + } catch (Exception e1) { + init4UpdateFaild(); + return; + } + if(!isUpdateCancle){ + replaceFiles(); + dialogExit(); + super.done(); + } + } + }; + downLoadWorker.execute(); + } + }; + + private ActionListener okListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + dialogExit(); + } + }; + + private ActionListener cancleListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if(downLoadWorker !=null){ + isUpdateCancle = true; + downLoadWorker.cancel(true); + } + dialogExit(); + } + }; + + public void setParentDialog(BasicDialog dialog){ + this.parentDialog = dialog; + } + + public UpdateOnLinePane(String serverVersion){ + this.serverVersion = serverVersion; + this.isUpdateCancle = false; + pushAuto.setSelected(ChartEnvManager.getEnvManager().isPushUpdateAuto()); + pushAuto.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + ChartEnvManager.getEnvManager().setPushUpdateAuto(pushAuto.isSelected()); + } + }); + init4PanesLayout(); + initListeners(); + judge(); + } + + private void initListeners(){ + updateButton.addActionListener(updateListener); + okButton.addActionListener(okListener); + cancleButton.addActionListener(cancleListener); + } + + private void init4PanesLayout(){ + this.setLayout(new BorderLayout()); + this.messagePane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + this.optionsPane = new JPanel(new FlowLayout(FlowLayout.RIGHT,H_GAP ,0)) ; + this.optionsPane.setBorder(new EmptyBorder(0, 0, GAP, RIGHT_BORDER_GAP)); + this.add(this.messagePane, BorderLayout.CENTER); + this.add(this.optionsPane, BorderLayout.SOUTH); + pushAuto.setFont(new Font(Inter.getLocText("FR-Designer-All_MSBold"), 0, PUSH_FONT_SIZE)); + pushAuto.setForeground(LABEL_COLOR); + this.revalidate(); + } + + //更新失败的提示 + private void init4UpdateFaild(){ + this.messagePane.removeAll(); + UILabel label = new UILabel(Inter.getLocText("FR-Chart-Version_UpdateFail")+"!"); + label.setHorizontalAlignment(SwingConstants.CENTER); + label.setFont(new Font(Inter.getLocText("FR-Designer-All_MSBold"), 0, MESSAGE_FONT_SIZE)); + label.setForeground(LABEL_COLOR); + this.messagePane.add(label,BorderLayout.CENTER); + optionsPane.removeAll(); + optionsPane.add(okButton); + this.revalidate(); + } + + private JProgressBar init4UpdatingPane(){ + this.messagePane.removeAll(); + JPanel centerPane = new JPanel(new GridLayout(2,1)); + UILabel label = new UILabel(Inter.getLocText("FR-Chart-App_UpdateProgress")); + label.setHorizontalAlignment(SwingConstants.CENTER); + label.setFont(new Font(Inter.getLocText("FR-Designer-All_MSBold"), 0, MESSAGE_FONT_SIZE)); + label.setForeground(LABEL_COLOR); + label.setBorder(new EmptyBorder(PUSH_FONT_SIZE,0,0,0)); + centerPane.add(label); + JProgressBar progressBar = new JProgressBar(); + progressBar.setMaximum(PRECENT); + progressBar.setMinimum(0); + progressBar.setValue(0); + progressBar.setBorder(new EmptyBorder(MESSAGE_FONT_SIZE,SIDE_GAP,SIDE_GAP*2,SIDE_GAP)); + centerPane.add(progressBar); + messagePane.add(centerPane,BorderLayout.CENTER); + optionsPane.removeAll(); + optionsPane.add(cancleButton); + this.revalidate(); + return progressBar; + } + + private void init4VersionSamePane(){ + this.messagePane.removeAll(); + UILabel label = new UILabel(Inter.getLocText("FR-Chart-Versions_Lasted")); + label.setHorizontalAlignment(SwingConstants.CENTER); + label.setFont(new Font(Inter.getLocText("FR-Designer-All_MSBold"), 0, MESSAGE_FONT_SIZE)); + label.setForeground(LABEL_COLOR); + this.messagePane.add(label,BorderLayout.CENTER); + optionsPane.removeAll(); + optionsPane.add(pushAuto); + optionsPane.add(okButton); + this.revalidate(); + } + + private void init4VersionDifferentPane(){ + this.messagePane.removeAll(); + createPaneShowVersions(); + optionsPane.removeAll(); + optionsPane.add(pushAuto); + optionsPane.add(updateButton); + optionsPane.add(cancleButton); + this.revalidate(); + } + + private void createPaneShowVersions(){ + JPanel centerPane = new JPanel(new GridLayout(2,1)); + UILabel localLabel = new UILabel(Inter.getLocText("FR-Chart-Version_Local")+":"+ ProductConstants.RELEASE_VERSION); + localLabel.setFont(new Font(Inter.getLocText("FR-Designer-All_MSBold"), 0, MESSAGE_FONT_SIZE)); + localLabel.setForeground(LABEL_COLOR); + localLabel.setBorder(new EmptyBorder(PUSH_FONT_SIZE,0,0,0)); + UILabel serverLabel = new UILabel(Inter.getLocText("FR-Chart-Version_Lasted")+":"+serverVersion); + serverLabel.setFont(new Font(Inter.getLocText("FR-Designer-All_MSBold"), 0, MESSAGE_FONT_SIZE)); + serverLabel.setForeground(LABEL_COLOR); + serverLabel.setBorder(new EmptyBorder(-MESSAGE_FONT_SIZE - PUSH_FONT_SIZE, 0, 0,0)); + localLabel.setHorizontalAlignment(SwingConstants.CENTER); + serverLabel.setHorizontalAlignment(SwingConstants.CENTER); + centerPane.add(localLabel); + centerPane.add(serverLabel); + messagePane.add(centerPane,BorderLayout.CENTER); + } + + private void judge(){ + if(ComparatorUtils.equals(ProductConstants.RELEASE_VERSION,serverVersion)){ + //版本一致,提示已经是最新版本 + init4VersionSamePane(); + }else{ + init4VersionDifferentPane(); + } + } + + /** + * Dialog exit. + */ + private void dialogExit() { + parentDialog.setVisible(false); + parentDialog.dispose(); + } + + + + + protected String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Help_UpdateOnline"); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java new file mode 100644 index 000000000..d1a4088cd --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java @@ -0,0 +1,108 @@ +package com.fr.design.mainframe.chart.gui; + +import java.awt.BorderLayout; + +import javax.swing.JPanel; + +import com.fr.design.chart.report.GisMapDataPane; +import com.fr.design.chart.report.MapDataPane; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.GisMapPlot; +import com.fr.chart.chartattr.MapPlot; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.mainframe.chart.gui.data.DataContentsPane; +import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; + +public class ChartDataPane extends AbstractChartAttrPane { + + protected DataContentsPane contentsPane; + protected AttributeChangeListener listener; + + private boolean supportCellData = true; + + public ChartDataPane(AttributeChangeListener listener) { + super(); + this.listener = listener; + } + + @Override + protected JPanel createContentPane() { + contentsPane = new NormalChartDataPane(listener, ChartDataPane.this); + return contentsPane; + } + + /** + * 界面标题 + */ + public String getIconPath() { + return "com/fr/design/images/chart/ChartData.png"; + } + + /** + * 界面标题 + * @return 界面标题 + */ + public String title4PopupWindow() { + return PaneTitleConstants.CHART_DATA_TITLE; + } + + protected void repeatLayout(ChartCollection collection) { + if(contentsPane != null) { + this.remove(contentsPane); + } + + this.setLayout(new BorderLayout(0, 0)); + if (collection != null && collection.getChartCount() <= 0) { + contentsPane = new NormalChartDataPane(listener, ChartDataPane.this); + } else if (collection.getSelectedChart().getPlot() instanceof MapPlot) { + contentsPane = new MapDataPane(listener); + } else if(collection.getSelectedChart().getPlot() instanceof GisMapPlot){ + contentsPane = new GisMapDataPane(listener); + }else { + contentsPane = new NormalChartDataPane(listener, ChartDataPane.this); + } + + if(contentsPane != null) { + contentsPane.setSupportCellData(supportCellData); + } + } + + /** + * 设置数据界面是否支持单元格 + */ + public void setSupportCellData(boolean supportCellData) { + this.supportCellData = supportCellData; + } + + /** + * 更新界面 数据内容 + */ + public void populate(ChartCollection collection) { + repeatLayout(collection); + + contentsPane.populate(collection); + + this.add(contentsPane, BorderLayout.CENTER); + + this.validate(); + } + + /** + * 保存 数据界面内容 + */ + public void update(ChartCollection collection) { + if(contentsPane != null) { + contentsPane.update(collection); + } + } + + /** + * 刷新图表数据界面 + * @param collection 图表收集器 + */ + public void refreshChartDataPane(ChartCollection collection){ + this.populate(collection); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDesignerDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDesignerDataPane.java new file mode 100644 index 000000000..f424d6981 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDesignerDataPane.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.chart.gui; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.GisMapPlot; +import com.fr.chart.chartattr.MapPlot; +import com.fr.design.chart.report.GisMapDataPane4Chart; +import com.fr.design.chart.report.MapDataPane4Chart; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.data.ImportSetChartDataPane; +import com.fr.general.FRLogger; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 下午1:57 + */ +public class ChartDesignerDataPane extends ChartDataPane { + private AttributeChangeListener listener; + + public ChartDesignerDataPane(AttributeChangeListener listener) { + super(listener); + this.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + FRLogger.getLogger().info("SD"); + } + }); + this.listener = listener; + } + + @Override + protected JPanel createContentPane() { + contentsPane = new ImportSetChartDataPane(listener,ChartDesignerDataPane.this); + return contentsPane; + } + + + protected void repeatLayout(ChartCollection collection) { + if(contentsPane != null) { + this.remove(contentsPane); + } + + this.setLayout(new BorderLayout(0, 0)); + if (collection.getSelectedChart().getPlot() instanceof MapPlot) { + contentsPane = new MapDataPane4Chart(listener,this); + }else if(collection.getSelectedChart().getPlot() instanceof GisMapPlot){ + contentsPane = new GisMapDataPane4Chart(listener,this); + } else{ + contentsPane = new ImportSetChartDataPane(listener,ChartDesignerDataPane.this); + } + } + + /** + * 主要用于图表设计器 + * @return 是 + */ + public boolean isNeedPresentPaneWhenFilterData(){ + return true; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDesignerOtherPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDesignerOtherPane.java new file mode 100644 index 000000000..7fe51b94b --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDesignerOtherPane.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.chart.gui; + +import com.fr.design.mainframe.chart.gui.other.ChartDesignerConditionAttrPane; +import com.fr.design.mainframe.chart.gui.other.ChartDesignerInteractivePane; +import com.fr.design.dialog.BasicPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.util.*; + +/** + * 图表设计器的图标属性表高级tab + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-16 + * Time: 下午2:04 + */ +public class ChartDesignerOtherPane extends ChartOtherPane { + + @Override + protected JPanel createContentPane() { + JPanel content = new JPanel(new BorderLayout()); + otherPane = new ChartTabPane(); + content.add(otherPane, BorderLayout.CENTER); + return content; + } + + /** + * 界面标题 + * + * @return 返回标题. + */ + public String title4PopupWindow() { + return Inter.getLocText("Advanced"); + } + + private boolean isHaveCondition() { + return hasCondition; + } + + + private class ChartTabPane extends TabPane { + + @Override + protected java.util.List initPaneList() { + java.util.List paneList = new ArrayList(); + interactivePane = new ChartDesignerInteractivePane(ChartDesignerOtherPane.this); + + paneList.add(interactivePane); + + if (ChartDesignerOtherPane.this.isHaveCondition()) { + conditionAttrPane = new ChartDesignerConditionAttrPane(); + paneList.add(conditionAttrPane); + } + return paneList; + } + + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartOtherPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartOtherPane.java new file mode 100644 index 000000000..f0fe20d03 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartOtherPane.java @@ -0,0 +1,139 @@ +package com.fr.design.mainframe.chart.gui; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.BasicPane; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.mainframe.chart.gui.other.ChartConditionAttrPane; +import com.fr.design.mainframe.chart.gui.other.ChartInteractivePane; +import com.fr.design.mainframe.chart.gui.type.ChartTabPane; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class ChartOtherPane extends AbstractChartAttrPane { + private static final long serialVersionUID = -5612046386597783406L; + protected TabPane otherPane; + protected boolean hasCondition = false; + + @Override + protected JPanel createContentPane() { + JPanel content = new JPanel(new BorderLayout()); + otherPane = new TabPane(); + content.add(otherPane, BorderLayout.CENTER); + return content; + } + + @Override + public void populate(ChartCollection collection) { + Plot plot = collection.getSelectedChart().getPlot(); + hasCondition = plot.isSupportDataSeriesCondition(); + + this.removeAll(); + initAll(); + this.validate();// kunsnat: 重新激活面板. 不然事件 滚动条等不响应. + + otherPane.populateBean(collection.getSelectedChart()); + } + + @Override + public void update(ChartCollection collection) { + otherPane.updateBean(collection.getSelectedChart()); + } + + protected BasicBeanPane createInteractivePane() { + return new ChartInteractivePane(ChartOtherPane.this); + } + + protected BasicBeanPane createConditionAttrPane() { + return new ChartConditionAttrPane(); + } + /** + * 注册 切换按钮的 改变事件, 和超链区分. + * @param currentChartEditPane 当前图表编辑界面. + */ + public void registerChartEditPane(ChartEditPane currentChartEditPane) { + otherPane.registerChartEditPane(currentChartEditPane); + } + + @Override + public String getIconPath() { + return "com/fr/design/images/chart/InterAttr.png"; + } + + /** + * 界面标题 + * @return 返回标题. + */ + public String title4PopupWindow() { + return PaneTitleConstants.CHART_OTHER_TITLE; + } + + private boolean isHaveCondition() { + return hasCondition; + } + + /** + * 设置选中的界面id + */ + public void setSelectedByIds(int level, String... id) { + otherPane.setSelectedByIds(level, id); + } + + protected class TabPane extends ChartTabPane { + protected BasicBeanPane interactivePane; + protected BasicBeanPane conditionAttrPane; + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + interactivePane = ChartOtherPane.this.createInteractivePane(); + + paneList.add(interactivePane); + + if (ChartOtherPane.this.isHaveCondition()) { + conditionAttrPane = ChartOtherPane.this.createConditionAttrPane(); + paneList.add(conditionAttrPane); + } + return paneList; + } + + @Override + public void populateBean(Chart chart) { + interactivePane.populateBean(chart); + if (ChartOtherPane.this.isHaveCondition()) { + conditionAttrPane.populateBean(chart); + } + } + + @Override + public void updateBean(Chart chart) { + if(chart == null) { + return; + } + interactivePane.updateBean(chart); + if (ChartOtherPane.this.isHaveCondition()) { + conditionAttrPane.updateBean(chart); + } + } + + /** + * 注册 切换按钮的切换事件. + * @param currentChartEditPane 当前编辑的图表编辑界面. + */ + public void registerChartEditPane(ChartEditPane currentChartEditPane) { +// chartSwitchPane.registerChartEditPane(currentChartEditPane); + } + + @Override + public Chart updateBean() { + return null; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartStylePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartStylePane.java new file mode 100644 index 000000000..0d338290e --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartStylePane.java @@ -0,0 +1,196 @@ +package com.fr.design.mainframe.chart.gui; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.mainframe.chart.gui.style.analysisline.ChartAnalysisLinePane; +import com.fr.design.mainframe.chart.gui.style.area.ChartAreaPane; +import com.fr.design.mainframe.chart.gui.style.axis.ChartAxisPane; +import com.fr.design.mainframe.chart.gui.style.datalabel.ChartDataLabelPane; +import com.fr.design.mainframe.chart.gui.style.datalabel.ChartLabelFontPane; +import com.fr.design.mainframe.chart.gui.style.datasheet.ChartDatasheetPane; +import com.fr.design.mainframe.chart.gui.style.legend.ChartLegendPane; +import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; +import com.fr.design.mainframe.chart.gui.style.title.ChartTitlePane; +import com.fr.design.mainframe.chart.gui.type.ChartTabPane; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class ChartStylePane extends AbstractChartAttrPane { + private static final long serialVersionUID = 8916444369607754491L; + private TabPane stylePane; + private Chart chart; + private AttributeChangeListener listener; + private BasicPane chartAxisPane; + + protected Chart getChart() { + return chart; + } + + public ChartStylePane() { + super(); + } + + public ChartStylePane(AttributeChangeListener listener) { + super(); + this.listener = listener; + } + + //shine: isNeedFormula是图表设计器用的, 所以属性给删除了. + public ChartStylePane(AttributeChangeListener listener, boolean isNeedFormula){ + super(); + this.listener = listener; + } + + @Override + protected JPanel createContentPane() { + JPanel content = new JPanel(new BorderLayout()); + if (chart == null) { + return content; + } + stylePane = new TabPane(); + content.add(stylePane, BorderLayout.CENTER); + return content; + } + + @Override + public void populate(ChartCollection collection) { + this.chart = collection.getSelectedChart(); + this.remove(leftContentPane); + initContentPane(); + this.removeAttributeChangeListener(); + stylePane.populateBean(chart); + this.addAttributeChangeListener(listener); + this.initAllListeners(); + } + + @Override + public void update(ChartCollection collection) { + stylePane.updateBean(collection.getSelectedChart()); + } + + protected List getPaneList() { + List paneList = new ArrayList(); + Plot plot = chart.getPlot(); + + paneList.add(new ChartTitlePane()); + + if(plot.isSupportLegend()){ + paneList.add(new ChartLegendPane()); + } else { + plot.setLegend(null); + } + + if(plot.isSupportDataSeriesAttr()) {// 系列属性 + paneList.add(createChartSeriesPane()); + } + + if(plot.isSupportDataLabelAttr()) {// 数据标签 + paneList.add(new ChartDataLabelPane(ChartStylePane.this)); + } + + if(plot.isMeterPlot()){//标签属性 + paneList.add(new ChartLabelFontPane()); + } + + if(plot.isHaveAxis()) {// 然后加载坐标轴界面. + paneList.add(createAxisPane()); + paneList.add(createAreaPane()); + if(plot.isSupportDataSheet()) { + paneList.add(createDataSheetPane()); + } + } else { + paneList.add(createAreaPane()); + } + + if(plot.needAnalysisLinePane()){//分析线型界面 + paneList.add(new ChartAnalysisLinePane(ChartStylePane.this)); + } + return paneList; + } + + protected ChartSeriesPane createChartSeriesPane() { + return new ChartSeriesPane(ChartStylePane.this); + } + + private BasicPane createDataSheetPane() { + ChartDatasheetPane chartDatasheetPane = new ChartDatasheetPane(); + chartDatasheetPane.useWithAxis((ChartAxisPane)chartAxisPane); + return chartDatasheetPane; + } + + private BasicPane createAxisPane() { + return chartAxisPane = new ChartAxisPane(chart.getPlot(),ChartStylePane.this); + } + + private BasicPane createAreaPane() { + return new ChartAreaPane(chart.getPlot(),ChartStylePane.this); + } + + /** + * 返回对应的图片路径. + */ + public String getIconPath() { + return "com/fr/design/images/chart/ChartStyle.png"; + } + + /** + * 返回界面的标题名称 + * @return 返回名称. + */ + public String title4PopupWindow() { + return PaneTitleConstants.CHART_STYLE_TITLE; + } + + /** + * 设置选中的界面id + */ + public void setSelectedByIds(int level, String... id) { + stylePane.setSelectedByIds(level, id); + } + + class TabPane extends ChartTabPane { + + @Override + protected void tabChanged() { + ChartStylePane.this.removeAttributeChangeListener(); + ((BasicBeanPane) paneList.get(tabPane.getSelectedIndex())).populateBean(chart); + ChartStylePane.this.addAttributeChangeListener(listener); + } + + @Override + protected List initPaneList() { + return ChartStylePane.this.getPaneList(); + } + + @Override + public void populateBean(Chart chart) { + if (chart == null || stylePane.getSelectedIndex() == -1) { + return; + } + ((BasicBeanPane) paneList.get(stylePane.getSelectedIndex())).populateBean(chart); + } + + @Override + public Chart updateBean() { + if (chart == null) { + return null; + } + ((BasicBeanPane) paneList.get(stylePane.getSelectedIndex())).updateBean(chart); + return chart; + } + + @Override + public void updateBean(Chart ob) { + ((BasicBeanPane) paneList.get(stylePane.getSelectedIndex())).updateBean(ob); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java new file mode 100644 index 000000000..0d6891050 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -0,0 +1,441 @@ +package com.fr.design.mainframe.chart.gui; + +import com.fr.base.BaseUtils; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.charttypes.ColumnIndependentChart; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import java.util.ArrayList; + +/** + * 图表 类型 增删 控制按钮界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-9-26 上午09:27:49 + */ +public class ChartTypeButtonPane extends BasicBeanPane implements UIObserver { + private static final long serialVersionUID = -8130803225718028933L; + private static final int B_W = 52; + private static final int B_H = 20; + private static final int COL_COUNT = 3; + + private UIButton addButton; + private ArrayList indexList = new ArrayList(); + + private JPanel buttonPane; + private ChartCollection editingCollection; + private UIObserverListener uiobListener = null; + private ComboBoxPane editChartType; + private UITextField currentEditingEditor = null; + + private boolean mouseOnChartTypeButtonPane = false; + + /** + * 鼠标事件是否在这个面板 + * @return 返回是否 + */ + public boolean isMouseOnChartTypeButtonPane() { + return this.mouseOnChartTypeButtonPane; + } + + private AWTEventListener awt = new AWTEventListener() { + public void eventDispatched(AWTEvent event) { + //没有进行鼠标点击,则返回 + if (event instanceof MouseEvent && ((MouseEvent) event).getClickCount() > 0) { + if (currentEditingEditor != null && !ComparatorUtils.equals(event.getSource(), currentEditingEditor)) { + stopEditing(); + if (event.getSource() instanceof ChartChangeButton) { + ((ChartChangeButton) event.getSource()).mouseClick((MouseEvent) event); + } + populateBean(editingCollection); + } + } + } + }; + + public ChartTypeButtonPane() { + this.setLayout(new BorderLayout()); + addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); + + buttonPane = new JPanel(); + this.add(buttonPane, BorderLayout.CENTER); + + JPanel eastPane = new JPanel(); + this.add(eastPane, BorderLayout.EAST); + + eastPane.setLayout(new BorderLayout()); + + eastPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 20)); + eastPane.add(addButton, BorderLayout.NORTH); + + addButton.setPreferredSize(new Dimension(20, 20)); + addButton.addActionListener(addListener); + addButton.addMouseListener(mouseListener); + Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + } + + ActionListener addListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + mouseOnChartTypeButtonPane = true; + String name = getNewChartName(); + ChartChangeButton button = new ChartChangeButton(name);// some set selected + + button.registerChangeListener(uiobListener); + + indexList.add(button); + + if (editingCollection != null) { + Chart[] barChart = ColumnIndependentChart.columnChartTypes; + try { + Chart newChart = (Chart) barChart[0].clone(); + editingCollection.addNamedChart(name, newChart); + editingCollection.addFunctionRecord(newChart); + } catch (CloneNotSupportedException e1) { + FRLogger.getLogger().error("Error in Clone"); + } + + } + layoutPane(buttonPane); + } + }; + + MouseListener mouseListener = new MouseAdapter() { + @Override + public void mouseExited(MouseEvent e) { + super.mouseExited(e); + mouseOnChartTypeButtonPane = false; + } + }; + + private String getNewChartName() { + int count = indexList.size() + 1; + while (true) { + String name_test = Inter.getLocText("FR-Chart-Module_Name") + count; + boolean repeated = false; + for (int i = 0, len = indexList.size(); i < len; i++) { + ChartChangeButton nameable = indexList.get(i); + if (ComparatorUtils.equals(nameable.getButtonName(), name_test)) { + repeated = true; + break; + } + } + + if (!repeated) { + return name_test; + } + count++; + } + } + + private void layoutPane(JPanel northPane) { + if (northPane == null) { + return; + } + northPane.removeAll(); + northPane.setLayout(new BoxLayout(northPane, BoxLayout.Y_AXIS)); + + JPanel pane = null; + for (int i = 0; i < indexList.size(); i++) { + if (i % COL_COUNT == 0) { + pane = new JPanel(new FlowLayout(FlowLayout.LEFT)); + northPane.add(pane); + } + + pane.add(indexList.get(i)); + } + + this.revalidate(); + } + + private void layoutRenamingPane(JPanel northPane, int index) { + if (northPane == null) { + return; + } + northPane.removeAll(); + northPane.setLayout(new BoxLayout(northPane, BoxLayout.Y_AXIS)); + + JPanel pane = null; + + for (int i = 0; i < indexList.size(); i++) { + if (i % COL_COUNT == 0) { + pane = new JPanel(new FlowLayout(FlowLayout.LEFT)); + northPane.add(pane); + } + if (i != index) { + pane.add(indexList.get(i)); + } else { + pane.add(currentEditingEditor); + } + } + this.revalidate(); + } + + /** + * 注册监听器 + * @param listener 观察者监听事件 + */ + public void registerChangeListener(UIObserverListener listener) { + uiobListener = listener; + } + + /** + * 是否应该响应事件监听器 + * @return 是则返回true + */ + public boolean shouldResponseChangeListener() { + return true; + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Types_Switch"); + } + + private void changeCollectionSelected(String name) { + if (editingCollection != null) { + int count = editingCollection.getChartCount(); + for (int i = 0; i < count; i++) { + if (ComparatorUtils.equals(name, editingCollection.getChartName(i))) { + editingCollection.setSelectedIndex(i); + break; + } + } + if (editChartType != null) { + editChartType.populateBean(editingCollection.getSelectedChart()); + } + } + } + + /** + * 设置当前对应的编辑Type + * + * @param chartPane + */ + public void setEditingChartPane(ComboBoxPane chartPane) { + editChartType = chartPane; + } + + @Override + public void populateBean(ChartCollection collection) { + editingCollection = collection; + + indexList.clear(); + int count = collection.getChartCount(); + int select = collection.getSelectedIndex(); + for (int i = 0; i < count; i++) { + ChartChangeButton button = new ChartChangeButton(collection.getChartName(i)); + indexList.add(button); + button.setSelected(i == select); + button.registerChangeListener(uiobListener); + } + + layoutPane(buttonPane); + checkAddButtonVisible(); + } + + private void checkAddButtonVisible() { + addButton.setVisible(true); + //新建一个collection + if(editingCollection != null && editingCollection.getChartCount() == 1){ + //vanChart 不支持图表切换 目前 + if(!ComparatorUtils.equals(editingCollection.getSelectedChart().getClass(), Chart.class)){ + addButton.setVisible(false); + } + } + } + + @Override + public ChartCollection updateBean() { + return null;// no use + } + + /** + * 保存 属性表属性. + */ + public void update(ChartCollection collection) { + // 什么也不做, 在button操作点击等时 已经处理. + } + + + private void stopEditing() { + if (currentEditingEditor != null) { + String newName = currentEditingEditor.getText(); + int selectedIndex = editingCollection.getSelectedIndex(); + if (!ComparatorUtils.equals(editingCollection.getChartName(selectedIndex), newName)) { + editingCollection.setChartName(selectedIndex, newName); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); + } + buttonPane.remove(currentEditingEditor); + currentEditingEditor = null; + } + } + + + private class ChartChangeButton extends UIToggleButton { + private static final double DEL_WIDTH = 10; + private BufferedImage closeIcon = BaseUtils.readImageWithCache("com/fr/design/images/toolbarbtn/chartChangeClose.png"); + private boolean isMoveOn = false; + + private String buttonName = ""; + private UITextField nameField = new UITextField(); + + public ChartChangeButton(String name) { + super(name); + + buttonName = name; + this.setToolTipText(name); + nameField.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + stopEditing(); + populateBean(editingCollection); + } + }); + } + + public String getButtonName() { + return buttonName; + } + + public Dimension getPreferredSize() { + return new Dimension(B_W, B_H); + } + + private void paintDeleteButton(Graphics g2d) { + Rectangle2D bounds = this.getBounds(); + + int x = (int) (bounds.getWidth() - DEL_WIDTH); + int y = (int) (1); + + g2d.drawImage((Image) closeIcon, x, y, closeIcon.getWidth(), closeIcon.getHeight(), null); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + + if (isMoveOn && indexList.size() > 1) { + paintDeleteButton(g); + } + } + + private void noSelected() { + for (int i = 0, size = indexList.size(); i < size; i++) { + indexList.get(i).setSelected(false); + } + } + + private void checkMoveOn(boolean moveOn) { + for (int i = 0; i < indexList.size(); i++) { + indexList.get(i).isMoveOn = false; + } + + this.isMoveOn = moveOn; + } + + private Rectangle2D getRectBounds() { + return this.getBounds(); + } + + private void deleteAButton() { + if (indexList.contains(this) && indexList.size() > 1) { + indexList.remove(this); + + if (this.isSelected()) { + indexList.get(0).setSelected(true); + changeCollectionSelected(indexList.get(0).getButtonName()); + } + + if (editingCollection != null) { + int count = editingCollection.getChartCount(); + for (int i = 0; i < count; i++) { + if (ComparatorUtils.equals(getButtonName(), editingCollection.getChartName(i))) { + editingCollection.removeNameObject(i); + break; + } + } + } + } + + relayoutPane(); + } + + private void relayoutPane() { + layoutPane(buttonPane); + } + + + protected MouseListener getMouseListener() { + return new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + mouseClick(e); + mouseOnChartTypeButtonPane = true; + } + + public void mouseEntered(MouseEvent e) { + checkMoveOn(true); + mouseOnChartTypeButtonPane = true; + } + + public void mouseExited(MouseEvent e) { + checkMoveOn(false); + mouseOnChartTypeButtonPane = false; + } + }; + } + + + public void mouseClick(MouseEvent e) { + Rectangle2D bounds = getRectBounds(); + if (bounds == null) { + return; + } + if (e.getX() >= bounds.getWidth() - DEL_WIDTH) { + deleteAButton(); + fireSelectedChanged(); + return; + } + + if (isSelected()) { + doWithRename(); + return; + } + + //第一次选择 + + if (isEnabled()) { + noSelected(); + changeCollectionSelected(getButtonName()); + setSelectedWithFireListener(true); + fireSelectedChanged(); + } + } + + private void doWithRename() { + currentEditingEditor = this.nameField; + Rectangle bounds = this.getBounds(); + currentEditingEditor.setPreferredSize(new Dimension((int) bounds.getWidth(), (int) bounds.getHeight())); + currentEditingEditor.setText(this.getButtonName()); + buttonPane.repaint(); + layoutRenamingPane(buttonPane, editingCollection.getSelectedIndex()); + currentEditingEditor.requestFocus(); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java new file mode 100644 index 000000000..686c130c1 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -0,0 +1,166 @@ +package com.fr.design.mainframe.chart.gui; + +import com.fr.base.FRContext; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +/** + * 图表 属性表, 类型选择 界面. +* @author kunsnat E-mail:kunsnat@gmail.com +* @version 创建时间:2012-12-26 上午10:56:51 + */ +public class ChartTypePane extends AbstractChartAttrPane{ + private ComboBoxPane chartTypePane; + private ChartTypeButtonPane buttonPane; + private ChartEditPane editPane; + private ChartCollection editingCollection; + + @Override + protected JPanel createContentPane() { + JPanel content = new JPanel(new BorderLayout()); + + buttonPane = new ChartTypeButtonPane(); + content.add(buttonPane, BorderLayout.NORTH); + + chartTypePane = new ComboBoxPane(); + chartTypePane.setBorder(BorderFactory.createEmptyBorder(0,0, 0, 10)); + content.add(chartTypePane, BorderLayout.CENTER); + + buttonPane.setEditingChartPane(chartTypePane); + + return content; + } + + /** + * 界面做为按钮时的图片位置. design_base + */ + public String getIconPath() { + return "com/fr/design/images/chart/ChartType.png"; + } + + /** + * 界面标题 + * @return 界面标题 + */ + public String title4PopupWindow() { + return PaneTitleConstants.CHART_TYPE_TITLE; + } + + class ComboBoxPane extends UIComboBoxPane{ + @Override + protected List> initPaneList() { + List> paneList = new ArrayList>(); + ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList); + return paneList; + } + + @Override + protected String title4PopupWindow() { + return null; + } + + public void updateBean(Chart chart) { + int lastSelectIndex = editPane.getSelectedChartIndex(chart); + + try{ + Chart newDefaultChart = (Chart)((AbstractChartTypePane)cards.get(jcb.getSelectedIndex())).getDefaultChart().clone(); + if(!chart.accept(newDefaultChart.getClass())){ + //vanChart 和 chart 之间切换 + editingCollection.removeNameObject(editingCollection.getSelectedIndex()); + editingCollection.addChart(newDefaultChart); + chart = newDefaultChart; + } + }catch (CloneNotSupportedException e){ + FRContext.getLogger().error(e.getMessage(), e); + } + + //这一步会替换plot + ((AbstractChartTypePane) cards.get(jcb.getSelectedIndex())).updateBean(chart); + + Plot plot = chart.getPlot(); + + if(plot != null){ + String plotID = plot.getPlotID(); + + //plot改变的话图表类型就算改变了 + + chart.setWrapperName(ChartTypeManager.getInstance().getWrapperName(plotID)); + + chart.setChartImagePath(ChartTypeManager.getInstance().getChartImagePath(plotID)); + + boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); + + if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && lastSelectIndex != jcb.getSelectedIndex())){ + editPane.reLayout(chart); + } + } + } + } + + /** + * 更新界面属性 用于展示 + */ + public void populate(ChartCollection collection) { + Chart chart = collection.getSelectedChart(); + chartTypePane.populateBean(chart); + + buttonPane.populateBean(collection); + } + + /** + * 保存界面属性 + */ + public void update(ChartCollection collection) { + editingCollection = collection; + buttonPane.update(collection);// 内部操作时 已经做过处理. + Chart chart = collection.getSelectedChart(); + + chartTypePane.updateBean(chart); + } + + /** + * 所有图表的类型界面 + * @return 类型界面 + */ + public FurtherBasicBeanPane[] getPaneList(){ + return chartTypePane.getCards().toArray(new FurtherBasicBeanPane[0]); + } + + /** + * 当前选中的图表的index + * @return 当前选中的图表的index + */ + public int getSelectedIndex(){ + return chartTypePane.getSelectedIndex(); + } + + /** + * 返回选中的图表的index + * @return 选中的图标的序号 + */ + public int getSelectedChartIndex(){ + return chartTypePane.getSelectedIndex(); + } + + /** + * 设置下编辑的面板 + * @param currentEditPane 设置下编辑的面板 + */ + public void registerChartEditPane(ChartEditPane currentEditPane) { + this.editPane = currentEditPane; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/StylePane4Chart.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/StylePane4Chart.java new file mode 100644 index 000000000..9ce3afd91 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/StylePane4Chart.java @@ -0,0 +1,33 @@ +package com.fr.design.mainframe.chart.gui; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; +import com.fr.design.mainframe.chart.gui.style.series.SeriesPane4ChartDesigner; + +/** + * 图表设计器的样式面板 + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-25 + * Time: 下午6:56 + */ +public class StylePane4Chart extends ChartStylePane { + + public StylePane4Chart(AttributeChangeListener listener, boolean isNeedFormula) { + super(listener, isNeedFormula); + } + + public void update(ChartCollection collection) { + int selectIndex = collection.getSelectedIndex(); + super.update(collection); + collection.getSelectedChart().setStyleGlobal(false); + collection.setChartName(selectIndex, collection.getSelectedChart().getTitle().getTextObject().toString()); + } + + protected ChartSeriesPane createChartSeriesPane(){ + return new SeriesPane4ChartDesigner(StylePane4Chart.this); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java new file mode 100644 index 000000000..ceca4f9dc --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java @@ -0,0 +1,213 @@ +package com.fr.design.mainframe.chart.gui; + +import com.fr.base.ScreenResolution; +import com.fr.chart.base.GlyphUtils; +import com.fr.chart.base.TextAttr; +import com.fr.design.constants.UIConstants; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRFont; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; +import java.awt.event.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 7.1.1 + */ +public class UIEditLabel extends JPanel implements UIObserver{ + + private static final int OFF_LEFT = 10; + + private UITextField currentEditingEditor = null; + private UILabel showLabel; + private boolean isEditingStopped = true; + private String originalLabel = StringUtils.EMPTY; + private DocumentListener documentListener = new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + fireChange(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + fireChange(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + fireChange(); + } + }; + + private void fireChange(){ + setText(currentEditingEditor.getText()); + observerListener.doChange(); + } + + + private AWTEventListener awt = new AWTEventListener() { + public void eventDispatched(AWTEvent event) { + if(!UIEditLabel.this.isShowing()){ + return; + } + doSomeInAll(event); + } + }; + + private void doSomeInAll(AWTEvent event) { + Rectangle bounds = new Rectangle(getLocationOnScreen().x, getLocationOnScreen().y, getWidth(), getHeight()); + if (event instanceof MouseEvent) { + MouseEvent mv = (MouseEvent) event; + if (mv.getClickCount() > 0) { + Point point = new Point((int) (mv.getLocationOnScreen().getX()) - 2 * OFF_LEFT, (int) mv.getLocationOnScreen().getY()); + // 判断鼠标点击是否在边界内 + if (!bounds.contains(point)) { + if (!isEditingStopped) { + stopEditing(); + } + } + } + } + } + + private UIObserverListener observerListener; + + public UIEditLabel(String label,int horizontalAlignment){ + initComponents(); + showLabel.setHorizontalAlignment(horizontalAlignment); + this.originalLabel = label; + setText(label); + } + + public UIEditLabel(int horizontalAlignment){ + initComponents(); + showLabel.setHorizontalAlignment(horizontalAlignment); + } + + private void initComponents(){ + showLabel = new UILabel(); + currentEditingEditor = new UITextField(); + this.setLayout(new BorderLayout()); + this.add(showLabel, BorderLayout.CENTER); + Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + showLabel.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + doAfterMousePress(); + isEditingStopped = false; + UIEditLabel.this.removeAll(); + currentEditingEditor.getDocument().removeDocumentListener(documentListener); + currentEditingEditor.setText(getText()); + currentEditingEditor.getDocument().addDocumentListener(documentListener); + UIEditLabel.this.add(currentEditingEditor,BorderLayout.CENTER); + UIEditLabel.this.setBackground(UIConstants.FLESH_BLUE); + UIEditLabel.this.revalidate(); + } + + /** + * {@inheritDoc} + */ + public void mouseEntered(MouseEvent e) { + showLabel.setToolTipText(getTooltip()); + UIEditLabel.this.setBackground(UIConstants.FLESH_BLUE); + } + + /** + * {@inheritDoc} + */ + public void mouseExited(MouseEvent e) { + showLabel.setToolTipText(getTooltip()); + UIEditLabel.this.setBackground(UIConstants.NORMAL_BACKGROUND); + } + + }); + currentEditingEditor.addKeyListener(new KeyAdapter() { + + public void keyPressed(KeyEvent e) { + if(e.getKeyCode()==KeyEvent.VK_ENTER){ + stopEditing(); + } + } + }); + currentEditingEditor.getDocument().addDocumentListener(documentListener); + } + + protected void doAfterMousePress(){ + + } + + /** + * 设置成正常的背景 + */ + public void resetNomalrBackground(){ + UIEditLabel.this.setBackground(UIConstants.NORMAL_BACKGROUND); + } + + private String getTooltip(){ + String text = showLabel.getText(); + double width = GlyphUtils.calculateTextDimensionWithNoRotation(text, new TextAttr(FRFont.getInstance()), ScreenResolution.getScreenResolution()).getWidth(); + if(width<=showLabel.getWidth()){ + return null; + } + return text; + } + + private void stopEditing(){ + isEditingStopped = true; + this.removeAll(); + String text =this.showLabel.getText(); + text = StringUtils.cutStringEndWith(text,":"); + text = !ComparatorUtils.equals(text, this.originalLabel) ? + StringUtils.perfectEnd(text, "(" + this.originalLabel + ")"): this.originalLabel; + showLabel.setText(StringUtils.perfectEnd(text,":")); + this.add(showLabel, BorderLayout.CENTER); + this.revalidate(); + this.repaint(); + } + + public String getText(){ + String text =this.showLabel.getText(); + text = StringUtils.cutStringEndWith(text,":"); + return StringUtils.cutStringEndWith(text,"("+this.originalLabel+")"); + } + + public void setText(String text){ + if(text == null || StringUtils.isEmpty(text)){ + this.showLabel.setText(this.originalLabel); + return; + } + if(!ComparatorUtils.equals(text,originalLabel)){ + text = StringUtils.cutStringEndWith(text, ":"); + text = StringUtils.perfectEnd(text,"("+originalLabel+")"); + } + text = StringUtils.perfectEnd(text,":"); + this.showLabel.setText(text); + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(UIObserverListener listener) { + this.observerListener = listener; + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java new file mode 100644 index 000000000..604c107c4 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java @@ -0,0 +1,68 @@ +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.data.util.function.AbstractDataFunction; +import com.fr.data.util.function.AverageFunction; +import com.fr.data.util.function.CountFunction; +import com.fr.data.util.function.MaxFunction; +import com.fr.data.util.function.MinFunction; +import com.fr.data.util.function.NoneFunction; +import com.fr.data.util.function.SumFunction; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.Inter; + +/** + * 公式选择. +* @author kunsnat E-mail:kunsnat@gmail.com +* @version 创建时间:2013-1-8 上午09:52:15 + */ +public class CalculateComboBox extends UIComboBox{ + + public static final String[] CALCULATE_ARRAY = {Inter.getLocText("DataFunction-None"), Inter.getLocText("DataFunction-Sum"), + Inter.getLocText("DataFunction-Average"), Inter.getLocText("DataFunction-Max"), + Inter.getLocText("DataFunction-Min"), Inter.getLocText("DataFunction-Count")}; + public static final Class[] CLASS_ARRAY = {NoneFunction.class, SumFunction.class, AverageFunction.class, + MaxFunction.class, MinFunction.class, CountFunction.class}; + + public CalculateComboBox() { + super(CALCULATE_ARRAY); + setSelectedIndex(0); + } + + public void reset() { + this.setSelectedItem(Inter.getLocText("DataFunction-None")); + } + + /** + * 更新公式选择. + */ + public void populateBean(AbstractDataFunction function) { + for(int i = 0; i < CLASS_ARRAY.length; i++) { + if(function != null && ComparatorUtils.equals(function.getClass(), CLASS_ARRAY[i])) { + setSelectedIndex(i); + break; + } + } + } + + /** + * 返回当前选择的公式 + */ + public AbstractDataFunction updateBean() { + try { + int selectIndex = getSelectedIndex(); + if(selectIndex >= 0 && selectIndex < CLASS_ARRAY.length) { + return (AbstractDataFunction)CLASS_ARRAY[selectIndex].newInstance(); + } + } catch (InstantiationException e) { + FRLogger.getLogger().error("Function Error"); + return null; + } catch (IllegalAccessException e) { + FRLogger.getLogger().error("Function Error"); + return null; + } + + return null; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java new file mode 100644 index 000000000..f0a6d67bb --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java @@ -0,0 +1,544 @@ +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.base.Utils; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartdata.TopDefinition; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane; +import com.fr.design.mainframe.chart.gui.style.ThirdTabPane; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +/** + * 图表数据 分类 系列 过滤界面. + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-19 下午04:40:21 + */ +public class ChartDataFilterPane extends ThirdTabPane { + private static final long serialVersionUID = 3650522989381790194L; + private static final int PAN_WIDTH = 210; + private static final int FIL_HEIGHT = 130; + + private CategoryFilterPane categoryPane; + private SeriesFilterPane seriesPane; + private boolean isNeedPresent = true; + private AbstractAttrNoScrollPane parentPane = null; + private Plot plot4Pane = null; + + public ChartDataFilterPane(Plot plot, ChartDataPane parent) { + super(plot, parent); + this.isNeedPresent = true; + } + + + protected List initPaneList(Plot plot, AbstractAttrNoScrollPane parent) { + plot4Pane = plot; + parentPane = parent; + List paneList = new ArrayList(); + if (plot == null || plot.isSupportCategoryFilter()) { + categoryPane = new CategoryFilterPane(parent); + paneList.add(new NamePane(categoryPane.title4PopupWindow(), categoryPane)); + } + + if (plot == null || plot.isSupportSeriesFilter()) { + seriesPane = new SeriesFilterPane(parent); + paneList.add(new NamePane(seriesPane.title4PopupWindow(), seriesPane)); + } + return paneList; + } + + protected int getContentPaneWidth() { + return PAN_WIDTH; + } + + /** + * 检查界面box使用. + */ + public void checkBoxUse() { + if (categoryPane != null) { + categoryPane.checkBoxUse(); + } + if (seriesPane != null) { + seriesPane.checkBoxUse(); + } + } + + /** + * 界面标题: 数据筛选. + * + * @return 返回标题. + */ + public String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Data_Filter"); + } + + /** + * 重新布局面板 + * @param isNeedPresent 是否需要形态(图表设计器不需要) + */ + public void relayoutPane(boolean isNeedPresent) { + if (this.isNeedPresent == isNeedPresent) { + return; + } + this.isNeedPresent = isNeedPresent; + this.removeAll(); + paneList = initPaneList4NoPresent(plot4Pane, parentPane); + initAllPane(); + this.validate(); + } + + private List initPaneList4NoPresent(Plot plot, AbstractAttrNoScrollPane parent) { + List paneList = new ArrayList(); + if (plot == null || plot.isSupportCategoryFilter()) { + categoryPane = new CategoryFilterPaneWithOutPresentPane(parent); + paneList.add(new NamePane(categoryPane.title4PopupWindow(), categoryPane)); + } + + if (plot == null || plot.isSupportSeriesFilter()) { + seriesPane = new SeriesFilterWithOutPresentPane(parent); + paneList.add(new NamePane(seriesPane.title4PopupWindow(), seriesPane)); + } + return paneList; + } + + public void populateBean(ChartCollection collection, boolean isNeedPresent) { + relayoutPane(isNeedPresent); + if (categoryPane != null) { + categoryPane.populateBean(collection.getSelectedChart().getFilterDefinition()); + } + if (seriesPane != null) { + seriesPane.populateBean(collection.getSelectedChart().getFilterDefinition()); + } + checkBoxUse(); + } + + /** + * 更新界面 数据筛选. + */ + public void populateBean(ChartCollection collection) { + this.populateBean(collection, true); + } + + /** + * 保存界面数据筛选. + */ + public void updateBean(ChartCollection collection) { + if (categoryPane != null) { + categoryPane.updateBean(collection.getSelectedChart().getFilterDefinition()); + } + if (seriesPane != null) { + seriesPane.updateBean(collection.getSelectedChart().getFilterDefinition()); + } + } + + /** + * 分类过滤. + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-19 下午04:41:35 + */ + private class CategoryFilterPane extends AbstractChartTabPane { + private UICheckBox onlyPreData; + private UITextField preDataNum; + private UICheckBox combineOther; + private UICheckBox notShowNull; + private PresentComboBox present; + private AbstractAttrNoScrollPane parent; + + public CategoryFilterPane(AbstractAttrNoScrollPane parent) { + super(true); + this.parent = parent; + } + + @Override + public Dimension getPreferredSize() { + Dimension dim = super.getPreferredSize(); + dim.height = FIL_HEIGHT; + return dim; + } + + @Override + protected JPanel createContentPane() { + this.setLayout(new BorderLayout()); + JPanel pane = new JPanel(); + this.add(pane, BorderLayout.NORTH); + pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); + pane.setPreferredSize(new Dimension(200, 110)); + initOtherPane(pane); + initPresentPane(pane); + return pane; + } + + protected void initOtherPane(JPanel pane) { + JPanel prePane = new JPanel(); + prePane.setLayout(new FlowLayout(FlowLayout.LEFT)); + prePane.setPreferredSize(new Dimension(200, 20)); + pane.add(prePane); + onlyPreData = new UICheckBox(Inter.getLocText("FR-Chart-Data_OnlyUseBefore")); + preDataNum = new UITextField(); + preDataNum.setPreferredSize(new Dimension(50, 20)); + prePane.add(onlyPreData); + prePane.add(preDataNum); + prePane.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Data_Records"))); + JPanel otherPane = new JPanel(); + otherPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + pane.add(otherPane); + combineOther = new UICheckBox(Inter.getLocText("FR-Chart-Data_CombineOther")); + combineOther.setSelected(true); + otherPane.add(combineOther); + JPanel catePane = new JPanel(); + pane.add(catePane); + catePane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); + notShowNull = new UICheckBox(Inter.getLocText("FR-Chart-Data_NotShowCate")); + catePane.add(notShowNull); + + onlyPreData.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + checkBoxUse(); + } + }); + } + + private void initPresentPane(JPanel pane) { + JPanel presentPane = new JPanel(); + presentPane.setLayout(new FlowLayout(FlowLayout.LEFT, 8, 0)); + pane.add(presentPane); + present = new PresentComboBox() { + protected void fireChange() { + fire(); + } + }; + present.setPreferredSize(new Dimension(70, 20)); + presentPane.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Style_Present") + ":")); + presentPane.add(present); + } + + private void fire() { + if (this.parent != null) { + this.parent.attributeChanged(); + } + } + + /** + * 界面标题 "分类" + */ + public String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Style_Category"); + } + + /** + * 检查分类过滤界面 Box是否可用. + */ + public void checkBoxUse() { + preDataNum.setEnabled(onlyPreData.isSelected()); + combineOther.setEnabled(onlyPreData.isSelected()); + ; + } + + /** + * 更新分类过滤界面内容 + */ + public void populateBean(TopDefinitionProvider topDefinition) { + if (topDefinition == null) { + return; + } + populateBean4NoPresent(topDefinition); + if(present != null){ + present.populate(topDefinition.getCategoryPresent()); + } + } + + /** + * 保存分类更新内容到TopDefinition + */ + public void updateBean(TopDefinitionProvider topDefinition) { + updateBean4NoPresent(topDefinition); + topDefinition.setCategoryPresent(present.update()); + } + + @Override + public TopDefinition updateBean() { + return null; + } + + protected void updateBean4NoPresent(TopDefinitionProvider topDefinition) { + if (onlyPreData.isSelected()) { + if (StringUtils.isNotEmpty(preDataNum.getText())) { + Number number = Utils.objectToNumber(preDataNum.getText(), true); + if (number != null) { + topDefinition.setTopCate(Integer.valueOf(preDataNum.getText())); + } + } + topDefinition.setDiscardOtherCate(!combineOther.isSelected()); + } else { + topDefinition.setTopCate(Integer.valueOf(-1)); + } + topDefinition.setDiscardNullCate(notShowNull.isSelected()); + } + + protected void populateBean4NoPresent(TopDefinitionProvider topDefinition) { + if (topDefinition.getTopCate() == -1) { + onlyPreData.setSelected(false); + } else { + onlyPreData.setSelected(true); + preDataNum.setText(String.valueOf(topDefinition.getTopCate())); + + combineOther.setSelected(!topDefinition.isDiscardOtherCate()); + } + + notShowNull.setSelected(topDefinition.isDiscardNullCate()); + } + } + + /** + * 系列过滤. + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-19 下午04:41:24 + */ + private class SeriesFilterPane extends AbstractChartTabPane { + private UICheckBox onlyPreData; + private UITextField preDataNum; + private UICheckBox notShowNull; + private UICheckBox combineOther; + private PresentComboBox present; + + private AbstractAttrNoScrollPane parent; + + public SeriesFilterPane(AbstractAttrNoScrollPane parent) { + super(true); + this.parent = parent; + } + + @Override + public Dimension getPreferredSize() { + Dimension dim = super.getPreferredSize(); + dim.height = FIL_HEIGHT; + return dim; + } + + @Override + protected JPanel createContentPane() { + this.setLayout(new BorderLayout()); + JPanel pane = new JPanel(); + this.add(pane, BorderLayout.NORTH); + pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); + pane.setPreferredSize(new Dimension(200, 110)); + initOtherPane(pane); + initPresentPane(pane); + return pane; + } + + + protected void initOtherPane(JPanel pane) { + JPanel prePane = new JPanel(); + prePane.setLayout(new FlowLayout(FlowLayout.LEFT)); + prePane.setPreferredSize(new Dimension(200, 20)); + pane.add(prePane); + onlyPreData = new UICheckBox(Inter.getLocText("FR-Chart-Data_OnlyUseBefore")); + preDataNum = new UITextField(); + preDataNum.setPreferredSize(new Dimension(50, 20)); + prePane.add(onlyPreData); + prePane.add(preDataNum); + prePane.add(new UILabel(Inter.getLocText("FR-Chart-Data_Records"))); + JPanel otherPane = new JPanel(); + otherPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + pane.add(otherPane); + + combineOther = new UICheckBox(Inter.getLocText("FR-Chart-Data_CombineOther")); + combineOther.setSelected(true); + otherPane.add(combineOther); + JPanel catePane = new JPanel(); + pane.add(catePane); + + catePane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); + notShowNull = new UICheckBox(Inter.getLocText("FR-Chart-Data_NotShowSeries")); + catePane.add(notShowNull); + + onlyPreData.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + checkBoxUse(); + } + }); + } + + private void initPresentPane(JPanel pane) { + JPanel presentPane = new JPanel(); + presentPane.setLayout(new FlowLayout(FlowLayout.LEFT, 8, 0)); + pane.add(presentPane); + present = new PresentComboBox() { + protected void fireChange() { + fire(); + } + }; + present.setPreferredSize(new Dimension(70, 20)); + presentPane.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Style_Present") + ":")); + presentPane.add(present); + } + + private void fire() { + if (this.parent != null) { + parent.attributeChanged(); + } + } + + + /** + * 界面标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("FR-Chart-Data_Series"); + } + + /** + * 检查Box是否可用 + */ + public void checkBoxUse() { + preDataNum.setEnabled(onlyPreData.isSelected()); + combineOther.setEnabled(onlyPreData.isSelected()); + } + + /** + * 系列 筛选器界面 更新属性 + */ + public void populateBean(TopDefinitionProvider topDefinition) { + if (topDefinition == null) { + return; + } + populate4NoPresent(topDefinition); + if(present != null){ + present.populate(topDefinition.getSeriesPresent()); + } + } + + protected void populate4NoPresent(TopDefinitionProvider topDefinition) { + if (topDefinition.getTopSeries() == -1) { + onlyPreData.setSelected(false); + } else { + onlyPreData.setSelected(true); + preDataNum.setText(String.valueOf(topDefinition.getTopSeries())); + + combineOther.setSelected(!topDefinition.isDiscardOtherSeries()); + } + + notShowNull.setSelected(topDefinition.isDiscardNullSeries()); + } + + /** + * 系列 筛选器界面 保存属性到TopDefinition + */ + public void updateBean(TopDefinitionProvider topDefinition) { + update4NoPresent(topDefinition); + if(present != null){ + topDefinition.setSeriesPresent(present.update()); + } + } + + protected void update4NoPresent(TopDefinitionProvider topDefinition) { + if (onlyPreData.isSelected()) { + if (StringUtils.isNotEmpty(preDataNum.getText())) { + Number number = Utils.objectToNumber(preDataNum.getText(), true); + if (number != null) { + topDefinition.setTopSeries(number.intValue()); + } + } + topDefinition.setDiscardOtherSeries(!combineOther.isSelected()); + } else { + topDefinition.setTopSeries(Integer.valueOf(-1)); + } + + topDefinition.setDiscardNullSeries(notShowNull.isSelected()); + } + + @Override + public TopDefinition updateBean() { + return null; + } + } + + private class SeriesFilterWithOutPresentPane extends SeriesFilterPane { + + public SeriesFilterWithOutPresentPane(AbstractAttrNoScrollPane parent) { + super(parent); + } + + @Override + protected JPanel createContentPane() { + this.setLayout(new BorderLayout()); + JPanel pane = new JPanel(); + this.add(pane, BorderLayout.NORTH); + pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); + pane.setPreferredSize(new Dimension(200, 110)); + initOtherPane(pane); + return pane; + } + + /** + * 系列 筛选器界面 更新属性 + */ + public void populateBean(TopDefinition topDefinition) { + if (topDefinition == null) { + return; + } + populate4NoPresent(topDefinition); + } + + /** + * 系列 筛选器界面 保存属性到TopDefinition + */ + public void updateBean(TopDefinition topDefinition) { + update4NoPresent(topDefinition); + } + + } + + private class CategoryFilterPaneWithOutPresentPane extends CategoryFilterPane { + + public CategoryFilterPaneWithOutPresentPane(AbstractAttrNoScrollPane parent) { + super(parent); + } + + @Override + protected JPanel createContentPane() { + this.setLayout(new BorderLayout()); + JPanel pane = new JPanel(); + this.add(pane, BorderLayout.NORTH); + pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); + pane.setPreferredSize(new Dimension(200, 110)); + initOtherPane(pane); + return pane; + } + + /** + * 更新分类过滤界面内容 + */ + public void populateBean(TopDefinition topDefinition) { + if (topDefinition == null) { + return; + } + populateBean4NoPresent(topDefinition); + } + + /** + * 保存分类更新内容到TopDefinition + */ + public void updateBean(TopDefinitionProvider topDefinition) { + updateBean4NoPresent(topDefinition); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ChartDesignDataLoadPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ChartDesignDataLoadPane.java new file mode 100644 index 000000000..43a2fae34 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ChartDesignDataLoadPane.java @@ -0,0 +1,48 @@ +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.base.TableData; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; +import com.fr.design.dialog.BasicPane; +import com.fr.design.mainframe.AbstractChartDataPane4Chart; + +/** + * 图表设计器导入 界面 + * Created by kunsnat on 14-10-21. + * kunsnat@gmail.com + */ +public abstract class ChartDesignDataLoadPane extends BasicPane { + + private AbstractChartDataPane4Chart parentPane; + + public ChartDesignDataLoadPane(AbstractChartDataPane4Chart parentPane){ + this.parentPane = parentPane; + } + + /** + * 加载数据集 + * + * @param tableData 数据集 + */ + public abstract void populateChartTableData(TableData tableData); + + /** + * 根据界面 获取数据集相关. + * + * @return 返回数据集 + */ + public abstract TableData getTableData(); + + + protected abstract String getNamePrefix(); + + //响应属性事件 + protected void fireChange() { + parentPane.fireTableDataChange(); + } + + + public TableDataWrapper getTableDataWrapper(){ + return new TemplateTableDataWrapper(getTableData()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/DataContentsPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/DataContentsPane.java new file mode 100644 index 000000000..ab711137b --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/DataContentsPane.java @@ -0,0 +1,39 @@ +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.design.mainframe.chart.PaneTitleConstants; + +/** + * 图表数据内容界面, 属性表 样式数据. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-1-18 下午03:42:20 + */ +public abstract class DataContentsPane extends AbstractChartAttrPane { + + + /** + * 界面标题 + */ + public String getIconPath() { + return "com/fr/design/images/chart/ChartData.png"; + } + + /** + * 界面标题 + */ + public String title4PopupWindow() { + return PaneTitleConstants.CHART_DATA_TITLE; + } + + /** + * 设置是否关联单元格数据. + */ + public abstract void setSupportCellData(boolean surpportCellData); + + /** + * 清除掉响应事件. + */ +// public void removeAttributeListener() { +// super.removeAttributeChangeListener(); +// } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java new file mode 100644 index 000000000..0a22b9664 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java @@ -0,0 +1,102 @@ +package com.fr.design.mainframe.chart.gui.data; + +import java.awt.BorderLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import javax.swing.JPanel; +import javax.swing.border.LineBorder; + +import com.fr.base.BaseUtils; +import com.fr.base.FRContext; +import com.fr.base.TableData; +import com.fr.design.constants.UIConstants; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.datapane.TableDataComboBox; +import com.fr.data.impl.NameTableData; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.dialog.BasicPane; + +public class DatabaseTableDataPane extends BasicPane{ + private static final long serialVersionUID = 5316016202202932242L; + private TableDataComboBox tableNameCombox; + private UIButton reviewButton; + + public DatabaseTableDataPane(UILabel label) { + initTableCombox(); + initReviewButton(); + this.setLayout(new BorderLayout(0,0)); + if(label != null) { + this.add(label, BorderLayout.WEST); + } + + JPanel pane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE,0)); + pane.add(tableNameCombox,BorderLayout.CENTER); + + pane.add(reviewButton,BorderLayout.EAST); + this.add(pane,BorderLayout.CENTER); + } + + /** + * 返回选中的数据源. + */ + public TableDataWrapper getTableDataWrapper() { + return tableNameCombox.getSelectedItem(); + } + + public void populateBean(TableData nameTableData) { + if(nameTableData == null) { + tableNameCombox.setSelectedItem(nameTableData); + } else { + tableNameCombox.setSelectedTableDataByName(((NameTableData)nameTableData).getName()); + } + } + + @Override + protected String title4PopupWindow() { + return null; + } + + /** + * 数据集列表选中后的事件 + */ + protected void userEvent() { + + } + + private void initTableCombox() { + tableNameCombox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); + tableNameCombox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if(e.getStateChange() == ItemEvent.DESELECTED){ + userEvent(); + } + } + }); + } + + private void initReviewButton() { + reviewButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/search.png")); + reviewButton.setBorder(new LineBorder(UIConstants.LINE_COLOR)); + reviewButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent e) { + TableDataWrapper tableDataWrappe = tableNameCombox.getSelectedItem(); + if ( tableDataWrappe != null) { + try { + tableDataWrappe.previewData(); + } catch (Exception e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + } + super.mouseReleased(e); + } + }); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/EmbbeddDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/EmbbeddDataPane.java new file mode 100644 index 000000000..a9f418907 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/EmbbeddDataPane.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.base.BaseUtils; +import com.fr.base.FRContext; +import com.fr.base.TableData; +import com.fr.design.constants.UIConstants; +import com.fr.data.impl.EmbeddedTableData; +import com.fr.design.data.tabledata.tabledatapane.EmbeddedTableDataPane; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.mainframe.AbstractChartDataPane4Chart; + +import javax.swing.*; +import javax.swing.border.LineBorder; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * 图表设计器内置数据集面板 + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-16 + * Time: 上午12:09 + */ +public class EmbbeddDataPane extends ChartDesignDataLoadPane { + private UIButton edit; + private UIButton reviewButton; + private EmbeddedTableData tableData; + + public EmbbeddDataPane(AbstractChartDataPane4Chart parentPane) { + super(parentPane); + tableData = new EmbeddedTableData(); + initEditButton(); + initReviewButton(); + this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 3)); + this.add(edit); + this.add(reviewButton); + } + + private void initEditButton() { + edit = new UIButton(BaseUtils.readIcon("com/fr/design/images/control/edit.png")); + edit.setBorder(new LineBorder(UIConstants.LINE_COLOR)); + edit.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + EmbeddedTableDataPane tableDataPane = new EmbeddedTableDataPane(); + tableDataPane.populateBean(tableData); + dgEdit(tableDataPane, getNamePrefix()); + } + }); + } + + private void initReviewButton() { + reviewButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/search.png")); + reviewButton.setBorder(new LineBorder(UIConstants.LINE_COLOR)); + reviewButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent e) { + //预览图表设计器内置数据集 + TableDataWrapper tableDataWrappe = getTableDataWrapper(); + if (tableDataWrappe != null) { + try { + tableDataWrappe.previewData(); + } catch (Exception e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + } + } + }); + } + + @Override + protected String title4PopupWindow() { + return null; + } + + @Override + public TableData getTableData() { + return tableData; + } + + /** + * 加载数据集 + * + * @param tableData 数据集 + */ + public void populateChartTableData(TableData tableData) { + if (tableData instanceof EmbeddedTableData) { + this.tableData =(EmbeddedTableData) tableData; + } + } + + protected String getNamePrefix() { + return "Embedded"; + } + + /** + * 编辑面板 + * + * @param uPanel 面板 + * @param originalName 原始名字 + */ + private void dgEdit(final EmbeddedTableDataPane uPanel, String originalName) { + final BasicPane.NamePane nPanel = uPanel.asNamePane(); + nPanel.setObjectName(originalName); + final BasicDialog dg; + dg = nPanel.showLargeWindow(SwingUtilities.getWindowAncestor(EmbbeddDataPane.this), new DialogActionAdapter() { + public void doOk() { + tableData = uPanel.updateBean(); + fireChange(); + } + }); + dg.setVisible(true); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ExcelDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ExcelDataPane.java new file mode 100644 index 000000000..7cc476e24 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ExcelDataPane.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.base.BaseUtils; +import com.fr.base.FRContext; +import com.fr.base.TableData; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.constants.UIConstants; +import com.fr.design.data.datapane.preview.PreviewTablePane; +import com.fr.data.impl.ExcelTableData; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.AbstractChartDataPane4Chart; +import com.fr.design.mainframe.DesignerContext; +import com.fr.file.FILE; +import com.fr.file.FILEChooserPane; +import com.fr.general.Inter; + +import javax.swing.*; +import javax.swing.border.LineBorder; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 下午11:58 + */ +public class ExcelDataPane extends ChartDesignDataLoadPane { + + private UITextField path = new UITextField(); + private UIButton reviewButton; + private ExcelTableData tableData; + private MouseListener listener = new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + FILEChooserPane fileChooserPane = new FILEChooserPane(true, true); + if (fileChooserPane.showOpenDialog(DesignerContext.getDesignerFrame(), ".xlsx") + == FILEChooserPane.OK_OPTION) { + FILE chooseFILE = fileChooserPane.getSelectedFILE(); + if (chooseFILE != null && chooseFILE.exists()) { + path.setText(chooseFILE.getPath()); + } else { + JOptionPane.showConfirmDialog(ExcelDataPane.this, Inter.getLocText("FR-Template-Path_chooseRightPath"), + Inter.getLocText("FR-App-All_Warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + path.setText(""); + } + tableData.setFilePath(path.getText().toString()); + tableData.setFromEnv(chooseFILE.isEnvFile()); + tableData.setNeedColumnName(true); + fireChange(); + } + } + }; + + public ExcelDataPane(AbstractChartDataPane4Chart parentPane, JComponent pathChooseButton) { + super(parentPane); + initReviewButton(); + tableData = new ExcelTableData(); + tableData.setFilePath(path.getText().toString()); + tableData.setNeedColumnName(true); + path.setEditable(false); + pathChooseButton.addMouseListener(listener); + this.setLayout(new BorderLayout(0, 0)); + JPanel pane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0)); + pane.add(path, BorderLayout.CENTER); + + pane.add(reviewButton, BorderLayout.EAST); + this.add(pane, BorderLayout.CENTER); + } + + @Override + protected String title4PopupWindow() { + return null; + } + + private void initReviewButton() { + reviewButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/search.png")); + reviewButton.setBorder(new LineBorder(UIConstants.LINE_COLOR)); + reviewButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + //预览本地excel + try { + PreviewTablePane.previewTableData(getTableData()); + } catch (Exception e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + } + }); + } + + @Override + public TableData getTableData() { + return tableData; + } + + @Override + protected String getNamePrefix() { + return null; + } + + /** + * 加载数据集 + * + * @param tableData 数据集 + */ + public void populateChartTableData(TableData tableData) { + if (tableData instanceof ExcelTableData) { + path.setText(((ExcelTableData) tableData).getFilePath()); + this.tableData = (ExcelTableData)tableData; + this.tableData.setNeedColumnName(true); + } + fireChange(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ImportSetChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ImportSetChartDataPane.java new file mode 100644 index 000000000..9c531ab36 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ImportSetChartDataPane.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.base.TableData; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartdata.TableDataDefinition; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.AbstractChartDataPane4Chart; +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.CategoryPlotMoreCateTableDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.Factory4TableDataContentPane; + +import javax.swing.*; + +/** + * 数据导入数据设置面板 + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 下午2:35 + */ +public class ImportSetChartDataPane extends AbstractChartDataPane4Chart { + + private AbstractTableDataContentPane dataContentPane; + + public ImportSetChartDataPane(final AttributeChangeListener listener, ChartDataPane parent) { + super(listener,parent); + } + + + /** + * 更新界面 数据内容 + */ + public void populate(ChartCollection collection) { + dataContentPane = getContentPane(collection.getSelectedChart().getPlot()); + dataContentPane.setNeedSummaryCaculateMethod(false); + dataContentPane.redoLayoutPane(); + if (collection != null && collection.getSelectedChart() != null) { + Chart chart = collection.getSelectedChart(); + TopDefinitionProvider definition = chart.getFilterDefinition(); + if (definition instanceof TableDataDefinition) { + TableData tableData = ((TableDataDefinition) definition).getTableData(); + if(tableData != null){ + populateChoosePane(tableData); + fireTableDataChange(); + } + if (dataContentPane != null) { + dataContentPane.populateBean(collection); + } + } + } + this.remove(leftContentPane); + this.initContentPane(); + this.validate(); + dataSource.addItemListener(dsListener); + initAllListeners(); + initSelfListener(dataContentPane); + this.addAttributeChangeListener(attributeChangeListener); + } + + protected JPanel getDataContentPane(){ + return dataContentPane; + } + + + @Override + public void update(ChartCollection collection) { + if (collection != null && collection.getSelectedChart() != null) { + if (dataContentPane != null) { + dataContentPane.updateBean(collection); + } + TableDataDefinition topDefinition =(TableDataDefinition)collection.getSelectedChart().getFilterDefinition(); + if(topDefinition !=null){ + topDefinition.setTableData(choosePane.getTableData()); + } + } + } + + private AbstractTableDataContentPane getContentPane(Plot plot) { + if (plot == null || plot.isSupportMoreCate()) { + return new CategoryPlotMoreCateTableDataContentPane(parentPane){ + public boolean isNeedSummaryCaculateMethod(){ + return false; + } + }; + } else{ + return Factory4TableDataContentPane.createTableDataContenetPaneWithPlotType(plot, parentPane); + } + } + + /** + * 数据集数据改变 + */ + public void fireTableDataChange() { + if (dataContentPane != null) { + dataContentPane.onSelectTableData(choosePane.getTableDataWrapper()); + } + } + + /** + * 清空数据集的设置 + */ + public void clearTableDataSetting(){ + if(dataContentPane != null){ + dataContentPane.clearAllBoxList(); + } + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/JSONDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/JSONDataPane.java new file mode 100644 index 000000000..96e17d742 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/JSONDataPane.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.base.BaseUtils; +import com.fr.base.FRContext; +import com.fr.base.TableData; +import com.fr.chart.chartdata.JSONTableData; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.constants.UIConstants; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.AbstractChartDataPane4Chart; + +import javax.swing.*; +import javax.swing.border.LineBorder; +import java.awt.*; +import java.awt.event.*; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-15 + * Time: 下午6:45 + */ +public class JSONDataPane extends ChartDesignDataLoadPane { + private UITextField url = new UITextField(); + private UIButton reviewButton; + private JSONTableData tableData; + + public JSONDataPane(AbstractChartDataPane4Chart parentPane) { + super(parentPane); + initReviewButton(); + url.addKeyListener(new KeyAdapter() { + @Override + public void keyTyped(KeyEvent e) { + if(e.getKeyChar() == KeyEvent.VK_ENTER){ + tableData.setFilePath(url.getText()); + fireChange(); + } + } + }); + this.setLayout(new BorderLayout(0, 0)); + JPanel pane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0)); + pane.add(url, BorderLayout.CENTER); + pane.add(reviewButton, BorderLayout.EAST); + this.add(pane, BorderLayout.CENTER); + tableData = new JSONTableData(url.getText()); + } + + @Override + protected String title4PopupWindow() { + return null; + } + + private void initReviewButton() { + reviewButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/search.png")); + reviewButton.setBorder(new LineBorder(UIConstants.LINE_COLOR)); + reviewButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent e) { + tableData.setFilePath(url.getText()); + fireChange(); + //预览JSON数据 + TableDataWrapper tableDataWrappe = getTableDataWrapper(); + if (tableDataWrappe != null) { + try { + tableDataWrappe.previewData(); + } catch (Exception e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + } + } + }); + } + + @Override + public TableData getTableData() { + return tableData; + } + + @Override + protected String getNamePrefix() { + return null; + } + + /** + * 加载数据集 + * @param tableData 数据集 + */ + public void populateChartTableData(TableData tableData) { + if(tableData instanceof JSONTableData) { + url.setText(((JSONTableData) tableData).getFilePath()); + this.tableData = (JSONTableData)tableData; + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java new file mode 100644 index 000000000..55c645181 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -0,0 +1,131 @@ +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +/** + * 一般数据界面 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-1-18 下午03:45:25 + */ +public class NormalChartDataPane extends DataContentsPane { + + private UIComboBoxPane dataPane; + private TableDataPane tableDataPane; + private ReportDataPane reportDataPane; + private AttributeChangeListener listener; + + private ChartDataPane parent; + + public NormalChartDataPane(AttributeChangeListener listener, ChartDataPane parent) { + this.listener = listener; + this.parent = parent; + initAll(); + } + + public NormalChartDataPane(AttributeChangeListener listener, ChartDataPane parent, boolean supportCellData) { + this.listener = listener; + this.parent = parent; + initAll(); + + dataPane.justSupportOneSelect(true); + } + + @Override + protected JPanel createContentPane() { + return new BasicScrollPane() { + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + dataPane = new UIComboBoxPane() { + protected void initLayout() { + this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE,6)); + JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE,0)); + northPane.add(jcb, BorderLayout.CENTER); + UILabel label1 = new UILabel(Inter.getLocText("Chart-Data_Resource") + ":", SwingConstants.RIGHT); + label1.setPreferredSize(new Dimension(75,20)); + northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); + this.add(northPane, BorderLayout.NORTH); + this.add(cardPane, BorderLayout.CENTER); + + } + @Override + protected String title4PopupWindow() { + return null; + } + + @Override + protected List> initPaneList() { + tableDataPane = new TableDataPane(parent); + reportDataPane = new ReportDataPane(parent); + List> paneList = new ArrayList>(); + paneList.add(tableDataPane); + paneList.add(reportDataPane); + return paneList; + } + }; + contentPane.add(dataPane, BorderLayout.CENTER); + dataPane.setBorder(BorderFactory.createEmptyBorder(10 ,0, 0, 0)); + return contentPane; + } + + @Override + protected String title4PopupWindow() { + return ""; + } + + @Override + public void populateBean(ChartCollection ob) { + + } + }; + + } + + /** + * 更新界面 数据内容 + */ + public void populate(ChartCollection collection) { + reportDataPane.refreshContentPane(collection); + tableDataPane.refreshContentPane(collection); + + dataPane.populateBean(collection); + this.initAllListeners(); + this.addAttributeChangeListener(listener); + + reportDataPane.checkBoxUse(); + tableDataPane.checkBoxUse(); + } + + /** + * 保存 数据界面内容 + */ + public void update(ChartCollection collection) { + if(dataPane.getSelectedIndex() == 0) { + tableDataPane.updateBean(collection); + } else { + reportDataPane.updateBean(collection); + } + } + + /** + * 是否支持单元格数据 + */ + public void setSupportCellData(boolean supportCellData) { + dataPane.justSupportOneSelect(supportCellData); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/PresentComboBox.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/PresentComboBox.java new file mode 100644 index 000000000..bf66cdf34 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/PresentComboBox.java @@ -0,0 +1,113 @@ +package com.fr.design.mainframe.chart.gui.data; + +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; + +import com.fr.base.present.DictPresent; +import com.fr.base.present.FormulaPresent; +import com.fr.base.present.Present; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.present.FormulaPresentPane; +import com.fr.design.present.dict.DictionaryPane; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.general.Inter; + +/** + * 公式下拉框编辑器. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-27 上午01:59:49 + */ +public class PresentComboBox extends UIComboBox{ + private Present present; + + private String[] ITEMS = { + Inter.getLocText("DS-Dictionary"), + Inter.getLocText("Present-Formula_Present"), + Inter.getLocText("Present-No_Present") + }; + + public PresentComboBox() { + super(); + + this.addItem(ITEMS[0]); + this.addItem(ITEMS[1]); + this.addItem(ITEMS[2]); + + this.setSelectedItem(ITEMS[2]); + + this.addPopupMenuListener(new PopupMenuListener() { + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + if (PresentComboBox.this.getSelectedIndex() == 0) { + final DictionaryPane pp = new DictionaryPane(); + if (present instanceof DictPresent) { + pp.populateBean(((DictPresent) present).getDictionary()); + } + + BasicDialog bg = pp.showWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionAdapter(){ + public void doOk() { + PresentComboBox.this.populate(new DictPresent(pp.updateBean())); + fireChange(); + } + }); + + bg.setVisible(true); + } else if (PresentComboBox.this.getSelectedIndex() == 1) { + final FormulaPresentPane pp = new FormulaPresentPane(); + if (present instanceof FormulaPresent) { + pp.populateBean((FormulaPresent) present); + } + + BasicDialog bg = pp.showSmallWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionAdapter(){ + public void doOk() { + PresentComboBox.this.populate(pp.updateBean()); + fireChange(); + } + }); + + bg.setVisible(true); + } else { + present = null; + fireChange(); + } + } + + public void popupMenuCanceled(PopupMenuEvent e) { + } + }); + } + + /** + * 重载用于加载 完成编辑后 ok的响应事件 + */ + protected void fireChange() { + + } + + /** + * 更新公式选择. + */ + public void populate(Present present) { + if (present instanceof DictPresent) { + this.setSelectedIndex(0); + } else if (present instanceof FormulaPresent) { + this.setSelectedIndex(1); + } else if (present == null) { + this.setSelectedIndex(2); + } + + this.present = present; + } + + /** + * 返回编辑的结果. + */ + public Present update() { + return present; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java new file mode 100644 index 000000000..cedc08a48 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java @@ -0,0 +1,101 @@ +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartdata.ReportDataDefinition; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.general.Inter; + +import java.awt.*; + +public class ReportDataPane extends FurtherBasicBeanPane{ + + private AbstractReportDataContentPane contentPane; + private ChartDataPane parent; + + public ReportDataPane(ChartDataPane parent) { + this.parent = parent; + } + + private AbstractReportDataContentPane getContentPane(Chart chart) { + if(chart == null) { + return null; + } + + Plot plot = chart.getPlot(); + + return ChartTypeInterfaceManager.getInstance().getReportDataSourcePane(plot, parent); + } + + /** + * 单元格数据 + * @return 界面的标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("FR-Chart_Cell_Data"); + } + + /** + * 界面是否接受这个对象 + * @param ob 需要判断的对象 + * @return 界面是否接受对象 + */ + public boolean accept(Object ob) { + return ob instanceof ChartCollection && ((ChartCollection)ob).getSelectedChart().getFilterDefinition() instanceof ReportDataDefinition; + } + + /** + * 界面重置 + */ + public void reset() { + + } + + /** + * 刷新contentPane + * @param collection 图表属性的集合 + */ + public void refreshContentPane(ChartCollection collection) { + this.removeAll(); + + this.setLayout(new BorderLayout()); + contentPane = getContentPane(collection.getSelectedChart()); + if(contentPane != null) { + this.add(contentPane, BorderLayout.CENTER); + } + } + + /** + * 检查界面是否可用. + */ + public void checkBoxUse() { + if(contentPane != null) { + contentPane.checkBoxUse(); + } + } + + @Override + public void populateBean(ChartCollection collection) { + if(collection == null) { + return; + } + if(contentPane != null) { + contentPane.populateBean(collection); + } + } + + public void updateBean(ChartCollection collection) { + if(contentPane != null) { + contentPane.updateBean(collection); + } + } + + @Override + public ChartCollection updateBean() { + return null; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java new file mode 100644 index 000000000..2bed0cb2d --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java @@ -0,0 +1,160 @@ +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.base.TableData; +import com.fr.chart.chartattr.*; +import com.fr.chart.chartdata.TableDataDefinition; +import com.fr.chart.chartdata.TopDefinition; +import com.fr.data.impl.NameTableData; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.table.*; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +public class TableDataPane extends FurtherBasicBeanPane{ + private static final long serialVersionUID = 4740461028440155147L; + private static final int TOP = -5; + private DatabaseTableDataPane tableDataPane; + private AbstractTableDataContentPane dataContentPane; + + private ChartDataPane parent; + + public TableDataPane(ChartDataPane parent) { + this.parent = parent; + initDataPane(); + } + + private void initDataPane() { + UILabel label = new BoldFontTextLabel(Inter.getLocText("Chart-DS_TableData") + ":", SwingConstants.RIGHT) ; + label.setPreferredSize(new Dimension(75,20)); + tableDataPane = new DatabaseTableDataPane(label) { + @Override + protected void userEvent() { + onSelectTableData(); + checkBoxUse(); + } + }; + + tableDataPane.setBorder(BorderFactory.createMatteBorder(0,6,0, 0, getBackground())); + tableDataPane.setBorder(BorderFactory.createEmptyBorder(0,1,0,1)); + tableDataPane.setPreferredSize(new Dimension(205 , 20)); + this.setBorder(BorderFactory.createEmptyBorder(TOP,0,0,0)); + this.add(tableDataPane, BorderLayout.NORTH); + } + + /** + * 检查box是否可用. + */ + public void checkBoxUse() { + TableDataWrapper dataWrap = tableDataPane.getTableDataWrapper(); + + if(dataContentPane != null) { + dataContentPane.checkBoxUse(dataWrap != null); + } + } + + private void onSelectTableData() { + TableDataWrapper dataWrap = tableDataPane.getTableDataWrapper(); + if(dataWrap == null) { + return; + } + if(dataContentPane != null) { + dataContentPane.onSelectTableData(dataWrap); + } + } + + private AbstractTableDataContentPane getContentPane(Plot plot) { + return ChartTypeInterfaceManager.getInstance().getTableDataSourcePane(plot, parent); + } + + /** + * 界面标题 + * @return 返回标题. + */ + public String title4PopupWindow() { + return Inter.getLocText(new String[]{"TableData", "Data"}); + } + + + /** + * 判断界面是否接受 + * @param ob 需要判断的对象 + * @return 返回是否接受. + */ + public boolean accept(Object ob) { + return ob instanceof ChartCollection && (((ChartCollection)ob).getSelectedChart().getFilterDefinition() instanceof TableDataDefinition); + } + + /** + * 重置界面 + */ + public void reset() { + + } + + /** + * 根据图表类型 刷新界面 + * @param collection 图表属性的集合 + */ + public void refreshContentPane(ChartCollection collection) { + if(dataContentPane != null) { + remove(dataContentPane); + } + dataContentPane = getContentPane(collection.getSelectedChart().getPlot()); + if(dataContentPane != null) { + add(dataContentPane, BorderLayout.CENTER); + } + } + + /** + * 更新界面属性 + */ + public void populateBean(ChartCollection collection) { + if(collection == null) { + return; + } + TableDataDefinition data = (TableDataDefinition)collection.getSelectedChart().getFilterDefinition(); + TableData tableData = null; + if(data != null) { + tableData = data.getTableData(); + } + onSelectTableData(); + checkBoxUse(); + + tableDataPane.populateBean(tableData); + if(dataContentPane != null) { + dataContentPane.populateBean(collection); + } + } + + /** + * 保存界面属性到ChartCollection + */ + public void updateBean(ChartCollection collection) { + if(dataContentPane != null) { + dataContentPane.updateBean(collection); + } + TopDefinition dataDefinition = (TopDefinition)collection.getSelectedChart().getFilterDefinition(); + if(dataDefinition instanceof TableDataDefinition) { + TableDataWrapper tableDataWrapper = tableDataPane.getTableDataWrapper(); + if (dataDefinition != null && tableDataWrapper != null){ + NameTableData nameTableData = new NameTableData(tableDataWrapper.getTableDataName()); + ((TableDataDefinition)dataDefinition).setTableData(nameTableData); + } + } + } + + /** + * 保存界面属性 新建ChartCollection + */ + public ChartCollection updateBean() { + return null; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java new file mode 100644 index 000000000..6754ca796 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java @@ -0,0 +1,172 @@ +package com.fr.design.mainframe.chart.gui.data.report; + +import com.fr.base.Formula; +import com.fr.base.Utils; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.constants.UIConstants; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.event.UIObserverListener; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.itable.UITable; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.layout.TableLayout; +import com.fr.stable.StableUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import java.awt.*; +import java.util.HashMap; +import java.util.List; + +/** + * 抽象的 属性表 单元格数据界面. +* @author kunsnat E-mail:kunsnat@gmail.com +* @version 创建时间:2012-12-27 上午10:31:53 + */ +public abstract class AbstractReportDataContentPane extends BasicBeanPane{ + private static final double ROW = 6; + + protected UICorrelationPane seriesPane; + + protected abstract String[] columnNames(); + + protected void initEveryPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p, TableLayout.LEADING, f }; + double[] rowSize = {p, ROW, p, ROW, p, ROW, p}; + + this.setLayout(new TableLayout(columnSize, rowSize)); + + initSeriesPane(); + + this.add(seriesPane, "0,2,2,2"); + } + + //kunsnat: 用于重载, 甘特图, 股价图 第一列 默认应该不可编辑. + protected void initSeriesPane() { + seriesPane = new UICorrelationPane(columnNames()) { + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + + protected UITable initUITable() { + return new UITable(columnCount) { + + public UITableEditor createTableEditor() { + return createUITableEditor(); + } + + public void tableCellEditingStopped(ChangeEvent e) { + stopPaneEditing(e); + } + }; + } + }; + } + + /** + * 检查界面Box 联动 是否可用. + */ + public void checkBoxUse() { + + } + + /** + * 覆盖方法 doNothing + */ + @Override + public ChartCollection updateBean() { + return null; + } + + /** + * 用于直接更新 下拉列表之类的界面 + */ + protected void populateList(List list) { + seriesPane.populateBean(list); + } + + /** + * 用于更新得到最新的界面列表值 + */ + protected List updateList() { + return seriesPane.updateBean(); + } + + /** + * 界面标题: + */ + protected String title4PopupWindow() { + return ""; + } + + protected HashMap createNameValue(List list) { + HashMap values = new HashMap(); + + for(int i = 0; i < list.size(); i++) { + Object[] tmp = list.get(i); + values.put(tmp[0], tmp[1]); + } + + return values; + } + + protected Object canBeFormula(Object object) { + if(object == null) { + return null; + } + + return StableUtils.canBeFormula(object) ? new Formula(object.toString()) : object.toString(); + } + + protected class InnerTableEditor extends UITableEditor { + private TinyFormulaPane editorComponent; + + /** + * 返回当前编辑器的值 + */ + public Object getCellEditorValue() { + return editorComponent.getUITextField().getText(); + } + + /** + * 返回当前编辑器.. + */ + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if(column == table.getModel().getColumnCount()) { + return null; + } + + seriesPane.stopCellEditing(); + + TinyFormulaPane editor = getEditorComponent(); + editor.getUITextField().setText(Utils.objectToString(value)); + return editor; + } + + private TinyFormulaPane getEditorComponent() { + editorComponent = null; + if (editorComponent == null) { + editorComponent = new TinyFormulaPane() { + @Override + public void okEvent() { + seriesPane.stopCellEditing(); + seriesPane.fireTargetChanged(); + } + }; + editorComponent.setBackground(UIConstants.FLESH_BLUE); + + editorComponent.getUITextField().registerChangeListener(new UIObserverListener() { + @Override + public void doChange() { + seriesPane.fireTargetChanged(); + } + }); + } + return editorComponent; + } + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/BubblePlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/BubblePlotReportDataContentPane.java new file mode 100644 index 000000000..01ea8eec1 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/BubblePlotReportDataContentPane.java @@ -0,0 +1,98 @@ +package com.fr.design.mainframe.chart.gui.data.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.BubblePlot; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.BubbleReportDefinition; +import com.fr.chart.chartdata.BubbleSeriesValue; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; +import com.fr.general.Inter; + +import java.util.ArrayList; +import java.util.List; + +/** + * 气泡图 属性表 单元格数据源界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-19 下午03:47:56 + */ +public class BubblePlotReportDataContentPane extends AbstractReportDataContentPane { + private static final int BUBBLE = 4; + private ChartDataFilterPane filterPane; + + public BubblePlotReportDataContentPane(ChartDataPane parent) { + initEveryPane(); + + this.add(new BoldFontTextLabel(Inter.getLocText("Data_Filter")), "0,4,2,4"); + this.add(filterPane = new ChartDataFilterPane(new BubblePlot(), parent), "0,6,2,4"); + } + + @Override + protected String[] columnNames() { + return new String[]{ + Inter.getLocText("Bubble-Series_Name"), + Inter.getLocText("ChartF-X_Axis"), + Inter.getLocText("ChartF-Y_Axis"), + Inter.getLocText("FRFont-Size") + }; + } + + public void checkBoxUse() { + } + + /** + * 更新气泡图 单元格界面内容 + */ + public void populateBean(ChartCollection collection) { + if(collection != null) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if(definition instanceof BubbleReportDefinition) { + seriesPane.populateBean(populateSeriesEntryList((BubbleReportDefinition)definition)); + } + } + filterPane.populateBean(collection); + } + + private List populateSeriesEntryList(BubbleReportDefinition seriesList) { + List array = new ArrayList(); + for(int i = 0; i < seriesList.size(); i++) { + BubbleSeriesValue seriesEntry = (BubbleSeriesValue)seriesList.get(i); + Object[] nameAndValue = new Object[BUBBLE]; + nameAndValue[0] = seriesEntry.getBubbleSereisName(); + nameAndValue[1] = seriesEntry.getBubbleSeriesX(); + nameAndValue[2] = seriesEntry.getBubbleSeriesY(); + nameAndValue[3] = seriesEntry.getBubbleSeriesSize(); + array.add(nameAndValue); + } + return array; + } + + /** + * 保存气泡图 单元格界面内容到collection + */ + public void updateBean(ChartCollection collection) { + if(collection != null) { + BubbleReportDefinition bubbleReport = new BubbleReportDefinition(); + collection.getSelectedChart().setFilterDefinition(bubbleReport); + + updateSeriesEntryList(bubbleReport, seriesPane.updateBean()); + filterPane.updateBean(collection); + } + } + + private void updateSeriesEntryList(BubbleReportDefinition list, List valueList) { + for (int i = 0; i < valueList.size(); i++) { + Object[] rowValueList = valueList.get(i); + + BubbleSeriesValue seriesEntry = new BubbleSeriesValue(); + + seriesEntry.setBubbleSeriesName(canBeFormula(rowValueList[0])); + seriesEntry.setBubbleSeriesX(canBeFormula(rowValueList[1])); + seriesEntry.setBubbleSeriesY(canBeFormula(rowValueList[2])); + seriesEntry.setBubbleSeriesSize(canBeFormula(rowValueList[3])); + list.add(seriesEntry); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java new file mode 100644 index 000000000..07d699dae --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java @@ -0,0 +1,182 @@ +package com.fr.design.mainframe.chart.gui.data.report; + +import com.fr.base.BaseUtils; +import com.fr.base.Utils; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Bar2DPlot; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.NormalReportDataDefinition; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; + + +/** + * 多分类 单元格数据集 界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-9-4 下午02:23:46 + */ +public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotReportDataContentPane implements UIObserver{ + private static final long serialVersionUID = -1122313353777460534L; + + private JPanel boxPane; + private UIButton addButton; + + private ArrayList formualList = new ArrayList(); + private UIObserverListener uiobListener = null; + + public CategoryPlotMoreCateReportDataContentPane() { + + } + + public CategoryPlotMoreCateReportDataContentPane(ChartDataPane parent) { + initEveryPane(); + categoryName = initCategoryBox(Inter.getLocText("FR-Chart-Category_Name") + ":"); + + JPanel catePane = new JPanel(); + catePane.setLayout(new BorderLayout(2, 2)); + + catePane.add(categoryName); + + addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); + addButton.setPreferredSize(new Dimension(20, 20)); + catePane.add(addButton, BorderLayout.EAST); + + boxPane = new JPanel(); + boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); + + boxPane.setBackground(Color.red); + + catePane.add(boxPane, BorderLayout.SOUTH); + + this.add(catePane, "0,0,2,0"); + this.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Data_Filter")), "0,4,2,4"); + this.add(filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent), "0,6,2,4"); + + addButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + addNewCatePane(); + } + }); + + } + + /** + * 检查box 是否应该可用状态. + */ + public void checkBoxUse() { + super.checkBoxUse(); + String text = categoryName.getUITextField().getText(); + addButton.setEnabled(StringUtils.isNotEmpty(text)); + } + + private TinyFormulaPane addNewCatePane() { + final TinyFormulaPane pane = initCategoryBox(StringUtils.EMPTY); + pane.setPreferredSize(new Dimension(122, 16)); + + pane.registerChangeListener(uiobListener); + + formualList.add(pane); + + final JPanel newButtonPane = new JPanel(); + newButtonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + newButtonPane.add(pane); + + UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); + newButtonPane.add(delButton); + + boxPane.add(newButtonPane); + + delButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + boxPane.remove(newButtonPane); + formualList.remove(pane); + checkAddButton(); + relayoutPane(); + } + }); + delButton.registerChangeListener(uiobListener); + + checkAddButton(); + relayoutPane(); + + return pane; + } + + private void checkAddButton() { + int size = formualList.size(); + addButton.setEnabled(size < 2); + } + + private void relayoutPane() { + this.revalidate(); + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(UIObserverListener listener) { + uiobListener = listener; + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + public void populateBean(ChartCollection collection) { + super.populateBean(collection); + + formualList.clear(); + + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if (definition instanceof NormalReportDataDefinition) { + NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; + int size = reportDefinition.getMoreCateSize(); + if (reportDefinition.getCategoryName() != null && size > 0) { + for(int i = 0; i < size; i++) { + TinyFormulaPane pane = addNewCatePane(); + pane.populateBean(Utils.objectToString(reportDefinition.getMoreCateWithIndex(i))); + } + } + } + + checkAddButton(); + } + + public void updateBean(ChartCollection collection) { + super.updateBean(collection); + + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if (definition instanceof NormalReportDataDefinition) { + NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; + + reportDefinition.clearMoreCate(); + + for(int i = 0, size = formualList.size(); i < size; i++) { + TinyFormulaPane pane = formualList.get(i); + reportDefinition.addMoreCate(canBeFormula(pane.updateBean())); + } + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java new file mode 100644 index 000000000..8be253677 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java @@ -0,0 +1,145 @@ +package com.fr.design.mainframe.chart.gui.data.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Bar2DPlot; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.NormalReportDataDefinition; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class CategoryPlotReportDataContentPane extends AbstractReportDataContentPane { + protected static final int PRE_WIDTH = 210; + + protected TinyFormulaPane categoryName; + protected ChartDataFilterPane filterPane; + + public CategoryPlotReportDataContentPane(){ + + } + + public CategoryPlotReportDataContentPane(ChartDataPane parent) { + initEveryPane(); + categoryName = initCategoryBox(Inter.getLocText("FR-Chart-Category_Name") + ":"); + + this.add(categoryName, "0,0,2,0"); + this.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Data_Filter")), "0,4,2,4"); + this.add(filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent), "0,6,2,4"); + } + + protected TinyFormulaPane initCategoryBox(final String leftLabel) { + TinyFormulaPane categoryName = new TinyFormulaPane() { + @Override + protected void initLayout() { + this.setLayout(new BorderLayout(4, 0)); + + if(StringUtils.isNotEmpty(leftLabel)) { + UILabel label1 = new UILabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT); + label1.setPreferredSize(new Dimension(75, 20)); + this.add(label1, BorderLayout.WEST); + } + + formulaTextField.setPreferredSize(new Dimension(100, 20)); + this.add(formulaTextField, BorderLayout.CENTER); + this.add(formulaTextFieldButton, BorderLayout.EAST); + } + + public void okEvent() { + checkBoxUse(); + } + }; + + categoryName.getUITextField().getDocument().addDocumentListener(new DocumentListener() { + public void removeUpdate(DocumentEvent e) { + checkBoxUse(); + } + + public void insertUpdate(DocumentEvent e) { + checkBoxUse(); + } + + public void changedUpdate(DocumentEvent e) { + checkBoxUse(); + } + }); + + return categoryName; + } + + @Override + protected String[] columnNames() { + return new String[]{ + Inter.getLocText("FR-Chart-Series_Name"), + Inter.getLocText("Chart-Series_Value") + }; + } + + public void populateBean(ChartCollection collection) { + checkBoxUse(); + + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if (definition instanceof NormalReportDataDefinition) { + NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; + if (reportDefinition.getCategoryName() != null) { + categoryName.getUITextField().setText(reportDefinition.getCategoryName().toString()); + + List list = getEntryList(reportDefinition); + if (!list.isEmpty()) { + populateList(list); + } + } + + seriesPane.doLayout(); + } + + filterPane.populateBean(collection); + } + + private List getEntryList(NormalReportDataDefinition seriesList) { + List list = new ArrayList(); + for (int i = 0; i < seriesList.size(); i++) { + SeriesDefinition seriesEntry = (SeriesDefinition) seriesList.get(i); + Object[] nameAndValue = new Object[2]; + nameAndValue[0] = seriesEntry.getSeriesName(); + nameAndValue[1] = seriesEntry.getValue(); + if (nameAndValue[0] != null && nameAndValue[1] != null) { + list.add(nameAndValue); + } + } + return list; + } + + public void updateBean(ChartCollection collection) { + collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition()); + + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if (definition instanceof NormalReportDataDefinition) { + NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; + + reportDefinition.setCategoryName(canBeFormula(categoryName.getUITextField().getText())); + + List list = updateList(); + for (int i = 0; i < list.size(); i++) { + Object[] value = (Object[]) list.get(i); + SeriesDefinition sd = new SeriesDefinition(); + + sd.setSeriesName(canBeFormula(value[0])); + sd.setValue(canBeFormula(value[1])); + reportDefinition.add(sd); + } + } + filterPane.updateBean(collection); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/GanttPlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/GanttPlotReportDataContentPane.java new file mode 100644 index 000000000..206bfcb3c --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/GanttPlotReportDataContentPane.java @@ -0,0 +1,112 @@ +package com.fr.design.mainframe.chart.gui.data.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.GanttReportDefinition; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.itable.UITable; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.general.Inter; + +import javax.swing.event.ChangeEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * 甘特图 属性表 单元格数据界面 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-21 下午03:01:48 + */ +public class GanttPlotReportDataContentPane extends AbstractReportDataContentPane { + + private static final String STEP = Inter.getLocText("ChartF-Step"); + private static final String START = Inter.getLocText("ChartF-PlansToBegin"); + private static final String END = Inter.getLocText("ChartF-EndOfTheProject"); + + private static final String RESTART = Inter.getLocText("ChartF-TheActualStart"); + private static final String REEND = Inter.getLocText("ChartF-TheActualEnd"); + private static final String PERCENT = Inter.getLocText("StyleFormat-Percent"); + private static final String PRO = Inter.getLocText("Chart_Project"); + + public GanttPlotReportDataContentPane(ChartDataPane parent) { + initEveryPane(); + + List list = new ArrayList(); + list.add(new Object[]{STEP, ""}); + list.add(new Object[]{START, ""}); + list.add(new Object[]{END, ""}); + list.add(new Object[]{RESTART, ""}); + list.add(new Object[]{REEND, ""}); + list.add(new Object[]{PERCENT, ""}); + list.add(new Object[]{PRO, ""}); + seriesPane.populateBean(list); + seriesPane.noAddUse(); + } + + protected void initSeriesPane() { + seriesPane = new UICorrelationPane(columnNames()) { + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + + protected UITable initUITable() { + return new UITable(columnCount) { + + public UITableEditor createTableEditor() { + return createUITableEditor(); + } + + public void tableCellEditingStopped(ChangeEvent e) { + stopPaneEditing(e); + } + + public boolean isCellEditable(int row, int column) { + return column != 0; + } + }; + } + }; + } + + public void populateBean(ChartCollection collection) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if(definition instanceof GanttReportDefinition) { + GanttReportDefinition ganttDefinition = (GanttReportDefinition)definition; + + List list = new ArrayList(); + list.add(new Object[]{STEP, ganttDefinition.getStep()}); + list.add(new Object[]{START, ganttDefinition.getPlanStart()}); + list.add(new Object[]{END, ganttDefinition.getPlanEnd()}); + list.add(new Object[]{RESTART, ganttDefinition.getRealStart()}); + list.add(new Object[]{REEND, ganttDefinition.getRealEnd()}); + list.add(new Object[]{PERCENT, ganttDefinition.getProgress()}); + list.add(new Object[]{PRO, ganttDefinition.getItem()}); + seriesPane.populateBean(list); + } + } + + public void updateBean(ChartCollection collection) { + GanttReportDefinition ganttDefinition = new GanttReportDefinition(); + + List list = seriesPane.updateBean(); + HashMap map = createNameValue(list); + + ganttDefinition.setStep(canBeFormula(map.get(STEP))); + ganttDefinition.setPlanStart(canBeFormula(map.get(START))); + ganttDefinition.setPlanEnd(canBeFormula(map.get(END))); + ganttDefinition.setRealStart(canBeFormula(map.get(RESTART))); + ganttDefinition.setRealEnd(canBeFormula(map.get(REEND))); + ganttDefinition.setProgress(canBeFormula(map.get(PERCENT))); + ganttDefinition.setItem(canBeFormula(map.get(PRO))); + + collection.getSelectedChart().setFilterDefinition(ganttDefinition); + } + + @Override + protected String[] columnNames() { + return new String[]{"", ""}; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java new file mode 100644 index 000000000..e4001079b --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java @@ -0,0 +1,105 @@ +package com.fr.design.mainframe.chart.gui.data.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.MeterPlot; +import com.fr.chart.chartdata.MeterReportDefinition; +import com.fr.design.formula.TinyFormulaPane; +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.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * 仪表盘 属性表 单元格数据界面 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-21 下午02:47:57 + */ +public class MeterPlotReportDataContentPane extends AbstractReportDataContentPane { + + private static final String CATENAME = Inter.getLocText(new String[]{"ChartF-Meter", "StyleFormat-Category", "WF-Name"}); + private static final String NVALUE = Inter.getLocText("Needle Value"); + + private TinyFormulaPane singCatePane; + private TinyFormulaPane singValuePane; + private ChartDataFilterPane filterPane; + + public MeterPlotReportDataContentPane(ChartDataPane parent) { +// initEveryPane(); +// +// List list = new ArrayList(); +// list.add(new Object[] { singCateName, "" }); +// list.add(new Object[] { singNeedleValue, "" }); +// seriesPane.populateBean(list); +// +// seriesPane.noAddUse(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p, f }; + double[] rowSize = { p, p, p}; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(CATENAME), singCatePane = new TinyFormulaPane()}, + new Component[]{new UILabel(NVALUE), singValuePane = new TinyFormulaPane()}, + new Component[]{null, null} + }; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + + this.setLayout(new BorderLayout()); + this.add(panel, BorderLayout.NORTH); + + double[] cs = {p}; + components = new Component[][]{ + new Component[]{new JSeparator()}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Data_Filter"))}, + new Component[]{filterPane = new ChartDataFilterPane(new MeterPlot(), parent)}, + }; + JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, cs); + + this.add(pane, BorderLayout.CENTER); + } + + public void populateBean(ChartCollection collection) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if(definition instanceof MeterReportDefinition) { + MeterReportDefinition meterDefinition = (MeterReportDefinition)definition; + + if (meterDefinition.getName() != null) { + singCatePane.getUITextField().setText(meterDefinition.getName().toString()); + } + if (meterDefinition.getValue() != null) { + singValuePane.getUITextField().setText(meterDefinition.getValue().toString()); + } + } + + filterPane.populateBean(collection); + } + + public void updateBean(ChartCollection collection) { + + if (collection != null) { + MeterReportDefinition meterDefinition = new MeterReportDefinition(); + + meterDefinition.setName(canBeFormula(singCatePane.getUITextField().getText())); + meterDefinition.setValue(canBeFormula(singValuePane.getUITextField().getText())); + + collection.getSelectedChart().setFilterDefinition(meterDefinition); + + filterPane.updateBean(collection); + } + } + + @Override + protected String[] columnNames() { + return new String[]{"", ""}; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/PiePlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/PiePlotReportDataContentPane.java new file mode 100644 index 000000000..1bededb91 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/PiePlotReportDataContentPane.java @@ -0,0 +1,89 @@ +package com.fr.design.mainframe.chart.gui.data.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.PiePlot; +import com.fr.chart.chartdata.NormalReportDataDefinition; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; +import com.fr.general.Inter; + +import java.util.ArrayList; +import java.util.List; + +/** + * 饼图 单元格数据 属性表 界面 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-19 上午10:42:27 + */ +public class PiePlotReportDataContentPane extends AbstractReportDataContentPane { + + private ChartDataFilterPane filterPane; + + public PiePlotReportDataContentPane(ChartDataPane parent) { + initEveryPane(); + + this.add(new BoldFontTextLabel(Inter.getLocText("Data_Filter")), "0,4,2,4"); + this.add(filterPane = new ChartDataFilterPane(new PiePlot(), parent), "0,6,2,4"); + } + + @Override + protected String[] columnNames() { + return new String[]{ + Inter.getLocText(new String[]{"Chart_Legend(Series)", "WF-Name"}), + Inter.getLocText(new String[]{"Chart_Legend(Series)", "Values"}) + }; + } + + + public void populateBean(ChartCollection collection) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if(definition instanceof NormalReportDataDefinition) { + NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition)definition; + List list = getEntryList(reportDefinition); + if(!list.isEmpty()) { + populateList(list); + } + } + + filterPane.populateBean(collection); + } + + private List getEntryList(NormalReportDataDefinition seriesList) { + List list = new ArrayList(); + for(int i = 0; i < seriesList.size(); i++) { + SeriesDefinition seriesEntry = (SeriesDefinition)seriesList.get(i); + Object[] nameAndValue = new Object[2]; + nameAndValue[0] = seriesEntry.getSeriesName(); + nameAndValue[1] = seriesEntry.getValue(); + if(nameAndValue[0] != null && nameAndValue[1] != null) { + list.add(nameAndValue); + } + } + return list; + } + + public void updateBean(ChartCollection collection) { + collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition()); + + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if(definition instanceof NormalReportDataDefinition) { + NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition)definition; + reportDefinition.setCategoryName(""); + + List list = updateList(); + for(int i = 0; i < list.size(); i++) { + Object[] value = (Object[])list.get(i); + SeriesDefinition sd = new SeriesDefinition(); + + sd.setSeriesName(canBeFormula(value[0])); + sd.setValue(canBeFormula(value[1])); + reportDefinition.add(sd); + } + } + + filterPane.updateBean(collection); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/StockPlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/StockPlotReportDataContentPane.java new file mode 100644 index 000000000..526049521 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/StockPlotReportDataContentPane.java @@ -0,0 +1,283 @@ +package com.fr.design.mainframe.chart.gui.data.report; + +import com.fr.base.ScreenResolution; +import com.fr.base.Utils; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.base.GlyphUtils; +import com.fr.chart.base.TextAttr; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.StockLabel; +import com.fr.chart.chartdata.StockReportDefinition; +import com.fr.design.constants.UIConstants; +import com.fr.design.event.UIObserverListener; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.itable.UITable; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.gui.itable.UITableUI; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRFont; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.plaf.TableUI; +import java.awt.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * 股价图 属性表 单元格数据源. + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-19 下午04:10:47 + */ +public class StockPlotReportDataContentPane extends AbstractReportDataContentPane { + private static final String AXIS = Inter.getLocText("Chart_HorialTimeAxis"); + private static final String VOLUME = Inter.getLocText("ChartF_Stock_Volume"); + private static final String OPEN = Inter.getLocText("ChartF_Stock_Open"); + private static final String HIGHT = Inter.getLocText("ChartF_Stock_High"); + private static final String LOW = Inter.getLocText("ChartF_Stock_Low"); + private static final String CLOSE = Inter.getLocText("ChartF_Stock_Close"); + private static final int PRE_WIDTH = 210; + private static final int VOLUMN_INDEX = 0; + private static final int OPEN_INDEX = 1; + private static final int HIGH_INDEX = 2; + private static final int LOW_INDEX = 3; + private static final int CLOSE_INDEX = 4; + + private TinyFormulaPane axisTime; + + public StockPlotReportDataContentPane(ChartDataPane parent) { + initEveryPane(); + + axisTime = new TinyFormulaPane() { + @Override + protected void initLayout() { + this.setLayout(new BorderLayout(4, 0)); + this.add(new BoldFontTextLabel(AXIS), BorderLayout.WEST); + this.add(formulaTextField, BorderLayout.CENTER); + this.add(formulaTextFieldButton, BorderLayout.EAST); + } + + @Override + public Dimension getPreferredSize() { + Dimension dim = new Dimension(); + dim.width = PRE_WIDTH; + dim.height = super.getPreferredSize().height; + return dim; + } + }; + + this.add(axisTime, "0,0,2,0"); + + List list = new ArrayList(); + list.add(new Object[]{VOLUME, ""}); + list.add(new Object[]{OPEN, ""}); + list.add(new Object[]{HIGHT, ""}); + list.add(new Object[]{LOW, ""}); + list.add(new Object[]{CLOSE, ""}); + + seriesPane.populateBean(list); + seriesPane.noAddUse(); + } + + protected void initSeriesPane() { + seriesPane = new UICorrelationPane(columnNames()) { + public UITableEditor createUITableEditor() { + return new StockTableEditor(); + } + + protected boolean isDeletable(){ + return false; + } + + protected UITable initUITable() { + return new UITable(columnCount) { + + public UITableEditor createTableEditor() { + return createUITableEditor(); + } + + public void tableCellEditingStopped(ChangeEvent e) { + stopPaneEditing(e); + } + + public boolean isCellEditable(int row, int column) { + return column <= 1; + } + + public TableUI getUI() { + return new UITableUI(){ + protected boolean isDeletable(){ + return false; + } + }; + } + + public void dealWithRollOver(int index){ + String text =(String)this.getModel().getValueAt(index, 0); + double width = GlyphUtils.calculateTextDimensionWithNoRotation(text, new TextAttr(FRFont.getInstance()), ScreenResolution.getScreenResolution()).getWidth(); + double cellWidth = this.getCellRect(index,0,false).getWidth(); + if(width<=cellWidth){ + this.setToolTipText(null); + }else{ + this.setToolTipText(text); + } + } + }; + } + }; + } + + + public void populateBean(ChartCollection collection) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if (definition instanceof StockReportDefinition) { + StockReportDefinition stockDefinition = (StockReportDefinition) definition; + + if (stockDefinition.getCategoryName() != null) { + axisTime.getUITextField().setText(stockDefinition.getCategoryName().toString()); + } + populateSeriesPane(stockDefinition); + } + } + + private void populateSeriesPane(StockReportDefinition stockDefinition){ + StockLabel stockLabel = stockDefinition.getStockLabel(); + List list = new ArrayList(); + String volumeLabel = !ComparatorUtils.equals(stockLabel.getVolumeLabel(),VOLUME) ? + StringUtils.perfectEnd(stockLabel.getVolumeLabel(),"("+VOLUME+")"): stockLabel.getVolumeLabel(); + String openLabel = !ComparatorUtils.equals(stockLabel.getOpenLabel(),OPEN) ? + StringUtils.perfectEnd(stockLabel.getOpenLabel(),"("+OPEN+")"): stockLabel.getOpenLabel(); + String highLabel = !ComparatorUtils.equals(stockLabel.getHighLabel(),HIGHT) ? + StringUtils.perfectEnd(stockLabel.getHighLabel(),"("+HIGHT+")"): stockLabel.getHighLabel(); + String lowLabel = !ComparatorUtils.equals(stockLabel.getLowLabel(),LOW) ? + StringUtils.perfectEnd(stockLabel.getLowLabel(),"("+LOW+")"): stockLabel.getLowLabel(); + String closeLabel = !ComparatorUtils.equals(stockLabel.getCloseLabel(),CLOSE) ? + StringUtils.perfectEnd(stockLabel.getCloseLabel(),"("+CLOSE+")"): stockLabel.getCloseLabel(); + list.add(new Object[]{volumeLabel, stockDefinition.getStockVolumn()}); + list.add(new Object[]{openLabel, stockDefinition.getStockOpen()}); + list.add(new Object[]{highLabel, stockDefinition.getStockHigh()}); + list.add(new Object[]{lowLabel, stockDefinition.getStockLow()}); + list.add(new Object[]{closeLabel, stockDefinition.getStockClose()}); + + seriesPane.populateBean(list); + } + + + public void updateBean(ChartCollection collection) { + collection.getSelectedChart().setFilterDefinition(new StockReportDefinition()); + + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if (definition instanceof StockReportDefinition) { + StockReportDefinition stockDefinition = (StockReportDefinition) definition; + + stockDefinition.setCategoryName(axisTime.getUITextField().getText()); + + List list =seriesPane.updateBean(); + StockLabel stockLabel = new StockLabel((list.get(VOLUMN_INDEX)[0]).toString(),(list.get(OPEN_INDEX)[0]).toString(), + (list.get(HIGH_INDEX)[0]).toString(),(list.get(LOW_INDEX)[0]).toString(),(list.get(CLOSE_INDEX)[0]).toString()); + stockDefinition.setStockLabel(stockLabel); + stockDefinition.setStockVolumn(canBeFormula(list.get(VOLUMN_INDEX)[1])); + stockDefinition.setStockOpen(canBeFormula(list.get(OPEN_INDEX)[1])); + stockDefinition.setStockHigh(canBeFormula(list.get(HIGH_INDEX)[1])); + stockDefinition.setStockLow(canBeFormula(list.get(LOW_INDEX)[1])); + stockDefinition.setStockClose(canBeFormula(list.get(CLOSE_INDEX)[1])); + populateSeriesPane(stockDefinition); + } + + } + + protected HashMap createNameValue(List list) { + HashMap values = new HashMap(); + + for (int i = 0; i < list.size(); i++) { + Object[] tmp = list.get(i); + values.put(tmp[0], tmp[1]); + } + + return values; + } + + @Override + protected String[] columnNames() { + return new String[]{"", ""}; + } + + private class StockTableEditor extends UITableEditor { + private TinyFormulaPane formulaComponent; + private UITextField labelComponent; + private int currentEditColumn = 1; + + public StockTableEditor() { + labelComponent = new UITextField(); + formulaComponent = new TinyFormulaPane() { + @Override + public void okEvent() { + seriesPane.stopCellEditing(); + seriesPane.fireTargetChanged(); + } + }; + + formulaComponent.setBackground(UIConstants.FLESH_BLUE); + + formulaComponent.getUITextField().registerChangeListener(new UIObserverListener() { + @Override + public void doChange() { + seriesPane.fireTargetChanged(); + } + }); + } + + /** + * 返回当前编辑器的值 + */ + public Object getCellEditorValue() { + if (currentEditColumn == 0) { + return labelComponent.getText(); + } + return formulaComponent.getUITextField().getText(); + } + + /** + * 返回当前编辑器.. + */ + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (column == table.getModel().getColumnCount()) { + return null; + } + seriesPane.stopCellEditing(); + + currentEditColumn = column; + if (currentEditColumn == 0) { + labelComponent.setText(getShowText(row,Utils.objectToString(value))); + return labelComponent; + } + + formulaComponent.getUITextField().setText(Utils.objectToString(value)); + return formulaComponent; + } + + private String getShowText(int row,String label){ + if(row == VOLUMN_INDEX){ + return StringUtils.cutStringEndWith(label,"("+VOLUME+")"); + }else if(row == OPEN_INDEX){ + return StringUtils.cutStringEndWith(label, "(" + OPEN + ")"); + }else if(row == HIGH_INDEX){ + return StringUtils.cutStringEndWith(label, "(" + HIGHT + ")"); + }else if(row == LOW_INDEX){ + return StringUtils.cutStringEndWith(label, "(" + LOW + ")"); + }else if(row == CLOSE_INDEX ){ + return StringUtils.cutStringEndWith(label, "(" + CLOSE + ")"); + }else { + return label; + } + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/XYScatterPlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/XYScatterPlotReportDataContentPane.java new file mode 100644 index 000000000..64b73bc59 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/XYScatterPlotReportDataContentPane.java @@ -0,0 +1,91 @@ +package com.fr.design.mainframe.chart.gui.data.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.XYScatterPlot; +import com.fr.chart.chartdata.ScatterReportDefinition; +import com.fr.chart.chartdata.ScatterSeriesValue; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; +import com.fr.general.Inter; + +import java.util.ArrayList; +import java.util.List; + +/** + * 散点图 属性表 单元格数据源. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-19 下午03:42:37 + */ +public class XYScatterPlotReportDataContentPane extends AbstractReportDataContentPane { + + private ChartDataFilterPane filterPane; + + public XYScatterPlotReportDataContentPane(ChartDataPane parent) { + initEveryPane(); + + this.add(new BoldFontTextLabel(Inter.getLocText("Data_Filter")), "0,4,2,4"); + this.add(filterPane = new ChartDataFilterPane(new XYScatterPlot(), parent), "0,6,2,4"); + } + + protected String[] columnNames() { + return new String[]{ + Inter.getLocText("Series_Name"), + Inter.getLocText("Chart_Scatter") + "x", + Inter.getLocText("Chart_Scatter") + "y" + }; + } + + public void populateBean(ChartCollection collection) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if(definition instanceof ScatterReportDefinition) { + ScatterReportDefinition scatter = (ScatterReportDefinition)definition; + + List list = populateSeriesEntryList(scatter); + if(list != null && !list.isEmpty()) { + seriesPane.populateBean(list); + } + } + + filterPane.populateBean(collection); + } + + private List populateSeriesEntryList(ScatterReportDefinition seriesList) { + List list = new ArrayList(); + for(int i = 0; i < seriesList.size(); i++) { + ScatterSeriesValue seriesEntry = (ScatterSeriesValue)seriesList.get(i); + Object[] nameAndValue = new Object[3]; + nameAndValue[0] = seriesEntry.getScatterSeriesName(); + nameAndValue[1] = seriesEntry.getScatterSeriesX(); + nameAndValue[2] = seriesEntry.getScatterSeriesY(); + list.add(nameAndValue); + } + return list; + } + + /** + * 保存散点 单元格数据内容到ChartCollection. + */ + public void updateBean(ChartCollection collection) { + ScatterReportDefinition reportDataDefinition = new ScatterReportDefinition(); + collection.getSelectedChart().setFilterDefinition(reportDataDefinition); + + updateSeriesEntryList(reportDataDefinition, seriesPane.updateBean()); + + filterPane.updateBean(collection); + } + + private void updateSeriesEntryList(ScatterReportDefinition list, List valueList) { + for (int i = 0; i < valueList.size(); i++) { + Object[] rowValueList = valueList.get(i); + + ScatterSeriesValue seriesEntry = new ScatterSeriesValue(); + + seriesEntry.setScatterSeriesName(canBeFormula(rowValueList[0])); + seriesEntry.setScatterSeriesX(canBeFormula(rowValueList[1])); + seriesEntry.setScatterSeriesY(canBeFormula(rowValueList[2])); + list.add(seriesEntry); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java new file mode 100644 index 000000000..c87d28e00 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java @@ -0,0 +1,137 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.List; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icombobox.UIComboBox; + +public abstract class AbstractTableDataContentPane extends BasicBeanPane{ + + private boolean isNeedSummaryCaculateMethod = true; + + public abstract void updateBean(ChartCollection ob); + + /** + * 检查box是否 需要使用 比如: 柱形图, 在分类轴未选择时, 不能选择使用 系列名 系列值 "系列名使用" + * @param hasUse 是否使用 + */ + public void checkBoxUse(boolean hasUse) { + + } + + /** + * 数据集变更时, 刷新box + * @param dataWrapper 二维表 + */ + public void onSelectTableData(TableDataWrapper dataWrapper) { + List columnNameList = dataWrapper.calculateColumnNameList(); + refreshBoxListWithSelectTableData(columnNameList); + } + + /** + * 清空所有的box设置 + */ + public abstract void clearAllBoxList(); + + protected abstract void refreshBoxListWithSelectTableData(List columnNameList); + + /** + * 刷新Box的选项. + */ + protected void refreshBoxItems(UIComboBox box, List list) { + if(box == null) { + return; + } + + Object ob = box.getSelectedItem(); + box.removeAllItems(); + + int length = list.size(); + for(int i = 0; i < length; i++) { + box.addItem(list.get(i)); + } + + box.getModel().setSelectedItem(ob); + } + + /** + * 清空box里所有东西 + * @param box 容器 + */ + protected void clearBoxItems(UIComboBox box){ + if(box == null){ + return; + } + box.removeAllItems(); + } + + protected ItemListener tooltipListener = new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if(e.getSource() instanceof UIComboBox) { + UIComboBox box = (UIComboBox)e.getSource(); + if(box.getSelectedItem() != null) { + box.setToolTipText(box.getSelectedItem().toString()); + } else { + box.setToolTipText(null); + } + } + } + }; + + /** + * 兼容以前 自定义的数据字段 + */ + protected void combineCustomEditValue(UIComboBox comBox, String value) { + if(comBox != null) { + comBox.setEditable(true); + comBox.setSelectedItem(value); + comBox.setEditable(false); + } + } + + @Override + protected String title4PopupWindow() { + return ""; + } + + @Override + public void populateBean(ChartCollection collection) { + if(collection == null) { + return; + } + } + + /** + * 重新layout整个面板 + */ + public void redoLayoutPane(){ + + } + + @Override + public ChartCollection updateBean() { + return null; + } + + /** + * 设置是否需要汇总方式 + * @param isNeedSummaryCaculateMethod 是否需要汇总 + */ + public void setNeedSummaryCaculateMethod(boolean isNeedSummaryCaculateMethod){ + this.isNeedSummaryCaculateMethod = isNeedSummaryCaculateMethod; + } + + /** + * 返回是否需要汇总方式 + * @return 是否需要汇总方式 + */ + public boolean isNeedSummaryCaculateMethod(){ + return this.isNeedSummaryCaculateMethod; + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/BubblePlotTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/BubblePlotTableDataContentPane.java new file mode 100644 index 000000000..bdc8e6d79 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/BubblePlotTableDataContentPane.java @@ -0,0 +1,165 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +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.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 BubblePlotTableDataContentPane extends AbstractTableDataContentPane { + + private UIComboBox seriesName; + private UIComboBox xCombox; + private UIComboBox yCombox; + private UIComboBox bubbleSize; + + private ChartDataFilterPane dataScreeningPane; + + public BubblePlotTableDataContentPane(ChartDataPane parent) { + seriesName = new UIComboBox(); + xCombox = new UIComboBox(); + yCombox = new UIComboBox(); + bubbleSize = new UIComboBox(); + dataScreeningPane = new ChartDataFilterPane(new BubblePlot(), parent); + + seriesName.setPreferredSize(new Dimension(100, 20)); + xCombox.setPreferredSize(new Dimension(100, 20)); + yCombox.setPreferredSize(new Dimension(100, 20)); + bubbleSize.setPreferredSize(new Dimension(100, 20)); + + seriesName.addItem(Inter.getLocText("Chart-Use_None")); + + 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")+":"), seriesName}, + new Component[]{new UILabel(" "+Inter.getLocText("Chart-Bubble_Value")+"x :"), xCombox}, + new Component[]{new UILabel(" "+Inter.getLocText("Chart-Bubble_Value")+"y :"), yCombox}, + new Component[]{new UILabel(" "+Inter.getLocText("Chart-Bubble_Size")+":"), 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); + } + + /** + * 检查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()); + combineCustomEditValue(bubbleSize, definition.getBubbleSize()); + + dataScreeningPane.populateBean(collection); + } + + @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.NONE_KEYS, 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/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java new file mode 100644 index 000000000..9ae7696d9 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java @@ -0,0 +1,234 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import com.fr.base.BaseUtils; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Bar2DPlot; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.NormalTableDataDefinition; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ibutton.UIButton; +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.mainframe.chart.gui.ChartDataPane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; + +/** + * 多分类轴 的数据集定义界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2013-9-3 上午10:00:28 + */ +public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableDataContentPane implements UIObserver{ + private static final long serialVersionUID = -3305681053750642843L; + private static final int COMBOX_GAP = 8; + private static final int COMBOX_WIDTH = 100; + private static final int COMBOX_HEIGHT = 20; + + private JPanel boxPane; + + private ArrayList boxList = new ArrayList(); + private UIButton addButton; + + private UIObserverListener uiobListener = null; + + public CategoryPlotMoreCateTableDataContentPane() { + // do nothing + } + + public CategoryPlotMoreCateTableDataContentPane(ChartDataPane parent) { + categoryCombox = new UIComboBox(); + categoryCombox.setPreferredSize(new Dimension(100,20)); + + JPanel categoryPane = new JPanel(new BorderLayout(4,0)); + categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); + UILabel categoryLabel = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT) ; + categoryLabel.setPreferredSize(new Dimension(75,20)); + + addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); + addButton.setPreferredSize(new Dimension(20, 20)); + + categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, addButton,null,categoryLabel,null})); + + boxPane = new JPanel(); + boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); + + categoryPane.add(boxPane, BorderLayout.SOUTH); + + this.setLayout(new BorderLayout()); + this.add(categoryPane, BorderLayout.NORTH); + seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot()); + this.add(seriesTypeComboxPane, BorderLayout.SOUTH); + + addButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if(boxList.size() < 2) { + addNewCombox(); + relayoutPane(); + } + + checkSeriseUse(categoryCombox.getSelectedItem() != null); + } + }); + + categoryCombox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + checkSeriseUse(categoryCombox.getSelectedItem() != null); + makeToolTipUse(categoryCombox); + + checkAddButton(); + } + }); + } + + protected void checkSeriseUse(boolean hasUse) { + super.checkSeriseUse(hasUse); + + addButton.setEnabled(hasUse); + } + + private UIComboBox addNewCombox() { + final JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); + + final UIComboBox combox = new UIComboBox(); + combox.setPreferredSize(new Dimension(COMBOX_WIDTH, COMBOX_HEIGHT)); + + int count = categoryCombox.getItemCount(); + for(int i = 0; i < count; i++) { + combox.addItem(categoryCombox.getItemAt(i)); + } + + combox.registerChangeListener(uiobListener); + combox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + makeToolTipUse(combox); + } + }); + + combox.setSelectedItem(categoryCombox.getItemAt(0)); + makeToolTipUse(combox); + + buttonPane.add(combox); + UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); + buttonPane.add(delButton); + boxPane.add(buttonPane); + boxList.add(combox); + + checkAddButton(); + + delButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + boxPane.remove(buttonPane); + boxList.remove(combox); + checkAddButton(); + relayoutPane(); + } + }); + delButton.registerChangeListener(uiobListener); + + return combox; + } + + private void checkAddButton() { + int size = boxList.size(); + addButton.setEnabled(size < 2 && categoryCombox.getSelectedItem() != null); + } + + private void relayoutPane() { + this.revalidate(); + } + + + /** + *检查 某些Box是否可用 + * @param hasUse 是否使用. + */ + public void checkBoxUse(boolean hasUse) { + super.checkBoxUse(hasUse); + + checkAddButton(); + } + + protected void refreshBoxListWithSelectTableData(List list) { + super.refreshBoxListWithSelectTableData(list); + + for(int i = 0, size = boxList.size(); i < size; i++) { + refreshBoxItems(boxList.get(i), list); + } + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(UIObserverListener listener) { + uiobListener = listener; + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + /** + * 更新 多分类相关界面 + * @param collection + */ + public void populateBean(ChartCollection collection) { + super.populateBean(collection); + + boxList.clear(); + + TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); + if(top instanceof NormalTableDataDefinition) { + NormalTableDataDefinition normal = (NormalTableDataDefinition)top; + int size = normal.getMoreCateSize(); + for(int i = 0; i < size; i++) { + UIComboBox box = addNewCombox(); + box.setSelectedItem(normal.getMoreCateWithIndex(i)); + } + } + + checkAddButton(); + checkSeriseUse(categoryCombox.getSelectedItem() != null); + } + + /** + * 保存多分类界面到collection + * @param collection + */ + public void updateBean(ChartCollection collection) { + super.updateBean(collection); + + TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); + if(top instanceof NormalTableDataDefinition) { + NormalTableDataDefinition normal = (NormalTableDataDefinition)top; + normal.clearMoreCate(); + for(int i = 0, size = boxList.size(); i < size; i++) { + UIComboBox box = boxList.get(i); + if(box.getSelectedItem() != null) { + normal.addMoreCate(box.getSelectedItem().toString()); + } + } + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java new file mode 100644 index 000000000..3f1e53268 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java @@ -0,0 +1,167 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import com.fr.chart.chartdata.TopDefinition; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartattr.Bar2DPlot; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.NormalTableDataDefinition; +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.mainframe.chart.gui.ChartDataPane; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; +import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.List; + +/** + * 属性表, 矩形类的 数据集 数据界面. +* @author kunsnat E-mail:kunsnat@gmail.com +* @version 创建时间:2012-12-26 下午04:48:01 + */ +public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPane{ + private static final long serialVersionUID = 7284078589672079657L; + + protected UIComboBox categoryCombox; + protected SeriesTypeUseComboxPane seriesTypeComboxPane; + + public CategoryPlotTableDataContentPane() { + + } + + public CategoryPlotTableDataContentPane(ChartDataPane parent) { + + categoryCombox = new UIComboBox(); + JPanel categoryPane = new JPanel(new BorderLayout(4,0)); + categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); + UILabel label1 = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT) ; + label1.setPreferredSize(new Dimension(75,20)); + categoryCombox.setPreferredSize(new Dimension(100,20)); + + categoryCombox.addItem(Inter.getLocText("Chart-Use_None")); + categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox,null,null,label1,null})); + + this.setLayout(new BorderLayout()); + + this.add(categoryPane, BorderLayout.NORTH); + + seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot()); + this.add(seriesTypeComboxPane, BorderLayout.SOUTH); + + categoryCombox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + checkSeriseUse(categoryCombox.getSelectedItem() != null); + makeToolTipUse(categoryCombox); + } + }); + } + + protected void makeToolTipUse(UIComboBox comBox) { + if(comBox.getSelectedItem() != null) { + comBox.setToolTipText(comBox.getSelectedItem().toString()); + } else { + comBox.setToolTipText(null); + } + } + + /** + * 检查 某些Box是否可用 + * @param hasUse 是否使用. + */ + public void checkBoxUse(boolean hasUse) { + categoryCombox.setEnabled(hasUse); + checkSeriseUse(hasUse); + } + + protected void checkSeriseUse(boolean hasUse) { + if(seriesTypeComboxPane != null) { + seriesTypeComboxPane.checkUseBox(hasUse && categoryCombox.getSelectedItem() != null); + } + } + + protected void refreshBoxListWithSelectTableData(List list) { + refreshBoxItems(categoryCombox, list); + categoryCombox.addItem(Inter.getLocText("Chart-Use_None")); + + seriesTypeComboxPane.refreshBoxListWithSelectTableData(list); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList(){ + clearBoxItems(categoryCombox); + categoryCombox.addItem(Inter.getLocText("Chart-Use_None")); + seriesTypeComboxPane.clearAllBoxList(); + } + + /** + * 保存界面内容到ChartCollection + */ + public void updateBean(ChartCollection collection) { + seriesTypeComboxPane.updateBean(collection); + NormalTableDataDefinition dataDefinition = (NormalTableDataDefinition)collection.getSelectedChart().getFilterDefinition(); + if(dataDefinition == null) { + return; + } + Object categoryName = categoryCombox.getSelectedItem(); + + if(ArrayUtils.contains(ChartConstants.NONE_KEYS, categoryName)) { + dataDefinition.setCategoryName(StringUtils.EMPTY); + } else { + dataDefinition.setCategoryName(categoryName == null ? null : categoryName.toString()); + } + + } + + /** + * 根据ChartCollection 更新界面 + */ + public void populateBean(ChartCollection collection) { + super.populateBean(collection); + TopDefinition top = (TopDefinition)collection.getSelectedChart().getFilterDefinition(); + + if(!(top instanceof NormalTableDataDefinition)) { + return; + } + NormalTableDataDefinition data = (NormalTableDataDefinition)top; + + if(data == null || ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) { + categoryCombox.setSelectedItem(Inter.getLocText("Chart-Use_None")); + } else if(data!= null && !this.boxItemsContainsObject(categoryCombox,data.getCategoryName())){ + categoryCombox.setSelectedItem(null); + }else { + combineCustomEditValue(categoryCombox, data == null ? null : data.getCategoryName()); + } + + seriesTypeComboxPane.populateBean(collection,this.isNeedSummaryCaculateMethod()); + } + + private boolean boxItemsContainsObject(UIComboBox box,Object item){ + if(box == null){ + return false; + } + + ComboBoxModel dataModel = box.getModel(); + for (int i = 0; i < dataModel.getSize(); i++) { + if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){ + return true; + } + } + return false; + } + + /** + * 重新布局整个面板 + */ + public void redoLayoutPane(){ + seriesTypeComboxPane.relayoutPane(this.isNeedSummaryCaculateMethod()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/Factory4TableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/Factory4TableDataContentPane.java new file mode 100644 index 000000000..e02e0ba80 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/Factory4TableDataContentPane.java @@ -0,0 +1,61 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import com.fr.base.FRContext; +import com.fr.chart.chartattr.*; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.style.axis.*; + +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by IntelliJ IDEA. + * Author : daisy + * Version: 6.5.6 + * Date: 14-10-23 + * Time: 上午11:08 + */ +public class Factory4TableDataContentPane { + + private static Map, Class> map = new HashMap, Class>(); + + static { + map.put(PiePlot.class, PiePlotTableDataContentPane.class); + map.put(Pie3DPlot.class,PiePlotTableDataContentPane.class); + map.put(BubblePlot.class, BubblePlotTableDataContentPane.class); + map.put(XYScatterPlot.class, XYScatterPlotTableDataContentPane.class); + map.put(GanttPlot.class, GanttPlotTableDataContentPane.class); + map.put(StockPlot.class, StockPlotTableDataContentPane.class); + map.put(MeterPlot.class,MeterPlotTableDataContentPane.class); + map.put(MeterBluePlot.class,MeterPlotTableDataContentPane.class); + map.put(SimpleMeterPlot.class,MeterPlotTableDataContentPane.class); + } + + /** + * 根据plot生产对应的数据面板 + * @param plot 图表 + * @param parentPane 父面板 + * @return 对应的数据面板 + */ + public static AbstractTableDataContentPane createTableDataContenetPaneWithPlotType(Plot plot, ChartDataPane parentPane){ + try { + Class classname = map.get(plot.getClass()); + if(classname == null){ + return new CategoryPlotTableDataContentPane(parentPane); + } + Constructor tabledataPaneClass = classname.getConstructor(ChartDataPane.class); + if(tabledataPaneClass !=null){ + return tabledataPaneClass.newInstance(parentPane); + }else{ + return new CategoryPlotTableDataContentPane(parentPane); + } + } catch (InstantiationException e) { + FRContext.getLogger().error(e.getMessage(), e); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } + return new CategoryPlotTableDataContentPane(parentPane); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/GanttPlotTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/GanttPlotTableDataContentPane.java new file mode 100644 index 000000000..f65a21332 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/GanttPlotTableDataContentPane.java @@ -0,0 +1,198 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.GanttPlot; +import com.fr.chart.chartdata.GanttTableDefinition; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.List; + +public class GanttPlotTableDataContentPane extends AbstractTableDataContentPane{ + + private UIComboBox step; + private UIComboBox planStart; + private UIComboBox planEnd; + private UIComboBox finalStart; + private UIComboBox finalEnd; + private UIComboBox percent; + private UIComboBox project; + + public GanttPlotTableDataContentPane(ChartDataPane parent) { + step = new UIComboBox(); + planStart = new UIComboBox(); + planEnd = new UIComboBox(); + finalStart = new UIComboBox(); + finalEnd = new UIComboBox(); + percent = new UIComboBox(); + project = new UIComboBox(); + + step.setPreferredSize(new Dimension(100, 20)); + planStart.setPreferredSize(new Dimension(100, 20)); + planEnd.setPreferredSize(new Dimension(100, 20)); + finalStart.setPreferredSize(new Dimension(100, 20)); + finalEnd.setPreferredSize(new Dimension(100, 20)); + percent.setPreferredSize(new Dimension(100, 20)); + project.setPreferredSize(new Dimension(100, 20)); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p, f}; + double[] rowSize = { p,p,p,p,p,p,p,p,p,p}; + + Component[][] components = new Component[][]{ + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Step_Name") + ":", SwingConstants.RIGHT),step}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Plan_Start") + ":", SwingConstants.RIGHT),planStart}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Plan_End") + ":", SwingConstants.RIGHT),planEnd}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Actual_Start") + ":", SwingConstants.RIGHT),finalStart}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Actual_End") + ":", SwingConstants.RIGHT),finalEnd}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Use_Percent") + ":", SwingConstants.RIGHT),percent}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Use_Items") + ":", SwingConstants.RIGHT),project}, + } ; + JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + this.setLayout(new BorderLayout()); + this.add(panel,BorderLayout.CENTER); + + finalStart.addItem(GanttPlot.NONE); + finalEnd.addItem(GanttPlot.NONE); + percent.addItem(GanttPlot.NONE); + project.addItem(GanttPlot.NONE); + + finalStart.setSelectedItem(GanttPlot.NONE); + finalEnd.setSelectedItem(GanttPlot.NONE); + percent.setSelectedItem(GanttPlot.NONE); + project.setSelectedItem(GanttPlot.NONE); + + step.addItemListener(check); + planStart.addItemListener(check); + planEnd.addItemListener(check); + + step.addItemListener(tooltipListener); + planStart.addItemListener(tooltipListener); + planEnd.addItemListener(tooltipListener); + finalStart.addItemListener(tooltipListener); + finalEnd.addItemListener(tooltipListener); + percent.addItemListener(tooltipListener); + project.addItemListener(tooltipListener); + } + + ItemListener check = new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + checkBoxUse(); + } + }; + + private void checkBoxUse() { + boolean hasStep = step.getSelectedItem() != null; + planStart.setEnabled(hasStep); + planEnd.setEnabled(hasStep); + finalStart.setEnabled(hasStep); + finalEnd.setEnabled(hasStep); + percent.setEnabled(hasStep); + project.setEnabled(hasStep); + + if(planStart.isEnabled() && planEnd.isEnabled()) { + project.setEnabled(planStart.getSelectedItem() != null && planEnd.getSelectedItem() != null); + } + } + + @Override + public void updateBean(ChartCollection collection) { + GanttTableDefinition data = new GanttTableDefinition(); + + Object resultProgress = step.getSelectedItem(); + Object resultPlanStart = planStart.getSelectedItem(); + Object resultPlanEnd = planEnd.getSelectedItem(); + Object resultFinalStart = finalStart.getSelectedItem(); + Object resultFinalEnd = finalEnd.getSelectedItem(); + Object resultPercent = percent.getSelectedItem(); + Object resultProject = project.getSelectedItem(); + + if(resultProgress != null) { + data.setStepString(resultProgress.toString()); + } + if(resultPlanStart != null) { + data.setPlanStart(resultPlanStart.toString()); + } + if(resultPlanEnd != null) { + data.setPlanEnd(resultPlanEnd.toString()); + } + if(resultFinalStart != null) { + data.setRealStart(resultFinalStart.toString()); + } + if(resultFinalEnd != null) { + data.setRealEnd(resultFinalEnd.toString()); + } + if(resultPercent != null) { + data.setProgress(resultPercent.toString()); + } + if(resultProject != null) { + data.setItem(resultProject.toString()); + } + collection.getSelectedChart().setFilterDefinition(data); + } + + @Override + public void populateBean(ChartCollection collection) { + super.populateBean(collection); + TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); + if(top instanceof GanttTableDefinition) { + GanttTableDefinition data = (GanttTableDefinition)top; + + combineCustomEditValue(step, data.getStepString()); + combineCustomEditValue(planStart, data.getPlanStart()); + combineCustomEditValue(planEnd, data.getPlanEnd()); + combineCustomEditValue(finalStart, data.getRealStart()); + combineCustomEditValue(finalEnd, data.getRealEnd()); + combineCustomEditValue(percent, data.getProgress()); + combineCustomEditValue(project, data.getItem()); + } + + checkBoxUse(); + } + + protected void refreshBoxListWithSelectTableData(List list) { + refreshBoxItems(step, list); + refreshBoxItems(planStart, list); + refreshBoxItems(planEnd, list); + refreshBoxItems(finalStart, list); + refreshBoxItems(finalEnd, list); + refreshBoxItems(percent, list); + refreshBoxItems(project, list); + + finalStart.addItem(GanttPlot.NONE); + finalEnd.addItem(GanttPlot.NONE); + percent.addItem(GanttPlot.NONE); + project.addItem(GanttPlot.NONE); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList(){ + clearBoxItems(step); + clearBoxItems(planStart); + clearBoxItems(planEnd); + clearBoxItems(finalStart); + clearBoxItems(finalEnd); + clearBoxItems(percent); + clearBoxItems(project); + + finalStart.addItem(GanttPlot.NONE); + finalEnd.addItem(GanttPlot.NONE); + percent.addItem(GanttPlot.NONE); + project.addItem(GanttPlot.NONE); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java new file mode 100644 index 000000000..5ea4e8fe6 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java @@ -0,0 +1,116 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.util.List; + +import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.SwingConstants; + +import com.fr.base.Utils; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.MeterPlot; +import com.fr.chart.chartdata.MeterTableDefinition; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +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.general.Inter; + +/** + * 仪表盘, 属性表, 数据集数据界面. + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-21 下午04:51:50 + */ +public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane { + private static final String METER_NAME = Inter.getLocText("Chart-Category_Use_Name") + ":"; + private static final String METER_VALUE = Inter.getLocText("Chart-Pointer_Value") + ":"; + + private UIComboBox nameBox; + private UIComboBox valueBox; + private ChartDataFilterPane filterPane; + + public MeterPlotTableDataContentPane(ChartDataPane parent) { + this.setLayout(new BorderLayout()); + + nameBox = new UIComboBox(); + valueBox = new UIComboBox(); + filterPane = new ChartDataFilterPane(new MeterPlot(), parent); + + nameBox.setPreferredSize(new Dimension(100, 20)); + valueBox.setPreferredSize(new Dimension(100, 20)); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p,f}; + double[] rowSize = { p, p,p,p,p,p,p,p, p}; + + Component[][] components = new Component[][]{ + new Component[]{new BoldFontTextLabel(METER_NAME, SwingConstants.RIGHT), nameBox}, + new Component[]{new BoldFontTextLabel(METER_VALUE, SwingConstants.RIGHT), valueBox}, + new Component[]{new JSeparator(), null}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Data_Filter"))}, + new Component[]{filterPane, null} + + } ; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + this.add(panel,BorderLayout.CENTER); + + nameBox.addItemListener(tooltipListener); + valueBox.addItemListener(tooltipListener); + } + + protected void refreshBoxListWithSelectTableData(List list) { + refreshBoxItems(nameBox, list); + refreshBoxItems(valueBox, list); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList(){ + clearBoxItems(nameBox); + clearBoxItems(valueBox); + } + + /** + * 更新仪表盘数据界面 + */ + public void populateBean(ChartCollection ob) { + if(ob != null && ob.getSelectedChart().getFilterDefinition() instanceof MeterTableDefinition) { + MeterTableDefinition meter = (MeterTableDefinition)ob.getSelectedChart().getFilterDefinition(); + + nameBox.setSelectedItem(meter.getName()); + valueBox.setSelectedItem(meter.getValue()); + filterPane.populateBean(ob); + } + } + + /** + * 保存界面属性. + */ + public void updateBean(ChartCollection ob) { + if(ob != null) { + MeterTableDefinition meter = new MeterTableDefinition(); + ob.getSelectedChart().setFilterDefinition(meter); + + meter.setName(Utils.objectToString(nameBox.getSelectedItem())); + meter.setValue(Utils.objectToString(valueBox.getSelectedItem())); + filterPane.updateBean(ob); + } + } + + /** + * 重新布局整个面板 + */ + public void redoLayoutPane(){ + filterPane.relayoutPane(this.isNeedSummaryCaculateMethod()); + } + + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/PiePlotTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/PiePlotTableDataContentPane.java new file mode 100644 index 000000000..a9eabca2e --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/PiePlotTableDataContentPane.java @@ -0,0 +1,54 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import java.awt.BorderLayout; +import java.util.List; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.PiePlot; +import com.fr.design.mainframe.chart.gui.ChartDataPane; + +public class PiePlotTableDataContentPane extends AbstractTableDataContentPane{ + private SeriesTypeUseComboxPane typeChoosePane; + + public PiePlotTableDataContentPane(ChartDataPane parent) { + typeChoosePane = new SeriesTypeUseComboxPane(parent, new PiePlot()); + this.setLayout(new BorderLayout()); + this.add(typeChoosePane, BorderLayout.CENTER); + } + + /** + * 判断时候使用typeChoosePane + * @param hasUse 是否使用 + */ + public void checkBoxUse(boolean hasUse) { + typeChoosePane.checkUseBox(hasUse); + } + + protected void refreshBoxListWithSelectTableData(List list) { + typeChoosePane.refreshBoxListWithSelectTableData(list); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList(){ + typeChoosePane.clearAllBoxList(); + } + + @Override + public void updateBean(ChartCollection collection) { + typeChoosePane.updateBean(collection); + } + + @Override + public void populateBean(ChartCollection collection) { + typeChoosePane.populateBean(collection,this.isNeedSummaryCaculateMethod()); + } + + /** + * 重新布局整个面板 + */ + public void redoLayoutPane(){ + typeChoosePane.relayoutPane(this.isNeedSummaryCaculateMethod()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java new file mode 100644 index 000000000..8e6784d92 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java @@ -0,0 +1,356 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import com.fr.base.Utils; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.ChartSummaryColumn; +import com.fr.chart.chartdata.MoreNameCDDefinition; +import com.fr.data.util.function.DataFunction; +import com.fr.data.util.function.NoneFunction; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.UICorrelationPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.itable.UITable; +import com.fr.design.gui.itable.UITableEditor; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; + +/** + * 属性表 数据集界面: 系列名 使用字段名. + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-26 下午04:39:46 + */ +public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane { + private static final String[] HEADS = {Inter.getLocText("FR-Chart-Field_Name"), Inter.getLocText("FR-Chart-Series_Name"), Inter.getLocText("FR-Chart-Data_Summary")}; + private static final String[] HEADS_NO_SUMMARY = {Inter.getLocText("FR-Chart-Field_Name"), Inter.getLocText("FR-Chart-Series_Name")}; + private UICorrelationPane seriesDataPane; + private List field = new ArrayList(); + private JPanel centerPane; + private boolean isNeedSummary = true; + private UIObserverListener observerListener; + + + public SeriesNameUseFieldNamePane() { + isNeedSummary = true; + initCenterPane(HEADS); + } + + private void initCenterPane(final String[] heads) { + seriesDataPane = new UICorrelationPane(heads) { + + @Override + protected ActionListener getAddButtonListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String[] blank =heads.length == 3?new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Inter.getLocText("FR-Chart-Data_None")}: + new String[]{StringUtils.EMPTY, StringUtils.EMPTY}; + tablePane.addLine(blank); + fireTargetChanged(); + } + }; + } + + public UITableEditor createUITableEditor() { + return new InnerTableEditor(); + } + + public void stopPaneEditing(ChangeEvent e) { + fireTargetChanged(); + } + + public void registerChangeListener(UIObserverListener listener) { + super.registerChangeListener(listener); + observerListener = listener; + } + + }; + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{seriesDataPane}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("FR-Chart-Data_Filter"))}, + }; + centerPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(centerPane, BorderLayout.CENTER); + } + + /** + * 判断是都接受 + * @param ob 传过来得 + * @return 是则返回true + */ + public boolean accept(Object ob) { + ChartCollection collection = (ChartCollection) ob; + return collection.getSelectedChart().getFilterDefinition() instanceof MoreNameCDDefinition; + } + + /** + * 标题 + * @return 标题 + */ + public String title4PopupWindow() { + return Inter.getLocText(new String[]{"FR-Chart-Data_Use", "FR-Chart-Field_Name"}); + } + + /** + * 重置. + */ + public void reset() { + + } + + + /** + * 数据集变更时 + * @param list 数据集 + */ + public void refreshBoxListWithSelectTableData(List list) { + field.clear(); + + for (int i = 0, length = list.size(); i < length; i++) { + Object ob = list.get(i); + if (ob != null) { + field.add(ob.toString()); + } + } + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList(){ + field.clear(); + } + + private void fireStop() { + seriesDataPane.stopCellEditing(); + seriesDataPane.fireTargetChanged(); + } + + /** + * 重新布局面板 + * @param isNeedSummary 是都需要汇总(图表设计器得时候不需要) + */ + public void relayoutPane(boolean isNeedSummary){ + if(this.isNeedSummary != isNeedSummary){ + this.remove(centerPane); + initCenterPane(isNeedSummary?HEADS:HEADS_NO_SUMMARY); + initListener(this); + this.validate(); + this.isNeedSummary = isNeedSummary; + } + } + + private void initListener(Container parentComponent) { + for (int i = 0; i < parentComponent.getComponentCount(); i++) { + Component tmpComp = parentComponent.getComponent(i); + + if (tmpComp instanceof Container) { + initListener((Container) tmpComp); + } + if (tmpComp instanceof UIObserver) { + ((UIObserver) tmpComp).registerChangeListener(observerListener); + } + } + } + + public void populateBean(ChartCollection collection,boolean isNeedSummary){ + relayoutPane(isNeedSummary); + TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition(); + if (topDefinition instanceof MoreNameCDDefinition) { + MoreNameCDDefinition moreDefinition = (MoreNameCDDefinition) topDefinition; + ChartSummaryColumn[] chartSummaryColumnArray = moreDefinition.getChartSummaryColumn(); + if (chartSummaryColumnArray == null || chartSummaryColumnArray.length == 0) { + return; + } + List list = new ArrayList(); + for (int i = 0; i < chartSummaryColumnArray.length; i++) { + ChartSummaryColumn column = chartSummaryColumnArray[i]; + String[] nameArray = {column.getName(), column.getCustomName(), getFunctionString(column.getFunction())}; + list.add(nameArray); + } + seriesDataPane.populateBean(list); + } + } + + /** + * 根据ChartCollection 更新界面 + */ + public void populateBean(ChartCollection collection) { + this.populateBean(collection,true); + } + + private String getFunctionString(DataFunction function) { + for (int i = 0; i < CalculateComboBox.CLASS_ARRAY.length; i++) { + Class tmp = function.getClass(); + if (ComparatorUtils.equals(tmp, CalculateComboBox.CLASS_ARRAY[i])) { + return CalculateComboBox.CALCULATE_ARRAY[i]; + } + } + return CalculateComboBox.CALCULATE_ARRAY[0]; + } + + /** + * 保存界面属性到ChartCollection + */ + public void updateBean(ChartCollection collection) { + TopDefinitionProvider normalDefinition = collection.getSelectedChart().getFilterDefinition(); + MoreNameCDDefinition moreDefinition = null; + if (normalDefinition instanceof MoreNameCDDefinition) { + moreDefinition = (MoreNameCDDefinition) normalDefinition; + } else { + moreDefinition = new MoreNameCDDefinition(); + } + + List data = seriesDataPane.updateBean(); + ChartSummaryColumn[] dataArray = new ChartSummaryColumn[data.size()]; + for (int i = 0; i < dataArray.length; i++) { + Object[] line = data.get(i); + String first = Utils.objectToString(line[0]); + String second = Utils.objectToString(line[1]); + if(isNeedSummary){ + String third = Utils.objectToString(line[2]); + dataArray[i] = new ChartSummaryColumn(first, second, getFcuntionByName(third)); + } else{ + dataArray[i] = new ChartSummaryColumn(first,second,new NoneFunction()); + } + } + moreDefinition.setChartSummaryColumn(dataArray); + collection.getSelectedChart().setFilterDefinition(moreDefinition); + } + + private DataFunction getFcuntionByName(String name) { + int index = 0; + for (int i = 0; i < CalculateComboBox.CALCULATE_ARRAY.length; i++) { + if (ComparatorUtils.equals(name, CalculateComboBox.CALCULATE_ARRAY[i])) { + index = i; + } + } + try { + return (DataFunction) CalculateComboBox.CLASS_ARRAY[index].newInstance(); + } catch (InstantiationException e) { + FRLogger.getLogger().error("Function Error"); + } catch (IllegalAccessException e) { + FRLogger.getLogger().error("Function Error"); + } + return new NoneFunction(); + } + + /** + * 保存为新的ChartCollection + */ + public ChartCollection updateBean() { + return null; + } + + private void checkRow(int row) { + UITable table = seriesDataPane.getTable(); + Object object = table.getValueAt(row, 0); + if (object != null) { + table.setValueAt(object, row, 1); + } + } + + private class InnerTableEditor extends UITableEditor { + private JComponent editorComponent; + + @Override + public Object getCellEditorValue() { + if (editorComponent instanceof UIComboBox) { + return ((UIComboBox) editorComponent).getSelectedItem(); + } else if (editorComponent instanceof UITextField) { + return ((UITextField) editorComponent).getText(); + } else if (editorComponent instanceof CalculateComboBox) { + return ((CalculateComboBox) editorComponent).getSelectedItem(); + } + return super.getCellEditorValue(); + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, final int row, int column) { + + switch (column) { + case 0: + return createComboxEdit(row, value); + case 1: + return createTextEdit(value); + default: + CalculateComboBox calculateComboBox = new CalculateComboBox(); + if (value != null) { + calculateComboBox.setSelectedItem(value); + } + calculateComboBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + fireStop(); + } + }); + editorComponent = calculateComboBox; + return calculateComboBox; + } + } + + private UIComboBox createComboxEdit(final int row, Object value) { + UIComboBox uiComboBox = new UIComboBox(field.toArray()); + + uiComboBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + fireStop(); + checkRow(row); + seriesDataPane.fireTargetChanged(); + } + }); + editorComponent = uiComboBox; + + if (value != null && StringUtils.isNotEmpty(value.toString())) { + uiComboBox.getModel().setSelectedItem(value); + } else { + uiComboBox.getModel().setSelectedItem(value); + } + + return uiComboBox; + } + + private UITextField createTextEdit(Object value) { + UITextField uiTextField = new UITextField(); + editorComponent = uiTextField; + if (value != null) { + uiTextField.setText(value.toString()); + } + + uiTextField.registerChangeListener(new UIObserverListener() { + @Override + public void doChange() { + seriesDataPane.fireTargetChanged();// kunsnat: 不能停止编辑, 因为输入会中断. + } + }); + + return uiTextField; + } + } + + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java new file mode 100644 index 000000000..f068bbbdd --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java @@ -0,0 +1,279 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.OneValueCDDefinition; +import com.fr.data.util.function.AbstractDataFunction; +import com.fr.data.util.function.NoneFunction; +import com.fr.design.beans.FurtherBasicBeanPane; +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.data.CalculateComboBox; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.List; + +/** + * 属性表 数据集 系列名使用 系列值 界面. + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-26 下午03:29:53 + */ +public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane { + private UIComboBox seriesName; + private UIComboBox seriesValue; + private CalculateComboBox calculateCombox; + private JPanel centerPane; + private boolean isNeedSummary = true; + + public SeriesNameUseFieldValuePane() { + seriesName = new UIComboBox(); + seriesValue = new UIComboBox(); + calculateCombox = new CalculateComboBox(); + calculateCombox.reset(); + isNeedSummary = true; + seriesName.setPreferredSize(new Dimension(100, 75)); + seriesValue.setPreferredSize(new Dimension(100, 75)); + calculateCombox.setPreferredSize(new Dimension(100, 75)); + seriesName.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (seriesName.getSelectedItem() != null) { + seriesName.setToolTipText(seriesName.getSelectedItem().toString()); + } else { + seriesName.setToolTipText(null); + } + } + + }); + + seriesValue.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + calculateCombox.setEnabled(seriesValue.getSelectedItem() != null); + if (seriesValue.getSelectedItem() != null) { + seriesValue.setToolTipText(seriesValue.getSelectedItem().toString()); + } else { + seriesValue.setToolTipText(null); + } + } + }); + initCenterPane(); + } + + private void initCenterPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p, p, p, p}; + UILabel Label1 = new UILabel(Inter.getLocText("Chart-Series_Name") + ":", SwingConstants.RIGHT); + Label1.setPreferredSize(new Dimension(75, 20)); + UILabel Label2 = new UILabel(Inter.getLocText("Chart-Series_Value") + ":", SwingConstants.RIGHT); + Label2.setPreferredSize(new Dimension(75, 20)); + UILabel Label3 = new UILabel(Inter.getLocText("Chart-Summary_Method") + ":", SwingConstants.RIGHT); + Label3.setPreferredSize(new Dimension(75, 20)); + Component[][] components = new Component[][]{ + new Component[]{GUICoreUtils.createBorderLayoutPane(new Component[]{seriesName, null, null, Label1, null})}, + new Component[]{GUICoreUtils.createBorderLayoutPane(new Component[]{seriesValue, null, null, Label2, null})}, + new Component[]{GUICoreUtils.createBorderLayoutPane(new Component[]{calculateCombox, null, null, Label3, null})}, + new Component[]{new JSeparator()}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Data_Filter"))}, + }; + + centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 6); + centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); + this.setLayout(new BorderLayout()); + this.add(centerPane, BorderLayout.CENTER); + } + + private void initCenterPaneWithOutCaculateSummary(){ + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p, p, p}; + UILabel Label1 = new UILabel(Inter.getLocText("Chart-Series_Name") + ":", SwingConstants.RIGHT); + Label1.setPreferredSize(new Dimension(75, 20)); + UILabel Label2 = new UILabel(Inter.getLocText("Chart-Series_Value") + ":", SwingConstants.RIGHT); + Label2.setPreferredSize(new Dimension(75, 20)); + UILabel Label3 = new UILabel(Inter.getLocText("Chart-Summary_Method") + ":", SwingConstants.RIGHT); + Label3.setPreferredSize(new Dimension(75, 20)); + Component[][] components = new Component[][]{ + new Component[]{GUICoreUtils.createBorderLayoutPane(new Component[]{seriesName, null, null, Label1, null})}, + new Component[]{GUICoreUtils.createBorderLayoutPane(new Component[]{seriesValue, null, null, Label2, null})}, + new Component[]{new JSeparator()}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Data_Filter"))}, + }; + + centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 6); + centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); + this.setLayout(new BorderLayout()); + this.add(centerPane, BorderLayout.CENTER); + } + + /** + * 检查box是否已经使用. + * @param hasUse 是否使用 + */ + public void checkUse(boolean hasUse) { + seriesName.setEnabled(hasUse); + seriesValue.setEnabled(hasUse); + calculateCombox.setEnabled(seriesValue.getSelectedItem() != null); + } + + /** + * 数据集变更时, 刷新Box选中项 + * @param list 列表 + */ + public void refreshBoxListWithSelectTableData(List list) { + refreshBoxItems(seriesName, list); + refreshBoxItems(seriesValue, list); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList(){ + clearBoxItems(seriesName); + clearBoxItems(seriesValue); + } + + private void clearBoxItems(UIComboBox box){ + if(box != null){ + box.removeAllItems(); + } + } + + private boolean boxItemsContainsObject(UIComboBox box,Object item){ + if(box == null){ + return false; + } + + ComboBoxModel dataModel = box.getModel(); + for (int i = 0; i < dataModel.getSize(); i++) { + if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){ + return true; + } + } + return false; + } + + private void refreshBoxItems(UIComboBox box, List list) { + if (box == null) { + return; + } + + Object ob = box.getSelectedItem(); + box.removeAllItems(); + + int length = list.size(); + for (int i = 0; i < length; i++) { + box.addItem(list.get(i)); + } + + box.getModel().setSelectedItem(ob); + } + + /** + * 判断界面是否接受 + * @param ob 接受的对象 + * @return 判断是否接受 + */ + public boolean accept(Object ob) { + ChartCollection collection = (ChartCollection) ob; + return collection.getSelectedChart().getFilterDefinition() instanceof OneValueCDDefinition; + } + + /** + * 界面标题. + * @return 界面标题 + */ + public String title4PopupWindow() { + return Inter.getLocText(new String[]{"Use", "Field", "Value"}); + } + + /** + * 重置 + */ + public void reset() { + + } + + /** + * 重新布局整个面板 + * @param isNeedSummary 是否需要汇总 + */ + public void relayoutPane(boolean isNeedSummary){ + if(this.isNeedSummary != isNeedSummary){ + this.remove(centerPane); + if(isNeedSummary){ + initCenterPane(); + }else{ + initCenterPaneWithOutCaculateSummary(); + } + this.validate(); + this.isNeedSummary = isNeedSummary; + } + } + + public void populateBean(ChartCollection ob , boolean isNeedSummary){ + relayoutPane(isNeedSummary); + TopDefinitionProvider topDefinition = ob.getSelectedChart().getFilterDefinition(); + if (topDefinition instanceof OneValueCDDefinition) { + OneValueCDDefinition oneDefinition = (OneValueCDDefinition) topDefinition; + seriesName.setEditable(true); + seriesName.setSelectedItem(this.boxItemsContainsObject(seriesName,oneDefinition.getSeriesColumnName()) + ? oneDefinition.getSeriesColumnName() : null); + seriesName.setEditable(false); + seriesValue.setEditable(true); + seriesValue.setSelectedItem(this.boxItemsContainsObject(seriesValue,oneDefinition.getValueColumnName()) + ? oneDefinition.getValueColumnName() : null); + seriesValue.setEditable(false); + if(this.isNeedSummary){ + calculateCombox.populateBean((AbstractDataFunction) oneDefinition.getDataFunction()); + } + } + } + + /** + * 更新界面内容: 字段值 + */ + public void populateBean(ChartCollection ob) { + populateBean(ob,true); + } + + /** + * 保存界面内容 字段值 + */ + public void updateBean(ChartCollection collection) { + OneValueCDDefinition oneDefinition = new OneValueCDDefinition(); + + String seriesName = (String) this.seriesName.getSelectedItem(); + oneDefinition.setSeriesColumnName(seriesName); + String valueName = (String) this.seriesValue.getSelectedItem(); + oneDefinition.setValueColumnName(valueName); + if(this.isNeedSummary){ + oneDefinition.setDataFunction(calculateCombox.updateBean()); + }else{ + oneDefinition.setDataFunction(new NoneFunction()); + } + collection.getSelectedChart().setFilterDefinition(oneDefinition); + } + + /** + * 保存界面属性 新的ChartCollection + */ + public ChartCollection updateBean() { + return null; + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java new file mode 100644 index 000000000..419af6bf3 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java @@ -0,0 +1,158 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartdata.MoreNameCDDefinition; +import com.fr.chart.chartdata.OneValueCDDefinition; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +/** + * 属性表: 柱形, 饼图 数据集界面, "系列名使用"界面. + * + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-26 下午03:17:08 + */ +public class SeriesTypeUseComboxPane extends UIComboBoxPane { + + private SeriesNameUseFieldValuePane nameFieldValuePane; + private SeriesNameUseFieldNamePane nameFieldNamePane; + + private ChartDataFilterPane dataScreeningPane; + + private ChartDataPane parent; + private Plot initplot; + private boolean isNeedSummary = true; + + public SeriesTypeUseComboxPane(ChartDataPane parent, Plot initplot) { + this.initplot = initplot; + this.parent = parent; + cards = initPaneList(); + this.isNeedSummary = true; + initComponents(); + } + + protected void initLayout() { + this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); + JPanel northPane = new JPanel(new BorderLayout(4, 0)); + UILabel label1 = new UILabel(Inter.getLocText("ChartF-Series_Name_From") + ":", SwingConstants.RIGHT); + label1.setPreferredSize(new Dimension(75, 20)); + northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); + this.add(northPane, BorderLayout.NORTH); + this.add(cardPane, BorderLayout.CENTER); + this.add(dataScreeningPane = new ChartDataFilterPane(this.initplot, parent), BorderLayout.SOUTH); + } + + /** + * 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用 + * @param hasUse 是否使用 + */ + public void checkUseBox(boolean hasUse) { + jcb.setEnabled(hasUse); + nameFieldValuePane.checkUse(hasUse); + dataScreeningPane.checkBoxUse(); + } + + /** + * 切换 变更数据集时, 刷新Box选中项目 + * @param list 列表 + */ + public void refreshBoxListWithSelectTableData(List list) { + nameFieldValuePane.refreshBoxListWithSelectTableData(list); + nameFieldNamePane.refreshBoxListWithSelectTableData(list); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList(){ + nameFieldValuePane.clearAllBoxList(); + nameFieldNamePane.clearAllBoxList(); + } + + /** + * 界面标题 + * @return 界面标题 + */ + protected String title4PopupWindow() { + return Inter.getLocText("ChartF-Series_Name_From"); + } + + @Override + protected List> initPaneList() { + nameFieldValuePane = new SeriesNameUseFieldValuePane(); + nameFieldNamePane = new SeriesNameUseFieldNamePane(); + List> paneList = new ArrayList>(); + paneList.add(nameFieldValuePane); + paneList.add(nameFieldNamePane); + return paneList; + } + + public void populateBean(ChartCollection ob, boolean isNeedSummary) { + this.isNeedSummary = isNeedSummary; + TopDefinitionProvider definition = ob.getSelectedChart().getFilterDefinition(); + if (definition instanceof OneValueCDDefinition) { + this.setSelectedIndex(0); + nameFieldValuePane.populateBean(ob, isNeedSummary); + } else if (definition instanceof MoreNameCDDefinition) { + this.setSelectedIndex(1); + nameFieldNamePane.populateBean(ob, isNeedSummary); + } + dataScreeningPane.populateBean(ob, isNeedSummary); + } + + /** + * 重新布局整个面板 + * @param isNeedSummary 是否需要汇总 + */ + public void relayoutPane(boolean isNeedSummary) { + this.isNeedSummary = isNeedSummary; + if (jcb.getSelectedIndex() == 0) { + nameFieldValuePane.relayoutPane(this.isNeedSummary); + } else { + nameFieldNamePane.relayoutPane(this.isNeedSummary); + } + dataScreeningPane.relayoutPane(this.isNeedSummary); + } + + + @Override + protected void comboBoxItemStateChanged() { + if (jcb.getSelectedIndex() == 0) { + nameFieldValuePane.relayoutPane(this.isNeedSummary); + } else { + nameFieldNamePane.relayoutPane(this.isNeedSummary); + } + } + + public void populateBean(ChartCollection ob) { + this.populateBean(ob, true); + } + + /** + * 保存界面属性到Ob-ChartCollection + */ + public void updateBean(ChartCollection ob) { + if (this.getSelectedIndex() == 0) { + nameFieldValuePane.updateBean(ob); + } else { + nameFieldNamePane.updateBean(ob); + } + + dataScreeningPane.updateBean(ob); + } + +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/StockPlotTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/StockPlotTableDataContentPane.java new file mode 100644 index 000000000..fa9489794 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/StockPlotTableDataContentPane.java @@ -0,0 +1,197 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import com.fr.base.Utils; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.StockPlot; +import com.fr.chart.chartdata.StockLabel; +import com.fr.chart.chartdata.StockTableDefinition; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.mainframe.chart.gui.UIEditLabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.util.List; + +/** + * 股价图 属性表 数据集 数据界面 + * @author kunsnat E-mail:kunsnat@gmail.com + * @version 创建时间:2012-12-19 下午04:38:28 + */ +public class StockPlotTableDataContentPane extends AbstractTableDataContentPane { + + private static final String TIMEAXIS = Inter.getLocText("Chart-Horizontal_TimeAxis"); + private static final int LABEL_WIDTH = 105; + + private UIComboBox axisBox; + private UIComboBox volumeBox; + private UIComboBox openBox; + private UIComboBox highBox; + private UIComboBox lowBox; + private UIComboBox closeBox; + + private UIEditLabel volumeLabel = new UIEditLabel(StockLabel.VOLUMEN,SwingConstants.RIGHT){ + protected void doAfterMousePress(){ + clearBackGround(); + } + }; + private UIEditLabel openLabel = new UIEditLabel(StockLabel.OPEN,SwingConstants.RIGHT){ + protected void doAfterMousePress(){ + clearBackGround(); + } + }; + private UIEditLabel highLabel = new UIEditLabel(StockLabel.HIGHT,SwingConstants.RIGHT){ + protected void doAfterMousePress(){ + clearBackGround(); + } + }; + private UIEditLabel lowLabel = new UIEditLabel(StockLabel.LOW,SwingConstants.RIGHT){ + protected void doAfterMousePress(){ + clearBackGround(); + } + }; + private UIEditLabel closeLabel = new UIEditLabel(StockLabel.CLOSE,SwingConstants.RIGHT){ + protected void doAfterMousePress(){ + clearBackGround(); + } + }; + + public StockPlotTableDataContentPane(ChartDataPane parent) {// TODO 更改统一的定义模式: 原先的坏处: 名字不容易很属性对应 + this.setLayout(new BorderLayout()); + + axisBox = new UIComboBox(); + volumeBox = new UIComboBox(); + openBox = new UIComboBox(); + highBox = new UIComboBox(); + lowBox = new UIComboBox(); + closeBox = new UIComboBox(); + + //ember:为了英文版正常显示将下拉框宽度从100改成了80 + axisBox.setPreferredSize(new Dimension(90, 20)); + volumeBox.setPreferredSize(new Dimension(90, 20)); + openBox.setPreferredSize(new Dimension(90, 20)); + highBox.setPreferredSize(new Dimension(90, 20)); + lowBox.setPreferredSize(new Dimension(90, 20)); + closeBox.setPreferredSize(new Dimension(90, 20)); + + double p = TableLayout.PREFERRED; + double[] columnSize = {LABEL_WIDTH,p}; + double[] rowSize = { p, p,p,p,p,p,p, p, p}; + + Component[][] components = new Component[][]{ + new Component[]{new BoldFontTextLabel(TIMEAXIS+":",SwingConstants.RIGHT),axisBox}, + new Component[]{volumeLabel,volumeBox}, + new Component[]{openLabel,openBox}, + new Component[]{highLabel,highBox}, + new Component[]{lowLabel,lowBox}, + new Component[]{closeLabel,closeBox} , + + } ; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + this.add(panel,BorderLayout.CENTER); + + volumeBox.addItem(StockPlot.NONE); + openBox.addItem(StockPlot.NONE); + + axisBox.addItemListener(tooltipListener); + volumeBox.addItemListener(tooltipListener); + openBox.addItemListener(tooltipListener); + highBox.addItemListener(tooltipListener); + lowBox.addItemListener(tooltipListener); + closeBox.addItemListener(tooltipListener); + } + + + private void clearBackGround(){ + volumeLabel.resetNomalrBackground(); + openLabel.resetNomalrBackground(); + highLabel.resetNomalrBackground(); + lowLabel.resetNomalrBackground(); + closeLabel.resetNomalrBackground(); + } + + protected void refreshBoxListWithSelectTableData(List list) { + refreshBoxItems(axisBox, list); + refreshBoxItems(volumeBox, list); + refreshBoxItems(openBox, list); + refreshBoxItems(highBox, list); + refreshBoxItems(lowBox, list); + refreshBoxItems(closeBox, list); + + volumeBox.addItem(StockPlot.NONE); + openBox.addItem(StockPlot.NONE); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList(){ + clearBoxItems(axisBox); + clearBoxItems(volumeBox); + clearBoxItems(openBox); + clearBoxItems(highBox); + clearBoxItems(lowBox); + clearBoxItems(closeBox); + + volumeBox.addItem(StockPlot.NONE); + openBox.addItem(StockPlot.NONE); + } + + /** + * 更新股价图 数据界面. + */ + public void populateBean(ChartCollection collection) { + if(collection == null) { + return; + } + + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if(definition instanceof StockTableDefinition) { + StockTableDefinition stock = (StockTableDefinition)definition; + + StockLabel stockLabel = stock.getStockLabel(); + volumeLabel.setText(stockLabel.getVolumeLabel()); + openLabel.setText(stockLabel.getOpenLabel()); + highLabel.setText(stockLabel.getHighLabel()); + lowLabel.setText(stockLabel.getLowLabel()); + closeLabel.setText(stockLabel.getLowLabel()); + + combineCustomEditValue(axisBox, stock.getCateTime()); + combineCustomEditValue(volumeBox, stock.getVolumnString()); + combineCustomEditValue(openBox, stock.getOpenString()); + combineCustomEditValue(highBox, stock.getHighString()); + combineCustomEditValue(lowBox, stock.getLowString()); + combineCustomEditValue(closeBox, stock.getCloseString()); + } + } + + @Override + public void updateBean(ChartCollection ob) { + if(ob != null) { + StockTableDefinition stock = new StockTableDefinition(); + ob.getSelectedChart().setFilterDefinition(stock); + + stock.setStockLabels(new StockLabel(volumeLabel.getText(),openLabel.getText(),highLabel.getText(),lowLabel.getText(),closeLabel.getText())); + + stock.setCateTime(Utils.objectToString(axisBox.getSelectedItem())); + stock.setVolumnString(Utils.objectToString(volumeBox.getSelectedItem())); + stock.setOpenString(Utils.objectToString(openBox.getSelectedItem())); + stock.setHighString(Utils.objectToString(highBox.getSelectedItem())); + stock.setLowString(Utils.objectToString(lowBox.getSelectedItem())); + stock.setCloseString(Utils.objectToString(closeBox.getSelectedItem())); + + StockLabel stockLabel = stock.getStockLabel(); + volumeLabel.setText(stockLabel.getVolumeLabel()); + openLabel.setText(stockLabel.getOpenLabel()); + highLabel.setText(stockLabel.getHighLabel()); + lowLabel.setText(stockLabel.getLowLabel()); + closeLabel.setText(stockLabel.getCloseLabel()); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/XYScatterPlotTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/XYScatterPlotTableDataContentPane.java new file mode 100644 index 000000000..c27b4322c --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/XYScatterPlotTableDataContentPane.java @@ -0,0 +1,153 @@ +package com.fr.design.mainframe.chart.gui.data.table; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.XYScatterPlot; +import com.fr.chart.chartdata.ScatterTableDefinition; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +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.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; + +/** + * 属性表 数据界面 散点图 数据集数据界面. +* @author kunsnat E-mail:kunsnat@gmail.com +* @version 创建时间:2012-12-27 下午04:12:59 + */ +public class XYScatterPlotTableDataContentPane extends AbstractTableDataContentPane{ + + private UIComboBox seriesName; + private UIComboBox xCombox; + private UIComboBox yCombox; + + private ChartDataFilterPane dataScreeningPane; + + public XYScatterPlotTableDataContentPane(ChartDataPane parent) { + seriesName = new UIComboBox(); + xCombox = new UIComboBox(); + yCombox = new UIComboBox(); + dataScreeningPane = new ChartDataFilterPane(new XYScatterPlot(), parent); + + seriesName.addItem(Inter.getLocText("Chart-Use_None")); + + seriesName.setPreferredSize(new Dimension(100, 20)); + xCombox.setPreferredSize(new Dimension(100, 20)); + yCombox.setPreferredSize(new Dimension(100, 20)); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = { p,f}; + double[] rowSize = { p,p,p,p,p,p}; + + Component[][] components = new Component[][]{ + new Component[]{new BoldFontTextLabel(" " + Inter.getLocText("Chart-Series_Name") + ":"),seriesName}, + new Component[]{new BoldFontTextLabel(" " + Inter.getLocText("Chart-Scatter_Name") + "x" + ":"), xCombox}, + new Component[]{new BoldFontTextLabel(" " + Inter.getLocText("Chart-Scatter_Name") + "y" + ":"), yCombox}, + new Component[]{new JSeparator(),null}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Data_Filter"))}, + new Component[]{dataScreeningPane,null} + }; + + 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); + } + + /** + * 联动 box是否可用. + * @param hasUse 是否使用. + */ + public void checkBoxUse(boolean hasUse) { + seriesName.setEnabled(hasUse); + xCombox.setEnabled(hasUse); + yCombox.setEnabled(hasUse); + } + + protected void refreshBoxListWithSelectTableData(List columnNameList) { + refreshBoxItems(seriesName, columnNameList); + seriesName.addItem(Inter.getLocText("Chart-Use_None")); + refreshBoxItems(xCombox, columnNameList); + refreshBoxItems(yCombox, columnNameList); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList(){ + clearBoxItems(seriesName); + seriesName.addItem(Inter.getLocText("Chart-Use_None")); + clearBoxItems(xCombox); + clearBoxItems(yCombox); + } + + /** + * 保存散点图 的数据集数据界面. + */ + public void updateBean(ChartCollection collection) { + + ScatterTableDefinition definition = new ScatterTableDefinition(); + collection.getSelectedChart().setFilterDefinition(definition); + + Object resultName = seriesName.getSelectedItem(); + Object resultX = xCombox.getSelectedItem(); + Object resultY = yCombox.getSelectedItem(); + + if(resultName == null || ArrayUtils.contains(ChartConstants.NONE_KEYS, resultName)) { + definition.setSeriesName(StringUtils.EMPTY); + } else { + definition.setSeriesName(resultName.toString()); + } + + if(resultX != null) { + definition.setScatterX(resultX.toString()); + } + + if(resultY != null) { + definition.setScatterY(resultY.toString()); + } + + dataScreeningPane.updateBean(collection); + } + + /** + * 更新散点图的数据集数据. + */ + public void populateBean(ChartCollection collection) { + TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); + if(top instanceof ScatterTableDefinition) { + ScatterTableDefinition definition = (ScatterTableDefinition)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.getScatterX()); + combineCustomEditValue(yCombox, definition.getScatterY()); + } + dataScreeningPane.populateBean(collection); + } + + /** + * 重新布局 + */ + public void redoLayoutPane(){ + dataScreeningPane.relayoutPane(this.isNeedSummaryCaculateMethod()); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartConditionAttrPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartConditionAttrPane.java new file mode 100644 index 000000000..79d315e3d --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartConditionAttrPane.java @@ -0,0 +1,84 @@ +package com.fr.design.mainframe.chart.gui.other; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.CustomPlot; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.chart.chartglyph.CustomAttr; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.gui.frpane.UICorrelationComboBoxPane; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.general.Inter; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +public class ChartConditionAttrPane extends BasicScrollPane { + private static final long serialVersionUID = 5725969986029470291L; + private UICorrelationComboBoxPane conditionPane; + + public ChartConditionAttrPane() { + super(); + } + + @Override + protected JPanel createContentPane() { + if (conditionPane == null) { + conditionPane = new UICorrelationComboBoxPane(); + } + + return conditionPane; + } + + /** + * 面板标题 + * @return 标题 + */ + public String title4PopupWindow() { + return Inter.getLocText("Chart-Condition_Display"); + } + + @Override + public void populateBean(Chart chart) { + Plot plot = chart.getPlot(); + Class showPane = ChartTypeInterfaceManager.getInstance().getPlotConditionPane(chart.getPlot()).getClass(); + List list = new ArrayList(); + + if(plot instanceof CustomPlot) { + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Condition_Attributes"), new CustomAttr(), showPane)); + } else { + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Condition_Attributes"), new ConditionAttr(), showPane)); + } + + conditionPane.refreshMenuAndAddMenuAction(list); + + ConditionCollection collection = chart.getPlot().getConditionCollection(); + List valueList = new ArrayList(); + + for(int i = 0; i < collection.getConditionAttrSize(); i++) { + valueList.add(new UIMenuNameableCreator(collection.getConditionAttr(i).getName(), collection.getConditionAttr(i), showPane)); + } + + conditionPane.populateBean(valueList); + conditionPane.doLayout(); + } + + @Override + public void updateBean(Chart chart) { + List list = conditionPane.updateBean(); + + ConditionCollection cc = chart.getPlot().getConditionCollection(); + + cc.clearConditionAttr(); + for(int i = 0; i < list.size(); i++) { + UIMenuNameableCreator nameMenu = list.get(i); + ConditionAttr ca = (ConditionAttr)nameMenu.getObj(); + ca.setName(nameMenu.getName()); + cc.addConditionAttr(ca); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerConditionAttrPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerConditionAttrPane.java new file mode 100644 index 000000000..ff05b6ba2 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerConditionAttrPane.java @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.chart.gui.other; + +/** + * Created by IntelliJ IDEA. + * Author : DAISY + * Version: 6.5.6 + * Date: 14-10-16 + * Time: 下午2:17 + */ +public class ChartDesignerConditionAttrPane extends ChartConditionAttrPane { +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerInteractivePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerInteractivePane.java new file mode 100644 index 000000000..c655e0800 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerInteractivePane.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.chart.gui.other; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartdata.TopDefinition; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.design.mainframe.chart.gui.ChartOtherPane; +import com.fr.general.Inter; +import com.fr.js.*; +import com.fr.third.org.hsqldb.lib.HashMap; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 6.5.6 + * Date: 14-10-16 + * Time: 下午2:12 + */ +public class ChartDesignerInteractivePane extends ChartInteractivePane { + public ChartDesignerInteractivePane(ChartOtherPane parent) { + super(parent); + } + + protected List refreshList(HashMap map) { + List list = new ArrayList(); + + list.add(new UIMenuNameableCreator(Inter.getLocText("Hyperlink-Web_link"), + new WebHyperlink(), getUseMap(map, WebHyperlink.class))); + list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); + list.add(new UIMenuNameableCreator(Inter.getLocText("RelatedChart"),null,null)); + + return list; + } + + protected void populateAutoRefresh(Chart chart){ + super.populateAutoRefresh(chart); + if(chart.getFilterDefinition() != null){ + TopDefinition definition = (TopDefinition)chart.getFilterDefinition(); + isAutoRefresh.setEnabled(definition.isSupportAutoRefresh()); + if(!isAutoRefresh.isEnabled()){ + isAutoRefresh.setSelected(false); + } + autoRefreshTime.setEnabled(definition.isSupportAutoRefresh()); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java new file mode 100644 index 000000000..f8b002bcf --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java @@ -0,0 +1,1068 @@ +package com.fr.design.mainframe.chart.gui.other; + +import com.fr.base.CoreDecimalFormat; +import com.fr.base.Style; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.base.AttrContents; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.base.TimeSwitchAttr; +import com.fr.chart.chartattr.*; +import com.fr.chart.chartdata.GisMapReportDefinition; +import com.fr.chart.chartdata.GisMapTableDefinition; +import com.fr.chart.web.ChartHyperPoplink; +import com.fr.chart.web.ChartHyperRelateCellLink; +import com.fr.chart.web.ChartHyperRelateFloatLink; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.javascript.ChartEmailPane; +import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; +import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkPane; +import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane; +import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.UIBubbleFloatPane; +import com.fr.design.gui.frpane.UICorrelationComboBoxPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.style.FormatPane; +import com.fr.design.hyperlink.ReportletHyperlinkPane; +import com.fr.design.hyperlink.WebHyperlinkPane; +import com.fr.design.javascript.JavaScriptImplPane; +import com.fr.design.javascript.ParameterJavaScriptPane; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartOtherPane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; +import com.fr.js.*; +import com.fr.stable.Constants; +import com.fr.stable.StringUtils; +import com.fr.stable.bridge.StableFactory; +import com.fr.third.org.hsqldb.lib.HashMap; +import com.fr.third.org.hsqldb.lib.Iterator; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.text.DecimalFormat; +import java.text.Format; +import java.util.ArrayList; +import java.util.List; + +public class ChartInteractivePane extends BasicScrollPane implements UIObserver{ + private static final long serialVersionUID = 3477409806918835992L; + private static HashMap normalMap = new HashMap(); + private static HashMap gisMap = new HashMap(); + private static HashMap mapMap = new HashMap(); + private static HashMap pieMap = new HashMap(); + + private static HashMap xyMap = new HashMap(); + private static HashMap bubbleMap = new HashMap(); + private static HashMap stockMap = new HashMap(); + private static HashMap ganttMap = new HashMap(); + private static HashMap meterMap = new HashMap(); + + private static final int TIME_SWITCH_GAP = 40; + + private UICheckBox isChartAnimation;// 动态 + private UICheckBox isSeriesDragEnable; //系列拖拽 + + private UICheckBox isAxisZoom;// 缩放 + + private UICheckBox isDatapointValue;// 数据点提示 + private UIButton dataPointValueFormat; + + private UICheckBox isDatapointPercent; + private UIButton dataPointPercentFormat; + + private UILabel tooltipStyleLabel; + private UIComboBox tooltipStyle; + + private UILabel tooltipShowTypeLabel; + private UIComboBox tooltipShowType; + + private UICheckBox isAddressTittle; + private UICheckBox isAddress; + private UICheckBox isAddressName; + + private UICheckBox isAxisShowToolTip;// 坐标轴提示 + + protected UICheckBox isAutoRefresh;// 自动刷新 + protected UISpinner autoRefreshTime; + + private UICorrelationComboBoxPane superLink;// 超链 + + private FormatPane valueFormatPane; + private FormatPane percentFormatPane; + private Format valueFormat; + private Format percentFormat; + + private JPanel tooltipPane; + private JPanel axisShowPane; + private JPanel autoRefreshPane; + private JPanel superlinkPane; + + private ChartOtherPane parent; + + private UICheckBox timeSwitch; + + private JPanel timeSwitchContainer; + private TimeSwitchPane timeSwitchPane; + + private static final int SIZEX = 258; + private static final int SIZEY = 209; + private static final int DET = 20; + public ChartInteractivePane(ChartOtherPane parent) { + super(); + this.parent = parent; + } + + /** + * 界面标题. + * @return 返回标题. + */ + public String title4PopupWindow() { + return Inter.getLocText("Chart-Interactive_Tab"); + } + + @Override + protected JPanel createContentPane() { + isChartAnimation = new UICheckBox(Inter.getLocText("Chart-Animation_JSShow")); + isSeriesDragEnable = new UICheckBox(Inter.getLocText("Chart-Series_Drag")); + + isDatapointValue = new UICheckBox(Inter.getLocText("Chart-Use_Value")); + dataPointValueFormat = new UIButton(Inter.getLocText("Chart-Use_Format")); + isDatapointPercent = new UICheckBox(Inter.getLocText("Chart-Value_Percent")); + dataPointPercentFormat = new UIButton(Inter.getLocText("Chart-Use_Format")); + tooltipStyle = new UIComboBox(new String []{Inter.getLocText("Chart-White_Black"), Inter.getLocText("Chart-Black_White")}); + tooltipStyleLabel = new UILabel(Inter.getLocText("Chart-Style_Name")); + tooltipShowType = new UIComboBox(new String []{Inter.getLocText("Chart-Series_SingleData"), Inter.getLocText("Chart-Series_AllData")}); + tooltipShowTypeLabel = new UILabel(Inter.getLocText("Chart-Use_Show")); + + isAddressTittle = new UICheckBox(Inter.getLocText("Chart-Area_Title")); + isAddress = new UICheckBox(Inter.getLocText("Chart-Gis_Address")); + isAddressName = new UICheckBox(Inter.getLocText("Chart-Address_Name")); + + isAxisShowToolTip = new UICheckBox(Inter.getLocText("Chart-Interactive_AxisTooltip")); + isAxisZoom = new UICheckBox(Inter.getLocText("Chart-Use_Zoom")); + isAutoRefresh = new UICheckBox(Inter.getLocText(new String[]{"Chart-Use_Auto", "Chart-Use_Refresh"})); + autoRefreshTime = new UISpinner(1, Integer.MAX_VALUE, 1); + superLink = new UICorrelationComboBoxPane(); + + isAutoRefresh.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkAutoRefresh(); + } + }); + timeSwitch = new UICheckBox(Inter.getLocText("FR-Chart-Interactive_timeSwitch")); + timeSwitchPane = new TimeSwitchPane(); + initFormatListener(); + return initPaneWithListener(); + } + + + private void initFormatListener() { + initValueFormatListener(); + initPercentFormatListener(); + isAxisZoom.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + timeSwitch.setEnabled(isAxisZoom.isSelected()); + if(!isAxisZoom.isSelected()){ + timeSwitch.setSelected(false); + } + } + }); + + timeSwitch.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + relayoutTimeSwitchPane(); + } + }); + } + + private void initValueFormatListener() { + dataPointValueFormat.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (valueFormatPane == null) { + valueFormatPane = new FormatPane(); + } + Point comPoint = dataPointValueFormat.getLocationOnScreen(); + Point arrowPoint = new Point(comPoint.x - DET, comPoint.y + dataPointValueFormat.getHeight()); + UIBubbleFloatPane