@ -1,11 +1,14 @@
package com.fr.design.report.freeze ;
import com.fr.base.FRContext ;
import com.fr.design.constants.UIConstants ;
import com.fr.design.dialog.BasicPane ;
import com.fr.design.extra.WebViewDlgHelper ;
import com.fr.design.gui.frpane.UITabbedPane ;
import com.fr.design.gui.icheckbox.UICheckBox ;
import com.fr.design.gui.ilable.ActionLabel ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.page.ReportPageAttrProvider ;
@ -29,6 +32,9 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
//边框高度
private static final int LABEL_HEIGHT = 45 ;
//tab
private UITabbedPane tabbedPane ;
// 重复标题行
private RepeatRowPane repeatTitleRowPane ;
// 重复标题列
@ -41,6 +47,10 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
private FreezePagePane freezePageRowPane ;
// 分页冻结列
private FreezePagePane freezePageColPane ;
//分页冻结结尾行
private FreezePagePane freezeFootRowPane ;
//分页冻结结尾列
private FreezePagePane freezeFootColPane ;
// 填报冻结行
private FreezeWriteRowPane freezeWriteRowPane ;
// 填报冻结列
@ -53,12 +63,21 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
private UICheckBox useRepeatFinisCCheckBox ;
// 分页冻结
private UICheckBox usePageFrozenCCheckBox ;
private UICheckBox usePageFrozenRCheckBox ;
private UICheckBox usePageHeadFrozenCCheckBox ;
private UICheckBox usePageHeadFrozenRCheckBox ;
private UICheckBox usePageFootFrozenCCheckBox ;
private UICheckBox usePageFootFrozenRCheckBox ;
// 填报冻结
private UICheckBox useWriteFrozenCCheckBox ;
private UICheckBox useWriteFrozenRCheckBox ;
private static final int REPEAT_AND_FROZEN_WIDTH = 600 , REPEAT_AND_FROZEN_HEIGHT = 100 ;
//标题区域
private static final String REPEAT_AND_FROZEN_HEAD = Toolkit . i18nText ( "Fine-Design_Report_Repeat_Head" ) ;
//结尾区域
private static final String REPEAT_AND_FROZEN_FOOT = Toolkit . i18nText ( "Fine-Design_Report_Repeat_Foot" ) ;
/ * *
* 重复标题行
* /
@ -137,30 +156,41 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
* 分页冻结Pane
* /
private JPanel initPageFrozenPane ( ) {
JPanel pagePanel = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
// 分页冻结
UILabel pageLabel = new UILabel ( getPageFrozenTitle ( ) ) ;
JPanel pageLabelPanel = FRGUIPaneFactory . createNormalFlowInnerContainer_S_Pane ( ) ;
pageLabelPanel . add ( pageLabel ) ;
pagePanel . add ( pageLabelPanel , BorderLayout . NORTH ) ;
JPanel pagecon = FRGUIPaneFactory . createNColumnGridInnerContainer_S_Pane ( 1 ) ;
pagecon . setBorder ( BorderFactory . createEmptyBorder ( 0 , 20 , 0 , 0 ) ) ;
pagePanel . add ( pagecon , BorderLayout . CENTER ) ;
UILabel warningx = new UILabel ( "(" + com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_Engine_Please_Set_Repeat_First" ) + ")" ) ;
warningx . setForeground ( Color . red ) ;
pageLabelPanel . add ( warningx ) ;
JPanel pageRowGridPane = FRGUIPaneFactory . createNormalFlowInnerContainer_S_Pane ( ) ;
pageRowGridPane . add ( this . usePageFrozenRCheckBox = new UICheckBox ( ) ) ;
pagecon . add ( pageRowGridPane ) ;
pageRowGridPane . add ( this . usePageHeadFrozenRCheckBox = new UICheckBox ( ) ) ;
// 显示行冻结信息的panel
freezePageRowPane = new FreezePagePane ( true ) ;
pageRowGridPane . add ( freezePageRowPane ) ;
pagecon . add ( pageRowGridPane ) ;
addPageFrozenCol ( pagecon ) ;
addBorder ( pagecon , REPEAT_AND_FROZEN_HEAD ) ;
return pagecon ;
}
return pagePanel ;
private JPanel initPageFrozenFootPane ( ) {
JPanel pageContentPanel = FRGUIPaneFactory . createNColumnGridInnerContainer_S_Pane ( 1 ) ;
pageContentPanel . setBorder ( BorderFactory . createEmptyBorder ( 0 , 20 , 0 , 0 ) ) ;
// 行冻结
JPanel pageRowPane = FRGUIPaneFactory . createNormalFlowInnerContainer_S_Pane ( ) ;
pageRowPane . add ( this . usePageFootFrozenRCheckBox = new UICheckBox ( ) ) ;
// 列冻结
JPanel pageColPane = FRGUIPaneFactory . createNormalFlowInnerContainer_S_Pane ( ) ;
pageColPane . add ( this . usePageFootFrozenCCheckBox = new UICheckBox ( ) ) ;
pageContentPanel . add ( pageRowPane ) ;
freezeFootRowPane = new FreezePagePane ( true , true ) ;
pageRowPane . add ( freezeFootRowPane ) ;
pageContentPanel . add ( pageColPane ) ;
freezeFootColPane = new FreezePagePane ( false , true ) ;
pageColPane . add ( freezeFootColPane ) ;
addBorder ( pageContentPanel , REPEAT_AND_FROZEN_FOOT ) ;
return pageContentPanel ;
}
/ * *
* 分页冻结列
* /
@ -168,7 +198,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
// 显示列冻结信息的panel
freezePageColPane = new FreezePagePane ( false ) ;
JPanel pageColGridPane = FRGUIPaneFactory . createNormalFlowInnerContainer_S_Pane ( ) ;
pageColGridPane . add ( this . usePageFrozenCCheckBox = new UICheckBox ( ) ) ;
pageColGridPane . add ( this . usePageHead FrozenCCheckBox = new UICheckBox ( ) ) ;
pagecon . add ( pageColGridPane ) ;
pageColGridPane . add ( freezePageColPane ) ;
}
@ -209,13 +239,17 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
JPanel cenrepeatPanel = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
outrepeatPanel . add ( cenrepeatPanel ) ;
JPanel outfreezePanel = FRGUIPaneFactory . createTitledBorderPane ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_Engine_Frozen" ) ) ;
this . add ( outrepeatPanel , BorderLayout . NORTH ) ;
this . add ( outfreezePanel , BorderLayout . CENTER ) ;
JPanel repeatPanel = FRGUIPaneFactory . createNColumnGridInnerContainer_S_Pane ( 1 ) ;
repeatPanel . setBorder ( BorderFactory . createEmptyBorder ( 0 , 20 , 0 , 0 ) ) ;
JPanel freezePanel = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
JPanel pagePanel = new JPanel ( FRGUIPaneFactory . createBorderLayout ( ) ) ;
JPanel repeatHeadPanel = FRGUIPaneFactory . createNColumnGridInnerContainer_S_Pane ( 1 ) ;
JPanel repeatFootPanel = FRGUIPaneFactory . createNColumnGridInnerContainer_S_Pane ( 1 ) ;
//添加上方的边界线
addBorder ( repeatHeadPanel , REPEAT_AND_FROZEN_HEAD ) ;
addBorder ( repeatFootPanel , REPEAT_AND_FROZEN_FOOT ) ;
pagePanel . add ( outrepeatPanel , BorderLayout . NORTH ) ;
pagePanel . add ( outfreezePanel , BorderLayout . CENTER ) ;
outfreezePanel . add ( freezePanel ) ;
// 重复打印部分
// 重复打印标题的起始行
JPanel labelPanel = FRGUIPaneFactory . createNormalFlowInnerContainer_S_Pane ( ) ;
@ -223,17 +257,26 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
UILabel warning = new UILabel ( "(" + com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_Engine_FreezeWarning" ) + ")" ) ;
warning . setForeground ( Color . red ) ;
labelPanel . add ( warning ) ;
cenrepeatPanel . add ( labelPanel , BorderLayout . NORTH ) ;
cenrepeatPanel . add ( repeatPanel , BorderLayout . CENTER ) ;
repeatPanel . add ( initRowStartPane ( ) ) ;
addColStart ( repeatPanel ) ;
repeatPanel . add ( initFootRowStarPane ( ) ) ;
addFootColStart ( repeatPanel ) ;
freezePanel . add ( initPageFrozenPane ( ) , BorderLayout . NORTH ) ;
addWriteFrozen ( freezePanel ) ;
cenrepeatPanel . add ( repeatHeadPanel , BorderLayout . NORTH ) ;
cenrepeatPanel . add ( repeatFootPanel , BorderLayout . CENTER ) ;
repeatHeadPanel . add ( initRowStartPane ( ) ) ;
addColStart ( repeatHeadPanel ) ;
repeatFootPanel . add ( initFootRowStarPane ( ) ) ;
addFootColStart ( repeatFootPanel ) ;
outfreezePanel . add ( initPageFrozenPane ( ) , BorderLayout . NORTH ) ;
outfreezePanel . add ( initPageFrozenFootPane ( ) , BorderLayout . CENTER ) ;
JPanel writePanel = FRGUIPaneFactory . createTitledBorderPane ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_Engine_Frozen" ) ) ;
addWriteFrozen ( writePanel ) ;
tabbedPane = new UITabbedPane ( ) ;
//去除对应的焦点虚线边框
tabbedPane . setFocusable ( false ) ;
tabbedPane . addTab ( Toolkit . i18nText ( "Fine-Design_Basic_M_Page_Preview" ) , pagePanel ) ;
tabbedPane . addTab ( Toolkit . i18nText ( "Fine-Design_Basic_M_Write_Preview" ) , writePanel ) ;
this . add ( tabbedPane ) ;
initPageRwoListener ( ) ;
initPageColListener ( ) ;
initWriteListener ( ) ;
@ -253,8 +296,11 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
private void initPageRwoListener ( ) {
repeatTitleRowPane . addListener ( freezePageRowListener ) ;
// 分页重复冻结行
usePageFrozenRCheckBox . addChangeListener ( usePageFrozenRListener ) ;
repeatFinisRowPane . addListener ( freezePageFootRowListener ) ;
// 分页重复冻结标题行
usePageHeadFrozenRCheckBox . addChangeListener ( usePageFrozenRListener ) ;
//分页重复冻结结尾行
usePageFootFrozenRCheckBox . addChangeListener ( freezePageFootRowListener ) ;
//重复标题行
useRepeatTitleRCheckBox . addChangeListener ( useRepeatTitleRListener ) ;
//重复结尾行
@ -263,8 +309,11 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
protected void initPageColListener ( ) {
repeatTitleColPane . addListener ( freezePageColListener ) ;
// 分页重复冻结列
usePageFrozenCCheckBox . addChangeListener ( usePageFrozenCListener ) ;
repeatFinisColPane . addListener ( freezePageFootColListener ) ;
// 分页重复冻结标题列
usePageHeadFrozenCCheckBox . addChangeListener ( usePageFrozenCListener ) ;
//分页重复冻结结尾列
usePageFootFrozenCCheckBox . addChangeListener ( freezePageFootColListener ) ;
//重复标题列
useRepeatTitleCCheckBox . addChangeListener ( useRepeatTitleCListener ) ;
//重复结尾列
@ -287,7 +336,14 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
@Override
public void stateChanged ( ChangeEvent e ) {
repeatFinisColPane . setEnabled ( useRepeatFinisCCheckBox . isSelected ( ) ) ;
boolean flag = useRepeatFinisCCheckBox . isSelected ( ) ;
repeatFinisColPane . setEnabled ( flag ) ;
if ( ! flag ) {
usePageFootFrozenCCheckBox . setSelected ( false ) ;
usePageFootFrozenCCheckBox . setEnabled ( false ) ;
} else {
usePageFootFrozenCCheckBox . setEnabled ( true ) ;
}
}
} ;
@ -296,8 +352,14 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
@Override
public void stateChanged ( ChangeEvent e ) {
repeatFinisRowPane . setEnabled ( useRepeatFinisRCheckBox . isSelected ( ) ) ;
boolean flag = useRepeatFinisRCheckBox . isSelected ( ) ;
repeatFinisRowPane . setEnabled ( flag ) ;
if ( ! flag ) {
usePageFootFrozenRCheckBox . setSelected ( false ) ;
usePageFootFrozenRCheckBox . setEnabled ( false ) ;
} else {
usePageFootFrozenRCheckBox . setEnabled ( true ) ;
}
}
} ;
@ -308,10 +370,10 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
boolean flag = useRepeatTitleCCheckBox . isSelected ( ) ;
repeatTitleColPane . setEnabled ( flag ) ;
if ( ! flag ) {
usePageFrozenCCheckBox . setSelected ( false ) ;
usePageFrozenCCheckBox . setEnabled ( false ) ;
usePageHead FrozenCCheckBox . setSelected ( false ) ;
usePageHead FrozenCCheckBox . setEnabled ( false ) ;
} else {
usePageFrozenCCheckBox . setEnabled ( true ) ;
usePageHead FrozenCCheckBox . setEnabled ( true ) ;
}
}
} ;
@ -323,10 +385,10 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
boolean flag = useRepeatTitleRCheckBox . isSelected ( ) ;
repeatTitleRowPane . setEnabled ( flag ) ;
if ( ! flag ) {
usePageFrozenRCheckBox . setSelected ( false ) ;
usePageFrozenRCheckBox . setEnabled ( false ) ;
usePageHead FrozenRCheckBox . setSelected ( false ) ;
usePageHead FrozenRCheckBox . setEnabled ( false ) ;
} else {
usePageFrozenRCheckBox . setEnabled ( true ) ;
usePageHead FrozenRCheckBox . setEnabled ( true ) ;
}
}
} ;
@ -352,14 +414,14 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
ChangeListener usePageFrozenCListener = new ChangeListener ( ) {
@Override
public void stateChanged ( ChangeEvent e ) {
freezePageColPane . setEnabled ( usePageFrozenCCheckBox . isSelected ( ) ) ;
freezePageColPane . setEnabled ( usePageHead FrozenCCheckBox . isSelected ( ) ) ;
}
} ;
ChangeListener usePageFrozenRListener = new ChangeListener ( ) {
@Override
public void stateChanged ( ChangeEvent e ) {
freezePageRowPane . setEnabled ( usePageFrozenRCheckBox . isSelected ( ) ) ;
freezePageRowPane . setEnabled ( usePageHead FrozenRCheckBox . isSelected ( ) ) ;
}
} ;
@ -383,6 +445,28 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
}
} ;
// 分页重复冻结列数据联动(结尾行)
ChangeListener freezePageFootRowListener = new ChangeListener ( ) {
@Override
public void stateChanged ( ChangeEvent e ) {
FT ft = repeatFinisRowPane . updateBean ( ) ;
int to = ft . getTo ( ) ;
int maxFrom = Math . max ( ft . getFrom ( ) , - 1 ) ;
freezeFootRowPane . populateBean ( new FT ( maxFrom , Math . max ( maxFrom , to ) ) ) ;
}
} ;
// 分页重复冻结列数据联动(结尾列)
ChangeListener freezePageFootColListener = new ChangeListener ( ) {
@Override
public void stateChanged ( ChangeEvent e ) {
FT ft = repeatFinisColPane . updateBean ( ) ;
int to = ft . getTo ( ) ;
int maxFrom = Math . max ( ft . getFrom ( ) , - 1 ) ;
freezeFootColPane . populateBean ( new FT ( maxFrom , Math . max ( maxFrom , to ) ) ) ;
}
} ;
/ * *
* 窗口标题
*
@ -407,7 +491,8 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
if ( isDefalut ( ft ) ) {
this . repeatTitleRowPane . populateBean ( defaultFT ) ;
this . repeatTitleRowPane . setEnabled ( false ) ;
usePageFrozenRCheckBox . setEnabled ( false ) ;
usePageHeadFrozenRCheckBox . setEnabled ( false ) ;
usePageFootFrozenRCheckBox . setEnabled ( false ) ;
} else {
this . repeatTitleRowPane . populateBean ( ft ) ;
useRepeatTitleRCheckBox . setSelected ( true ) ;
@ -423,7 +508,8 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
useRepeatFinisRCheckBox . setSelected ( true ) ;
}
this . usePageFrozenRCheckBox . setSelected ( attribute . isUsePageFrozenRow ( ) ) ;
this . usePageHeadFrozenRCheckBox . setSelected ( attribute . isUsePageFrozenRow ( ) ) ;
this . usePageFootFrozenRCheckBox . setSelected ( attribute . isUsePageFrozenRow ( ) ) ;
this . freezePageRowPane . setEnabled ( attribute . isUsePageFrozenRow ( ) ) ;
}
@ -432,7 +518,8 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
if ( isDefalut ( ft ) ) {
this . repeatTitleColPane . populateBean ( defaultFT ) ;
this . repeatTitleColPane . setEnabled ( false ) ;
usePageFrozenCCheckBox . setEnabled ( false ) ;
usePageHeadFrozenCCheckBox . setEnabled ( false ) ;
usePageFootFrozenCCheckBox . setEnabled ( false ) ;
} else {
this . repeatTitleColPane . populateBean ( ft ) ;
useRepeatTitleCCheckBox . setSelected ( true ) ;
@ -448,7 +535,8 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
useRepeatFinisCCheckBox . setSelected ( true ) ;
}
this . usePageFrozenCCheckBox . setSelected ( attribute . isUsePageFrozenColumn ( ) ) ;
this . usePageHeadFrozenCCheckBox . setSelected ( attribute . isUsePageFrozenColumn ( ) ) ;
this . usePageFootFrozenCCheckBox . setSelected ( attribute . isUsePageFrozenColumn ( ) ) ;
this . freezePageColPane . setEnabled ( attribute . isUsePageFrozenColumn ( ) ) ;
}
@ -494,6 +582,17 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
return attribute ;
}
/ * *
* 给内部的重复与冻结选项添加指定的边框
*
* @param jPanel 重复或冻结对应的界面
* @param title 边框的文字
* /
public static void addBorder ( JPanel jPanel , String title ) {
jPanel . setBorder ( BorderFactory . createTitledBorder ( BorderFactory . createMatteBorder ( 1 , 0 , 0 , 0 , UIConstants . TITLED_BORDER_COLOR ) , title ) ) ;
jPanel . setPreferredSize ( new Dimension ( REPEAT_AND_FROZEN_WIDTH , REPEAT_AND_FROZEN_HEIGHT ) ) ;
}
protected void updateRowPane ( ReportPageAttrProvider attribute ) {
// 重复标题行
int titleFrom = valid ( useRepeatTitleRCheckBox , this . repeatTitleRowPane . updateBean ( ) . getFrom ( ) ) ;
@ -506,7 +605,8 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
attribute . setRepeatFooterRowFrom ( finishFrom ) ;
attribute . setRepeatFooterRowTo ( finishTo ) ;
attribute . setUsePageFrozenRow ( this . usePageFrozenRCheckBox . isSelected ( ) ) ;
attribute . setUsePageFrozenRow ( this . usePageHeadFrozenRCheckBox . isSelected ( ) | | this . usePageFootFrozenRCheckBox . isSelected ( ) ) ;
attribute . setUsePageFootFrozen ( this . usePageFootFrozenRCheckBox . isSelected ( ) | | this . usePageFootFrozenCCheckBox . isSelected ( ) ) ;
}
private int valid ( UICheckBox checkBox , int num ) {
@ -524,7 +624,8 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
attribute . setRepeatFooterColumnFrom ( finishFrom ) ;
attribute . setRepeatFooterColumnTo ( finishTo ) ;
attribute . setUsePageFrozenColumn ( this . usePageFrozenCCheckBox . isSelected ( ) ) ;
attribute . setUsePageFrozenColumn ( this . usePageHeadFrozenCCheckBox . isSelected ( ) | | this . usePageFootFrozenCCheckBox . isSelected ( ) ) ;
attribute . setUsePageFootFrozen ( this . usePageFootFrozenRCheckBox . isSelected ( ) | | this . usePageFootFrozenCCheckBox . isSelected ( ) ) ;
}
/ * *