diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsTableOperatorListener.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsTableOperatorListener.java new file mode 100644 index 0000000000..831efc85e0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsTableOperatorListener.java @@ -0,0 +1,19 @@ +package com.fr.design.mainframe.vcs; + +import java.util.List; + +/** + * 版本管理表格操作事件 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2023/7/27 + */ +public interface VcsTableOperatorListener { + + + /** + * 处理操作 + */ + void doOperator(List entityList); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java index 4b0f8e9763..186e6b849a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/RecyclePane.java @@ -11,6 +11,7 @@ import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.TableEntity; import com.fr.design.mainframe.vcs.TableValueOperator; import com.fr.design.mainframe.vcs.VcsTableEntity; +import com.fr.design.mainframe.vcs.VcsTableOperatorListener; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; @@ -25,7 +26,9 @@ import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import static com.fr.design.i18n.Toolkit.i18nText; @@ -44,6 +47,8 @@ public class RecyclePane extends AbstractSupportSelectTablePane public static final Icon ICON_DELETE = IconUtils.readSVGIcon("/com/fr/design/standard/vcslist/vcs_recycle_delete", IconUtils.ICON_TYPE_NORMAL); public static final Icon ICON_DELETE_DISABLE = IconUtils.readSVGIcon("/com/fr/design/standard/vcslist/vcs_recycle_delete", IconUtils.ICON_TYPE_DISABLED); + private Set listenerSet = new HashSet<>(); + protected UITextField searchTextField; protected UILabel deleteLabel; @@ -214,6 +219,7 @@ public class RecyclePane extends AbstractSupportSelectTablePane model.setList(tableEntities); model.fireTableDataChanged(); listener.doAfterChooseYes(selectList); + fireVcsListener(model.getList()); } } } @@ -274,6 +280,25 @@ public class RecyclePane extends AbstractSupportSelectTablePane this.parentDialog = parentDialog; } + + /** + * 添加版本管理表格操作事件 + * + * @param listener 版本管理表格操作事件 + */ + public void addVcsListener(VcsTableOperatorListener listener) { + listenerSet.add(listener); + } + + /** + * 触发版本管理表格操作事件 + */ + public void fireVcsListener(List tableEntities) { + for (VcsTableOperatorListener listener : listenerSet) { + listener.doOperator(tableEntities); + } + } + /** * 删除范围 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java index 5a2f20cf15..e50ef2c4d4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java @@ -10,6 +10,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.VcsTableEntity; +import com.fr.design.mainframe.vcs.VcsTableOperatorListener; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.report.entity.VcsEntity; @@ -160,6 +161,12 @@ public class VcsCenterPane extends VcsNewPane { return entity.getFilename()+Toolkit.i18nText("Fine-Design_Vcs_Version_Tips"); } }; + pane.addVcsListener(entities -> { + if (entities.size() == 0) { + model.getList().remove(o); + model.fireTableDataChanged(); + } + }); pane.showDialog(getDialog()); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java index baafe56868..484453a8d8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java @@ -216,6 +216,7 @@ public class VcsNewPane extends RecyclePane { model.getList().remove(o); model.fireTableDataChanged(); VcsOperatorWorker.createDeleteWorker().deleteTargetVersion(entity); + fireVcsListener(model.getList()); } } }