@ -12,7 +12,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.design.mainframe.theme.TemplateThemePreviewPane ;
import com.fr.design.mainframe.theme.TemplateThemePreviewPane ;
import com.fr.design.mainframe.theme.preview.ecpreview.ECComponentPreviewPane ;
import com.fr.design.mainframe.theme.preview.ecpreview.ECComponentPreviewPane ;
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.PiePlot4VanChart ;
import com.fr.plugin.chart.PiePlot4VanChart ;
@ -24,10 +23,10 @@ import com.fr.plugin.chart.type.RadiusType;
import com.fr.plugin.chart.vanchart.VanChart ;
import com.fr.plugin.chart.vanchart.VanChart ;
import com.fr.stable.Constants ;
import com.fr.stable.Constants ;
import com.fr.stable.StringUtils ;
import com.fr.stable.StringUtils ;
import javax.swing.JComponent ;
import javax.swing.JPanel ;
import javax.swing.JPanel ;
import java.util.ArrayList ;
import java.awt.AlphaComposite ;
import java.awt.Composite ;
import java.awt.Graphics2D ;
import java.awt.BorderLayout ;
import java.awt.BorderLayout ;
import java.awt.Color ;
import java.awt.Color ;
import java.awt.Dimension ;
import java.awt.Dimension ;
@ -44,6 +43,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane<FormTheme> {
private Background background ;
private Background background ;
private ChartComponentPreviewPane columnChartPreviewPane ;
private ChartComponentPreviewPane columnChartPreviewPane ;
private ChartComponentPreviewPane pieChartPreviewPane ;
private ChartComponentPreviewPane pieChartPreviewPane ;
private float alpha = 1 . 0F ;
public FormThemePreviewPane ( ) {
public FormThemePreviewPane ( ) {
setLayout ( FRGUIPaneFactory . createBorderLayout ( ) ) ;
setLayout ( FRGUIPaneFactory . createBorderLayout ( ) ) ;
@ -72,9 +72,9 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane<FormTheme> {
}
}
} ;
} ;
pieChartPanel . setLayout ( new BorderLayout ( ) ) ;
pieChartPanel . setLayout ( new BorderLayout ( ) ) ;
pieChartPreviewPane = createChartPreviewPane ( initPieChart ( ) , 300 , 368 ) ;
pieChartPreviewPane = createChartPreviewPane ( initPieChart ( ) , 217 , 368 ) ;
pieChartPanel . add ( pieChartPreviewPane , BorderLayout . CENTER ) ;
pieChartPanel . add ( pieChartPreviewPane , BorderLayout . CENTER ) ;
chartContent . add ( columnChartPanel , BorderLayout . WEST ) ;
chartContent . add ( columnChartPanel , BorderLayout . CENTER ) ;
chartContent . add ( pieChartPanel , BorderLayout . EAST ) ;
chartContent . add ( pieChartPanel , BorderLayout . EAST ) ;
return chartContent ;
return chartContent ;
}
}
@ -89,6 +89,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane<FormTheme> {
@Override
@Override
public void refresh ( FormTheme theme ) {
public void refresh ( FormTheme theme ) {
background = theme . getBodyStyle ( ) . getStyle ( ) . getBackground ( ) ;
background = theme . getBodyStyle ( ) . getStyle ( ) . getBackground ( ) ;
alpha = theme . getBodyStyle ( ) . getStyle ( ) . getAlpha ( ) ;
elementCasePane . refresh ( theme ) ;
elementCasePane . refresh ( theme ) ;
columnChartPreviewPane . refresh ( theme ) ;
columnChartPreviewPane . refresh ( theme ) ;
pieChartPreviewPane . refresh ( theme ) ;
pieChartPreviewPane . refresh ( theme ) ;
@ -96,18 +97,19 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane<FormTheme> {
}
}
public void paint ( Graphics g ) {
@Override
// 禁止双缓冲
public void paintComponent ( Graphics g ) {
ArrayList < JComponent > dbcomponents = new ArrayList < JComponent > ( ) ;
paintBackground ( ( Graphics2D ) g ) ;
}
private void paintBackground ( Graphics2D g2d ) {
if ( background = = null ) {
if ( background = = null ) {
background = ColorBackground . getInstance ( Color . WHITE ) ;
background = ColorBackground . getInstance ( Color . WHITE ) ;
}
}
background . paint ( g , new Rectangle2D . Double ( 0 , 0 , 517 , 532 ) ) ;
Composite oldComposite = g2d . getComposite ( ) ;
paintChildren ( g ) ;
g2d . setComposite ( AlphaComposite . getInstance ( AlphaComposite . SRC_ATOP , alpha ) ) ;
// 恢复双缓冲
background . paint ( g2d , new Rectangle2D . Double ( 0 , 0 , 517 , 532 ) ) ;
ComponentUtils . resetBuffer ( dbcomponents ) ;
g2d . setComposite ( oldComposite ) ;
}
}
//柱形图
//柱形图