@ -18,7 +18,9 @@ import java.awt.Font;
import java.awt.FontMetrics ;
import java.awt.FontMetrics ;
import java.awt.Graphics ;
import java.awt.Graphics ;
import java.awt.Graphics2D ;
import java.awt.Graphics2D ;
import java.awt.Rectangle ;
import java.awt.RenderingHints ;
import java.awt.RenderingHints ;
import java.awt.geom.AffineTransform ;
import java.awt.image.BufferedImage ;
import java.awt.image.BufferedImage ;
import java.util.List ;
import java.util.List ;
@ -36,10 +38,19 @@ public class CellStylePreviewPane extends JPanel {
private String paintText = "Report" ;
private String paintText = "Report" ;
private Style style = Style . DEFAULT_STYLE ;
private Style style = Style . DEFAULT_STYLE ;
private final int column ;
private final int row ;
private final int columnSpan ;
private final int rowSpan ;
private final boolean autoClearCanvas ;
private final boolean autoClearCanvas ;
private final boolean paintingMosaic ;
private final boolean paintingMosaic ;
public CellStylePreviewPane ( boolean autoClearCanvas , boolean paintingMosaic ) {
public CellStylePreviewPane ( int column , int row , int columnSpan , int rowSpan , boolean autoClearCanvas , boolean paintingMosaic ) {
this . column = column ;
this . row = row ;
this . columnSpan = columnSpan ;
this . rowSpan = rowSpan ;
this . autoClearCanvas = autoClearCanvas ;
this . autoClearCanvas = autoClearCanvas ;
this . paintingMosaic = paintingMosaic ;
this . paintingMosaic = paintingMosaic ;
transparentBackgroundWidth = transparentBackgroundImage . getWidth ( null ) ;
transparentBackgroundWidth = transparentBackgroundImage . getWidth ( null ) ;
@ -133,8 +144,30 @@ public class CellStylePreviewPane extends JPanel {
Style . paintContent ( g2d , paintText , style , width , height , resolution ) ;
Style . paintContent ( g2d , paintText , style , width , height , resolution ) ;
g2d . setClip ( null ) ;
paintCellBorder ( g2d , style ) ;
Style . paintBorder ( g2d , style , width , height ) ;
}
protected void paintCellBorder ( Graphics2D g2d , Style style ) {
float adjustLeft = 0 ;
float adjustTop = 0 ;
float adjustRight = 0 ;
float adjustBottom = 0 ;
if ( column = = 0 ) {
adjustLeft = GraphHelper . getLineStyleSize ( style . getBorderLeft ( ) ) / 2 . 0F ;
}
if ( row = = 0 ) {
adjustTop = GraphHelper . getLineStyleSize ( style . getBorderTop ( ) ) / 2 . 0F ;
}
if ( column = = columnSpan - 1 ) {
adjustRight = - GraphHelper . getLineStyleSize ( style . getBorderRight ( ) ) / 2 . 0F ;
}
if ( row = = rowSpan - 1 ) {
adjustBottom = - GraphHelper . getLineStyleSize ( style . getBorderBottom ( ) ) / 2 . 0F ;
}
g2d . translate ( adjustLeft , adjustTop ) ;
Style . paintBorder ( g2d , style , getWidth ( ) - adjustLeft + adjustRight , getHeight ( ) - adjustTop + adjustBottom ) ;
g2d . translate ( - adjustLeft , - adjustTop ) ;
}
}
@Override
@Override