@ -1,7 +1,6 @@
package com.fr.quickeditor.cellquick ;
import com.fr.base.BaseFormula ;
import com.fr.design.actions.UpdateAction ;
import com.fr.design.actions.columnrow.DSColumnConditionAction ;
import com.fr.design.actions.core.ActionFactory ;
import com.fr.design.actions.insert.cell.DSColumnCellAction ;
@ -26,7 +25,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.design.layout.TableLayout ;
import com.fr.design.layout.TableLayoutHelper ;
import com.fr.design.mainframe.cell.CellEditorPane ;
import com.fr.design.mainframe.cell.AbstractDS CellEditorPane ;
import com.fr.general.IOUtils ;
import com.fr.general.Inter ;
import com.fr.quickeditor.CellQuickEditor ;
@ -37,10 +36,18 @@ import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FilterTypeEnum ;
import com.fr.report.cell.cellattr.core.group.SelectCount ;
import javax.swing.* ;
import javax.swing.BorderFactory ;
import javax.swing.Icon ;
import javax.swing.JComponent ;
import javax.swing.JPanel ;
import javax.swing.SwingUtilities ;
import javax.swing.event.ChangeEvent ;
import javax.swing.event.ChangeListener ;
import java.awt.* ;
import java.awt.BorderLayout ;
import java.awt.CardLayout ;
import java.awt.Color ;
import java.awt.Component ;
import java.awt.Dimension ;
import java.awt.event.ActionEvent ;
import java.awt.event.ActionListener ;
import java.awt.event.ItemEvent ;
@ -63,7 +70,6 @@ import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.UNDEFINE;
* @since 9 . 0
* /
public class CellDSColumnEditor extends CellQuickEditor {
private static final double P = TableLayout . PREFERRED , F = TableLayout . FILL ;
private static final Color TIP_FONT_COLOR = new Color ( 0x7F333334 , true ) ;
@ -71,18 +77,34 @@ public class CellDSColumnEditor extends CellQuickEditor {
private JPanel dsColumnRegion ;
private JPanel centerPane ;
// 基本和高级设置
private ArrayList < CellEditorPane > paneList ;
// 基本和高级设置 卡片布局
/ * *
* 基本和高级设置
* /
private ArrayList < AbstractDSCellEditorPane > paneList ;
/ * *
* 基本和高级设置 卡片布局
* /
private CardLayout card ;
// 基本和高级设置 容器面板
/ * *
* 基本和高级设置 容器面板
* /
private JPanel cardContainer ;
// 卡片布局TAB切换按钮
/ * *
* 卡片布局TAB切换按钮
* /
private UIHeadGroup tabsHeaderIconPane ;
// 数据列高级设置
/ * *
* 数据列基本设置
* /
private DSColumnBasicEditorPane cellDSColumnBasicPane ;
/ * *
* 数据列高级设置
* /
private DSColumnAdvancedEditorPane cellDSColumnAdvancedPane ;
private CellDSColumnEditor ( ) {
public CellDSColumnEditor ( ) {
super ( ) ;
}
@ -109,36 +131,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
/ * *
* 内容全部重新动态生成 , 不然容易出错
* 刷新详细信息面板
* /
@Override
protected void refreshDetails ( ) {
this . createPanes ( ) ;
this . createSwitchTab ( ) ;
dsColumnRegion = new JPanel ( new BorderLayout ( ) ) ;
dsColumnRegion . add ( tabsHeaderIconPane , BorderLayout . NORTH ) ;
dsColumnRegion . add ( cardContainer , BorderLayout . CENTER ) ;
//必须removeAll之后再添加;重新再实例化一个centerJPanel,因为对象变了会显示不出来
centerPane . removeAll ( ) ;
centerPane . add ( dsColumnRegion , BorderLayout . CENTER ) ;
for ( CellEditorPane cellEditorPane : paneList ) {
cellEditorPane . populate ( ) ;
}
cellDSColumnBasicPane . populate ( ) ;
cellDSColumnAdvancedPane . populate ( ) ;
this . validate ( ) ;
}
/ * *
* 关闭时候释放
* /
public void release ( ) {
super . release ( ) ;
dsColumnRegion = null ;
centerPane = null ;
}
/ * *
* 初始化基本和高级设置切换tab
* /
@ -147,7 +149,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
card = new CardLayout ( ) ;
cardContainer = new JPanel ( card ) ;
for ( int i = 0 ; i < paneList . size ( ) ; i + + ) {
CellEditorPane pane = paneList . get ( i ) ;
AbstractDS CellEditorPane pane = paneList . get ( i ) ;
iconArray [ i ] = pane . getIconPath ( ) ;
cardContainer . add ( pane , pane . title4PopupWindow ( ) ) ;
}
@ -162,20 +164,24 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
/ * *
* 刷新 数据列基本和高级设置面板
* 数据列基本和高级设置面板
* /
private void createPanes ( ) {
paneList = new ArrayList < > ( ) ;
/*基本设置面板*/
DSColumnBasicEditorPane cellDSColumnBasicPane = new DSColumnBasicEditorPane ( ) ;
cellDSColumnBasicPane = new DSColumnBasicEditorPane ( ) ;
paneList . add ( cellDSColumnBasicPane ) ;
/*高级设置面板*/
cellDSColumnAdvancedPane = new DSColumnAdvancedEditorPane ( ) ;
paneList . add ( cellDSColumnAdvancedPane ) ;
}
@Override
public void release ( ) {
super . release ( ) ;
cellDSColumnBasicPane . release ( ) ;
cellDSColumnAdvancedPane . release ( ) ;
}
/ * *
* 单元格元素 数据列 高级设置内容面板
@ -184,16 +190,34 @@ public class CellDSColumnEditor extends CellQuickEditor {
* @version 2017年7月25日
* @since 9 . 0
* /
class DSColumnBasicEditorPane extends CellEditorPane {
class DSColumnBasicEditorPane extends AbstractDS CellEditorPane {
//数据集和数据列
/ * *
* 数据集和数据列
* /
private SelectedDataColumnPane dataPane ;
//数据分组设置
/ * *
* 数据分组设置
* /
private ResultSetGroupDockingPane groupPane ;
//条件过滤按钮面板
/ * *
* 条件过滤按钮面板
* /
private JPanel conditionPane ;
// 分组设置监听器
/ * *
* 条件过滤按钮触发动作
* /
private DSColumnConditionAction condition ;
/ * *
* 条件过滤按钮
* /
private UIButton conditionUIButton ;
/ * *
* 分组设置监听器
* /
private ItemListener groupListener = new ItemListener ( ) {
@Override
public void itemStateChanged ( ItemEvent e ) {
@ -209,7 +233,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
}
} ;
//数据集列设置监听器
/ * *
* 数据集列设置监听器
* /
private ItemListener dataListener = new ItemListener ( ) {
@Override
public void itemStateChanged ( ItemEvent e ) {
@ -221,7 +247,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
} ;
DSColumnBasicEditorPane ( ) {
dataPane = new SelectedDataColumnPane ( true , true , tc , cellElement ) ;
dataPane = new SelectedDataColumnPane ( true , true , cellElement ) ;
groupPane = new ResultSetGroupDockingPane ( ) ;
dataPane . addListener ( dataListener ) ;
groupPane . setListener ( groupListener ) ;
@ -229,17 +255,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
double [ ] rowSize = { P } , columnSize = { P , F } ;
UILabel uiLabel = new UILabel ( Inter . getLocText ( "FR-Designer_Filter_Conditions" ) ) ;
uiLabel . setPreferredSize ( LABEL_DIMENSION ) ;
UIButton uiButton = new UIButt on( ) ;
condition = new DSColumnConditionActi on( ) ;
if ( tc ! = null ) {
//第一次初始化时tc为空,会引发NullPointerException
UpdateAction condition = new DSColumnConditionAction ( tc ) ;
condition . setEditingComponent ( tc ) ;
}
//丢掉icon,修改按钮名称为编辑
condition . setSmallIcon ( null ) ;
condition . setName ( Inter . getLocText ( "FR-Designer_Edit" ) ) ;
uiButton = new UIButton ( condition ) ;
}
conditionUIButton = new UIButton ( condition ) ;
Component [ ] [ ] components = new Component [ ] [ ] {
new Component [ ] { uiLabel , ui Button}
new Component [ ] { uiLabel , conditionUI Button}
} ;
conditionPane = TableLayoutHelper . createGapTableLayoutPane ( components , rowSize , columnSize , HGAP , VGAP ) ;
this . createScrollPane ( ) ;
@ -267,8 +292,17 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override
public void populate ( ) {
dataPane . populate ( null , cellElement ) ;
dataPane . populate ( DesignTableDataManager . getEditingTableDataSource ( ) , cellElement , tc ) ;
groupPane . populate ( cellElement ) ;
if ( tc ! = null ) {
condition . setEditingComponent ( tc ) ;
}
}
@Override
protected void release ( ) {
condition . setEditingComponent ( null ) ;
dataPane . release ( ) ;
}
@ -277,6 +311,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
*
* @return content JPanel
* /
@Override
protected JPanel createContentPane ( ) {
double [ ] columnSize = { F } ;
@ -294,23 +329,39 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
class DSColumnAdvancedEditorPane extends CellEditorPane {
class DSColumnAdvancedEditorPane extends AbstractDS CellEditorPane {
//排列顺序
/ * *
* 排列顺序
* /
private ResultSetSortConfigPane sortPane ;
//结果集筛选
/ * *
* 结果集筛选
* /
private ResultSetFilterConfigPane filterPane ;
//自定义值显示
/ * *
* 自定义值显示
* /
private CustomValuePane valuePane ;
//横向可扩展性
/ * *
* 横向可扩展性
* /
private UICheckBox heCheckBox ;
//纵向可扩展性
/ * *
* 纵向可扩展性
* /
private UICheckBox veCheckBox ;
//补充空白数据
/ * *
* 补充空白数据
* /
private UICheckBox useMultiplyNumCheckBox ;
//补充空白数据数目输入框
/ * *
* 补充空白数据数目输入框
* /
private UISpinner multiNumSpinner ;
//补充空白数据数目面板 可隐藏
/ * *
* 补充空白数据数目面板 可隐藏
* /
private JPanel multiPane ;
@ -384,6 +435,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
}
@Override
protected void release ( ) {
}
/ * *
* 更新单元格扩展属性
* /
@ -426,6 +482,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
*
* @return 内容面板
* /
@Override
protected JPanel createContentPane ( ) {
this . setLayout ( FRGUIPaneFactory . createBorderLayout ( ) ) ;
//结果集排序
@ -501,6 +558,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
multiPane . setBorder ( BorderFactory . createEmptyBorder ( 0 , 20 , 0 , 0 ) ) ;
multiNumPane . add ( multiPane ) ;
useMultiplyNumCheckBox . addActionListener ( new ActionListener ( ) {
@Override
public void actionPerformed ( ActionEvent e ) {
checkButtonEnabled ( ) ;
cellDSColumnAdvancedPane . updateMultipleConfig ( ) ;
@ -548,7 +606,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
public class ResultSetSortConfigPane extends JPanel {
private static final String DEFAULT_VALUE = "=" ;
private JPanel contentPane ;
//面板
private UIButtonGroup sortTypePane ;
private JFormulaField formulaField ;
private CardLayout cardLayout ;
@ -675,6 +732,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
private JFormulaField bottomFormulaPane ;
private ActionListener actionListener = new ActionListener ( ) {
@Override
public void actionPerformed ( ActionEvent evt ) {
int selectIndex = rsComboBox . getSelectedIndex ( ) ;
CardLayout setCardPaneLayout = ( CardLayout ) setCardPane . getLayout ( ) ;
@ -978,6 +1036,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
private ActionListener formulaButtonActionListener = new ActionListener ( ) {
@Override
public void actionPerformed ( ActionEvent evt ) {
BaseFormula valueFormula = BaseFormula . createFormulaBuilder ( ) . build ( ) ;
String text = formulaTextField . getText ( ) ;