if (m_GUIType == GUI_MDI) {
final ChildFrameMDI frame = (ChildFrameMDI) c;
Point l = panel.getFrameLocation();
if ((l.x != -1) && (l.y != -1))
frame.setLocation(l);
frame.addInternalFrameListener(new InternalFrameAdapter() {
public void internalFrameClosing(InternalFrameEvent e) {
panel.stopMonitoring();
}
});
}
else {
final ChildFrameSDI frame = (ChildFrameSDI) c;
Point l = panel.getFrameLocation();
if ((l.x != -1) && (l.y != -1))
frame.setLocation(l);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
panel.stopMonitoring();
}
});
}
}
else {
showWindow(getWindow(title));
}
}
});
jMenuProgram.add(new JSeparator());
// Program/Exit
jMenuItemProgramExit = new JMenuItem();
jMenuProgram.add(jMenuItemProgramExit);
jMenuItemProgramExit.setText("Exit");
jMenuItemProgramExit.setMnemonic('E');
jMenuItemProgramExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
// close all children
Iterator iter = getWindowList();
Vector<Container> list = new Vector<Container>();
while (iter.hasNext())
list.add((Container) iter.next());
for (int i = 0; i < list.size(); i++) {
Container c = list.get(i);
if (c instanceof ChildFrameMDI)
((ChildFrameMDI) c).dispose();
else if (c instanceof ChildFrameSDI)
((ChildFrameSDI) c).dispose();
}
// close logwindow
m_LogWindow.dispose();
// close main window
m_Self.dispose();
// make sure we stop
System.exit(0);
}
});
// Applications
jMenuApplications = new JMenu();
jMenuBar.add(jMenuApplications);
jMenuApplications.setText("Applications");
jMenuApplications.setMnemonic('A');
// Applications/Explorer
jMenuItemApplicationsExplorer = new JMenuItem();
jMenuApplications.add(jMenuItemApplicationsExplorer);
jMenuItemApplicationsExplorer.setText("Explorer");
jMenuItemApplicationsExplorer.setMnemonic('E');
jMenuItemApplicationsExplorer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String title = jMenuItemApplicationsExplorer.getText();
if (!containsWindow(title)) {
createFrame(
m_Self, title, new Explorer(), new BorderLayout(),
BorderLayout.CENTER, 800, 600, null, true, true);
}
else {
showWindow(getWindow(title));
}
}
});
// Applications/Experimenter
jMenuItemApplicationsExperimenter = new JMenuItem();
jMenuApplications.add(jMenuItemApplicationsExperimenter);
jMenuItemApplicationsExperimenter.setText("Experimenter");
jMenuItemApplicationsExperimenter.setMnemonic('X');
jMenuItemApplicationsExperimenter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String title = jMenuItemApplicationsExperimenter.getText();
if (!containsWindow(title)) {
createFrame(
m_Self, title, new Experimenter(false), new BorderLayout(),
BorderLayout.CENTER, 800, 600, null, true, true);
}
else {
showWindow(getWindow(title));
}
}
});
// Applications/KnowledgeFlow
jMenuItemApplicationsKnowledgeFlow = new JMenuItem();
jMenuApplications.add(jMenuItemApplicationsKnowledgeFlow);
jMenuItemApplicationsKnowledgeFlow.setText("KnowledgeFlow");
jMenuItemApplicationsKnowledgeFlow.setMnemonic('K');
jMenuItemApplicationsKnowledgeFlow.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String title = jMenuItemApplicationsKnowledgeFlow.getText();
if (!containsWindow(title)) {
KnowledgeFlowApp.createSingleton(new String[0]);
createFrame(
m_Self, title, KnowledgeFlowApp.getSingleton(), new BorderLayout(),
BorderLayout.CENTER, 900, 600, null, true, true);
}
else {
showWindow(getWindow(title));
}
}
});
// Applications/SimpleCLI
jMenuItemApplicationsSimpleCLI = new JMenuItem();
jMenuApplications.add(jMenuItemApplicationsSimpleCLI);
jMenuItemApplicationsSimpleCLI.setText("SimpleCLI");
jMenuItemApplicationsSimpleCLI.setMnemonic('S');
jMenuItemApplicationsSimpleCLI.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String title = jMenuItemApplicationsSimpleCLI.getText();
if (!containsWindow(title)) {
try {
createFrame(
m_Self, title, new SimpleCLIPanel(), new BorderLayout(),
BorderLayout.CENTER, 600, 500, null, true, true);
}
catch (Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(
m_Self, "Error instantiating SimpleCLI:\n" + e.getMessage());
return;
}
}
else {
showWindow(getWindow(title));
}
}
});
// Tools
jMenuTools = new JMenu();
jMenuBar.add(jMenuTools);
jMenuTools.setText("Tools");
jMenuTools.setMnemonic('T');
// Tools/ArffViewer
jMenuItemToolsArffViewer = new JMenuItem();
jMenuTools.add(jMenuItemToolsArffViewer);
jMenuItemToolsArffViewer.setText("ArffViewer");
jMenuItemToolsArffViewer.setMnemonic('A');
jMenuItemToolsArffViewer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String title = jMenuItemToolsArffViewer.getText();
if (!containsWindow(title)) {
ArffViewerMainPanel panel = new ArffViewerMainPanel(null);
panel.setConfirmExit(false);
Container frame = createFrame(
m_Self, title, panel, new BorderLayout(),
BorderLayout.CENTER, 800, 600, panel.getMenu(), true, true);
panel.setParent(frame);
}
else {
showWindow(getWindow(title));
}
}
});
// Tools/SqlViewer
jMenuItemToolsSqlViewer = new JMenuItem();
jMenuTools.add(jMenuItemToolsSqlViewer);
jMenuItemToolsSqlViewer.setText("SqlViewer");
jMenuItemToolsSqlViewer.setMnemonic('S');
jMenuItemToolsSqlViewer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String title = jMenuItemToolsSqlViewer.getText();
if (!containsWindow(title)) {
final SqlViewer sql = new SqlViewer(null);
final Container frame = createFrame(
m_Self, title, sql, new BorderLayout(),
BorderLayout.CENTER, -1, -1, null, false, true);
// custom listener
if (frame instanceof ChildFrameMDI) {
((ChildFrameMDI) frame).addInternalFrameListener(new InternalFrameAdapter() {
public void internalFrameClosing(InternalFrameEvent e) {
sql.saveSize();
((ChildFrameMDI) frame).dispose();
}
});
}
else if (frame instanceof ChildFrameSDI) {
((ChildFrameSDI) frame).addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
sql.saveSize();
((ChildFrameSDI) frame).dispose();
}
});
}
}
else {
showWindow(getWindow(title));
}
}
});
// Tools/Bayes net editor
// Tools/Bayes net editor
final JMenuItem jMenuItemBayesNet = new JMenuItem();
jMenuTools.add(jMenuItemBayesNet);
jMenuItemBayesNet.setText("Bayes net editor");
jMenuItemBayesNet.setMnemonic('N');
jMenuItemBayesNet.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String title = jMenuItemBayesNet.getText();
if (!containsWindow(title)) {
final GUI bayesNetGUI = new GUI();
final Container frame = createFrame(
m_Self, title, bayesNetGUI, new BorderLayout(),
BorderLayout.CENTER, 800, 600, bayesNetGUI.getMenuBar(), false, true);
}
else {
showWindow(getWindow(title));
}
}
});
// Tools/Groovy console
if (Groovy.isPresent()) {
jMenuItemToolsGroovyConsole = new JMenuItem();
jMenuTools.add(jMenuItemToolsGroovyConsole);
jMenuItemToolsGroovyConsole.setText("Groovy console");
jMenuItemToolsGroovyConsole.setMnemonic('G');
jMenuItemToolsGroovyConsole.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String title = jMenuItemToolsGroovyConsole.getText();
if (!containsWindow(title)) {
final GroovyPanel panel = new GroovyPanel();
final Container frame = createFrame(
m_Self, title, panel, new BorderLayout(),
BorderLayout.CENTER, 800, 600, panel.getMenuBar(), false, true);
// custom listener
if (frame instanceof ChildFrameMDI) {
((ChildFrameMDI) frame).addInternalFrameListener(new InternalFrameAdapter() {
public void internalFrameClosing(InternalFrameEvent e) {
((ChildFrameMDI) frame).dispose();
}
});
}
else if (frame instanceof ChildFrameSDI) {
((ChildFrameSDI) frame).addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
((ChildFrameSDI) frame).dispose();
}
});
}
}
else {
showWindow(getWindow(title));
}
}
});
}
// Tools/Jython console
if (Jython.isPresent()) {
jMenuItemToolsJythonConsole = new JMenuItem();
jMenuTools.add(jMenuItemToolsJythonConsole);
jMenuItemToolsJythonConsole.setText("Jython console");
jMenuItemToolsJythonConsole.setMnemonic('J');
jMenuItemToolsJythonConsole.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String title = jMenuItemToolsJythonConsole.getText();
if (!containsWindow(title)) {
final JythonPanel panel = new JythonPanel();
final Container frame = createFrame(
m_Self, title, panel, new BorderLayout(),
BorderLayout.CENTER, 800, 600, panel.getMenuBar(), false, true);
// custom listener
if (frame instanceof ChildFrameMDI) {
((ChildFrameMDI) frame).addInternalFrameListener(new InternalFrameAdapter() {
public void internalFrameClosing(InternalFrameEvent e) {
((ChildFrameMDI) frame).dispose();
}
});
}