Browse Source

REPORT-33616 填报属性设置-智能添加单元格,确认和取消效果一样

feature/big-screen
zack 4 years ago
parent
commit
03f3c71675
  1. 72
      designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
  2. 2
      designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java

72
designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java

@ -36,6 +36,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils;
import com.fr.general.data.Condition;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ColumnRow;
import com.fr.stable.ColumnRowGroup;
import com.fr.write.DBManipulation;
@ -47,14 +48,31 @@ import com.fr.write.config.InsertConfig;
import com.fr.write.config.IntelliDMLConfig;
import com.fr.write.config.UpdateConfig;
import javax.swing.*;
import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.DefaultComboBoxModel;
import javax.swing.Icon;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumn;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
@ -911,6 +929,11 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
return ComparatorUtils.equals(this.name, ((ColumnName)obj).name);
}
@Override
protected ColumnName clone() throws CloneNotSupportedException {
return new ColumnName(name);
}
}
public static class ColumnValue {
@ -931,6 +954,11 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
return ComparatorUtils.equals(this.obj, ((ColumnValue)obj).obj);
}
@Override
protected ColumnValue clone() throws CloneNotSupportedException {
return new ColumnValue(obj);
}
}
protected static class KeyColumnNameValueTable extends JTable {
@ -941,7 +969,14 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
public KeyColumnTableModel getTableModel4SmartAddCell() {
return new KeyColumnValueTableModel((KeyColumnTableModel)this.getModel());
KeyColumnTableModel clonedTableModel = null;
try {
//智能添加的时候修改clone的配置,不修改原配置,点击确认后覆盖原配置
clonedTableModel = ((KeyColumnValueTableModel) this.getModel()).clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return new KeyColumnValueTableModel(clonedTableModel);
}
}
@ -949,11 +984,11 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
protected abstract static class KeyColumnTableModel extends AbstractTableModel {
public static final String RAW_KEY = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_RWA_Key");
public static final String COLUMN = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Column");
public static final String VALUE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Value");
public static final String VALUE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Value");
public static final String[] COLUMN_NAMES = new String[]{RAW_KEY, COLUMN, VALUE};
public static final String[] COLUMN_NAMES = new String[]{RAW_KEY, COLUMN, VALUE};
protected java.util.List<KeyColumnNameValue> keyColumnNameValueList = new ArrayList<KeyColumnNameValue>();
protected List<KeyColumnNameValue> keyColumnNameValueList = new ArrayList<>();
public KeyColumnTableModel(KeyColumnTableModel model) {
if (model != null) {
@ -988,9 +1023,16 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
public void removeAllKeyColumnNameValue() {
this.keyColumnNameValueList.clear();
}
public void refreshNameValueList(KeyColumnTableModel model) {
if (model != null) {
this.keyColumnNameValueList.clear();
this.keyColumnNameValueList.addAll(model.keyColumnNameValueList);
}
}
}
protected static class KeyColumnValueTableModel extends KeyColumnTableModel {
protected static class KeyColumnValueTableModel extends KeyColumnTableModel implements Cloneable{
public KeyColumnValueTableModel(KeyColumnTableModel model) {
super(model);
@ -1037,6 +1079,16 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
public boolean isCellEditable(int row, int col) {
return true;
}
@Override
protected KeyColumnValueTableModel clone() throws CloneNotSupportedException {
KeyColumnValueTableModel cloned = (KeyColumnValueTableModel) super.clone();
cloned.keyColumnNameValueList = new ArrayList<>();
for (KeyColumnNameValue keyColumnNameValue : keyColumnNameValueList) {
cloned.keyColumnNameValueList.add(keyColumnNameValue.clone());
}
return cloned;
}
}
@ -1054,11 +1106,17 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
/**
* 字符串
*
* @return 字符串z
*/
public String toString() {
return (isKey ? "* " : "") + cn + ":" + cv;
}
@Override
protected KeyColumnNameValue clone() throws CloneNotSupportedException {
return new KeyColumnNameValue(isKey, cn.clone(), cv.clone(), false);
}
}
/*

2
designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java

@ -511,7 +511,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
private SmartJTablePaneAction a = new AbstractSmartJTablePaneAction(this, SmartInsertDBManipulationPane.this) {
@Override
public void doOk() {
// 遗留代码
((KeyColumnTableModel)keyColumnValuesTable.getModel()).refreshNameValueList((KeyColumnTableModel)model);
}
@Override

Loading…
Cancel
Save