Browse Source

CHART-10961 线型样式面板迭代 加组件&事件

persist/11.0
Wim.Zhai 5 years ago
parent
commit
9218230e79
  1. 19
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java
  2. 79
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java
  3. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java
  4. 114
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java
  5. 20
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/radar/VanChartRadarAxisAreaPane.java

19
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java

@ -33,6 +33,7 @@ public class VanChartLineTypePane extends BasicPane {
private UIButtonGroup nullValueBreak;//空值断开
private JPanel lineWidthPane;
private JPanel lineStylePane;
public VanChartLineTypePane() {
@ -42,13 +43,6 @@ public class VanChartLineTypePane extends BasicPane {
nullValueBreak = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")});
lineTypeComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkLineWidth();
}
});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
@ -62,11 +56,11 @@ public class VanChartLineTypePane extends BasicPane {
Arrays.fill(row, p);
double[] col = {f, e};
JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
lineStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
this.setLayout(new BorderLayout(0, 6));
this.add(typeAndWidthPane, BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER);
this.add(lineStylePane, BorderLayout.CENTER);
}
private JPanel createTypeAndWidthPane() {
@ -79,6 +73,7 @@ public class VanChartLineTypePane extends BasicPane {
@Override
public void actionPerformed(ActionEvent e) {
checkLineWidth();
checkLineStyle();
}
});
@ -124,6 +119,12 @@ public class VanChartLineTypePane extends BasicPane {
}
}
private void checkLineStyle() {
if (lineStylePane != null && lineTypeComboBox != null) {
lineStylePane.setVisible(!ComparatorUtils.equals(lineTypeComboBox.getSelectedItem(),LineType.NONE));
}
}
public void checkLarge(boolean large) {
if (large) {
lineTypeComboBox.setSelectedItem(LineType.NONE);

79
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java

@ -1,29 +1,29 @@
package com.fr.van.chart.designer.component;
import com.fr.chart.base.AttrColor;
import com.fr.chart.base.AttrLineStyle;
import com.fr.chart.base.LineStyleInfo;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.base.TrendLineType;
import com.fr.plugin.chart.base.VanChartAttrTrendLine;
import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.type.LineType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by Mitisky on 15/10/19.
@ -33,62 +33,90 @@ public class VanChartTrendLinePane extends BasicPane{
private UITextField trendLineName;
private ColorSelectBox trendLineColor;
private LineComboBox trendLineStyle;//线型
private LineTypeComboBox trendLineStyle;//线型
private UISpinner lineWidthSpinner;//线宽
private UIComboBox trendLineType;//趋势线函数类型
private UISpinner prePeriod;
private UISpinner afterPeriod;
private JPanel trendLineHidePane;
public VanChartTrendLinePane() {
this.setLayout(new BorderLayout());
initComponents();
}
private void initComponents(){
this.setLayout(new BorderLayout(0,6));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] row = {p,p,p,p,p,p};
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] col = {f, e};
trendLineName = new UITextField();
trendLineColor = new ColorSelectBox(100);
trendLineStyle = new LineComboBox(VanChartConstants.ALERT_LINE_STYLE);
trendLineStyle = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2);
trendLineType = new UIComboBox(TYPES);
prePeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
afterPeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
double[] r = {p, p};
double[] c = {f, p, f, p};
Component[][] periodComps = new Component[][]{
new Component[]{prePeriod, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cycle")), afterPeriod, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cycle"))},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TrendLine_Forward")), null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_After_Period")), null},
new Component[]{prePeriod, new UILabel(Toolkit.i18nText("Fine-Design_Chart_Cycle")), afterPeriod, new UILabel(Toolkit.i18nText("Fine-Design_Chart_Cycle"))},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_TrendLine_Forward")), null, new UILabel(Toolkit.i18nText("Fine-Design_Chart_After_Period")), null},
};
JPanel periodPane = TableLayoutHelper.createTableLayoutPane(periodComps, r, c);
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Period"));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Period"));
label.setVerticalAlignment(SwingConstants.TOP);
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Name")), trendLineName},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Name")), trendLineName},
new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(trendLineStyle)
}
};
Component[][] componentsMayHide = new Component[][]{
new Component[]{
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(trendLineStyle)
},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), trendLineColor},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), trendLineType},
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")),
UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), trendLineColor},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Type")), trendLineType},
new Component[]{label, periodPane}
};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p,p,p}, col);
trendLineHidePane = TableLayout4VanChartHelper.createGapTableLayoutPane(componentsMayHide, new double[]{p,p,p,p}, col);
trendLineStyle.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkHidePaneVisible();
}
});
checkHidePaneVisible();
this.add(panel, BorderLayout.CENTER);
this.add(trendLineHidePane, BorderLayout.SOUTH);
}
protected String title4PopupWindow(){
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TrendLine");
return Toolkit.i18nText("Fine-Design_Chart_TrendLine");
}
public void populate(VanChartAttrTrendLine trendLine) {
checkHidePaneVisible();
if(trendLine != null){
trendLineName.setText(trendLine.getTrendLineName());
LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo();
trendLineColor.setSelectObject(lineStyleInfo.getAttrLineColor().getSeriesColor());
trendLineStyle.setSelectedLineStyle(lineStyleInfo.getAttrLineStyle().getLineStyle());
trendLineStyle.setSelectedItem(lineStyleInfo.getAttrLineStyle().getLineType());
lineWidthSpinner.setValue(lineStyleInfo.getAttrLineStyle().getLineWidth());
trendLineType.setSelectedItem(trendLine.getTrendLineType());
prePeriod.setValue(trendLine.getPrePeriod());
afterPeriod.setValue(trendLine.getAfterPeriod());
@ -100,7 +128,8 @@ public class VanChartTrendLinePane extends BasicPane{
trendLine.setTrendLineName(trendLineName.getText());
LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo();
lineStyleInfo.setAttrLineStyle(new AttrLineStyle(trendLineStyle.getSelectedLineStyle()));
lineStyleInfo.getAttrLineStyle().setLineWidth(lineWidthSpinner.getValue());
lineStyleInfo.getAttrLineStyle().setLineType((LineType) trendLineStyle.getSelectedItem());
lineStyleInfo.setAttrLineColor(new AttrColor(trendLineColor.getSelectObject()));
trendLine.setTrendLineType((TrendLineType) trendLineType.getSelectedItem());
@ -110,4 +139,10 @@ public class VanChartTrendLinePane extends BasicPane{
return trendLine;
}
private void checkHidePaneVisible(){
if (trendLineHidePane != null && trendLineStyle != null){
trendLineHidePane.setVisible(trendLineStyle.getSelectedItem() != LineType.NONE);
}
}
}

21
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java

@ -5,9 +5,9 @@ import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
@ -16,12 +16,12 @@ import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.type.LineType;
import com.fr.stable.Constants;
import com.fr.stable.StableUtils;
import com.fr.van.chart.designer.component.LineTypeComboBox;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
@ -42,7 +42,8 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
private static final long serialVersionUID = -1208941770684286439L;
private UIButtonGroup alertAxis;
protected TinyFormulaPane alertValue;
protected LineComboBox alertLineStyle;
protected LineTypeComboBox alertLineStyle;//线型
private UISpinner lineWidthSpinner;//线宽
protected ColorSelectBox alertLineColor;
private UIButtonGroup alertTextPosition;
@ -63,7 +64,8 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
//設置大小,防止文本過長導致界面“變形”
alertValue.setPreferredSize(new Dimension(VALUE_WD, HT));
alertLineStyle = new LineComboBox(VanChartConstants.ALERT_LINE_STYLE);
alertLineStyle = new LineTypeComboBox(new LineType[]{LineType.NORMAL, LineType.DASH});
lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2);
alertLineColor = new ColorSelectBox(100);
alertTextPosition = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Top"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom")});
alertText = new TinyFormulaPane();
@ -95,7 +97,7 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
{
double p = TableLayout.PREFERRED;
double[] columnSize = {p,p};
double[] rowSize = {p,p,p,p};
double[] rowSize = {p,p,p,p,p};
Component[][] components = getTopPaneComponents();
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -106,6 +108,7 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),alertAxis},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value")),alertValue},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),alertLineStyle},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Width")), lineWidthSpinner},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),alertLineColor},
};
}
@ -154,7 +157,8 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
checkPositionPane();
alertValue.populateBean(Utils.objectToString(chartAlertValue.getAlertValueFormula()));
alertLineStyle.setSelectedLineStyle(chartAlertValue.getLineStyle().getLineStyle());
alertLineStyle.setSelectedItem(chartAlertValue.getLineStyle().getLineType());
lineWidthSpinner.setValue(chartAlertValue.getLineStyle().getLineWidth());
alertLineColor.setSelectObject(chartAlertValue.getLineColor().getSeriesColor());
if(VanChartAttrHelper.isXAxis(chartAlertValue.getAxisName())){
@ -178,7 +182,8 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
chartAlertValue.setAlertValueFormula(BaseFormula.createFormulaBuilder().build(alertValue.updateBean()));
chartAlertValue.getLineColor().setSeriesColor(alertLineColor.getSelectObject());
chartAlertValue.getLineStyle().setLineStyle(alertLineStyle.getSelectedLineStyle());
chartAlertValue.getLineStyle().setLineType((LineType) alertLineStyle.getSelectedItem());
chartAlertValue.getLineStyle().setLineWidth(lineWidthSpinner.getValue());
String contentString = alertText.updateBean();
Object contentObj;

114
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java

@ -4,14 +4,16 @@ import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
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.style.color.ColorSelectBox;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.type.LineType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.LineTypeComboBox;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -39,11 +41,21 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private ColorSelectBox verticalColorBackground;
protected BackgroundListControlPane customIntervalBackground;
private LineTypeComboBox horizonLineType;//横向线型
private LineTypeComboBox verticalLineType;//纵向线型
private JPanel horizontalColorPane;
private JPanel verticalColorPane;
public VanChartAxisAreaPane() {
initComponents();
}
protected void initComponents() {
horizontalGridLine = new ColorSelectBox(100);
verticalGridLine = new ColorSelectBox(100);
horizonLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
verticalLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
@ -52,7 +64,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{createGridLinePane(new double[]{p, p, p}, new double[]{f, e})},
new Component[]{createGridLinePane()},
new Component[]{createAlertLinePane()},
new Component[]{createIntervalPane(new double[]{p, p, p, p}, new double[]{f, s})},
};
@ -61,25 +73,62 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
this.add(panel, BorderLayout.CENTER);
}
private JPanel createGridLinePane(double[] row, double[] col) {
horizontalGridLine = new ColorSelectBox(100);
verticalGridLine = new ColorSelectBox(100);
Component[][] components = getGridLinePaneComponents();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
}
protected JPanel createGridLinePane() {
protected Component[][] getGridLinePaneComponents() {
return new Component[][]{
Component[][] upComponent = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal")), horizontalGridLine},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")), verticalGridLine},
new Component[]{null, horizontalGridLine}
};
horizontalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(upComponent);
Component[][] downComponent = new Component[][]{
new Component[]{null,null},
new Component[]{null, verticalGridLine}
};
verticalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(downComponent);
horizonLineType.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (horizontalGridLine == null || horizonLineType == null){
return;
}
horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE);
}
});
verticalLineType.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (verticalGridLine == null || verticalLineType == null){
return;
}
verticalColorPane.setVisible(verticalLineType.getSelectedItem() != LineType.NONE);
}
});
checkColorBoxVisible();
JPanel horizonLineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), horizonLineType);
JPanel horizontal = new JPanel(new BorderLayout());
horizontal.add(horizonLineTypePane, BorderLayout.NORTH);
horizontal.add(horizontalColorPane, BorderLayout.CENTER);
JPanel verticalLineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), verticalLineType);
JPanel vertical = new JPanel(new BorderLayout());
vertical.add(verticalLineTypePane, BorderLayout.NORTH);
vertical.add(verticalColorPane, BorderLayout.CENTER);
JPanel panel = new JPanel(new BorderLayout(0, 4));
panel.add(horizontal, BorderLayout.NORTH);
panel.add(vertical, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
}
protected JPanel createAlertLinePane() {
alertLine = getAlertLinePane();
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line"), alertLine);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Alert_Line"), alertLine);
alertLine.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0));
return panel;
}
@ -89,7 +138,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
}
protected JPanel createIntervalPane(double[] row, double[] col) {
isDefaultIntervalBackground = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Interval"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background")});
isDefaultIntervalBackground = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Interval"), Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background")});
horizontalColorBackground = new ColorSelectBox(100);
verticalColorBackground = new ColorSelectBox(100);
Component[][] components = getIntervalPaneComponents();
@ -99,8 +148,8 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
cardLayout = new CardLayout();
centerPane = new JPanel(cardLayout);
centerPane.add(defaultPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Interval"));
centerPane.add(customIntervalBackground, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background"));
centerPane.add(defaultPane, Toolkit.i18nText("Fine-Design_Chart_Default_Interval"));
centerPane.add(customIntervalBackground, Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background"));
isDefaultIntervalBackground.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -108,10 +157,10 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
}
});
JPanel intervalPane = new JPanel(new BorderLayout(0, 6));
JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Interval_Background"), isDefaultIntervalBackground);
JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Interval_Background"), isDefaultIntervalBackground);
intervalPane.add(panel1, BorderLayout.NORTH);
intervalPane.add(centerPane, BorderLayout.CENTER);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Interval_Background"), intervalPane);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Interval_Background"), intervalPane);
intervalPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0));
return panel;
}
@ -123,16 +172,16 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
protected Component[][] getIntervalPaneComponents() {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal")), horizontalColorBackground},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")), verticalColorBackground},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal")), horizontalColorBackground},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")), verticalColorBackground},
};
}
private void checkCardPane() {
if (isDefaultIntervalBackground.getSelectedIndex() == 0) {
cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Interval"));
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Default_Interval"));
} else {
cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background"));
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background"));
}
}
@ -142,6 +191,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
public void populateBean(Plot plot) {
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot;
checkColorBoxVisible();
populateGridLine(rectanglePlot);
@ -155,9 +205,11 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
checkCardPane();
}
protected void populateGridLine(VanChartRectanglePlot rectanglePlot) {
private void populateGridLine(VanChartRectanglePlot rectanglePlot) {
horizontalGridLine.setSelectObject(rectanglePlot.getDefaultYAxis().getMainGridColor());
verticalGridLine.setSelectObject(rectanglePlot.getDefaultXAxis().getMainGridColor());
horizonLineType.setSelectedItem(rectanglePlot.getDefaultYAxis().getGridLineType());
verticalLineType.setSelectedItem(rectanglePlot.getDefaultXAxis().getGridLineType());
}
@ -179,9 +231,11 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
customIntervalBackground.update(plot, isDefaultIntervalBackground.getSelectedIndex() == 0);
}
protected void updateGirdLine(VanChartRectanglePlot rectanglePlot) {
private void updateGirdLine(VanChartRectanglePlot rectanglePlot) {
rectanglePlot.getDefaultYAxis().setMainGridColor(horizontalGridLine.getSelectObject());
rectanglePlot.getDefaultXAxis().setMainGridColor(verticalGridLine.getSelectObject());
rectanglePlot.getDefaultYAxis().setGridLineType((LineType)horizonLineType.getSelectedItem());
rectanglePlot.getDefaultXAxis().setGridLineType((LineType)verticalLineType.getSelectedItem());
}
/**
@ -199,4 +253,14 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
public Plot updateBean() {
return null;
}
private void checkColorBoxVisible() {
if (horizontalColorPane != null && horizonLineType != null){
horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE);
}
if (verticalColorPane != null && verticalLineType != null){
verticalColorPane.setVisible(verticalLineType.getSelectedItem() != LineType.NONE);
}
}
}

20
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/radar/VanChartRadarAxisAreaPane.java

@ -2,12 +2,16 @@ package com.fr.van.chart.designer.style.background.radar;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.background.AlertLineListControlPane;
import com.fr.van.chart.designer.style.background.BackgroundListControlPane;
import com.fr.van.chart.designer.style.background.VanChartAxisAreaPane;
import javax.swing.JPanel;
import java.awt.Component;
import java.util.Arrays;
/**
* 样式-背景-绘图区背景-雷达图只有Y轴的配置间隔背景网格线警戒线
@ -17,11 +21,21 @@ public class VanChartRadarAxisAreaPane extends VanChartAxisAreaPane {
private static final long serialVersionUID = 2459614679918546393L;
//雷达图只有横向的y轴的网格线配置
protected Component[][] getGridLinePaneComponents() {
return new Component[][]{
@Override
protected JPanel createGridLinePane() {
Component[][] components = new Component[][]{
new Component[]{null,null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),horizontalGridLine},
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] row = new double[components.length];
Arrays.fill(row, p);
double[] col = {f, e};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
}
protected Component[][] getIntervalPaneComponents() {

Loading…
Cancel
Save