|
|
|
@ -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.AbstractDSCellEditorPane; |
|
|
|
|
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,22 +131,12 @@ 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(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -132,6 +144,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
/** |
|
|
|
|
* 关闭时候释放 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void release() { |
|
|
|
|
super.release(); |
|
|
|
|
dsColumnRegion = null; |
|
|
|
@ -147,7 +160,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); |
|
|
|
|
AbstractDSCellEditorPane pane = paneList.get(i); |
|
|
|
|
iconArray[i] = pane.getIconPath(); |
|
|
|
|
cardContainer.add(pane, pane.title4PopupWindow()); |
|
|
|
|
} |
|
|
|
@ -162,17 +175,15 @@ 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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -184,16 +195,34 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
* @version 2017年7月25日 |
|
|
|
|
* @since 9.0 |
|
|
|
|
*/ |
|
|
|
|
class DSColumnBasicEditorPane extends CellEditorPane { |
|
|
|
|
class DSColumnBasicEditorPane extends AbstractDSCellEditorPane { |
|
|
|
|
|
|
|
|
|
//数据集和数据列
|
|
|
|
|
/** |
|
|
|
|
* 数据集和数据列 |
|
|
|
|
*/ |
|
|
|
|
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 +238,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
//数据集列设置监听器
|
|
|
|
|
/** |
|
|
|
|
* 数据集列设置监听器 |
|
|
|
|
*/ |
|
|
|
|
private ItemListener dataListener = new ItemListener() { |
|
|
|
|
@Override |
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
@ -229,17 +260,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 UIButton(); |
|
|
|
|
condition = new DSColumnConditionAction(); |
|
|
|
|
if (tc != null) { |
|
|
|
|
//第一次初始化时tc为空,会引发NullPointerException
|
|
|
|
|
UpdateAction condition = new DSColumnConditionAction(tc); |
|
|
|
|
//丢掉icon,修改按钮名称为编辑
|
|
|
|
|
condition.setSmallIcon(null); |
|
|
|
|
condition.setName(Inter.getLocText("FR-Designer_Edit")); |
|
|
|
|
uiButton = new UIButton(condition); |
|
|
|
|
condition.setEditingComponent(tc); |
|
|
|
|
} |
|
|
|
|
//丢掉icon,修改按钮名称为编辑
|
|
|
|
|
condition.setSmallIcon(null); |
|
|
|
|
condition.setName(Inter.getLocText("FR-Designer_Edit")); |
|
|
|
|
conditionUIButton = new UIButton(condition); |
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{uiLabel, uiButton} |
|
|
|
|
new Component[]{uiLabel, conditionUIButton} |
|
|
|
|
}; |
|
|
|
|
conditionPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); |
|
|
|
|
this.createScrollPane(); |
|
|
|
@ -269,6 +299,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
public void populate() { |
|
|
|
|
dataPane.populate(null, cellElement); |
|
|
|
|
groupPane.populate(cellElement); |
|
|
|
|
if (tc != null) { |
|
|
|
|
condition.setEditingComponent(tc); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -277,6 +310,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
* |
|
|
|
|
* @return content JPanel |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
protected JPanel createContentPane() { |
|
|
|
|
|
|
|
|
|
double[] columnSize = {F}; |
|
|
|
@ -294,23 +328,39 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DSColumnAdvancedEditorPane extends CellEditorPane { |
|
|
|
|
class DSColumnAdvancedEditorPane extends AbstractDSCellEditorPane { |
|
|
|
|
|
|
|
|
|
//排列顺序
|
|
|
|
|
/** |
|
|
|
|
* 排列顺序 |
|
|
|
|
*/ |
|
|
|
|
private ResultSetSortConfigPane sortPane; |
|
|
|
|
//结果集筛选
|
|
|
|
|
/** |
|
|
|
|
* 结果集筛选 |
|
|
|
|
*/ |
|
|
|
|
private ResultSetFilterConfigPane filterPane; |
|
|
|
|
//自定义值显示
|
|
|
|
|
/** |
|
|
|
|
* 自定义值显示 |
|
|
|
|
*/ |
|
|
|
|
private CustomValuePane valuePane; |
|
|
|
|
//横向可扩展性
|
|
|
|
|
/** |
|
|
|
|
* 横向可扩展性 |
|
|
|
|
*/ |
|
|
|
|
private UICheckBox heCheckBox; |
|
|
|
|
//纵向可扩展性
|
|
|
|
|
/** |
|
|
|
|
* 纵向可扩展性 |
|
|
|
|
*/ |
|
|
|
|
private UICheckBox veCheckBox; |
|
|
|
|
//补充空白数据
|
|
|
|
|
/** |
|
|
|
|
* 补充空白数据 |
|
|
|
|
*/ |
|
|
|
|
private UICheckBox useMultiplyNumCheckBox; |
|
|
|
|
//补充空白数据数目输入框
|
|
|
|
|
/** |
|
|
|
|
* 补充空白数据数目输入框 |
|
|
|
|
*/ |
|
|
|
|
private UISpinner multiNumSpinner; |
|
|
|
|
//补充空白数据数目面板 可隐藏
|
|
|
|
|
/** |
|
|
|
|
* 补充空白数据数目面板 可隐藏 |
|
|
|
|
*/ |
|
|
|
|
private JPanel multiPane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -426,6 +476,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
* |
|
|
|
|
* @return 内容面板 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
protected JPanel createContentPane() { |
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
//结果集排序
|
|
|
|
@ -501,6 +552,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 +600,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 +726,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 +1030,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(); |
|
|
|
|