Browse Source

REPORT-3348 数据列基本设置添加过滤条件设置,多个文件换行符和todo

master
yaoh.wu 7 years ago
parent
commit
98eec20b71
  1. 11
      designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java
  2. 105
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  3. 13
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

11
designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java

@ -23,11 +23,14 @@ public class DSColumnBasicEditorPane extends CellEditorPane {
private ResultSetGroupDockingPane groupPane; private ResultSetGroupDockingPane groupPane;
//当前编辑的单元格 //当前编辑的单元格
private TemplateCellElement cellElement; private TemplateCellElement cellElement;
//条件过滤按钮面板
private JPanel conditionPane;
public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane) { public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane, JPanel conditionPane) {
this.cellElement = cellElement; this.cellElement = cellElement;
this.dataPane = dataPane; this.dataPane = dataPane;
this.groupPane = groupPane; this.groupPane = groupPane;
this.conditionPane = conditionPane;
this.add(this.createContentPane(), BorderLayout.CENTER); this.add(this.createContentPane(), BorderLayout.CENTER);
} }
@ -66,12 +69,14 @@ public class DSColumnBasicEditorPane extends CellEditorPane {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
//数据集列选择 //数据集列选择
new Component[]{this.dataPane, null}, new Component[]{this.dataPane, null},
//数据分组设置 //数据分组设置
new Component[]{this.groupPane, null} new Component[]{this.groupPane, null},
//条件过滤
new Component[]{this.conditionPane, null}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }

