Browse Source

Pull request #2062: REPORT-37100 数据集-刷新参数界面后,复制的关联数据集的参数修改会影响原数据集

Merge in DESIGN/design from ~YYMING/design:release/10.0 to release/10.0

* commit 'bcb58283ffcdce649bd3d570f8bf3635e958253b':
  REPORT-37100 加一个注释
  REPORT-37100 数据集-刷新参数界面后,复制的关联数据集的参数修改会影响原数据集
  REPORT-32116 由于fr_email的http请求里没有刷新sessionMap缓存,导致邮件发送事件发送的对象是上一次选择的发送人
feature/big-screen
Yyming 4 years ago
parent
commit
00c0cdddcd
  1. 64
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  3. 2
      designer-realize/src/main/java/com/fr/start/MainDesigner.java

64
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.design.gui.itextfield.UITextField;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -95,9 +96,8 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
centerPanel.setLayout(new GridLayout(len < MIN_BAR_NUMBER ? MIN_BAR_NUMBER : len + 1, 1)); centerPanel.setLayout(new GridLayout(len < MIN_BAR_NUMBER ? MIN_BAR_NUMBER : len + 1, 1));
centerPanel.add(headLabel); centerPanel.add(headLabel);
Iterator<Entry<String, TableDataWrapper>> entryIt = resMap.entrySet().iterator(); for (Entry<String, TableDataWrapper> stringTableDataWrapperEntry : resMap.entrySet()) {
while (entryIt.hasNext()) { TableDataWrapper tableDataWrappe = stringTableDataWrapperEntry.getValue();
TableDataWrapper tableDataWrappe = entryIt.next().getValue();
String tmp = tableDataWrappe.getTableDataName(); String tmp = tableDataWrappe.getTableDataName();
if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) { if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) {
centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon())); centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon()));
@ -111,13 +111,10 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} }
private ActionListener getPreviewActionListener() { private ActionListener getPreviewActionListener() {
return new ActionListener() { return e -> {
public void actionPerformed(ActionEvent e) {
MultiTDTableData td = MultiTDTableDataPane.this.updateBean(); MultiTDTableData td = MultiTDTableDataPane.this.updateBean();
td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource()); td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource());
new TemplateTableDataWrapper(td).previewData(); new TemplateTableDataWrapper(td).previewData();
}
}; };
} }
@ -126,12 +123,12 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
jpanel.setPreferredSize(new Dimension(-1, 150)); jpanel.setPreferredSize(new Dimension(-1, 150));
jpanel.setLayout(new BorderLayout()); jpanel.setLayout(new BorderLayout());
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel() { editorPane = new UITableEditorPane<>(new ParameterTableModel() {
@Override @Override
public UITableEditAction[] createAction() { public UITableEditAction[] createAction() {
return new UITableEditAction[]{new RefreshAction()}; 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); jpanel.add(editorPane, BorderLayout.CENTER);
@ -162,29 +159,32 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
paramTexts[i] = (String) object[i]; paramTexts[i] = (String) object[i];
} }
List<ParameterProvider> existParameterList = new ArrayList<ParameterProvider>(); List<ParameterProvider> existParameterList = new ArrayList<>();
Iterator<Entry<String, String>> dataItera = choosenTableData.entrySet().iterator(); List<String> parameterName = new ArrayList<>();
List<String> parameterName = new ArrayList<String>(); for (Entry<String, String> entry : choosenTableData.entrySet()) {
while (dataItera.hasNext()) {
Entry<String, String> entry = dataItera.next();
TableData td = resMap.get(entry.getKey()).getTableData(); TableData td = resMap.get(entry.getKey()).getTableData();
ParameterProvider[] currentparameters = td.getParameters(Calculator.createCalculator()); ParameterProvider[] currentParameters = td.getParameters(Calculator.createCalculator());
for (int i=0; i<currentparameters.length; i++){ for (ParameterProvider currentParameter : currentParameters) {
if (parameterName.contains(currentparameters[i].getName())){ if (parameterName.contains(currentParameter.getName())) {
continue; continue;
} }
parameterName.add(currentparameters[i].getName()); parameterName.add(currentParameter.getName());
existParameterList.add(currentparameters[i]); try {
//采用给新的界面刷新参数时,clone一个值过去,不然会出现联动修改
existParameterList.add((ParameterProvider) currentParameter.clone());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} }
} }
ParameterProvider[] texts = ParameterHelper.analyze4Parameters(paramTexts, true); ParameterProvider[] texts = ParameterHelper.analyze4Parameters(paramTexts, true);
for (int i=0; i<texts.length; i++) { for (ParameterProvider text : texts) {
if (parameterName.contains(texts[i].getName())){ if (parameterName.contains(text.getName())) {
continue; continue;
} }
existParameterList.add(texts[i]); existParameterList.add(text);
} }
Parameter[] ps = existParameterList.toArray(new Parameter[existParameterList.size()]); ParameterProvider[] ps = existParameterList.toArray(new ParameterProvider[0]);
editorPane.populate(ps); editorPane.populate(ps);
existParameterList.clear(); existParameterList.clear();
parameterName.clear(); parameterName.clear();
@ -217,7 +217,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
String name; String name;
for (int i = 0; i < ob.getTableDataCount(); i++) { for (int i = 0; i < ob.getTableDataCount(); i++) {
name = ob.getTableDataName(i); name = ob.getTableDataName(i);
choosenTableData.put(name, ""); choosenTableData.put(name, StringUtils.EMPTY);
} }
} }
} }
@ -236,15 +236,13 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
@Override @Override
public MultiTDTableData updateBean() { public MultiTDTableData updateBean() {
ConditionTableData td = new ConditionTableData(); ConditionTableData td = new ConditionTableData();
Iterator<Entry<String, String>> it = choosenTableData.entrySet().iterator(); for (Entry<String, String> entry : choosenTableData.entrySet()) {
while (it.hasNext()) {
Entry<String, String> entry = it.next();
td.addTableData(entry.getKey(), entry.getValue()); td.addTableData(entry.getKey(), entry.getValue());
} }
List<ParameterProvider> paramList = editorPane.update(); List<ParameterProvider> paramList = editorPane.update();
if (paramList != null) { if (paramList != null) {
td.setDefineParameters(paramList.toArray(new Parameter[paramList.size()])); td.setDefineParameters(paramList.toArray(new Parameter[0]));
} }
return td; return td;
@ -348,9 +346,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
chekbox.setSelected(false); chekbox.setSelected(false);
formulaContentTextField.setEnabled(false); formulaContentTextField.setEnabled(false);
formulaButton.setEnabled(false); formulaButton.setEnabled(false);
if (choosenTableData.containsKey(name)) {
choosenTableData.remove(name); choosenTableData.remove(name);
}
} else { } else {
formulaButton.setEnabled(true); formulaButton.setEnabled(true);
formulaContentTextField.setEnabled(true); formulaContentTextField.setEnabled(true);
@ -372,10 +368,8 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} else { } else {
formulaButton.setEnabled(false); formulaButton.setEnabled(false);
formulaContentTextField.setEnabled(false); formulaContentTextField.setEnabled(false);
if (choosenTableData.containsKey(name)) {
choosenTableData.remove(name); choosenTableData.remove(name);
} }
}
} }
}; };
@ -388,22 +382,20 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} }
private ActionListener getFormulaActionListener() { private ActionListener getFormulaActionListener() {
return new ActionListener() { return e -> {
public void actionPerformed(ActionEvent e) {
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText())); formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText()));
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() { formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() {
public void doOk() { public void doOk() {
BaseFormula formula = formulaPane.update(); BaseFormula formula = formulaPane.update();
if (formula == null) { if (formula == null) {
formulaContentTextField.setText(""); formulaContentTextField.setText(StringUtils.EMPTY);
} else { } else {
formulaContentTextField.setText(formula.getContent().substring(1)); formulaContentTextField.setText(formula.getContent().substring(1));
} }
MultiTDTableDataPane.this.refresh(); MultiTDTableDataPane.this.refresh();
} }
}).setVisible(true); }).setVisible(true);
}
}; };
} }
} }

