@ -1,5 +1,6 @@
package com.fr.design.mainframe.theme.preview.ecpreview ;
import com.fr.base.CellBorderSourceFlag ;
import com.fr.base.theme.ReportTheme ;
import com.fr.base.theme.TemplateTheme ;
import com.fr.base.theme.settings.ThemedCellStyleList ;
@ -22,12 +23,12 @@ import java.util.ArrayList;
import java.util.List ;
public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreviewed < ReportTheme > {
private final List < AbstractPreviewCell > headerTitleCellList = new ArrayList < > ( ) ;
private final List < AbstractPreviewCell > headerCellList = new ArrayList < > ( ) ;
private final List < AbstractPreviewCell > titleCellList = new ArrayList < > ( ) ;
private final List < AbstractPreviewCell > contentCellList = new ArrayList < > ( ) ;
private final List < AbstractPreviewCell > highLightCellList = new ArrayList < > ( ) ;
private final List < AbstractPreviewCell > assistCellList = new ArrayList < > ( ) ;
private final List < AbstractPreviewCell > headerTitleCellList = new ArrayList < > ( ) ; // 大标题样式单元格
private final List < AbstractPreviewCell > headerCellList = new ArrayList < > ( ) ; // 表头样式单元格
private final List < AbstractPreviewCell > titleCellList = new ArrayList < > ( ) ; // 小标题样式单元格
private final List < AbstractPreviewCell > contentCellList = new ArrayList < > ( ) ; // 正文样式单元格
private final List < AbstractPreviewCell > highLightCellList = new ArrayList < > ( ) ; // 高亮文本样式单元格
private final List < AbstractPreviewCell > assistCellList = new ArrayList < > ( ) ; // 辅助信息样式单元格
private static final int CONTENT_ROW_COUNT = 3 ;
private static final int COL_COUNT = 5 ;
@ -64,31 +65,38 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
private JPanel createNorthPane ( ) {
JPanel northPane = FRGUIPaneFactory . createBorderLayout_NO_Opaque_Pane ( ) ;
AbstractPreviewCell bigTitleCell = new PreviewCell ( Toolkit . i18nText ( "Fine-Design_Basic_Template_Theme_Profile_Pane_Cell_Style_Big_Title" ) ) ;
bigTitleCell . setBorderSourceFlag ( CellBorderSourceFlag . ALL_BORDER_SOURCE_OUTER ) ;
bigTitleCell . setPreferredSize ( new Dimension ( 615 , 46 ) ) ;
headerTitleCellList . add ( bigTitleCell ) ;
northPane . add ( bigTitleCell , BorderLayout . NORTH ) ;
CornerPreviewCell cornerCell = new CornerPreviewCell ( new String [ ] { Toolkit . i18nText ( "Fine-Design_Basic_Column_Name" ) ,
Toolkit . i18nText ( "Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Data" ) , Toolkit . i18nText ( "Fine-Design_Basic_Template_Theme_Profile_Pane_Row_Name" ) } ,
new Point2D [ ] { new Point ( 159 , 71 ) , new Point ( 225 , 49 ) } ) ;
cornerCell . setBorderSourceFlag ( CellBorderSourceFlag . INVALID_BORDER_SOURCE ) ;
cornerCell . setPreferredSize ( new Dimension ( 225 , 71 ) ) ;
titleCellList . add ( cornerCell ) ;
northPane . add ( cornerCell , BorderLayout . WEST ) ;
JPanel centerPane = FRGUIPaneFactory . createBorderLayout_NO_Opaque_Pane ( ) ;
northPane . add ( centerPane , BorderLayout . CENTER ) ;
PreviewCell cell = new PreviewCell ( Toolkit . i18nText ( "Fine-Design_Basic_Predefined_Style_Small_Title" ) ) ;
cell . setBorderSourceFlag ( CellBorderSourceFlag . ALL_BORDER_SOURCE_OUTER ) ;
titleCellList . add ( cell ) ;
cell . setPreferredSize ( new Dimension ( 308 , 38 ) ) ;
centerPane . add ( cell , BorderLayout . NORTH ) ;
JPanel eastSouthPane = new UINoOpaquePanel ( new GridLayout ( ) ) ;
PreviewCell cell1 = new PreviewCell ( Toolkit . i18nText ( "Fine-Design_Basic_Predefined_Style_Header" ) ) ;
PreviewCell cell2 = new PreviewCell ( Toolkit . i18nText ( "Fine-Design_Basic_Predefined_Style_Header" ) ) ;
PreviewCell cell3 = new PreviewCell ( Toolkit . i18nText ( "Fine-Design_Basic_Predefined_Style_Header" ) ) ;
headerCellList . add ( cell1 ) ;
headerCellList . add ( cell2 ) ;
headerCellList . add ( cell3 ) ;
eastSouthPane . add ( cell1 ) ;
eastSouthPane . add ( cell2 ) ;
eastSouthPane . add ( cell3 ) ;
for ( int c = 0 ; c < CONTENT_ROW_COUNT ; c + + ) {
PreviewCell headerCell = new PreviewCell ( Toolkit . i18nText ( "Fine-Design_Basic_Predefined_Style_Header" ) ) ;
int flag = CellBorderSourceFlag . ALL_BORDER_SOURCE_OUTER ;
if ( c > 0 ) {
flag | = CellBorderSourceFlag . LEFT_BORDER_SOURCE_INNER ;
}
if ( c < CONTENT_ROW_COUNT - 1 ) {
flag | = CellBorderSourceFlag . RIGHT_BORDER_SOURCE_INNER ;
}
headerCell . setBorderSourceFlag ( flag ) ;
headerCellList . add ( headerCell ) ;
eastSouthPane . add ( headerCell ) ;
}
centerPane . add ( eastSouthPane , BorderLayout . CENTER ) ;
return northPane ;
}
@ -102,8 +110,16 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
cell1 . setPreferredSize ( new Dimension ( 112 , 153 ) ) ;
westPane . add ( cell1 , BorderLayout . WEST ) ;
JPanel gridPane = new UINoOpaquePanel ( new GridLayout ( 5 , 1 ) ) ;
for ( int i = 0 ; i < COL_COUNT ; i + + ) {
for ( int r = 0 ; r < COL_COUNT ; r + + ) {
PreviewCell cell = new PreviewCell ( Toolkit . i18nText ( "Fine-Design_Basic_Predefined_Style_Header" ) ) ;
int flag = CellBorderSourceFlag . ALL_BORDER_SOURCE_OUTER ;
if ( r > 0 ) {
flag | = CellBorderSourceFlag . TOP_BORDER_SOURCE_INNER ;
}
if ( r < COL_COUNT - 1 ) {
flag | = CellBorderSourceFlag . BOTTOM_BORDER_SOURCE_INNER ;
}
cell . setBorderSourceFlag ( flag ) ;
cell . setPreferredSize ( new Dimension ( 113 , 31 ) ) ;
headerCellList . add ( cell ) ;
gridPane . add ( cell ) ;
@ -114,11 +130,36 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
centerPane . add ( innerCenterPane , BorderLayout . CENTER ) ;
for ( int i = 0 ; i < COL_COUNT * CONTENT_ROW_COUNT ; i + + ) {
PreviewCell cell ;
if ( ( i + 1 ) % CONTENT_ROW_COUNT = = 0 ) {
int r = i / CONTENT_ROW_COUNT ;
int c = i % CONTENT_ROW_COUNT ;
if ( c = = CONTENT_ROW_COUNT - 1 ) {
cell = new PreviewCell ( Toolkit . i18nText ( "Fine-Design_Basic_Predefined_Style_Highlight_Text" ) ) ;
int flag = CellBorderSourceFlag . ALL_BORDER_SOURCE_OUTER ;
if ( r ! = 0 ) {
flag | = CellBorderSourceFlag . TOP_BORDER_SOURCE_INNER ;
}
if ( r ! = COL_COUNT - 1 ) {
flag | = CellBorderSourceFlag . BOTTOM_BORDER_SOURCE_INNER ;
}
cell . setBorderSourceFlag ( flag ) ;
highLightCellList . add ( cell ) ;
} else {
cell = new PreviewCell ( Toolkit . i18nText ( "Fine-Design_Basic_Predefined_Style_Main_Text" ) ) ;
int flag = CellBorderSourceFlag . ALL_BORDER_SOURCE_OUTER ;
if ( r > 0 ) {
flag | = CellBorderSourceFlag . TOP_BORDER_SOURCE_INNER ;
}
if ( r < COL_COUNT - 1 ) {
flag | = CellBorderSourceFlag . BOTTOM_BORDER_SOURCE_INNER ;
}
if ( c > 0 ) {
flag | = CellBorderSourceFlag . LEFT_BORDER_SOURCE_INNER ;
}
if ( c < CONTENT_ROW_COUNT - 2 ) {
flag | = CellBorderSourceFlag . RIGHT_BORDER_SOURCE_INNER ;
}
cell . setBorderSourceFlag ( flag ) ;
contentCellList . add ( cell ) ;
}
cell . setPreferredSize ( new Dimension ( 123 , 31 ) ) ;
@ -132,6 +173,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
private JPanel createSouthPane ( ) {
JPanel southPane = FRGUIPaneFactory . createBorderLayout_NO_Opaque_Pane ( ) ;
PreviewCell assistCell = new PreviewCell ( Toolkit . i18nText ( "Fine-Design_Basic_Predefined_Style_Assist_Text" ) ) ;
assistCell . setBorderSourceFlag ( CellBorderSourceFlag . ALL_BORDER_SOURCE_OUTER ) ;
assistCell . setPreferredSize ( new Dimension ( 123 , 30 ) ) ;
assistCellList . add ( assistCell ) ;
southPane . add ( assistCell , BorderLayout . CENTER ) ;
@ -141,12 +183,12 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
@Override
public void refresh ( TemplateTheme theme ) {
ThemedCellStyleList cellStyleConfig = theme . getCellStyleList ( ) ;
refresh ( headerTitleCellList , getReportBigTitleStyle ( cellStyleConfig ) ) ;
refresh ( headerCellList , getReportHeaderStyle ( cellStyleConfig ) ) ;
refresh ( contentCellList , getMainContentStyle ( cellStyleConfig ) ) ;
refresh ( titleCellList , getSmallTitleStyle ( cellStyleConfig ) ) ;
refresh ( highLightCellList , getHighLightStyle ( cellStyleConfig ) ) ;
refresh ( assistCellList , getAssistMsgStyle ( cellStyleConfig ) ) ;
refresh ( headerTitleCellList , cellStyleConfig . getUse4BigTitle ( ) ) ;
refresh ( headerCellList , cellStyleConfig . getUse4Header ( ) ) ;
refresh ( contentCellList , cellStyleConfig . getUse4MainText ( ) ) ;
refresh ( titleCellList , cellStyleConfig . getUse4SmallTitle ( ) ) ;
refresh ( highLightCellList , cellStyleConfig . getUse4HighlightText ( ) ) ;
refresh ( assistCellList , cellStyleConfig . getUse4SupportInfo ( ) ) ;
}
}
}