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..571e13d447 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,32 @@ 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 { + //采用给新的界面刷新参数时,clone一个值过去,不然会出现联动修改 + 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 +346,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); } /** diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 2cdc832308..0020514f2d 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -144,7 +144,7 @@ public class MainDesigner extends BaseDesigner { } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return shortCuts.toArray(new ShortCut[shortCuts.size()]); + return shortCuts.toArray(new ShortCut[0]); } @Override