refs #14
Added ToolBar to JExtDesktopPane and created new About window.
This commit is contained in:
parent
d9b47eab9b
commit
0ee348e2b6
BIN
resources/images/Cascade16.png
Normal file
BIN
resources/images/Cascade16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 535 B |
BIN
resources/images/TileHorizontal16.png
Normal file
BIN
resources/images/TileHorizontal16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 422 B |
BIN
resources/images/TileVertical16.png
Normal file
BIN
resources/images/TileVertical16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 369 B |
@ -1,21 +1,20 @@
|
|||||||
package eva2.client;
|
package eva2.client;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Title: EvA2
|
* Title: EvA2
|
||||||
* Description: The main client class of the EvA framework.
|
* Description: The main client class of the EvA framework.
|
||||||
* Copyright: Copyright (c) 2008
|
* Copyright: Copyright (c) 2008
|
||||||
* Company: University of Tuebingen, Computer
|
* Company: University of Tuebingen, Computer
|
||||||
* Architecture
|
* Architecture
|
||||||
*
|
*
|
||||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
||||||
* @version: $Revision: 322 $ $Date: 2007-12-11 17:24:07 +0100 (Tue, 11 Dec 2007)$
|
* @version: $Revision: 322 $ $Date: 2007-12-11 17:24:07 +0100 (Tue, 11 Dec 2007)$
|
||||||
* $Author: mkron $
|
* $Author: mkron $
|
||||||
*/
|
*/
|
||||||
import eva2.EvAInfo;
|
import eva2.EvAInfo;
|
||||||
import eva2.gui.*;
|
import eva2.gui.*;
|
||||||
import eva2.server.EvAServer;
|
import eva2.server.EvAServer;
|
||||||
import eva2.server.go.InterfaceGOParameters;
|
import eva2.server.go.InterfaceGOParameters;
|
||||||
import eva2.server.go.strategies.GradientDescentAlgorithm;
|
|
||||||
import eva2.server.modules.AbstractModuleAdapter;
|
import eva2.server.modules.AbstractModuleAdapter;
|
||||||
import eva2.server.modules.GOParameters;
|
import eva2.server.modules.GOParameters;
|
||||||
import eva2.server.modules.GenericModuleAdapter;
|
import eva2.server.modules.GenericModuleAdapter;
|
||||||
@ -23,11 +22,14 @@ import eva2.server.modules.ModuleAdapter;
|
|||||||
import eva2.server.stat.AbstractStatistics;
|
import eva2.server.stat.AbstractStatistics;
|
||||||
import eva2.server.stat.InterfaceStatisticsListener;
|
import eva2.server.stat.InterfaceStatisticsListener;
|
||||||
import eva2.server.stat.InterfaceStatisticsParameter;
|
import eva2.server.stat.InterfaceStatisticsParameter;
|
||||||
import eva2.tools.*;
|
import eva2.tools.BasicResourceLoader;
|
||||||
|
import eva2.tools.EVAERROR;
|
||||||
|
import eva2.tools.ReflectPackage;
|
||||||
|
import eva2.tools.StringTools;
|
||||||
import eva2.tools.jproxy.RemoteStateListener;
|
import eva2.tools.jproxy.RemoteStateListener;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.io.*;
|
import java.io.Serializable;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -49,9 +51,10 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
* Generated serial version identifier.
|
* Generated serial version identifier.
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 8232856334379977970L;
|
private static final long serialVersionUID = 8232856334379977970L;
|
||||||
private final int splashScreenTime = 1500;
|
private final int splashScreenTime = 2500;
|
||||||
private final int maxWindowMenuLength = 30;
|
private final int maxWindowMenuLength = 30;
|
||||||
private boolean clientInited = false;
|
private boolean clientInited = false;
|
||||||
|
private JExtDesktopPaneToolBar desktopToolBar;
|
||||||
private JDesktopPane desktopPane;
|
private JDesktopPane desktopPane;
|
||||||
private JFrame mainFrame;
|
private JFrame mainFrame;
|
||||||
private JPanel configurationPane;
|
private JPanel configurationPane;
|
||||||
@ -60,10 +63,9 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
|
|
||||||
private EvAComAdapter comAdapter;
|
private EvAComAdapter comAdapter;
|
||||||
private transient JMenuBar menuBar;
|
private transient JMenuBar menuBar;
|
||||||
private transient JExtMenu menuAbout;
|
private transient JExtMenu menuHelp;
|
||||||
private transient JExtMenu menuSelHosts;
|
private transient JExtMenu menuSelHosts;
|
||||||
private transient JExtMenu menuModule;
|
private transient JExtMenu menuModule;
|
||||||
private transient JExtMenu menuWindow;
|
|
||||||
private transient JExtMenu menuOptions;
|
private transient JExtMenu menuOptions;
|
||||||
private transient JProgressBar progressBar;
|
private transient JProgressBar progressBar;
|
||||||
|
|
||||||
@ -379,18 +381,35 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
|
|
||||||
/* Set Look and Feel */
|
/* Set Look and Feel */
|
||||||
try {
|
try {
|
||||||
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LOGGER.log(Level.INFO, "Could not set Look&Feel", ex);
|
LOGGER.log(Level.INFO, "Could not set Look&Feel", ex);
|
||||||
}
|
}
|
||||||
mainFrame = new JFrame(EvAInfo.productName + " Workbench");
|
|
||||||
|
/* Create main frame with GridBagLayout */
|
||||||
|
mainFrame = new JFrame(EvAInfo.productName);
|
||||||
mainFrame.setLayout(new GridBagLayout());
|
mainFrame.setLayout(new GridBagLayout());
|
||||||
mainFrame.setMinimumSize(new Dimension(800, 600));
|
mainFrame.setMinimumSize(new Dimension(800, 600));
|
||||||
desktopPane = new JExtDesktopPane();
|
|
||||||
|
/* Creates the desktopPane for Plot/Text Output */
|
||||||
|
desktopPane = new JExtDesktopPane();
|
||||||
JEFrameRegister.getInstance().setDesktopPane(desktopPane);
|
JEFrameRegister.getInstance().setDesktopPane(desktopPane);
|
||||||
horizontalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
|
/* Creates desktopPane ToolBar to show tiling buttons */
|
||||||
|
desktopToolBar = new JExtDesktopPaneToolBar((JExtDesktopPane) desktopPane);
|
||||||
|
|
||||||
|
/* Pane to hold ToolBar + DesktopPane */
|
||||||
|
JPanel desktopPanel = new JPanel(new GridBagLayout());
|
||||||
|
GridBagConstraints desktopConst = new GridBagConstraints();
|
||||||
|
desktopConst.gridx = 0;
|
||||||
|
desktopConst.gridy = 0;
|
||||||
|
desktopConst.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
desktopConst.weightx = 1.0;
|
||||||
|
desktopPanel.add(desktopToolBar, desktopConst);
|
||||||
|
desktopConst.gridy = 1;
|
||||||
|
desktopConst.fill = GridBagConstraints.BOTH;
|
||||||
|
desktopConst.weighty = 1.0;
|
||||||
|
desktopPanel.add(desktopPane, desktopConst);
|
||||||
|
|
||||||
BasicResourceLoader loader = BasicResourceLoader.instance();
|
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||||
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
|
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
|
||||||
// TODO: use setIconImages (for better support of multiple icons when changing programs etc.)
|
// TODO: use setIconImages (for better support of multiple icons when changing programs etc.)
|
||||||
@ -428,10 +447,14 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
gbConstraints.gridheight = GridBagConstraints.RELATIVE;
|
gbConstraints.gridheight = GridBagConstraints.RELATIVE;
|
||||||
mainFrame.add(configurationPane, gbConstraints);
|
mainFrame.add(configurationPane, gbConstraints);
|
||||||
|
|
||||||
/* SplitPane for desktopPane and loggingPanel */
|
/* SplitPane for desktopPanel and loggingPanel */
|
||||||
horizontalSplit.setTopComponent(desktopPane);
|
horizontalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
|
||||||
|
horizontalSplit.setTopComponent(desktopPanel);
|
||||||
horizontalSplit.setBottomComponent(logPanel);
|
horizontalSplit.setBottomComponent(logPanel);
|
||||||
horizontalSplit.setDividerLocation(0.25);
|
horizontalSplit.setDividerLocation(0.25);
|
||||||
|
horizontalSplit.setDividerSize(8);
|
||||||
|
horizontalSplit.setOneTouchExpandable(true);
|
||||||
|
horizontalSplit.setResizeWeight(1.0);
|
||||||
horizontalSplit.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
|
horizontalSplit.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
|
||||||
horizontalSplit.setContinuousLayout(true);
|
horizontalSplit.setContinuousLayout(true);
|
||||||
/* Add horizontal split pane at 1,1 */
|
/* Add horizontal split pane at 1,1 */
|
||||||
@ -682,7 +705,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
actAbout = new ExtAction("&About...", "Product Information",
|
actAbout = new ExtAction("&About", "Product Information",
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_A, Event.CTRL_MASK)) {
|
KeyStroke.getKeyStroke(KeyEvent.VK_A, Event.CTRL_MASK)) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -691,7 +714,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
showAboutDialog();
|
showAboutDialog();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
actLicense = new ExtAction("&License...", "View License",
|
actLicense = new ExtAction("&License", "View License",
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_L, Event.CTRL_MASK)) {
|
KeyStroke.getKeyStroke(KeyEvent.VK_L, Event.CTRL_MASK)) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -774,75 +797,6 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
menuModule = new JExtMenu("&Module");
|
menuModule = new JExtMenu("&Module");
|
||||||
menuModule.add(actModuleLoad);
|
menuModule.add(actModuleLoad);
|
||||||
|
|
||||||
|
|
||||||
menuWindow = new JExtMenu("&Window");
|
|
||||||
menuWindow.addMenuListener(new MenuListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void menuSelected(final MenuEvent event) {
|
|
||||||
menuWindow.removeAll();
|
|
||||||
JExtMenu curMenu = menuWindow;
|
|
||||||
List<JEFrame> frameList = JEFrameRegister.getInstance().getFrameList();
|
|
||||||
int frameIndex = 1;
|
|
||||||
for (JEFrame frame : frameList) {
|
|
||||||
|
|
||||||
JMenuItem act = new JMenuItem(frameIndex + ". " + frame.getTitle());
|
|
||||||
final JInternalFrame selectedFrame = frame;
|
|
||||||
|
|
||||||
act.addActionListener(new ActionListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(final ActionEvent event) {
|
|
||||||
if (!selectedFrame.isFocusOwner()) {
|
|
||||||
//selectedFrame..setExtendedState(JFrame.NORMAL);
|
|
||||||
selectedFrame.setVisible(false);
|
|
||||||
// it seems to be quite a fuss to bring something to the front and actually mean it...
|
|
||||||
selectedFrame.setVisible(true);
|
|
||||||
// this seems useless
|
|
||||||
selectedFrame.toFront();
|
|
||||||
// this seems useless too
|
|
||||||
selectedFrame.requestFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (curMenu.getItemCount() >= maxWindowMenuLength) {
|
|
||||||
JExtMenu subMenu = new JExtMenu("&More...");
|
|
||||||
curMenu.add(new JSeparator());
|
|
||||||
curMenu.add(subMenu);
|
|
||||||
curMenu = subMenu;
|
|
||||||
}
|
|
||||||
curMenu.add(act);
|
|
||||||
|
|
||||||
/* Next frame index */
|
|
||||||
frameIndex++;
|
|
||||||
}
|
|
||||||
String[] commonPrefixes = JEFrameRegister.getInstance().getCommonPrefixes(10);
|
|
||||||
if (commonPrefixes.length > 0) {
|
|
||||||
menuWindow.add(new JSeparator());
|
|
||||||
}
|
|
||||||
for (int i = 0; i < commonPrefixes.length; i++) {
|
|
||||||
final String prefix = commonPrefixes[i];
|
|
||||||
JMenuItem act = new JMenuItem("Close all of " + prefix + "...");
|
|
||||||
act.addActionListener(new ActionListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(final ActionEvent event) {
|
|
||||||
JEFrameRegister.getInstance().closeAllByPrefix(prefix);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
menuWindow.add(act);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void menuCanceled(MenuEvent e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void menuDeselected(MenuEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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");
|
||||||
menuSelHosts.add(actHost);
|
menuSelHosts.add(actHost);
|
||||||
@ -851,9 +805,9 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
menuSelHosts.add(actKillHost);
|
menuSelHosts.add(actKillHost);
|
||||||
menuSelHosts.add(actKillAllHosts);
|
menuSelHosts.add(actKillAllHosts);
|
||||||
|
|
||||||
menuAbout = new JExtMenu("&About");
|
menuHelp = new JExtMenu("&Help");
|
||||||
menuAbout.add(actAbout);
|
menuHelp.add(actAbout);
|
||||||
menuAbout.add(actLicense);
|
menuHelp.add(actLicense);
|
||||||
|
|
||||||
menuOptions = new JExtMenu("&Options");
|
menuOptions = new JExtMenu("&Options");
|
||||||
menuOptions.add(menuSelHosts);
|
menuOptions.add(menuSelHosts);
|
||||||
@ -864,11 +818,8 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
menuBar.add(menuOptions);
|
menuBar.add(menuOptions);
|
||||||
menuBar.add(menuWindow);
|
|
||||||
menuBar.add(menuAbout);
|
|
||||||
|
|
||||||
menuBar.add(((JExtDesktopPane) desktopPane).getWindowMenu());
|
menuBar.add(((JExtDesktopPane) desktopPane).getWindowMenu());
|
||||||
|
menuBar.add(menuHelp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -897,9 +848,9 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
comAdapter.setRunLocally(false);
|
comAdapter.setRunLocally(false);
|
||||||
}
|
}
|
||||||
if (selectedModule == null) { // show a dialog and ask for a module
|
if (selectedModule == null) { // show a dialog and ask for a module
|
||||||
String[] ModuleNameList = comAdapter.getModuleNameList();
|
String[] moduleNameList = comAdapter.getModuleNameList();
|
||||||
if (ModuleNameList == null) {
|
if (moduleNameList == null) {
|
||||||
JOptionPane.showMessageDialog(configurationPane, "No modules available on " + comAdapter.getHostName(), EvAInfo.infoTitle, 1);
|
JOptionPane.showMessageDialog(mainFrame, "No modules available on " + comAdapter.getHostName(), EvAInfo.infoTitle, 1);
|
||||||
} else {
|
} else {
|
||||||
String lastModule = null;
|
String lastModule = null;
|
||||||
|
|
||||||
@ -911,16 +862,16 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lastModule == null) {
|
if (lastModule == null) {
|
||||||
lastModule = ModuleNameList[0];
|
lastModule = moduleNameList[0];
|
||||||
LOGGER.log(Level.INFO, "Defaulting to module: {0}", lastModule);
|
LOGGER.log(Level.INFO, "Defaulting to module: {0}", lastModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedModule = (String) JOptionPane.showInputDialog(configurationPane,
|
selectedModule = (String) JOptionPane.showInputDialog(mainFrame,
|
||||||
"Which module do you want \n to load on host: " + comAdapter.getHostName() + " ?",
|
"Which module do you want \n to load on host: " + comAdapter.getHostName() + " ?",
|
||||||
"Load optimization module on host",
|
"Load optimization module on host",
|
||||||
JOptionPane.QUESTION_MESSAGE,
|
JOptionPane.QUESTION_MESSAGE,
|
||||||
null,
|
null,
|
||||||
ModuleNameList,
|
moduleNameList,
|
||||||
lastModule);
|
lastModule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1028,13 +979,21 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
configurationPane.setVisible(false);
|
configurationPane.setVisible(false);
|
||||||
configurationPane.removeAll();
|
configurationPane.removeAll();
|
||||||
|
|
||||||
JComponent tree = null;
|
GridBagConstraints gbConstraints = new GridBagConstraints();
|
||||||
|
|
||||||
|
/* ToDo: Find a way to properly add the TreeView to the GOPanel */
|
||||||
if (withTreeView && (newModuleAdapter instanceof AbstractModuleAdapter)) {
|
if (withTreeView && (newModuleAdapter instanceof AbstractModuleAdapter)) {
|
||||||
|
JComponent tree = null;
|
||||||
tree = getEvATreeView(frameMaker.getGOPanel(), "GOParameters", ((AbstractModuleAdapter) newModuleAdapter).getGOParameters());
|
tree = getEvATreeView(frameMaker.getGOPanel(), "GOParameters", ((AbstractModuleAdapter) newModuleAdapter).getGOParameters());
|
||||||
configurationPane.add(tree, BorderLayout.LINE_START);
|
gbConstraints.gridx = 0;
|
||||||
|
gbConstraints.gridy = 0;
|
||||||
|
gbConstraints.fill = GridBagConstraints.BOTH;
|
||||||
|
gbConstraints.weightx = 1.0;
|
||||||
|
gbConstraints.weighty = 1.0;
|
||||||
|
configurationPane.add(tree, gbConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
GridBagConstraints gbConstraints = new GridBagConstraints();
|
|
||||||
gbConstraints.weightx = 1.0;
|
gbConstraints.weightx = 1.0;
|
||||||
gbConstraints.weighty = 0.0;
|
gbConstraints.weighty = 0.0;
|
||||||
gbConstraints.gridx = 0;
|
gbConstraints.gridx = 0;
|
||||||
@ -1048,7 +1007,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
gbConstraints2.gridx = 0;
|
gbConstraints2.gridx = 0;
|
||||||
gbConstraints2.gridy = 0;
|
gbConstraints2.gridy = 0;
|
||||||
gbConstraints2.fill = GridBagConstraints.VERTICAL;
|
gbConstraints2.fill = GridBagConstraints.VERTICAL;
|
||||||
gbConstraints2.gridheight = GridBagConstraints.REMAINDER;
|
//gbConstraints2.gridheight = GridBagConstraints.REMAINDER;
|
||||||
gbConstraints2.weighty = 1.0;
|
gbConstraints2.weighty = 1.0;
|
||||||
configurationPane.add(moduleContainer, gbConstraints2);
|
configurationPane.add(moduleContainer, gbConstraints2);
|
||||||
configurationPane.validate();
|
configurationPane.validate();
|
||||||
@ -1126,20 +1085,10 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showAboutDialog() {
|
private void showAboutDialog() {
|
||||||
StringBuilder aboutMessage = new StringBuilder();
|
AboutDialog aboutDialog = new AboutDialog(mainFrame);
|
||||||
aboutMessage.append(EvAInfo.productName);
|
aboutDialog.setLocationRelativeTo(mainFrame);
|
||||||
aboutMessage.append(" - ");
|
aboutDialog.setVisible(true);
|
||||||
aboutMessage.append(EvAInfo.productLongName);
|
aboutDialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
|
||||||
aboutMessage.append("\nUniversity of T\u00FCbingen, T\u00FCbingen, Germany\nChair for Cognitive Systems\n");
|
|
||||||
aboutMessage.append("Dr. M. Kronfeld, H. Planatscher, M. de Paly, Dr. A. Dr\u00E4ger,\n");
|
|
||||||
aboutMessage.append("Dr. F. Streichert, Dr. H. Ulmer and Prof. Dr. A. Zell \nCoypright \u00A9 ");
|
|
||||||
aboutMessage.append(EvAInfo.copyrightYear);
|
|
||||||
aboutMessage.append("\nVersion ");
|
|
||||||
aboutMessage.append(EvAInfo.getVersion());
|
|
||||||
aboutMessage.append("\nSee: ");
|
|
||||||
aboutMessage.append(EvAInfo.url);
|
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(configurationPane, aboutMessage, EvAInfo.infoTitle, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showLicense() {
|
private void showLicense() {
|
||||||
@ -1258,7 +1207,7 @@ final class SplashScreen extends Frame {
|
|||||||
JWindow splashWindow = new JWindow(this);
|
JWindow splashWindow = new JWindow(this);
|
||||||
BasicResourceLoader loader = BasicResourceLoader.instance();
|
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||||
byte[] bytes = loader.getBytesFromResourceLocation(imgLocation, true);
|
byte[] bytes = loader.getBytesFromResourceLocation(imgLocation, true);
|
||||||
ImageIcon ii = new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes));
|
ImageIcon ii = new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes));
|
||||||
JLabel splashLabel = new JLabel(ii);
|
JLabel splashLabel = new JLabel(ii);
|
||||||
|
|
||||||
splashWindow.add(splashLabel);
|
splashWindow.add(splashLabel);
|
||||||
|
108
src/eva2/gui/AboutDialog.java
Normal file
108
src/eva2/gui/AboutDialog.java
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package eva2.gui;
|
||||||
|
|
||||||
|
import com.sun.javaws.ui.JavawsSysRun;
|
||||||
|
import eva2.EvAInfo;
|
||||||
|
import eva2.tools.BasicResourceLoader;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.event.HyperlinkEvent;
|
||||||
|
import javax.swing.event.HyperlinkListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author becker
|
||||||
|
*/
|
||||||
|
public class AboutDialog extends JDialog {
|
||||||
|
private JLabel imageLabel;
|
||||||
|
private JEditorPane infoEditorPane;
|
||||||
|
private JTextArea aboutTextArea;
|
||||||
|
|
||||||
|
public AboutDialog(Frame parent) {
|
||||||
|
super(parent);
|
||||||
|
initComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponents() {
|
||||||
|
setTitle("About");
|
||||||
|
setLayout(new GridBagLayout());
|
||||||
|
GridBagConstraints gbConstraints = new GridBagConstraints();
|
||||||
|
|
||||||
|
setSize(new Dimension(470, 600));
|
||||||
|
setResizable(false);
|
||||||
|
|
||||||
|
/* Load EvA2 Image */
|
||||||
|
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||||
|
byte[] bytes = loader.getBytesFromResourceLocation(eva2.EvAInfo.splashLocation, true);
|
||||||
|
ImageIcon imageIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes));
|
||||||
|
|
||||||
|
/* Create a new JLabel with the image */
|
||||||
|
imageLabel = new JLabel(imageIcon);
|
||||||
|
|
||||||
|
gbConstraints.gridx = 0;
|
||||||
|
gbConstraints.gridy = 0;
|
||||||
|
gbConstraints.ipady = 10;
|
||||||
|
gbConstraints.insets = new Insets(10, 10, 0, 10);
|
||||||
|
gbConstraints.anchor = GridBagConstraints.PAGE_START;
|
||||||
|
add(imageLabel, gbConstraints);
|
||||||
|
|
||||||
|
String infoMessage = "<html><head></head><body>"
|
||||||
|
+"<p>EvA2 (an Evolutionary Algorithms framework, revised version 2) is a comprehensive heuristic optimization framework with emphasis on Evolutionary Algorithms implemented in Java™.</p>"
|
||||||
|
+"<p>For more information, please visit the <a href=\"http://www.cogsys.cs.uni-tuebingen.de/software/JavaEvA/\">EvA2 Homepage</a>.</p>"
|
||||||
|
+"</body></html>";
|
||||||
|
|
||||||
|
infoEditorPane = new JEditorPane("text/html", infoMessage);
|
||||||
|
infoEditorPane.setEditable(false);
|
||||||
|
infoEditorPane.setOpaque(false);
|
||||||
|
infoEditorPane.addHyperlinkListener(new HyperlinkListener() {
|
||||||
|
|
||||||
|
public void hyperlinkUpdate(HyperlinkEvent hle) {
|
||||||
|
if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) {
|
||||||
|
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
|
||||||
|
|
||||||
|
if (desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
|
||||||
|
//java.net.URI uri = new java.net.URI(hle.getURL().toString());
|
||||||
|
//desktop.browse(uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
gbConstraints.gridy++;
|
||||||
|
gbConstraints.anchor = GridBagConstraints.CENTER;
|
||||||
|
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
gbConstraints.weightx = 1.0;
|
||||||
|
add(infoEditorPane, gbConstraints);
|
||||||
|
|
||||||
|
aboutTextArea = new JTextArea();
|
||||||
|
aboutTextArea.setEditable(false);
|
||||||
|
aboutTextArea.setRows(8);
|
||||||
|
|
||||||
|
gbConstraints.gridy++;
|
||||||
|
gbConstraints.weighty = 1.0;
|
||||||
|
gbConstraints.fill = GridBagConstraints.BOTH;
|
||||||
|
add(new JScrollPane(aboutTextArea), gbConstraints);
|
||||||
|
|
||||||
|
JButton closeButton = new JButton("Close");
|
||||||
|
closeButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
AboutDialog.this.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
gbConstraints.gridy++;
|
||||||
|
gbConstraints.fill = GridBagConstraints.NONE;
|
||||||
|
gbConstraints.weighty = 0.0;
|
||||||
|
gbConstraints.insets = new Insets(10, 10, 10, 10);
|
||||||
|
add(closeButton, gbConstraints);
|
||||||
|
}
|
||||||
|
}
|
@ -62,7 +62,7 @@ public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceN
|
|||||||
|
|
||||||
tabbedPane = new JTabbedPane();
|
tabbedPane = new JTabbedPane();
|
||||||
tabbedPane.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
|
tabbedPane.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
|
||||||
//tabbedPane.setUI(new eva2.gui.utils.CustomTabbedPaneUI());
|
tabbedPane.setUI(new eva2.gui.utils.CustomTabbedPaneUI());
|
||||||
tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
|
tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,9 +56,9 @@ public class ExtDesktopManager extends DefaultDesktopManager {
|
|||||||
super.closeFrame(internalFrame);
|
super.closeFrame(internalFrame);
|
||||||
int index = ((Integer) internalFrame.getClientProperty(INDEX)).intValue() + WINDOW_LIST_START - 1;
|
int index = ((Integer) internalFrame.getClientProperty(INDEX)).intValue() + WINDOW_LIST_START - 1;
|
||||||
int i;
|
int i;
|
||||||
desktop.m_mnuWindow.remove(index);
|
desktop.getWindowMenu().remove(index);
|
||||||
for (i = index; i < Math.min(WINDOW_LIST_START + 9, desktop.m_mnuWindow.getItemCount()); i++) {
|
for (i = index; i < Math.min(WINDOW_LIST_START + 9, desktop.getWindowMenu().getItemCount()); i++) {
|
||||||
JMenuItem m = desktop.m_mnuWindow.getItem(i);
|
JMenuItem m = desktop.getWindowMenu().getItem(i);
|
||||||
JInternalFrame frame = (JInternalFrame) m.getClientProperty(FRAME);
|
JInternalFrame frame = (JInternalFrame) m.getClientProperty(FRAME);
|
||||||
frame.putClientProperty(INDEX, new Integer(((Integer) frame.getClientProperty(INDEX)).intValue() - 1));
|
frame.putClientProperty(INDEX, new Integer(((Integer) frame.getClientProperty(INDEX)).intValue() - 1));
|
||||||
int winIndex = i - WINDOW_LIST_START + 1;
|
int winIndex = i - WINDOW_LIST_START + 1;
|
||||||
|
@ -9,13 +9,10 @@ package eva2.gui;
|
|||||||
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
|
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
|
||||||
* $Author: streiche $
|
* $Author: streiche $
|
||||||
*/
|
*/
|
||||||
/*==========================================================================*
|
import java.io.File;
|
||||||
* IMPORTS
|
|
||||||
*==========================================================================*/
|
|
||||||
import javax.swing.JInternalFrame;
|
import javax.swing.JInternalFrame;
|
||||||
import javax.swing.JMenu;
|
import javax.swing.JMenu;
|
||||||
import javax.swing.JToolBar;
|
import javax.swing.JToolBar;
|
||||||
import java.io.File;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package eva2.gui;
|
package eva2.gui;
|
||||||
/*
|
/*
|
||||||
* Title: EvA2
|
* Title: EvA2 Description: Copyright: Copyright (c) 2003 Company: University of Tuebingen, Computer
|
||||||
* Description:
|
* Architecture @author Holger Ulmer, Felix Streichert, Hannes Planatscher @version: $Revision: 10 $
|
||||||
* Copyright: Copyright (c) 2003
|
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $ $Author: streiche $
|
||||||
* Company: University of Tuebingen, Computer Architecture
|
|
||||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
|
||||||
* @version: $Revision: 10 $
|
|
||||||
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
|
|
||||||
* $Author: streiche $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Event;
|
import java.awt.Event;
|
||||||
@ -24,14 +21,12 @@ import javax.swing.*;
|
|||||||
*/
|
*/
|
||||||
public class JExtDesktopPane extends JDesktopPane {
|
public class JExtDesktopPane extends JDesktopPane {
|
||||||
|
|
||||||
private ActionListener m_actMenuFrame;
|
private ActionListener actMenuFrame;
|
||||||
private ExtDesktopManager m_manager;
|
private ExtDesktopManager desktopManager;
|
||||||
public JExtMenu m_mnuWindow;
|
private JExtMenu windowMenu;
|
||||||
private ExtAction actWindowTileVert;
|
private ExtAction actWindowTileVert;
|
||||||
private ExtAction actWindowTileHorz;
|
private ExtAction actWindowTileHorz;
|
||||||
private ExtAction actWindowOverlap;
|
private ExtAction actWindowOverlap;
|
||||||
private ExtAction actWindowArrangeIcons;
|
|
||||||
private ExtAction actWindowList;
|
|
||||||
public final static int WINDOW_TILEVERT = 0;
|
public final static int WINDOW_TILEVERT = 0;
|
||||||
public final static int WINDOW_TILEHORZ = 1;
|
public final static int WINDOW_TILEHORZ = 1;
|
||||||
public final static int WINDOW_OVERLAP = 2;
|
public final static int WINDOW_OVERLAP = 2;
|
||||||
@ -44,76 +39,58 @@ public class JExtDesktopPane extends JDesktopPane {
|
|||||||
*/
|
*/
|
||||||
public JExtDesktopPane() {
|
public JExtDesktopPane() {
|
||||||
super();
|
super();
|
||||||
m_mnuWindow = new JExtMenu("&Windows");
|
|
||||||
m_manager = new ExtDesktopManager(this);
|
windowMenu = new JExtMenu("&Windows");
|
||||||
setDesktopManager(m_manager);
|
desktopManager = new ExtDesktopManager(this);
|
||||||
|
setDesktopManager(desktopManager);
|
||||||
|
|
||||||
m_actMenuFrame = new ActionListener() {
|
actMenuFrame = new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
@Override
|
||||||
if (!(e.getSource() instanceof JMenuItem)) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
|
if (!(event.getSource() instanceof JMenuItem)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JInternalFrame frame = (JInternalFrame) ((JMenuItem) e.getSource()).getClientProperty(ExtDesktopManager.FRAME);
|
JInternalFrame frame = (JInternalFrame) ((JMenuItem) event.getSource()).getClientProperty(ExtDesktopManager.FRAME);
|
||||||
selectFrame(frame);
|
selectFrame(frame);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
m_mnuWindow.add(actWindowTileVert = new ExtAction("&Nebeneinander", "Ordnet die Fenster nebeneinander an") {
|
windowMenu.add(actWindowTileVert = new ExtAction("Tile &Vertically", "Tiles all windows vertically") {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
@Override
|
||||||
|
public void actionPerformed(final ActionEvent event) {
|
||||||
tileWindows(SwingConstants.HORIZONTAL);
|
tileWindows(SwingConstants.HORIZONTAL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_mnuWindow.add(actWindowTileHorz = new ExtAction("&Untereinander", "Ordnet die Fenster untereinander an") {
|
windowMenu.add(actWindowTileHorz = new ExtAction("Tile &Horizontally", "Tiles all windows horizontically") {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
@Override
|
||||||
|
public void actionPerformed(final ActionEvent event) {
|
||||||
tileWindows(SwingConstants.VERTICAL);
|
tileWindows(SwingConstants.VERTICAL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_mnuWindow.add(actWindowOverlap = new ExtAction("Ü&berlappend", "Ordnet die Fenster Überlappend an") {
|
windowMenu.add(actWindowOverlap = new ExtAction("&Cascade Windows", "Cascades all visible windows") {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
@Override
|
||||||
|
public void actionPerformed(final ActionEvent event) {
|
||||||
overlapWindows();
|
overlapWindows();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_mnuWindow.add(actWindowArrangeIcons = new ExtAction("&Symbole anordnen", "Ordnet die Symbole auf dem Desktop an") {
|
windowMenu.addSeparator();
|
||||||
|
desktopManager.WINDOW_LIST_START = 4;
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
m_mnuWindow.add(actWindowList = new ExtAction("Fenster&liste...", "Zeigt eine Liste aller Fenster an", KeyStroke.getKeyStroke(KeyEvent.VK_0, Event.ALT_MASK)) {
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
Vector l = new Vector();
|
|
||||||
JInternalFrame frames[] = getAllFrames();
|
|
||||||
|
|
||||||
for (int i = 0; i < frames.length; i++) {
|
|
||||||
l.add(frames[i].getTitle());
|
|
||||||
}
|
|
||||||
|
|
||||||
JList list = new JList(l);
|
|
||||||
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
|
||||||
JScrollPane pane = new JScrollPane(list);
|
|
||||||
pane.setPreferredSize(new Dimension(pane.getPreferredSize().width, 150));
|
|
||||||
|
|
||||||
if (JOptionPane.showOptionDialog(JExtDesktopPane.this, pane, "Fenster auswählen", JOptionPane.OK_CANCEL_OPTION,
|
|
||||||
JOptionPane.PLAIN_MESSAGE, null, null, null) == JOptionPane.OK_OPTION) {
|
|
||||||
if (list.getSelectedIndex() != -1) {
|
|
||||||
selectFrame(frames[list.getSelectedIndex()]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
m_mnuWindow.addSeparator();
|
|
||||||
m_manager.WINDOW_LIST_START = 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to access the window actions.
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
|
* @param action The desired action (use JExtDesktopPane constants). Default is null
|
||||||
|
* @return The ExtAction
|
||||||
|
*/
|
||||||
public ExtAction getWindowAction(int action) {
|
public ExtAction getWindowAction(int action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case WINDOW_TILEVERT:
|
case WINDOW_TILEVERT:
|
||||||
@ -122,10 +99,6 @@ public class JExtDesktopPane extends JDesktopPane {
|
|||||||
return actWindowTileHorz;
|
return actWindowTileHorz;
|
||||||
case WINDOW_OVERLAP:
|
case WINDOW_OVERLAP:
|
||||||
return actWindowOverlap;
|
return actWindowOverlap;
|
||||||
case WINDOW_ARRANGEICONS:
|
|
||||||
return actWindowArrangeIcons;
|
|
||||||
case WINDOW_LIST:
|
|
||||||
return actWindowList;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -264,41 +237,26 @@ public class JExtDesktopPane extends JDesktopPane {
|
|||||||
public void addImpl(Component comp, Object constraints, int index) {
|
public void addImpl(Component comp, Object constraints, int index) {
|
||||||
super.addImpl(comp, constraints, index);
|
super.addImpl(comp, constraints, index);
|
||||||
//System.out.println("JExtDesktopPane.addImpl");
|
//System.out.println("JExtDesktopPane.addImpl");
|
||||||
if (comp instanceof JDocFrame) {
|
if (comp instanceof JInternalFrame) {
|
||||||
JDocFrame f = (JDocFrame) comp;
|
JInternalFrame docFrame = (JInternalFrame) comp;
|
||||||
int frameIndex = m_mnuWindow.getItemCount() - m_manager.WINDOW_LIST_START + 1;
|
int frameIndex = windowMenu.getItemCount() - desktopManager.WINDOW_LIST_START + 1;
|
||||||
if (f.getClientProperty(ExtDesktopManager.INDEX) != null) {
|
if (docFrame.getClientProperty(ExtDesktopManager.INDEX) != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
f.putClientProperty(ExtDesktopManager.INDEX, new Integer(frameIndex));
|
docFrame.putClientProperty(ExtDesktopManager.INDEX, new Integer(frameIndex));
|
||||||
JMenuItem m = new JMenuItem((frameIndex < 10 ? frameIndex + " " : "") + f.getTitle());
|
JMenuItem m = new JMenuItem((frameIndex < 10 ? frameIndex + " " : "") + docFrame.getTitle());
|
||||||
if (frameIndex < 10) {
|
if (frameIndex < 10) {
|
||||||
m.setMnemonic((char) (0x30 + frameIndex));
|
m.setMnemonic((char) (0x30 + frameIndex));
|
||||||
m.setAccelerator(KeyStroke.getKeyStroke(0x30 + frameIndex, Event.ALT_MASK));
|
m.setAccelerator(KeyStroke.getKeyStroke(0x30 + frameIndex, Event.ALT_MASK));
|
||||||
}
|
}
|
||||||
m.setToolTipText("Shows the window " + f.getTitle() + " an");
|
m.setToolTipText("Shows the window " + docFrame.getTitle());
|
||||||
m.putClientProperty(ExtDesktopManager.FRAME, f);
|
m.putClientProperty(ExtDesktopManager.FRAME, docFrame);
|
||||||
m.addActionListener(m_actMenuFrame);
|
m.addActionListener(actMenuFrame);
|
||||||
m_mnuWindow.add(m);
|
windowMenu.add(m);
|
||||||
}
|
}
|
||||||
// if(comp instanceof Plot){
|
|
||||||
// Plot f = (Plot)comp;
|
|
||||||
// int frameIndex = m_mnuWindow.getItemCount() - m_manager.WINDOW_LIST_START + 1;
|
|
||||||
// if(f.getClientProperty(ExtDesktopManager.INDEX) != null) return;
|
|
||||||
// f.putClientProperty(ExtDesktopManager.INDEX, new Integer(frameIndex));
|
|
||||||
// JMenuItem m = new JMenuItem((frameIndex < 10 ? frameIndex + " " : "") + f.getTitle());
|
|
||||||
// if(frameIndex < 10){
|
|
||||||
// m.setMnemonic((char)(0x30 + frameIndex));
|
|
||||||
// m.setAccelerator(KeyStroke.getKeyStroke(0x30 + frameIndex, Event.ALT_MASK));
|
|
||||||
// }
|
|
||||||
// m.setToolTipText("Shows the window " + f.getTitle() + " an");
|
|
||||||
// m.putClientProperty(ExtDesktopManager.FRAME, f);
|
|
||||||
// m.addActionListener(m_actMenuFrame);
|
|
||||||
// m_mnuWindow.add(m);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JMenu getWindowMenu() {
|
public JMenu getWindowMenu() {
|
||||||
return m_mnuWindow;
|
return windowMenu;
|
||||||
}
|
}
|
||||||
}
|
}
|
63
src/eva2/gui/JExtDesktopPaneToolBar.java
Normal file
63
src/eva2/gui/JExtDesktopPaneToolBar.java
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package eva2.gui;
|
||||||
|
|
||||||
|
import javax.swing.JToolBar;
|
||||||
|
import eva2.tools.ToolBoxGui;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JDesktopPane;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author becker
|
||||||
|
*/
|
||||||
|
public class JExtDesktopPaneToolBar extends JToolBar {
|
||||||
|
|
||||||
|
private JExtDesktopPane desktopPane;
|
||||||
|
|
||||||
|
public JExtDesktopPaneToolBar(JExtDesktopPane desktopPane) {
|
||||||
|
this.desktopPane = desktopPane;
|
||||||
|
|
||||||
|
initComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponents() {
|
||||||
|
/* We don't want the ToolBar to be draggable */
|
||||||
|
setFloatable(false);
|
||||||
|
|
||||||
|
/* Add Buttons to tile the desktopPane */
|
||||||
|
JButton verticalButton = ToolBoxGui.createIconifiedButton("resources/images/TileVertical16.png", "Tile vertically", false);
|
||||||
|
verticalButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
desktopPane.tileWindows(SwingConstants.VERTICAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
add(verticalButton);
|
||||||
|
|
||||||
|
JButton horizontalButton = ToolBoxGui.createIconifiedButton("resources/images/TileHorizontal16.png", "Tile horizontally", false);
|
||||||
|
horizontalButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
desktopPane.tileWindows(SwingConstants.HORIZONTAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
add(horizontalButton);
|
||||||
|
|
||||||
|
JButton cascadeButton = ToolBoxGui.createIconifiedButton("resources/images/Cascade16.png", "Cascade windows", false);
|
||||||
|
cascadeButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
desktopPane.overlapWindows();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
add(cascadeButton);
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,10 @@
|
|||||||
package eva2.gui;
|
package eva2.gui;
|
||||||
/*
|
/*
|
||||||
* Title: EvA2
|
* Title: EvA2 Description: Copyright: Copyright (c) 2003 Company: University of Tuebingen, Computer
|
||||||
* Description:
|
* Architecture @author Holger Ulmer, Felix Streichert, Hannes Planatscher @version: $Revision: 255
|
||||||
* Copyright: Copyright (c) 2003
|
* $ $Date: 2007-11-15 14:58:12 +0100 (Thu, 15 Nov 2007) $ $Author: mkron $
|
||||||
* Company: University of Tuebingen, Computer Architecture
|
|
||||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
|
||||||
* @version: $Revision: 255 $
|
|
||||||
* $Date: 2007-11-15 14:58:12 +0100 (Thu, 15 Nov 2007) $
|
|
||||||
* $Author: mkron $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import eva2.EvAInfo;
|
import eva2.EvAInfo;
|
||||||
import eva2.server.go.tools.FileTools;
|
import eva2.server.go.tools.FileTools;
|
||||||
import eva2.tools.BasicResourceLoader;
|
import eva2.tools.BasicResourceLoader;
|
||||||
@ -26,156 +22,153 @@ import javax.swing.event.InternalFrameEvent;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListener, Serializable {
|
public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListener, Serializable {
|
||||||
|
|
||||||
private JMenuItem clearItem, saveItem;
|
private JMenuItem clearItem, saveItem;
|
||||||
public static boolean TRACE = false;
|
|
||||||
protected String frameTitle = "undefined";
|
protected String frameTitle = "undefined";
|
||||||
private transient JTextArea textArea = null;
|
private transient JTextArea textArea = null;
|
||||||
private final JInternalFrame frame;
|
private final JInternalFrame frame;
|
||||||
private JPopupMenu popup;
|
private JPopupMenu popup;
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public JTextoutputFrame(String title) {
|
|
||||||
if (TRACE) System.out.println("JTextoutputFrame Constructor");
|
|
||||||
frameTitle = title;
|
|
||||||
frame = new JEFrame(frameTitle);
|
|
||||||
textArea = null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void print(String text) {
|
|
||||||
//System.out.println("Print:"+Text);
|
|
||||||
if (textArea == null) {
|
|
||||||
createFrame();
|
|
||||||
}
|
|
||||||
textArea.append(text);
|
|
||||||
textArea.repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void println(String txt) {
|
/**
|
||||||
print(txt+'\n');
|
*
|
||||||
}
|
*/
|
||||||
|
public JTextoutputFrame(String title) {
|
||||||
|
frameTitle = title;
|
||||||
|
frame = new JEFrame(frameTitle);
|
||||||
|
textArea = null;
|
||||||
|
}
|
||||||
|
|
||||||
public void setShow(boolean bShow) {
|
/**
|
||||||
if (frame.isVisible() != bShow) {
|
*
|
||||||
if (frame.isVisible()) {
|
*/
|
||||||
frame.dispose();
|
public void print(String text) {
|
||||||
textArea.setText(null);
|
if (textArea == null) {
|
||||||
} else {
|
createFrame();
|
||||||
if (textArea == null) createFrame();
|
}
|
||||||
else frame.setVisible(true);
|
textArea.append(text);
|
||||||
frame.setEnabled(true);
|
textArea.repaint();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void println(String txt) {
|
||||||
*
|
print(txt + '\n');
|
||||||
*/
|
}
|
||||||
private void createFrame() {
|
|
||||||
if (TRACE) System.out.println("JTextoutputFrame createFrame");
|
|
||||||
textArea = new JTextArea(10,80);
|
|
||||||
textArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
|
||||||
textArea.setLineWrap(true);
|
|
||||||
textArea.setWrapStyleWord(true);
|
|
||||||
textArea.setEditable(false);
|
|
||||||
textArea.setCaretPosition(0);
|
|
||||||
|
|
||||||
BasicResourceLoader loader = BasicResourceLoader.instance();
|
public void setShow(boolean bShow) {
|
||||||
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
|
if (frame.isVisible() != bShow) {
|
||||||
//frame.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
|
if (frame.isVisible()) {
|
||||||
|
frame.dispose();
|
||||||
frame.addInternalFrameListener(new InternalFrameAdapter() {
|
textArea.setText(null);
|
||||||
|
} else {
|
||||||
|
if (textArea == null) {
|
||||||
|
createFrame();
|
||||||
|
} else {
|
||||||
|
frame.setVisible(true);
|
||||||
|
}
|
||||||
|
frame.setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void createFrame() {
|
||||||
|
textArea = new JTextArea(10, 80);
|
||||||
|
textArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||||
|
textArea.setLineWrap(true);
|
||||||
|
textArea.setWrapStyleWord(true);
|
||||||
|
textArea.setEditable(false);
|
||||||
|
textArea.setCaretPosition(0);
|
||||||
|
|
||||||
|
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||||
|
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
|
||||||
|
|
||||||
|
frame.addInternalFrameListener(new InternalFrameAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void internalFrameClosing(InternalFrameEvent e) {
|
public void internalFrameClosing(final InternalFrameEvent event) {
|
||||||
super.internalFrameClosing(e);
|
super.internalFrameClosing(event);
|
||||||
frame.dispose();
|
frame.dispose();
|
||||||
frame.setEnabled(false);
|
frame.setEnabled(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
frame.getContentPane().setLayout(new BorderLayout());
|
frame.getContentPane().setLayout(new BorderLayout());
|
||||||
//frame.getContentPane().add(new JScrollPane(m_TextArea), BorderLayout.CENTER);
|
final JScrollPane scrollpane = new JScrollPane(textArea);
|
||||||
final JScrollPane scrollpane = new JScrollPane(textArea);
|
frame.getContentPane().add(scrollpane, BorderLayout.CENTER);
|
||||||
frame.getContentPane().add(scrollpane, BorderLayout.CENTER);
|
scrollpane.getViewport().addChangeListener(new ChangeListener() {
|
||||||
scrollpane.getViewport().addChangeListener(new ChangeListener() {
|
|
||||||
private int lastHeight;
|
|
||||||
//
|
|
||||||
public void stateChanged(ChangeEvent e) {
|
|
||||||
JViewport viewport = (JViewport)e.getSource();
|
|
||||||
int Height = viewport.getViewSize().height;
|
|
||||||
if (Height != lastHeight) {
|
|
||||||
lastHeight = Height;
|
|
||||||
int x = Height - viewport.getExtentSize().height;
|
|
||||||
viewport.setViewPosition(new Point(0, x));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
makePopupMenu();
|
|
||||||
frame.pack();
|
|
||||||
frame.setSize(800, 400);
|
|
||||||
frame.setVisible(true);
|
|
||||||
// frame.setState(Frame.ICONIFIED);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private int lastHeight;
|
||||||
|
//
|
||||||
|
|
||||||
void makePopupMenu() {
|
public void stateChanged(ChangeEvent e) {
|
||||||
//Create the popup menu.
|
JViewport viewport = (JViewport) e.getSource();
|
||||||
popup = new JPopupMenu();
|
int Height = viewport.getViewSize().height;
|
||||||
clearItem = new JMenuItem("Clear");
|
if (Height != lastHeight) {
|
||||||
clearItem.addActionListener(this);
|
lastHeight = Height;
|
||||||
popup.add(clearItem);
|
int x = Height - viewport.getExtentSize().height;
|
||||||
saveItem = new JMenuItem("Save as...");
|
viewport.setViewPosition(new Point(0, x));
|
||||||
saveItem.addActionListener(this);
|
}
|
||||||
popup.add(saveItem);
|
}
|
||||||
// menuItem = new JMenuItem("Refine Multiruns");
|
});
|
||||||
// menuItem.addActionListener(this);
|
makePopupMenu();
|
||||||
// popup.add(menuItem);
|
frame.pack();
|
||||||
|
frame.setSize(800, 400);
|
||||||
|
frame.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
//Add listener to components that can bring up popup menus.
|
void makePopupMenu() {
|
||||||
MouseListener popupListener = new PopupListener(popup);
|
//Create the popup menu.
|
||||||
// frame.addMouseListener(popupListener);
|
popup = new JPopupMenu();
|
||||||
textArea.addMouseListener(popupListener);
|
clearItem = new JMenuItem("Clear");
|
||||||
// menuBar.addMouseListener(popupListener);
|
clearItem.addActionListener(this);
|
||||||
|
popup.add(clearItem);
|
||||||
|
saveItem = new JMenuItem("Save as...");
|
||||||
|
saveItem.addActionListener(this);
|
||||||
|
popup.add(saveItem);
|
||||||
|
|
||||||
|
//Add listener to components that can bring up popup menus.
|
||||||
|
MouseListener popupListener = new PopupListener(popup);
|
||||||
|
textArea.addMouseListener(popupListener);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
JMenuItem src = (JMenuItem) e.getSource();
|
||||||
public void actionPerformed(ActionEvent e) {
|
if (src == clearItem) {
|
||||||
JMenuItem src = (JMenuItem)e.getSource();
|
textArea.setText(null);
|
||||||
if (src == clearItem) {
|
} else if (src == saveItem) {
|
||||||
textArea.setText(null);
|
FileTools.saveObjectWithFileChooser(frame, textArea.getText());
|
||||||
} else if (src == saveItem) {
|
|
||||||
FileTools.saveObjectWithFileChooser(frame, textArea.getText());
|
|
||||||
// File outfile = FileTools.writeString("TextOutput.txt", m_TextArea.getText());
|
// File outfile = FileTools.writeString("TextOutput.txt", m_TextArea.getText());
|
||||||
} else System.err.println("Unknown popup component (JTextoutputFrame)!");
|
} else {
|
||||||
}
|
System.err.println("Unknown popup component (JTextoutputFrame)!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A popup listener opening a popup menu on right clicks.
|
* A popup listener opening a popup menu on right clicks.
|
||||||
*
|
*
|
||||||
* @author mkron
|
* @author mkron
|
||||||
*/
|
*/
|
||||||
class PopupListener extends MouseAdapter {
|
class PopupListener extends MouseAdapter {
|
||||||
JPopupMenu popup;
|
|
||||||
|
|
||||||
public PopupListener(JPopupMenu pm) {
|
JPopupMenu popup;
|
||||||
popup = pm;
|
|
||||||
}
|
|
||||||
public void mousePressed(MouseEvent e) {
|
|
||||||
maybeShowPopup(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void mouseReleased(MouseEvent e) {
|
public PopupListener(JPopupMenu pm) {
|
||||||
maybeShowPopup(e);
|
popup = pm;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void maybeShowPopup(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
if (e.isPopupTrigger()) {
|
maybeShowPopup(e);
|
||||||
popup.show(e.getComponent(),
|
}
|
||||||
e.getX(), e.getY());
|
|
||||||
}
|
public void mouseReleased(MouseEvent e) {
|
||||||
}
|
maybeShowPopup(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void maybeShowPopup(MouseEvent e) {
|
||||||
|
if (e.isPopupTrigger()) {
|
||||||
|
popup.show(e.getComponent(),
|
||||||
|
e.getX(), e.getY());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -12,15 +12,12 @@ import eva2.server.stat.InterfaceTextListener;
|
|||||||
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
|
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
|
||||||
* $Author: streiche $
|
* $Author: streiche $
|
||||||
*/
|
*/
|
||||||
/*==========================================================================*
|
|
||||||
* IMPORTS
|
|
||||||
*==========================================================================*/
|
|
||||||
/*==========================================================================*
|
|
||||||
* INTERFACE DECLARATION
|
|
||||||
*==========================================================================*/
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface JTextoutputFrameInterface extends InterfaceTextListener {
|
public interface JTextoutputFrameInterface extends InterfaceTextListener {
|
||||||
public void setShow(boolean bShow);
|
|
||||||
|
/**
|
||||||
|
* Set the show property to define whether the Output Frame should be shown.
|
||||||
|
*
|
||||||
|
* @param bShow Whether the frame should be shown or not
|
||||||
|
*/
|
||||||
|
void setShow(boolean bShow);
|
||||||
}
|
}
|
@ -9,9 +9,6 @@ package eva2.gui;
|
|||||||
* $Date: 2006-12-18 16:32:23 +0100 (Mon, 18 Dec 2006) $
|
* $Date: 2006-12-18 16:32:23 +0100 (Mon, 18 Dec 2006) $
|
||||||
* $Author: marcekro $
|
* $Author: marcekro $
|
||||||
*/
|
*/
|
||||||
/*==========================================================================*
|
|
||||||
* IMPORTS
|
|
||||||
*==========================================================================*/
|
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
@ -26,9 +23,6 @@ import eva2.EvAInfo;
|
|||||||
import eva2.tools.BasicResourceLoader;
|
import eva2.tools.BasicResourceLoader;
|
||||||
import eva2.tools.SelectedTag;
|
import eva2.tools.SelectedTag;
|
||||||
import eva2.tools.Tag;
|
import eva2.tools.Tag;
|
||||||
/*==========================================================================*
|
|
||||||
* CLASS DECLARATION
|
|
||||||
*==========================================================================*/
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -64,8 +64,11 @@ public class ToolBoxGui {
|
|||||||
bytes = BasicResourceLoader.instance().getBytesFromResourceLocation(iconSrc, false);
|
bytes = BasicResourceLoader.instance().getBytesFromResourceLocation(iconSrc, false);
|
||||||
if (bytes == null) {
|
if (bytes == null) {
|
||||||
newButton = new JButton(title);
|
newButton = new JButton(title);
|
||||||
} else {
|
} else if (withTitle) {
|
||||||
newButton = new JButton(title, new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
newButton = new JButton(title, new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
||||||
|
} else {
|
||||||
|
newButton = new JButton(new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
||||||
|
newButton.setToolTipText(title);
|
||||||
}
|
}
|
||||||
return newButton;
|
return newButton;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user