From 9ef4cb3b40ec2de48905b1280d41f1ec52a29ec8 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 1 Aug 2023 13:42:13 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-101740=20=E3=80=90=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E4=B8=89=E6=9C=9F=E3=80=91=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=89=93=E5=BC=80=E8=A2=AB=E9=94=81=E5=AE=9A?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E6=9D=BF=EF=BC=8C=E6=B2=A1=E6=9C=89=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/TemplateTreePane.java | 17 ++++++++++++----- .../design/mainframe/vcs/ui/VcsCenterPane.java | 7 ++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 58d9b0e88d..8da6b7a3b6 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -239,11 +239,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { String reportPath = reportletsTree.getSelectedTemplatePath(); final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath); String lock = node.getLock(); - boolean showLockInfo = LockInfoUtils.isCompatibleOperator() - || LockInfoUtils.unableGetLockInfo() - || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) - ? (lock != null && !lock.equals(node.getUserID())) - : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); + boolean showLockInfo = needShowLockInfo(lock, selectedFilePath, node); if (showLockInfo) { UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath); node.setLock(UUID.randomUUID().toString()); @@ -257,6 +253,17 @@ public class TemplateTreePane extends JPanel implements FileOperations { DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); } + /** + * 是否需要展示锁定信息 + */ + public static boolean needShowLockInfo(String lock, String selectedFilePath, FileNode node) { + return LockInfoUtils.isCompatibleOperator() + || LockInfoUtils.unableGetLockInfo() + || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) + ? (lock != null && !lock.equals(node.getUserID())) + : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); + } + private void checkDevelopForBiddenTemplate(String selectedFilePath) { JTemplate template = getOpenedTemplate(selectedFilePath); if (template != null && template.isForbidden()) { 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 20b31d9c28..080edb4a25 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 @@ -4,6 +4,7 @@ import com.fr.base.svg.IconUtils; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.lock.LockInfoUtils; @@ -165,11 +166,7 @@ public class VcsCenterPane extends VcsNewPane { protected Boolean doInBackground() throws Exception { String selectedFilePath = getTemplateTruePath(filename); String lock = node.getLock(); - return LockInfoUtils.isCompatibleOperator() - || LockInfoUtils.unableGetLockInfo() - || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) - ? (lock != null && !lock.equals(node.getUserID())) - : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); + return TemplateTreePane.needShowLockInfo(lock, selectedFilePath, node); } @Override protected void done() {