|
|
|
@ -3,6 +3,8 @@ package com.fr.van.chart.designer.style.background;
|
|
|
|
|
import com.fr.chart.chartattr.Chart; |
|
|
|
|
import com.fr.chart.chartattr.Plot; |
|
|
|
|
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.design.mainframe.chart.PaneTitleConstants; |
|
|
|
@ -12,8 +14,10 @@ import com.fr.van.chart.designer.component.background.VanChartBackgroundPane;
|
|
|
|
|
import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; |
|
|
|
|
import com.fr.van.chart.designer.style.background.radar.VanChartRadarAxisAreaPane; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
|
|
//图表区|绘图区 边框和背景
|
|
|
|
@ -25,12 +29,13 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
|
|
|
|
|
private VanChartAxisAreaPane chartAxisAreaPane; |
|
|
|
|
|
|
|
|
|
private JPanel contentPane; |
|
|
|
|
private UILabel tooltipLabel; |
|
|
|
|
|
|
|
|
|
private boolean isPlot;//绘图区
|
|
|
|
|
|
|
|
|
|
private AbstractAttrNoScrollPane parent; |
|
|
|
|
|
|
|
|
|
public VanChartAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent){ |
|
|
|
|
public VanChartAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent) { |
|
|
|
|
super(); |
|
|
|
|
this.isPlot = isPlot; |
|
|
|
|
this.parent = parent; |
|
|
|
@ -50,14 +55,22 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
|
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double[] columnSize = { f }; |
|
|
|
|
double[] rowSize = {p,p,p}; |
|
|
|
|
double[] columnSize = {f}; |
|
|
|
|
double[] rowSize = {p, p, p}; |
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),chartBorderPane)}, |
|
|
|
|
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), chartBorderPane)}, |
|
|
|
|
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), chartBackgroundPane)}, |
|
|
|
|
}; |
|
|
|
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
|
|
|
contentPane.add(panel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
if (!isPlot) { |
|
|
|
|
tooltipLabel = new UILabel("<html>" + Toolkit.i18nText("Fine-Design_Chart_Background_Tooltip") + "</html>"); |
|
|
|
|
tooltipLabel.setForeground(Color.gray); |
|
|
|
|
tooltipLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 5, 10)); |
|
|
|
|
contentPane.add(tooltipLabel, BorderLayout.NORTH); |
|
|
|
|
tooltipLabel.setVisible(false); |
|
|
|
|
} |
|
|
|
|
return contentPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -68,11 +81,11 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
|
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double[] columnSize = { f }; |
|
|
|
|
double[] rowSize = {p,p,p}; |
|
|
|
|
double[] columnSize = {f}; |
|
|
|
|
double[] rowSize = {p, p, p}; |
|
|
|
|
Component[][] components; |
|
|
|
|
|
|
|
|
|
if(plot.isSupportBorder()){//有边框和背景
|
|
|
|
|
if (plot.isSupportBorder()) {//有边框和背景
|
|
|
|
|
|
|
|
|
|
chartAxisAreaPane = initAxisAreaPane(); |
|
|
|
|
|
|
|
|
@ -85,7 +98,7 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
|
|
|
contentPane.add(panel,BorderLayout.CENTER); |
|
|
|
|
contentPane.add(panel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
parent.initAllListeners(); |
|
|
|
|
} |
|
|
|
@ -96,7 +109,7 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
|
|
|
|
|
|
|
|
|
|
protected Component[][] initComponents() { |
|
|
|
|
return new Component[][]{ |
|
|
|
|
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),chartBorderPane)}, |
|
|
|
|
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), chartBorderPane)}, |
|
|
|
|
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), chartBackgroundPane)}, |
|
|
|
|
new Component[]{chartAxisAreaPane} |
|
|
|
|
}; |
|
|
|
@ -104,10 +117,11 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 标题 |
|
|
|
|
* |
|
|
|
|
* @return 标题 |
|
|
|
|
*/ |
|
|
|
|
public String title4PopupWindow() { |
|
|
|
|
if(isPlot){ |
|
|
|
|
if (isPlot) { |
|
|
|
|
return PaneTitleConstants.CHART_STYLE_AREA_PLOT_TITLE; |
|
|
|
|
} |
|
|
|
|
return PaneTitleConstants.CHART_STYLE_AREA_AREA_TITLE; |
|
|
|
@ -118,11 +132,11 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
|
|
|
|
|
if (chart == null) { |
|
|
|
|
chart = new Chart(); |
|
|
|
|
} |
|
|
|
|
if(isPlot){ |
|
|
|
|
if (isPlot) { |
|
|
|
|
Plot plot = chart.getPlot(); |
|
|
|
|
chartBorderPane.update(plot); |
|
|
|
|
chartBackgroundPane.update(plot); |
|
|
|
|
if(plot.isSupportIntervalBackground() && chartAxisAreaPane != null){ |
|
|
|
|
if (plot.isSupportIntervalBackground() && chartAxisAreaPane != null) { |
|
|
|
|
chartAxisAreaPane.updateBean(plot); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -133,12 +147,12 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void populateBean(Chart chart) { |
|
|
|
|
if(chart == null) { |
|
|
|
|
if (chart == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if(isPlot){ |
|
|
|
|
if (isPlot) { |
|
|
|
|
Plot plot = chart.getPlot(); |
|
|
|
|
if(plot.isSupportIntervalBackground()){ |
|
|
|
|
if (plot.isSupportIntervalBackground()) { |
|
|
|
|
//含有坐标轴相关设置,例如警戒线、网格线、间隔背景
|
|
|
|
|
if (chartAxisAreaPane == null) { |
|
|
|
|
refreshContentPane(plot); |
|
|
|
@ -157,4 +171,8 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
|
|
|
|
|
public Chart updateBean() { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void refreshTooltipLabel(boolean inForm) { |
|
|
|
|
tooltipLabel.setVisible(inForm); |
|
|
|
|
} |
|
|
|
|
} |