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. 108
      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

108
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<MultiTDTableData
centerPanel.setLayout(new GridLayout(len < MIN_BAR_NUMBER ? MIN_BAR_NUMBER : len + 1, 1));
centerPanel.add(headLabel);
Iterator<Entry<String, TableDataWrapper>> entryIt = resMap.entrySet().iterator();
while (entryIt.hasNext()) {
TableDataWrapper tableDataWrappe = entryIt.next().getValue();
for (Entry<String, TableDataWrapper> 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
}
private ActionListener getPreviewActionListener() {
return new ActionListener() {
public void actionPerformed(ActionEvent e) {
MultiTDTableData td = MultiTDTableDataPane.this.updateBean();
td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource());
new TemplateTableDataWrapper(td).previewData();
}
return e -> {
MultiTDTableData td = MultiTDTableDataPane.this.updateBean();
td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource());
new TemplateTableDataWrapper(td).previewData();
};
}
@ -126,12 +123,12 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
jpanel.setPreferredSize(new Dimension(-1, 150));
jpanel.setLayout(new BorderLayout());
editorPane = new UITableEditorPane<ParameterProvider>(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<MultiTDTableData
for (int i = 0; i < size; i++) {
paramTexts[i] = (String) object[i];
}
List<ParameterProvider> existParameterList = new ArrayList<ParameterProvider>();
Iterator<Entry<String, String>> dataItera = choosenTableData.entrySet().iterator();
List<String> parameterName = new ArrayList<String>();
while (dataItera.hasNext()) {
Entry<String, String> entry = dataItera.next();
TableData td = resMap.get(entry.getKey()).getTableData();
ParameterProvider[] currentparameters = td.getParameters(Calculator.createCalculator());
for (int i=0; i<currentparameters.length; i++){
if (parameterName.contains(currentparameters[i].getName())){
continue;
}
parameterName.add(currentparameters[i].getName());
existParameterList.add(currentparameters[i]);
}
List<ParameterProvider> existParameterList = new ArrayList<>();
List<String> parameterName = new ArrayList<>();
for (Entry<String, String> 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<texts.length; i++) {
if (parameterName.contains(texts[i].getName())){
continue;
}
existParameterList.add(texts[i]);
for (ParameterProvider text : texts) {
if (parameterName.contains(text.getName())) {
continue;
}
existParameterList.add(text);
}
Parameter[] ps = existParameterList.toArray(new Parameter[existParameterList.size()]);
ParameterProvider[] ps = existParameterList.toArray(new ParameterProvider[0]);
editorPane.populate(ps);
existParameterList.clear();
parameterName.clear();
@ -217,7 +217,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
String name;
for (int i = 0; i < ob.getTableDataCount(); i++) {
name = ob.getTableDataName(i);
choosenTableData.put(name, "");
choosenTableData.put(name, StringUtils.EMPTY);
}
}
}
@ -236,15 +236,13 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
@Override
public MultiTDTableData updateBean() {
ConditionTableData td = new ConditionTableData();
Iterator<Entry<String, String>> it = choosenTableData.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> entry = it.next();
for (Entry<String, String> entry : choosenTableData.entrySet()) {
td.addTableData(entry.getKey(), entry.getValue());
}
List<ParameterProvider> 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<MultiTDTableData
chekbox.setSelected(false);
formulaContentTextField.setEnabled(false);
formulaButton.setEnabled(false);
if (choosenTableData.containsKey(name)) {
choosenTableData.remove(name);
}
choosenTableData.remove(name);
} else {
formulaButton.setEnabled(true);
formulaContentTextField.setEnabled(true);
@ -372,9 +368,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} else {
formulaButton.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() {
return new ActionListener() {
public void actionPerformed(ActionEvent e) {
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("");
} else {
formulaContentTextField.setText(formula.getContent().substring(1));
}
MultiTDTableDataPane.this.refresh();
return e -> {
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);
};
}
}

7
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<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里放的是一行数据
private List<T> list = new ArrayList<T>();
@SuppressWarnings({ "unchecked", "rawtypes" })
protected UITableModelAdapter(String[] columnNames) {
this.columnNames = columnNames;
table = new JTable(this);
@ -101,8 +100,8 @@ public abstract class UITableModelAdapter<T extends Object> 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);
}
/**

2
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

Loading…
Cancel
Save