parent
0ba2d9706c
commit
f1ede54afd
@ -83,6 +83,7 @@ import eva2.tools.Serializer;
|
|||||||
import eva2.tools.StringTools;
|
import eva2.tools.StringTools;
|
||||||
import eva2.tools.jproxy.RemoteStateListener;
|
import eva2.tools.jproxy.RemoteStateListener;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -107,6 +108,9 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
private transient JExtMenu menuOptions;
|
private transient JExtMenu menuOptions;
|
||||||
private transient JProgressBar progressBar;
|
private transient JProgressBar progressBar;
|
||||||
|
|
||||||
|
// Option
|
||||||
|
private ExtAction actQuit;
|
||||||
|
|
||||||
// LogPanel
|
// LogPanel
|
||||||
private LogPanel logPanel;
|
private LogPanel logPanel;
|
||||||
private static final Logger logger = Logger.getLogger(EvAInfo.defaultLogger);
|
private static final Logger logger = Logger.getLogger(EvAInfo.defaultLogger);
|
||||||
@ -115,12 +119,12 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
private ExtAction actModuleLoad;
|
private ExtAction actModuleLoad;
|
||||||
|
|
||||||
// Hosts:
|
// Hosts:
|
||||||
|
|
||||||
private ExtAction actHost;
|
private ExtAction actHost;
|
||||||
private ExtAction actAvailableHost;
|
private ExtAction actAvailableHost;
|
||||||
private ExtAction actKillHost;
|
private ExtAction actKillHost;
|
||||||
private ExtAction actKillAllHosts;
|
private ExtAction actKillAllHosts;
|
||||||
private ModuleAdapter currentModuleAdapter = null;
|
private ModuleAdapter currentModuleAdapter = null;
|
||||||
|
|
||||||
// About:
|
// About:
|
||||||
private ExtAction actAbout;
|
private ExtAction actAbout;
|
||||||
private ExtAction actLicense;
|
private ExtAction actLicense;
|
||||||
@ -141,6 +145,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
private boolean withGUI = true;
|
private boolean withGUI = true;
|
||||||
private boolean withTreeView = false;
|
private boolean withTreeView = false;
|
||||||
private EvATabbedFrameMaker frameMaker = null;
|
private EvATabbedFrameMaker frameMaker = null;
|
||||||
|
private Window parentWindow;
|
||||||
|
|
||||||
public void addRemoteStateListener(RemoteStateListener l) {
|
public void addRemoteStateListener(RemoteStateListener l) {
|
||||||
if (superListenerList == null) {
|
if (superListenerList == null) {
|
||||||
@ -401,6 +406,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
*/
|
*/
|
||||||
private void init(String hostName, String paramsFile, InterfaceGOParameters goParams, final Window parent) {
|
private void init(String hostName, String paramsFile, InterfaceGOParameters goParams, final Window parent) {
|
||||||
useDefaultModule = EvAInfo.propDefaultModule();
|
useDefaultModule = EvAInfo.propDefaultModule();
|
||||||
|
this.parentWindow = parent;
|
||||||
|
|
||||||
if (useDefaultModule != null) {
|
if (useDefaultModule != null) {
|
||||||
useDefaultModule = useDefaultModule.trim();
|
useDefaultModule = useDefaultModule.trim();
|
||||||
@ -479,16 +485,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
evaFrame.addWindowListener(new WindowAdapter() {
|
evaFrame.addWindowListener(new WindowAdapter() {
|
||||||
|
|
||||||
public void windowClosing(WindowEvent e) {
|
public void windowClosing(WindowEvent e) {
|
||||||
logger.info("Closing EvA2 Client. Bye!");
|
EvAClient.this.close();
|
||||||
evaFrame.dispose();
|
|
||||||
Set<String> keys = System.getenv().keySet();
|
|
||||||
if (keys.contains("MATLAB")) {
|
|
||||||
System.out.println("Seems like Ive been started from Matlab: not killing JVM");
|
|
||||||
} else {
|
|
||||||
if (parent == null) {
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -500,8 +497,6 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
comAdapter.setLogPanel(logPanel);
|
comAdapter.setLogPanel(logPanel);
|
||||||
logger.log(Level.INFO, "Selected Host: {0}", comAdapter.getHostName());
|
logger.log(Level.INFO, "Selected Host: {0}", comAdapter.getHostName());
|
||||||
}
|
}
|
||||||
// m_mnuModule.setText("Select module");
|
|
||||||
// m_mnuModule.repaint();
|
|
||||||
|
|
||||||
if (withGUI) {
|
if (withGUI) {
|
||||||
logger.log(Level.INFO, "Working directory is: {0}", System.getProperty("user.dir"));
|
logger.log(Level.INFO, "Working directory is: {0}", System.getProperty("user.dir"));
|
||||||
@ -519,6 +514,23 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes EvA2 workbench. Will not kill the JVM iff
|
||||||
|
* the MATLAB environment variable has been set.
|
||||||
|
*/
|
||||||
|
public void close() {
|
||||||
|
logger.info("Closing EvA2 Client. Bye!");
|
||||||
|
evaFrame.dispose();
|
||||||
|
Set<String> keys = System.getenv().keySet();
|
||||||
|
if (keys.contains("MATLAB")) {
|
||||||
|
logger.info("EvA2 workbench has been started from Matlab: not killing JVM");
|
||||||
|
} else {
|
||||||
|
if (parentWindow == null) {
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the parameter panels (if settings have been changed outside of
|
* Refresh the parameter panels (if settings have been changed outside of
|
||||||
* the GUI which should be updated in the GUI.
|
* the GUI which should be updated in the GUI.
|
||||||
@ -595,12 +607,18 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
// add a data listener instance:
|
// add a data listener instance:
|
||||||
evaClient.getStatistics().addDataListener(statisticsListener);
|
evaClient.getStatistics().addDataListener(statisticsListener);
|
||||||
|
|
||||||
evaClient.refreshMainPanels(); // GUI update due to the changes made through the API
|
// GUI update due to the changes made through the API
|
||||||
|
evaClient.refreshMainPanels();
|
||||||
|
|
||||||
|
|
||||||
return evaClient;
|
return evaClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method returns a readable usage string.
|
||||||
|
*
|
||||||
|
* @return Returns usage message
|
||||||
|
*/
|
||||||
public static String usage() {
|
public static String usage() {
|
||||||
StringBuilder sbuf = new StringBuilder();
|
StringBuilder sbuf = new StringBuilder();
|
||||||
sbuf.append(EvAInfo.productName);
|
sbuf.append(EvAInfo.productName);
|
||||||
@ -630,9 +648,6 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
// Module:
|
|
||||||
/////////////////////////////////////////////////////////////
|
|
||||||
actModuleLoad = new ExtAction("&Load", "Load Module",
|
actModuleLoad = new ExtAction("&Load", "Load Module",
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_L, Event.CTRL_MASK)) {
|
KeyStroke.getKeyStroke(KeyEvent.VK_L, Event.CTRL_MASK)) {
|
||||||
|
|
||||||
@ -732,6 +747,17 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
xx.start();
|
xx.start();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
actQuit = new ExtAction("&Quit", "Quit EvA2 workbench",
|
||||||
|
KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK)) {
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||||
|
*/
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
EvAClient.this.close();
|
||||||
|
}
|
||||||
|
};
|
||||||
/*
|
/*
|
||||||
* m_actStartServerManager = new ExtAction("Start &Server Manager",
|
* m_actStartServerManager = new ExtAction("Start &Server Manager",
|
||||||
* "Start &Server Manager", KeyStroke.getKeyStroke(KeyEvent.VK_S,
|
* "Start &Server Manager", KeyStroke.getKeyStroke(KeyEvent.VK_S,
|
||||||
@ -760,20 +786,21 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
Object[] framelist = JEFrameRegister.getFrameList();
|
Object[] framelist = JEFrameRegister.getFrameList();
|
||||||
for (int i = 0; i < framelist.length; i++) {
|
for (int i = 0; i < framelist.length; i++) {
|
||||||
JMenuItem act = new JMenuItem((i + 1) + ". " + ((JEFrame) framelist[i]).getTitle());
|
JMenuItem act = new JMenuItem((i + 1) + ". " + ((JEFrame) framelist[i]).getTitle());
|
||||||
final JFrame x = ((JEFrame) framelist[i]);
|
final JFrame selectedFrame = ((JEFrame) framelist[i]);
|
||||||
|
|
||||||
act.addActionListener((new ActionListener() {
|
act.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (!x.isActive()) {
|
if (!selectedFrame.isActive()) {
|
||||||
x.setExtendedState(JFrame.NORMAL);
|
selectedFrame.setExtendedState(JFrame.NORMAL);
|
||||||
x.setVisible(false);
|
selectedFrame.setVisible(false);
|
||||||
x.setVisible(true); // it seems to be quite a fuss to bring something to the front and actually mean it...
|
selectedFrame.setVisible(true); // it seems to be quite a fuss to bring something to the front and actually mean it...
|
||||||
x.toFront(); // this seems useless
|
selectedFrame.toFront(); // this seems useless
|
||||||
x.requestFocus(); // this seems useless too
|
selectedFrame.requestFocus(); // this seems useless too
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
|
|
||||||
if (curMenu.getItemCount() >= maxWindowMenuLength) {
|
if (curMenu.getItemCount() >= maxWindowMenuLength) {
|
||||||
JExtMenu subMenu = new JExtMenu("&More...");
|
JExtMenu subMenu = new JExtMenu("&More...");
|
||||||
curMenu.add(new JSeparator());
|
curMenu.add(new JSeparator());
|
||||||
@ -810,23 +837,20 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
menuSelHosts = new JExtMenu("&Select Hosts");
|
menuSelHosts = new JExtMenu("&Select Hosts");
|
||||||
menuSelHosts.setToolTipText("Select a host for the server application");
|
menuSelHosts.setToolTipText("Select a host for the server application");
|
||||||
//if (EvAClient.LITE_VERSION == false)
|
|
||||||
menuSelHosts.add(actHost);
|
menuSelHosts.add(actHost);
|
||||||
menuSelHosts.add(actAvailableHost);
|
menuSelHosts.add(actAvailableHost);
|
||||||
menuSelHosts.addSeparator();
|
menuSelHosts.addSeparator();
|
||||||
menuSelHosts.add(actKillHost);
|
menuSelHosts.add(actKillHost);
|
||||||
menuSelHosts.add(actKillAllHosts);
|
menuSelHosts.add(actKillAllHosts);
|
||||||
// m_mnuOptions.add(m_actStartServerManager);
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
menuAbout = new JExtMenu("&About");
|
menuAbout = new JExtMenu("&About");
|
||||||
menuAbout.add(actAbout);
|
menuAbout.add(actAbout);
|
||||||
menuAbout.add(actLicense);
|
menuAbout.add(actLicense);
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// m_barMenu.add(m_Desktop.getWindowMenu());
|
|
||||||
|
|
||||||
menuOptions = new JExtMenu("&Options");
|
menuOptions = new JExtMenu("&Options");
|
||||||
menuOptions.add(menuSelHosts);
|
menuOptions.add(menuSelHosts);
|
||||||
//m_barMenu.add(m_mnuSelHosts);
|
menuOptions.add(actQuit);
|
||||||
// this is accessible if no default module is given
|
// this is accessible if no default module is given
|
||||||
if (showLoadModules) {
|
if (showLoadModules) {
|
||||||
menuBar.add(menuModule);
|
menuBar.add(menuModule);
|
||||||
@ -1191,7 +1215,6 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class SplashScreen extends Frame {
|
final class SplashScreen extends Frame {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1281793825850423095L;
|
private static final long serialVersionUID = 1281793825850423095L;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user