From 625537158f06cb040e910e12a935de95ceed4bf6 Mon Sep 17 00:00:00 2001 From: Fredrik Osterlind Date: Tue, 19 Nov 2013 10:17:00 +0100 Subject: [PATCH] renamed main Java class of Cooja from GUI to Cooja. se.sics.cooja.GUI -> se.sics.cooja.Cooja this commit does not contain any functional changes, but may require external scripts to be updated such as Makefiles. --- tools/cooja/apps/avrora/cooja.config | 4 +- .../cooja/avrmote/MicaZCompileDialog.java | 4 +- .../se/sics/cooja/avrmote/MicaZMoteType.java | 6 +- tools/cooja/apps/collect-view/cooja.config | 4 +- .../plugins/collectview/CollectView.java | 20 +-- tools/cooja/apps/mrm/cooja.config | 4 +- .../apps/mrm/java/se/sics/mrm/AreaViewer.java | 20 +-- .../mrm/java/se/sics/mrm/FormulaViewer.java | 4 +- tools/cooja/apps/mspsim/cooja.config | 6 +- .../cooja/mspsim/CC430MoteType.java | 8 +- .../cooja/mspmote/AbstractMspMoteType.java | 8 +- .../se/sics/cooja/mspmote/ESBMoteType.java | 16 +- .../sics/cooja/mspmote/Exp5438MoteType.java | 8 +- .../sics/cooja/mspmote/MspCompileDialog.java | 4 +- .../src/se/sics/cooja/mspmote/MspMote.java | 4 +- .../se/sics/cooja/mspmote/MspMoteType.java | 8 +- .../se/sics/cooja/mspmote/SkyMoteType.java | 16 +- .../sics/cooja/mspmote/TyndallMoteType.java | 8 +- .../interfaces/SkyCoffeeFilesystem.java | 10 +- .../cooja/mspmote/interfaces/SkyFlash.java | 10 +- .../cooja/mspmote/plugins/BreakpointsUI.java | 6 +- .../se/sics/cooja/mspmote/plugins/MspCLI.java | 4 +- .../cooja/mspmote/plugins/MspCodeWatcher.java | 16 +- .../mspmote/plugins/MspCycleWatcher.java | 4 +- .../mspmote/plugins/MspStackWatcher.java | 8 +- tools/cooja/apps/native_gateway/cooja.config | 4 +- .../sics/cooja/plugins/NativeIPGateway.java | 4 +- tools/cooja/apps/powertracker/cooja.config | 4 +- .../apps/powertracker/java/PowerTracker.java | 6 +- tools/cooja/apps/serial_socket/cooja.config | 4 +- .../java/SerialSocketClient.java | 10 +- .../java/SerialSocketServer.java | 12 +- tools/cooja/build.xml | 16 +- tools/cooja/config/cooja_applet.config | 8 +- tools/cooja/config/cooja_default.config | 8 +- .../examples/project_new_plugin/cooja.config | 2 +- .../java/MyDummyPlugin.java | 4 +- .../project_new_radiomedium/cooja.config | 2 +- .../java/DummyRadioMedium.java | 2 +- .../java/se/sics/cooja/COOJAProject.java | 14 +- .../se/sics/cooja/{GUI.java => Cooja.java} | 164 +++++++++--------- .../cooja/java/se/sics/cooja/CoojaApplet.java | 2 +- tools/cooja/java/se/sics/cooja/CoreComm.java | 8 +- .../java/se/sics/cooja/ProjectConfig.java | 8 +- .../java/se/sics/cooja/SimEventCentral.java | 2 +- .../cooja/java/se/sics/cooja/Simulation.java | 16 +- .../se/sics/cooja/SupportedArguments.java | 2 +- tools/cooja/java/se/sics/cooja/VisPlugin.java | 6 +- .../cooja/contikimote/ContikiMoteType.java | 48 ++--- .../cooja/dialogs/AbstractCompileDialog.java | 12 +- .../se/sics/cooja/dialogs/AddMoteDialog.java | 6 +- .../se/sics/cooja/dialogs/BufferSettings.java | 6 +- .../se/sics/cooja/dialogs/CompileContiki.java | 22 +-- .../cooja/dialogs/ConfigurationWizard.java | 26 +-- .../dialogs/ContikiMoteCompileDialog.java | 6 +- .../sics/cooja/dialogs/CreateSimDialog.java | 10 +- .../cooja/dialogs/ExternalToolsDialog.java | 24 +-- .../cooja/dialogs/ImportAppMoteDialog.java | 6 +- .../se/sics/cooja/dialogs/MessageList.java | 4 +- .../dialogs/ProjectDirectoriesDialog.java | 18 +- .../cooja/interfaces/Mote2MoteRelations.java | 4 +- .../motes/AbstractApplicationMoteType.java | 4 +- .../se/sics/cooja/plugins/BufferListener.java | 48 ++--- .../sics/cooja/plugins/DGRMConfigurator.java | 16 +- .../se/sics/cooja/plugins/EventListener.java | 12 +- .../se/sics/cooja/plugins/LogListener.java | 18 +- .../sics/cooja/plugins/LogScriptEngine.java | 14 +- .../sics/cooja/plugins/MoteInformation.java | 4 +- .../cooja/plugins/MoteInterfaceViewer.java | 12 +- .../cooja/plugins/MoteTypeInformation.java | 6 +- .../java/se/sics/cooja/plugins/Notes.java | 4 +- .../se/sics/cooja/plugins/RadioLogger.java | 10 +- .../se/sics/cooja/plugins/ScriptRunner.java | 34 ++-- .../se/sics/cooja/plugins/SimControl.java | 4 +- .../se/sics/cooja/plugins/SimInformation.java | 4 +- .../java/se/sics/cooja/plugins/TimeLine.java | 22 +-- .../sics/cooja/plugins/VariableWatcher.java | 4 +- .../se/sics/cooja/plugins/Visualizer.java | 20 +-- .../cooja/positioners/ManualPositioner.java | 4 +- .../java/se/sics/cooja/util/ExecuteJAR.java | 48 ++--- 80 files changed, 499 insertions(+), 499 deletions(-) rename tools/cooja/java/se/sics/cooja/{GUI.java => Cooja.java} (96%) diff --git a/tools/cooja/apps/avrora/cooja.config b/tools/cooja/apps/avrora/cooja.config index a426fa3d9..4c1b1de70 100644 --- a/tools/cooja/apps/avrora/cooja.config +++ b/tools/cooja/apps/avrora/cooja.config @@ -1,2 +1,2 @@ -se.sics.cooja.GUI.MOTETYPES = + se.sics.cooja.avrmote.MicaZMoteType -se.sics.cooja.GUI.JARFILES = + cooja_avrora.jar avrora-small.jar +se.sics.cooja.Cooja.MOTETYPES = + se.sics.cooja.avrmote.MicaZMoteType +se.sics.cooja.Cooja.JARFILES = + cooja_avrora.jar avrora-small.jar diff --git a/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZCompileDialog.java b/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZCompileDialog.java index 21a91127f..ce2bb222f 100644 --- a/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZCompileDialog.java +++ b/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZCompileDialog.java @@ -34,7 +34,7 @@ import java.io.File; import org.apache.log4j.Logger; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; import se.sics.cooja.Simulation; @@ -82,7 +82,7 @@ public class MicaZCompileDialog extends AbstractCompileDialog { /* TODO Split into String[] */ return /*"make clean TARGET=micaz\n" + */ - GUI.getExternalToolsSetting("PATH_MAKE") + " " + getExpectedFirmwareFile(source).getName() + " TARGET=micaz"; + Cooja.getExternalToolsSetting("PATH_MAKE") + " " + getExpectedFirmwareFile(source).getName() + " TARGET=micaz"; } public File getExpectedFirmwareFile(File source) { diff --git a/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZMoteType.java b/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZMoteType.java index 5b885e1ea..b82f4bf5b 100644 --- a/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZMoteType.java +++ b/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZMoteType.java @@ -50,7 +50,7 @@ import org.jdom.Element; import se.sics.cooja.AbstractionLevelDescription; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; @@ -199,7 +199,7 @@ public class MicaZMoteType implements MoteType { panel.add(smallPane); /* Icon (if available) */ - if (!GUI.isVisualizedInApplet()) { + if (!Cooja.isVisualizedInApplet()) { Icon moteTypeIcon = getMoteTypeIcon(); if (moteTypeIcon != null) { smallPane = new JPanel(new BorderLayout()); @@ -315,7 +315,7 @@ public class MicaZMoteType implements MoteType { throw new MoteTypeCreationException("Either source or firmware not specified"); } - return configureAndInit(GUI.getTopParentContainer(), simulation, visAvailable); + return configureAndInit(Cooja.getTopParentContainer(), simulation, visAvailable); } public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable) diff --git a/tools/cooja/apps/collect-view/cooja.config b/tools/cooja/apps/collect-view/cooja.config index 4e423538b..f49148522 100644 --- a/tools/cooja/apps/collect-view/cooja.config +++ b/tools/cooja/apps/collect-view/cooja.config @@ -1,2 +1,2 @@ -se.sics.cooja.GUI.PLUGINS = + se.sics.cooja.plugins.collectview.CollectView -se.sics.cooja.GUI.JARFILES = + cooja-collect-view.jar +se.sics.cooja.Cooja.PLUGINS = + se.sics.cooja.plugins.collectview.CollectView +se.sics.cooja.Cooja.JARFILES = + cooja-collect-view.jar diff --git a/tools/cooja/apps/collect-view/java/se/sics/cooja/plugins/collectview/CollectView.java b/tools/cooja/apps/collect-view/java/se/sics/cooja/plugins/collectview/CollectView.java index d9fe01b0f..f94006d6a 100644 --- a/tools/cooja/apps/collect-view/java/se/sics/cooja/plugins/collectview/CollectView.java +++ b/tools/cooja/apps/collect-view/java/se/sics/cooja/plugins/collectview/CollectView.java @@ -49,7 +49,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.HasQuickHelp; import se.sics.cooja.Mote; import se.sics.cooja.MotePlugin; @@ -81,7 +81,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp { private DataOutputStream out; private boolean isRunning; - public CollectView(Mote mote, Simulation simulation, final GUI gui) { + public CollectView(Mote mote, Simulation simulation, final Cooja gui) { super("Collect View (" + mote + ")", gui, false); this.mote = mote; @@ -92,7 +92,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp { } /* GUI components */ - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { inLabel = new JLabel(" 0 bytes", JLabel.RIGHT); outLabel = new JLabel(" 0 bytes", JLabel.RIGHT); @@ -114,12 +114,12 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp { pack(); } - String contikiPath = GUI.getExternalToolsSetting("PATH_CONTIKI", "../../.."); + String contikiPath = Cooja.getExternalToolsSetting("PATH_CONTIKI", "../../.."); String jarFile = contikiPath + "/tools/collect-view/dist/collect-view.jar"; if (!new File(jarFile).canRead()) { logger.fatal("Could not find the CollectView application:" + jarFile); - if (GUI.isVisualized()) { - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + if (Cooja.isVisualized()) { + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "Could not find the CollectView application:\n" + jarFile + "\n\nPlease try to recompile it!", "CollectView application not found", JOptionPane.ERROR_MESSAGE); @@ -154,7 +154,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp { } serialPort.writeByte((byte) '\n'); inBytes += line.length() + 1; - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { inLabel.setText(inBytes + " bytes"); } } @@ -205,7 +205,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp { outBytes++; if (b == '\n') { out.flush(); - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { outLabel.setText(outBytes + " bytes"); } } @@ -235,7 +235,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp { if (isRunning) { logger.fatal("The CollectView application died!"); - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { JOptionPane.showMessageDialog(this, "The CollectView application died!", "CollectView died!", JOptionPane.ERROR_MESSAGE); } @@ -253,7 +253,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp { } } - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { EventQueue.invokeLater(new Runnable() { public void run() { setTitle(getTitle() + " *DISCONNECTED*"); diff --git a/tools/cooja/apps/mrm/cooja.config b/tools/cooja/apps/mrm/cooja.config index 90efbb4f0..c651edba8 100644 --- a/tools/cooja/apps/mrm/cooja.config +++ b/tools/cooja/apps/mrm/cooja.config @@ -1,2 +1,2 @@ -se.sics.cooja.GUI.RADIOMEDIUMS = + se.sics.mrm.MRM -se.sics.cooja.GUI.JARFILES = + mrm.jar +se.sics.cooja.Cooja.RADIOMEDIUMS = + se.sics.mrm.MRM +se.sics.cooja.Cooja.JARFILES = + mrm.jar diff --git a/tools/cooja/apps/mrm/java/se/sics/mrm/AreaViewer.java b/tools/cooja/apps/mrm/java/se/sics/mrm/AreaViewer.java index 0d4d24257..aad1bc90b 100644 --- a/tools/cooja/apps/mrm/java/se/sics/mrm/AreaViewer.java +++ b/tools/cooja/apps/mrm/java/se/sics/mrm/AreaViewer.java @@ -98,7 +98,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.PluginType; import se.sics.cooja.Simulation; import se.sics.cooja.SupportedArguments; @@ -220,7 +220,7 @@ public class AreaViewer extends VisPlugin { * * @param simulationToVisualize Simulation using MRM */ - public AreaViewer(Simulation simulationToVisualize, GUI gui) { + public AreaViewer(Simulation simulationToVisualize, Cooja gui) { super("MRM Radio environment", gui); currentSimulation = simulationToVisualize; @@ -358,7 +358,7 @@ public class AreaViewer extends VisPlugin { JRadioButton customButton = new JRadioButton("From bitmap"); customButton.setActionCommand("set custom bitmap"); customButton.addActionListener(obstacleHandler); - if (GUI.isVisualizedInApplet()) { + if (Cooja.isVisualizedInApplet()) { customButton.setEnabled(false); } @@ -1147,7 +1147,7 @@ public class AreaViewer extends VisPlugin { } /* Set virtual size of image */ - Container topParent = GUI.getTopParentContainer(); + Container topParent = Cooja.getTopParentContainer(); ImageSettingsDialog dialog; if (topParent instanceof Frame) { dialog = new ImageSettingsDialog(file, image, (Frame) topParent); @@ -1185,18 +1185,18 @@ public class AreaViewer extends VisPlugin { /* Show obstacle finder dialog */ ObstacleFinderDialog obstacleFinderDialog; - Container parentContainer = GUI.getTopParentContainer(); + Container parentContainer = Cooja.getTopParentContainer(); if (parentContainer instanceof Window) { obstacleFinderDialog = new ObstacleFinderDialog( - backgroundImage, currentChannelModel, (Window) GUI.getTopParentContainer() + backgroundImage, currentChannelModel, (Window) Cooja.getTopParentContainer() ); } else if (parentContainer instanceof Frame) { obstacleFinderDialog = new ObstacleFinderDialog( - backgroundImage, currentChannelModel, (Frame) GUI.getTopParentContainer() + backgroundImage, currentChannelModel, (Frame) Cooja.getTopParentContainer() ); } else if (parentContainer instanceof Dialog) { obstacleFinderDialog = new ObstacleFinderDialog( - backgroundImage, currentChannelModel, (Dialog) GUI.getTopParentContainer() + backgroundImage, currentChannelModel, (Dialog) Cooja.getTopParentContainer() ); } else { logger.fatal("Unknown parent container"); @@ -1213,7 +1213,7 @@ public class AreaViewer extends VisPlugin { // Create progress monitor final ProgressMonitor pm = new ProgressMonitor( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "Registering obstacles", null, 0, @@ -1774,7 +1774,7 @@ public class AreaViewer extends VisPlugin { // Create progress monitor final ProgressMonitor pm = new ProgressMonitor( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "Calculating channel attenuation", null, 0, diff --git a/tools/cooja/apps/mrm/java/se/sics/mrm/FormulaViewer.java b/tools/cooja/apps/mrm/java/se/sics/mrm/FormulaViewer.java index d3d18abd5..2690e9350 100644 --- a/tools/cooja/apps/mrm/java/se/sics/mrm/FormulaViewer.java +++ b/tools/cooja/apps/mrm/java/se/sics/mrm/FormulaViewer.java @@ -58,7 +58,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.PluginType; import se.sics.cooja.Simulation; import se.sics.cooja.SupportedArguments; @@ -99,7 +99,7 @@ public class FormulaViewer extends se.sics.cooja.VisPlugin { * * @param simulationToVisualize Simulation which holds the MRM channel model. */ - public FormulaViewer(Simulation simulationToVisualize, GUI gui) { + public FormulaViewer(Simulation simulationToVisualize, Cooja gui) { super("MRM Settings", gui); simulation = simulationToVisualize; diff --git a/tools/cooja/apps/mspsim/cooja.config b/tools/cooja/apps/mspsim/cooja.config index 875dd1236..4bef66cde 100644 --- a/tools/cooja/apps/mspsim/cooja.config +++ b/tools/cooja/apps/mspsim/cooja.config @@ -1,3 +1,3 @@ -se.sics.cooja.GUI.MOTETYPES = + se.sics.cooja.mspmote.ESBMoteType se.sics.cooja.mspmote.SkyMoteType se.sics.cooja.mspmote.Z1MoteType se.sics.cooja.mspmote.WismoteMoteType se.sics.cooja.mspmote.Exp5438MoteType se.sics.cooja.mspmote.SkyMoteType com.thingsquare.cooja.mspsim.CC430MoteType com.thingsquare.cooja.mspsim.Exp1120MoteType com.thingsquare.cooja.mspsim.Exp1101MoteType com.thingsquare.cooja.mspsim.Exp2420MoteType com.thingsquare.cooja.mspsim.Trxeb2520MoteType com.thingsquare.cooja.mspsim.Trxeb1120MoteType com.thingsquare.cooja.mspsim.Eth1120MoteType -se.sics.cooja.GUI.JARFILES = + cooja_mspsim.jar mspsim.jar coffee.jar jipv6.jar -se.sics.cooja.GUI.PLUGINS = + se.sics.cooja.mspmote.plugins.MspCLI se.sics.cooja.mspmote.plugins.MspCodeWatcher se.sics.cooja.mspmote.plugins.MspStackWatcher se.sics.cooja.mspmote.plugins.MspCycleWatcher +se.sics.cooja.Cooja.MOTETYPES = + se.sics.cooja.mspmote.ESBMoteType se.sics.cooja.mspmote.SkyMoteType se.sics.cooja.mspmote.Z1MoteType se.sics.cooja.mspmote.WismoteMoteType se.sics.cooja.mspmote.Exp5438MoteType se.sics.cooja.mspmote.SkyMoteType com.thingsquare.cooja.mspsim.CC430MoteType com.thingsquare.cooja.mspsim.Exp1120MoteType com.thingsquare.cooja.mspsim.Exp1101MoteType com.thingsquare.cooja.mspsim.Exp2420MoteType com.thingsquare.cooja.mspsim.Trxeb2520MoteType com.thingsquare.cooja.mspsim.Trxeb1120MoteType com.thingsquare.cooja.mspsim.Eth1120MoteType +se.sics.cooja.Cooja.JARFILES = + cooja_mspsim.jar mspsim.jar coffee.jar jipv6.jar +se.sics.cooja.Cooja.PLUGINS = + se.sics.cooja.mspmote.plugins.MspCLI se.sics.cooja.mspmote.plugins.MspCodeWatcher se.sics.cooja.mspmote.plugins.MspStackWatcher se.sics.cooja.mspmote.plugins.MspCycleWatcher diff --git a/tools/cooja/apps/mspsim/src/com/thingsquare/cooja/mspsim/CC430MoteType.java b/tools/cooja/apps/mspsim/src/com/thingsquare/cooja/mspsim/CC430MoteType.java index f07540341..f92fa6a93 100644 --- a/tools/cooja/apps/mspsim/src/com/thingsquare/cooja/mspsim/CC430MoteType.java +++ b/tools/cooja/apps/mspsim/src/com/thingsquare/cooja/mspsim/CC430MoteType.java @@ -46,7 +46,7 @@ import org.apache.log4j.Logger; import se.sics.cooja.AbstractionLevelDescription; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; import se.sics.cooja.Simulation; @@ -169,14 +169,14 @@ public class CC430MoteType extends MspMoteType { Toolkit toolkit = Toolkit.getDefaultToolkit(); URL imageURL = this.getClass().getClassLoader().getResource("images/cc430.jpg"); Image image = toolkit.getImage(imageURL); - MediaTracker tracker = new MediaTracker(GUI.getTopParentContainer()); + MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer()); tracker.addImage(image, 1); try { tracker.waitForAll(); } catch (InterruptedException ex) { } - if (image.getHeight(GUI.getTopParentContainer()) > 0 && image.getWidth(GUI.getTopParentContainer()) > 0) { - image = image.getScaledInstance((200*image.getWidth(GUI.getTopParentContainer())/image.getHeight(GUI.getTopParentContainer())), 200, Image.SCALE_DEFAULT); + if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) { + image = image.getScaledInstance((200*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 200, Image.SCALE_DEFAULT); return new ImageIcon(image); } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/AbstractMspMoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/AbstractMspMoteType.java index 39fee19bd..6afd0d96a 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/AbstractMspMoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/AbstractMspMoteType.java @@ -66,15 +66,15 @@ public abstract class AbstractMspMoteType extends MspMoteType { /* SPECIAL CASE: Cooja started in applet. * Use preconfigured Contiki firmware */ - if (GUI.isVisualizedInApplet()) { - String firmware = GUI.getExternalToolsSetting(getMoteType().toUpperCase() + "_FIRMWARE", ""); + if (Cooja.isVisualizedInApplet()) { + String firmware = Cooja.getExternalToolsSetting(getMoteType().toUpperCase() + "_FIRMWARE", ""); if (!firmware.equals("")) { setContikiFirmwareFile(new File(firmware)); - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "Creating mote type from precompiled firmware: " + firmware, "Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE); } else { - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "No precompiled firmware found", "Compiled firmware file not available", JOptionPane.ERROR_MESSAGE); return false; diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMoteType.java index 91d256ab8..c49cfc5be 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMoteType.java @@ -45,7 +45,7 @@ import org.apache.log4j.Logger; import se.sics.cooja.AbstractionLevelDescription; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; import se.sics.cooja.Simulation; @@ -73,14 +73,14 @@ public class ESBMoteType extends MspMoteType { Toolkit toolkit = Toolkit.getDefaultToolkit(); URL imageURL = this.getClass().getClassLoader().getResource("images/esb.jpg"); Image image = toolkit.getImage(imageURL); - MediaTracker tracker = new MediaTracker(GUI.getTopParentContainer()); + MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer()); tracker.addImage(image, 1); try { tracker.waitForAll(); } catch (InterruptedException ex) { } - if (image.getHeight(GUI.getTopParentContainer()) > 0 && image.getWidth(GUI.getTopParentContainer()) > 0) { - image = image.getScaledInstance((100*image.getWidth(GUI.getTopParentContainer())/image.getHeight(GUI.getTopParentContainer())), 100, Image.SCALE_DEFAULT); + if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) { + image = image.getScaledInstance((100*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 100, Image.SCALE_DEFAULT); return new ImageIcon(image); } @@ -96,15 +96,15 @@ public class ESBMoteType extends MspMoteType { /* SPECIAL CASE: Cooja started in applet. * Use preconfigured Contiki firmware */ - if (GUI.isVisualizedInApplet()) { - String firmware = GUI.getExternalToolsSetting("ESB_FIRMWARE", ""); + if (Cooja.isVisualizedInApplet()) { + String firmware = Cooja.getExternalToolsSetting("ESB_FIRMWARE", ""); if (!firmware.equals("")) { setContikiFirmwareFile(new File(firmware)); - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "Creating mote type from precompiled firmware: " + firmware, "Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE); } else { - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "No precompiled firmware found", "Compiled firmware file not available", JOptionPane.ERROR_MESSAGE); return false; diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438MoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438MoteType.java index 443c75fa8..3f9bcf31a 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438MoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438MoteType.java @@ -43,7 +43,7 @@ import org.apache.log4j.Logger; import se.sics.cooja.AbstractionLevelDescription; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; import se.sics.cooja.Simulation; @@ -168,14 +168,14 @@ public class Exp5438MoteType extends MspMoteType { Toolkit toolkit = Toolkit.getDefaultToolkit(); URL imageURL = this.getClass().getClassLoader().getResource("exp5438.png"); Image image = toolkit.getImage(imageURL); - MediaTracker tracker = new MediaTracker(GUI.getTopParentContainer()); + MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer()); tracker.addImage(image, 1); try { tracker.waitForAll(); } catch (InterruptedException ex) { } - if (image.getHeight(GUI.getTopParentContainer()) > 0 && image.getWidth(GUI.getTopParentContainer()) > 0) { - image = image.getScaledInstance((200*image.getWidth(GUI.getTopParentContainer())/image.getHeight(GUI.getTopParentContainer())), 200, Image.SCALE_DEFAULT); + if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) { + image = image.getScaledInstance((200*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 200, Image.SCALE_DEFAULT); return new ImageIcon(image); } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspCompileDialog.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspCompileDialog.java index 019505f89..60c1f663d 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspCompileDialog.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspCompileDialog.java @@ -37,7 +37,7 @@ import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteInterface; import se.sics.cooja.Simulation; import se.sics.cooja.dialogs.AbstractCompileDialog; @@ -102,7 +102,7 @@ public class MspCompileDialog extends AbstractCompileDialog { public String getDefaultCompileCommands(File source) { /* TODO Split into String[] */ return - GUI.getExternalToolsSetting("PATH_MAKE") + " " + + Cooja.getExternalToolsSetting("PATH_MAKE") + " " + getExpectedFirmwareFile(source).getName() + " TARGET=" + target; } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java index 400b243c4..24b233284 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java @@ -42,7 +42,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ContikiError; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteInterfaceHandler; @@ -230,7 +230,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc this.myCpu.getLogger().addLogListener(ll); logger.info("Loading firmware from: " + fileELF.getAbsolutePath()); - GUI.setProgressMessage("Loading " + fileELF.getName()); + Cooja.setProgressMessage("Loading " + fileELF.getName()); node.loadFirmware(((MspMoteType)getType()).getELF()); /* Throw exceptions at bad memory access */ diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java index d4af5e2f3..699e421c5 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java @@ -43,7 +43,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; @@ -168,7 +168,7 @@ public abstract class MspMoteType implements MoteType { JLabel label = new JLabel(sb.append("").toString()); label.setVerticalTextPosition(JLabel.TOP); /* Icon (if available) */ - if (!GUI.isVisualizedInApplet()) { + if (!Cooja.isVisualizedInApplet()) { Icon moteTypeIcon = getMoteTypeIcon(); if (moteTypeIcon != null) { label.setIcon(moteTypeIcon); @@ -316,7 +316,7 @@ public abstract class MspMoteType implements MoteType { fileFirmware = getExpectedFirmwareFile(fileSource); } - return configureAndInit(GUI.getTopParentContainer(), simulation, visAvailable); + return configureAndInit(Cooja.getTopParentContainer(), simulation, visAvailable); } public abstract Class[] getAllMoteInterfaceClasses(); @@ -330,7 +330,7 @@ public abstract class MspMoteType implements MoteType { private ELF elf; /* cached */ public ELF getELF() throws IOException { if (elf == null) { - if (GUI.isVisualizedInApplet()) { + if (Cooja.isVisualizedInApplet()) { logger.warn("ELF loading in applet not implemented"); } elf = loadELF(getContikiFirmwareFile().getPath()); diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMoteType.java index e5134f0b0..3819d1ca3 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMoteType.java @@ -45,7 +45,7 @@ import org.apache.log4j.Logger; import se.sics.cooja.AbstractionLevelDescription; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; import se.sics.cooja.Simulation; @@ -82,15 +82,15 @@ public class SkyMoteType extends MspMoteType { /* SPECIAL CASE: Cooja started in applet. * Use preconfigured Contiki firmware */ - if (GUI.isVisualizedInApplet()) { - String firmware = GUI.getExternalToolsSetting("SKY_FIRMWARE", ""); + if (Cooja.isVisualizedInApplet()) { + String firmware = Cooja.getExternalToolsSetting("SKY_FIRMWARE", ""); if (!firmware.equals("")) { setContikiFirmwareFile(new File(firmware)); - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "Creating mote type from precompiled firmware: " + firmware, "Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE); } else { - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "No precompiled firmware found", "Compiled firmware file not available", JOptionPane.ERROR_MESSAGE); return false; @@ -188,14 +188,14 @@ public class SkyMoteType extends MspMoteType { Toolkit toolkit = Toolkit.getDefaultToolkit(); URL imageURL = this.getClass().getClassLoader().getResource("images/sky.jpg"); Image image = toolkit.getImage(imageURL); - MediaTracker tracker = new MediaTracker(GUI.getTopParentContainer()); + MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer()); tracker.addImage(image, 1); try { tracker.waitForAll(); } catch (InterruptedException ex) { } - if (image.getHeight(GUI.getTopParentContainer()) > 0 && image.getWidth(GUI.getTopParentContainer()) > 0) { - image = image.getScaledInstance((200*image.getWidth(GUI.getTopParentContainer())/image.getHeight(GUI.getTopParentContainer())), 200, Image.SCALE_DEFAULT); + if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) { + image = image.getScaledInstance((200*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 200, Image.SCALE_DEFAULT); return new ImageIcon(image); } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMoteType.java index ae401a316..354c83ad3 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMoteType.java @@ -43,7 +43,7 @@ import org.apache.log4j.Logger; import se.sics.cooja.AbstractionLevelDescription; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; import se.sics.cooja.Simulation; @@ -165,14 +165,14 @@ public class TyndallMoteType extends MspMoteType { Toolkit toolkit = Toolkit.getDefaultToolkit(); URL imageURL = this.getClass().getClassLoader().getResource("tyndall.png"); Image image = toolkit.getImage(imageURL); - MediaTracker tracker = new MediaTracker(GUI.getTopParentContainer()); + MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer()); tracker.addImage(image, 1); try { tracker.waitForAll(); } catch (InterruptedException ex) { } - if (image.getHeight(GUI.getTopParentContainer()) > 0 && image.getWidth(GUI.getTopParentContainer()) > 0) { - image = image.getScaledInstance((200*image.getWidth(GUI.getTopParentContainer())/image.getHeight(GUI.getTopParentContainer())), 200, Image.SCALE_DEFAULT); + if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) { + image = image.getScaledInstance((200*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 200, Image.SCALE_DEFAULT); return new ImageIcon(image); } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyCoffeeFilesystem.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyCoffeeFilesystem.java index 158827ef6..016ccdae1 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyCoffeeFilesystem.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyCoffeeFilesystem.java @@ -55,7 +55,7 @@ import org.jdom.Element; import se.sics.coffee.CoffeeFS; import se.sics.coffee.CoffeeFile; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MoteInterface; import se.sics.cooja.dialogs.TableColumnAdjuster; @@ -167,7 +167,7 @@ public class SkyCoffeeFilesystem extends MoteInterface { public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); - int reply = fileChooser.showOpenDialog(GUI.getTopParentContainer()); + int reply = fileChooser.showOpenDialog(Cooja.getTopParentContainer()); if (reply != JFileChooser.APPROVE_OPTION) { return; } @@ -226,7 +226,7 @@ public class SkyCoffeeFilesystem extends MoteInterface { public void setValueAt(Object value, final int row, int col) { if (col == COLUMN_SAVE) { JFileChooser fc = new JFileChooser(); - int returnVal = fc.showSaveDialog(GUI.getTopParentContainer()); + int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer()); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } @@ -237,7 +237,7 @@ public class SkyCoffeeFilesystem extends MoteInterface { String s2 = "Cancel"; Object[] options = { s1, s2 }; int n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "A file with the same name already exists.\nDo you want to remove it?", "Overwrite existing file?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, s1); @@ -270,7 +270,7 @@ public class SkyCoffeeFilesystem extends MoteInterface { if (col == COLUMN_REMOVE) { int reply = JOptionPane.showConfirmDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "Remove \"" + files[row].getName() + "\" from filesystem?"); if (reply != JOptionPane.YES_OPTION) { return; diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyFlash.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyFlash.java index 5f93f5986..02f078bad 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyFlash.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/SkyFlash.java @@ -86,7 +86,7 @@ public class SkyFlash extends MoteInterface { final JButton downloadButton = new JButton("Store to file"); panel.add(downloadButton); - if (GUI.isVisualizedInApplet()) { + if (Cooja.isVisualizedInApplet()) { uploadButton.setEnabled(false); uploadButton.setToolTipText("Not available in applet mode"); downloadButton.setEnabled(false); @@ -95,7 +95,7 @@ public class SkyFlash extends MoteInterface { uploadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - byte[] fileData = readDialogFileBytes(GUI.getTopParentContainer()); + byte[] fileData = readDialogFileBytes(Cooja.getTopParentContainer()); if (fileData != null) { if (fileData.length > CoojaM25P80.SIZE) { @@ -120,7 +120,7 @@ public class SkyFlash extends MoteInterface { m24p80.seek(0); m24p80.readFully(data); - writeDialogFileBytes(GUI.getTopParentContainer(), data); + writeDialogFileBytes(Cooja.getTopParentContainer(), data); } catch (IOException ex) { logger.fatal("Data download failed: " + ex.getMessage(), ex); } @@ -158,7 +158,7 @@ public class SkyFlash extends MoteInterface { public static void writeDialogFileBytes(Component parent, byte[] data) { JFileChooser fc = new JFileChooser(); - int returnVal = fc.showSaveDialog(GUI.getTopParentContainer()); + int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer()); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } @@ -169,7 +169,7 @@ public class SkyFlash extends MoteInterface { String s2 = "Cancel"; Object[] options = { s1, s2 }; int n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "A file with the same name already exists.\nDo you want to remove it?", "Overwrite existing file?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, s1); diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/BreakpointsUI.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/BreakpointsUI.java index c789339c6..2922df9a4 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/BreakpointsUI.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/BreakpointsUI.java @@ -53,7 +53,7 @@ import javax.swing.table.DefaultTableCellRenderer; import org.apache.log4j.Logger; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Watchpoint; import se.sics.cooja.WatchpointMote; @@ -201,7 +201,7 @@ public class BreakpointsUI extends JPanel { private void configureWatchpointInfo(Watchpoint breakpoint) { String msg = (String) JOptionPane.showInputDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "Enter description;", "Watchpoint description", JOptionPane.QUESTION_MESSAGE, null, null, breakpoint.getUserMessage()); @@ -210,7 +210,7 @@ public class BreakpointsUI extends JPanel { } breakpoint.setUserMessage(msg); Color newColor = JColorChooser.showDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "Watchpoint color", breakpoint.getColor()); if (newColor == null) { diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCLI.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCLI.java index 99d7d6678..6a1031770 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCLI.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCLI.java @@ -46,7 +46,7 @@ import javax.swing.JTextArea; import javax.swing.JTextField; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.HasQuickHelp; import se.sics.cooja.Mote; import se.sics.cooja.MotePlugin; @@ -74,7 +74,7 @@ public class MspCLI extends VisPlugin implements MotePlugin, HasQuickHelp { private int historyPos = 0; private int historyCount = 0; - public MspCLI(Mote mote, Simulation simulationToVisualize, GUI gui) { + public MspCLI(Mote mote, Simulation simulationToVisualize, Cooja gui) { super("Msp CLI (" + mote.getID() + ')', gui); this.mspMote = (MspMote) mote; diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCodeWatcher.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCodeWatcher.java index 0358720f4..8affaf8ff 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCodeWatcher.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCodeWatcher.java @@ -66,7 +66,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MotePlugin; import se.sics.cooja.PluginType; @@ -125,7 +125,7 @@ public class MspCodeWatcher extends VisPlugin implements MotePlugin { * @param simulationToVisualize Simulation * @param gui Simulator */ - public MspCodeWatcher(Mote mote, Simulation simulationToVisualize, GUI gui) { + public MspCodeWatcher(Mote mote, Simulation simulationToVisualize, Cooja gui) { super("Msp Code Watcher - " + mote, gui); simulation = simulationToVisualize; this.mspMote = (MspMote) mote; @@ -453,7 +453,7 @@ public class MspCodeWatcher extends VisPlugin implements MotePlugin { } private void loadDefaultRules() { - String rulesString = GUI.getExternalToolsSetting("MSPCODEWATCHER_RULES", "/cygdrive/c/*c:/"); + String rulesString = Cooja.getExternalToolsSetting("MSPCODEWATCHER_RULES", "/cygdrive/c/*c:/"); String[] rulesArr = rulesString.split("\\*"); rules.clear(); for (int i=0; i < rulesArr.length/2; i++) { @@ -475,7 +475,7 @@ public class MspCodeWatcher extends VisPlugin implements MotePlugin { private JTable table = null; private void tryMapDebugInfo() { /* called from AWT */ - int r = JOptionPane.showConfirmDialog(GUI.getTopParentContainer(), + int r = JOptionPane.showConfirmDialog(Cooja.getTopParentContainer(), "The firmware file " + mspMote.getType().getContikiFirmwareFile().getName() + " references " + debugSourceFiles.length + " source files.\n" + "This function tries to locate these files on disk with a set of simple substitution rules.\n" + "\n" + @@ -487,7 +487,7 @@ public class MspCodeWatcher extends VisPlugin implements MotePlugin { /* table with rules */ rulesDebuggingOutput.clearMessages(); - final JDialog dialog = new JDialog((Window)GUI.getTopParentContainer(), "Locate source files"); + final JDialog dialog = new JDialog((Window)Cooja.getTopParentContainer(), "Locate source files"); dialog.setModal(true); updateRulesUsage(); AbstractTableModel model = new AbstractTableModel() { @@ -646,9 +646,9 @@ public class MspCodeWatcher extends VisPlugin implements MotePlugin { } } if (sb.length() >= 1) { - GUI.setExternalToolsSetting("MSPCODEWATCHER_RULES", sb.substring(1)); + Cooja.setExternalToolsSetting("MSPCODEWATCHER_RULES", sb.substring(1)); } else { - GUI.setExternalToolsSetting("MSPCODEWATCHER_RULES", ""); + Cooja.setExternalToolsSetting("MSPCODEWATCHER_RULES", ""); } } }); @@ -681,7 +681,7 @@ public class MspCodeWatcher extends VisPlugin implements MotePlugin { dialog.getContentPane().add(BorderLayout.SOUTH, control); dialog.getRootPane().setDefaultButton(closeButton); dialog.setSize(550, 500); - dialog.setLocationRelativeTo(GUI.getTopParentContainer()); + dialog.setLocationRelativeTo(Cooja.getTopParentContainer()); dialog.setVisible(true); } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCycleWatcher.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCycleWatcher.java index 0495abd09..255478fa7 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCycleWatcher.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspCycleWatcher.java @@ -46,7 +46,7 @@ import javax.swing.JTextField; import org.apache.log4j.Logger; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MotePlugin; import se.sics.cooja.PluginType; @@ -69,7 +69,7 @@ public class MspCycleWatcher extends VisPlugin implements MotePlugin { private JTextField resetTextField = new JTextField(""); private long cycleReset = 0; - public MspCycleWatcher(Mote mote, Simulation simulationToVisualize, GUI gui) { + public MspCycleWatcher(Mote mote, Simulation simulationToVisualize, Cooja gui) { super("Msp Cycle Watcher", gui); this.mspMote = (MspMote) mote; cpu = mspMote.getCPU(); diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspStackWatcher.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspStackWatcher.java index 6e0fc6ebc..3b8ee855f 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspStackWatcher.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/plugins/MspStackWatcher.java @@ -47,7 +47,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MotePlugin; import se.sics.cooja.MoteTimeEvent; @@ -83,7 +83,7 @@ public class MspStackWatcher extends VisPlugin implements MotePlugin { private JLabel memLabel = new JLabel(""); - public MspStackWatcher(Mote mote, Simulation simulationToVisualize, GUI gui) { + public MspStackWatcher(Mote mote, Simulation simulationToVisualize, Cooja gui) { super("Msp Stack Watcher: " + mote, gui); this.mspMote = (MspMote) mote; cpu = mspMote.getCPU(); @@ -135,7 +135,7 @@ public class MspStackWatcher extends VisPlugin implements MotePlugin { if (gui) { String s = (String)JOptionPane.showInputDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "With default linker scripts the stack starts at 0x" + Integer.toHexString(stack) + ".\n" + "If you are using a modified linker script, you may here correct the stack start address.", "Enter stack start address", @@ -193,7 +193,7 @@ public class MspStackWatcher extends VisPlugin implements MotePlugin { if (available <= 0) { SwingUtilities.invokeLater(new Runnable() { public void run() { - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), String.format("Stack overflow!\n\n" + "\tSP = 0x%05x\n" + "\tHeap start = 0x%05x\n\n" + diff --git a/tools/cooja/apps/native_gateway/cooja.config b/tools/cooja/apps/native_gateway/cooja.config index 9bcd6c66f..88161d7d0 100644 --- a/tools/cooja/apps/native_gateway/cooja.config +++ b/tools/cooja/apps/native_gateway/cooja.config @@ -1,2 +1,2 @@ -se.sics.cooja.GUI.PLUGINS = + se.sics.cooja.plugins.NativeIPGateway -se.sics.cooja.GUI.JARFILES = + native_gateway.jar +se.sics.cooja.Cooja.PLUGINS = + se.sics.cooja.plugins.NativeIPGateway +se.sics.cooja.Cooja.JARFILES = + native_gateway.jar diff --git a/tools/cooja/apps/native_gateway/java/se/sics/cooja/plugins/NativeIPGateway.java b/tools/cooja/apps/native_gateway/java/se/sics/cooja/plugins/NativeIPGateway.java index 7add1c3ea..13be45988 100644 --- a/tools/cooja/apps/native_gateway/java/se/sics/cooja/plugins/NativeIPGateway.java +++ b/tools/cooja/apps/native_gateway/java/se/sics/cooja/plugins/NativeIPGateway.java @@ -67,8 +67,8 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; -import se.sics.cooja.GUI.RunnableInEDT; +import se.sics.cooja.Cooja; +import se.sics.cooja.Cooja.RunnableInEDT; import se.sics.cooja.Mote; import se.sics.cooja.MotePlugin; import se.sics.cooja.PluginType; diff --git a/tools/cooja/apps/powertracker/cooja.config b/tools/cooja/apps/powertracker/cooja.config index 1df154e2b..95e208f70 100644 --- a/tools/cooja/apps/powertracker/cooja.config +++ b/tools/cooja/apps/powertracker/cooja.config @@ -1,2 +1,2 @@ -se.sics.cooja.GUI.PLUGINS = + PowerTracker -se.sics.cooja.GUI.JARFILES = + powertracker.jar +se.sics.cooja.Cooja.PLUGINS = + PowerTracker +se.sics.cooja.Cooja.JARFILES = + powertracker.jar diff --git a/tools/cooja/apps/powertracker/java/PowerTracker.java b/tools/cooja/apps/powertracker/java/PowerTracker.java index 35a6b8c2d..c5edd9b2a 100644 --- a/tools/cooja/apps/powertracker/java/PowerTracker.java +++ b/tools/cooja/apps/powertracker/java/PowerTracker.java @@ -55,7 +55,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.PluginType; import se.sics.cooja.SimEventCentral.MoteCountListener; @@ -88,7 +88,7 @@ public class PowerTracker extends VisPlugin { private JTable table; private int tableMaxRadioOnIndex = -1; - public PowerTracker(final Simulation simulation, final GUI gui) { + public PowerTracker(final Simulation simulation, final Cooja gui) { super("PowerTracker", gui, false); this.simulation = simulation; @@ -109,7 +109,7 @@ public class PowerTracker extends VisPlugin { addMote(m); } - if (!GUI.isVisualized()) { + if (!Cooja.isVisualized()) { return; } diff --git a/tools/cooja/apps/serial_socket/cooja.config b/tools/cooja/apps/serial_socket/cooja.config index c3a1d3e41..1194a47d9 100644 --- a/tools/cooja/apps/serial_socket/cooja.config +++ b/tools/cooja/apps/serial_socket/cooja.config @@ -1,2 +1,2 @@ -se.sics.cooja.GUI.PLUGINS = + SerialSocketClient SerialSocketServer -se.sics.cooja.GUI.JARFILES = + serial_socket.jar +se.sics.cooja.Cooja.PLUGINS = + SerialSocketClient SerialSocketServer +se.sics.cooja.Cooja.JARFILES = + serial_socket.jar diff --git a/tools/cooja/apps/serial_socket/java/SerialSocketClient.java b/tools/cooja/apps/serial_socket/java/SerialSocketClient.java index 9bf8dcbc7..b9b61784a 100644 --- a/tools/cooja/apps/serial_socket/java/SerialSocketClient.java +++ b/tools/cooja/apps/serial_socket/java/SerialSocketClient.java @@ -49,7 +49,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MotePlugin; import se.sics.cooja.PluginType; @@ -86,12 +86,12 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin { private Mote mote; - public SerialSocketClient(Mote mote, Simulation simulation, final GUI gui) { + public SerialSocketClient(Mote mote, Simulation simulation, final Cooja gui) { super("Serial Socket (CLIENT) (" + mote + ")", gui, false); this.mote = mote; /* GUI components */ - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { Box northBox = Box.createHorizontalBox(); northBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); statusLabel = configureLabel(northBox, "", ""); @@ -134,7 +134,7 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin { out.write(serialPort.getLastSerialData()); out.flush(); outBytes++; - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { outLabel.setText(outBytes + " bytes"); } } catch (IOException e) { @@ -165,7 +165,7 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin { serialPort.writeByte(data[i]); } inBytes += numRead; - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { inLabel.setText(inBytes + " bytes"); } } else { diff --git a/tools/cooja/apps/serial_socket/java/SerialSocketServer.java b/tools/cooja/apps/serial_socket/java/SerialSocketServer.java index 97c047479..a4e8ac823 100644 --- a/tools/cooja/apps/serial_socket/java/SerialSocketServer.java +++ b/tools/cooja/apps/serial_socket/java/SerialSocketServer.java @@ -53,7 +53,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MotePlugin; import se.sics.cooja.PluginType; @@ -90,7 +90,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { private Mote mote; - public SerialSocketServer(Mote mote, Simulation simulation, final GUI gui) { + public SerialSocketServer(Mote mote, Simulation simulation, final Cooja gui) { super("Serial Socket (SERVER) (" + mote + ")", gui, false); this.mote = mote; @@ -99,7 +99,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { LISTEN_PORT = 60000 + mote.getID(); /* GUI components */ - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { Box northBox = Box.createHorizontalBox(); northBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); statusLabel = configureLabel(northBox, "", ""); @@ -122,7 +122,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { try { logger.info("Listening on port: " + LISTEN_PORT); - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { statusLabel.setText("Listening on port: " + LISTEN_PORT); } server = new ServerSocket(LISTEN_PORT); @@ -136,7 +136,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { out.flush(); startSocketReadThread(in); - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { statusLabel.setText("Client connected: " + client.getInetAddress()); } } catch (IOException e) { @@ -247,7 +247,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin { } catch (IOException e) { } - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { SwingUtilities.invokeLater(new Runnable() { public void run() { statusLabel.setText("Listening on port: " + LISTEN_PORT); diff --git a/tools/cooja/build.xml b/tools/cooja/build.xml index 287da6bb3..d16cff332 100644 --- a/tools/cooja/build.xml +++ b/tools/cooja/build.xml @@ -100,7 +100,7 @@ The COOJA Simulator - + @@ -114,7 +114,7 @@ The COOJA Simulator - + @@ -129,7 +129,7 @@ The COOJA Simulator - + @@ -143,7 +143,7 @@ The COOJA Simulator - + @@ -157,7 +157,7 @@ The COOJA Simulator - + @@ -172,7 +172,7 @@ The COOJA Simulator - + @@ -194,7 +194,7 @@ The COOJA Simulator - + @@ -225,7 +225,7 @@ The COOJA Simulator - + diff --git a/tools/cooja/config/cooja_applet.config b/tools/cooja/config/cooja_applet.config index 1d0dc43e6..9ca8a9a99 100644 --- a/tools/cooja/config/cooja_applet.config +++ b/tools/cooja/config/cooja_applet.config @@ -1,4 +1,4 @@ -se.sics.cooja.GUI.MOTETYPES = se.sics.cooja.motes.DisturberMoteType se.sics.cooja.contikimote.ContikiMoteType se.sics.cooja.mspmote.ESBMoteType se.sics.cooja.mspmote.SkyMoteType -se.sics.cooja.GUI.PLUGINS = se.sics.cooja.plugins.Visualizer se.sics.cooja.plugins.LogListener se.sics.cooja.plugins.MoteInformation se.sics.cooja.plugins.MoteInterfaceViewer se.sics.cooja.plugins.VariableWatcher se.sics.cooja.plugins.EventListener se.sics.cooja.plugins.RadioLogger se.sics.cooja.mspmote.plugins.MspCodeWatcher se.sics.cooja.mspmote.plugins.MspStackWatcher se.sics.cooja.mspmote.plugins.MspCycleWatcher -se.sics.cooja.GUI.POSITIONERS = se.sics.cooja.positioners.RandomPositioner se.sics.cooja.positioners.LinearPositioner se.sics.cooja.positioners.EllipsePositioner se.sics.cooja.positioners.ManualPositioner -se.sics.cooja.GUI.RADIOMEDIUMS = se.sics.cooja.radiomediums.UDGM se.sics.cooja.radiomediums.UDGMConstantLoss se.sics.cooja.radiomediums.DirectedGraphMedium se.sics.mrm.MRM se.sics.cooja.radiomediums.SilentRadioMedium +se.sics.cooja.Cooja.MOTETYPES = se.sics.cooja.motes.DisturberMoteType se.sics.cooja.contikimote.ContikiMoteType se.sics.cooja.mspmote.ESBMoteType se.sics.cooja.mspmote.SkyMoteType +se.sics.cooja.Cooja.PLUGINS = se.sics.cooja.plugins.Visualizer se.sics.cooja.plugins.LogListener se.sics.cooja.plugins.MoteInformation se.sics.cooja.plugins.MoteInterfaceViewer se.sics.cooja.plugins.VariableWatcher se.sics.cooja.plugins.EventListener se.sics.cooja.plugins.RadioLogger se.sics.cooja.mspmote.plugins.MspCodeWatcher se.sics.cooja.mspmote.plugins.MspStackWatcher se.sics.cooja.mspmote.plugins.MspCycleWatcher +se.sics.cooja.Cooja.POSITIONERS = se.sics.cooja.positioners.RandomPositioner se.sics.cooja.positioners.LinearPositioner se.sics.cooja.positioners.EllipsePositioner se.sics.cooja.positioners.ManualPositioner +se.sics.cooja.Cooja.RADIOMEDIUMS = se.sics.cooja.radiomediums.UDGM se.sics.cooja.radiomediums.UDGMConstantLoss se.sics.cooja.radiomediums.DirectedGraphMedium se.sics.mrm.MRM se.sics.cooja.radiomediums.SilentRadioMedium diff --git a/tools/cooja/config/cooja_default.config b/tools/cooja/config/cooja_default.config index 7f46f6138..020041c0d 100644 --- a/tools/cooja/config/cooja_default.config +++ b/tools/cooja/config/cooja_default.config @@ -2,7 +2,7 @@ se.sics.cooja.contikimote.interfaces.ContikiRadio.RADIO_TRANSMISSION_RATE_kbps = se.sics.cooja.contikimote.ContikiMoteType.MOTE_INTERFACES = se.sics.cooja.interfaces.Position se.sics.cooja.interfaces.Battery se.sics.cooja.contikimote.interfaces.ContikiVib se.sics.cooja.contikimote.interfaces.ContikiMoteID se.sics.cooja.contikimote.interfaces.ContikiRS232 se.sics.cooja.contikimote.interfaces.ContikiBeeper se.sics.cooja.interfaces.RimeAddress se.sics.cooja.contikimote.interfaces.ContikiIPAddress se.sics.cooja.contikimote.interfaces.ContikiRadio se.sics.cooja.contikimote.interfaces.ContikiButton se.sics.cooja.contikimote.interfaces.ContikiPIR se.sics.cooja.contikimote.interfaces.ContikiClock se.sics.cooja.contikimote.interfaces.ContikiLED se.sics.cooja.contikimote.interfaces.ContikiCFS se.sics.cooja.interfaces.Mote2MoteRelations se.sics.cooja.interfaces.MoteAttributes se.sics.cooja.contikimote.ContikiMoteType.C_SOURCES = -se.sics.cooja.GUI.MOTETYPES = se.sics.cooja.motes.ImportAppMoteType se.sics.cooja.motes.DisturberMoteType se.sics.cooja.contikimote.ContikiMoteType -se.sics.cooja.GUI.PLUGINS = se.sics.cooja.plugins.Visualizer se.sics.cooja.plugins.LogListener se.sics.cooja.plugins.TimeLine se.sics.cooja.plugins.MoteInformation se.sics.cooja.plugins.MoteInterfaceViewer se.sics.cooja.plugins.VariableWatcher se.sics.cooja.plugins.EventListener se.sics.cooja.plugins.RadioLogger se.sics.cooja.plugins.ScriptRunner se.sics.cooja.plugins.Notes se.sics.cooja.plugins.BufferListener -se.sics.cooja.GUI.POSITIONERS = se.sics.cooja.positioners.RandomPositioner se.sics.cooja.positioners.LinearPositioner se.sics.cooja.positioners.EllipsePositioner se.sics.cooja.positioners.ManualPositioner -se.sics.cooja.GUI.RADIOMEDIUMS = se.sics.cooja.radiomediums.UDGM se.sics.cooja.radiomediums.UDGMConstantLoss se.sics.cooja.radiomediums.DirectedGraphMedium se.sics.cooja.radiomediums.SilentRadioMedium +se.sics.cooja.Cooja.MOTETYPES = se.sics.cooja.motes.ImportAppMoteType se.sics.cooja.motes.DisturberMoteType se.sics.cooja.contikimote.ContikiMoteType +se.sics.cooja.Cooja.PLUGINS = se.sics.cooja.plugins.Visualizer se.sics.cooja.plugins.LogListener se.sics.cooja.plugins.TimeLine se.sics.cooja.plugins.MoteInformation se.sics.cooja.plugins.MoteInterfaceViewer se.sics.cooja.plugins.VariableWatcher se.sics.cooja.plugins.EventListener se.sics.cooja.plugins.RadioLogger se.sics.cooja.plugins.ScriptRunner se.sics.cooja.plugins.Notes se.sics.cooja.plugins.BufferListener +se.sics.cooja.Cooja.POSITIONERS = se.sics.cooja.positioners.RandomPositioner se.sics.cooja.positioners.LinearPositioner se.sics.cooja.positioners.EllipsePositioner se.sics.cooja.positioners.ManualPositioner +se.sics.cooja.Cooja.RADIOMEDIUMS = se.sics.cooja.radiomediums.UDGM se.sics.cooja.radiomediums.UDGMConstantLoss se.sics.cooja.radiomediums.DirectedGraphMedium se.sics.cooja.radiomediums.SilentRadioMedium diff --git a/tools/cooja/examples/project_new_plugin/cooja.config b/tools/cooja/examples/project_new_plugin/cooja.config index 15497e9cd..f4037d6e6 100644 --- a/tools/cooja/examples/project_new_plugin/cooja.config +++ b/tools/cooja/examples/project_new_plugin/cooja.config @@ -1,2 +1,2 @@ DESCRIPTION = Example plugin -se.sics.cooja.GUI.PLUGINS = + MyDummyPlugin +se.sics.cooja.Cooja.PLUGINS = + MyDummyPlugin diff --git a/tools/cooja/examples/project_new_plugin/java/MyDummyPlugin.java b/tools/cooja/examples/project_new_plugin/java/MyDummyPlugin.java index 3139eaa7d..93d89f0be 100644 --- a/tools/cooja/examples/project_new_plugin/java/MyDummyPlugin.java +++ b/tools/cooja/examples/project_new_plugin/java/MyDummyPlugin.java @@ -44,7 +44,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.PluginType; import se.sics.cooja.Simulation; import se.sics.cooja.TimeEvent; @@ -76,7 +76,7 @@ public class MyDummyPlugin extends VisPlugin { * @param simulation Simulation object * @param gui GUI object */ - public MyDummyPlugin(Simulation simulation, GUI gui) { + public MyDummyPlugin(Simulation simulation, Cooja gui) { super("Example plugin title", gui); this.sim = simulation; diff --git a/tools/cooja/examples/project_new_radiomedium/cooja.config b/tools/cooja/examples/project_new_radiomedium/cooja.config index 9eb9aa4e8..3e1bf9d00 100644 --- a/tools/cooja/examples/project_new_radiomedium/cooja.config +++ b/tools/cooja/examples/project_new_radiomedium/cooja.config @@ -1 +1 @@ -se.sics.cooja.GUI.RADIOMEDIUMS = + DummyRadioMedium +se.sics.cooja.Cooja.RADIOMEDIUMS = + DummyRadioMedium diff --git a/tools/cooja/examples/project_new_radiomedium/java/DummyRadioMedium.java b/tools/cooja/examples/project_new_radiomedium/java/DummyRadioMedium.java index 38c9f85bd..7ac91982b 100644 --- a/tools/cooja/examples/project_new_radiomedium/java/DummyRadioMedium.java +++ b/tools/cooja/examples/project_new_radiomedium/java/DummyRadioMedium.java @@ -43,7 +43,7 @@ import se.sics.cooja.radiomediums.AbstractRadioMedium; */ @ClassDescription("Dummy Radio Medium") public class DummyRadioMedium extends AbstractRadioMedium { - private static Logger logger = Logger.getLogger(GUI.class); + private static Logger logger = Logger.getLogger(Cooja.class); public DummyRadioMedium(Simulation simulation) { super(simulation); diff --git a/tools/cooja/java/se/sics/cooja/COOJAProject.java b/tools/cooja/java/se/sics/cooja/COOJAProject.java index 685e333d5..3cce26533 100644 --- a/tools/cooja/java/se/sics/cooja/COOJAProject.java +++ b/tools/cooja/java/se/sics/cooja/COOJAProject.java @@ -68,7 +68,7 @@ public class COOJAProject { Collections.addAll(dirs, newf); } } - if(subf.getName().equals(GUI.PROJECT_CONFIG_FILENAME)){ + if(subf.getName().equals(Cooja.PROJECT_CONFIG_FILENAME)){ try{ dirs.add(folder); } catch(Exception e){ @@ -89,7 +89,7 @@ public class COOJAProject { public COOJAProject(File dir) { try { this.dir = dir; - configFile = new File(dir.getPath(), GUI.PROJECT_CONFIG_FILENAME); + configFile = new File(dir.getPath(), Cooja.PROJECT_CONFIG_FILENAME); config = new ProjectConfig(false); config.appendConfigFile(configFile); } catch (Exception e) { @@ -113,7 +113,7 @@ public class COOJAProject { if (getConfigJARs() != null) { String[] jars = getConfigJARs(); for (String jar: jars) { - File jarFile = GUI.findJarFile(dir, jar); + File jarFile = Cooja.findJarFile(dir, jar); if (jarFile == null || !jarFile.exists()) { return true; } @@ -141,16 +141,16 @@ public class COOJAProject { return arr; } public String[] getConfigPlugins() { - return getStringArray("se.sics.cooja.GUI.PLUGINS"); + return getStringArray("se.sics.cooja.Cooja.PLUGINS"); } public String[] getConfigJARs() { - return getStringArray("se.sics.cooja.GUI.JARFILES"); + return getStringArray("se.sics.cooja.Cooja.JARFILES"); } public String[] getConfigMoteTypes() { - return getStringArray("se.sics.cooja.GUI.MOTETYPES"); + return getStringArray("se.sics.cooja.Cooja.MOTETYPES"); } public String[] getConfigRadioMediums() { - return getStringArray("se.sics.cooja.GUI.RADIOMEDIUMS"); + return getStringArray("se.sics.cooja.Cooja.RADIOMEDIUMS"); } public String[] getConfigMoteInterfaces() { return getStringArray("se.sics.cooja.contikimote.ContikiMoteType.MOTE_INTERFACES"); diff --git a/tools/cooja/java/se/sics/cooja/GUI.java b/tools/cooja/java/se/sics/cooja/Cooja.java similarity index 96% rename from tools/cooja/java/se/sics/cooja/GUI.java rename to tools/cooja/java/se/sics/cooja/Cooja.java index da6b39b2b..f8e112d0a 100644 --- a/tools/cooja/java/se/sics/cooja/GUI.java +++ b/tools/cooja/java/se/sics/cooja/Cooja.java @@ -155,11 +155,11 @@ import se.sics.cooja.util.ExecuteJAR; * * @author Fredrik Osterlind */ -public class GUI extends Observable { +public class Cooja extends Observable { private static JFrame frame = null; private static JApplet applet = null; private static final long serialVersionUID = 1L; - private static Logger logger = Logger.getLogger(GUI.class); + private static Logger logger = Logger.getLogger(Cooja.class); /** * External tools configuration. @@ -294,7 +294,7 @@ public class GUI extends Observable { private static final String WINDOW_TITLE = "Cooja: The Contiki Network Simulator"; - private GUI myGUI; + private Cooja myGUI; private Simulation mySimulation; @@ -369,7 +369,7 @@ public class GUI extends Observable { * * @param desktop Desktop pane */ - public GUI(JDesktopPane desktop) { + public Cooja(JDesktopPane desktop) { myGUI = this; mySimulation = null; myDesktopPane = desktop; @@ -448,7 +448,7 @@ public class GUI extends Observable { } catch (ParseProjectsException e) { logger.fatal("Error when loading extensions: " + e.getMessage(), e); if (isVisualized()) { - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "All Cooja extensions could not load.\n\n" + "To manage Cooja extensions:\n" + "Menu->Settings->Cooja extensions", @@ -822,7 +822,7 @@ public class GUI extends Observable { for (Class moteTypeClass : moteTypeClasses) { /* Sort mote types according to abstraction level */ - String abstractionLevelDescription = GUI.getAbstractionLevelDescriptionOf(moteTypeClass); + String abstractionLevelDescription = Cooja.getAbstractionLevelDescriptionOf(moteTypeClass); if(abstractionLevelDescription == null) { abstractionLevelDescription = "[unknown cross-level]"; } @@ -845,7 +845,7 @@ public class GUI extends Observable { menuMoteTypeClasses.add(abstractionLevelSeparator); } - String description = GUI.getDescriptionOf(moteTypeClass); + String description = Cooja.getDescriptionOf(moteTypeClass); menuItem = new JMenuItem(description + "..."); menuItem.setActionCommand("create mote type"); menuItem.putClientProperty("class", moteTypeClass); @@ -985,7 +985,7 @@ public class GUI extends Observable { /* Check if plugin was imported by a extension directory */ File project = - getProjectConfig().getUserProjectDefining(GUI.class, "PLUGINS", newPluginClass.getName()); + getProjectConfig().getUserProjectDefining(Cooja.class, "PLUGINS", newPluginClass.getName()); if (project != null) { tooltip += "\nLoaded by extension: " + project.getPath(); } @@ -1123,7 +1123,7 @@ public class GUI extends Observable { return menuBar; } - private static void configureFrame(final GUI gui, boolean createSimDialog) { + private static void configureFrame(final Cooja gui, boolean createSimDialog) { if (frame == null) { frame = new JFrame(WINDOW_TITLE); @@ -1205,7 +1205,7 @@ public class GUI extends Observable { } } - private static void configureApplet(final GUI gui, boolean createSimDialog) { + private static void configureApplet(final Cooja gui, boolean createSimDialog) { applet = CoojaApplet.applet; // Add menu bar @@ -1327,7 +1327,7 @@ public class GUI extends Observable { if (vis) { frame = new JFrame(WINDOW_TITLE); } - GUI gui = new GUI(desktop); + Cooja gui = new Cooja(desktop); if (vis) { configureFrame(gui, false); } @@ -1360,13 +1360,13 @@ public class GUI extends Observable { logger.info("> Starting Cooja"); JDesktopPane desktop = createDesktopPane(); frame = new JFrame(WINDOW_TITLE); - GUI gui = new GUI(desktop); + Cooja gui = new Cooja(desktop); configureFrame(gui, false); logger.info("> Creating simulation"); Simulation sim = new Simulation(gui); sim.setTitle("Quickstarted simulation: " + source); - boolean simOK = CreateSimDialog.showDialog(GUI.getTopParentContainer(), sim); + boolean simOK = CreateSimDialog.showDialog(Cooja.getTopParentContainer(), sim); if (!simOK) { logger.fatal("No simulation, aborting quickstart"); System.exit(1); @@ -1379,7 +1379,7 @@ public class GUI extends Observable { moteType.setDescription("Cooja mote type (" + source + ")"); try { - boolean compileOK = moteType.configureAndInit(GUI.getTopParentContainer(), sim, true); + boolean compileOK = moteType.configureAndInit(Cooja.getTopParentContainer(), sim, true); if (!compileOK) { logger.fatal("Mote type initialization failed, aborting quickstart"); return null; @@ -1552,7 +1552,7 @@ public class GUI extends Observable { } // Register mote types - String[] moteTypeClassNames = projectConfig.getStringArrayValue(GUI.class, + String[] moteTypeClassNames = projectConfig.getStringArrayValue(Cooja.class, "MOTETYPES"); if (moteTypeClassNames != null) { for (String moteTypeClassName : moteTypeClassNames) { @@ -1575,7 +1575,7 @@ public class GUI extends Observable { registerPlugin(SimControl.class); registerPlugin(SimInformation.class); registerPlugin(MoteTypeInformation.class); - String[] pluginClassNames = projectConfig.getStringArrayValue(GUI.class, + String[] pluginClassNames = projectConfig.getStringArrayValue(Cooja.class, "PLUGINS"); if (pluginClassNames != null) { for (String pluginClassName : pluginClassNames) { @@ -1593,7 +1593,7 @@ public class GUI extends Observable { // Register positioners String[] positionerClassNames = projectConfig.getStringArrayValue( - GUI.class, "POSITIONERS"); + Cooja.class, "POSITIONERS"); if (positionerClassNames != null) { for (String positionerClassName : positionerClassNames) { Class positionerClass = tryLoadClass(this, @@ -1611,7 +1611,7 @@ public class GUI extends Observable { // Register radio mediums String[] radioMediumsClassNames = projectConfig.getStringArrayValue( - GUI.class, "RADIOMEDIUMS"); + Cooja.class, "RADIOMEDIUMS"); if (radioMediumsClassNames != null) { for (String radioMediumClassName : radioMediumsClassNames) { Class radioMediumClass = tryLoadClass(this, @@ -1745,11 +1745,11 @@ public class GUI extends Observable { } /** - * Same as the {@link #startPlugin(Class, GUI, Simulation, Mote)} method, + * Same as the {@link #startPlugin(Class, Cooja, Simulation, Mote)} method, * but does not throw exceptions. If COOJA is visualised, an error dialog * is shown if plugin could not be started. * - * @see #startPlugin(Class, GUI, Simulation, Mote) + * @see #startPlugin(Class, Cooja, Simulation, Mote) * @param pluginClass Plugin class * @param argGUI Plugin GUI argument * @param argSimulation Plugin simulation argument @@ -1757,12 +1757,12 @@ public class GUI extends Observable { * @return Started plugin */ private Plugin tryStartPlugin(final Class pluginClass, - final GUI argGUI, final Simulation argSimulation, final Mote argMote, boolean activate) { + final Cooja argGUI, final Simulation argSimulation, final Mote argMote, boolean activate) { try { return startPlugin(pluginClass, argGUI, argSimulation, argMote, activate); } catch (PluginConstructionException ex) { - if (GUI.isVisualized()) { - GUI.showErrorDialog(GUI.getTopParentContainer(), "Error when starting plugin", ex, false); + if (Cooja.isVisualized()) { + Cooja.showErrorDialog(Cooja.getTopParentContainer(), "Error when starting plugin", ex, false); } else { /* If the plugin requires visualization, inform user */ Throwable cause = ex; @@ -1780,12 +1780,12 @@ public class GUI extends Observable { } public Plugin tryStartPlugin(final Class pluginClass, - final GUI argGUI, final Simulation argSimulation, final Mote argMote) { + final Cooja argGUI, final Simulation argSimulation, final Mote argMote) { return tryStartPlugin(pluginClass, argGUI, argSimulation, argMote, true); } public Plugin startPlugin(final Class pluginClass, - final GUI argGUI, final Simulation argSimulation, final Mote argMote) + final Cooja argGUI, final Simulation argSimulation, final Mote argMote) throws PluginConstructionException { return startPlugin(pluginClass, argGUI, argSimulation, argMote, true); @@ -1803,7 +1803,7 @@ public class GUI extends Observable { * @throws PluginConstructionException At errors */ private Plugin startPlugin(final Class pluginClass, - final GUI argGUI, final Simulation argSimulation, final Mote argMote, boolean activate) + final Cooja argGUI, final Simulation argSimulation, final Mote argMote, boolean activate) throws PluginConstructionException { @@ -1829,7 +1829,7 @@ public class GUI extends Observable { } plugin = - pluginClass.getConstructor(new Class[] { Mote.class, Simulation.class, GUI.class }) + pluginClass.getConstructor(new Class[] { Mote.class, Simulation.class, Cooja.class }) .newInstance(argMote, argSimulation, argGUI); } else if (pluginType == PluginType.SIM_PLUGIN @@ -1842,7 +1842,7 @@ public class GUI extends Observable { } plugin = - pluginClass.getConstructor(new Class[] { Simulation.class, GUI.class }) + pluginClass.getConstructor(new Class[] { Simulation.class, Cooja.class }) .newInstance(argSimulation, argGUI); } else if (pluginType == PluginType.COOJA_PLUGIN @@ -1852,7 +1852,7 @@ public class GUI extends Observable { } plugin = - pluginClass.getConstructor(new Class[] { GUI.class }) + pluginClass.getConstructor(new Class[] { Cooja.class }) .newInstance(argGUI); } else { @@ -1914,11 +1914,11 @@ public class GUI extends Observable { /* Check plugin constructor */ try { if (pluginType == PluginType.COOJA_PLUGIN || pluginType == PluginType.COOJA_STANDARD_PLUGIN) { - pluginClass.getConstructor(new Class[] { GUI.class }); + pluginClass.getConstructor(new Class[] { Cooja.class }); } else if (pluginType == PluginType.SIM_PLUGIN || pluginType == PluginType.SIM_STANDARD_PLUGIN) { - pluginClass.getConstructor(new Class[] { Simulation.class, GUI.class }); + pluginClass.getConstructor(new Class[] { Simulation.class, Cooja.class }); } else if (pluginType == PluginType.MOTE_PLUGIN) { - pluginClass.getConstructor(new Class[] { Mote.class, Simulation.class, GUI.class }); + pluginClass.getConstructor(new Class[] { Mote.class, Simulation.class, Cooja.class }); menuMotePluginClasses.add(pluginClass); } else { logger.fatal("Could not register plugin, bad plugin type: " + pluginType); @@ -2164,7 +2164,7 @@ public class GUI extends Observable { MoteType newMoteType = null; try { newMoteType = moteTypeClass.newInstance(); - if (!newMoteType.configureAndInit(GUI.getTopParentContainer(), mySimulation, isVisualized())) { + if (!newMoteType.configureAndInit(Cooja.getTopParentContainer(), mySimulation, isVisualized())) { return; } mySimulation.addMoteType(newMoteType); @@ -2201,7 +2201,7 @@ public class GUI extends Observable { String s1 = "Remove"; String s2 = "Cancel"; Object[] options = { s1, s2 }; - int n = JOptionPane.showOptionDialog(GUI.getTopParentContainer(), + int n = JOptionPane.showOptionDialog(Cooja.getTopParentContainer(), "You have an active simulation.\nDo you want to remove it?", "Remove current simulation?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, s2); @@ -2287,7 +2287,7 @@ public class GUI extends Observable { public File work() { JFileChooser fc = new JFileChooser(); - fc.setFileFilter(GUI.SAVED_SIMULATIONS_FILES); + fc.setFileFilter(Cooja.SAVED_SIMULATIONS_FILES); if (suggestedFile != null && suggestedFile.isDirectory()) { fc.setCurrentDirectory(suggestedFile); @@ -2299,7 +2299,7 @@ public class GUI extends Observable { } } - int returnVal = fc.showOpenDialog(GUI.getTopParentContainer()); + int returnVal = fc.showOpenDialog(Cooja.getTopParentContainer()); if (returnVal != JFileChooser.APPROVE_OPTION) { logger.info("Load command cancelled by user..."); return null; @@ -2337,7 +2337,7 @@ public class GUI extends Observable { progressDialog = new RunnableInEDT() { public JDialog work() { - final JDialog progressDialog = new JDialog((Window) GUI.getTopParentContainer(), progressTitle, ModalityType.APPLICATION_MODAL); + final JDialog progressDialog = new JDialog((Window) Cooja.getTopParentContainer(), progressTitle, ModalityType.APPLICATION_MODAL); JPanel progressPanel = new JPanel(new BorderLayout()); JProgressBar progressBar; @@ -2369,7 +2369,7 @@ public class GUI extends Observable { progressDialog.setSize(400, 200); progressDialog.getRootPane().setDefaultButton(button); - progressDialog.setLocationRelativeTo(GUI.getTopParentContainer()); + progressDialog.setLocationRelativeTo(Cooja.getTopParentContainer()); progressDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); java.awt.EventQueue.invokeLater(new Runnable() { @@ -2399,7 +2399,7 @@ public class GUI extends Observable { /* Optionally show compilation warnings */ boolean hideWarn = Boolean.parseBoolean( - GUI.getExternalToolsSetting("HIDE_WARNINGS", "false") + Cooja.getExternalToolsSetting("HIDE_WARNINGS", "false") ); if (quick && !hideWarn && !PROGRESS_WARNINGS.isEmpty()) { showWarningsDialog(frame, PROGRESS_WARNINGS.toArray(new String[0])); @@ -2407,9 +2407,9 @@ public class GUI extends Observable { PROGRESS_WARNINGS.clear(); } catch (UnsatisfiedLinkError e) { - shouldRetry = showErrorDialog(GUI.getTopParentContainer(), "Simulation load error", e, true); + shouldRetry = showErrorDialog(Cooja.getTopParentContainer(), "Simulation load error", e, true); } catch (SimulationCreationException e) { - shouldRetry = showErrorDialog(GUI.getTopParentContainer(), "Simulation load error", e, true); + shouldRetry = showErrorDialog(Cooja.getTopParentContainer(), "Simulation load error", e, true); } } while (shouldRetry); @@ -2468,7 +2468,7 @@ public class GUI extends Observable { /* Optionally show compilation warnings */ boolean hideWarn = Boolean.parseBoolean( - GUI.getExternalToolsSetting("HIDE_WARNINGS", "false") + Cooja.getExternalToolsSetting("HIDE_WARNINGS", "false") ); if (!hideWarn && !PROGRESS_WARNINGS.isEmpty()) { showWarningsDialog(frame, PROGRESS_WARNINGS.toArray(new String[0])); @@ -2539,7 +2539,7 @@ public class GUI extends Observable { logger.warn("Memory usage is getting critical. Reboot Cooja to avoid out of memory error. Current memory usage is " + format.format(100*memRatio) + "%."); if (isVisualized()) { int n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "Reboot Cooja to avoid out of memory error.\n" + "Current memory usage is " + format.format(100*memRatio) + "%.", "Out of memory warning", @@ -2584,7 +2584,7 @@ public class GUI extends Observable { mySimulation.stopSimulation(); JFileChooser fc = new JFileChooser(); - fc.setFileFilter(GUI.SAVED_SIMULATIONS_FILES); + fc.setFileFilter(Cooja.SAVED_SIMULATIONS_FILES); // Suggest file using history File suggestedFile = getLastOpenedFile(); @@ -2604,7 +2604,7 @@ public class GUI extends Observable { String s2 = "Cancel"; Object[] options = { s1, s2 }; int n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "A file with the same name already exists.\nDo you want to remove it?", "Overwrite existing file?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, s1); @@ -2664,7 +2664,7 @@ public class GUI extends Observable { // Create new simulation Simulation newSim = new Simulation(this); - boolean createdOK = CreateSimDialog.showDialog(GUI.getTopParentContainer(), newSim); + boolean createdOK = CreateSimDialog.showDialog(Cooja.getTopParentContainer(), newSim); if (createdOK) { myGUI.setSimulation(newSim, true); } @@ -2691,7 +2691,7 @@ public class GUI extends Observable { String s2 = "No"; String s3 = "Cancel"; Object[] options = { s1, s2, s3 }; - int n = JOptionPane.showOptionDialog(GUI.getTopParentContainer(), + int n = JOptionPane.showOptionDialog(Cooja.getTopParentContainer(), "Do you want to save the current simulation?", WINDOW_TITLE, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, options, s1); @@ -2809,24 +2809,24 @@ public class GUI extends Observable { String filename = null; if (osName.startsWith("win")) { - filename = GUI.EXTERNAL_TOOLS_WIN32_SETTINGS_FILENAME; + filename = Cooja.EXTERNAL_TOOLS_WIN32_SETTINGS_FILENAME; } else if (osName.startsWith("mac os x")) { - filename = GUI.EXTERNAL_TOOLS_MACOSX_SETTINGS_FILENAME; + filename = Cooja.EXTERNAL_TOOLS_MACOSX_SETTINGS_FILENAME; } else if (osName.startsWith("freebsd")) { - filename = GUI.EXTERNAL_TOOLS_FREEBSD_SETTINGS_FILENAME; + filename = Cooja.EXTERNAL_TOOLS_FREEBSD_SETTINGS_FILENAME; } else if (osName.startsWith("linux")) { - filename = GUI.EXTERNAL_TOOLS_LINUX_SETTINGS_FILENAME; + filename = Cooja.EXTERNAL_TOOLS_LINUX_SETTINGS_FILENAME; if (osArch.startsWith("amd64")) { - filename = GUI.EXTERNAL_TOOLS_LINUX_64_SETTINGS_FILENAME; + filename = Cooja.EXTERNAL_TOOLS_LINUX_64_SETTINGS_FILENAME; } } else { logger.warn("Unknown system: " + osName); logger.warn("Using default linux external tools configuration"); - filename = GUI.EXTERNAL_TOOLS_LINUX_SETTINGS_FILENAME; + filename = Cooja.EXTERNAL_TOOLS_LINUX_SETTINGS_FILENAME; } try { - InputStream in = GUI.class.getResourceAsStream(EXTERNAL_TOOLS_SETTINGS_FILENAME); + InputStream in = Cooja.class.getResourceAsStream(EXTERNAL_TOOLS_SETTINGS_FILENAME); if (in == null) { throw new FileNotFoundException(filename + " not found"); } @@ -2834,7 +2834,7 @@ public class GUI extends Observable { settings.load(in); in.close(); - in = GUI.class.getResourceAsStream(filename); + in = Cooja.class.getResourceAsStream(filename); if (in == null) { throw new FileNotFoundException(filename + " not found"); } @@ -2931,11 +2931,11 @@ public class GUI extends Observable { myGUI.doAddMotes((MoteType) ((JMenuItem) e.getSource()) .getClientProperty("motetype")); } else if (e.getActionCommand().equals("edit paths")) { - ExternalToolsDialog.showDialog(GUI.getTopParentContainer()); + ExternalToolsDialog.showDialog(Cooja.getTopParentContainer()); } else if (e.getActionCommand().equals("manage extensions")) { COOJAProject[] newProjects = ProjectDirectoriesDialog.showDialog( - GUI.getTopParentContainer(), - GUI.this, + Cooja.getTopParentContainer(), + Cooja.this, getProjects() ); if (newProjects != null) { @@ -2948,7 +2948,7 @@ public class GUI extends Observable { } catch (ParseProjectsException ex) { logger.fatal("Error when loading extensions: " + ex.getMessage(), ex); if (isVisualized()) { - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "All Cooja extensions could not load.\n\n" + "To manage Cooja extensions:\n" + "Menu->Settings->Cooja extensions", @@ -2958,7 +2958,7 @@ public class GUI extends Observable { } } } else if (e.getActionCommand().equals("configuration wizard")) { - ConfigurationWizard.startWizard(GUI.getTopParentContainer(), GUI.this); + ConfigurationWizard.startWizard(Cooja.getTopParentContainer(), Cooja.this); } else { logger.warn("Unhandled action: " + e.getActionCommand()); } @@ -3046,7 +3046,7 @@ public class GUI extends Observable { ProjectConfig projectConfig = new ProjectConfig(false); projectConfig.appendProjectDir(projectDir); String[] projectJarFiles = projectConfig.getStringArrayValue( - GUI.class, "JARFILES"); + Cooja.class, "JARFILES"); if (projectJarFiles != null && projectJarFiles.length > 0) { for (String jarfile : projectJarFiles) { File jarpath = findJarFile(projectDir, jarfile); @@ -3144,7 +3144,7 @@ public class GUI extends Observable { DOMConfigurator.configure(LOG_CONFIG_FILE); } else { // Used when starting from jar - DOMConfigurator.configure(GUI.class.getResource("/" + LOG_CONFIG_FILE)); + DOMConfigurator.configure(Cooja.class.getResource("/" + LOG_CONFIG_FILE)); } externalToolsUserSettingsFile = new File(System.getProperty("user.home"), EXTERNAL_TOOLS_USER_SETTINGS_FILENAME); @@ -3166,7 +3166,7 @@ public class GUI extends Observable { for (String element : args) { if (element.startsWith("-contiki=")) { String arg = element.substring("-contiki=".length()); - GUI.specifiedContikiPath = arg; + Cooja.specifiedContikiPath = arg; } if (element.startsWith("-external_tools_config=")) { @@ -3177,8 +3177,8 @@ public class GUI extends Observable { specifiedExternalToolsConfigFile = null; System.exit(1); } else { - GUI.externalToolsUserSettingsFile = specifiedExternalToolsConfigFile; - GUI.externalToolsUserSettingsFileReadOnly = true; + Cooja.externalToolsUserSettingsFile = specifiedExternalToolsConfigFile; + Cooja.externalToolsUserSettingsFileReadOnly = true; } } @@ -3230,7 +3230,7 @@ public class GUI extends Observable { if (sim == null) { System.exit(1); } - GUI gui = sim.getGUI(); + Cooja gui = sim.getGUI(); /* Make sure at least one test editor is controlling the simulation */ boolean hasEditor = false; @@ -3291,13 +3291,13 @@ public class GUI extends Observable { JDesktopPane desktop = createDesktopPane(); applet = CoojaApplet.applet; - GUI gui = new GUI(desktop); + Cooja gui = new Cooja(desktop); - GUI.setExternalToolsSetting("PATH_CONTIKI_BUILD", buildPath); - GUI.setExternalToolsSetting("PATH_CONTIKI_WEB", webPath); + Cooja.setExternalToolsSetting("PATH_CONTIKI_BUILD", buildPath); + Cooja.setExternalToolsSetting("PATH_CONTIKI_WEB", webPath); - GUI.setExternalToolsSetting("SKY_FIRMWARE", skyFirmware); - GUI.setExternalToolsSetting("ESB_FIRMWARE", esbFirmware); + Cooja.setExternalToolsSetting("SKY_FIRMWARE", skyFirmware); + Cooja.setExternalToolsSetting("ESB_FIRMWARE", esbFirmware); configureApplet(gui, false); } @@ -3310,7 +3310,7 @@ public class GUI extends Observable { public void run() { JDesktopPane desktop = createDesktopPane(); frame = new JFrame(WINDOW_TITLE); - GUI gui = new GUI(desktop); + Cooja gui = new Cooja(desktop); configureFrame(gui, false); } }); @@ -3927,7 +3927,7 @@ public class GUI extends Observable { JCheckBox hideButton = new JCheckBox("Hide compilation warnings", false); hideButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - GUI.setExternalToolsSetting("HIDE_WARNINGS", + Cooja.setExternalToolsSetting("HIDE_WARNINGS", "" + ((JCheckBox)e.getSource()).isSelected()); }; }); @@ -4171,11 +4171,11 @@ public class GUI extends Observable { String fileCanonical = file.getCanonicalPath(); //No so nice, but goes along with GUI.getExternalToolsSetting - String defp = GUI.getExternalToolsSetting("PATH_CONTIKI", null); + String defp = Cooja.getExternalToolsSetting("PATH_CONTIKI", null); for(int i = 0; i < elem; i++){ - path[i] = new File(GUI.getExternalToolsSetting(PATH_IDENTIFIER[i][1], defp + PATH_IDENTIFIER[i][2])); + path[i] = new File(Cooja.getExternalToolsSetting(PATH_IDENTIFIER[i][1], defp + PATH_IDENTIFIER[i][2])); canonicals[i] = path[i].getCanonicalPath(); if (fileCanonical.startsWith(canonicals[i])){ if(mlength < canonicals[i].length()){ @@ -4232,8 +4232,8 @@ public class GUI extends Observable { //logger.info("Found: " + PATH_IDENTIFIER[i][0]); //No so nice, but goes along with GUI.getExternalToolsSetting - String defp = GUI.getExternalToolsSetting("PATH_CONTIKI", null); - path = new File(GUI.getExternalToolsSetting(PATH_IDENTIFIER[i][1], defp + PATH_IDENTIFIER[i][2])); + String defp = Cooja.getExternalToolsSetting("PATH_CONTIKI", null); + path = new File(Cooja.getExternalToolsSetting(PATH_IDENTIFIER[i][1], defp + PATH_IDENTIFIER[i][2])); //logger.info("Config: " + PATH_IDENTIFIER[i][1] + ", " + defp + PATH_IDENTIFIER[i][2] + " = " + path.toString()); canonical = path.getCanonicalPath(); @@ -4505,7 +4505,7 @@ public class GUI extends Observable { /* Info message */ String[] options = new String[] { "OK", "Cancel" }; int n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "This function attempts to build an executable Cooja JAR from the current simulation.\n" + "The JAR will contain all simulation dependencies, including extension JAR files and mote firmware files.\n" + "\nExecutable simulations can be used to run already prepared simulations on several computers.\n" + @@ -4538,7 +4538,7 @@ public class GUI extends Observable { fc.setFileFilter(jarFilter); File suggest = new File(getExternalToolsSetting("EXECUTE_JAR_LAST", "cooja_simulation.jar")); fc.setSelectedFile(suggest); - int returnVal = fc.showSaveDialog(GUI.getTopParentContainer()); + int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer()); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } @@ -4546,7 +4546,7 @@ public class GUI extends Observable { if (outputFile.exists()) { options = new String[] { "Overwrite", "Cancel" }; n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "A file with the same name already exists.\nDo you want to remove it?", "Overwrite existing file?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); @@ -4561,9 +4561,9 @@ public class GUI extends Observable { new Thread() { public void run() { try { - ExecuteJAR.buildExecutableJAR(GUI.this, finalOutputFile); + ExecuteJAR.buildExecutableJAR(Cooja.this, finalOutputFile); } catch (RuntimeException ex) { - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } diff --git a/tools/cooja/java/se/sics/cooja/CoojaApplet.java b/tools/cooja/java/se/sics/cooja/CoojaApplet.java index 46456dd39..f241e766c 100644 --- a/tools/cooja/java/se/sics/cooja/CoojaApplet.java +++ b/tools/cooja/java/se/sics/cooja/CoojaApplet.java @@ -51,7 +51,7 @@ public class CoojaApplet extends JApplet { esbFirmware = ""; } - GUI.main(new String[] { + Cooja.main(new String[] { "-applet ", "-esb_firmware=" + esbFirmware, "-sky_firmware=" + skyFirmware, diff --git a/tools/cooja/java/se/sics/cooja/CoreComm.java b/tools/cooja/java/se/sics/cooja/CoreComm.java index 1e69e4f8f..850567d82 100644 --- a/tools/cooja/java/se/sics/cooja/CoreComm.java +++ b/tools/cooja/java/se/sics/cooja/CoreComm.java @@ -134,7 +134,7 @@ public abstract class CoreComm { try { Reader reader; - String mainTemplate = GUI + String mainTemplate = Cooja .getExternalToolsSetting("CORECOMM_TEMPLATE_FILENAME"); if ((new File(mainTemplate)).exists()) { @@ -213,7 +213,7 @@ public abstract class CoreComm { try { int b; - String[] cmd = new String[] { GUI.getExternalToolsSetting("PATH_JAVAC"), + String[] cmd = new String[] { Cooja.getExternalToolsSetting("PATH_JAVAC"), "-version", "se/sics/cooja/corecomm/" + className + ".java" }; Process p = Runtime.getRuntime().exec(cmd, null, null); @@ -233,11 +233,11 @@ public abstract class CoreComm { // Try including cooja.jar cmd = new String[] { - GUI.getExternalToolsSetting("PATH_JAVAC"), + Cooja.getExternalToolsSetting("PATH_JAVAC"), "-version", "se/sics/cooja/corecomm/" + className + ".java", "-cp", - GUI.getExternalToolsSetting("PATH_CONTIKI") + Cooja.getExternalToolsSetting("PATH_CONTIKI") + "/tools/cooja/dist/cooja.jar" }; p = Runtime.getRuntime().exec(cmd, null, null); diff --git a/tools/cooja/java/se/sics/cooja/ProjectConfig.java b/tools/cooja/java/se/sics/cooja/ProjectConfig.java index 85a31bf2f..fcafeeec1 100644 --- a/tools/cooja/java/se/sics/cooja/ProjectConfig.java +++ b/tools/cooja/java/se/sics/cooja/ProjectConfig.java @@ -107,8 +107,8 @@ public class ProjectConfig { if (useDefault) { - InputStream input = GUI.class - .getResourceAsStream(GUI.PROJECT_DEFAULT_CONFIG_FILENAME); + InputStream input = Cooja.class + .getResourceAsStream(Cooja.PROJECT_DEFAULT_CONFIG_FILENAME); if (input != null) { try { appendConfigStream(input); @@ -116,7 +116,7 @@ public class ProjectConfig { input.close(); } } else { - throw new FileNotFoundException(GUI.PROJECT_DEFAULT_CONFIG_FILENAME); + throw new FileNotFoundException(Cooja.PROJECT_DEFAULT_CONFIG_FILENAME); } } } @@ -142,7 +142,7 @@ public class ProjectConfig { throw new FileNotFoundException("Project directory does not exist: " + projectDir.getAbsolutePath()); } - File projectConfig = new File(projectDir.getPath(), GUI.PROJECT_CONFIG_FILENAME); + File projectConfig = new File(projectDir.getPath(), Cooja.PROJECT_CONFIG_FILENAME); if (!projectConfig.exists()) { throw new FileNotFoundException("Project config does not exist: " + projectConfig.getAbsolutePath()); } diff --git a/tools/cooja/java/se/sics/cooja/SimEventCentral.java b/tools/cooja/java/se/sics/cooja/SimEventCentral.java index 947a2888c..24bd1e59c 100644 --- a/tools/cooja/java/se/sics/cooja/SimEventCentral.java +++ b/tools/cooja/java/se/sics/cooja/SimEventCentral.java @@ -61,7 +61,7 @@ public class SimEventCentral { this.simulation = simulation; /* Default buffer sizes */ - logOutputBufferSize = Integer.parseInt(GUI.getExternalToolsSetting("BUFFERSIZE_LOGOUTPUT", "" + 40000)); + logOutputBufferSize = Integer.parseInt(Cooja.getExternalToolsSetting("BUFFERSIZE_LOGOUTPUT", "" + 40000)); moteObservations = new ArrayList(); diff --git a/tools/cooja/java/se/sics/cooja/Simulation.java b/tools/cooja/java/se/sics/cooja/Simulation.java index 0286c8da6..4e26112fc 100644 --- a/tools/cooja/java/se/sics/cooja/Simulation.java +++ b/tools/cooja/java/se/sics/cooja/Simulation.java @@ -85,7 +85,7 @@ public class Simulation extends Observable implements Runnable { private Thread simulationThread = null; - private GUI myGUI = null; + private Cooja myGUI = null; private long randomSeed = 123456; @@ -290,7 +290,7 @@ public class Simulation extends Observable implements Runnable { } else { logger.fatal("Simulation stopped due to error: " + e.getMessage(), e); - if (!GUI.isVisualized()) { + if (!Cooja.isVisualized()) { /* Quit simulator if in test mode */ System.exit(1); } else { @@ -298,7 +298,7 @@ public class Simulation extends Observable implements Runnable { if (nextEvent instanceof MoteTimeEvent) { title += ": " + ((MoteTimeEvent)nextEvent).getMote(); } - GUI.showErrorDialog(GUI.getTopParentContainer(), title, e, false); + Cooja.showErrorDialog(Cooja.getTopParentContainer(), title, e, false); } } } @@ -320,7 +320,7 @@ public class Simulation extends Observable implements Runnable { /** * Creates a new simulation */ - public Simulation(GUI gui) { + public Simulation(Cooja gui) { myGUI = gui; } @@ -396,7 +396,7 @@ public class Simulation extends Observable implements Runnable { /** * @return GUI holding this simulation */ - public GUI getGUI() { + public Cooja getGUI() { return myGUI; } @@ -619,7 +619,7 @@ public class Simulation extends Observable implements Runnable { // Show configure simulation dialog boolean createdOK = false; if (visAvailable) { - createdOK = CreateSimDialog.showDialog(GUI.getTopParentContainer(), this); + createdOK = CreateSimDialog.showDialog(Cooja.getTopParentContainer(), this); } else { createdOK = true; } @@ -648,9 +648,9 @@ public class Simulation extends Observable implements Runnable { /* Try to recreate simulation using a different mote type */ if (visAvailable) { - String[] availableMoteTypes = getGUI().getProjectConfig().getStringArrayValue("se.sics.cooja.GUI.MOTETYPES"); + String[] availableMoteTypes = getGUI().getProjectConfig().getStringArrayValue("se.sics.cooja.Cooja.MOTETYPES"); String newClass = (String) JOptionPane.showInputDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "The simulation is about to load '" + moteTypeClassName + "'\n" + "You may try to load the simulation using a different mote type.\n", "Loading mote type", diff --git a/tools/cooja/java/se/sics/cooja/SupportedArguments.java b/tools/cooja/java/se/sics/cooja/SupportedArguments.java index 0b1d5ceed..546b648da 100644 --- a/tools/cooja/java/se/sics/cooja/SupportedArguments.java +++ b/tools/cooja/java/se/sics/cooja/SupportedArguments.java @@ -43,7 +43,7 @@ import se.sics.cooja.plugins.skins.DGRMVisualizerSkin; * * See below code usage examples. * - * @see GUI#createMotePluginsSubmenu(Mote) + * @see Cooja#createMotePluginsSubmenu(Mote) * @see Visualizer#populateSkinMenu(MenuElement) * @see DGRMVisualizerSkin * diff --git a/tools/cooja/java/se/sics/cooja/VisPlugin.java b/tools/cooja/java/se/sics/cooja/VisPlugin.java index 968ce2761..50a477947 100644 --- a/tools/cooja/java/se/sics/cooja/VisPlugin.java +++ b/tools/cooja/java/se/sics/cooja/VisPlugin.java @@ -54,14 +54,14 @@ import se.sics.cooja.plugins.SimControl; */ public abstract class VisPlugin extends JInternalFrame implements Plugin { - public VisPlugin(String title, final GUI gui) { + public VisPlugin(String title, final Cooja gui) { this(title, gui, true); } - public VisPlugin(String title, final GUI gui, boolean requiresVis) { + public VisPlugin(String title, final Cooja gui, boolean requiresVis) { super(title, true, true, true, true); - if (requiresVis && !GUI.isVisualized()) { + if (requiresVis && !Cooja.isVisualized()) { throw new PluginRequiresVisualizationException(); } diff --git a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java index 3574c76ab..8a3622ff8 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java @@ -57,7 +57,7 @@ import org.jdom.Element; import se.sics.cooja.AbstractionLevelDescription; import se.sics.cooja.ClassDescription; import se.sics.cooja.CoreComm; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; @@ -385,7 +385,7 @@ public class ContikiMoteType implements MoteType { myCoreComm = CoreComm.createCoreComm(this.javaClassName, getContikiFirmwareFile()); /* Parse addresses using map file or command */ - boolean useCommand = Boolean.parseBoolean(GUI.getExternalToolsSetting("PARSE_WITH_COMMAND", "false")); + boolean useCommand = Boolean.parseBoolean(Cooja.getExternalToolsSetting("PARSE_WITH_COMMAND", "false")); int dataSectionAddr = -1, dataSectionSize = -1; int bssSectionAddr = -1, bssSectionSize = -1; @@ -612,7 +612,7 @@ public class ContikiMoteType implements MoteType { int nrNew = 0, nrOld = 0, nrMismatch = 0; Pattern pattern = - Pattern.compile(GUI.getExternalToolsSetting("COMMAND_VAR_NAME_ADDRESS")); + Pattern.compile(Cooja.getExternalToolsSetting("COMMAND_VAR_NAME_ADDRESS")); for (String line : output) { Matcher matcher = pattern.matcher(line); @@ -738,9 +738,9 @@ public class ContikiMoteType implements MoteType { } String regExp = - GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_1") + + Cooja.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_1") + varName + - GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_2"); + Cooja.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_2"); String retString = getFirstMatchGroup(mapFileData, regExp, 1); if (retString != null) { @@ -804,7 +804,7 @@ public class ContikiMoteType implements MoteType { int startAddress, int endAddress) { ArrayList varNames = new ArrayList(); - Pattern pattern = Pattern.compile(GUI.getExternalToolsSetting("MAPFILE_VAR_NAME")); + Pattern pattern = Pattern.compile(Cooja.getExternalToolsSetting("MAPFILE_VAR_NAME")); for (String line : lines) { Matcher matcher = pattern.matcher(line); if (matcher.find()) { @@ -819,9 +819,9 @@ public class ContikiMoteType implements MoteType { protected int getVariableSize(Vector lines, String varName) { Pattern pattern = Pattern.compile( - GUI.getExternalToolsSetting("MAPFILE_VAR_SIZE_1") + + Cooja.getExternalToolsSetting("MAPFILE_VAR_SIZE_1") + varName + - GUI.getExternalToolsSetting("MAPFILE_VAR_SIZE_2")); + Cooja.getExternalToolsSetting("MAPFILE_VAR_SIZE_2")); for (int i = 0; i < lines.size(); i++) { Matcher matcher = pattern.matcher(lines.get(i)); if (matcher.find()) { @@ -843,42 +843,42 @@ public class ContikiMoteType implements MoteType { } public static int parseMapDataSectionAddr(String[] mapFileData) { - String regexp = GUI.getExternalToolsSetting("MAPFILE_DATA_START", ""); + String regexp = Cooja.getExternalToolsSetting("MAPFILE_DATA_START", ""); if (regexp.equals("")) { return -1; } return parseFirstHexInt(regexp, mapFileData); } public static int parseMapDataSectionSize(String[] mapFileData) { - String regexp = GUI.getExternalToolsSetting("MAPFILE_DATA_SIZE", ""); + String regexp = Cooja.getExternalToolsSetting("MAPFILE_DATA_SIZE", ""); if (regexp.equals("")) { return -1; } return parseFirstHexInt(regexp, mapFileData); } public static int parseMapBssSectionAddr(String[] mapFileData) { - String regexp = GUI.getExternalToolsSetting("MAPFILE_BSS_START", ""); + String regexp = Cooja.getExternalToolsSetting("MAPFILE_BSS_START", ""); if (regexp.equals("")) { return -1; } return parseFirstHexInt(regexp, mapFileData); } public static int parseMapBssSectionSize(String[] mapFileData) { - String regexp = GUI.getExternalToolsSetting("MAPFILE_BSS_SIZE", ""); + String regexp = Cooja.getExternalToolsSetting("MAPFILE_BSS_SIZE", ""); if (regexp.equals("")) { return -1; } return parseFirstHexInt(regexp, mapFileData); } public static int parseMapCommonSectionAddr(String[] mapFileData) { - String regexp = GUI.getExternalToolsSetting("MAPFILE_COMMON_START", ""); + String regexp = Cooja.getExternalToolsSetting("MAPFILE_COMMON_START", ""); if (regexp.equals("")) { return -1; } return parseFirstHexInt(regexp, mapFileData); } public static int parseMapCommonSectionSize(String[] mapFileData) { - String regexp = GUI.getExternalToolsSetting("MAPFILE_COMMON_SIZE", ""); + String regexp = Cooja.getExternalToolsSetting("MAPFILE_COMMON_SIZE", ""); if (regexp.equals("")) { return -1; } @@ -886,14 +886,14 @@ public class ContikiMoteType implements MoteType { } public static int parseCommandDataSectionAddr(String[] output) { - String regexp = GUI.getExternalToolsSetting("COMMAND_DATA_START", ""); + String regexp = Cooja.getExternalToolsSetting("COMMAND_DATA_START", ""); if (regexp.equals("")) { return -1; } return parseFirstHexInt(regexp, output); } public static int parseCommandDataSectionSize(String[] output) { - String regexp = GUI.getExternalToolsSetting("COMMAND_DATA_END", ""); + String regexp = Cooja.getExternalToolsSetting("COMMAND_DATA_END", ""); if (regexp.equals("")) { return -1; } @@ -909,14 +909,14 @@ public class ContikiMoteType implements MoteType { return end - start; } public static int parseCommandBssSectionAddr(String[] output) { - String regexp = GUI.getExternalToolsSetting("COMMAND_BSS_START", ""); + String regexp = Cooja.getExternalToolsSetting("COMMAND_BSS_START", ""); if (regexp.equals("")) { return -1; } return parseFirstHexInt(regexp, output); } public static int parseCommandBssSectionSize(String[] output) { - String regexp = GUI.getExternalToolsSetting("COMMAND_BSS_END", ""); + String regexp = Cooja.getExternalToolsSetting("COMMAND_BSS_END", ""); if (regexp.equals("")) { return -1; } @@ -932,14 +932,14 @@ public class ContikiMoteType implements MoteType { return end - start; } public static int parseCommandCommonSectionAddr(String[] output) { - String regexp = GUI.getExternalToolsSetting("COMMAND_COMMON_START", ""); + String regexp = Cooja.getExternalToolsSetting("COMMAND_COMMON_START", ""); if (regexp.equals("")) { return -1; } return parseFirstHexInt(regexp, output); } public static int parseCommandCommonSectionSize(String[] output) { - String regexp = GUI.getExternalToolsSetting("COMMAND_COMMON_END", ""); + String regexp = Cooja.getExternalToolsSetting("COMMAND_COMMON_END", ""); if (regexp.equals("")) { return -1; } @@ -972,9 +972,9 @@ public class ContikiMoteType implements MoteType { private static int getRelVarAddr(String mapFileData[], String varName) { String regExp = - GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_1") + + Cooja.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_1") + varName + - GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_2"); + Cooja.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_2"); String retString = getFirstMatchGroup(mapFileData, regExp, 1); if (retString != null) { @@ -1002,7 +1002,7 @@ public class ContikiMoteType implements MoteType { ArrayList output = new ArrayList(); try { - String command = GUI.getExternalToolsSetting("PARSE_COMMAND"); + String command = Cooja.getExternalToolsSetting("PARSE_COMMAND"); if (command == null) { return null; } @@ -1386,7 +1386,7 @@ public class ContikiMoteType implements MoteType { setCompileCommands(compileCommands); } - boolean createdOK = configureAndInit(GUI.getTopParentContainer(), simulation, visAvailable); + boolean createdOK = configureAndInit(Cooja.getTopParentContainer(), simulation, visAvailable); return createdOK; } diff --git a/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java index 2ff2d9160..8562ee18b 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/AbstractCompileDialog.java @@ -73,7 +73,7 @@ import javax.swing.filechooser.FileFilter; import org.apache.log4j.Logger; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; import se.sics.cooja.Simulation; @@ -108,7 +108,7 @@ public abstract class AbstractCompileDialog extends JDialog { } protected Simulation simulation; - protected GUI gui; + protected Cooja gui; protected MoteType moteType; protected JTabbedPane tabbedPane; @@ -189,7 +189,7 @@ public abstract class AbstractCompileDialog extends JDialog { lastFile = fp; } if (lastFile == null) { - String path = GUI.getExternalToolsSetting("COMPILE_LAST_FILE", null); + String path = Cooja.getExternalToolsSetting("COMPILE_LAST_FILE", null); if (path != null) { lastFile = new File(path); lastFile = gui.restorePortablePath(lastFile); @@ -209,7 +209,7 @@ public abstract class AbstractCompileDialog extends JDialog { } else { File helloworldSourceFile = new java.io.File( - GUI.getExternalToolsSetting("PATH_CONTIKI"), "examples/hello-world/hello-world.c"); + Cooja.getExternalToolsSetting("PATH_CONTIKI"), "examples/hello-world/hello-world.c"); try { helloworldSourceFile = helloworldSourceFile.getCanonicalFile(); fc.setCurrentDirectory(helloworldSourceFile.getParentFile()); @@ -579,7 +579,7 @@ public abstract class AbstractCompileDialog extends JDialog { } lastFile = file; - GUI.setExternalToolsSetting("COMPILE_LAST_FILE", gui.createPortablePath(lastFile).getPath()); + Cooja.setExternalToolsSetting("COMPILE_LAST_FILE", gui.createPortablePath(lastFile).getPath()); if (file.getName().endsWith(".c")) { setDialogState(DialogState.SELECTED_SOURCE); @@ -797,7 +797,7 @@ public abstract class AbstractCompileDialog extends JDialog { } /* Create new mote interface checkbox */ - JCheckBox intfCheckBox = new JCheckBox(GUI.getDescriptionOf(intfClass)); + JCheckBox intfCheckBox = new JCheckBox(Cooja.getDescriptionOf(intfClass)); intfCheckBox.setSelected(selected); intfCheckBox.putClientProperty("class", intfClass); intfCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); diff --git a/tools/cooja/java/se/sics/cooja/dialogs/AddMoteDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/AddMoteDialog.java index 4d3bcdcaa..8c0d7c199 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/AddMoteDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/AddMoteDialog.java @@ -62,7 +62,7 @@ import javax.swing.SwingUtilities; import org.apache.log4j.Logger; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MoteType; import se.sics.cooja.Positioner; @@ -215,7 +215,7 @@ public class AddMoteDialog extends JDialog { .getRegisteredPositioners(); String[] posDistributions = new String[positioners.size()]; for (int i = 0; i < posDistributions.length; i++) { - posDistributions[i] = GUI.getDescriptionOf(positioners.get(i)); + posDistributions[i] = Cooja.getDescriptionOf(positioners.get(i)); } comboBox = new JComboBox(posDistributions); @@ -465,7 +465,7 @@ public class AddMoteDialog extends JDialog { Class positionerClass = null; for (Class positioner : simulation.getGUI() .getRegisteredPositioners()) { - if (GUI.getDescriptionOf(positioner).equals( + if (Cooja.getDescriptionOf(positioner).equals( positionDistributionBox.getSelectedItem())) { positionerClass = positioner; } diff --git a/tools/cooja/java/se/sics/cooja/dialogs/BufferSettings.java b/tools/cooja/java/se/sics/cooja/dialogs/BufferSettings.java index 9c45f6df6..d6c51d6d3 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/BufferSettings.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/BufferSettings.java @@ -53,7 +53,7 @@ import javax.swing.KeyStroke; import org.apache.log4j.Logger; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.SimEventCentral; import se.sics.cooja.Simulation; @@ -65,7 +65,7 @@ public class BufferSettings extends JDialog { private SimEventCentral central; public static void showDialog(JDesktopPane parent, Simulation simulation) { - if (GUI.isVisualizedInApplet()) { + if (Cooja.isVisualizedInApplet()) { return; } @@ -145,7 +145,7 @@ public class BufferSettings extends JDialog { return; } - GUI.setExternalToolsSetting("BUFFERSIZE_LOGOUTPUT", "" + central.getLogOutputBufferSize()); + Cooja.setExternalToolsSetting("BUFFERSIZE_LOGOUTPUT", "" + central.getLogOutputBufferSize()); } }; diff --git a/tools/cooja/java/se/sics/cooja/dialogs/CompileContiki.java b/tools/cooja/java/se/sics/cooja/dialogs/CompileContiki.java index 3d9786ae2..78cf2fc58 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/CompileContiki.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/CompileContiki.java @@ -49,7 +49,7 @@ import javax.swing.Action; import org.apache.log4j.Logger; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteType; import se.sics.cooja.MoteType.MoteTypeCreationException; import se.sics.cooja.contikimote.ContikiMoteType; @@ -359,7 +359,7 @@ public class CompileContiki { BufferedWriter sourceFileWriter = null; try { Reader reader; - String mainTemplate = GUI.getExternalToolsSetting("CONTIKI_MAIN_TEMPLATE_FILENAME"); + String mainTemplate = Cooja.getExternalToolsSetting("CONTIKI_MAIN_TEMPLATE_FILENAME"); if ((new File(mainTemplate)).exists()) { reader = new FileReader(mainTemplate); } else { @@ -455,11 +455,11 @@ public class CompileContiki { boolean includeSymbols = false; /* TODO */ /* Fetch configuration from external tools */ - String link1 = GUI.getExternalToolsSetting("LINK_COMMAND_1", ""); - String link2 = GUI.getExternalToolsSetting("LINK_COMMAND_2", ""); - String ar1 = GUI.getExternalToolsSetting("AR_COMMAND_1", ""); - String ar2 = GUI.getExternalToolsSetting("AR_COMMAND_2", ""); - String ccFlags = GUI.getExternalToolsSetting("COMPILER_ARGS", ""); + String link1 = Cooja.getExternalToolsSetting("LINK_COMMAND_1", ""); + String link2 = Cooja.getExternalToolsSetting("LINK_COMMAND_2", ""); + String ar1 = Cooja.getExternalToolsSetting("AR_COMMAND_1", ""); + String ar2 = Cooja.getExternalToolsSetting("AR_COMMAND_2", ""); + String ccFlags = Cooja.getExternalToolsSetting("COMPILER_ARGS", ""); /* Replace MAPFILE variable */ link1 = link1.replace("$(MAPFILE)", "obj_cooja/" + mapFile.getName()); @@ -503,13 +503,13 @@ public class CompileContiki { env.add(new String[] { "CONTIKI_APP", contikiAppNoExtension }); env.add(new String[] { "COOJA_SOURCEDIRS", "" }); env.add(new String[] { "COOJA_SOURCEFILES", "" }); - env.add(new String[] { "CC", GUI.getExternalToolsSetting("PATH_C_COMPILER") }); - env.add(new String[] { "OBJCOPY", GUI.getExternalToolsSetting("PATH_OBJCOPY") }); + env.add(new String[] { "CC", Cooja.getExternalToolsSetting("PATH_C_COMPILER") }); + env.add(new String[] { "OBJCOPY", Cooja.getExternalToolsSetting("PATH_OBJCOPY") }); env.add(new String[] { "EXTRA_CC_ARGS", ccFlags }); - env.add(new String[] { "LD", GUI.getExternalToolsSetting("PATH_LINKER") }); + env.add(new String[] { "LD", Cooja.getExternalToolsSetting("PATH_LINKER") }); env.add(new String[] { "LINK_COMMAND_1", link1 }); env.add(new String[] { "LINK_COMMAND_2", link2 }); - env.add(new String[] { "AR", GUI.getExternalToolsSetting("PATH_AR") }); + env.add(new String[] { "AR", Cooja.getExternalToolsSetting("PATH_AR") }); env.add(new String[] { "AR_COMMAND_1", ar1 }); env.add(new String[] { "AR_COMMAND_2", ar2 }); env.add(new String[] { "SYMBOLS", includeSymbols?"1":"" }); diff --git a/tools/cooja/java/se/sics/cooja/dialogs/ConfigurationWizard.java b/tools/cooja/java/se/sics/cooja/dialogs/ConfigurationWizard.java index b26ebeaf4..a371e4dcc 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/ConfigurationWizard.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/ConfigurationWizard.java @@ -64,7 +64,7 @@ import javax.swing.JProgressBar; import javax.swing.JScrollPane; import se.sics.cooja.CoreComm; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteType.MoteTypeCreationException; import se.sics.cooja.SectionMoteMemory; import se.sics.cooja.contikimote.ContikiMoteType; @@ -152,8 +152,8 @@ public class ConfigurationWizard extends JDialog { private static JButton button; private static JProgressBar progressBar; - public static boolean startWizard(Container parentContainer, GUI gui) { - if (GUI.isVisualizedInApplet()) { + public static boolean startWizard(Container parentContainer, Cooja gui) { + if (Cooja.isVisualizedInApplet()) { return false; } @@ -185,7 +185,7 @@ public class ConfigurationWizard extends JDialog { return true; } - public static boolean showWizardInfo(Container parent, GUI gui) { + public static boolean showWizardInfo(Container parent, Cooja gui) { String options[] = {"Start tests", OPTION_CLOSE_WIZARD}; int value = JOptionPane.showOptionDialog(parent, "This wizard configures and tests your toolchain for simulation of Cooja motes.\n" + @@ -206,7 +206,7 @@ public class ConfigurationWizard extends JDialog { return true; } - public static boolean doCompileCTest(JFrame parent, GUI gui) { + public static boolean doCompileCTest(JFrame parent, Cooja gui) { final String testDescription = "Step 1/4 - Compile and link Contiki library"; String value = OPTION_RUN_TEST; while (value.equals(OPTION_RUN_TEST)) { @@ -260,7 +260,7 @@ public class ConfigurationWizard extends JDialog { return false; } - public static boolean doLoadLibraryTest(JFrame parent, GUI gui) { + public static boolean doLoadLibraryTest(JFrame parent, Cooja gui) { final String testDescription = "Step 2/4 - Load Contiki library in Java"; String value = OPTION_RUN_TEST; while (value.equals(OPTION_RUN_TEST)) { @@ -315,7 +315,7 @@ public class ConfigurationWizard extends JDialog { return false; } - public static boolean doAddressParsingTest(JFrame parent, GUI gui) { + public static boolean doAddressParsingTest(JFrame parent, Cooja gui) { final String testDescription = "Step 3/4 - Library memory addresses"; String value = OPTION_RUN_TEST; while (value.equals(OPTION_RUN_TEST)) { @@ -371,7 +371,7 @@ public class ConfigurationWizard extends JDialog { return false; } - public static boolean doMemoryReplacementTest(JFrame parent, GUI gui) { + public static boolean doMemoryReplacementTest(JFrame parent, Cooja gui) { final String testDescription = "Step 4/4 - Memory replacement test"; String value = OPTION_RUN_TEST; while (value.equals(OPTION_RUN_TEST)) { @@ -462,7 +462,7 @@ public class ConfigurationWizard extends JDialog { private static JPanel createConfigureComboBox(final String name) { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); - JComboBox combo = new JComboBox(new Object[] { GUI.getExternalToolsSetting(name, "") }); + JComboBox combo = new JComboBox(new Object[] { Cooja.getExternalToolsSetting(name, "") }); JLabel label = new JLabel(name); label.setToolTipText(name); @@ -490,7 +490,7 @@ public class ConfigurationWizard extends JDialog { } combo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { - GUI.setExternalToolsSetting(name, (String) e.getItem()); + Cooja.setExternalToolsSetting(name, (String) e.getItem()); } }); combo.setEditable(true); @@ -616,7 +616,7 @@ public class ConfigurationWizard extends JDialog { testOutput.addMessage("### Compiling C library source: " + cLibrarySourceFile.getName()); try { - String contikiPath = GUI.getExternalToolsSetting("PATH_CONTIKI").replaceAll("\\\\", "/"); + String contikiPath = Cooja.getExternalToolsSetting("PATH_CONTIKI").replaceAll("\\\\", "/"); CompileContiki.compile( "make " + "-f " + contikiPath + "/Makefile.include " + @@ -711,7 +711,7 @@ public class ConfigurationWizard extends JDialog { testOutput.addMessage(""); successCommand = performCommandAddressTest(testOutput, normalStream, errorStream); - boolean parseWithCommand = Boolean.parseBoolean(GUI.getExternalToolsSetting("PARSE_WITH_COMMAND", "false")); + boolean parseWithCommand = Boolean.parseBoolean(Cooja.getExternalToolsSetting("PARSE_WITH_COMMAND", "false")); if (successMap && successCommand) { testOutput.addMessage("### Both map file and command based address parsing succeeded"); @@ -916,7 +916,7 @@ public class ConfigurationWizard extends JDialog { if (!performLoadTest(dummy, dummyStream, errorStream)) { return false; } - boolean parseWithCommand = Boolean.parseBoolean(GUI.getExternalToolsSetting("PARSE_WITH_COMMAND", "false")); + boolean parseWithCommand = Boolean.parseBoolean(Cooja.getExternalToolsSetting("PARSE_WITH_COMMAND", "false")); if (parseWithCommand) { if (!performCommandAddressTest(dummy, dummyStream, errorStream)) { return false; diff --git a/tools/cooja/java/se/sics/cooja/dialogs/ContikiMoteCompileDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/ContikiMoteCompileDialog.java index d87a0a6b7..79c50a5ed 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/ContikiMoteCompileDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/ContikiMoteCompileDialog.java @@ -56,7 +56,7 @@ import javax.swing.event.DocumentListener; import org.apache.log4j.Logger; import se.sics.cooja.CoreComm; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; import se.sics.cooja.ProjectConfig; @@ -211,7 +211,7 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog { return /*"make clean TARGET=cooja\n" + */ - GUI.getExternalToolsSetting("PATH_MAKE") + " " + getExpectedFirmwareFile(source).getName() + " TARGET=cooja" + defines; + Cooja.getExternalToolsSetting("PATH_MAKE") + " " + getExpectedFirmwareFile(source).getName() + " TARGET=cooja" + defines; } public File getExpectedFirmwareFile(File source) { @@ -326,7 +326,7 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog { button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { /* Show external tools dialog */ - ExternalToolsDialog.showDialog(GUI.getTopParentContainer()); + ExternalToolsDialog.showDialog(Cooja.getTopParentContainer()); /* Update and select environment tab */ SwingUtilities.invokeLater(new Runnable() { diff --git a/tools/cooja/java/se/sics/cooja/dialogs/CreateSimDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/CreateSimDialog.java index 735b1a7de..8d3cdfb2a 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/CreateSimDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/CreateSimDialog.java @@ -60,7 +60,7 @@ import javax.swing.KeyStroke; import org.apache.log4j.Logger; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.RadioMedium; import se.sics.cooja.Simulation; @@ -118,7 +118,7 @@ public class CreateSimDialog extends JDialog { Class radioMediumClass = simulation.getRadioMedium().getClass(); - String currentDescription = GUI.getDescriptionOf(radioMediumClass); + String currentDescription = Cooja.getDescriptionOf(radioMediumClass); for (int i=0; i < dialog.radioMediumBox.getItemCount(); i++) { String menuDescription = (String) dialog.radioMediumBox.getItemAt(i); @@ -167,7 +167,7 @@ public class CreateSimDialog extends JDialog { return false; } - private CreateSimDialog(Window window, GUI gui) { + private CreateSimDialog(Window window, Cooja gui) { super(window, "Create new simulation", ModalityType.APPLICATION_MODAL); Box vertBox = Box.createVerticalBox(); @@ -236,7 +236,7 @@ public class CreateSimDialog extends JDialog { Vector radioMediumDescriptions = new Vector(); for (Class radioMediumClass: gui.getRegisteredRadioMediums()) { - String description = GUI.getDescriptionOf(radioMediumClass); + String description = Cooja.getDescriptionOf(radioMediumClass); radioMediumDescriptions.add(description); } @@ -341,7 +341,7 @@ public class CreateSimDialog extends JDialog { String currentRadioMediumDescription = (String) radioMediumBox.getSelectedItem(); for (Class radioMediumClass: mySimulation.getGUI().getRegisteredRadioMediums()) { - String radioMediumDescription = GUI.getDescriptionOf(radioMediumClass); + String radioMediumDescription = Cooja.getDescriptionOf(radioMediumClass); if (currentRadioMediumDescription.equals(radioMediumDescription)) { try { diff --git a/tools/cooja/java/se/sics/cooja/dialogs/ExternalToolsDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/ExternalToolsDialog.java index 4738b258d..a8c1004cf 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/ExternalToolsDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/ExternalToolsDialog.java @@ -64,7 +64,7 @@ public class ExternalToolsDialog extends JDialog { * Parent container for dialog */ public static void showDialog(Container parentContainer) { - if (GUI.isVisualizedInApplet()) { + if (Cooja.isVisualizedInApplet()) { return; } @@ -153,13 +153,13 @@ public class ExternalToolsDialog extends JDialog { explanations.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // MAIN PART - textFields = new JTextField[GUI.getExternalToolsSettingsCount()]; - for (int i = 0; i < GUI.getExternalToolsSettingsCount(); i++) { + textFields = new JTextField[Cooja.getExternalToolsSettingsCount()]; + for (int i = 0; i < Cooja.getExternalToolsSettingsCount(); i++) { // Add text fields for every changeable property smallPane = new JPanel(); smallPane.setAlignmentX(Component.LEFT_ALIGNMENT); smallPane.setLayout(new BoxLayout(smallPane, BoxLayout.X_AXIS)); - label = new JLabel(GUI.getExternalToolsSettingName(i)); + label = new JLabel(Cooja.getExternalToolsSettingName(i)); label.setPreferredSize(new Dimension(LABEL_WIDTH, LABEL_HEIGHT)); textField = new JTextField(35); @@ -192,17 +192,17 @@ public class ExternalToolsDialog extends JDialog { } private void updateTextFields() { - for (int i = 0; i < GUI.getExternalToolsSettingsCount(); i++) { - textFields[i].setText(GUI.getExternalToolsSetting(GUI.getExternalToolsSettingName(i), "")); + for (int i = 0; i < Cooja.getExternalToolsSettingsCount(); i++) { + textFields[i].setText(Cooja.getExternalToolsSetting(Cooja.getExternalToolsSettingName(i), "")); } } private void compareWithDefaults() { - for (int i = 0; i < GUI.getExternalToolsSettingsCount(); i++) { + for (int i = 0; i < Cooja.getExternalToolsSettingsCount(); i++) { String currentValue = textFields[i].getText(); // Compare with default value - String defaultValue = GUI.getExternalToolsDefaultSetting(GUI.getExternalToolsSettingName(i), ""); + String defaultValue = Cooja.getExternalToolsDefaultSetting(Cooja.getExternalToolsSettingName(i), ""); if (currentValue.equals(defaultValue)) { textFields[i].setBackground(Color.WHITE); textFields[i].setToolTipText(""); @@ -225,15 +225,15 @@ public class ExternalToolsDialog extends JDialog { } public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("reset")) { - GUI.loadExternalToolsDefaultSettings(); + Cooja.loadExternalToolsDefaultSettings(); updateTextFields(); compareWithDefaults(); } else if (e.getActionCommand().equals("ok")) { - for (int i = 0; i < GUI.getExternalToolsSettingsCount(); i++) { - GUI.setExternalToolsSetting(GUI.getExternalToolsSettingName(i), textFields[i].getText() + for (int i = 0; i < Cooja.getExternalToolsSettingsCount(); i++) { + Cooja.setExternalToolsSetting(Cooja.getExternalToolsSettingName(i), textFields[i].getText() .trim()); } - GUI.saveExternalToolsUserSettings(); + Cooja.saveExternalToolsUserSettings(); if (myDialog != null && myDialog.isDisplayable()) { myDialog.dispose(); } diff --git a/tools/cooja/java/se/sics/cooja/dialogs/ImportAppMoteDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/ImportAppMoteDialog.java index 0d7276be4..f5f2715b2 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/ImportAppMoteDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/ImportAppMoteDialog.java @@ -54,7 +54,7 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.KeyStroke; import javax.swing.filechooser.FileFilter; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.Simulation; import se.sics.cooja.motes.ImportAppMoteType; @@ -127,7 +127,7 @@ public class ImportAppMoteDialog extends JDialog { fc.setSelectedFile(new File(new File(path), name.replace(".", "/") + ".class")); } else { File fp = simulation.getGUI() - .restorePortablePath(new File(GUI.getExternalToolsSetting("IMPORT_APP_LAST", + .restorePortablePath(new File(Cooja.getExternalToolsSetting("IMPORT_APP_LAST", "mymote.class"))); if (path.length() > 0 && !fp.getAbsolutePath().startsWith(path)) { fc.setCurrentDirectory(new File(path)); @@ -249,7 +249,7 @@ public class ImportAppMoteDialog extends JDialog { } else { pathField.setText(loader.getTestClassPath().getPath()); classField.setText(loader.getTestClassName()); - GUI.setExternalToolsSetting("IMPORT_APP_LAST", + Cooja.setExternalToolsSetting("IMPORT_APP_LAST", simulation.getGUI().createPortablePath(classFile).getPath()); return true; } diff --git a/tools/cooja/java/se/sics/cooja/dialogs/MessageList.java b/tools/cooja/java/se/sics/cooja/dialogs/MessageList.java index 70bf63b58..6fcc825c2 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/MessageList.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/MessageList.java @@ -65,7 +65,7 @@ import javax.swing.JSeparator; import javax.swing.ListModel; import javax.swing.ListSelectionModel; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; public class MessageList extends JList { @@ -178,7 +178,7 @@ public class MessageList extends JList { } public void addMessage(final String message, final int type) { - GUI.setProgressMessage(message, type); + Cooja.setProgressMessage(message, type); MessageContainer msg = new MessageContainer(message, type); messages.add(msg); diff --git a/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java index 64776f139..3b63a119b 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java @@ -84,7 +84,7 @@ import javax.swing.tree.TreePath; import org.apache.log4j.Logger; import se.sics.cooja.COOJAProject; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.ProjectConfig; /** @@ -97,7 +97,7 @@ public class ProjectDirectoriesDialog extends JDialog { private static final long serialVersionUID = 1896348946753376556L; private static Logger logger = Logger.getLogger(ProjectDirectoriesDialog.class); - private GUI gui; + private Cooja gui; private JTable table = null; private JTextArea projectInfo = new JTextArea("Extension information:"); @@ -115,8 +115,8 @@ public class ProjectDirectoriesDialog extends JDialog { * @param currentProjects Current projects * @return New COOJA projects, or null */ - public static COOJAProject[] showDialog(Container parent, GUI gui, COOJAProject[] currentProjects) { - if (GUI.isVisualizedInApplet()) { + public static COOJAProject[] showDialog(Container parent, Cooja gui, COOJAProject[] currentProjects) { + if (Cooja.isVisualizedInApplet()) { return null; } @@ -263,7 +263,7 @@ public class ProjectDirectoriesDialog extends JDialog { newDefaultProjectDirs = newDefaultProjectDirs.replace('\\', '/'); String question = "External tools setting DEFAULT_PROJECTDIRS will change from:\n" - + GUI.getExternalToolsSetting("DEFAULT_PROJECTDIRS", "").replace(';', '\n') + + Cooja.getExternalToolsSetting("DEFAULT_PROJECTDIRS", "").replace(';', '\n') + "\n\n to:\n\n" + newDefaultProjectDirs.replace(';', '\n'); String title = "Change external tools settings?"; @@ -275,7 +275,7 @@ public class ProjectDirectoriesDialog extends JDialog { return; } - GUI.setExternalToolsSetting("DEFAULT_PROJECTDIRS", newDefaultProjectDirs); + Cooja.setExternalToolsSetting("DEFAULT_PROJECTDIRS", newDefaultProjectDirs); dispose(); } }); @@ -339,7 +339,7 @@ public class ProjectDirectoriesDialog extends JDialog { String s1 = "Remove"; String s2 = "Cancel"; Object[] options = { s1, s2 }; - int n = JOptionPane.showOptionDialog(GUI.getTopParentContainer(), + int n = JOptionPane.showOptionDialog(Cooja.getTopParentContainer(), "Remove Cooja project?\n" + project, "Remove Cooja project?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, s1); @@ -415,7 +415,7 @@ public class ProjectDirectoriesDialog extends JDialog { String[] jars = project.getConfigJARs(); projectInfo.append("JARs: " + Arrays.toString(jars) + "\n"); for (String jar: jars) { - File jarFile = GUI.findJarFile(project.dir, jar); + File jarFile = Cooja.findJarFile(project.dir, jar); if (jarFile == null) { projectInfo.append("\tError: " + jar + " could not be found.\n"); } else if (!jarFile.exists()) { @@ -742,7 +742,7 @@ class DirectoryTreePanel extends JPanel { return false; } boolean containsConfig() { - return new File(dir, GUI.PROJECT_CONFIG_FILENAME).exists(); + return new File(dir, Cooja.PROJECT_CONFIG_FILENAME).exists(); } boolean subtreeContainsProject() { try { diff --git a/tools/cooja/java/se/sics/cooja/interfaces/Mote2MoteRelations.java b/tools/cooja/java/se/sics/cooja/interfaces/Mote2MoteRelations.java index 1048a7167..71b450cca 100644 --- a/tools/cooja/java/se/sics/cooja/interfaces/Mote2MoteRelations.java +++ b/tools/cooja/java/se/sics/cooja/interfaces/Mote2MoteRelations.java @@ -44,7 +44,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MoteInterface; import se.sics.cooja.SimEventCentral.MoteCountListener; @@ -79,7 +79,7 @@ public class Mote2MoteRelations extends MoteInterface { private Mote mote = null; private ArrayList relations = new ArrayList(); - private GUI gui; + private Cooja gui; private Observer logObserver = new Observer() { public void update(Observable o, Object arg) { diff --git a/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java b/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java index 2f6af8fc9..16a9d359f 100644 --- a/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java +++ b/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java @@ -40,7 +40,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; @@ -212,7 +212,7 @@ public abstract class AbstractApplicationMoteType implements MoteType { } } - boolean createdOK = configureAndInit(GUI.getTopParentContainer(), simulation, visAvailable); + boolean createdOK = configureAndInit(Cooja.getTopParentContainer(), simulation, visAvailable); return createdOK; } diff --git a/tools/cooja/java/se/sics/cooja/plugins/BufferListener.java b/tools/cooja/java/se/sics/cooja/plugins/BufferListener.java index 66e4731bd..e3feab88b 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/BufferListener.java +++ b/tools/cooja/java/se/sics/cooja/plugins/BufferListener.java @@ -87,7 +87,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MoteMemory; import se.sics.cooja.MoteMemory.MemoryEventType; @@ -263,7 +263,7 @@ public class BufferListener extends VisPlugin { * @param simulation Simulation * @param gui GUI */ - public BufferListener(final Simulation simulation, final GUI gui) { + public BufferListener(final Simulation simulation, final Cooja gui) { super("Buffer Listener - " + "?" + " motes", gui); this.simulation = simulation; @@ -788,7 +788,7 @@ public class BufferListener extends VisPlugin { if (buffer != null) { String status = buffer.getStatusString(); setTitle("Buffer Listener - " + - ((status!=null)?status:GUI.getDescriptionOf(buffer)) + " " + + ((status!=null)?status:Cooja.getDescriptionOf(buffer)) + " " + "- " + memoryMonitors.size() + " buffers on " + motes.size() + " motes"); } } @@ -1056,9 +1056,9 @@ public class BufferListener extends VisPlugin { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); - File suggest = new File(GUI.getExternalToolsSetting("BUFFER_LISTENER_SAVEFILE", "BufferAccessLogger.txt")); + File suggest = new File(Cooja.getExternalToolsSetting("BUFFER_LISTENER_SAVEFILE", "BufferAccessLogger.txt")); fc.setSelectedFile(suggest); - int returnVal = fc.showSaveDialog(GUI.getTopParentContainer()); + int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer()); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } @@ -1069,7 +1069,7 @@ public class BufferListener extends VisPlugin { String s2 = "Cancel"; Object[] options = { s1, s2 }; int n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "A file with the same name already exists.\nDo you want to remove it?", "Overwrite existing file?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, s1); @@ -1078,7 +1078,7 @@ public class BufferListener extends VisPlugin { } } - GUI.setExternalToolsSetting("BUFFER_LISTENER_SAVEFILE", saveFile.getPath()); + Cooja.setExternalToolsSetting("BUFFER_LISTENER_SAVEFILE", saveFile.getPath()); if (saveFile.exists() && !saveFile.canWrite()) { logger.fatal("No write access to file: " + saveFile); return; @@ -1280,7 +1280,7 @@ public class BufferListener extends VisPlugin { parserMenu.removeAll(); for (Class bpClass: bufferParsers) { - JCheckBoxMenuItem mi = new JCheckBoxMenuItem(GUI.getDescriptionOf(bpClass), bpClass==parser.getClass()); + JCheckBoxMenuItem mi = new JCheckBoxMenuItem(Cooja.getDescriptionOf(bpClass), bpClass==parser.getClass()); mi.putClientProperty("CLASS", bpClass); mi.addActionListener(parserSelectedListener); parserMenu.add(mi); @@ -1309,7 +1309,7 @@ public class BufferListener extends VisPlugin { if (btClass == CustomVariableBuffer.class) { bufferMenu.addSeparator(); } - JCheckBoxMenuItem mi = new JCheckBoxMenuItem(GUI.getDescriptionOf(btClass), btClass==buffer.getClass()); + JCheckBoxMenuItem mi = new JCheckBoxMenuItem(Cooja.getDescriptionOf(btClass), btClass==buffer.getClass()); mi.putClientProperty("CLASS", btClass); mi.addActionListener(bufferSelectedListener); bufferMenu.add(mi); @@ -1329,7 +1329,7 @@ public class BufferListener extends VisPlugin { } parser = bp; - logTable.getColumnModel().getColumn(COLUMN_DATA).setHeaderValue(GUI.getDescriptionOf(bp)); + logTable.getColumnModel().getColumn(COLUMN_DATA).setHeaderValue(Cooja.getDescriptionOf(bp)); repaint(); } @@ -1831,9 +1831,9 @@ public class BufferListener extends VisPlugin { offset = Integer.parseInt(element.getAttributeValue("offset")); } public boolean configure(BufferListener bl) { - String suggestName = GUI.getExternalToolsSetting("BUFFER_LISTENER_VARNAME", "node_id"); - String suggestSize = GUI.getExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "2"); - String suggestOffset = GUI.getExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "0"); + String suggestName = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VARNAME", "node_id"); + String suggestSize = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "2"); + String suggestOffset = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "0"); BufferInput infoComponent = new BufferInput(suggestName, suggestSize, suggestOffset); @@ -1868,9 +1868,9 @@ public class BufferListener extends VisPlugin { return false; } - GUI.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable); - GUI.setExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "" + size); - GUI.setExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "" + offset); + Cooja.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable); + Cooja.setExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "" + size); + Cooja.setExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "" + offset); return true; } } @@ -1912,9 +1912,9 @@ public class BufferListener extends VisPlugin { offset = Integer.parseInt(element.getAttributeValue("offset")); } public boolean configure(BufferListener bl) { - String suggestName = GUI.getExternalToolsSetting("BUFFER_LISTENER_VARNAME", "node_id"); - String suggestSize = GUI.getExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "2"); - String suggestOffset = GUI.getExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "0"); + String suggestName = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VARNAME", "node_id"); + String suggestSize = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "2"); + String suggestOffset = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "0"); BufferInput infoComponent = new BufferInput(suggestName, suggestSize, suggestOffset); @@ -1948,9 +1948,9 @@ public class BufferListener extends VisPlugin { /* Abort */ return false; } - GUI.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable); - GUI.setExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "" + size); - GUI.setExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "" + offset); + Cooja.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable); + Cooja.setExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "" + size); + Cooja.setExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "" + offset); return true; } } @@ -1979,7 +1979,7 @@ public class BufferListener extends VisPlugin { variable = element.getAttributeValue("variable"); } public boolean configure(BufferListener bl) { - String suggestName = GUI.getExternalToolsSetting("BUFFER_LISTENER_VARNAME", "node_id"); + String suggestName = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VARNAME", "node_id"); BufferInput infoComponent = new BufferInput(suggestName, null, null); @@ -1995,7 +1995,7 @@ public class BufferListener extends VisPlugin { if (variable == null) { return false; } - GUI.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable); + Cooja.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable); return true; } } diff --git a/tools/cooja/java/se/sics/cooja/plugins/DGRMConfigurator.java b/tools/cooja/java/se/sics/cooja/plugins/DGRMConfigurator.java index e9edbe339..26a6f8600 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/DGRMConfigurator.java +++ b/tools/cooja/java/se/sics/cooja/plugins/DGRMConfigurator.java @@ -60,7 +60,7 @@ import javax.swing.table.TableCellEditor; import org.apache.log4j.Logger; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.PluginType; import se.sics.cooja.Simulation; @@ -98,14 +98,14 @@ public class DGRMConfigurator extends VisPlugin { "Source", "Destination", "RX Ratio", "RSSI","LQI", "Delay" }; - private GUI gui = null; + private Cooja gui = null; private DirectedGraphMedium radioMedium = null; private Observer radioMediumObserver; private JTable graphTable = null; private JComboBox combo = new JComboBox(); private JButton removeButton; - public DGRMConfigurator(Simulation sim, GUI gui) { + public DGRMConfigurator(Simulation sim, Cooja gui) { super("DGRM Configurator", gui); this.gui = gui; radioMedium = (DirectedGraphMedium) sim.getRadioMedium(); @@ -296,7 +296,7 @@ public class DGRMConfigurator extends VisPlugin { if (radioMedium.getEdges().length > 0) { String[] options = new String[] { "Remove", "Cancel" }; int n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "Importing edges will remove all your existing edges.", "Clear edge table?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); @@ -310,9 +310,9 @@ public class DGRMConfigurator extends VisPlugin { /* Select file to import edges from */ JFileChooser fc = new JFileChooser(); - File suggest = new File(GUI.getExternalToolsSetting("DGRM_IMPORT_LINKS_FILE", "cooja_dgrm_links.dat")); + File suggest = new File(Cooja.getExternalToolsSetting("DGRM_IMPORT_LINKS_FILE", "cooja_dgrm_links.dat")); fc.setSelectedFile(suggest); - int returnVal = fc.showOpenDialog(GUI.getTopParentContainer()); + int returnVal = fc.showOpenDialog(Cooja.getTopParentContainer()); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } @@ -321,13 +321,13 @@ public class DGRMConfigurator extends VisPlugin { logger.fatal("No read access to file: " + file); return; } - GUI.setExternalToolsSetting("DGRM_IMPORT_LINKS_FILE", file.getPath()); + Cooja.setExternalToolsSetting("DGRM_IMPORT_LINKS_FILE", file.getPath()); /* Parse and import edges */ try { importEdges(parseDGRMLinksFile(file, gui.getSimulation())); } catch (Exception e) { - GUI.showErrorDialog(this, "Error when importing DGRM links from " + file.getName(), e, false); + Cooja.showErrorDialog(this, "Error when importing DGRM links from " + file.getName(), e, false); } } diff --git a/tools/cooja/java/se/sics/cooja/plugins/EventListener.java b/tools/cooja/java/se/sics/cooja/plugins/EventListener.java index ab4436431..04e5f30f7 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/EventListener.java +++ b/tools/cooja/java/se/sics/cooja/plugins/EventListener.java @@ -51,7 +51,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MoteInterface; import se.sics.cooja.MoteType; @@ -132,7 +132,7 @@ public class EventListener extends VisPlugin { final MoteInterface moteInterface = (MoteInterface) obs; int moteID = myMote.getID(); - myParent.actOnChange("'" + GUI.getDescriptionOf(moteInterface.getClass()) + myParent.actOnChange("'" + Cooja.getDescriptionOf(moteInterface.getClass()) + "'" + " of mote '" + (moteID > 0 ? Integer.toString(moteID) : "?") + "'" + " changed at time " + myParent.mySimulation.getSimulationTime(), new AbstractAction( @@ -141,7 +141,7 @@ public class EventListener extends VisPlugin { MoteInterfaceViewer plugin = (MoteInterfaceViewer) mySimulation.getGUI().tryStartPlugin( MoteInterfaceViewer.class, mySimulation.getGUI(), mySimulation, myMote); - plugin.setSelectedInterface(GUI.getDescriptionOf(moteInterface.getClass())); + plugin.setSelectedInterface(Cooja.getDescriptionOf(moteInterface.getClass())); } }); } @@ -153,7 +153,7 @@ public class EventListener extends VisPlugin { } public void update(Observable obs, Object obj) { - myParent.actOnChange("'" + GUI.getDescriptionOf(obs.getClass()) + "'" + myParent.actOnChange("'" + Cooja.getDescriptionOf(obs.getClass()) + "'" + " changed at time " + myParent.mySimulation.getSimulationTime(), null); } @@ -163,7 +163,7 @@ public class EventListener extends VisPlugin { * @param simulationToControl * Simulation to control */ - public EventListener(Simulation simulationToControl, GUI gui) { + public EventListener(Simulation simulationToControl, Cooja gui) { super("Event Listener", gui); mySimulation = simulationToControl; @@ -199,7 +199,7 @@ public class EventListener extends VisPlugin { interfacePanel.setLayout(new BoxLayout(interfacePanel, BoxLayout.Y_AXIS)); interfacePanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); for (Class interfaceClass : allInterfaces) { - JCheckBox checkBox = new JCheckBox(GUI.getDescriptionOf(interfaceClass), + JCheckBox checkBox = new JCheckBox(Cooja.getDescriptionOf(interfaceClass), false); checkBox.setToolTipText(interfaceClass.getName()); checkBox.putClientProperty("interface_class", interfaceClass); diff --git a/tools/cooja/java/se/sics/cooja/plugins/LogListener.java b/tools/cooja/java/se/sics/cooja/plugins/LogListener.java index 0476699bd..e1521c5ee 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/LogListener.java +++ b/tools/cooja/java/se/sics/cooja/plugins/LogListener.java @@ -83,7 +83,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.HasQuickHelp; import se.sics.cooja.Mote; import se.sics.cooja.Plugin; @@ -206,7 +206,7 @@ public class LogListener extends VisPlugin implements HasQuickHelp { * @param simulation Simulation * @param gui GUI */ - public LogListener(final Simulation simulation, final GUI gui) { + public LogListener(final Simulation simulation, final Cooja gui) { super("Mote output", gui); this.simulation = simulation; @@ -742,9 +742,9 @@ public class LogListener extends VisPlugin implements HasQuickHelp { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); - File suggest = new File(GUI.getExternalToolsSetting("LOG_LISTENER_SAVEFILE", "loglistener.txt")); + File suggest = new File(Cooja.getExternalToolsSetting("LOG_LISTENER_SAVEFILE", "loglistener.txt")); fc.setSelectedFile(suggest); - int returnVal = fc.showSaveDialog(GUI.getTopParentContainer()); + int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer()); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } @@ -755,7 +755,7 @@ public class LogListener extends VisPlugin implements HasQuickHelp { String s2 = "Cancel"; Object[] options = { s1, s2 }; int n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "A file with the same name already exists.\nDo you want to remove it?", "Overwrite existing file?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, s1); @@ -764,7 +764,7 @@ public class LogListener extends VisPlugin implements HasQuickHelp { } } - GUI.setExternalToolsSetting("LOG_LISTENER_SAVEFILE", saveFile.getPath()); + Cooja.setExternalToolsSetting("LOG_LISTENER_SAVEFILE", saveFile.getPath()); if (saveFile.exists() && !saveFile.canWrite()) { logger.fatal("No write access to file: " + saveFile); return; @@ -838,9 +838,9 @@ public class LogListener extends VisPlugin implements HasQuickHelp { } JFileChooser fc = new JFileChooser(); - File suggest = new File(GUI.getExternalToolsSetting("LOG_LISTENER_APPENDFILE", "loglistener_append.txt")); + File suggest = new File(Cooja.getExternalToolsSetting("LOG_LISTENER_APPENDFILE", "loglistener_append.txt")); fc.setSelectedFile(suggest); - int returnVal = fc.showSaveDialog(GUI.getTopParentContainer()); + int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer()); if (returnVal != JFileChooser.APPROVE_OPTION) { appendToFile = false; cb.setSelected(appendToFile); @@ -848,7 +848,7 @@ public class LogListener extends VisPlugin implements HasQuickHelp { } File saveFile = fc.getSelectedFile(); - GUI.setExternalToolsSetting("LOG_LISTENER_APPENDFILE", saveFile.getPath()); + Cooja.setExternalToolsSetting("LOG_LISTENER_APPENDFILE", saveFile.getPath()); if (saveFile.exists() && !saveFile.canWrite()) { logger.fatal("No write access to file: " + saveFile); appendToFile = false; diff --git a/tools/cooja/java/se/sics/cooja/plugins/LogScriptEngine.java b/tools/cooja/java/se/sics/cooja/plugins/LogScriptEngine.java index 3ba0eba00..688a6afab 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/LogScriptEngine.java +++ b/tools/cooja/java/se/sics/cooja/plugins/LogScriptEngine.java @@ -44,7 +44,7 @@ import javax.script.ScriptException; import org.apache.log4j.Logger; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.SimEventCentral.LogOutputEvent; import se.sics.cooja.SimEventCentral.LogOutputListener; @@ -157,8 +157,8 @@ public class LogScriptEngine { stepScript(); } catch (UndeclaredThrowableException e) { logger.fatal("Exception: " + e.getMessage(), e); - if (GUI.isVisualized()) { - GUI.showErrorDialog(GUI.getTopParentContainer(), + if (Cooja.isVisualized()) { + Cooja.showErrorDialog(Cooja.getTopParentContainer(), e.getMessage(), e, false); } @@ -308,7 +308,7 @@ public class LogScriptEngine { throwable.getMessage().contains("test script killed") ) { logger.info("Test script finished"); } else { - if (!GUI.isVisualized()) { + if (!Cooja.isVisualized()) { logger.fatal("Test script error, terminating Cooja."); logger.fatal("Script error:", e); System.exit(1); @@ -317,8 +317,8 @@ public class LogScriptEngine { logger.fatal("Script error:", e); deactivateScript(); simulation.stopSimulation(); - if (GUI.isVisualized()) { - GUI.showErrorDialog(GUI.getTopParentContainer(), + if (Cooja.isVisualized()) { + Cooja.showErrorDialog(Cooja.getTopParentContainer(), "Script error", e, false); } } @@ -454,7 +454,7 @@ public class LogScriptEngine { private void deactive() { deactivateScript(); - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { log("[if test was run without visualization, Cooja would now have been terminated]\n"); stopSimulation = true; simulation.invokeSimulationThread(stopSimulationRunnable); diff --git a/tools/cooja/java/se/sics/cooja/plugins/MoteInformation.java b/tools/cooja/java/se/sics/cooja/plugins/MoteInformation.java index 463d6684f..3c7be120a 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/MoteInformation.java +++ b/tools/cooja/java/se/sics/cooja/plugins/MoteInformation.java @@ -45,7 +45,7 @@ import javax.swing.JScrollPane; import org.apache.log4j.Logger; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MotePlugin; import se.sics.cooja.PluginType; @@ -79,7 +79,7 @@ public class MoteInformation extends VisPlugin implements MotePlugin { * @param s Simulation * @param gui Simulator */ - public MoteInformation(Mote m, Simulation s, GUI gui) { + public MoteInformation(Mote m, Simulation s, Cooja gui) { super("Mote Information (" + m + ")", gui); this.mote = m; this.simulation = s; diff --git a/tools/cooja/java/se/sics/cooja/plugins/MoteInterfaceViewer.java b/tools/cooja/java/se/sics/cooja/plugins/MoteInterfaceViewer.java index 7044ad576..b7e37e158 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/MoteInterfaceViewer.java +++ b/tools/cooja/java/se/sics/cooja/plugins/MoteInterfaceViewer.java @@ -49,7 +49,7 @@ import javax.swing.JSeparator; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.HasQuickHelp; import se.sics.cooja.Mote; import se.sics.cooja.MoteInterface; @@ -79,7 +79,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, Mote * * @param moteToView Mote to view */ - public MoteInterfaceViewer(Mote moteToView, Simulation simulation, GUI gui) { + public MoteInterfaceViewer(Mote moteToView, Simulation simulation, Cooja gui) { super("Mote Interface Viewer (" + moteToView + ")", gui); mote = moteToView; @@ -98,7 +98,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, Mote Collection intfs = mote.getInterfaces().getInterfaces(); for (MoteInterface intf : intfs) { - selectInterfaceComboBox.addItem(GUI.getDescriptionOf(intf)); + selectInterfaceComboBox.addItem(Cooja.getDescriptionOf(intf)); } selectInterfaceComboBox.addActionListener(new ActionListener() { @@ -115,7 +115,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, Mote selectedMoteInterface = null; Collection intfs = mote.getInterfaces().getInterfaces(); for (MoteInterface intf : intfs) { - if (GUI.getDescriptionOf(intf).equals(interfaceDescription)) { + if (Cooja.getDescriptionOf(intf).equals(interfaceDescription)) { selectedMoteInterface = intf; mote.getSimulation().getGUI().loadQuickHelp(MoteInterfaceViewer.this); break; @@ -219,7 +219,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, Mote } public String getQuickHelp() { - String help = "" + GUI.getDescriptionOf(this) + ""; + String help = "" + Cooja.getDescriptionOf(this) + ""; help += "

Lists mote interfaces, and allows mote inspection and interaction via mote interface visualizers."; MoteInterface intf = selectedMoteInterface; @@ -227,7 +227,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, Mote if (intf instanceof HasQuickHelp) { help += "

" + ((HasQuickHelp)intf).getQuickHelp(); } else { - help += "

" + GUI.getDescriptionOf(intf) + ""; + help += "

" + Cooja.getDescriptionOf(intf) + ""; help += "

No help available"; } } diff --git a/tools/cooja/java/se/sics/cooja/plugins/MoteTypeInformation.java b/tools/cooja/java/se/sics/cooja/plugins/MoteTypeInformation.java index 2751576e5..e8448b1d8 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/MoteTypeInformation.java +++ b/tools/cooja/java/se/sics/cooja/plugins/MoteTypeInformation.java @@ -42,7 +42,7 @@ import javax.swing.JScrollPane; import org.apache.log4j.Logger; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteType; import se.sics.cooja.PluginType; import se.sics.cooja.Simulation; @@ -66,7 +66,7 @@ public class MoteTypeInformation extends VisPlugin { * @param simulation Simulation * @param gui Cooja */ - public MoteTypeInformation(Simulation simulation, GUI gui) { + public MoteTypeInformation(Simulation simulation, Cooja gui) { super("Mote Type Information", gui); this.simulation = simulation; @@ -102,7 +102,7 @@ public class MoteTypeInformation extends VisPlugin { /* Mote types */ for (MoteType moteType: simulation.getMoteTypes()) { String moteTypeString = - GUI.getDescriptionOf(moteType) +": " + + Cooja.getDescriptionOf(moteType) +": " + "ID=" + moteType.getIdentifier() + ", \"" + moteType.getDescription() + "\""; diff --git a/tools/cooja/java/se/sics/cooja/plugins/Notes.java b/tools/cooja/java/se/sics/cooja/plugins/Notes.java index e23b20e35..c58b75ec5 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/Notes.java +++ b/tools/cooja/java/se/sics/cooja/plugins/Notes.java @@ -50,7 +50,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.PluginType; import se.sics.cooja.Simulation; import se.sics.cooja.VisPlugin; @@ -64,7 +64,7 @@ public class Notes extends VisPlugin { private JTextArea notes = new JTextArea("Enter notes here"); private boolean decorationsVisible = true; - public Notes(Simulation simulation, GUI gui) { + public Notes(Simulation simulation, Cooja gui) { super("Notes", gui); add(BorderLayout.CENTER, new JScrollPane(notes)); diff --git a/tools/cooja/java/se/sics/cooja/plugins/RadioLogger.java b/tools/cooja/java/se/sics/cooja/plugins/RadioLogger.java index f9614317a..751ad3197 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/RadioLogger.java +++ b/tools/cooja/java/se/sics/cooja/plugins/RadioLogger.java @@ -84,7 +84,7 @@ import org.jdom.Element; import se.sics.cooja.ClassDescription; import se.sics.cooja.ConvertedRadioPacket; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Plugin; import se.sics.cooja.PluginType; import se.sics.cooja.RadioConnection; @@ -147,7 +147,7 @@ public class RadioLogger extends VisPlugin { private JTextField searchField = new JTextField(30); - public RadioLogger(final Simulation simulationToControl, final GUI gui) { + public RadioLogger(final Simulation simulationToControl, final Cooja gui) { super("Radio messages", gui); setLayout(new BorderLayout()); @@ -961,7 +961,7 @@ public class RadioLogger extends VisPlugin { public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); - int returnVal = fc.showSaveDialog(GUI.getTopParentContainer()); + int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer()); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } @@ -972,7 +972,7 @@ public class RadioLogger extends VisPlugin { String s2 = "Cancel"; Object[] options = { s1, s2 }; int n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "A file with the same name already exists.\nDo you want to remove it?", "Overwrite existing file?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, s1); @@ -1073,7 +1073,7 @@ public class RadioLogger extends VisPlugin { } String alias = (String) JOptionPane.showInputDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "Enter alias for all packets with identical payload.\n" + "An empty string removes the current alias.\n\n" + connections.get(selectedRow).data + "\n", diff --git a/tools/cooja/java/se/sics/cooja/plugins/ScriptRunner.java b/tools/cooja/java/se/sics/cooja/plugins/ScriptRunner.java index fd3084e7d..7f0d04654 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/ScriptRunner.java +++ b/tools/cooja/java/se/sics/cooja/plugins/ScriptRunner.java @@ -80,7 +80,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.PluginType; import se.sics.cooja.Simulation; import se.sics.cooja.VisPlugin; @@ -121,7 +121,7 @@ public class ScriptRunner extends VisPlugin { private JSyntaxLinkFile actionLinkFile = null; private File linkedFile = null; - public ScriptRunner(Simulation simulation, GUI gui) { + public ScriptRunner(Simulation simulation, Cooja gui) { super("Simulation script editor", gui, false); this.simulation = simulation; this.engine = null; @@ -147,7 +147,7 @@ public class ScriptRunner extends VisPlugin { public void actionPerformed(ActionEvent e) { String script = loadScript(file); if (script == null) { - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "Could not load example script: scripts/" + file, "Could not load script", JOptionPane.ERROR_MESSAGE); return; @@ -289,7 +289,7 @@ public class ScriptRunner extends VisPlugin { codeEditor.setEditable(true); } else { updateScript(linkedFile); - GUI.setExternalToolsSetting("SCRIPTRUNNER_LAST_SCRIPTFILE", source.getAbsolutePath()); + Cooja.setExternalToolsSetting("SCRIPTRUNNER_LAST_SCRIPTFILE", source.getAbsolutePath()); if (actionLinkFile != null) { actionLinkFile.setMenuText("Unlink script: " + source.getName()); @@ -321,7 +321,7 @@ public class ScriptRunner extends VisPlugin { /* Create new engine */ engine = new LogScriptEngine(simulation); - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { /* Attach visualized log observer */ engine.setScriptLogObserver(new Observer() { public void update(Observable obs, Object obj) { @@ -380,8 +380,8 @@ public class ScriptRunner extends VisPlugin { } catch (ScriptException e) { logger.fatal("Test script error: ", e); setScriptActive(false); - if (GUI.isVisualized()) { - GUI.showErrorDialog(GUI.getTopParentContainer(), + if (Cooja.isVisualized()) { + Cooja.showErrorDialog(Cooja.getTopParentContainer(), "Script error", e, false); } } catch (RuntimeException e) { @@ -443,23 +443,23 @@ public class ScriptRunner extends VisPlugin { /* Start test in external process */ try { JPanel progressPanel = new JPanel(new BorderLayout()); - final JDialog progressDialog = new JDialog((Window)GUI.getTopParentContainer(), (String) null); + final JDialog progressDialog = new JDialog((Window)Cooja.getTopParentContainer(), (String) null); progressDialog.setTitle("Running test..."); File coojaBuild; File coojaJAR; try { - coojaBuild = new File(GUI.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/build"); - coojaJAR = new File(GUI.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/dist/cooja.jar"); + coojaBuild = new File(Cooja.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/build"); + coojaJAR = new File(Cooja.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/dist/cooja.jar"); coojaBuild = coojaBuild.getCanonicalFile(); coojaJAR = coojaJAR.getCanonicalFile(); } catch (IOException e) { - coojaBuild = new File(GUI.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/build"); - coojaJAR = new File(GUI.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/dist/cooja.jar"); + coojaBuild = new File(Cooja.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/build"); + coojaJAR = new File(Cooja.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/dist/cooja.jar"); } if (!coojaJAR.exists()) { - JOptionPane.showMessageDialog(GUI.getTopParentContainer(), + JOptionPane.showMessageDialog(Cooja.getTopParentContainer(), "Can't start Cooja, cooja.jar not found:" + "\n" + coojaJAR.getAbsolutePath() + "\n\nVerify that PATH_CONTIKI is correct in external tools settings.", @@ -480,7 +480,7 @@ public class ScriptRunner extends VisPlugin { /* User confirmation */ String s1 = "Start"; String s2 = "Cancel"; - int n = JOptionPane.showOptionDialog(GUI.getTopParentContainer(), + int n = JOptionPane.showOptionDialog(Cooja.getTopParentContainer(), "Starting Cooja in " + coojaBuild.getPath() + ":\n" + " " + command[0] + " " + command[1] + " " + command[2] + " " + command[3] + "\n", "Starting Cooja without GUI", JOptionPane.YES_NO_OPTION, @@ -655,7 +655,7 @@ public class ScriptRunner extends VisPlugin { setLinkFile(file); } else if ("active".equals(name)) { boolean active = Boolean.parseBoolean(element.getText()); - if (GUI.isVisualized()) { + if (Cooja.isVisualized()) { try { setScriptActive(active); } catch (Exception e) { @@ -665,7 +665,7 @@ public class ScriptRunner extends VisPlugin { } } - if (!GUI.isVisualized()) { + if (!Cooja.isVisualized()) { /* Automatically activate script */ try { setScriptActive(true); @@ -699,7 +699,7 @@ public class ScriptRunner extends VisPlugin { } JFileChooser fileChooser = new JFileChooser(); - String suggest = GUI.getExternalToolsSetting("SCRIPTRUNNER_LAST_SCRIPTFILE", null); + String suggest = Cooja.getExternalToolsSetting("SCRIPTRUNNER_LAST_SCRIPTFILE", null); if (suggest != null) { fileChooser.setSelectedFile(new File(suggest)); } else { diff --git a/tools/cooja/java/se/sics/cooja/plugins/SimControl.java b/tools/cooja/java/se/sics/cooja/plugins/SimControl.java index 3a617db60..32b8185a2 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/SimControl.java +++ b/tools/cooja/java/se/sics/cooja/plugins/SimControl.java @@ -52,7 +52,7 @@ import javax.swing.SwingUtilities; import javax.swing.Timer; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.HasQuickHelp; import se.sics.cooja.PluginType; import se.sics.cooja.Simulation; @@ -83,7 +83,7 @@ public class SimControl extends VisPlugin implements HasQuickHelp { * * @param simulation Simulation to control */ - public SimControl(Simulation simulation, GUI gui) { + public SimControl(Simulation simulation, Cooja gui) { super("Simulation control", gui); this.simulation = simulation; diff --git a/tools/cooja/java/se/sics/cooja/plugins/SimInformation.java b/tools/cooja/java/se/sics/cooja/plugins/SimInformation.java index 09ab3b554..da97988c2 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/SimInformation.java +++ b/tools/cooja/java/se/sics/cooja/plugins/SimInformation.java @@ -66,7 +66,7 @@ public class SimInformation extends VisPlugin { * * @param simulationToView Simulation to view */ - public SimInformation(Simulation simulationToView, GUI gui) { + public SimInformation(Simulation simulationToView, Cooja gui) { super("Simulation Information", gui); simulation = simulationToView; @@ -180,7 +180,7 @@ public class SimInformation extends VisPlugin { smallPane.add(Box.createHorizontalGlue()); Class radioMediumClass = simulation.getRadioMedium().getClass(); - String description = GUI.getDescriptionOf(radioMediumClass); + String description = Cooja.getDescriptionOf(radioMediumClass); label = new JLabel(description); smallPane.add(label); diff --git a/tools/cooja/java/se/sics/cooja/plugins/TimeLine.java b/tools/cooja/java/se/sics/cooja/plugins/TimeLine.java index e73e0f120..122880712 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/TimeLine.java +++ b/tools/cooja/java/se/sics/cooja/plugins/TimeLine.java @@ -81,7 +81,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.HasQuickHelp; import se.sics.cooja.Mote; import se.sics.cooja.Plugin; @@ -167,7 +167,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp { * @param simulation Simulation * @param gui GUI */ - public TimeLine(final Simulation simulation, final GUI gui) { + public TimeLine(final Simulation simulation, final Cooja gui) { super("Timeline", gui); this.simulation = simulation; @@ -257,9 +257,9 @@ public class TimeLine extends VisPlugin implements HasQuickHelp { LogListener.class.getName()); if (showLogOutputs) { if (logEventFilterPlugin != null) { - logger.info("Filtering shown log outputs by use of " + GUI.getDescriptionOf(LogListener.class) + " plugin"); + logger.info("Filtering shown log outputs by use of " + Cooja.getDescriptionOf(LogListener.class) + " plugin"); } else { - logger.info("No active " + GUI.getDescriptionOf(LogListener.class) + " plugin, not filtering log outputs"); + logger.info("No active " + Cooja.getDescriptionOf(LogListener.class) + " plugin, not filtering log outputs"); } } @@ -479,7 +479,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp { String options[] = new String[] {"Cancel", "Show"}; optionPane.setOptions(options); optionPane.setInitialValue(options[1]); - JDialog dialog = optionPane.createDialog(GUI.getTopParentContainer(), "Show mote in timeline"); + JDialog dialog = optionPane.createDialog(Cooja.getTopParentContainer(), "Show mote in timeline"); dialog.setVisible(true); if (optionPane.getValue() == null || !optionPane.getValue().equals("Show")) { @@ -652,7 +652,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp { private static final long serialVersionUID = 975176793514425718L; public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); - int returnVal = fc.showSaveDialog(GUI.getTopParentContainer()); + int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer()); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } @@ -663,7 +663,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp { String s2 = "Cancel"; Object[] options = { s1, s2 }; int n = JOptionPane.showOptionDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "A file with the same name already exists.\nDo you want to remove it?", "Overwrite existing file?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, s1); @@ -934,7 +934,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp { }); } - private Action radioLoggerAction = new AbstractAction("Show in " + GUI.getDescriptionOf(RadioLogger.class)) { + private Action radioLoggerAction = new AbstractAction("Show in " + Cooja.getDescriptionOf(RadioLogger.class)) { private static final long serialVersionUID = 7690116136861949864L; public void actionPerformed(ActionEvent e) { if (popupLocation == null) { @@ -954,7 +954,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp { } } }; - private Action logListenerAction = new AbstractAction("Show in " + GUI.getDescriptionOf(LogListener.class)) { + private Action logListenerAction = new AbstractAction("Show in " + Cooja.getDescriptionOf(LogListener.class)) { private static final long serialVersionUID = -8626118368774023257L; public void actionPerformed(ActionEvent e) { if (popupLocation == null) { @@ -975,7 +975,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp { } }; - private Action showInAllAction = new AbstractAction("Show in " + GUI.getDescriptionOf(LogListener.class) + " and " + GUI.getDescriptionOf(RadioLogger.class)) { + private Action showInAllAction = new AbstractAction("Show in " + Cooja.getDescriptionOf(LogListener.class) + " and " + Cooja.getDescriptionOf(RadioLogger.class)) { private static final long serialVersionUID = -2458733078524773995L; public void actionPerformed(ActionEvent e) { logListenerAction.actionPerformed(null); @@ -2474,7 +2474,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp { "

LEDs" + "
Shows LED state: red, green, and blue. (Assumes all mote types have exactly three LEDs.)" + "

Log outputs" + - "
Shows log outputs, as also shown in " + GUI.getDescriptionOf(LogListener.class) + + "
Shows log outputs, as also shown in " + Cooja.getDescriptionOf(LogListener.class) + "

Watchpoints" + "
Shows triggered watchpoints, currently only supported by emulated motes. To add watchpoints, use the Msp Code Watcher plugin."; } diff --git a/tools/cooja/java/se/sics/cooja/plugins/VariableWatcher.java b/tools/cooja/java/se/sics/cooja/plugins/VariableWatcher.java index 73f4dec52..fb583eac7 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/VariableWatcher.java +++ b/tools/cooja/java/se/sics/cooja/plugins/VariableWatcher.java @@ -66,7 +66,7 @@ import org.jdom.Element; import se.sics.cooja.AddressMemory; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.Mote; import se.sics.cooja.MotePlugin; import se.sics.cooja.PluginType; @@ -121,7 +121,7 @@ public class VariableWatcher extends VisPlugin implements MotePlugin { * @param simulation Simulation * @param gui GUI */ - public VariableWatcher(Mote moteToView, Simulation simulation, GUI gui) { + public VariableWatcher(Mote moteToView, Simulation simulation, Cooja gui) { super("Variable Watcher (" + moteToView + ")", gui); this.mote = moteToView; moteMemory = (AddressMemory) moteToView.getMemory(); diff --git a/tools/cooja/java/se/sics/cooja/plugins/Visualizer.java b/tools/cooja/java/se/sics/cooja/plugins/Visualizer.java index b7b02cb35..230ee0a92 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/Visualizer.java +++ b/tools/cooja/java/se/sics/cooja/plugins/Visualizer.java @@ -88,8 +88,8 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.ClassDescription; -import se.sics.cooja.GUI; -import se.sics.cooja.GUI.MoteRelation; +import se.sics.cooja.Cooja; +import se.sics.cooja.Cooja.MoteRelation; import se.sics.cooja.HasQuickHelp; import se.sics.cooja.Mote; import se.sics.cooja.MoteInterface; @@ -136,7 +136,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { public static final int MOTE_RADIUS = 8; private static final Color[] DEFAULT_MOTE_COLORS = { Color.WHITE }; - private GUI gui = null; + private Cooja gui = null; private Simulation simulation = null; private final JPanel canvas; private boolean loadedConfig = false; @@ -205,7 +205,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { private ArrayList> moteMenuActions = new ArrayList>(); - public Visualizer(Simulation simulation, GUI gui) { + public Visualizer(Simulation simulation, Cooja gui) { super("Network", gui); this.gui = gui; this.simulation = simulation; @@ -566,7 +566,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { } /* Activate default skins */ - String[] defaultSkins = GUI.getExternalToolsSetting("VISUALIZER_DEFAULT_SKINS", "").split(";"); + String[] defaultSkins = Cooja.getExternalToolsSetting("VISUALIZER_DEFAULT_SKINS", "").split(";"); for (String skin: defaultSkins) { if (skin.isEmpty()) { continue; @@ -726,7 +726,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { continue; } - String description = GUI.getDescriptionOf(skinClass); + String description = Cooja.getDescriptionOf(skinClass); JCheckBoxMenuItem item = new JCheckBoxMenuItem(description, false); item.putClientProperty("skinclass", skinClass); @@ -1335,7 +1335,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { for (Class skinClass: visualizerSkins) { if (wanted.equals(skinClass.getName()) /* Backwards compatibility */ - || wanted.equals(GUI.getDescriptionOf(skinClass))) { + || wanted.equals(Cooja.getDescriptionOf(skinClass))) { final Class skin = skinClass; SwingUtilities.invokeLater(new Runnable() { public void run() { @@ -1384,7 +1384,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { } sb.append(skin.getClass().getName()); } - GUI.setExternalToolsSetting("VISUALIZER_DEFAULT_SKINS", sb.toString()); + Cooja.setExternalToolsSetting("VISUALIZER_DEFAULT_SKINS", sb.toString()); } }; @@ -1428,7 +1428,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { } /* Extract description (input to plugin) */ - String desc = GUI.getDescriptionOf(mote.getInterfaces().getLED()); + String desc = Cooja.getDescriptionOf(mote.getInterfaces().getLED()); MoteInterfaceViewer viewer = (MoteInterfaceViewer) simulation.getGUI().tryStartPlugin( @@ -1471,7 +1471,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { } /* Extract description (input to plugin) */ - String desc = GUI.getDescriptionOf(serialPort); + String desc = Cooja.getDescriptionOf(serialPort); MoteInterfaceViewer viewer = (MoteInterfaceViewer) simulation.getGUI().tryStartPlugin( diff --git a/tools/cooja/java/se/sics/cooja/positioners/ManualPositioner.java b/tools/cooja/java/se/sics/cooja/positioners/ManualPositioner.java index 8d8349865..95f009bd4 100644 --- a/tools/cooja/java/se/sics/cooja/positioners/ManualPositioner.java +++ b/tools/cooja/java/se/sics/cooja/positioners/ManualPositioner.java @@ -80,7 +80,7 @@ public class ManualPositioner extends Positioner { if (totalNumberOfMotes > 10) { int value = JOptionPane.showConfirmDialog( - GUI.getTopParentContainer(), + Cooja.getTopParentContainer(), "Do you really want to manually enter the positions of " + totalNumberOfMotes + " new motes ?\n", "Manually enter mote positions?", JOptionPane.YES_NO_OPTION, @@ -106,7 +106,7 @@ public class ManualPositioner extends Positioner { dialog.xField.setValue(lastX); dialog.yField.setValue(lastY); dialog.zField.setValue(lastZ); - dialog.setLocationRelativeTo(GUI.getTopParentContainer()); + dialog.setLocationRelativeTo(Cooja.getTopParentContainer()); dialog.pack(); dialog.setModal(true); dialog.setResizable(false); diff --git a/tools/cooja/java/se/sics/cooja/util/ExecuteJAR.java b/tools/cooja/java/se/sics/cooja/util/ExecuteJAR.java index f1a91381e..e0efc551a 100644 --- a/tools/cooja/java/se/sics/cooja/util/ExecuteJAR.java +++ b/tools/cooja/java/se/sics/cooja/util/ExecuteJAR.java @@ -48,7 +48,7 @@ import org.jdom.input.SAXBuilder; import org.jdom.output.Format; import org.jdom.output.XMLOutputter; -import se.sics.cooja.GUI; +import se.sics.cooja.Cooja; import se.sics.cooja.MoteType; import se.sics.cooja.Plugin; import se.sics.cooja.ProjectConfig; @@ -67,10 +67,10 @@ public class ExecuteJAR { public static void main(String[] args) { try { - if ((new File(GUI.LOG_CONFIG_FILE)).exists()) { - DOMConfigurator.configure(GUI.LOG_CONFIG_FILE); + if ((new File(Cooja.LOG_CONFIG_FILE)).exists()) { + DOMConfigurator.configure(Cooja.LOG_CONFIG_FILE); } else { - DOMConfigurator.configure(GUI.class.getResource("/" + GUI.LOG_CONFIG_FILE)); + DOMConfigurator.configure(Cooja.class.getResource("/" + Cooja.LOG_CONFIG_FILE)); } } catch (AccessControlException e) { BasicConfigurator.configure(); @@ -99,10 +99,10 @@ public class ExecuteJAR { /* Load simulation */ logger.info("Loading " + config); - GUI.externalToolsUserSettingsFile = new File( + Cooja.externalToolsUserSettingsFile = new File( System.getProperty("user.home"), - GUI.EXTERNAL_TOOLS_USER_SETTINGS_FILENAME); - Simulation s = GUI.quickStartSimulationConfig(config, false, null); + Cooja.EXTERNAL_TOOLS_USER_SETTINGS_FILENAME); + Simulation s = Cooja.quickStartSimulationConfig(config, false, null); if (s == null) { throw new RuntimeException( "Error when creating simulation" @@ -142,7 +142,7 @@ public class ExecuteJAR { File diskFile = new File(executeDir, SIMCONFIG_FILENAME); if (OVERWRITE || !diskFile.exists()) { logger.info("Unpacking simulation config: " + SIMCONFIG_FILENAME + " -> " + diskFile.getName()); - inputStream = GUI.class.getResourceAsStream("/" + SIMCONFIG_FILENAME); + inputStream = Cooja.class.getResourceAsStream("/" + SIMCONFIG_FILENAME); byte[] fileData = ArrayUtils.readFromStream(inputStream); if (fileData == null) { logger.info("Failed extracting file (read fail)"); @@ -160,7 +160,7 @@ public class ExecuteJAR { diskFile = new File(executeDir, EXTERNALTOOLS_FILENAME); if (OVERWRITE || !diskFile.exists()) { logger.info("Unpacking external tools config: " + EXTERNALTOOLS_FILENAME + " -> " + diskFile.getName()); - inputStream = GUI.class.getResourceAsStream("/" + EXTERNALTOOLS_FILENAME); + inputStream = Cooja.class.getResourceAsStream("/" + EXTERNALTOOLS_FILENAME); byte[] fileData = ArrayUtils.readFromStream(inputStream); if (fileData == null) { logger.info("Failed extracting file (read fail)"); @@ -174,7 +174,7 @@ public class ExecuteJAR { } else { logger.info("Skip: external tools config already exists: " + diskFile); } - GUI.externalToolsUserSettingsFile = diskFile; + Cooja.externalToolsUserSettingsFile = diskFile; /* Unpack files from JAR (with attribute EXPORT=copy) */ SAXBuilder builder = new SAXBuilder(); @@ -186,8 +186,8 @@ public class ExecuteJAR { } logger.info("Starting simulation"); - GUI.setLookAndFeel(); - GUI.quickStartSimulationConfig(new File(executeDir, SIMCONFIG_FILENAME), false, null); + Cooja.setLookAndFeel(); + Cooja.quickStartSimulationConfig(new File(executeDir, SIMCONFIG_FILENAME), false, null); } /** @@ -196,7 +196,7 @@ public class ExecuteJAR { * @param gui GUI. Must contain simulation * @param outputFile Output file */ - public static boolean buildExecutableJAR(GUI gui, File outputFile) { + public static boolean buildExecutableJAR(Cooja gui, File outputFile) { String executeDir = null; executeDir = outputFile.getName(); if (!executeDir.endsWith(".jar")) { @@ -215,11 +215,11 @@ public class ExecuteJAR { for (MoteType t: simulation.getMoteTypes()) { if (!t.getClass().getName().contains("SkyMoteType")) { throw new RuntimeException( - "You simulation contains the mote type: " + GUI.getDescriptionOf(t.getClass()) + "\n" + + "You simulation contains the mote type: " + Cooja.getDescriptionOf(t.getClass()) + "\n" + "Only the Sky Mote Type is currently supported.\n" ); } - logger.info("Checking mote types: '" + GUI.getDescriptionOf(t.getClass()) + "'"); + logger.info("Checking mote types: '" + Cooja.getDescriptionOf(t.getClass()) + "'"); } /* Check dependencies: Contiki Test Editor */ @@ -253,10 +253,10 @@ public class ExecuteJAR { /* Unpacking project JARs */ ProjectConfig config = gui.getProjectConfig(); - String[] projectJARs = config.getStringArrayValue(GUI.class.getName() + ".JARFILES"); + String[] projectJARs = config.getStringArrayValue(Cooja.class.getName() + ".JARFILES"); for (String jar: projectJARs) { /* Locate project */ - File project = config.getUserProjectDefining(GUI.class, "JARFILES", jar); + File project = config.getUserProjectDefining(Cooja.class, "JARFILES", jar); File jarFile = new File(project, jar); if (!jarFile.exists()) { jarFile = new File(project, "lib/" + jar); @@ -287,7 +287,7 @@ public class ExecuteJAR { "tools/cooja/lib/jdom.jar", "tools/cooja/lib/log4j.jar", "tools/cooja/dist/cooja.jar" }; for (String jar: coreJARs) { - File jarFile = new File(GUI.getExternalToolsSetting("PATH_CONTIKI"), jar); + File jarFile = new File(Cooja.getExternalToolsSetting("PATH_CONTIKI"), jar); if (!jarFile.exists()) { throw new RuntimeException( "Project JAR could not be found: " + jarFile.getAbsolutePath() @@ -334,11 +334,11 @@ public class ExecuteJAR { File externalToolsConfig = new File(workingDir, EXTERNALTOOLS_FILENAME); FileOutputStream out = new FileOutputStream(externalToolsConfig); Properties differingSettings = new Properties(); - Enumeration keyEnum = GUI.currentExternalToolsSettings.keys(); + Enumeration keyEnum = Cooja.currentExternalToolsSettings.keys(); while (keyEnum.hasMoreElements()) { String key = (String) keyEnum.nextElement(); - String defaultSetting = GUI.getExternalToolsDefaultSetting(key, ""); - String currentSetting = GUI.currentExternalToolsSettings.getProperty(key, ""); + String defaultSetting = Cooja.getExternalToolsDefaultSetting(key, ""); + String currentSetting = Cooja.currentExternalToolsSettings.getProperty(key, ""); if (key.equals("DEFAULT_PROJECTDIRS")) { differingSettings.setProperty(key, ""); @@ -442,7 +442,7 @@ public class ExecuteJAR { return true; } - private static void handleExportAttributesToJAR(Element e, GUI gui, File toDir) { + private static void handleExportAttributesToJAR(Element e, Cooja gui, File toDir) { /* Checks configuration for EXPORT attributes: * copy: file copy file to exported JAR, update file path. * discard: remove config element */ @@ -489,8 +489,8 @@ public class ExecuteJAR { Attribute a = c.getAttribute("EXPORT"); if (a != null && a.getValue().equals("copy")) { /* Copy file from JAR */ - File file = GUI.restoreConfigRelativePath(config, new File(c.getText())); - InputStream inputStream = GUI.class.getResourceAsStream("/" + file.getName()); + File file = Cooja.restoreConfigRelativePath(config, new File(c.getText())); + InputStream inputStream = Cooja.class.getResourceAsStream("/" + file.getName()); if (inputStream == null) { throw new RuntimeException("Could not unpack file: " + file); }