ju 7 years ago
parent
commit
2395ebd51f
  1. 8
      designer-base/src/com/fr/design/env/DesignerWorkspaceInfo.java
  2. 4
      designer-base/src/com/fr/design/env/RemoteWorkspace.java
  3. 2
      designer-base/src/com/fr/env/EnvListPane.java
  4. 187
      designer-base/src/com/fr/env/RemoteEnvPane.java
  5. 377
      designer-base/src/com/fr/env/RemoteEnvPane2.java

8
designer-base/src/com/fr/design/env/DesignerWorkspaceInfo.java vendored

@ -85,12 +85,11 @@ public class DesignerWorkspaceInfo implements XMLable {
if (reader.isChildNode()) { if (reader.isChildNode()) {
String tagName = reader.getTagName(); String tagName = reader.getTagName();
if ("Connection".equals(tagName)) { if ("Connection".equals(tagName)) {
String ip = reader.getAttrAsString("ip", StringUtils.EMPTY); String url = reader.getAttrAsString("url", StringUtils.EMPTY);
int port = reader.getAttrAsInt("port", DEFAULT_RPC_PORT);
String username = reader.getAttrAsString("username", StringUtils.EMPTY); String username = reader.getAttrAsString("username", StringUtils.EMPTY);
//密码解密 //密码解密
String password = SecurityToolbox.decrypt(reader.getAttrAsString("password", StringUtils.EMPTY)); String password = SecurityToolbox.decrypt(reader.getAttrAsString("password", StringUtils.EMPTY));
this.connection = new WorkspaceConnection(ip, port, username, password); this.connection = new WorkspaceConnection(url, username, password);
} }
} }
} }
@ -103,8 +102,7 @@ public class DesignerWorkspaceInfo implements XMLable {
writer.attr("type", type.toString()); writer.attr("type", type.toString());
if (this.connection != null) { if (this.connection != null) {
writer.startTAG("Connection"); writer.startTAG("Connection");
writer.attr("ip", connection.getIp()); writer.attr("url", connection.getUrl());
writer.attr("port", connection.getPort());
writer.attr("username", connection.getUserName()); writer.attr("username", connection.getUserName());
writer.attr("password", SecurityToolbox.encrypt(connection.getPassword())); writer.attr("password", SecurityToolbox.encrypt(connection.getPassword()));
writer.end(); writer.end();

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

@ -5,7 +5,7 @@ import com.fr.report.util.RemoteDesignAuthenticateUtils;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceClient; import com.fr.workspace.connect.WorkspaceClient;
import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.engine.WorkspaceServerContext; import com.fr.workspace.server.WorkspaceServerContext;
/** /**
* Created by juhaoyu on 2018/6/14. * Created by juhaoyu on 2018/6/14.
@ -22,7 +22,7 @@ public class RemoteWorkspace implements Workspace {
RemoteWorkspace(WorkspaceClient client, WorkspaceConnection connection) { RemoteWorkspace(WorkspaceClient client, WorkspaceConnection connection) {
this.client = client; this.client = client;
this.address = connection.getIp() + ":" + connection.getPort(); this.address = connection.getUrl();
this.userName = connection.getUserName(); this.userName = connection.getUserName();
} }

2
designer-base/src/com/fr/env/EnvListPane.java vendored

@ -59,7 +59,7 @@ public class EnvListPane extends JListControlPane {
NameableCreator local = new NameObjectCreator(Inter.getLocText("Env-Local_Directory"), "com/fr/design/images/data/bind/localconnect.png", NameableCreator local = new NameObjectCreator(Inter.getLocText("Env-Local_Directory"), "com/fr/design/images/data/bind/localconnect.png",
DesignerWorkspaceInfo.class, LocalEnvPane.class); DesignerWorkspaceInfo.class, LocalEnvPane.class);
NameableCreator remote = new NameObjectCreator(Inter.getLocText("Env-Remote_Server"), "com/fr/design/images/data/bind/distanceconnect.png", NameableCreator remote = new NameObjectCreator(Inter.getLocText("Env-Remote_Server"), "com/fr/design/images/data/bind/distanceconnect.png",
DesignerWorkspaceInfo.class, RemoteEnvPane2.class); DesignerWorkspaceInfo.class, RemoteEnvPane.class);
return new NameableCreator[]{local, remote}; return new NameableCreator[]{local, remote};
} }

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

@ -1,11 +1,10 @@
package com.fr.env; package com.fr.env;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -14,25 +13,45 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.scrollruler.ModLineBorder;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.guava.base.Strings;
import javax.swing.*; import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnection;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File; import java.io.File;
import static com.fr.design.layout.TableLayout.FILL; import static com.fr.design.layout.TableLayout.FILL;
import static com.fr.design.layout.TableLayout.PREFERRED; import static com.fr.design.layout.TableLayout.PREFERRED;
import static com.fr.third.guava.base.Optional.fromNullable;
/** /**
* @author yaohwu * @author yaohwu
@ -41,6 +60,11 @@ public class RemoteEnvPane extends BasicBeanPane<DesignerWorkspaceInfo> {
private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92);
private JDialog dialog;
private UILabel message;
private UIButton okButton;
private UIButton cancelButton;
/** /**
* 是否启用 https 勾选框 * 是否启用 https 勾选框
*/ */
@ -180,7 +204,7 @@ public class RemoteEnvPane extends BasicBeanPane<DesignerWorkspaceInfo> {
// 服务器地址地址 // 服务器地址地址
JPanel configPanel = new JPanel(new BorderLayout()); final JPanel configPanel = new JPanel(new BorderLayout());
configPanel.setBorder( configPanel.setBorder(
BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder(
new EmptyBorder(15, 0, 0, 0), new EmptyBorder(15, 0, 0, 0),
@ -222,9 +246,7 @@ public class RemoteEnvPane extends BasicBeanPane<DesignerWorkspaceInfo> {
testConnectionButton.addActionListener(new ActionListener() { testConnectionButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent ev) { public void actionPerformed(ActionEvent ev) {
if (testConnection()) { tryConnectRemoteEnv();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(RemoteEnvPane.this), Inter.getLocText("Datasource-Connection_successfully"));
}
} }
}); });
testPanel.add(testConnectionButton); testPanel.add(testConnectionButton);
@ -240,35 +262,33 @@ public class RemoteEnvPane extends BasicBeanPane<DesignerWorkspaceInfo> {
@Override @Override
public void populateBean(DesignerWorkspaceInfo ob) { public void populateBean(DesignerWorkspaceInfo ob) {
WorkspaceConnection connection = ob.getConnection();
if (StringUtils.isEmpty(ob.getPath())) { this.remoteEnvURL = Strings.isNullOrEmpty(connection.getUrl())
remoteEnvURL = RemoteEnvURL.createDefaultURL(); ? RemoteEnvURL.createDefaultURL()
} else { : new RemoteEnvURL(connection.getUrl());
remoteEnvURL = new RemoteEnvURL(ob.getPath());
}
fillRemoteEnvURLField(); fillRemoteEnvURLField();
fillIndividualField(); fillIndividualField();
httpsCheckbox.setSelected(remoteEnvURL.getHttps()); httpsCheckbox.setSelected(this.remoteEnvURL.getHttps());
DesignerEnvManager.getEnvManager().setHttps(remoteEnvURL.getHttps()); DesignerEnvManager.getEnvManager().setHttps(this.remoteEnvURL.getHttps());
fileChooserButton.setEnabled(remoteEnvURL.getHttps()); fileChooserButton.setEnabled(this.remoteEnvURL.getHttps());
updateHttpsConfigPanel(); updateHttpsConfigPanel();
String username = ob.getConnection().getUserName(); this.usernameInput.setText(fromNullable(connection.getUserName()).or(StringUtils.EMPTY));
String pwd = ob.getConnection().getPassword(); this.passwordInput.setText(fromNullable(connection.getPassword()).or(StringUtils.EMPTY));
this.usernameInput.setText(username == null ? StringUtils.EMPTY : pwd);
this.passwordInput.setText(pwd == null ? StringUtils.EMPTY : pwd);
} }
@Override @Override
public DesignerWorkspaceInfo updateBean() { public DesignerWorkspaceInfo updateBean() {
WorkspaceConnection connection = new WorkspaceConnection(
String path = remoteEnvURL.getURL(); this.remoteEnvURL.getURL(),
String user = this.usernameInput.getText(); this.usernameInput.getText(),
String password = new String(this.passwordInput.getPassword()); new String(this.passwordInput.getPassword()));
// return DesignerWorkspaceInfo.createRemote();
return null; DesignerWorkspaceInfo config = new DesignerWorkspaceInfo();
//return new RemoteEnvConfig(path, user, password); config.setConnection(connection);
config.setType(DesignerWorkspaceType.Remote);
return config;
} }
@Override @Override
@ -446,50 +466,77 @@ public class RemoteEnvPane extends BasicBeanPane<DesignerWorkspaceInfo> {
return inputPanel; return inputPanel;
} }
private void tryConnectRemoteEnv() {
final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
private void setHttpsParas() { @Override
System.setProperty("javax.net.ssl.trustStore", this.certPathInput.getText()); protected Void doInBackground() throws Exception {
System.setProperty("javax.net.ssl.trustStorePassword", new String(this.certSecretKeyInput.getPassword()));
DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
manager.setCertificatePath(this.certPathInput.getText());
manager.setCertificatePass(new String(this.certSecretKeyInput.getPassword()));
manager.setHttps(this.httpsCheckbox.isSelected());
}
private boolean testConnection() { final DesignerWorkspaceInfo remoteEnv = updateBean();
String url = remoteEnvURL.getURL(); WorkContext.getConnector().testConnection(remoteEnv.getConnection());
//RemoteEnv env = new RemoteEnv(url, usernameInput.getText(), new String(passwordInput.getPassword())); return null;
boolean connect = false;
try {
if (StringUtils.isNotEmpty(url)) {
if (remoteEnvURL.getHttps()) {
setHttpsParas();
}
// connect = env.testConnectionWithOutRegisteServer(this);
} }
} catch (Exception e) {
JOptionPane.showMessageDialog( @Override
this, protected void done() {
Inter.getLocText("Datasource-Connection_failed"), okButton.setEnabled(true);
UIManager.getString("OptionPane.messageDialogTitle", this.getLocale()), try {
JOptionPane.ERROR_MESSAGE get();
); message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful"));
FRContext.getLogger().error(e.getMessage(), e); } catch (Exception e) {
} message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed"));
if (connect) {
try {
String remoteVersion = "";
if (StringUtils.isBlank(remoteVersion) || ComparatorUtils.compare(remoteVersion, ProductConstants.DESIGNER_VERSION) < 0) {
String info = Inter.getLocText("Server-version-tip") + "。";
String moreInfo = Inter.getLocText("Server-version-tip-moreInfo") + "。";
new InformationWarnPane(info, moreInfo, Inter.getLocText("Tooltips")).show();
return false;
} }
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
} }
} };
return connect; worker.execute();
initMessageDialog();
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dialog.dispose();
worker.cancel(true);
}
});
dialog.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
worker.cancel(true);
}
});
dialog.setVisible(true);
dialog.dispose();
}
private void initMessageDialog() {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Try") + "...");
message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0));
okButton.setEnabled(false);
dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane.this), Inter.getLocText("Datasource-Test_Connection"), true);
dialog.setSize(new Dimension(268, 118));
okButton.setEnabled(false);
JPanel jp = new JPanel();
JPanel upPane = new JPanel();
JPanel downPane = new JPanel();
UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
upPane.add(uiLabel);
upPane.add(message);
downPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0));
downPane.add(okButton);
downPane.add(cancelButton);
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
jp.add(upPane);
jp.add(downPane);
dialog.add(jp);
dialog.setResizable(false);
dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(RemoteEnvPane.this));
} }
/** /**

377
designer-base/src/com/fr/env/RemoteEnvPane2.java vendored

@ -1,192 +1,185 @@
package com.fr.env; //package com.fr.env;
//
import com.fr.design.beans.BasicBeanPane; //import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder; //import com.fr.design.border.UITitledBorder;
import com.fr.design.env.DesignerWorkspaceInfo; //import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType; //import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.gui.ibutton.UIButton; //import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; //import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPassWordField; //import com.fr.design.gui.ipasswordfield.UIPassWordField;
import com.fr.design.gui.itextfield.UIIntNumberField; //import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UITextField; //import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout; //import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; //import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; //import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; //import com.fr.general.Inter;
import com.fr.workspace.WorkContext; //import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnection; //import com.fr.workspace.connect.WorkspaceConnection;
//
import javax.swing.*; //import javax.swing.*;
import javax.swing.border.EmptyBorder; //import javax.swing.border.EmptyBorder;
import java.awt.*; //import java.awt.*;
import java.awt.event.ActionEvent; //import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; //import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; //import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; //import java.awt.event.WindowEvent;
//
/** ///**
* 远程环境设置界面暂时命名为2待做完功能直接替代掉老的RemoteEnvPane // * 远程环境设置界面,暂时命名为2,待做完功能直接替代掉老的RemoteEnvPane
*/ // */
public class RemoteEnvPane2 extends BasicBeanPane<DesignerWorkspaceInfo> { //public class RemoteEnvPane2 extends BasicBeanPane<DesignerWorkspaceInfo> {
//
private UITextField hostTextField; // private UITextField urlTextField;
private UIIntNumberField portTextField; // private UITextField usernameTextField;
private UITextField usernameTextField; // private UIPassWordField passwordTextField;
private UIPassWordField passwordTextField; // private JDialog dialog;
private JDialog dialog; // private UILabel message;
private UILabel message; // private UIButton okButton;
private UIButton okButton; // private UIButton cancelButton;
private UIButton cancelButton; //
// public RemoteEnvPane2() {
public RemoteEnvPane2() { // initComponents();
initComponents(); // }
} //
// private void initComponents() {
private void initComponents() { // setLayout(new BorderLayout());
setLayout(new BorderLayout()); //
// JPanel contentPanel = new JPanel(new BorderLayout());
JPanel contentPanel = new JPanel(new BorderLayout()); // add(contentPanel, BorderLayout.CENTER);
add(contentPanel, BorderLayout.CENTER); //
// contentPanel.setBorder(
contentPanel.setBorder( // BorderFactory.createCompoundBorder(
BorderFactory.createCompoundBorder( // new EmptyBorder(6, 0, 0, 0),
new EmptyBorder(6, 0, 0, 0), // UITitledBorder.createBorderWithTitle(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Config")))
UITitledBorder.createBorderWithTitle(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Config"))) // );
); //
// double p = TableLayout.PREFERRED;
double p = TableLayout.PREFERRED; // double f = TableLayout.FILL;
double f = TableLayout.FILL; // double[] rowSize = new double[]{p, p, p, p};
double[] rowSize = new double[]{p, p, p, p, p}; // double[] columnSize = new double[]{p, f};
double[] columnSize = new double[]{p, f}; // UIButton testConnectionButton = new UIButton(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Try"));
UIButton testConnectionButton = new UIButton(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Try")); // urlTextField = new UITextField();
hostTextField = new UITextField(); // urlTextField.setPlaceholder("http://192.168.100.200/webroot/decision");
hostTextField.setPlaceholder("192.168.100.200"); // JPanel valuePane = TableLayoutHelper.createTableLayoutPane(
portTextField = new UIIntNumberField(); // new Component[][]{
portTextField.setPlaceholder("39999"); // {new UILabel(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Host") + ":", SwingConstants.RIGHT), urlTextField},
JPanel valuePane = TableLayoutHelper.createTableLayoutPane( // {new UILabel(Inter.getLocText("Fine-Designer_Basic_Remote_Env_User") + ":", SwingConstants.RIGHT), usernameTextField = new UITextField()},
new Component[][]{ // {new UILabel(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Password") + ":", SwingConstants.RIGHT), passwordTextField = new UIPassWordField()},
{new UILabel(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Host") + ":", SwingConstants.RIGHT), hostTextField}, // {null, GUICoreUtils.createFlowPane(testConnectionButton, FlowLayout.LEFT)}
{new UILabel(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Port") + ":", SwingConstants.RIGHT),portTextField}, // },
{new UILabel(Inter.getLocText("Fine-Designer_Basic_Remote_Env_User") + ":", SwingConstants.RIGHT), usernameTextField = new UITextField()}, // rowSize, columnSize
{new UILabel(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Password") + ":", SwingConstants.RIGHT), passwordTextField = new UIPassWordField()}, // );
{null, GUICoreUtils.createFlowPane(testConnectionButton, FlowLayout.LEFT)} // testConnectionButton.addActionListener(new ActionListener() {
}, // @Override
rowSize, columnSize // public void actionPerformed(ActionEvent e) {
); // tryConnectRemoteEnv();
testConnectionButton.addActionListener(new ActionListener() { // }
@Override // });
public void actionPerformed(ActionEvent e) { // contentPanel.add(valuePane, BorderLayout.CENTER);
tryConnectRemoteEnv(); //
} // message = new UILabel();
}); // okButton = new UIButton(Inter.getLocText("OK"));
contentPanel.add(valuePane, BorderLayout.CENTER); // cancelButton = new UIButton(Inter.getLocText("Cancel"));
// }
message = new UILabel(); //
okButton = new UIButton(Inter.getLocText("OK")); // private void tryConnectRemoteEnv() {
cancelButton = new UIButton(Inter.getLocText("Cancel")); // final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
} //
// @Override
private void tryConnectRemoteEnv() { // protected Void doInBackground() throws Exception {
final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { //
// final DesignerWorkspaceInfo remoteEnv = updateBean();
@Override // WorkContext.getConnector().testConnection(remoteEnv.getConnection());
protected Void doInBackground() throws Exception { // return null;
// }
final DesignerWorkspaceInfo remoteEnv = updateBean(); //
WorkContext.getConnector().testConnection(remoteEnv.getConnection()); // @Override
return null; // protected void done() {
} // okButton.setEnabled(true);
// try {
@Override // get();
protected void done() { // message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful"));
okButton.setEnabled(true); // } catch (Exception e) {
try { // message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed"));
get(); // }
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful")); // }
} catch (Exception e) { // };
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed")); // worker.execute();
} // initMessageDialog();
} // okButton.addActionListener(new ActionListener() {
}; // public void actionPerformed(ActionEvent e) {
worker.execute(); // dialog.dispose();
initMessageDialog(); // }
okButton.addActionListener(new ActionListener() { // });
public void actionPerformed(ActionEvent e) { // cancelButton.addActionListener(new ActionListener() {
dialog.dispose(); // public void actionPerformed(ActionEvent e) {
} // dialog.dispose();
}); // worker.cancel(true);
cancelButton.addActionListener(new ActionListener() { // }
public void actionPerformed(ActionEvent e) { // });
dialog.dispose(); //
worker.cancel(true); // dialog.addWindowListener(new WindowAdapter() {
} // public void windowClosed(WindowEvent e) {
}); // worker.cancel(true);
// }
dialog.addWindowListener(new WindowAdapter() { // });
public void windowClosed(WindowEvent e) { //
worker.cancel(true); // dialog.setVisible(true);
} // dialog.dispose();
}); // }
//
dialog.setVisible(true); // private void initMessageDialog() {
dialog.dispose(); // message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Try") + "...");
} // message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0));
// okButton.setEnabled(false);
private void initMessageDialog() { //
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Env_Try") + "..."); // dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane2.this), Inter.getLocText("Datasource-Test_Connection"), true);
message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0)); //
okButton.setEnabled(false); // dialog.setSize(new Dimension(268, 118));
// okButton.setEnabled(false);
dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane2.this), Inter.getLocText("Datasource-Test_Connection"), true); // JPanel jp = new JPanel();
// JPanel upPane = new JPanel();
dialog.setSize(new Dimension(268, 118)); // JPanel downPane = new JPanel();
okButton.setEnabled(false); // UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
JPanel jp = new JPanel(); // upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
JPanel upPane = new JPanel(); // upPane.add(uiLabel);
JPanel downPane = new JPanel(); // upPane.add(message);
UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); // downPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0));
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); // downPane.add(okButton);
upPane.add(uiLabel); // downPane.add(cancelButton);
upPane.add(message); // jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
downPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); // jp.add(upPane);
downPane.add(okButton); // jp.add(downPane);
downPane.add(cancelButton); // dialog.add(jp);
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); // dialog.setResizable(false);
jp.add(upPane); // dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(RemoteEnvPane2.this));
jp.add(downPane); // }
dialog.add(jp); //
dialog.setResizable(false); // @Override
dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(RemoteEnvPane2.this)); // protected String title4PopupWindow() {
} // return "RemoteEnv";
// }
@Override //
protected String title4PopupWindow() { // @Override
return "RemoteEnv"; // public void populateBean(DesignerWorkspaceInfo config) {
} // if (config == null) {
// return;
@Override // }
public void populateBean(DesignerWorkspaceInfo config) { // WorkspaceConnection connection = config.getConnection();
if (config == null) { // if (connection != null) {
return; // urlTextField.setText(connection.getUrl());
} // usernameTextField.setText(connection.getUserName());
WorkspaceConnection connection = config.getConnection(); // passwordTextField.setText(connection.getPassword());
if (connection != null) { // }
hostTextField.setText(connection.getIp()); // }
if (connection.getPort() != 0) { //
portTextField.setValue(connection.getPort()); // @Override
} // public DesignerWorkspaceInfo updateBean() {
usernameTextField.setText(connection.getUserName()); //
passwordTextField.setText(connection.getPassword()); // DesignerWorkspaceInfo config = new DesignerWorkspaceInfo();
} // WorkspaceConnection connection = new WorkspaceConnection(urlTextField.getText(), usernameTextField.getText(), passwordTextField.getText());
} // config.setConnection(connection);
// config.setType(DesignerWorkspaceType.Remote);
@Override // return config;
public DesignerWorkspaceInfo updateBean() { // }
//}
DesignerWorkspaceInfo config = new DesignerWorkspaceInfo();
WorkspaceConnection connection = new WorkspaceConnection(hostTextField.getText(), (int) portTextField.getValue(), usernameTextField.getText(), passwordTextField.getText());
config.setConnection(connection);
config.setType(DesignerWorkspaceType.Remote);
return config;
}
}

Loading…
Cancel
Save