@ -32,9 +32,6 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private static final int PREFERRED_WIDTH = 100 ;
protected ColorSelectBox horizontalGridLine ;
protected ColorSelectBox verticalGridLine ;
protected AlertLineListControlPane alertLine ;
private UIButtonGroup isDefaultIntervalBackground ;
@ -44,8 +41,10 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private ColorSelectBox verticalColorBackground ;
protected BackgroundListControlPane customIntervalBackground ;
private LineTypeComboBox horizonLineType ; //横向线型
private LineTypeComboBox verticalLineType ; //纵向线型
private LineTypeComboBox horizonLineType ;
private LineTypeComboBox verticalLineType ;
private ColorSelectBox horizontalColorBox ;
private ColorSelectBox verticalColorBox ;
private JPanel horizontalColorPane ;
private JPanel verticalColorPane ;
@ -53,9 +52,9 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
initComponents ( ) ;
}
protected void initComponents ( ) {
horizontalGridLine = new ColorSelectBox ( PREFERRED_WIDTH ) ;
verticalGridLine = new ColorSelectBox ( PREFERRED_WIDTH ) ;
private void initComponents ( ) {
horizontalColorBox = new ColorSelectBox ( PREFERRED_WIDTH ) ;
verticalColorBox = new ColorSelectBox ( PREFERRED_WIDTH ) ;
horizonLineType = new LineTypeComboBox ( new LineType [ ] { LineType . NONE , LineType . SOLID , LineType . DASHED } ) ;
verticalLineType = new LineTypeComboBox ( new LineType [ ] { LineType . NONE , LineType . SOLID , LineType . DASHED } ) ;
@ -77,23 +76,33 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
}
protected JPanel createGridLinePane ( ) {
initGridLineComponents ( ) ;
JPanel panel = new JPanel ( new BorderLayout ( 0 , 4 ) ) ;
panel . add ( createSingleGridLinePane ( Toolkit . i18nText ( "Fine-Design_Chart_Direction_Horizontal" ) , true ) , BorderLayout . NORTH ) ;
panel . add ( createSingleGridLinePane ( Toolkit . i18nText ( "Fine-Design_Chart_Direction_Vertical" ) , false ) , BorderLayout . CENTER ) ;
return TableLayout4VanChartHelper . createExpandablePaneWithTitle ( Toolkit . i18nText ( "Fine-Design_Chart_Grid_Line" ) , panel ) ;
}
protected void initGridLineComponents ( ) {
Component [ ] [ ] upComponent = new Component [ ] [ ] {
new Component [ ] { null , null } ,
new Component [ ] { null , horizontalGridLine }
new Component [ ] { null , horizontalColorBox }
} ;
horizontalColorPane = TableLayout4VanChartHelper . createGapTableLayoutPane ( upComponent ) ;
Component [ ] [ ] downComponent = new Component [ ] [ ] {
new Component [ ] { null , null } ,
new Component [ ] { null , verticalGridLine }
new Component [ ] { null , verticalColorBox }
} ;
verticalColorPane = TableLayout4VanChartHelper . createGapTableLayoutPane ( downComponent ) ;
horizonLineType . addActionListener ( new ActionListener ( ) {
@Override
public void actionPerformed ( ActionEvent e ) {
if ( horizontalGridLine = = null | | horizonLineType = = null ) {
if ( horizontalColorBox = = null | | horizonLineType = = null ) {
return ;
}
horizontalColorPane . setVisible ( horizonLineType . getSelectedItem ( ) ! = LineType . NONE ) ;
@ -103,7 +112,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
verticalLineType . addActionListener ( new ActionListener ( ) {
@Override
public void actionPerformed ( ActionEvent e ) {
if ( verticalGridLine = = null | | verticalLineType = = null ) {
if ( verticalColorBox = = null | | verticalLineType = = null ) {
return ;
}
verticalColorPane . setVisible ( verticalLineType . getSelectedItem ( ) ! = LineType . NONE ) ;
@ -111,22 +120,20 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
} ) ;
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 ) ;
protected JPanel createSingleGridLinePane ( String title , boolean isHorizontal ) {
LineTypeComboBox lineTypeComboBox = isHorizontal ? horizonLineType : verticalLineType ;
JPanel colorSelectPane = isHorizontal ? horizontalColorPane : verticalColorPane ;
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 lineTypePane = TableLayout4VanChartHelper . createGapTableLayoutPane ( title , lineTypeComboBox ) ;
JPanel panel = new JPanel ( new BorderLayout ( 0 , 4 ) ) ;
panel . add ( horizontal , BorderLayout . NORTH ) ;
panel . add ( vertical , BorderLayout . CENTER ) ;
JPanel singleGridLinePane = new JPanel ( new BorderLayout ( ) ) ;
return TableLayout4VanChartHelper . createExpandablePaneWithTitle ( Toolkit . i18nText ( "Fine-Design_Chart_Grid_Line" ) , panel ) ;
singleGridLinePane . add ( lineTypePane , BorderLayout . NORTH ) ;
singleGridLinePane . add ( colorSelectPane , BorderLayout . CENTER ) ;
return singleGridLinePane ;
}
protected JPanel createAlertLinePane ( ) {
@ -213,12 +220,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
VanChartAxis defaultYAxis = rectanglePlot . getDefaultYAxis ( ) ;
if ( defaultXAxis ! = null ) {
verticalGridLine . setSelectObject ( defaultXAxis . getMainGridColor ( ) ) ;
verticalColorBox . setSelectObject ( defaultXAxis . getMainGridColor ( ) ) ;
verticalLineType . setSelectedItem ( defaultXAxis . getGridLineType ( ) ) ;
}
if ( defaultYAxis ! = null ) {
horizontalGridLine . setSelectObject ( defaultYAxis . getMainGridColor ( ) ) ;
horizontalColorBox . setSelectObject ( defaultYAxis . getMainGridColor ( ) ) ;
horizonLineType . setSelectedItem ( defaultYAxis . getGridLineType ( ) ) ;
}
}
@ -246,12 +253,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
VanChartAxis defaultYAxis = rectanglePlot . getDefaultYAxis ( ) ;
if ( defaultXAxis ! = null ) {
defaultXAxis . setMainGridColor ( verticalGridLine . getSelectObject ( ) ) ;
defaultXAxis . setMainGridColor ( verticalColorBox . getSelectObject ( ) ) ;
defaultXAxis . setGridLineType ( ( LineType ) verticalLineType . getSelectedItem ( ) ) ;
}
if ( defaultYAxis ! = null ) {
defaultYAxis . setMainGridColor ( horizontalGridLine . getSelectObject ( ) ) ;
defaultYAxis . setMainGridColor ( horizontalColorBox . getSelectObject ( ) ) ;
defaultYAxis . setGridLineType ( ( LineType ) horizonLineType . getSelectedItem ( ) ) ;
}
}