105
designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -1,22 +1,22 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.SimpleDSColumn; import com.fr.data.SimpleDSColumn;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.LazyComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.icombobox.LazyComboBox;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.data.TableDataColumn; import com.fr.general.data.TableDataColumn;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
@ -35,6 +35,14 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/**
* 数据集列动态参数设置组件
*
* @author yaoh.wu
* @version 2017年7月26日
* todo 9.0设计器更新修改动态参数注入按钮部分,使其能在右侧边栏正常显示
* @since 8.0
*/
public class SelectedDataColumnPane extends BasicPane { public class SelectedDataColumnPane extends BasicPane {
protected UITableEditorPane<ParameterProvider> editorPane; protected UITableEditorPane<ParameterProvider> editorPane;
protected Parameter[] ps; protected Parameter[] ps;
@ -57,7 +65,6 @@ public class SelectedDataColumnPane extends BasicPane {
* 初始化组件 * 初始化组件
* *
* @param showParameterButton 是否显示参数按钮 * @param showParameterButton 是否显示参数按钮
*
*/ */
public void initComponent(boolean showParameterButton) { public void initComponent(boolean showParameterButton) {
initTableNameComboBox(); initTableNameComboBox();
@ -98,41 +105,6 @@ public class SelectedDataColumnPane extends BasicPane {
} }
} }
protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
tableNameComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
columnNameComboBox.setLoaded(false);
// columnNameComboBox.loadList();
}
});
tableNameComboBox.setPreferredSize(new Dimension(100, 20));
}
private void initWithParameterButton() {
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
paramButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
List<ParameterProvider> parameterList = editorPane.update();
ps = parameterList.toArray(new Parameter[parameterList.size()]);
}
});
editorPane.populate(ps == null ? new Parameter[0] : ps);
paramDialog.setVisible(true);
}
});
}
@Override
protected String title4PopupWindow() {
return "DSColumn";
}
public void populate(TableDataSource source, TemplateCellElement cellElement) { public void populate(TableDataSource source, TemplateCellElement cellElement) {
if (cellElement == null) { if (cellElement == null) {
@ -183,7 +155,6 @@ public class SelectedDataColumnPane extends BasicPane {
* 更新面板 * 更新面板
* *
* @return 更新后的值 * @return 更新后的值
*
*/ */
public SimpleDSColumn updateColumnPane() { public SimpleDSColumn updateColumnPane() {
SimpleDSColumn dsColumn = new SimpleDSColumn(); SimpleDSColumn dsColumn = new SimpleDSColumn();
@ -210,16 +181,10 @@ public class SelectedDataColumnPane extends BasicPane {
return dsColumn; return dsColumn;
} }
private boolean isColumnName(String columnExp) {
return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#");
}
/** /**
* 添加监听事件 * 添加监听事件
* *
* @param i 监听事件 * @param i 监听事件
*
*/ */
public void addListener(ItemListener i) { public void addListener(ItemListener i) {
itemListener = i; itemListener = i;
@ -231,13 +196,55 @@ public class SelectedDataColumnPane extends BasicPane {
* 移除监听事件 * 移除监听事件
* *
* @param i 监听事件 * @param i 监听事件
*
*/ */
public void removeListener(ItemListener i) { public void removeListener(ItemListener i) {
tableNameComboBox.removeItemListener(i); tableNameComboBox.removeItemListener(i);
columnNameComboBox.removeItemListener(i); columnNameComboBox.removeItemListener(i);
} }
protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
tableNameComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
columnNameComboBox.setLoaded(false);
}
});
tableNameComboBox.setPreferredSize(new Dimension(100, 20));
}
@Override
protected String title4PopupWindow() {
return "DSColumn";
}
private void initWithParameterButton() {
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
paramButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
List<ParameterProvider> parameterList = editorPane.update();
ps = parameterList.toArray(new Parameter[parameterList.size()]);
}
});
editorPane.populate(ps == null ? new Parameter[0] : ps);
paramDialog.setVisible(true);
}
});
}
private boolean isColumnName(String columnExp) {
return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#");
}
private List<String> calculateColumnNameList() { private List<String> calculateColumnNameList() {
if (this.tableNameComboBox.getSelectedItem() != null) { if (this.tableNameComboBox.getSelectedItem() != null) {
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList(); return this.tableNameComboBox.getSelectedItem().calculateColumnNameList();

13
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -1,10 +1,13 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fr.design.actions.columnrow.DSColumnConditionAction;
import com.fr.design.dscolumn.DSColumnAdvancedEditorPane; import com.fr.design.dscolumn.DSColumnAdvancedEditorPane;
import com.fr.design.dscolumn.DSColumnBasicEditorPane; import com.fr.design.dscolumn.DSColumnBasicEditorPane;
import com.fr.design.dscolumn.ResultSetGroupDockingPane; import com.fr.design.dscolumn.ResultSetGroupDockingPane;
import com.fr.design.dscolumn.SelectedDataColumnPane; import com.fr.design.dscolumn.SelectedDataColumnPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.cell.CellEditorPane; import com.fr.design.mainframe.cell.CellEditorPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
@ -30,6 +33,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
private SelectedDataColumnPane dataPane; private SelectedDataColumnPane dataPane;
//数据分组设置组件 //数据分组设置组件
private ResultSetGroupDockingPane groupPane; private ResultSetGroupDockingPane groupPane;
//过滤条件面板
private JPanel conditionPane;
// 基本和高级设置 // 基本和高级设置
private ArrayList<CellEditorPane> paneList; private ArrayList<CellEditorPane> paneList;
// 基本和高级设置 卡片布局 // 基本和高级设置 卡片布局
@ -171,9 +176,15 @@ public class CellDSColumnEditor extends CellQuickEditor {
/*基本设置面板*/ /*基本设置面板*/
this.dataPane = new SelectedDataColumnPane(false); this.dataPane = new SelectedDataColumnPane(false);
this.groupPane = new ResultSetGroupDockingPane(tc); this.groupPane = new ResultSetGroupDockingPane(tc);
this.conditionPane = new JPanel(new BorderLayout());
conditionPane.add(new UILabel("filter"), BorderLayout.WEST);
if (tc != null) {
//第一次初始化时tc为空,引发NullPointerException
conditionPane.add(new UIButton(new DSColumnConditionAction(tc)), BorderLayout.EAST);
}
dataPane.addListener(dataListener); dataPane.addListener(dataListener);
groupPane.addListener(groupListener); groupPane.addListener(groupListener);
paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane)); paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane, conditionPane));
/*高级设置面板*/ /*高级设置面板*/

Loading…
Cancel
Save