7
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java

@ -23,7 +23,7 @@ import java.util.List;
* @editor zhou * @editor zhou
* @since 2012-3-28下午3:07:44 * @since 2012-3-28下午3:07:44
*/ */
public abstract class UITableModelAdapter<T extends Object> extends AbstractTableModel implements UITableEditorLoader { public abstract class UITableModelAdapter<T> extends AbstractTableModel implements UITableEditorLoader {
/** /**
* *
@ -37,7 +37,6 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
// list里放的是一行数据 // list里放的是一行数据
private List<T> list = new ArrayList<T>(); private List<T> list = new ArrayList<T>();
@SuppressWarnings({ "unchecked", "rawtypes" })
protected UITableModelAdapter(String[] columnNames) { protected UITableModelAdapter(String[] columnNames) {
this.columnNames = columnNames; this.columnNames = columnNames;
table = new JTable(this); table = new JTable(this);
@ -101,8 +100,8 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
} }
} }
public void setRowAt(T value, int rowIndwx) { public void setRowAt(T value, int rowIndex) {
this.list.set(rowIndwx, value); this.list.set(rowIndex, value);
} }
/** /**

2
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -144,7 +144,7 @@ public class MainDesigner extends BaseDesigner {
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[0]);
} }
@Override @Override

Loading…
Cancel
Save