@ -1,6 +1,7 @@
package com.fr.design.mainframe.cell.settingpane ;
import com.fine.swing.ui.layout.Layouts ;
import com.fine.swing.ui.layout.Row ;
import com.fine.theme.utils.FineUIStyle ;
import com.fine.theme.utils.FineUIUtils ;
import com.formdev.flatlaf.util.ScaledEmptyBorder ;
@ -11,7 +12,6 @@ import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory ;
import com.fr.design.file.HistoryTemplateListPane ;
import com.fr.design.foldablepane.UIExpandablePane ;
import com.fr.design.gui.core.ReactiveCardPane ;
import com.fr.design.gui.ibutton.UIButtonGroup ;
import com.fr.design.gui.ibutton.UIRadioButton ;
import com.fr.design.gui.icheckbox.UICheckBox ;
@ -74,14 +74,14 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private UIComboBox showContent ;
//内容提示
private ReactiveCardPane showContentPane ;
private JPanel showContentPane ;
private UIButtonGroup tooltipButtonGroup ;
private ReactiveCardPane tooltipPane ;
private JPanel tooltipPane ;
private UITextField tooltipTextField ;
private UITextField fileNameTextField ;
//文本超出时隐藏
private ReactiveCardPane overflowPane ;
private JPanel overflowPane ;
private UICheckBox textOverflowCheckBox ;
private int curSelectedIndex ;
private UIComboBox showPartComboBox ;
@ -112,7 +112,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
// 插入行策略
private UIButtonGroup insertRowPolicyButtonGroup ;
private ValueEditorPane valueEditor ;
private ReactiveCardPane insertRowPolicyPane ;
private JPanel insertRowPolicyPane ;
private UILabel insertRowPolicyLabel ;
private UIRadioButton exportButton ;
@ -220,6 +220,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
initInsertRowPolicyPane ( ) ;
return Layouts . column ( LayoutConstants . VERTICAL_GAP ,
cell ( seniorUpPane ( ) ) ,
row (
cell ( insertRowPolicyLabel ) . weight ( 1 . 2 ) ,
cell ( insertRowPolicyButtonGroup ) . weight ( 3 )
) ,
cell ( insertRowPolicyPane )
) . with ( it - > it . setBorder ( new ScaledEmptyBorder ( 0 , 0 , LayoutConstants . VERTICAL_GAP , 0 ) )
) . getComponent ( ) ;
@ -236,29 +240,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
insertRowPolicyLabel = new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_CellWrite_InsertRow_Policy" , SwingConstants . LEFT ) ) ;
UIComponentUtils . setLineWrap ( insertRowPolicyLabel ) ;
insertRowPolicyPane = ReactiveCardPane . create ( )
. addSupplier ( "empty" , ( ) - > Layouts . column ( LayoutConstants . VERTICAL_GAP ,
row (
cell ( insertRowPolicyLabel ) . weight ( 1 . 2 ) ,
cell ( insertRowPolicyButtonGroup ) . weight ( 3 )
)
) . getComponent ( ) )
. addSupplier ( "default" , ( ) - > Layouts . column ( LayoutConstants . VERTICAL_GAP ,
row (
cell ( insertRowPolicyLabel ) . weight ( 1 . 2 ) ,
cell ( insertRowPolicyButtonGroup ) . weight ( 3 )
) ,
row (
flex ( 1 . 2 ) ,
cell ( valueEditor ) . weight ( 3 )
)
) . getComponent ( )
) ;
insertRowPolicyPane . select ( "empty" ) . populate ( ) ;
insertRowPolicyPane = row ( flex ( 1 . 2 ) , cell ( valueEditor ) . weight ( 3 ) ) . getComponent ( ) ;
insertRowPolicyPane . setVisible ( false ) ;
insertRowPolicyButtonGroup . addChangeListener ( e - > {
String key = insertRowPolicyButtonGroup . getSelectedIndex ( ) = = 1 ? "default" : "empty" ;
insertRowPolicyPane . select ( key ) . populate ( ) ;
insertRowPolicyPane . setVisible ( insertRowPolicyButtonGroup . getSelectedIndex ( ) = = 1 ) ;
} ) ;
}
@ -284,32 +270,24 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
UILabel showContentLabel = new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_Show_Content" ) , SwingConstants . LEFT ) ;
UIComponentUtils . setLineWrap ( showContentLabel ) ;
Row downloadRow = row (
cell ( downloadLabel ) . weight ( 1 . 2 ) , cell ( fileNameTextField ) . weight ( 3 . 0 )
) . getComponent ( ) ;
downloadRow . setVisible ( false ) ;
initTooltipPane ( ) ;
showContentPane = ReactiveCardPane . create ( )
. addSupplier ( "default" , ( ) - > column ( LayoutConstants . VERTICAL_GAP ,
row (
cell ( showContentLabel ) . weight ( 1 . 2 ) , cell ( showContent ) . weight ( 3 . 0 )
) ,
cell ( tooltipPane )
) . getComponent ( ) )
. addSupplier ( "download" , ( ) - > column ( LayoutConstants . VERTICAL_GAP ,
row (
cell ( showContentLabel ) . weight ( 1 . 2 ) , cell ( showContent ) . weight ( 3 . 0 )
) ,
row (
cell ( downloadLabel ) . weight ( 1 . 2 ) , cell ( fileNameTextField ) . weight ( 3 . 0 )
) ,
cell ( tooltipPane )
) . getComponent ( ) ) ;
showContentPane . select ( "default" ) . populate ( ) ;
showContentPane = column ( 10 ,
row (
cell ( showContentLabel ) . weight ( 1 . 2 ) , cell ( showContent ) . weight ( 3 . 0 )
) ,
cell ( downloadRow ) ,
cell ( tooltipPane )
) . getComponent ( ) ;
showContent . addItemListener ( e - > {
if ( e . getStateChange ( ) = = ItemEvent . SELECTED ) {
if ( showContent . getSelectedIndex ( ) = = DOWNLOAD_INDEX ) {
showContentPane . select ( "download" ) . populate ( ) ;
} else {
showContentPane . select ( "default" ) . populate ( ) ;
}
downloadRow . setVisible ( showContent . getSelectedIndex ( ) = = DOWNLOAD_INDEX ) ;
handleCellShowStyleChange ( e ) ;
}
} ) ;
@ -320,28 +298,19 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
tooltipButtonGroup = new UIButtonGroup ( new String [ ] { Toolkit . i18nText ( "Fine-Design_Report_CellWrite_ToolTip_Custom" ) ,
Toolkit . i18nText ( "Fine-Design_Report_CellWrite_ToolTip_CellValue" ) } ) ;
tooltipTextField = new UITextField ( ) ;
tooltipPane = ReactiveCardPane . create ( )
. addSupplier ( "define" , ( ) - > column ( LayoutConstants . VERTICAL_GAP ,
row (
cell ( toolTipLabel ) . weight ( 1 . 2 ) , cell ( tooltipButtonGroup ) . weight ( 3 . 0 )
) ,
row (
flex ( 1 . 2 ) , cell ( tooltipTextField ) . weight ( 3 . 0 )
)
) . getComponent ( ) )
. addSupplier ( "cellValue" , ( ) - > column ( LayoutConstants . VERTICAL_GAP ,
row (
cell ( toolTipLabel ) . weight ( 1 . 2 ) , cell ( tooltipButtonGroup ) . weight ( 3 . 0 )
)
) . getComponent ( ) ) ;
tooltipPane . select ( "define" ) . populate ( ) ;
Row tooltipTextRow = row (
flex ( 1 . 2 ) , cell ( tooltipTextField ) . weight ( 3 . 0 )
) . getComponent ( ) ;
tooltipPane = column ( 10 ,
row (
cell ( toolTipLabel ) . weight ( 1 . 2 ) , cell ( tooltipButtonGroup ) . weight ( 3 . 0 )
) ,
cell ( tooltipTextRow )
) . getComponent ( ) ;
tooltipButtonGroup . addChangeListener ( e - > {
if ( tooltipButtonGroup . getSelectedIndex ( ) = = 0 ) {
tooltipPane . select ( "define" ) . populate ( ) ;
} else {
tooltipPane . select ( "cellValue" ) . populate ( ) ;
}
tooltipTextRow . setVisible ( tooltipButtonGroup . getSelectedIndex ( ) = = 0 ) ;
} ) ;
}
@ -354,35 +323,40 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
UILabel hideTypeLabel = new UILabel ( Toolkit . i18nText ( "Fine-Design_Report_CellWrite_TextOverflow_HideType" ) ) ;
textOverflowCheckBox = new UICheckBox ( Toolkit . i18nText ( "Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow" ) ) ;
overflowPane = ReactiveCardPane . create ( )
. addSupplier ( "empty" , ( ) - > column ( LayoutConstants . VERTICAL_GAP ,
row ( cell ( textOverflowCheckBox ) )
) . getComponent ( ) )
. addSupplier ( "showChar" , ( ) - > column ( LayoutConstants . VERTICAL_GAP ,
row ( cell ( textOverflowCheckBox ) ) ,
row ( cell ( showPartLabel ) . weight ( 1 . 2 ) , cell ( showPartComboBox ) . weight ( 1 . 4 ) , flex ( 0 . 1 ) , cell ( numberLabel ) . weight ( 0 . 5 ) , cell ( showCharNums ) . weight ( 1 . 0 ) ) ,
row ( cell ( hideTypeLabel ) . weight ( 1 . 2 ) , cell ( textOverflowTypeComboBox ) . weight ( 3 . 0 ) )
) . getComponent ( ) )
. addSupplier ( "showCell" , ( ) - > column ( LayoutConstants . VERTICAL_GAP ,
row ( cell ( textOverflowCheckBox ) ) ,
row ( cell ( showPartLabel ) . weight ( 1 . 2 ) , cell ( showPartComboBox ) . weight ( 3 . 0 ) ) ,
row ( cell ( hideTypeLabel ) . weight ( 1 . 2 ) , cell ( textOverflowTypeComboBox ) . weight ( 3 . 0 ) )
) . getComponent ( ) ) ;
overflowPane . select ( "empty" ) . populate ( ) ;
// 字符长度-数量
Row numPane = row ( flex ( 0 . 1 ) , cell ( numberLabel ) . weight ( 0 . 5 ) , cell ( showCharNums ) . weight ( 1 . 0 ) ) . getComponent ( ) ;
// 显示部分 & 隐藏方式
JPanel overflowPolicyPane = column ( 10 ,
row (
cell ( showPartLabel ) . weight ( 1 . 2 ) ,
row (
cell ( showPartComboBox ) . weight ( 1 . 4 ) ,
cell ( numPane ) . weight ( 1 . 6 )
) . weight ( 3 )
) ,
row (
cell ( hideTypeLabel ) . weight ( 1 . 2 ) ,
cell ( textOverflowTypeComboBox ) . weight ( 3 . 0 )
)
) . getComponent ( ) ;
overflowPane = column ( 10 ,
row ( cell ( textOverflowCheckBox ) ) ,
cell ( overflowPolicyPane )
) . getComponent ( ) ;
overflowPolicyPane . setVisible ( false ) ;
showPartComboBox . addItemListener ( e - > {
if ( showPartComboBox . getSelectedIndex ( ) = = 0 ) {
overflowPane . select ( "showChar" ) . populate ( ) ;
} else {
overflowPane . select ( "showCell" ) . populate ( ) ;
}
numPane . setVisible ( showPartComboBox . getSelectedIndex ( ) = = 0 ) ;
} ) ;
textOverflowCheckBox . addItemListener ( e - > {
if ( e . getStateChange ( ) = = ItemEvent . SELECTED ) {
if ( showPartComboBox . getSelectedIndex ( ) = = 0 ) {
overflowPane . select ( "showChar" ) . populate ( ) ;
} else {
overflowPane . select ( "showCell" ) . populate ( ) ;
}
overflowPolicyPane . setVisible ( true ) ;
numPane . setVisible ( showPartComboBox . getSelectedIndex ( ) = = 0 ) ;
// 记录目前自动调整哪个被选中
for ( int i = 0 ; i < adjustRadioButtons . length ; i + + ) {
if ( adjustRadioButtons [ i ] . isSelected ( ) ) {
@ -392,7 +366,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
}
noAutoRadioButton . setSelected ( true ) ;
} else {
overflowPane . select ( "empty" ) . populate ( ) ;
overflowPolicyP ane . setVisible ( false ) ;
adjustRadioButtons [ curSelectedIndex ] . setSelected ( true ) ;
}
} ) ;
@ -557,12 +531,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} else {
tooltipButtonGroup . setSelectedIndex ( 1 ) ;
}
if ( tooltipButtonGroup . getSelectedIndex ( ) = = 0 ) {
tooltipPane . select ( "define" ) . populate ( ) ;
} else {
tooltipPane . select ( "cellValue" ) . populate ( ) ;
}
tooltipPane . setVisible ( true ) ;
tooltipPane . setVisible ( tooltipButtonGroup . getSelectedIndex ( ) = = 0 ) ;
if ( cellGUIAttr . isHideTextWhenOverflow ( ) ) {
textOverflowCheckBox . setSelected ( true ) ;
if ( cellGUIAttr . isShowCharNum ( ) ) {
@ -607,12 +576,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
insertRowPolicyButtonGroup . setSelectedIndex ( 0 ) ;
this . valueEditor . populate ( StringUtils . EMPTY ) ;
}
String key = insertRowPolicyButtonGroup . getSelectedIndex ( ) = = 1 ? "default" : "empty" ;
insertRowPolicyPane . select ( key ) . populate ( ) ;
insertRowPolicyPane . setVisible ( true ) ;
insertRowPolicyPane . setVisible ( insertRowPolicyButtonGroup . getSelectedIndex ( ) = = 1 ) ;
JTemplate jTemplate = HistoryTemplateListPane . getInstance ( ) . getCurrentEditingTemplate ( ) ;
if ( ! jTemplate . isJWorkBook ( ) ) { //表单中报表块编辑屏蔽掉 插入行策略
insertRowPolicyPane . select ( "empty" ) . populate ( ) ;
insertRowPolicyPane . setVisible ( false ) ;
}
populateDesensitizationBean ( cellElement ) ;
}