Browse Source

多人远程

research/10.0
yaoh.wu 6 years ago
parent
commit
ff520def37
  1. 15
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  2. 10
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  3. 10
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

15
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.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -48,6 +48,7 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Enumeration; import java.util.Enumeration;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_OPTION; import static javax.swing.JOptionPane.YES_NO_OPTION;
public class TemplateTreePane extends JPanel implements FileOperations { public class TemplateTreePane extends JPanel implements FileOperations {
@ -202,7 +203,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
String username = null; String username = null;
if (info != null) { if (info != null) {
WorkspaceConnection connection = info.getConnection(); WorkspaceConnectionInfo connection = info.getConnection();
username = connection == null ? StringUtils.EMPTY : connection.getUserName(); username = connection == null ? StringUtils.EMPTY : connection.getUserName();
} }
String lock = node.getLock(); 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_And_Folder")
: Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_Unlock_File"); : 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(), if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
tipContent, tipContent,
UIManager.getString("OptionPane.messageDialogTitle"), UIManager.getString("OptionPane.messageDialogTitle"),

10
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(); 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); new FileRenameDialog(node);
MutilTempalteTabPane.getInstance().repaint(); MutilTempalteTabPane.getInstance().repaint();
} }

10
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.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants;
import com.fr.serialization.SerializerHelper; import com.fr.serialization.SerializerHelper;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.third.apache.log4j.spi.LoggingEvent; 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.Workspace;
import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.engine.server.rpc.netty.RemoteCallClient; import com.fr.workspace.engine.server.rpc.netty.RemoteCallClient;
import com.fr.workspace.server.WorkspaceConnection;
import com.fr.workspace.server.socket.SocketInfoOperator; import com.fr.workspace.server.socket.SocketInfoOperator;
import io.socket.client.IO; import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
@ -111,12 +113,16 @@ public class DesignerSocketIO {
private static String getSocketUri(Workspace current) throws IOException { private static String getSocketUri(Workspace current) throws IOException {
URL url = new URL(current.getPath()); URL url = new URL(current.getPath());
int port = WorkContext.getCurrent().get(SocketInfoOperator.class).getPort(); 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.getProtocol(),
url.getHost(), url.getHost(),
port, port,
WorkspaceConstants.WS_NAMESPACE, WorkspaceConstants.WS_NAMESPACE,
DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME, DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME,
RemoteCallClient.getInstance().getConnection()); connection.getToken(),
RemoteDesignConstants.USER_LOCK_ID,
connection.getId()
);
} }
} }

Loading…
Cancel
Save