From ff520def37d587f091de7f14f889e991daf3ffe5 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 11 Sep 2018 12:26:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E4=BA=BA=E8=BF=9C=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/file/TemplateTreePane.java | 15 +++++++++++++-- .../mainframe/DesignerFrameFileDealerPane.java | 10 ++++++++++ .../mainframe/socketio/DesignerSocketIO.java | 10 ++++++++-- 3 files changed, 31 insertions(+), 4 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 509e484ae3..f40036fe9d 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 @@ -25,7 +25,7 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; -import com.fr.workspace.connect.WorkspaceConnection; +import com.fr.workspace.connect.WorkspaceConnectionInfo; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -48,6 +48,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; +import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.YES_NO_OPTION; public class TemplateTreePane extends JPanel implements FileOperations { @@ -202,7 +203,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { String username = null; if (info != null) { - WorkspaceConnection connection = info.getConnection(); + WorkspaceConnectionInfo connection = info.getConnection(); username = connection == null ? StringUtils.EMPTY : connection.getUserName(); } String lock = node.getLock(); @@ -285,6 +286,16 @@ public class TemplateTreePane extends JPanel implements FileOperations { ? Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_Unlock_File_And_Folder") : Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_Unlock_File"); + if (deletableNodes.isEmpty()) { + // 提醒被锁定模板无法删除 + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Unable_Delete_Locked_File"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + WARNING_MESSAGE); + return; + } + + if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), tipContent, UIManager.getString("OptionPane.messageDialogTitle"), diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index a0d1531e4c..d0800c087d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -310,6 +310,16 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } FileNode node = selectedOperation.getFileNode(); + String lock = node.getLock(); + if (lock != null && !lock.equals(node.getUserID())) { + // 提醒被锁定模板无法重命名 + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Unable_Rename_Locked_File"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + WARNING_MESSAGE); + return; + } + new FileRenameDialog(node); MutilTempalteTabPane.getInstance().repaint(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 4e7d42e7d3..8ac8b8da90 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -8,6 +8,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.loghandler.DesignerLogHandler; import com.fr.event.EventDispatcher; import com.fr.log.FineLoggerFactory; +import com.fr.report.RemoteDesignConstants; import com.fr.serialization.SerializerHelper; import com.fr.stable.ArrayUtils; import com.fr.third.apache.log4j.spi.LoggingEvent; @@ -16,6 +17,7 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.engine.server.rpc.netty.RemoteCallClient; +import com.fr.workspace.server.WorkspaceConnection; import com.fr.workspace.server.socket.SocketInfoOperator; import io.socket.client.IO; import io.socket.client.Socket; @@ -111,12 +113,16 @@ public class DesignerSocketIO { private static String getSocketUri(Workspace current) throws IOException { URL url = new URL(current.getPath()); int port = WorkContext.getCurrent().get(SocketInfoOperator.class).getPort(); - return String.format("%s://%s:%s%s?%s=%s", + WorkspaceConnection connection = RemoteCallClient.getInstance().getConnection(); + return String.format("%s://%s:%s%s?%s=%s&%s=%s", url.getProtocol(), url.getHost(), port, WorkspaceConstants.WS_NAMESPACE, DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME, - RemoteCallClient.getInstance().getConnection()); + connection.getToken(), + RemoteDesignConstants.USER_LOCK_ID, + connection.getId() + ); } }