diff --git a/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java index 4852aaa66..e71f539eb 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java @@ -14,7 +14,7 @@ import java.util.Iterator; public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane { public SelectedConfirmedDataColumnPane() { - super(false, false); + super(false); } protected void initTableNameComboBox() { diff --git a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java index 55f94fff7..0790f87db 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -17,6 +17,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.ElementCasePane; import com.fr.general.Inter; import com.fr.general.data.TableDataColumn; import com.fr.report.cell.CellElement; @@ -54,12 +55,17 @@ public class SelectedDataColumnPane extends BasicPane { private UIButton paramButton; public SelectedDataColumnPane() { - this(true, false); + this(true, false, null); } - public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout) { + + public SelectedDataColumnPane(boolean showParameterButton) { + this(showParameterButton, false, null); + } + + public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout, ElementCasePane casePane) { if (verticalLayout) { - initComponentVerticalLayout(true); + initComponentVerticalLayout(casePane); } else { initComponent(showParameterButton); } @@ -111,15 +117,11 @@ public class SelectedDataColumnPane extends BasicPane { /** - * 初始化组件 - * - * @param showParameterButton 是否显示参数按钮 + * 初始化竖直布局的组件 */ - public void initComponentVerticalLayout(boolean showParameterButton) { + public void initComponentVerticalLayout(ElementCasePane casePane) { initTableNameComboBox(); - if (showParameterButton) { - initWithParameterButton(); - } + initWithParameterButton(casePane); columnNameComboBox = new LazyComboBox() { @Override public Object[] load() { @@ -132,27 +134,17 @@ public class SelectedDataColumnPane extends BasicPane { double p = TableLayout.PREFERRED; UILabel label1 = new UILabel(Inter.getLocText("TableData")); UILabel label3 = new UILabel(Inter.getLocText("DataColumn")); - if (showParameterButton) { - //todo 国际化 - UILabel label2 = new UILabel("param"); - Component[][] components = { - {label1, tableNameComboBox}, - {label2, paramButton}, - {label3, columnNameComboBox} - }; - this.setLayout(new BorderLayout()); - this.add(TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f})); - } else { - double[] columnSize = {p, f}; - double[] rowSize = {p, p}; - Component[][] components = new Component[][]{ - new Component[]{label1, tableNameComboBox}, - new Component[]{label3, columnNameComboBox} - }; - JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - this.setLayout(new BorderLayout()); - this.add(jPanel, BorderLayout.CENTER); - } + + //todo 国际化 + UILabel label2 = new UILabel("param"); + Component[][] components = { + {label1, tableNameComboBox}, + {label2, paramButton}, + {label3, columnNameComboBox} + }; + this.setLayout(new BorderLayout()); + this.add(TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f})); + } @@ -286,6 +278,26 @@ public class SelectedDataColumnPane extends BasicPane { }); } + private void initWithParameterButton(ElementCasePane casePane) { + editorPane = new UITableEditorPane(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 parameterList = editorPane.update(); + ps = parameterList.toArray(new Parameter[parameterList.size()]); + editorPane.update(); + casePane.fireTargetModified(); + } + }); + 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("#"); diff --git a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 1e1e9a578..156f9521b 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -53,7 +53,7 @@ import java.util.ArrayList; */ public class CellDSColumnEditor extends CellQuickEditor { - private static double P = TableLayout.PREFERRED, F = TableLayout.FILL; + private static final double P = TableLayout.PREFERRED, F = TableLayout.FILL; private enum FilterType { //前N个 后N个 奇数 偶数 自定义 未定义 @@ -204,7 +204,7 @@ public class CellDSColumnEditor extends CellQuickEditor { DSColumnBasicEditorPane() { this.setLayout(new BorderLayout()); - dataPane = new SelectedDataColumnPane(true, true); + dataPane = new SelectedDataColumnPane(true, true, tc); groupPane = new ResultSetGroupDockingPane(tc); dataPane.addListener(dataListener); groupPane.addListener(groupListener);