From f6840df7613b1a46c7d4e914396396aace75b68f Mon Sep 17 00:00:00 2001 From: Yyming Date: Tue, 11 Aug 2020 14:53:15 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-37100=20=E6=95=B0=E6=8D=AE=E9=9B=86-?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=8F=82=E6=95=B0=E7=95=8C=E9=9D=A2=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=A4=8D=E5=88=B6=E7=9A=84=E5=85=B3=E8=81=94=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E7=9A=84=E5=8F=82=E6=95=B0=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BC=9A=E5=BD=B1=E5=93=8D=E5=8E=9F=E6=95=B0=E6=8D=AE=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledatapane/MultiTDTableDataPane.java | 107 ++++++++---------- .../itableeditorpane/UITableModelAdapter.java | 7 +- 2 files changed, 52 insertions(+), 62 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java index 2cf170c55e..d9377da6b7 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java @@ -19,6 +19,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.script.Calculator; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; @@ -95,9 +96,8 @@ public class MultiTDTableDataPane extends AbstractTableDataPane> entryIt = resMap.entrySet().iterator(); - while (entryIt.hasNext()) { - TableDataWrapper tableDataWrappe = entryIt.next().getValue(); + for (Entry stringTableDataWrapperEntry : resMap.entrySet()) { + TableDataWrapper tableDataWrappe = stringTableDataWrapperEntry.getValue(); String tmp = tableDataWrappe.getTableDataName(); if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) { centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon())); @@ -111,13 +111,10 @@ public class MultiTDTableDataPane extends AbstractTableDataPane { + MultiTDTableData td = MultiTDTableDataPane.this.updateBean(); + td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource()); + new TemplateTableDataWrapper(td).previewData(); }; } @@ -126,12 +123,12 @@ public class MultiTDTableDataPane extends AbstractTableDataPane(new ParameterTableModel() { + editorPane = new UITableEditorPane<>(new ParameterTableModel() { @Override public UITableEditAction[] createAction() { return new UITableEditAction[]{new RefreshAction()}; } - }, " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Default_Parameter")); + }, StringUtils.BLANK + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Default_Parameter")); jpanel.add(editorPane, BorderLayout.CENTER); @@ -162,29 +159,31 @@ public class MultiTDTableDataPane extends AbstractTableDataPane existParameterList = new ArrayList(); - Iterator> dataItera = choosenTableData.entrySet().iterator(); - List parameterName = new ArrayList(); - while (dataItera.hasNext()) { - Entry entry = dataItera.next(); - TableData td = resMap.get(entry.getKey()).getTableData(); - ParameterProvider[] currentparameters = td.getParameters(Calculator.createCalculator()); - for (int i=0; i existParameterList = new ArrayList<>(); + List parameterName = new ArrayList<>(); + for (Entry entry : choosenTableData.entrySet()) { + TableData td = resMap.get(entry.getKey()).getTableData(); + ParameterProvider[] currentParameters = td.getParameters(Calculator.createCalculator()); + for (ParameterProvider currentParameter : currentParameters) { + if (parameterName.contains(currentParameter.getName())) { + continue; + } + parameterName.add(currentParameter.getName()); + try { + existParameterList.add((ParameterProvider) currentParameter.clone()); + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } } ParameterProvider[] texts = ParameterHelper.analyze4Parameters(paramTexts, true); - for (int i=0; i> it = choosenTableData.entrySet().iterator(); - while (it.hasNext()) { - Entry entry = it.next(); + for (Entry entry : choosenTableData.entrySet()) { td.addTableData(entry.getKey(), entry.getValue()); } List paramList = editorPane.update(); if (paramList != null) { - td.setDefineParameters(paramList.toArray(new Parameter[paramList.size()])); + td.setDefineParameters(paramList.toArray(new Parameter[0])); } return td; @@ -348,9 +345,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane { + final UIFormula formulaPane = FormulaFactory.createFormulaPane(); + formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText())); + formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() { + public void doOk() { + BaseFormula formula = formulaPane.update(); + if (formula == null) { + formulaContentTextField.setText(StringUtils.EMPTY); + } else { + formulaContentTextField.setText(formula.getContent().substring(1)); } - }).setVisible(true); - } + MultiTDTableDataPane.this.refresh(); + } + }).setVisible(true); }; } } diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java index 7d04113078..4506bb9a6c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java @@ -23,7 +23,7 @@ import java.util.List; * @editor zhou * @since 2012-3-28下午3:07:44 */ -public abstract class UITableModelAdapter extends AbstractTableModel implements UITableEditorLoader { +public abstract class UITableModelAdapter extends AbstractTableModel implements UITableEditorLoader { /** * @@ -37,7 +37,6 @@ public abstract class UITableModelAdapter extends AbstractTabl // list里放的是一行数据 private List list = new ArrayList(); - @SuppressWarnings({ "unchecked", "rawtypes" }) protected UITableModelAdapter(String[] columnNames) { this.columnNames = columnNames; table = new JTable(this); @@ -101,8 +100,8 @@ public abstract class UITableModelAdapter extends AbstractTabl } } - public void setRowAt(T value, int rowIndwx) { - this.list.set(rowIndwx, value); + public void setRowAt(T value, int rowIndex) { + this.list.set(rowIndex, value); } /**