diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index b0997b7f6c..530b466930 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -36,8 +36,6 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import java.util.HashSet; -import java.util.Set; import javax.swing.AbstractButton; import javax.swing.Action; import javax.swing.DefaultCellEditor; @@ -55,8 +53,10 @@ import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.EventObject; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Objects; +import java.util.Set; /** * Coder: zack @@ -83,6 +83,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp protected String[] allDSNames; protected ConnectionTableAction connectionTableAction; protected ToolBarDef toolbarDef; + protected TableDataTreePaneListener listener = null; private String type = ""; @@ -142,6 +143,17 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp public abstract void dgEdit(final AbstractTableDataPane uPanel, String originalName, boolean isUpdate); + public void showEditPane(final AbstractTableDataPane tableDataPane, String originalName, TableDataTreePaneListener listener) { + this.listener = listener; + dgEdit(tableDataPane, originalName); + } + + public interface TableDataTreePaneListener { + void doOk(); + + void doCancel(); + } + protected void doPropertyChange(BasicDialog dg, BasicPane.NamePane nPanel, final String oldName) { type = dg.getTitle(); nPanel.setShowText(StringUtils.BLANK); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index b69be8c8d5..5a63666023 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -361,11 +361,18 @@ public class TableDataTreePane extends BasicTableDataTreePane { //单独编辑数据集关闭,修改缓存配置状态,刷新下一键开启/关闭按钮 checkButtonEnabled(); + + if (listener != null) { + listener.doOk(); + } } @Override public void doCancel() { super.doCancel(); + if (listener != null) { + listener.doCancel(); + } } }); tdNamePanel.addPropertyChangeListener(new PropertyChangeAdapter() { diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java index 83c52ac784..a47b0021f2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java @@ -242,12 +242,22 @@ public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previe rtd = treeTableDataComboBox.getSelcetedTableData(); name = treeTableDataComboBox.getSelectedItem().getTableDataName(); } + final String tableDataName = name; AbstractTableDataWrapper atdw = new TemplateTableDataWrapper(rtd, ""); - tdtp.dgEdit(atdw.creatTableDataPane(), name); - treeTableDataComboBox.refresh(); - treeTableDataComboBox.setSelectedTableDataByName(name); - textPane.populate(1); - valuePane.populate(1); + tdtp.showEditPane(atdw.creatTableDataPane(), name, new BasicTableDataTreePane.TableDataTreePaneListener() { + @Override + public void doOk() { + // 去除缓存列,后面刷新会重新选中 + DesignTableDataManager.removeSelectedColumnNames(tableDataName); + treeTableDataComboBox.refresh(); + treeTableDataComboBox.setSelectedTableDataByName(tableDataName); + } + + @Override + public void doCancel() { + + } + }); } }