|
|
@ -12,13 +12,10 @@ import com.fr.design.utils.ComponentUtils; |
|
|
|
import com.fr.general.Background; |
|
|
|
import com.fr.general.Background; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
|
|
|
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
|
|
|
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
|
|
|
|
|
|
|
import com.fr.plugin.chart.base.AttrLabel; |
|
|
|
import com.fr.plugin.chart.base.AttrLabel; |
|
|
|
import com.fr.plugin.chart.base.VanChartTools; |
|
|
|
import com.fr.plugin.chart.base.VanChartTools; |
|
|
|
import com.fr.plugin.chart.column.VanChartColumnPlot; |
|
|
|
import com.fr.plugin.chart.column.VanChartColumnPlot; |
|
|
|
import com.fr.plugin.chart.line.VanChartLinePlot; |
|
|
|
|
|
|
|
import com.fr.plugin.chart.vanchart.VanChart; |
|
|
|
import com.fr.plugin.chart.vanchart.VanChart; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
@ -38,14 +35,9 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen |
|
|
|
private double scaleX = 1.0; |
|
|
|
private double scaleX = 1.0; |
|
|
|
private double scaleY = 1.0; |
|
|
|
private double scaleY = 1.0; |
|
|
|
private ChartPreStylePreView columnChartPane; |
|
|
|
private ChartPreStylePreView columnChartPane; |
|
|
|
private ChartPreStylePreView lineChartPane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int COLUMN_CHART_WIDTH = 297; |
|
|
|
private int COLUMN_CHART_WIDTH = 517; |
|
|
|
|
|
|
|
private int COLUMN_CHART_HEIGHT = 300; |
|
|
|
private int COLUMN_CHART_HEIGHT = 220; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final double CHART_SCALE = 0.6; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PredefinedStylePreviewPane() { |
|
|
|
public PredefinedStylePreviewPane() { |
|
|
|
this(1.0, 1.0); |
|
|
|
this(1.0, 1.0); |
|
|
@ -57,21 +49,17 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen |
|
|
|
this.setBackground(Color.WHITE); |
|
|
|
this.setBackground(Color.WHITE); |
|
|
|
this.elementCasePreview = new ElementCasePreview(); |
|
|
|
this.elementCasePreview = new ElementCasePreview(); |
|
|
|
this.add(initChartPreViewPane()); |
|
|
|
this.add(initChartPreViewPane()); |
|
|
|
this.elementCasePreview.setPreferredSize(new Dimension(517, 250)); |
|
|
|
this.elementCasePreview.setPreferredSize(new Dimension(517, 190)); |
|
|
|
this.add(this.elementCasePreview); |
|
|
|
this.add(this.elementCasePreview); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel initChartPreViewPane() { |
|
|
|
private JPanel initChartPreViewPane() { |
|
|
|
columnChartPane = new ChartPreStylePreView(initVanColumnChart(), CHART_SCALE, CHART_SCALE); |
|
|
|
columnChartPane = new ChartPreStylePreView(initVanColumnChart()); |
|
|
|
columnChartPane.setPreferredSize(new Dimension(COLUMN_CHART_WIDTH, COLUMN_CHART_HEIGHT)); |
|
|
|
columnChartPane.setPreferredSize(new Dimension(COLUMN_CHART_WIDTH, COLUMN_CHART_HEIGHT)); |
|
|
|
columnChartPane.setCallbackEvent(this); |
|
|
|
columnChartPane.setCallbackEvent(this); |
|
|
|
lineChartPane = new ChartPreStylePreView(initVanLineChart(), CHART_SCALE, CHART_SCALE); |
|
|
|
|
|
|
|
lineChartPane.setPreferredSize(new Dimension(220, 220)); |
|
|
|
|
|
|
|
lineChartPane.setCallbackEvent(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
|
|
|
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
|
|
|
panel.add(columnChartPane); |
|
|
|
panel.add(columnChartPane); |
|
|
|
panel.add(lineChartPane); |
|
|
|
|
|
|
|
return panel; |
|
|
|
return panel; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -79,12 +67,11 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen |
|
|
|
private ChartCollection initVanColumnChart() { |
|
|
|
private ChartCollection initVanColumnChart() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone(); |
|
|
|
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone(); |
|
|
|
chart.getTitle().setPosition(Constants.LEFT); |
|
|
|
|
|
|
|
VanChartTools vanChartTools = chart.getVanChartTools(); |
|
|
|
VanChartTools vanChartTools = chart.getVanChartTools(); |
|
|
|
vanChartTools.setSort(false); |
|
|
|
vanChartTools.setSort(false); |
|
|
|
vanChartTools.setExport(false); |
|
|
|
vanChartTools.setExport(false); |
|
|
|
vanChartTools.setFullScreen(false); |
|
|
|
vanChartTools.setFullScreen(false); |
|
|
|
VanChartPlot plot = chart.getPlot(); |
|
|
|
VanChartColumnPlot plot = chart.getPlot(); |
|
|
|
AttrLabel defaultAttrLabel = plot.getDefaultAttrLabel(); |
|
|
|
AttrLabel defaultAttrLabel = plot.getDefaultAttrLabel(); |
|
|
|
defaultAttrLabel.setEnable(true); |
|
|
|
defaultAttrLabel.setEnable(true); |
|
|
|
defaultAttrLabel.getAttrLabelDetail().getBorder().setBorderStyle(0); |
|
|
|
defaultAttrLabel.getAttrLabelDetail().getBorder().setBorderStyle(0); |
|
|
@ -92,30 +79,14 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen |
|
|
|
plot.getConditionCollection().getDefaultAttr().addDataSeriesCondition(defaultAttrLabel); |
|
|
|
plot.getConditionCollection().getDefaultAttr().addDataSeriesCondition(defaultAttrLabel); |
|
|
|
plot.getLegend().setLegendVisible(false); |
|
|
|
plot.getLegend().setLegendVisible(false); |
|
|
|
plot.getDataSheet().setVisible(true); |
|
|
|
plot.getDataSheet().setVisible(true); |
|
|
|
ChartCollection chartCollection = new ChartCollection(chart); |
|
|
|
|
|
|
|
return chartCollection; |
|
|
|
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//折线图
|
|
|
|
VanChartAxis defaultYAxis = plot.getDefaultYAxis(); |
|
|
|
private ChartCollection initVanLineChart() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartLinePlot.VAN_CHART_LINE_PLOT)[0].clone(); |
|
|
|
|
|
|
|
chart.getTitle().setPosition(Constants.LEFT); |
|
|
|
|
|
|
|
VanChartTools vanChartTools = chart.getVanChartTools(); |
|
|
|
|
|
|
|
vanChartTools.setSort(false); |
|
|
|
|
|
|
|
vanChartTools.setExport(false); |
|
|
|
|
|
|
|
vanChartTools.setFullScreen(false); |
|
|
|
|
|
|
|
VanChartLinePlot plot = chart.getPlot(); |
|
|
|
|
|
|
|
plot.getLegend().setPosition(Constants.TOP); |
|
|
|
|
|
|
|
VanChartAxis defaultXAxis = plot.getDefaultXAxis(); |
|
|
|
|
|
|
|
Title title = new Title(); |
|
|
|
Title title = new Title(); |
|
|
|
title.setTextObject(Toolkit.i18nText("Fine-Design_Chart_Category")); |
|
|
|
title.setTextObject(Toolkit.i18nText("Fine-Design_Chart_Axis_Title")); |
|
|
|
defaultXAxis.setTitle(title); |
|
|
|
title.getTextAttr().setRotation(-90); |
|
|
|
defaultXAxis.setShowAxisTitle(true); |
|
|
|
defaultYAxis.setTitle(title); |
|
|
|
|
|
|
|
defaultYAxis.setShowAxisTitle(true); |
|
|
|
|
|
|
|
|
|
|
|
ChartCollection chartCollection = new ChartCollection(chart); |
|
|
|
ChartCollection chartCollection = new ChartCollection(chart); |
|
|
|
return chartCollection; |
|
|
|
return chartCollection; |
|
|
|
} catch (Exception ex) { |
|
|
|
} catch (Exception ex) { |
|
|
@ -142,11 +113,9 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen |
|
|
|
background.paint(g, new Rectangle2D.Double(0, 0, 517, 500)); |
|
|
|
background.paint(g, new Rectangle2D.Double(0, 0, 517, 500)); |
|
|
|
this.columnChartPane.paintComponent(g); |
|
|
|
this.columnChartPane.paintComponent(g); |
|
|
|
|
|
|
|
|
|
|
|
g.translate(COLUMN_CHART_WIDTH, 0); |
|
|
|
g.translate(0, COLUMN_CHART_HEIGHT); |
|
|
|
this.lineChartPane.paintComponent(g); |
|
|
|
|
|
|
|
g.translate(-COLUMN_CHART_WIDTH, COLUMN_CHART_HEIGHT + 10); |
|
|
|
|
|
|
|
this.elementCasePreview.paintContent(g); |
|
|
|
this.elementCasePreview.paintContent(g); |
|
|
|
g.translate(0, -COLUMN_CHART_HEIGHT - 10); |
|
|
|
g.translate(0, -COLUMN_CHART_HEIGHT); |
|
|
|
// 恢复双缓冲
|
|
|
|
// 恢复双缓冲
|
|
|
|
ComponentUtils.resetBuffer(dbcomponents); |
|
|
|
ComponentUtils.resetBuffer(dbcomponents); |
|
|
|
|
|
|
|
|
|
|
@ -167,7 +136,6 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen |
|
|
|
public void refresh(PredefinedStyle style, boolean displayFormBackground) { |
|
|
|
public void refresh(PredefinedStyle style, boolean displayFormBackground) { |
|
|
|
elementCasePreview.refresh(style); |
|
|
|
elementCasePreview.refresh(style); |
|
|
|
columnChartPane.refresh(style); |
|
|
|
columnChartPane.refresh(style); |
|
|
|
lineChartPane.refresh(style); |
|
|
|
|
|
|
|
background = displayFormBackground ? style.getFormBackground().getBackground() : style.getReportBackground(); |
|
|
|
background = displayFormBackground ? style.getFormBackground().getBackground() : style.getReportBackground(); |
|
|
|
this.repaint(); |
|
|
|
this.repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|