@ -1,6 +1,8 @@
package com.fr.van.chart.box ;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.layout.TableLayout ;
import com.fr.design.layout.TableLayoutHelper ;
import com.fr.plugin.chart.base.AttrTooltipContent ;
import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent ;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane ;
@ -10,10 +12,13 @@ import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox
import com.fr.van.chart.designer.style.VanChartStylePane ;
import javax.swing.JPanel ;
import java.awt.BorderLayout ;
import java.awt.Component ;
public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private boolean detailed ;
private VanChartFormatPaneWithCheckBox number ;
private VanChartFormatPaneWithCheckBox max ;
private VanChartFormatPaneWithCheckBox q3 ;
@ -22,8 +27,12 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private VanChartFormatPaneWithCheckBox min ;
private VanChartFormatPaneWithCheckBox outlier ;
public VanChartBoxTooltipContentPane ( VanChartStylePane parent , JPanel showOnPane ) {
private JPanel dataNumberPane ;
private JPanel dataOutlierPane ;
public VanChartBoxTooltipContentPane ( VanChartStylePane parent , JPanel showOnPane , boolean isDetailed ) {
super ( parent , showOnPane ) ;
this . detailed = isDetailed ;
}
protected void initFormatPane ( VanChartStylePane parent , JPanel showOnPane ) {
@ -67,22 +76,81 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} ;
}
protected JPanel createCommonPanel ( ) {
JPanel commonPanel = new JPanel ( new BorderLayout ( ) ) ;
commonPanel . add ( createCateAndSeriesPane ( ) , BorderLayout . NORTH ) ;
commonPanel . add ( createDataNumberPane ( ) , BorderLayout . CENTER ) ;
commonPanel . add ( createDataDetailPane ( ) , BorderLayout . SOUTH ) ;
checkFormatVisible ( detailed ) ;
return commonPanel ;
}
protected double [ ] getRowSize ( double p ) {
return new double [ ] { p , p , p , p , p , p , p , p , p } ;
return new double [ ] { p , p , p , p , p , p , p , p , p , p , p , p } ;
}
protected Component [ ] [ ] getPaneComponents ( ) {
return new Component [ ] [ ] {
private JPanel createCateAndSeriesPane ( ) {
double p = TableLayout . PREFERRED ;
double f = TableLayout . FILL ;
double [ ] columnSize = { f , p } ;
double [ ] rowSize = { p , p } ;
Component [ ] [ ] cateAndSeries = new Component [ ] [ ] {
new Component [ ] { categoryNameFormatPane , null } ,
new Component [ ] { seriesNameFormatPane , null } ,
new Component [ ] { seriesNameFormatPane , null }
} ;
return TableLayoutHelper . createTableLayoutPane ( cateAndSeries , rowSize , columnSize ) ;
}
private JPanel createDataNumberPane ( ) {
double p = TableLayout . PREFERRED ;
double f = TableLayout . FILL ;
double [ ] columnSize = { f , p } ;
double [ ] rowSize = { p , p } ;
Component [ ] [ ] dataNumber = new Component [ ] [ ] {
new Component [ ] { null , null } ,
new Component [ ] { number , null } ,
} ;
dataNumberPane = TableLayoutHelper . createTableLayoutPane ( dataNumber , rowSize , columnSize ) ;
return dataNumberPane ;
}
private JPanel createDataDetailPane ( ) {
double p = TableLayout . PREFERRED ;
double f = TableLayout . FILL ;
double [ ] columnSize = { f , p } ;
JPanel detailPane = new JPanel ( new BorderLayout ( ) ) ;
Component [ ] [ ] dataDetail = new Component [ ] [ ] {
new Component [ ] { null , null } ,
new Component [ ] { max , null } ,
new Component [ ] { q3 , null } ,
new Component [ ] { median , null } ,
new Component [ ] { q1 , null } ,
new Component [ ] { min , null } ,
new Component [ ] { outlier , null }
new Component [ ] { min , null }
} ;
Component [ ] [ ] dataOutlier = new Component [ ] [ ] {
new Component [ ] { null , null } ,
new Component [ ] { outlier , null } ,
} ;
dataOutlierPane = TableLayoutHelper . createTableLayoutPane ( dataOutlier , new double [ ] { p , p } , columnSize ) ;
detailPane . add ( TableLayoutHelper . createTableLayoutPane ( dataDetail , new double [ ] { p , p , p , p , p , p } , columnSize ) , BorderLayout . NORTH ) ;
detailPane . add ( dataOutlierPane , BorderLayout . CENTER ) ;
return detailPane ;
}
public boolean isDirty ( ) {
@ -146,4 +214,11 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
outlier . update ( boxTooltipContent . getOutlier ( ) ) ;
}
}
public void checkFormatVisible ( boolean detailed ) {
this . detailed = detailed ;
dataNumberPane . setVisible ( detailed ) ;
dataOutlierPane . setVisible ( detailed ) ;
}
}