ju 7 years ago
parent
commit
5c66b02c7b
  1. 12
      designer-base/src/com/fr/design/DesignerEnvManager.java
  2. 4
      designer-base/src/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  3. 4
      designer-base/src/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  4. 2
      designer-base/src/com/fr/design/mainframe/TemplatePane.java
  5. 24
      designer-base/src/com/fr/env/RemoteEnvPane.java
  6. 9
      designer-realize/src/com/fr/start/EnvSwitcher.java

12
designer-base/src/com/fr/design/DesignerEnvManager.java

@ -10,6 +10,7 @@ import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.file.FILEFactory;
@ -35,10 +36,9 @@ import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.WorkContext;
import javax.swing.SwingWorker;
import javax.swing.*;
import javax.swing.SwingWorker.StateValue;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
@ -1475,10 +1475,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
String tagName = reader.getTagName();
if (LocalDesignerWorkspaceInfo.XML_TAG.equals(tagName)) {
if (DesignerWorkspaceType.Local.toString().equals(tagName)) {
LocalDesignerWorkspaceInfo envConfig = (LocalDesignerWorkspaceInfo) GeneralXMLTools.readXMLable(reader);
putEnv(name, envConfig);
} else if (RemoteDesignerWorkspaceInfo.XML_TAG.equals(tagName)) {
} else if (DesignerWorkspaceType.Remote.toString().equals(tagName)) {
RemoteDesignerWorkspaceInfo envConfig = (RemoteDesignerWorkspaceInfo) GeneralXMLTools.readXMLable(reader);
putEnv(name, envConfig);
}
@ -1605,7 +1605,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
for (Entry<String, DesignerWorkspaceInfo> entry : nameEnvMap.entrySet()) {
writer.startTAG("EnvConfigElement").attr("name", entry.getKey());
DesignerWorkspaceInfo envConfig = entry.getValue();
GeneralXMLTools.writeXMLable(writer, envConfig, envConfig.XML_TAG);
GeneralXMLTools.writeXMLable(writer, envConfig, envConfig.getType().toString());
writer.end();
}
writer.end();

4
designer-base/src/com/fr/design/env/LocalDesignerWorkspaceInfo.java vendored

@ -9,9 +9,7 @@ import com.fr.workspace.connect.WorkspaceConnection;
* Created by juhaoyu on 2018/6/15.
*/
public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
public static final String XML_TAG = "LocalDesignerWorkspaceInfo";
private String name;
private String path;

4
designer-base/src/com/fr/design/env/RemoteDesignerWorkspaceInfo.java vendored

@ -7,9 +7,7 @@ import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.connect.WorkspaceConnection;
public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
public static final String XML_TAG = "RemoteDesignerWorkspaceInfo";
private String name;
private WorkspaceConnection connection;

2
designer-base/src/com/fr/design/mainframe/TemplatePane.java

@ -142,7 +142,7 @@ public class TemplatePane extends JPanel implements MouseListener {
@Override
public void success() {
DesignerEnvManager.getEnvManager().setCurEnvName(selectedName);
DesignUtils.refreshDesignerFrame();
}
});

24
designer-base/src/com/fr/env/RemoteEnvPane.java vendored

@ -47,6 +47,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.util.concurrent.ExecutionException;
import static com.fr.design.layout.TableLayout.FILL;
import static com.fr.design.layout.TableLayout.PREFERRED;
@ -60,9 +61,10 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92);
private JDialog dialog;
private UILabel message;
private UIButton okButton;
private UIButton cancelButton;
private UILabel message = new UILabel();
private UIButton okButton = new UIButton(Inter.getLocText("OK"));
private UIButton cancelButton = new UIButton(Inter.getLocText("Cancel"));
;
/**
* 是否启用 https 勾选框
@ -469,23 +471,25 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
}
private void tryConnectRemoteEnv() {
final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
final SwingWorker<Boolean, Void> worker = new SwingWorker<Boolean, Void>() {
@Override
protected Void doInBackground() throws Exception {
protected Boolean doInBackground() throws Exception {
final RemoteDesignerWorkspaceInfo remoteEnv = updateBean();
WorkContext.getConnector().testConnection(remoteEnv.getConnection());
return null;
return WorkContext.getConnector().testConnection(remoteEnv.getConnection());
}
@Override
protected void done() {
okButton.setEnabled(true);
try {
get();
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful"));
} catch (Exception e) {
if (get()) {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful"));
} else {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed"));
}
} catch (InterruptedException | ExecutionException e) {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed"));
}
}

9
designer-realize/src/com/fr/start/EnvSwitcher.java

@ -26,13 +26,4 @@ public class EnvSwitcher {
TemplatePane.getInstance().dealEvnExceptionWhenStartDesigner();
}
}
/**
* 找不到默认的工作空间时让用户手动选择一个
*/
private Workspace chooseWorkspace() {
return null;
}
}

Loading…
Cancel
Save