@ -1,6 +1,6 @@
package com.fr.design.cell ;
package com.fr.design.cell ;
import com.fr.report.cell.CellElement BorderSourceFlag ;
import com.fr.base.Cell BorderSourceFlag ;
import com.fr.base.CellBorderStyle ;
import com.fr.base.CellBorderStyle ;
import com.fr.base.Style ;
import com.fr.base.Style ;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase ;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase ;
@ -20,6 +20,7 @@ public class CellRectangleStylePreviewPane extends JPanel {
private static final int COLUMN_COUNT = 2 ;
private static final int COLUMN_COUNT = 2 ;
private final TemplateCellElement [ ] [ ] cellElementGrid = new TemplateCellElement [ ROW_COUNT ] [ COLUMN_COUNT ] ;
private final TemplateCellElement [ ] [ ] cellElementGrid = new TemplateCellElement [ ROW_COUNT ] [ COLUMN_COUNT ] ;
private final int [ ] [ ] borderSourceFlags = new int [ ROW_COUNT ] [ COLUMN_COUNT ] ;
private final CellStylePreviewPane [ ] [ ] cellStylePreviewPaneGrid = new CellStylePreviewPane [ ROW_COUNT ] [ COLUMN_COUNT ] ;
private final CellStylePreviewPane [ ] [ ] cellStylePreviewPaneGrid = new CellStylePreviewPane [ ROW_COUNT ] [ COLUMN_COUNT ] ;
public CellRectangleStylePreviewPane ( ) {
public CellRectangleStylePreviewPane ( ) {
@ -29,25 +30,25 @@ public class CellRectangleStylePreviewPane extends JPanel {
for ( int c = 0 ; c < COLUMN_COUNT ; c + + ) {
for ( int c = 0 ; c < COLUMN_COUNT ; c + + ) {
CellStylePreviewPane pane = new CellStylePreviewPane ( ) ;
CellStylePreviewPane pane = new CellStylePreviewPane ( ) ;
TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase . createInstance ( c , r ) ;
TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase . createInstance ( c , r ) ;
int flags = CellElement BorderSourceFlag . ALL_BORDER_SOURCE_OUTER ;
int flags = CellBorderSourceFlag . ALL_BORDER_SOURCE_OUTER ;
if ( r ! = 0 ) {
if ( r ! = 0 ) {
flags | = CellElement BorderSourceFlag . TOP_BORDER_SOURCE_INNER ;
flags | = CellBorderSourceFlag . TOP_BORDER_SOURCE_INNER ;
}
}
if ( r ! = ROW_COUNT - 1 ) {
if ( r ! = ROW_COUNT - 1 ) {
flags | = CellElement BorderSourceFlag . BOTTOM_BORDER_SOURCE_INNER ;
flags | = CellBorderSourceFlag . BOTTOM_BORDER_SOURCE_INNER ;
}
}
if ( c ! = 0 ) {
if ( c ! = 0 ) {
flags | = CellElement BorderSourceFlag . LEFT_BORDER_SOURCE_INNER ;
flags | = CellBorderSourceFlag . LEFT_BORDER_SOURCE_INNER ;
}
}
if ( c ! = COLUMN_COUNT - 1 ) {
if ( c ! = COLUMN_COUNT - 1 ) {
flags | = CellElement BorderSourceFlag . RIGHT_BORDER_SOURCE_INNER ;
flags | = CellBorderSourceFlag . RIGHT_BORDER_SOURCE_INNER ;
}
}
cellElement . setBorderSourceFlags ( flags ) ;
pane . setStyle ( cellElement . getStyle ( ) ) ;
pane . setStyle ( cellElement . getStyle ( ) ) ;
add ( pane ) ;
add ( pane ) ;
cellElementGrid [ r ] [ c ] = cellElement ;
cellElementGrid [ r ] [ c ] = cellElement ;
borderSourceFlags [ r ] [ c ] = flags ;
cellStylePreviewPaneGrid [ r ] [ c ] = pane ;
cellStylePreviewPaneGrid [ r ] [ c ] = pane ;
}
}
}
}
@ -64,7 +65,8 @@ public class CellRectangleStylePreviewPane extends JPanel {
for ( int j = 0 ; j < COLUMN_COUNT ; j + + ) {
for ( int j = 0 ; j < COLUMN_COUNT ; j + + ) {
CellStylePreviewPane pane = cellStylePreviewPaneGrid [ i ] [ j ] ;
CellStylePreviewPane pane = cellStylePreviewPaneGrid [ i ] [ j ] ;
TemplateCellElement cellElement = cellElementGrid [ i ] [ j ] ;
TemplateCellElement cellElement = cellElementGrid [ i ] [ j ] ;
cellElement . setStyle ( style , borderStyle ) ;
int flag = borderSourceFlags [ i ] [ j ] ;
cellElement . setStyle ( CellBorderSourceFlag . deriveBorderedStyle ( style , borderStyle , flag ) ) ;
pane . setStyle ( cellElement . getStyle ( ) ) ;
pane . setStyle ( cellElement . getStyle ( ) ) ;
}
}