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.
This commit is contained in:
parent
f13af20f12
commit
625537158f
|
@ -1,2 +1,2 @@
|
||||||
se.sics.cooja.GUI.MOTETYPES = + se.sics.cooja.avrmote.MicaZMoteType
|
se.sics.cooja.Cooja.MOTETYPES = + se.sics.cooja.avrmote.MicaZMoteType
|
||||||
se.sics.cooja.GUI.JARFILES = + cooja_avrora.jar avrora-small.jar
|
se.sics.cooja.Cooja.JARFILES = + cooja_avrora.jar avrora-small.jar
|
||||||
|
|
|
@ -34,7 +34,7 @@ import java.io.File;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
@ -82,7 +82,7 @@ public class MicaZCompileDialog extends AbstractCompileDialog {
|
||||||
/* TODO Split into String[] */
|
/* TODO Split into String[] */
|
||||||
return
|
return
|
||||||
/*"make clean TARGET=micaz\n" + */
|
/*"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) {
|
public File getExpectedFirmwareFile(File source) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.AbstractionLevelDescription;
|
import se.sics.cooja.AbstractionLevelDescription;
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
|
@ -199,7 +199,7 @@ public class MicaZMoteType implements MoteType {
|
||||||
panel.add(smallPane);
|
panel.add(smallPane);
|
||||||
|
|
||||||
/* Icon (if available) */
|
/* Icon (if available) */
|
||||||
if (!GUI.isVisualizedInApplet()) {
|
if (!Cooja.isVisualizedInApplet()) {
|
||||||
Icon moteTypeIcon = getMoteTypeIcon();
|
Icon moteTypeIcon = getMoteTypeIcon();
|
||||||
if (moteTypeIcon != null) {
|
if (moteTypeIcon != null) {
|
||||||
smallPane = new JPanel(new BorderLayout());
|
smallPane = new JPanel(new BorderLayout());
|
||||||
|
@ -315,7 +315,7 @@ public class MicaZMoteType implements MoteType {
|
||||||
throw new MoteTypeCreationException("Either source or firmware not specified");
|
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)
|
public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable)
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
se.sics.cooja.GUI.PLUGINS = + se.sics.cooja.plugins.collectview.CollectView
|
se.sics.cooja.Cooja.PLUGINS = + se.sics.cooja.plugins.collectview.CollectView
|
||||||
se.sics.cooja.GUI.JARFILES = + cooja-collect-view.jar
|
se.sics.cooja.Cooja.JARFILES = + cooja-collect-view.jar
|
||||||
|
|
|
@ -49,7 +49,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.HasQuickHelp;
|
import se.sics.cooja.HasQuickHelp;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MotePlugin;
|
import se.sics.cooja.MotePlugin;
|
||||||
|
@ -81,7 +81,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp {
|
||||||
private DataOutputStream out;
|
private DataOutputStream out;
|
||||||
private boolean isRunning;
|
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);
|
super("Collect View (" + mote + ")", gui, false);
|
||||||
this.mote = mote;
|
this.mote = mote;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GUI components */
|
/* GUI components */
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
inLabel = new JLabel(" 0 bytes", JLabel.RIGHT);
|
inLabel = new JLabel(" 0 bytes", JLabel.RIGHT);
|
||||||
outLabel = 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();
|
pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
String contikiPath = GUI.getExternalToolsSetting("PATH_CONTIKI", "../../..");
|
String contikiPath = Cooja.getExternalToolsSetting("PATH_CONTIKI", "../../..");
|
||||||
String jarFile = contikiPath + "/tools/collect-view/dist/collect-view.jar";
|
String jarFile = contikiPath + "/tools/collect-view/dist/collect-view.jar";
|
||||||
if (!new File(jarFile).canRead()) {
|
if (!new File(jarFile).canRead()) {
|
||||||
logger.fatal("Could not find the CollectView application:" + jarFile);
|
logger.fatal("Could not find the CollectView application:" + jarFile);
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"Could not find the CollectView application:\n" +
|
"Could not find the CollectView application:\n" +
|
||||||
jarFile + "\n\nPlease try to recompile it!",
|
jarFile + "\n\nPlease try to recompile it!",
|
||||||
"CollectView application not found", JOptionPane.ERROR_MESSAGE);
|
"CollectView application not found", JOptionPane.ERROR_MESSAGE);
|
||||||
|
@ -154,7 +154,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp {
|
||||||
}
|
}
|
||||||
serialPort.writeByte((byte) '\n');
|
serialPort.writeByte((byte) '\n');
|
||||||
inBytes += line.length() + 1;
|
inBytes += line.length() + 1;
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
inLabel.setText(inBytes + " bytes");
|
inLabel.setText(inBytes + " bytes");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp {
|
||||||
outBytes++;
|
outBytes++;
|
||||||
if (b == '\n') {
|
if (b == '\n') {
|
||||||
out.flush();
|
out.flush();
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
outLabel.setText(outBytes + " bytes");
|
outLabel.setText(outBytes + " bytes");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ public class CollectView extends VisPlugin implements MotePlugin, HasQuickHelp {
|
||||||
|
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
logger.fatal("The CollectView application died!");
|
logger.fatal("The CollectView application died!");
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
JOptionPane.showMessageDialog(this, "The CollectView application died!",
|
JOptionPane.showMessageDialog(this, "The CollectView application died!",
|
||||||
"CollectView died!", JOptionPane.ERROR_MESSAGE);
|
"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() {
|
EventQueue.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
setTitle(getTitle() + " *DISCONNECTED*");
|
setTitle(getTitle() + " *DISCONNECTED*");
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
se.sics.cooja.GUI.RADIOMEDIUMS = + se.sics.mrm.MRM
|
se.sics.cooja.Cooja.RADIOMEDIUMS = + se.sics.mrm.MRM
|
||||||
se.sics.cooja.GUI.JARFILES = + mrm.jar
|
se.sics.cooja.Cooja.JARFILES = + mrm.jar
|
||||||
|
|
|
@ -98,7 +98,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
import se.sics.cooja.SupportedArguments;
|
import se.sics.cooja.SupportedArguments;
|
||||||
|
@ -220,7 +220,7 @@ public class AreaViewer extends VisPlugin {
|
||||||
*
|
*
|
||||||
* @param simulationToVisualize Simulation using MRM
|
* @param simulationToVisualize Simulation using MRM
|
||||||
*/
|
*/
|
||||||
public AreaViewer(Simulation simulationToVisualize, GUI gui) {
|
public AreaViewer(Simulation simulationToVisualize, Cooja gui) {
|
||||||
super("MRM Radio environment", gui);
|
super("MRM Radio environment", gui);
|
||||||
|
|
||||||
currentSimulation = simulationToVisualize;
|
currentSimulation = simulationToVisualize;
|
||||||
|
@ -358,7 +358,7 @@ public class AreaViewer extends VisPlugin {
|
||||||
JRadioButton customButton = new JRadioButton("From bitmap");
|
JRadioButton customButton = new JRadioButton("From bitmap");
|
||||||
customButton.setActionCommand("set custom bitmap");
|
customButton.setActionCommand("set custom bitmap");
|
||||||
customButton.addActionListener(obstacleHandler);
|
customButton.addActionListener(obstacleHandler);
|
||||||
if (GUI.isVisualizedInApplet()) {
|
if (Cooja.isVisualizedInApplet()) {
|
||||||
customButton.setEnabled(false);
|
customButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1147,7 +1147,7 @@ public class AreaViewer extends VisPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set virtual size of image */
|
/* Set virtual size of image */
|
||||||
Container topParent = GUI.getTopParentContainer();
|
Container topParent = Cooja.getTopParentContainer();
|
||||||
ImageSettingsDialog dialog;
|
ImageSettingsDialog dialog;
|
||||||
if (topParent instanceof Frame) {
|
if (topParent instanceof Frame) {
|
||||||
dialog = new ImageSettingsDialog(file, image, (Frame) topParent);
|
dialog = new ImageSettingsDialog(file, image, (Frame) topParent);
|
||||||
|
@ -1185,18 +1185,18 @@ public class AreaViewer extends VisPlugin {
|
||||||
|
|
||||||
/* Show obstacle finder dialog */
|
/* Show obstacle finder dialog */
|
||||||
ObstacleFinderDialog obstacleFinderDialog;
|
ObstacleFinderDialog obstacleFinderDialog;
|
||||||
Container parentContainer = GUI.getTopParentContainer();
|
Container parentContainer = Cooja.getTopParentContainer();
|
||||||
if (parentContainer instanceof Window) {
|
if (parentContainer instanceof Window) {
|
||||||
obstacleFinderDialog = new ObstacleFinderDialog(
|
obstacleFinderDialog = new ObstacleFinderDialog(
|
||||||
backgroundImage, currentChannelModel, (Window) GUI.getTopParentContainer()
|
backgroundImage, currentChannelModel, (Window) Cooja.getTopParentContainer()
|
||||||
);
|
);
|
||||||
} else if (parentContainer instanceof Frame) {
|
} else if (parentContainer instanceof Frame) {
|
||||||
obstacleFinderDialog = new ObstacleFinderDialog(
|
obstacleFinderDialog = new ObstacleFinderDialog(
|
||||||
backgroundImage, currentChannelModel, (Frame) GUI.getTopParentContainer()
|
backgroundImage, currentChannelModel, (Frame) Cooja.getTopParentContainer()
|
||||||
);
|
);
|
||||||
} else if (parentContainer instanceof Dialog) {
|
} else if (parentContainer instanceof Dialog) {
|
||||||
obstacleFinderDialog = new ObstacleFinderDialog(
|
obstacleFinderDialog = new ObstacleFinderDialog(
|
||||||
backgroundImage, currentChannelModel, (Dialog) GUI.getTopParentContainer()
|
backgroundImage, currentChannelModel, (Dialog) Cooja.getTopParentContainer()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
logger.fatal("Unknown parent container");
|
logger.fatal("Unknown parent container");
|
||||||
|
@ -1213,7 +1213,7 @@ public class AreaViewer extends VisPlugin {
|
||||||
|
|
||||||
// Create progress monitor
|
// Create progress monitor
|
||||||
final ProgressMonitor pm = new ProgressMonitor(
|
final ProgressMonitor pm = new ProgressMonitor(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"Registering obstacles",
|
"Registering obstacles",
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
|
@ -1774,7 +1774,7 @@ public class AreaViewer extends VisPlugin {
|
||||||
|
|
||||||
// Create progress monitor
|
// Create progress monitor
|
||||||
final ProgressMonitor pm = new ProgressMonitor(
|
final ProgressMonitor pm = new ProgressMonitor(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"Calculating channel attenuation",
|
"Calculating channel attenuation",
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -58,7 +58,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
import se.sics.cooja.SupportedArguments;
|
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.
|
* @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);
|
super("MRM Settings", gui);
|
||||||
|
|
||||||
simulation = simulationToVisualize;
|
simulation = simulationToVisualize;
|
||||||
|
|
|
@ -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.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.GUI.JARFILES = + cooja_mspsim.jar mspsim.jar coffee.jar jipv6.jar
|
se.sics.cooja.Cooja.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.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
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.AbstractionLevelDescription;
|
import se.sics.cooja.AbstractionLevelDescription;
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
@ -169,14 +169,14 @@ public class CC430MoteType extends MspMoteType {
|
||||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||||
URL imageURL = this.getClass().getClassLoader().getResource("images/cc430.jpg");
|
URL imageURL = this.getClass().getClassLoader().getResource("images/cc430.jpg");
|
||||||
Image image = toolkit.getImage(imageURL);
|
Image image = toolkit.getImage(imageURL);
|
||||||
MediaTracker tracker = new MediaTracker(GUI.getTopParentContainer());
|
MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer());
|
||||||
tracker.addImage(image, 1);
|
tracker.addImage(image, 1);
|
||||||
try {
|
try {
|
||||||
tracker.waitForAll();
|
tracker.waitForAll();
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
}
|
}
|
||||||
if (image.getHeight(GUI.getTopParentContainer()) > 0 && image.getWidth(GUI.getTopParentContainer()) > 0) {
|
if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) {
|
||||||
image = image.getScaledInstance((200*image.getWidth(GUI.getTopParentContainer())/image.getHeight(GUI.getTopParentContainer())), 200, Image.SCALE_DEFAULT);
|
image = image.getScaledInstance((200*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 200, Image.SCALE_DEFAULT);
|
||||||
return new ImageIcon(image);
|
return new ImageIcon(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,15 +66,15 @@ public abstract class AbstractMspMoteType extends MspMoteType {
|
||||||
|
|
||||||
/* SPECIAL CASE: Cooja started in applet.
|
/* SPECIAL CASE: Cooja started in applet.
|
||||||
* Use preconfigured Contiki firmware */
|
* Use preconfigured Contiki firmware */
|
||||||
if (GUI.isVisualizedInApplet()) {
|
if (Cooja.isVisualizedInApplet()) {
|
||||||
String firmware = GUI.getExternalToolsSetting(getMoteType().toUpperCase() + "_FIRMWARE", "");
|
String firmware = Cooja.getExternalToolsSetting(getMoteType().toUpperCase() + "_FIRMWARE", "");
|
||||||
if (!firmware.equals("")) {
|
if (!firmware.equals("")) {
|
||||||
setContikiFirmwareFile(new File(firmware));
|
setContikiFirmwareFile(new File(firmware));
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"Creating mote type from precompiled firmware: " + firmware,
|
"Creating mote type from precompiled firmware: " + firmware,
|
||||||
"Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE);
|
"Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE);
|
||||||
} else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"No precompiled firmware found",
|
"No precompiled firmware found",
|
||||||
"Compiled firmware file not available", JOptionPane.ERROR_MESSAGE);
|
"Compiled firmware file not available", JOptionPane.ERROR_MESSAGE);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.AbstractionLevelDescription;
|
import se.sics.cooja.AbstractionLevelDescription;
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
@ -73,14 +73,14 @@ public class ESBMoteType extends MspMoteType {
|
||||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||||
URL imageURL = this.getClass().getClassLoader().getResource("images/esb.jpg");
|
URL imageURL = this.getClass().getClassLoader().getResource("images/esb.jpg");
|
||||||
Image image = toolkit.getImage(imageURL);
|
Image image = toolkit.getImage(imageURL);
|
||||||
MediaTracker tracker = new MediaTracker(GUI.getTopParentContainer());
|
MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer());
|
||||||
tracker.addImage(image, 1);
|
tracker.addImage(image, 1);
|
||||||
try {
|
try {
|
||||||
tracker.waitForAll();
|
tracker.waitForAll();
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
}
|
}
|
||||||
if (image.getHeight(GUI.getTopParentContainer()) > 0 && image.getWidth(GUI.getTopParentContainer()) > 0) {
|
if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) {
|
||||||
image = image.getScaledInstance((100*image.getWidth(GUI.getTopParentContainer())/image.getHeight(GUI.getTopParentContainer())), 100, Image.SCALE_DEFAULT);
|
image = image.getScaledInstance((100*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 100, Image.SCALE_DEFAULT);
|
||||||
return new ImageIcon(image);
|
return new ImageIcon(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,15 +96,15 @@ public class ESBMoteType extends MspMoteType {
|
||||||
|
|
||||||
/* SPECIAL CASE: Cooja started in applet.
|
/* SPECIAL CASE: Cooja started in applet.
|
||||||
* Use preconfigured Contiki firmware */
|
* Use preconfigured Contiki firmware */
|
||||||
if (GUI.isVisualizedInApplet()) {
|
if (Cooja.isVisualizedInApplet()) {
|
||||||
String firmware = GUI.getExternalToolsSetting("ESB_FIRMWARE", "");
|
String firmware = Cooja.getExternalToolsSetting("ESB_FIRMWARE", "");
|
||||||
if (!firmware.equals("")) {
|
if (!firmware.equals("")) {
|
||||||
setContikiFirmwareFile(new File(firmware));
|
setContikiFirmwareFile(new File(firmware));
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"Creating mote type from precompiled firmware: " + firmware,
|
"Creating mote type from precompiled firmware: " + firmware,
|
||||||
"Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE);
|
"Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE);
|
||||||
} else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"No precompiled firmware found",
|
"No precompiled firmware found",
|
||||||
"Compiled firmware file not available", JOptionPane.ERROR_MESSAGE);
|
"Compiled firmware file not available", JOptionPane.ERROR_MESSAGE);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.AbstractionLevelDescription;
|
import se.sics.cooja.AbstractionLevelDescription;
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
@ -168,14 +168,14 @@ public class Exp5438MoteType extends MspMoteType {
|
||||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||||
URL imageURL = this.getClass().getClassLoader().getResource("exp5438.png");
|
URL imageURL = this.getClass().getClassLoader().getResource("exp5438.png");
|
||||||
Image image = toolkit.getImage(imageURL);
|
Image image = toolkit.getImage(imageURL);
|
||||||
MediaTracker tracker = new MediaTracker(GUI.getTopParentContainer());
|
MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer());
|
||||||
tracker.addImage(image, 1);
|
tracker.addImage(image, 1);
|
||||||
try {
|
try {
|
||||||
tracker.waitForAll();
|
tracker.waitForAll();
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
}
|
}
|
||||||
if (image.getHeight(GUI.getTopParentContainer()) > 0 && image.getWidth(GUI.getTopParentContainer()) > 0) {
|
if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) {
|
||||||
image = image.getScaledInstance((200*image.getWidth(GUI.getTopParentContainer())/image.getHeight(GUI.getTopParentContainer())), 200, Image.SCALE_DEFAULT);
|
image = image.getScaledInstance((200*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 200, Image.SCALE_DEFAULT);
|
||||||
return new ImageIcon(image);
|
return new ImageIcon(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
import se.sics.cooja.dialogs.AbstractCompileDialog;
|
import se.sics.cooja.dialogs.AbstractCompileDialog;
|
||||||
|
@ -102,7 +102,7 @@ public class MspCompileDialog extends AbstractCompileDialog {
|
||||||
public String getDefaultCompileCommands(File source) {
|
public String getDefaultCompileCommands(File source) {
|
||||||
/* TODO Split into String[] */
|
/* TODO Split into String[] */
|
||||||
return
|
return
|
||||||
GUI.getExternalToolsSetting("PATH_MAKE") + " " +
|
Cooja.getExternalToolsSetting("PATH_MAKE") + " " +
|
||||||
getExpectedFirmwareFile(source).getName() + " TARGET=" + target;
|
getExpectedFirmwareFile(source).getName() + " TARGET=" + target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ContikiError;
|
import se.sics.cooja.ContikiError;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteInterfaceHandler;
|
import se.sics.cooja.MoteInterfaceHandler;
|
||||||
|
@ -230,7 +230,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
|
||||||
this.myCpu.getLogger().addLogListener(ll);
|
this.myCpu.getLogger().addLogListener(ll);
|
||||||
|
|
||||||
logger.info("Loading firmware from: " + fileELF.getAbsolutePath());
|
logger.info("Loading firmware from: " + fileELF.getAbsolutePath());
|
||||||
GUI.setProgressMessage("Loading " + fileELF.getName());
|
Cooja.setProgressMessage("Loading " + fileELF.getName());
|
||||||
node.loadFirmware(((MspMoteType)getType()).getELF());
|
node.loadFirmware(((MspMoteType)getType()).getELF());
|
||||||
|
|
||||||
/* Throw exceptions at bad memory access */
|
/* Throw exceptions at bad memory access */
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
|
@ -168,7 +168,7 @@ public abstract class MspMoteType implements MoteType {
|
||||||
JLabel label = new JLabel(sb.append("</table></html>").toString());
|
JLabel label = new JLabel(sb.append("</table></html>").toString());
|
||||||
label.setVerticalTextPosition(JLabel.TOP);
|
label.setVerticalTextPosition(JLabel.TOP);
|
||||||
/* Icon (if available) */
|
/* Icon (if available) */
|
||||||
if (!GUI.isVisualizedInApplet()) {
|
if (!Cooja.isVisualizedInApplet()) {
|
||||||
Icon moteTypeIcon = getMoteTypeIcon();
|
Icon moteTypeIcon = getMoteTypeIcon();
|
||||||
if (moteTypeIcon != null) {
|
if (moteTypeIcon != null) {
|
||||||
label.setIcon(moteTypeIcon);
|
label.setIcon(moteTypeIcon);
|
||||||
|
@ -316,7 +316,7 @@ public abstract class MspMoteType implements MoteType {
|
||||||
fileFirmware = getExpectedFirmwareFile(fileSource);
|
fileFirmware = getExpectedFirmwareFile(fileSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
return configureAndInit(GUI.getTopParentContainer(), simulation, visAvailable);
|
return configureAndInit(Cooja.getTopParentContainer(), simulation, visAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Class<? extends MoteInterface>[] getAllMoteInterfaceClasses();
|
public abstract Class<? extends MoteInterface>[] getAllMoteInterfaceClasses();
|
||||||
|
@ -330,7 +330,7 @@ public abstract class MspMoteType implements MoteType {
|
||||||
private ELF elf; /* cached */
|
private ELF elf; /* cached */
|
||||||
public ELF getELF() throws IOException {
|
public ELF getELF() throws IOException {
|
||||||
if (elf == null) {
|
if (elf == null) {
|
||||||
if (GUI.isVisualizedInApplet()) {
|
if (Cooja.isVisualizedInApplet()) {
|
||||||
logger.warn("ELF loading in applet not implemented");
|
logger.warn("ELF loading in applet not implemented");
|
||||||
}
|
}
|
||||||
elf = loadELF(getContikiFirmwareFile().getPath());
|
elf = loadELF(getContikiFirmwareFile().getPath());
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.AbstractionLevelDescription;
|
import se.sics.cooja.AbstractionLevelDescription;
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
@ -82,15 +82,15 @@ public class SkyMoteType extends MspMoteType {
|
||||||
|
|
||||||
/* SPECIAL CASE: Cooja started in applet.
|
/* SPECIAL CASE: Cooja started in applet.
|
||||||
* Use preconfigured Contiki firmware */
|
* Use preconfigured Contiki firmware */
|
||||||
if (GUI.isVisualizedInApplet()) {
|
if (Cooja.isVisualizedInApplet()) {
|
||||||
String firmware = GUI.getExternalToolsSetting("SKY_FIRMWARE", "");
|
String firmware = Cooja.getExternalToolsSetting("SKY_FIRMWARE", "");
|
||||||
if (!firmware.equals("")) {
|
if (!firmware.equals("")) {
|
||||||
setContikiFirmwareFile(new File(firmware));
|
setContikiFirmwareFile(new File(firmware));
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"Creating mote type from precompiled firmware: " + firmware,
|
"Creating mote type from precompiled firmware: " + firmware,
|
||||||
"Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE);
|
"Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE);
|
||||||
} else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"No precompiled firmware found",
|
"No precompiled firmware found",
|
||||||
"Compiled firmware file not available", JOptionPane.ERROR_MESSAGE);
|
"Compiled firmware file not available", JOptionPane.ERROR_MESSAGE);
|
||||||
return false;
|
return false;
|
||||||
|
@ -188,14 +188,14 @@ public class SkyMoteType extends MspMoteType {
|
||||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||||
URL imageURL = this.getClass().getClassLoader().getResource("images/sky.jpg");
|
URL imageURL = this.getClass().getClassLoader().getResource("images/sky.jpg");
|
||||||
Image image = toolkit.getImage(imageURL);
|
Image image = toolkit.getImage(imageURL);
|
||||||
MediaTracker tracker = new MediaTracker(GUI.getTopParentContainer());
|
MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer());
|
||||||
tracker.addImage(image, 1);
|
tracker.addImage(image, 1);
|
||||||
try {
|
try {
|
||||||
tracker.waitForAll();
|
tracker.waitForAll();
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
}
|
}
|
||||||
if (image.getHeight(GUI.getTopParentContainer()) > 0 && image.getWidth(GUI.getTopParentContainer()) > 0) {
|
if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) {
|
||||||
image = image.getScaledInstance((200*image.getWidth(GUI.getTopParentContainer())/image.getHeight(GUI.getTopParentContainer())), 200, Image.SCALE_DEFAULT);
|
image = image.getScaledInstance((200*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 200, Image.SCALE_DEFAULT);
|
||||||
return new ImageIcon(image);
|
return new ImageIcon(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.AbstractionLevelDescription;
|
import se.sics.cooja.AbstractionLevelDescription;
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
@ -165,14 +165,14 @@ public class TyndallMoteType extends MspMoteType {
|
||||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||||
URL imageURL = this.getClass().getClassLoader().getResource("tyndall.png");
|
URL imageURL = this.getClass().getClassLoader().getResource("tyndall.png");
|
||||||
Image image = toolkit.getImage(imageURL);
|
Image image = toolkit.getImage(imageURL);
|
||||||
MediaTracker tracker = new MediaTracker(GUI.getTopParentContainer());
|
MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer());
|
||||||
tracker.addImage(image, 1);
|
tracker.addImage(image, 1);
|
||||||
try {
|
try {
|
||||||
tracker.waitForAll();
|
tracker.waitForAll();
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
}
|
}
|
||||||
if (image.getHeight(GUI.getTopParentContainer()) > 0 && image.getWidth(GUI.getTopParentContainer()) > 0) {
|
if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) {
|
||||||
image = image.getScaledInstance((200*image.getWidth(GUI.getTopParentContainer())/image.getHeight(GUI.getTopParentContainer())), 200, Image.SCALE_DEFAULT);
|
image = image.getScaledInstance((200*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 200, Image.SCALE_DEFAULT);
|
||||||
return new ImageIcon(image);
|
return new ImageIcon(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ import org.jdom.Element;
|
||||||
import se.sics.coffee.CoffeeFS;
|
import se.sics.coffee.CoffeeFS;
|
||||||
import se.sics.coffee.CoffeeFile;
|
import se.sics.coffee.CoffeeFile;
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.dialogs.TableColumnAdjuster;
|
import se.sics.cooja.dialogs.TableColumnAdjuster;
|
||||||
|
@ -167,7 +167,7 @@ public class SkyCoffeeFilesystem extends MoteInterface {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
JFileChooser fileChooser = new JFileChooser();
|
JFileChooser fileChooser = new JFileChooser();
|
||||||
int reply = fileChooser.showOpenDialog(GUI.getTopParentContainer());
|
int reply = fileChooser.showOpenDialog(Cooja.getTopParentContainer());
|
||||||
if (reply != JFileChooser.APPROVE_OPTION) {
|
if (reply != JFileChooser.APPROVE_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ public class SkyCoffeeFilesystem extends MoteInterface {
|
||||||
public void setValueAt(Object value, final int row, int col) {
|
public void setValueAt(Object value, final int row, int col) {
|
||||||
if (col == COLUMN_SAVE) {
|
if (col == COLUMN_SAVE) {
|
||||||
JFileChooser fc = new JFileChooser();
|
JFileChooser fc = new JFileChooser();
|
||||||
int returnVal = fc.showSaveDialog(GUI.getTopParentContainer());
|
int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer());
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ public class SkyCoffeeFilesystem extends MoteInterface {
|
||||||
String s2 = "Cancel";
|
String s2 = "Cancel";
|
||||||
Object[] options = { s1, s2 };
|
Object[] options = { s1, s2 };
|
||||||
int n = JOptionPane.showOptionDialog(
|
int n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"A file with the same name already exists.\nDo you want to remove it?",
|
"A file with the same name already exists.\nDo you want to remove it?",
|
||||||
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
||||||
|
@ -270,7 +270,7 @@ public class SkyCoffeeFilesystem extends MoteInterface {
|
||||||
|
|
||||||
if (col == COLUMN_REMOVE) {
|
if (col == COLUMN_REMOVE) {
|
||||||
int reply = JOptionPane.showConfirmDialog(
|
int reply = JOptionPane.showConfirmDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"Remove \"" + files[row].getName() + "\" from filesystem?");
|
"Remove \"" + files[row].getName() + "\" from filesystem?");
|
||||||
if (reply != JOptionPane.YES_OPTION) {
|
if (reply != JOptionPane.YES_OPTION) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class SkyFlash extends MoteInterface {
|
||||||
final JButton downloadButton = new JButton("Store to file");
|
final JButton downloadButton = new JButton("Store to file");
|
||||||
panel.add(downloadButton);
|
panel.add(downloadButton);
|
||||||
|
|
||||||
if (GUI.isVisualizedInApplet()) {
|
if (Cooja.isVisualizedInApplet()) {
|
||||||
uploadButton.setEnabled(false);
|
uploadButton.setEnabled(false);
|
||||||
uploadButton.setToolTipText("Not available in applet mode");
|
uploadButton.setToolTipText("Not available in applet mode");
|
||||||
downloadButton.setEnabled(false);
|
downloadButton.setEnabled(false);
|
||||||
|
@ -95,7 +95,7 @@ public class SkyFlash extends MoteInterface {
|
||||||
|
|
||||||
uploadButton.addActionListener(new ActionListener() {
|
uploadButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
byte[] fileData = readDialogFileBytes(GUI.getTopParentContainer());
|
byte[] fileData = readDialogFileBytes(Cooja.getTopParentContainer());
|
||||||
|
|
||||||
if (fileData != null) {
|
if (fileData != null) {
|
||||||
if (fileData.length > CoojaM25P80.SIZE) {
|
if (fileData.length > CoojaM25P80.SIZE) {
|
||||||
|
@ -120,7 +120,7 @@ public class SkyFlash extends MoteInterface {
|
||||||
m24p80.seek(0);
|
m24p80.seek(0);
|
||||||
m24p80.readFully(data);
|
m24p80.readFully(data);
|
||||||
|
|
||||||
writeDialogFileBytes(GUI.getTopParentContainer(), data);
|
writeDialogFileBytes(Cooja.getTopParentContainer(), data);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.fatal("Data download failed: " + ex.getMessage(), 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) {
|
public static void writeDialogFileBytes(Component parent, byte[] data) {
|
||||||
JFileChooser fc = new JFileChooser();
|
JFileChooser fc = new JFileChooser();
|
||||||
int returnVal = fc.showSaveDialog(GUI.getTopParentContainer());
|
int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer());
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ public class SkyFlash extends MoteInterface {
|
||||||
String s2 = "Cancel";
|
String s2 = "Cancel";
|
||||||
Object[] options = { s1, s2 };
|
Object[] options = { s1, s2 };
|
||||||
int n = JOptionPane.showOptionDialog(
|
int n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"A file with the same name already exists.\nDo you want to remove it?",
|
"A file with the same name already exists.\nDo you want to remove it?",
|
||||||
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
||||||
|
|
|
@ -53,7 +53,7 @@ import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Watchpoint;
|
import se.sics.cooja.Watchpoint;
|
||||||
import se.sics.cooja.WatchpointMote;
|
import se.sics.cooja.WatchpointMote;
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ public class BreakpointsUI extends JPanel {
|
||||||
|
|
||||||
private void configureWatchpointInfo(Watchpoint breakpoint) {
|
private void configureWatchpointInfo(Watchpoint breakpoint) {
|
||||||
String msg = (String) JOptionPane.showInputDialog(
|
String msg = (String) JOptionPane.showInputDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"Enter description;",
|
"Enter description;",
|
||||||
"Watchpoint description",
|
"Watchpoint description",
|
||||||
JOptionPane.QUESTION_MESSAGE, null, null, breakpoint.getUserMessage());
|
JOptionPane.QUESTION_MESSAGE, null, null, breakpoint.getUserMessage());
|
||||||
|
@ -210,7 +210,7 @@ public class BreakpointsUI extends JPanel {
|
||||||
}
|
}
|
||||||
breakpoint.setUserMessage(msg);
|
breakpoint.setUserMessage(msg);
|
||||||
Color newColor = JColorChooser.showDialog(
|
Color newColor = JColorChooser.showDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"Watchpoint color",
|
"Watchpoint color",
|
||||||
breakpoint.getColor());
|
breakpoint.getColor());
|
||||||
if (newColor == null) {
|
if (newColor == null) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ import javax.swing.JTextArea;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.HasQuickHelp;
|
import se.sics.cooja.HasQuickHelp;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MotePlugin;
|
import se.sics.cooja.MotePlugin;
|
||||||
|
@ -74,7 +74,7 @@ public class MspCLI extends VisPlugin implements MotePlugin, HasQuickHelp {
|
||||||
private int historyPos = 0;
|
private int historyPos = 0;
|
||||||
private int historyCount = 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);
|
super("Msp CLI (" + mote.getID() + ')', gui);
|
||||||
this.mspMote = (MspMote) mote;
|
this.mspMote = (MspMote) mote;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MotePlugin;
|
import se.sics.cooja.MotePlugin;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
|
@ -125,7 +125,7 @@ public class MspCodeWatcher extends VisPlugin implements MotePlugin {
|
||||||
* @param simulationToVisualize Simulation
|
* @param simulationToVisualize Simulation
|
||||||
* @param gui Simulator
|
* @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);
|
super("Msp Code Watcher - " + mote, gui);
|
||||||
simulation = simulationToVisualize;
|
simulation = simulationToVisualize;
|
||||||
this.mspMote = (MspMote) mote;
|
this.mspMote = (MspMote) mote;
|
||||||
|
@ -453,7 +453,7 @@ public class MspCodeWatcher extends VisPlugin implements MotePlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadDefaultRules() {
|
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("\\*");
|
String[] rulesArr = rulesString.split("\\*");
|
||||||
rules.clear();
|
rules.clear();
|
||||||
for (int i=0; i < rulesArr.length/2; i++) {
|
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 JTable table = null;
|
||||||
private void tryMapDebugInfo() {
|
private void tryMapDebugInfo() {
|
||||||
/* called from AWT */
|
/* 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" +
|
"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" +
|
"This function tries to locate these files on disk with a set of simple substitution rules.\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
@ -487,7 +487,7 @@ public class MspCodeWatcher extends VisPlugin implements MotePlugin {
|
||||||
|
|
||||||
/* table with rules */
|
/* table with rules */
|
||||||
rulesDebuggingOutput.clearMessages();
|
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);
|
dialog.setModal(true);
|
||||||
updateRulesUsage();
|
updateRulesUsage();
|
||||||
AbstractTableModel model = new AbstractTableModel() {
|
AbstractTableModel model = new AbstractTableModel() {
|
||||||
|
@ -646,9 +646,9 @@ public class MspCodeWatcher extends VisPlugin implements MotePlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sb.length() >= 1) {
|
if (sb.length() >= 1) {
|
||||||
GUI.setExternalToolsSetting("MSPCODEWATCHER_RULES", sb.substring(1));
|
Cooja.setExternalToolsSetting("MSPCODEWATCHER_RULES", sb.substring(1));
|
||||||
} else {
|
} 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.getContentPane().add(BorderLayout.SOUTH, control);
|
||||||
dialog.getRootPane().setDefaultButton(closeButton);
|
dialog.getRootPane().setDefaultButton(closeButton);
|
||||||
dialog.setSize(550, 500);
|
dialog.setSize(550, 500);
|
||||||
dialog.setLocationRelativeTo(GUI.getTopParentContainer());
|
dialog.setLocationRelativeTo(Cooja.getTopParentContainer());
|
||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ import javax.swing.JTextField;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MotePlugin;
|
import se.sics.cooja.MotePlugin;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
|
@ -69,7 +69,7 @@ public class MspCycleWatcher extends VisPlugin implements MotePlugin {
|
||||||
private JTextField resetTextField = new JTextField("");
|
private JTextField resetTextField = new JTextField("");
|
||||||
private long cycleReset = 0;
|
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);
|
super("Msp Cycle Watcher", gui);
|
||||||
this.mspMote = (MspMote) mote;
|
this.mspMote = (MspMote) mote;
|
||||||
cpu = mspMote.getCPU();
|
cpu = mspMote.getCPU();
|
||||||
|
|
|
@ -47,7 +47,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MotePlugin;
|
import se.sics.cooja.MotePlugin;
|
||||||
import se.sics.cooja.MoteTimeEvent;
|
import se.sics.cooja.MoteTimeEvent;
|
||||||
|
@ -83,7 +83,7 @@ public class MspStackWatcher extends VisPlugin implements MotePlugin {
|
||||||
|
|
||||||
private JLabel memLabel = new JLabel("");
|
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);
|
super("Msp Stack Watcher: " + mote, gui);
|
||||||
this.mspMote = (MspMote) mote;
|
this.mspMote = (MspMote) mote;
|
||||||
cpu = mspMote.getCPU();
|
cpu = mspMote.getCPU();
|
||||||
|
@ -135,7 +135,7 @@ public class MspStackWatcher extends VisPlugin implements MotePlugin {
|
||||||
|
|
||||||
if (gui) {
|
if (gui) {
|
||||||
String s = (String)JOptionPane.showInputDialog(
|
String s = (String)JOptionPane.showInputDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"With default linker scripts the stack starts at 0x" + Integer.toHexString(stack) + ".\n" +
|
"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.",
|
"If you are using a modified linker script, you may here correct the stack start address.",
|
||||||
"Enter stack start address",
|
"Enter stack start address",
|
||||||
|
@ -193,7 +193,7 @@ public class MspStackWatcher extends VisPlugin implements MotePlugin {
|
||||||
if (available <= 0) {
|
if (available <= 0) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
String.format("Stack overflow!\n\n" +
|
String.format("Stack overflow!\n\n" +
|
||||||
"\tSP = 0x%05x\n" +
|
"\tSP = 0x%05x\n" +
|
||||||
"\tHeap start = 0x%05x\n\n" +
|
"\tHeap start = 0x%05x\n\n" +
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
se.sics.cooja.GUI.PLUGINS = + se.sics.cooja.plugins.NativeIPGateway
|
se.sics.cooja.Cooja.PLUGINS = + se.sics.cooja.plugins.NativeIPGateway
|
||||||
se.sics.cooja.GUI.JARFILES = + native_gateway.jar
|
se.sics.cooja.Cooja.JARFILES = + native_gateway.jar
|
||||||
|
|
|
@ -67,8 +67,8 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.GUI.RunnableInEDT;
|
import se.sics.cooja.Cooja.RunnableInEDT;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MotePlugin;
|
import se.sics.cooja.MotePlugin;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
se.sics.cooja.GUI.PLUGINS = + PowerTracker
|
se.sics.cooja.Cooja.PLUGINS = + PowerTracker
|
||||||
se.sics.cooja.GUI.JARFILES = + powertracker.jar
|
se.sics.cooja.Cooja.JARFILES = + powertracker.jar
|
||||||
|
|
|
@ -55,7 +55,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.SimEventCentral.MoteCountListener;
|
import se.sics.cooja.SimEventCentral.MoteCountListener;
|
||||||
|
@ -88,7 +88,7 @@ public class PowerTracker extends VisPlugin {
|
||||||
private JTable table;
|
private JTable table;
|
||||||
private int tableMaxRadioOnIndex = -1;
|
private int tableMaxRadioOnIndex = -1;
|
||||||
|
|
||||||
public PowerTracker(final Simulation simulation, final GUI gui) {
|
public PowerTracker(final Simulation simulation, final Cooja gui) {
|
||||||
super("PowerTracker", gui, false);
|
super("PowerTracker", gui, false);
|
||||||
this.simulation = simulation;
|
this.simulation = simulation;
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ public class PowerTracker extends VisPlugin {
|
||||||
addMote(m);
|
addMote(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GUI.isVisualized()) {
|
if (!Cooja.isVisualized()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
se.sics.cooja.GUI.PLUGINS = + SerialSocketClient SerialSocketServer
|
se.sics.cooja.Cooja.PLUGINS = + SerialSocketClient SerialSocketServer
|
||||||
se.sics.cooja.GUI.JARFILES = + serial_socket.jar
|
se.sics.cooja.Cooja.JARFILES = + serial_socket.jar
|
||||||
|
|
|
@ -49,7 +49,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MotePlugin;
|
import se.sics.cooja.MotePlugin;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
|
@ -86,12 +86,12 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin {
|
||||||
|
|
||||||
private Mote mote;
|
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);
|
super("Serial Socket (CLIENT) (" + mote + ")", gui, false);
|
||||||
this.mote = mote;
|
this.mote = mote;
|
||||||
|
|
||||||
/* GUI components */
|
/* GUI components */
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
Box northBox = Box.createHorizontalBox();
|
Box northBox = Box.createHorizontalBox();
|
||||||
northBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
northBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||||
statusLabel = configureLabel(northBox, "", "");
|
statusLabel = configureLabel(northBox, "", "");
|
||||||
|
@ -134,7 +134,7 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin {
|
||||||
out.write(serialPort.getLastSerialData());
|
out.write(serialPort.getLastSerialData());
|
||||||
out.flush();
|
out.flush();
|
||||||
outBytes++;
|
outBytes++;
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
outLabel.setText(outBytes + " bytes");
|
outLabel.setText(outBytes + " bytes");
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -165,7 +165,7 @@ public class SerialSocketClient extends VisPlugin implements MotePlugin {
|
||||||
serialPort.writeByte(data[i]);
|
serialPort.writeByte(data[i]);
|
||||||
}
|
}
|
||||||
inBytes += numRead;
|
inBytes += numRead;
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
inLabel.setText(inBytes + " bytes");
|
inLabel.setText(inBytes + " bytes");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -53,7 +53,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MotePlugin;
|
import se.sics.cooja.MotePlugin;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
|
@ -90,7 +90,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
||||||
|
|
||||||
private Mote mote;
|
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);
|
super("Serial Socket (SERVER) (" + mote + ")", gui, false);
|
||||||
this.mote = mote;
|
this.mote = mote;
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
||||||
LISTEN_PORT = 60000 + mote.getID();
|
LISTEN_PORT = 60000 + mote.getID();
|
||||||
|
|
||||||
/* GUI components */
|
/* GUI components */
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
Box northBox = Box.createHorizontalBox();
|
Box northBox = Box.createHorizontalBox();
|
||||||
northBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
northBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||||
statusLabel = configureLabel(northBox, "", "");
|
statusLabel = configureLabel(northBox, "", "");
|
||||||
|
@ -122,7 +122,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.info("Listening on port: " + LISTEN_PORT);
|
logger.info("Listening on port: " + LISTEN_PORT);
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
statusLabel.setText("Listening on port: " + LISTEN_PORT);
|
statusLabel.setText("Listening on port: " + LISTEN_PORT);
|
||||||
}
|
}
|
||||||
server = new ServerSocket(LISTEN_PORT);
|
server = new ServerSocket(LISTEN_PORT);
|
||||||
|
@ -136,7 +136,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
startSocketReadThread(in);
|
startSocketReadThread(in);
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
statusLabel.setText("Client connected: " + client.getInetAddress());
|
statusLabel.setText("Client connected: " + client.getInetAddress());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -247,7 +247,7 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
statusLabel.setText("Listening on port: " + LISTEN_PORT);
|
statusLabel.setText("Listening on port: " + LISTEN_PORT);
|
||||||
|
|
|
@ -100,7 +100,7 @@ The COOJA Simulator
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="run" depends="init, compile, jar, copy configs">
|
<target name="run" depends="init, compile, jar, copy configs">
|
||||||
<java fork="yes" dir="${build}" classname="se.sics.cooja.GUI" maxmemory="512m">
|
<java fork="yes" dir="${build}" classname="se.sics.cooja.Cooja" maxmemory="512m">
|
||||||
<sysproperty key="user.language" value="en"/>
|
<sysproperty key="user.language" value="en"/>
|
||||||
<arg line="${args}"/>
|
<arg line="${args}"/>
|
||||||
<env key="LD_LIBRARY_PATH" value="."/>
|
<env key="LD_LIBRARY_PATH" value="."/>
|
||||||
|
@ -114,7 +114,7 @@ The COOJA Simulator
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="run64" depends="init, compile, jar, copy configs">
|
<target name="run64" depends="init, compile, jar, copy configs">
|
||||||
<java fork="yes" dir="${build}" classname="se.sics.cooja.GUI" maxmemory="512m">
|
<java fork="yes" dir="${build}" classname="se.sics.cooja.Cooja" maxmemory="512m">
|
||||||
<sysproperty key="user.language" value="en"/>
|
<sysproperty key="user.language" value="en"/>
|
||||||
<jvmarg value="-d64 -XX:+ShowMessageBoxOnError"/>
|
<jvmarg value="-d64 -XX:+ShowMessageBoxOnError"/>
|
||||||
<arg line="${args}"/>
|
<arg line="${args}"/>
|
||||||
|
@ -129,7 +129,7 @@ The COOJA Simulator
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="run_errorbox" depends="init, compile, jar, copy configs">
|
<target name="run_errorbox" depends="init, compile, jar, copy configs">
|
||||||
<java fork="yes" dir="${build}" classname="se.sics.cooja.GUI" maxmemory="512m">
|
<java fork="yes" dir="${build}" classname="se.sics.cooja.Cooja" maxmemory="512m">
|
||||||
<sysproperty key="user.language" value="en"/>
|
<sysproperty key="user.language" value="en"/>
|
||||||
<jvmarg value="-XX:+ShowMessageBoxOnError"/>
|
<jvmarg value="-XX:+ShowMessageBoxOnError"/>
|
||||||
<env key="LD_LIBRARY_PATH" value="."/>
|
<env key="LD_LIBRARY_PATH" value="."/>
|
||||||
|
@ -143,7 +143,7 @@ The COOJA Simulator
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="runprof" depends="init, compile, jar, copy configs">
|
<target name="runprof" depends="init, compile, jar, copy configs">
|
||||||
<java fork="yes" dir="${build}" classname="se.sics.cooja.GUI">
|
<java fork="yes" dir="${build}" classname="se.sics.cooja.Cooja">
|
||||||
<arg line="${args}"/>
|
<arg line="${args}"/>
|
||||||
<env key="LD_LIBRARY_PATH" value="."/>
|
<env key="LD_LIBRARY_PATH" value="."/>
|
||||||
<jvmarg line="-agentlib:yjpagent"/>
|
<jvmarg line="-agentlib:yjpagent"/>
|
||||||
|
@ -157,7 +157,7 @@ The COOJA Simulator
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="runfree" depends="init, compile, jar, copy configs">
|
<target name="runfree" depends="init, compile, jar, copy configs">
|
||||||
<java fork="yes" dir="${build}" classname="se.sics.cooja.GUI" maxmemory="1536m">
|
<java fork="yes" dir="${build}" classname="se.sics.cooja.Cooja" maxmemory="1536m">
|
||||||
<arg line="${args}"/>
|
<arg line="${args}"/>
|
||||||
<env key="LD_LIBRARY_PATH" value="."/>
|
<env key="LD_LIBRARY_PATH" value="."/>
|
||||||
<classpath>
|
<classpath>
|
||||||
|
@ -172,7 +172,7 @@ The COOJA Simulator
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="run_bigmem" depends="init, compile, jar, copy configs">
|
<target name="run_bigmem" depends="init, compile, jar, copy configs">
|
||||||
<java fork="yes" dir="${build}" classname="se.sics.cooja.GUI" maxmemory="1536m">
|
<java fork="yes" dir="${build}" classname="se.sics.cooja.Cooja" maxmemory="1536m">
|
||||||
<arg line="${args}"/>
|
<arg line="${args}"/>
|
||||||
<env key="LD_LIBRARY_PATH" value="."/>
|
<env key="LD_LIBRARY_PATH" value="."/>
|
||||||
<classpath>
|
<classpath>
|
||||||
|
@ -194,7 +194,7 @@ The COOJA Simulator
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="run_nogui" depends="init, compile, jar, copy configs">
|
<target name="run_nogui" depends="init, compile, jar, copy configs">
|
||||||
<java fork="yes" dir="${build}" classname="se.sics.cooja.GUI" maxmemory="512m">
|
<java fork="yes" dir="${build}" classname="se.sics.cooja.Cooja" maxmemory="512m">
|
||||||
<arg line="-nogui=${args}"/>
|
<arg line="-nogui=${args}"/>
|
||||||
<env key="LD_LIBRARY_PATH" value="."/>
|
<env key="LD_LIBRARY_PATH" value="."/>
|
||||||
<classpath>
|
<classpath>
|
||||||
|
@ -225,7 +225,7 @@ The COOJA Simulator
|
||||||
<mkdir dir="${dist}"/>
|
<mkdir dir="${dist}"/>
|
||||||
<jar destfile="${dist}/cooja.jar" basedir="${build}">
|
<jar destfile="${dist}/cooja.jar" basedir="${build}">
|
||||||
<manifest>
|
<manifest>
|
||||||
<attribute name="Main-Class" value="se.sics.cooja.GUI"/>
|
<attribute name="Main-Class" value="se.sics.cooja.Cooja"/>
|
||||||
<attribute name="Class-Path" value=". lib/log4j.jar lib/jdom.jar lib/jsyntaxpane.jar"/>
|
<attribute name="Class-Path" value=". lib/log4j.jar lib/jdom.jar lib/jsyntaxpane.jar"/>
|
||||||
</manifest>
|
</manifest>
|
||||||
</jar>
|
</jar>
|
||||||
|
|
|
@ -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.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.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.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.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.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.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.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
|
||||||
|
|
|
@ -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.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.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.Cooja.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.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.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.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.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.RADIOMEDIUMS = se.sics.cooja.radiomediums.UDGM se.sics.cooja.radiomediums.UDGMConstantLoss se.sics.cooja.radiomediums.DirectedGraphMedium se.sics.cooja.radiomediums.SilentRadioMedium
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
DESCRIPTION = Example plugin
|
DESCRIPTION = Example plugin
|
||||||
se.sics.cooja.GUI.PLUGINS = + MyDummyPlugin
|
se.sics.cooja.Cooja.PLUGINS = + MyDummyPlugin
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
import se.sics.cooja.TimeEvent;
|
import se.sics.cooja.TimeEvent;
|
||||||
|
@ -76,7 +76,7 @@ public class MyDummyPlugin extends VisPlugin {
|
||||||
* @param simulation Simulation object
|
* @param simulation Simulation object
|
||||||
* @param gui GUI object
|
* @param gui GUI object
|
||||||
*/
|
*/
|
||||||
public MyDummyPlugin(Simulation simulation, GUI gui) {
|
public MyDummyPlugin(Simulation simulation, Cooja gui) {
|
||||||
super("Example plugin title", gui);
|
super("Example plugin title", gui);
|
||||||
this.sim = simulation;
|
this.sim = simulation;
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
se.sics.cooja.GUI.RADIOMEDIUMS = + DummyRadioMedium
|
se.sics.cooja.Cooja.RADIOMEDIUMS = + DummyRadioMedium
|
||||||
|
|
|
@ -43,7 +43,7 @@ import se.sics.cooja.radiomediums.AbstractRadioMedium;
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Dummy Radio Medium")
|
@ClassDescription("Dummy Radio Medium")
|
||||||
public class DummyRadioMedium extends AbstractRadioMedium {
|
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) {
|
public DummyRadioMedium(Simulation simulation) {
|
||||||
super(simulation);
|
super(simulation);
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class COOJAProject {
|
||||||
Collections.addAll(dirs, newf);
|
Collections.addAll(dirs, newf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(subf.getName().equals(GUI.PROJECT_CONFIG_FILENAME)){
|
if(subf.getName().equals(Cooja.PROJECT_CONFIG_FILENAME)){
|
||||||
try{
|
try{
|
||||||
dirs.add(folder);
|
dirs.add(folder);
|
||||||
} catch(Exception e){
|
} catch(Exception e){
|
||||||
|
@ -89,7 +89,7 @@ public class COOJAProject {
|
||||||
public COOJAProject(File dir) {
|
public COOJAProject(File dir) {
|
||||||
try {
|
try {
|
||||||
this.dir = dir;
|
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 = new ProjectConfig(false);
|
||||||
config.appendConfigFile(configFile);
|
config.appendConfigFile(configFile);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -113,7 +113,7 @@ public class COOJAProject {
|
||||||
if (getConfigJARs() != null) {
|
if (getConfigJARs() != null) {
|
||||||
String[] jars = getConfigJARs();
|
String[] jars = getConfigJARs();
|
||||||
for (String jar: jars) {
|
for (String jar: jars) {
|
||||||
File jarFile = GUI.findJarFile(dir, jar);
|
File jarFile = Cooja.findJarFile(dir, jar);
|
||||||
if (jarFile == null || !jarFile.exists()) {
|
if (jarFile == null || !jarFile.exists()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -141,16 +141,16 @@ public class COOJAProject {
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
public String[] getConfigPlugins() {
|
public String[] getConfigPlugins() {
|
||||||
return getStringArray("se.sics.cooja.GUI.PLUGINS");
|
return getStringArray("se.sics.cooja.Cooja.PLUGINS");
|
||||||
}
|
}
|
||||||
public String[] getConfigJARs() {
|
public String[] getConfigJARs() {
|
||||||
return getStringArray("se.sics.cooja.GUI.JARFILES");
|
return getStringArray("se.sics.cooja.Cooja.JARFILES");
|
||||||
}
|
}
|
||||||
public String[] getConfigMoteTypes() {
|
public String[] getConfigMoteTypes() {
|
||||||
return getStringArray("se.sics.cooja.GUI.MOTETYPES");
|
return getStringArray("se.sics.cooja.Cooja.MOTETYPES");
|
||||||
}
|
}
|
||||||
public String[] getConfigRadioMediums() {
|
public String[] getConfigRadioMediums() {
|
||||||
return getStringArray("se.sics.cooja.GUI.RADIOMEDIUMS");
|
return getStringArray("se.sics.cooja.Cooja.RADIOMEDIUMS");
|
||||||
}
|
}
|
||||||
public String[] getConfigMoteInterfaces() {
|
public String[] getConfigMoteInterfaces() {
|
||||||
return getStringArray("se.sics.cooja.contikimote.ContikiMoteType.MOTE_INTERFACES");
|
return getStringArray("se.sics.cooja.contikimote.ContikiMoteType.MOTE_INTERFACES");
|
||||||
|
|
|
@ -155,11 +155,11 @@ import se.sics.cooja.util.ExecuteJAR;
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
public class GUI extends Observable {
|
public class Cooja extends Observable {
|
||||||
private static JFrame frame = null;
|
private static JFrame frame = null;
|
||||||
private static JApplet applet = null;
|
private static JApplet applet = null;
|
||||||
private static final long serialVersionUID = 1L;
|
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.
|
* External tools configuration.
|
||||||
|
@ -294,7 +294,7 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
private static final String WINDOW_TITLE = "Cooja: The Contiki Network Simulator";
|
private static final String WINDOW_TITLE = "Cooja: The Contiki Network Simulator";
|
||||||
|
|
||||||
private GUI myGUI;
|
private Cooja myGUI;
|
||||||
|
|
||||||
private Simulation mySimulation;
|
private Simulation mySimulation;
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ public class GUI extends Observable {
|
||||||
*
|
*
|
||||||
* @param desktop Desktop pane
|
* @param desktop Desktop pane
|
||||||
*/
|
*/
|
||||||
public GUI(JDesktopPane desktop) {
|
public Cooja(JDesktopPane desktop) {
|
||||||
myGUI = this;
|
myGUI = this;
|
||||||
mySimulation = null;
|
mySimulation = null;
|
||||||
myDesktopPane = desktop;
|
myDesktopPane = desktop;
|
||||||
|
@ -448,7 +448,7 @@ public class GUI extends Observable {
|
||||||
} catch (ParseProjectsException e) {
|
} catch (ParseProjectsException e) {
|
||||||
logger.fatal("Error when loading extensions: " + e.getMessage(), e);
|
logger.fatal("Error when loading extensions: " + e.getMessage(), e);
|
||||||
if (isVisualized()) {
|
if (isVisualized()) {
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"All Cooja extensions could not load.\n\n" +
|
"All Cooja extensions could not load.\n\n" +
|
||||||
"To manage Cooja extensions:\n" +
|
"To manage Cooja extensions:\n" +
|
||||||
"Menu->Settings->Cooja extensions",
|
"Menu->Settings->Cooja extensions",
|
||||||
|
@ -822,7 +822,7 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
for (Class<? extends MoteType> moteTypeClass : moteTypeClasses) {
|
for (Class<? extends MoteType> moteTypeClass : moteTypeClasses) {
|
||||||
/* Sort mote types according to abstraction level */
|
/* Sort mote types according to abstraction level */
|
||||||
String abstractionLevelDescription = GUI.getAbstractionLevelDescriptionOf(moteTypeClass);
|
String abstractionLevelDescription = Cooja.getAbstractionLevelDescriptionOf(moteTypeClass);
|
||||||
if(abstractionLevelDescription == null) {
|
if(abstractionLevelDescription == null) {
|
||||||
abstractionLevelDescription = "[unknown cross-level]";
|
abstractionLevelDescription = "[unknown cross-level]";
|
||||||
}
|
}
|
||||||
|
@ -845,7 +845,7 @@ public class GUI extends Observable {
|
||||||
menuMoteTypeClasses.add(abstractionLevelSeparator);
|
menuMoteTypeClasses.add(abstractionLevelSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
String description = GUI.getDescriptionOf(moteTypeClass);
|
String description = Cooja.getDescriptionOf(moteTypeClass);
|
||||||
menuItem = new JMenuItem(description + "...");
|
menuItem = new JMenuItem(description + "...");
|
||||||
menuItem.setActionCommand("create mote type");
|
menuItem.setActionCommand("create mote type");
|
||||||
menuItem.putClientProperty("class", moteTypeClass);
|
menuItem.putClientProperty("class", moteTypeClass);
|
||||||
|
@ -985,7 +985,7 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
/* Check if plugin was imported by a extension directory */
|
/* Check if plugin was imported by a extension directory */
|
||||||
File project =
|
File project =
|
||||||
getProjectConfig().getUserProjectDefining(GUI.class, "PLUGINS", newPluginClass.getName());
|
getProjectConfig().getUserProjectDefining(Cooja.class, "PLUGINS", newPluginClass.getName());
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
tooltip += "\nLoaded by extension: " + project.getPath();
|
tooltip += "\nLoaded by extension: " + project.getPath();
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1123,7 @@ public class GUI extends Observable {
|
||||||
return menuBar;
|
return menuBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void configureFrame(final GUI gui, boolean createSimDialog) {
|
private static void configureFrame(final Cooja gui, boolean createSimDialog) {
|
||||||
|
|
||||||
if (frame == null) {
|
if (frame == null) {
|
||||||
frame = new JFrame(WINDOW_TITLE);
|
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;
|
applet = CoojaApplet.applet;
|
||||||
|
|
||||||
// Add menu bar
|
// Add menu bar
|
||||||
|
@ -1327,7 +1327,7 @@ public class GUI extends Observable {
|
||||||
if (vis) {
|
if (vis) {
|
||||||
frame = new JFrame(WINDOW_TITLE);
|
frame = new JFrame(WINDOW_TITLE);
|
||||||
}
|
}
|
||||||
GUI gui = new GUI(desktop);
|
Cooja gui = new Cooja(desktop);
|
||||||
if (vis) {
|
if (vis) {
|
||||||
configureFrame(gui, false);
|
configureFrame(gui, false);
|
||||||
}
|
}
|
||||||
|
@ -1360,13 +1360,13 @@ public class GUI extends Observable {
|
||||||
logger.info("> Starting Cooja");
|
logger.info("> Starting Cooja");
|
||||||
JDesktopPane desktop = createDesktopPane();
|
JDesktopPane desktop = createDesktopPane();
|
||||||
frame = new JFrame(WINDOW_TITLE);
|
frame = new JFrame(WINDOW_TITLE);
|
||||||
GUI gui = new GUI(desktop);
|
Cooja gui = new Cooja(desktop);
|
||||||
configureFrame(gui, false);
|
configureFrame(gui, false);
|
||||||
|
|
||||||
logger.info("> Creating simulation");
|
logger.info("> Creating simulation");
|
||||||
Simulation sim = new Simulation(gui);
|
Simulation sim = new Simulation(gui);
|
||||||
sim.setTitle("Quickstarted simulation: " + source);
|
sim.setTitle("Quickstarted simulation: " + source);
|
||||||
boolean simOK = CreateSimDialog.showDialog(GUI.getTopParentContainer(), sim);
|
boolean simOK = CreateSimDialog.showDialog(Cooja.getTopParentContainer(), sim);
|
||||||
if (!simOK) {
|
if (!simOK) {
|
||||||
logger.fatal("No simulation, aborting quickstart");
|
logger.fatal("No simulation, aborting quickstart");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
@ -1379,7 +1379,7 @@ public class GUI extends Observable {
|
||||||
moteType.setDescription("Cooja mote type (" + source + ")");
|
moteType.setDescription("Cooja mote type (" + source + ")");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean compileOK = moteType.configureAndInit(GUI.getTopParentContainer(), sim, true);
|
boolean compileOK = moteType.configureAndInit(Cooja.getTopParentContainer(), sim, true);
|
||||||
if (!compileOK) {
|
if (!compileOK) {
|
||||||
logger.fatal("Mote type initialization failed, aborting quickstart");
|
logger.fatal("Mote type initialization failed, aborting quickstart");
|
||||||
return null;
|
return null;
|
||||||
|
@ -1552,7 +1552,7 @@ public class GUI extends Observable {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register mote types
|
// Register mote types
|
||||||
String[] moteTypeClassNames = projectConfig.getStringArrayValue(GUI.class,
|
String[] moteTypeClassNames = projectConfig.getStringArrayValue(Cooja.class,
|
||||||
"MOTETYPES");
|
"MOTETYPES");
|
||||||
if (moteTypeClassNames != null) {
|
if (moteTypeClassNames != null) {
|
||||||
for (String moteTypeClassName : moteTypeClassNames) {
|
for (String moteTypeClassName : moteTypeClassNames) {
|
||||||
|
@ -1575,7 +1575,7 @@ public class GUI extends Observable {
|
||||||
registerPlugin(SimControl.class);
|
registerPlugin(SimControl.class);
|
||||||
registerPlugin(SimInformation.class);
|
registerPlugin(SimInformation.class);
|
||||||
registerPlugin(MoteTypeInformation.class);
|
registerPlugin(MoteTypeInformation.class);
|
||||||
String[] pluginClassNames = projectConfig.getStringArrayValue(GUI.class,
|
String[] pluginClassNames = projectConfig.getStringArrayValue(Cooja.class,
|
||||||
"PLUGINS");
|
"PLUGINS");
|
||||||
if (pluginClassNames != null) {
|
if (pluginClassNames != null) {
|
||||||
for (String pluginClassName : pluginClassNames) {
|
for (String pluginClassName : pluginClassNames) {
|
||||||
|
@ -1593,7 +1593,7 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
// Register positioners
|
// Register positioners
|
||||||
String[] positionerClassNames = projectConfig.getStringArrayValue(
|
String[] positionerClassNames = projectConfig.getStringArrayValue(
|
||||||
GUI.class, "POSITIONERS");
|
Cooja.class, "POSITIONERS");
|
||||||
if (positionerClassNames != null) {
|
if (positionerClassNames != null) {
|
||||||
for (String positionerClassName : positionerClassNames) {
|
for (String positionerClassName : positionerClassNames) {
|
||||||
Class<? extends Positioner> positionerClass = tryLoadClass(this,
|
Class<? extends Positioner> positionerClass = tryLoadClass(this,
|
||||||
|
@ -1611,7 +1611,7 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
// Register radio mediums
|
// Register radio mediums
|
||||||
String[] radioMediumsClassNames = projectConfig.getStringArrayValue(
|
String[] radioMediumsClassNames = projectConfig.getStringArrayValue(
|
||||||
GUI.class, "RADIOMEDIUMS");
|
Cooja.class, "RADIOMEDIUMS");
|
||||||
if (radioMediumsClassNames != null) {
|
if (radioMediumsClassNames != null) {
|
||||||
for (String radioMediumClassName : radioMediumsClassNames) {
|
for (String radioMediumClassName : radioMediumsClassNames) {
|
||||||
Class<? extends RadioMedium> radioMediumClass = tryLoadClass(this,
|
Class<? extends RadioMedium> 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
|
* but does not throw exceptions. If COOJA is visualised, an error dialog
|
||||||
* is shown if plugin could not be started.
|
* 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 pluginClass Plugin class
|
||||||
* @param argGUI Plugin GUI argument
|
* @param argGUI Plugin GUI argument
|
||||||
* @param argSimulation Plugin simulation argument
|
* @param argSimulation Plugin simulation argument
|
||||||
|
@ -1757,12 +1757,12 @@ public class GUI extends Observable {
|
||||||
* @return Started plugin
|
* @return Started plugin
|
||||||
*/
|
*/
|
||||||
private Plugin tryStartPlugin(final Class<? extends Plugin> pluginClass,
|
private Plugin tryStartPlugin(final Class<? extends Plugin> pluginClass,
|
||||||
final GUI argGUI, final Simulation argSimulation, final Mote argMote, boolean activate) {
|
final Cooja argGUI, final Simulation argSimulation, final Mote argMote, boolean activate) {
|
||||||
try {
|
try {
|
||||||
return startPlugin(pluginClass, argGUI, argSimulation, argMote, activate);
|
return startPlugin(pluginClass, argGUI, argSimulation, argMote, activate);
|
||||||
} catch (PluginConstructionException ex) {
|
} catch (PluginConstructionException ex) {
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
GUI.showErrorDialog(GUI.getTopParentContainer(), "Error when starting plugin", ex, false);
|
Cooja.showErrorDialog(Cooja.getTopParentContainer(), "Error when starting plugin", ex, false);
|
||||||
} else {
|
} else {
|
||||||
/* If the plugin requires visualization, inform user */
|
/* If the plugin requires visualization, inform user */
|
||||||
Throwable cause = ex;
|
Throwable cause = ex;
|
||||||
|
@ -1780,12 +1780,12 @@ public class GUI extends Observable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plugin tryStartPlugin(final Class<? extends Plugin> pluginClass,
|
public Plugin tryStartPlugin(final Class<? extends Plugin> 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);
|
return tryStartPlugin(pluginClass, argGUI, argSimulation, argMote, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plugin startPlugin(final Class<? extends Plugin> pluginClass,
|
public Plugin startPlugin(final Class<? extends Plugin> pluginClass,
|
||||||
final GUI argGUI, final Simulation argSimulation, final Mote argMote)
|
final Cooja argGUI, final Simulation argSimulation, final Mote argMote)
|
||||||
throws PluginConstructionException
|
throws PluginConstructionException
|
||||||
{
|
{
|
||||||
return startPlugin(pluginClass, argGUI, argSimulation, argMote, true);
|
return startPlugin(pluginClass, argGUI, argSimulation, argMote, true);
|
||||||
|
@ -1803,7 +1803,7 @@ public class GUI extends Observable {
|
||||||
* @throws PluginConstructionException At errors
|
* @throws PluginConstructionException At errors
|
||||||
*/
|
*/
|
||||||
private Plugin startPlugin(final Class<? extends Plugin> pluginClass,
|
private Plugin startPlugin(final Class<? extends Plugin> 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
|
throws PluginConstructionException
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1829,7 +1829,7 @@ public class GUI extends Observable {
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin =
|
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);
|
.newInstance(argMote, argSimulation, argGUI);
|
||||||
|
|
||||||
} else if (pluginType == PluginType.SIM_PLUGIN
|
} else if (pluginType == PluginType.SIM_PLUGIN
|
||||||
|
@ -1842,7 +1842,7 @@ public class GUI extends Observable {
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin =
|
plugin =
|
||||||
pluginClass.getConstructor(new Class[] { Simulation.class, GUI.class })
|
pluginClass.getConstructor(new Class[] { Simulation.class, Cooja.class })
|
||||||
.newInstance(argSimulation, argGUI);
|
.newInstance(argSimulation, argGUI);
|
||||||
|
|
||||||
} else if (pluginType == PluginType.COOJA_PLUGIN
|
} else if (pluginType == PluginType.COOJA_PLUGIN
|
||||||
|
@ -1852,7 +1852,7 @@ public class GUI extends Observable {
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin =
|
plugin =
|
||||||
pluginClass.getConstructor(new Class[] { GUI.class })
|
pluginClass.getConstructor(new Class[] { Cooja.class })
|
||||||
.newInstance(argGUI);
|
.newInstance(argGUI);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1914,11 +1914,11 @@ public class GUI extends Observable {
|
||||||
/* Check plugin constructor */
|
/* Check plugin constructor */
|
||||||
try {
|
try {
|
||||||
if (pluginType == PluginType.COOJA_PLUGIN || pluginType == PluginType.COOJA_STANDARD_PLUGIN) {
|
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) {
|
} 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) {
|
} 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);
|
menuMotePluginClasses.add(pluginClass);
|
||||||
} else {
|
} else {
|
||||||
logger.fatal("Could not register plugin, bad plugin type: " + pluginType);
|
logger.fatal("Could not register plugin, bad plugin type: " + pluginType);
|
||||||
|
@ -2164,7 +2164,7 @@ public class GUI extends Observable {
|
||||||
MoteType newMoteType = null;
|
MoteType newMoteType = null;
|
||||||
try {
|
try {
|
||||||
newMoteType = moteTypeClass.newInstance();
|
newMoteType = moteTypeClass.newInstance();
|
||||||
if (!newMoteType.configureAndInit(GUI.getTopParentContainer(), mySimulation, isVisualized())) {
|
if (!newMoteType.configureAndInit(Cooja.getTopParentContainer(), mySimulation, isVisualized())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mySimulation.addMoteType(newMoteType);
|
mySimulation.addMoteType(newMoteType);
|
||||||
|
@ -2201,7 +2201,7 @@ public class GUI extends Observable {
|
||||||
String s1 = "Remove";
|
String s1 = "Remove";
|
||||||
String s2 = "Cancel";
|
String s2 = "Cancel";
|
||||||
Object[] options = { s1, s2 };
|
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?",
|
"You have an active simulation.\nDo you want to remove it?",
|
||||||
"Remove current simulation?", JOptionPane.YES_NO_OPTION,
|
"Remove current simulation?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE, null, options, s2);
|
JOptionPane.QUESTION_MESSAGE, null, options, s2);
|
||||||
|
@ -2287,7 +2287,7 @@ public class GUI extends Observable {
|
||||||
public File work() {
|
public File work() {
|
||||||
JFileChooser fc = new JFileChooser();
|
JFileChooser fc = new JFileChooser();
|
||||||
|
|
||||||
fc.setFileFilter(GUI.SAVED_SIMULATIONS_FILES);
|
fc.setFileFilter(Cooja.SAVED_SIMULATIONS_FILES);
|
||||||
|
|
||||||
if (suggestedFile != null && suggestedFile.isDirectory()) {
|
if (suggestedFile != null && suggestedFile.isDirectory()) {
|
||||||
fc.setCurrentDirectory(suggestedFile);
|
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) {
|
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
||||||
logger.info("Load command cancelled by user...");
|
logger.info("Load command cancelled by user...");
|
||||||
return null;
|
return null;
|
||||||
|
@ -2337,7 +2337,7 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
progressDialog = new RunnableInEDT<JDialog>() {
|
progressDialog = new RunnableInEDT<JDialog>() {
|
||||||
public JDialog work() {
|
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());
|
JPanel progressPanel = new JPanel(new BorderLayout());
|
||||||
JProgressBar progressBar;
|
JProgressBar progressBar;
|
||||||
|
@ -2369,7 +2369,7 @@ public class GUI extends Observable {
|
||||||
progressDialog.setSize(400, 200);
|
progressDialog.setSize(400, 200);
|
||||||
|
|
||||||
progressDialog.getRootPane().setDefaultButton(button);
|
progressDialog.getRootPane().setDefaultButton(button);
|
||||||
progressDialog.setLocationRelativeTo(GUI.getTopParentContainer());
|
progressDialog.setLocationRelativeTo(Cooja.getTopParentContainer());
|
||||||
progressDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
|
progressDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
|
||||||
|
|
||||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||||
|
@ -2399,7 +2399,7 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
/* Optionally show compilation warnings */
|
/* Optionally show compilation warnings */
|
||||||
boolean hideWarn = Boolean.parseBoolean(
|
boolean hideWarn = Boolean.parseBoolean(
|
||||||
GUI.getExternalToolsSetting("HIDE_WARNINGS", "false")
|
Cooja.getExternalToolsSetting("HIDE_WARNINGS", "false")
|
||||||
);
|
);
|
||||||
if (quick && !hideWarn && !PROGRESS_WARNINGS.isEmpty()) {
|
if (quick && !hideWarn && !PROGRESS_WARNINGS.isEmpty()) {
|
||||||
showWarningsDialog(frame, PROGRESS_WARNINGS.toArray(new String[0]));
|
showWarningsDialog(frame, PROGRESS_WARNINGS.toArray(new String[0]));
|
||||||
|
@ -2407,9 +2407,9 @@ public class GUI extends Observable {
|
||||||
PROGRESS_WARNINGS.clear();
|
PROGRESS_WARNINGS.clear();
|
||||||
|
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
shouldRetry = showErrorDialog(GUI.getTopParentContainer(), "Simulation load error", e, true);
|
shouldRetry = showErrorDialog(Cooja.getTopParentContainer(), "Simulation load error", e, true);
|
||||||
} catch (SimulationCreationException e) {
|
} catch (SimulationCreationException e) {
|
||||||
shouldRetry = showErrorDialog(GUI.getTopParentContainer(), "Simulation load error", e, true);
|
shouldRetry = showErrorDialog(Cooja.getTopParentContainer(), "Simulation load error", e, true);
|
||||||
}
|
}
|
||||||
} while (shouldRetry);
|
} while (shouldRetry);
|
||||||
|
|
||||||
|
@ -2468,7 +2468,7 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
/* Optionally show compilation warnings */
|
/* Optionally show compilation warnings */
|
||||||
boolean hideWarn = Boolean.parseBoolean(
|
boolean hideWarn = Boolean.parseBoolean(
|
||||||
GUI.getExternalToolsSetting("HIDE_WARNINGS", "false")
|
Cooja.getExternalToolsSetting("HIDE_WARNINGS", "false")
|
||||||
);
|
);
|
||||||
if (!hideWarn && !PROGRESS_WARNINGS.isEmpty()) {
|
if (!hideWarn && !PROGRESS_WARNINGS.isEmpty()) {
|
||||||
showWarningsDialog(frame, PROGRESS_WARNINGS.toArray(new String[0]));
|
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) + "%.");
|
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()) {
|
if (isVisualized()) {
|
||||||
int n = JOptionPane.showOptionDialog(
|
int n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"Reboot Cooja to avoid out of memory error.\n" +
|
"Reboot Cooja to avoid out of memory error.\n" +
|
||||||
"Current memory usage is " + format.format(100*memRatio) + "%.",
|
"Current memory usage is " + format.format(100*memRatio) + "%.",
|
||||||
"Out of memory warning",
|
"Out of memory warning",
|
||||||
|
@ -2584,7 +2584,7 @@ public class GUI extends Observable {
|
||||||
mySimulation.stopSimulation();
|
mySimulation.stopSimulation();
|
||||||
|
|
||||||
JFileChooser fc = new JFileChooser();
|
JFileChooser fc = new JFileChooser();
|
||||||
fc.setFileFilter(GUI.SAVED_SIMULATIONS_FILES);
|
fc.setFileFilter(Cooja.SAVED_SIMULATIONS_FILES);
|
||||||
|
|
||||||
// Suggest file using history
|
// Suggest file using history
|
||||||
File suggestedFile = getLastOpenedFile();
|
File suggestedFile = getLastOpenedFile();
|
||||||
|
@ -2604,7 +2604,7 @@ public class GUI extends Observable {
|
||||||
String s2 = "Cancel";
|
String s2 = "Cancel";
|
||||||
Object[] options = { s1, s2 };
|
Object[] options = { s1, s2 };
|
||||||
int n = JOptionPane.showOptionDialog(
|
int n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"A file with the same name already exists.\nDo you want to remove it?",
|
"A file with the same name already exists.\nDo you want to remove it?",
|
||||||
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
||||||
|
@ -2664,7 +2664,7 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
// Create new simulation
|
// Create new simulation
|
||||||
Simulation newSim = new Simulation(this);
|
Simulation newSim = new Simulation(this);
|
||||||
boolean createdOK = CreateSimDialog.showDialog(GUI.getTopParentContainer(), newSim);
|
boolean createdOK = CreateSimDialog.showDialog(Cooja.getTopParentContainer(), newSim);
|
||||||
if (createdOK) {
|
if (createdOK) {
|
||||||
myGUI.setSimulation(newSim, true);
|
myGUI.setSimulation(newSim, true);
|
||||||
}
|
}
|
||||||
|
@ -2691,7 +2691,7 @@ public class GUI extends Observable {
|
||||||
String s2 = "No";
|
String s2 = "No";
|
||||||
String s3 = "Cancel";
|
String s3 = "Cancel";
|
||||||
Object[] options = { s1, s2, s3 };
|
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?",
|
"Do you want to save the current simulation?",
|
||||||
WINDOW_TITLE, JOptionPane.YES_NO_CANCEL_OPTION,
|
WINDOW_TITLE, JOptionPane.YES_NO_CANCEL_OPTION,
|
||||||
JOptionPane.WARNING_MESSAGE, null, options, s1);
|
JOptionPane.WARNING_MESSAGE, null, options, s1);
|
||||||
|
@ -2809,24 +2809,24 @@ public class GUI extends Observable {
|
||||||
|
|
||||||
String filename = null;
|
String filename = null;
|
||||||
if (osName.startsWith("win")) {
|
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")) {
|
} 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")) {
|
} else if (osName.startsWith("freebsd")) {
|
||||||
filename = GUI.EXTERNAL_TOOLS_FREEBSD_SETTINGS_FILENAME;
|
filename = Cooja.EXTERNAL_TOOLS_FREEBSD_SETTINGS_FILENAME;
|
||||||
} else if (osName.startsWith("linux")) {
|
} else if (osName.startsWith("linux")) {
|
||||||
filename = GUI.EXTERNAL_TOOLS_LINUX_SETTINGS_FILENAME;
|
filename = Cooja.EXTERNAL_TOOLS_LINUX_SETTINGS_FILENAME;
|
||||||
if (osArch.startsWith("amd64")) {
|
if (osArch.startsWith("amd64")) {
|
||||||
filename = GUI.EXTERNAL_TOOLS_LINUX_64_SETTINGS_FILENAME;
|
filename = Cooja.EXTERNAL_TOOLS_LINUX_64_SETTINGS_FILENAME;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Unknown system: " + osName);
|
logger.warn("Unknown system: " + osName);
|
||||||
logger.warn("Using default linux external tools configuration");
|
logger.warn("Using default linux external tools configuration");
|
||||||
filename = GUI.EXTERNAL_TOOLS_LINUX_SETTINGS_FILENAME;
|
filename = Cooja.EXTERNAL_TOOLS_LINUX_SETTINGS_FILENAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InputStream in = GUI.class.getResourceAsStream(EXTERNAL_TOOLS_SETTINGS_FILENAME);
|
InputStream in = Cooja.class.getResourceAsStream(EXTERNAL_TOOLS_SETTINGS_FILENAME);
|
||||||
if (in == null) {
|
if (in == null) {
|
||||||
throw new FileNotFoundException(filename + " not found");
|
throw new FileNotFoundException(filename + " not found");
|
||||||
}
|
}
|
||||||
|
@ -2834,7 +2834,7 @@ public class GUI extends Observable {
|
||||||
settings.load(in);
|
settings.load(in);
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
in = GUI.class.getResourceAsStream(filename);
|
in = Cooja.class.getResourceAsStream(filename);
|
||||||
if (in == null) {
|
if (in == null) {
|
||||||
throw new FileNotFoundException(filename + " not found");
|
throw new FileNotFoundException(filename + " not found");
|
||||||
}
|
}
|
||||||
|
@ -2931,11 +2931,11 @@ public class GUI extends Observable {
|
||||||
myGUI.doAddMotes((MoteType) ((JMenuItem) e.getSource())
|
myGUI.doAddMotes((MoteType) ((JMenuItem) e.getSource())
|
||||||
.getClientProperty("motetype"));
|
.getClientProperty("motetype"));
|
||||||
} else if (e.getActionCommand().equals("edit paths")) {
|
} else if (e.getActionCommand().equals("edit paths")) {
|
||||||
ExternalToolsDialog.showDialog(GUI.getTopParentContainer());
|
ExternalToolsDialog.showDialog(Cooja.getTopParentContainer());
|
||||||
} else if (e.getActionCommand().equals("manage extensions")) {
|
} else if (e.getActionCommand().equals("manage extensions")) {
|
||||||
COOJAProject[] newProjects = ProjectDirectoriesDialog.showDialog(
|
COOJAProject[] newProjects = ProjectDirectoriesDialog.showDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
GUI.this,
|
Cooja.this,
|
||||||
getProjects()
|
getProjects()
|
||||||
);
|
);
|
||||||
if (newProjects != null) {
|
if (newProjects != null) {
|
||||||
|
@ -2948,7 +2948,7 @@ public class GUI extends Observable {
|
||||||
} catch (ParseProjectsException ex) {
|
} catch (ParseProjectsException ex) {
|
||||||
logger.fatal("Error when loading extensions: " + ex.getMessage(), ex);
|
logger.fatal("Error when loading extensions: " + ex.getMessage(), ex);
|
||||||
if (isVisualized()) {
|
if (isVisualized()) {
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"All Cooja extensions could not load.\n\n" +
|
"All Cooja extensions could not load.\n\n" +
|
||||||
"To manage Cooja extensions:\n" +
|
"To manage Cooja extensions:\n" +
|
||||||
"Menu->Settings->Cooja extensions",
|
"Menu->Settings->Cooja extensions",
|
||||||
|
@ -2958,7 +2958,7 @@ public class GUI extends Observable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (e.getActionCommand().equals("configuration wizard")) {
|
} else if (e.getActionCommand().equals("configuration wizard")) {
|
||||||
ConfigurationWizard.startWizard(GUI.getTopParentContainer(), GUI.this);
|
ConfigurationWizard.startWizard(Cooja.getTopParentContainer(), Cooja.this);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Unhandled action: " + e.getActionCommand());
|
logger.warn("Unhandled action: " + e.getActionCommand());
|
||||||
}
|
}
|
||||||
|
@ -3046,7 +3046,7 @@ public class GUI extends Observable {
|
||||||
ProjectConfig projectConfig = new ProjectConfig(false);
|
ProjectConfig projectConfig = new ProjectConfig(false);
|
||||||
projectConfig.appendProjectDir(projectDir);
|
projectConfig.appendProjectDir(projectDir);
|
||||||
String[] projectJarFiles = projectConfig.getStringArrayValue(
|
String[] projectJarFiles = projectConfig.getStringArrayValue(
|
||||||
GUI.class, "JARFILES");
|
Cooja.class, "JARFILES");
|
||||||
if (projectJarFiles != null && projectJarFiles.length > 0) {
|
if (projectJarFiles != null && projectJarFiles.length > 0) {
|
||||||
for (String jarfile : projectJarFiles) {
|
for (String jarfile : projectJarFiles) {
|
||||||
File jarpath = findJarFile(projectDir, jarfile);
|
File jarpath = findJarFile(projectDir, jarfile);
|
||||||
|
@ -3144,7 +3144,7 @@ public class GUI extends Observable {
|
||||||
DOMConfigurator.configure(LOG_CONFIG_FILE);
|
DOMConfigurator.configure(LOG_CONFIG_FILE);
|
||||||
} else {
|
} else {
|
||||||
// Used when starting from jar
|
// 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);
|
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) {
|
for (String element : args) {
|
||||||
if (element.startsWith("-contiki=")) {
|
if (element.startsWith("-contiki=")) {
|
||||||
String arg = element.substring("-contiki=".length());
|
String arg = element.substring("-contiki=".length());
|
||||||
GUI.specifiedContikiPath = arg;
|
Cooja.specifiedContikiPath = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.startsWith("-external_tools_config=")) {
|
if (element.startsWith("-external_tools_config=")) {
|
||||||
|
@ -3177,8 +3177,8 @@ public class GUI extends Observable {
|
||||||
specifiedExternalToolsConfigFile = null;
|
specifiedExternalToolsConfigFile = null;
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
} else {
|
} else {
|
||||||
GUI.externalToolsUserSettingsFile = specifiedExternalToolsConfigFile;
|
Cooja.externalToolsUserSettingsFile = specifiedExternalToolsConfigFile;
|
||||||
GUI.externalToolsUserSettingsFileReadOnly = true;
|
Cooja.externalToolsUserSettingsFileReadOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3230,7 +3230,7 @@ public class GUI extends Observable {
|
||||||
if (sim == null) {
|
if (sim == null) {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
GUI gui = sim.getGUI();
|
Cooja gui = sim.getGUI();
|
||||||
|
|
||||||
/* Make sure at least one test editor is controlling the simulation */
|
/* Make sure at least one test editor is controlling the simulation */
|
||||||
boolean hasEditor = false;
|
boolean hasEditor = false;
|
||||||
|
@ -3291,13 +3291,13 @@ public class GUI extends Observable {
|
||||||
JDesktopPane desktop = createDesktopPane();
|
JDesktopPane desktop = createDesktopPane();
|
||||||
|
|
||||||
applet = CoojaApplet.applet;
|
applet = CoojaApplet.applet;
|
||||||
GUI gui = new GUI(desktop);
|
Cooja gui = new Cooja(desktop);
|
||||||
|
|
||||||
GUI.setExternalToolsSetting("PATH_CONTIKI_BUILD", buildPath);
|
Cooja.setExternalToolsSetting("PATH_CONTIKI_BUILD", buildPath);
|
||||||
GUI.setExternalToolsSetting("PATH_CONTIKI_WEB", webPath);
|
Cooja.setExternalToolsSetting("PATH_CONTIKI_WEB", webPath);
|
||||||
|
|
||||||
GUI.setExternalToolsSetting("SKY_FIRMWARE", skyFirmware);
|
Cooja.setExternalToolsSetting("SKY_FIRMWARE", skyFirmware);
|
||||||
GUI.setExternalToolsSetting("ESB_FIRMWARE", esbFirmware);
|
Cooja.setExternalToolsSetting("ESB_FIRMWARE", esbFirmware);
|
||||||
|
|
||||||
configureApplet(gui, false);
|
configureApplet(gui, false);
|
||||||
}
|
}
|
||||||
|
@ -3310,7 +3310,7 @@ public class GUI extends Observable {
|
||||||
public void run() {
|
public void run() {
|
||||||
JDesktopPane desktop = createDesktopPane();
|
JDesktopPane desktop = createDesktopPane();
|
||||||
frame = new JFrame(WINDOW_TITLE);
|
frame = new JFrame(WINDOW_TITLE);
|
||||||
GUI gui = new GUI(desktop);
|
Cooja gui = new Cooja(desktop);
|
||||||
configureFrame(gui, false);
|
configureFrame(gui, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3927,7 +3927,7 @@ public class GUI extends Observable {
|
||||||
JCheckBox hideButton = new JCheckBox("Hide compilation warnings", false);
|
JCheckBox hideButton = new JCheckBox("Hide compilation warnings", false);
|
||||||
hideButton.addActionListener(new ActionListener() {
|
hideButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
GUI.setExternalToolsSetting("HIDE_WARNINGS",
|
Cooja.setExternalToolsSetting("HIDE_WARNINGS",
|
||||||
"" + ((JCheckBox)e.getSource()).isSelected());
|
"" + ((JCheckBox)e.getSource()).isSelected());
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -4171,11 +4171,11 @@ public class GUI extends Observable {
|
||||||
String fileCanonical = file.getCanonicalPath();
|
String fileCanonical = file.getCanonicalPath();
|
||||||
|
|
||||||
//No so nice, but goes along with GUI.getExternalToolsSetting
|
//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++){
|
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();
|
canonicals[i] = path[i].getCanonicalPath();
|
||||||
if (fileCanonical.startsWith(canonicals[i])){
|
if (fileCanonical.startsWith(canonicals[i])){
|
||||||
if(mlength < canonicals[i].length()){
|
if(mlength < canonicals[i].length()){
|
||||||
|
@ -4232,8 +4232,8 @@ public class GUI extends Observable {
|
||||||
//logger.info("Found: " + PATH_IDENTIFIER[i][0]);
|
//logger.info("Found: " + PATH_IDENTIFIER[i][0]);
|
||||||
|
|
||||||
//No so nice, but goes along with GUI.getExternalToolsSetting
|
//No so nice, but goes along with GUI.getExternalToolsSetting
|
||||||
String defp = GUI.getExternalToolsSetting("PATH_CONTIKI", null);
|
String defp = Cooja.getExternalToolsSetting("PATH_CONTIKI", null);
|
||||||
path = new File(GUI.getExternalToolsSetting(PATH_IDENTIFIER[i][1], defp + PATH_IDENTIFIER[i][2]));
|
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());
|
//logger.info("Config: " + PATH_IDENTIFIER[i][1] + ", " + defp + PATH_IDENTIFIER[i][2] + " = " + path.toString());
|
||||||
canonical = path.getCanonicalPath();
|
canonical = path.getCanonicalPath();
|
||||||
|
@ -4505,7 +4505,7 @@ public class GUI extends Observable {
|
||||||
/* Info message */
|
/* Info message */
|
||||||
String[] options = new String[] { "OK", "Cancel" };
|
String[] options = new String[] { "OK", "Cancel" };
|
||||||
int n = JOptionPane.showOptionDialog(
|
int n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"This function attempts to build an executable Cooja JAR from the current simulation.\n" +
|
"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" +
|
"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" +
|
"\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);
|
fc.setFileFilter(jarFilter);
|
||||||
File suggest = new File(getExternalToolsSetting("EXECUTE_JAR_LAST", "cooja_simulation.jar"));
|
File suggest = new File(getExternalToolsSetting("EXECUTE_JAR_LAST", "cooja_simulation.jar"));
|
||||||
fc.setSelectedFile(suggest);
|
fc.setSelectedFile(suggest);
|
||||||
int returnVal = fc.showSaveDialog(GUI.getTopParentContainer());
|
int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer());
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4546,7 +4546,7 @@ public class GUI extends Observable {
|
||||||
if (outputFile.exists()) {
|
if (outputFile.exists()) {
|
||||||
options = new String[] { "Overwrite", "Cancel" };
|
options = new String[] { "Overwrite", "Cancel" };
|
||||||
n = JOptionPane.showOptionDialog(
|
n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"A file with the same name already exists.\nDo you want to remove it?",
|
"A file with the same name already exists.\nDo you want to remove it?",
|
||||||
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
||||||
|
@ -4561,9 +4561,9 @@ public class GUI extends Observable {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
ExecuteJAR.buildExecutableJAR(GUI.this, finalOutputFile);
|
ExecuteJAR.buildExecutableJAR(Cooja.this, finalOutputFile);
|
||||||
} catch (RuntimeException ex) {
|
} catch (RuntimeException ex) {
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
ex.getMessage(),
|
ex.getMessage(),
|
||||||
"Error", JOptionPane.ERROR_MESSAGE);
|
"Error", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
|
@ -51,7 +51,7 @@ public class CoojaApplet extends JApplet {
|
||||||
esbFirmware = "";
|
esbFirmware = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI.main(new String[] {
|
Cooja.main(new String[] {
|
||||||
"-applet ",
|
"-applet ",
|
||||||
"-esb_firmware=" + esbFirmware,
|
"-esb_firmware=" + esbFirmware,
|
||||||
"-sky_firmware=" + skyFirmware,
|
"-sky_firmware=" + skyFirmware,
|
||||||
|
|
|
@ -134,7 +134,7 @@ public abstract class CoreComm {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Reader reader;
|
Reader reader;
|
||||||
String mainTemplate = GUI
|
String mainTemplate = Cooja
|
||||||
.getExternalToolsSetting("CORECOMM_TEMPLATE_FILENAME");
|
.getExternalToolsSetting("CORECOMM_TEMPLATE_FILENAME");
|
||||||
|
|
||||||
if ((new File(mainTemplate)).exists()) {
|
if ((new File(mainTemplate)).exists()) {
|
||||||
|
@ -213,7 +213,7 @@ public abstract class CoreComm {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int b;
|
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" };
|
"-version", "se/sics/cooja/corecomm/" + className + ".java" };
|
||||||
|
|
||||||
Process p = Runtime.getRuntime().exec(cmd, null, null);
|
Process p = Runtime.getRuntime().exec(cmd, null, null);
|
||||||
|
@ -233,11 +233,11 @@ public abstract class CoreComm {
|
||||||
|
|
||||||
// Try including cooja.jar
|
// Try including cooja.jar
|
||||||
cmd = new String[] {
|
cmd = new String[] {
|
||||||
GUI.getExternalToolsSetting("PATH_JAVAC"),
|
Cooja.getExternalToolsSetting("PATH_JAVAC"),
|
||||||
"-version",
|
"-version",
|
||||||
"se/sics/cooja/corecomm/" + className + ".java",
|
"se/sics/cooja/corecomm/" + className + ".java",
|
||||||
"-cp",
|
"-cp",
|
||||||
GUI.getExternalToolsSetting("PATH_CONTIKI")
|
Cooja.getExternalToolsSetting("PATH_CONTIKI")
|
||||||
+ "/tools/cooja/dist/cooja.jar" };
|
+ "/tools/cooja/dist/cooja.jar" };
|
||||||
|
|
||||||
p = Runtime.getRuntime().exec(cmd, null, null);
|
p = Runtime.getRuntime().exec(cmd, null, null);
|
||||||
|
|
|
@ -107,8 +107,8 @@ public class ProjectConfig {
|
||||||
|
|
||||||
|
|
||||||
if (useDefault) {
|
if (useDefault) {
|
||||||
InputStream input = GUI.class
|
InputStream input = Cooja.class
|
||||||
.getResourceAsStream(GUI.PROJECT_DEFAULT_CONFIG_FILENAME);
|
.getResourceAsStream(Cooja.PROJECT_DEFAULT_CONFIG_FILENAME);
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
try {
|
try {
|
||||||
appendConfigStream(input);
|
appendConfigStream(input);
|
||||||
|
@ -116,7 +116,7 @@ public class ProjectConfig {
|
||||||
input.close();
|
input.close();
|
||||||
}
|
}
|
||||||
} else {
|
} 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());
|
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()) {
|
if (!projectConfig.exists()) {
|
||||||
throw new FileNotFoundException("Project config does not exist: " + projectConfig.getAbsolutePath());
|
throw new FileNotFoundException("Project config does not exist: " + projectConfig.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class SimEventCentral {
|
||||||
this.simulation = simulation;
|
this.simulation = simulation;
|
||||||
|
|
||||||
/* Default buffer sizes */
|
/* Default buffer sizes */
|
||||||
logOutputBufferSize = Integer.parseInt(GUI.getExternalToolsSetting("BUFFERSIZE_LOGOUTPUT", "" + 40000));
|
logOutputBufferSize = Integer.parseInt(Cooja.getExternalToolsSetting("BUFFERSIZE_LOGOUTPUT", "" + 40000));
|
||||||
|
|
||||||
|
|
||||||
moteObservations = new ArrayList<MoteObservation>();
|
moteObservations = new ArrayList<MoteObservation>();
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class Simulation extends Observable implements Runnable {
|
||||||
|
|
||||||
private Thread simulationThread = null;
|
private Thread simulationThread = null;
|
||||||
|
|
||||||
private GUI myGUI = null;
|
private Cooja myGUI = null;
|
||||||
|
|
||||||
private long randomSeed = 123456;
|
private long randomSeed = 123456;
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ public class Simulation extends Observable implements Runnable {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
logger.fatal("Simulation stopped due to error: " + e.getMessage(), e);
|
logger.fatal("Simulation stopped due to error: " + e.getMessage(), e);
|
||||||
if (!GUI.isVisualized()) {
|
if (!Cooja.isVisualized()) {
|
||||||
/* Quit simulator if in test mode */
|
/* Quit simulator if in test mode */
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -298,7 +298,7 @@ public class Simulation extends Observable implements Runnable {
|
||||||
if (nextEvent instanceof MoteTimeEvent) {
|
if (nextEvent instanceof MoteTimeEvent) {
|
||||||
title += ": " + ((MoteTimeEvent)nextEvent).getMote();
|
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
|
* Creates a new simulation
|
||||||
*/
|
*/
|
||||||
public Simulation(GUI gui) {
|
public Simulation(Cooja gui) {
|
||||||
myGUI = gui;
|
myGUI = gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ public class Simulation extends Observable implements Runnable {
|
||||||
/**
|
/**
|
||||||
* @return GUI holding this simulation
|
* @return GUI holding this simulation
|
||||||
*/
|
*/
|
||||||
public GUI getGUI() {
|
public Cooja getGUI() {
|
||||||
return myGUI;
|
return myGUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ public class Simulation extends Observable implements Runnable {
|
||||||
// Show configure simulation dialog
|
// Show configure simulation dialog
|
||||||
boolean createdOK = false;
|
boolean createdOK = false;
|
||||||
if (visAvailable) {
|
if (visAvailable) {
|
||||||
createdOK = CreateSimDialog.showDialog(GUI.getTopParentContainer(), this);
|
createdOK = CreateSimDialog.showDialog(Cooja.getTopParentContainer(), this);
|
||||||
} else {
|
} else {
|
||||||
createdOK = true;
|
createdOK = true;
|
||||||
}
|
}
|
||||||
|
@ -648,9 +648,9 @@ public class Simulation extends Observable implements Runnable {
|
||||||
|
|
||||||
/* Try to recreate simulation using a different mote type */
|
/* Try to recreate simulation using a different mote type */
|
||||||
if (visAvailable) {
|
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(
|
String newClass = (String) JOptionPane.showInputDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"The simulation is about to load '" + moteTypeClassName + "'\n" +
|
"The simulation is about to load '" + moteTypeClassName + "'\n" +
|
||||||
"You may try to load the simulation using a different mote type.\n",
|
"You may try to load the simulation using a different mote type.\n",
|
||||||
"Loading mote type",
|
"Loading mote type",
|
||||||
|
|
|
@ -43,7 +43,7 @@ import se.sics.cooja.plugins.skins.DGRMVisualizerSkin;
|
||||||
*
|
*
|
||||||
* See below code usage examples.
|
* See below code usage examples.
|
||||||
*
|
*
|
||||||
* @see GUI#createMotePluginsSubmenu(Mote)
|
* @see Cooja#createMotePluginsSubmenu(Mote)
|
||||||
* @see Visualizer#populateSkinMenu(MenuElement)
|
* @see Visualizer#populateSkinMenu(MenuElement)
|
||||||
* @see DGRMVisualizerSkin
|
* @see DGRMVisualizerSkin
|
||||||
*
|
*
|
||||||
|
|
|
@ -54,14 +54,14 @@ import se.sics.cooja.plugins.SimControl;
|
||||||
*/
|
*/
|
||||||
public abstract class VisPlugin extends JInternalFrame implements Plugin {
|
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);
|
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);
|
super(title, true, true, true, true);
|
||||||
|
|
||||||
if (requiresVis && !GUI.isVisualized()) {
|
if (requiresVis && !Cooja.isVisualized()) {
|
||||||
throw new PluginRequiresVisualizationException();
|
throw new PluginRequiresVisualizationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ import org.jdom.Element;
|
||||||
import se.sics.cooja.AbstractionLevelDescription;
|
import se.sics.cooja.AbstractionLevelDescription;
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.CoreComm;
|
import se.sics.cooja.CoreComm;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
|
@ -385,7 +385,7 @@ public class ContikiMoteType implements MoteType {
|
||||||
myCoreComm = CoreComm.createCoreComm(this.javaClassName, getContikiFirmwareFile());
|
myCoreComm = CoreComm.createCoreComm(this.javaClassName, getContikiFirmwareFile());
|
||||||
|
|
||||||
/* Parse addresses using map file or command */
|
/* 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 dataSectionAddr = -1, dataSectionSize = -1;
|
||||||
int bssSectionAddr = -1, bssSectionSize = -1;
|
int bssSectionAddr = -1, bssSectionSize = -1;
|
||||||
|
@ -612,7 +612,7 @@ public class ContikiMoteType implements MoteType {
|
||||||
int nrNew = 0, nrOld = 0, nrMismatch = 0;
|
int nrNew = 0, nrOld = 0, nrMismatch = 0;
|
||||||
|
|
||||||
Pattern pattern =
|
Pattern pattern =
|
||||||
Pattern.compile(GUI.getExternalToolsSetting("COMMAND_VAR_NAME_ADDRESS"));
|
Pattern.compile(Cooja.getExternalToolsSetting("COMMAND_VAR_NAME_ADDRESS"));
|
||||||
|
|
||||||
for (String line : output) {
|
for (String line : output) {
|
||||||
Matcher matcher = pattern.matcher(line);
|
Matcher matcher = pattern.matcher(line);
|
||||||
|
@ -738,9 +738,9 @@ public class ContikiMoteType implements MoteType {
|
||||||
}
|
}
|
||||||
|
|
||||||
String regExp =
|
String regExp =
|
||||||
GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_1") +
|
Cooja.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_1") +
|
||||||
varName +
|
varName +
|
||||||
GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_2");
|
Cooja.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_2");
|
||||||
String retString = getFirstMatchGroup(mapFileData, regExp, 1);
|
String retString = getFirstMatchGroup(mapFileData, regExp, 1);
|
||||||
|
|
||||||
if (retString != null) {
|
if (retString != null) {
|
||||||
|
@ -804,7 +804,7 @@ public class ContikiMoteType implements MoteType {
|
||||||
int startAddress, int endAddress) {
|
int startAddress, int endAddress) {
|
||||||
ArrayList<String> varNames = new ArrayList<String>();
|
ArrayList<String> varNames = new ArrayList<String>();
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile(GUI.getExternalToolsSetting("MAPFILE_VAR_NAME"));
|
Pattern pattern = Pattern.compile(Cooja.getExternalToolsSetting("MAPFILE_VAR_NAME"));
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
Matcher matcher = pattern.matcher(line);
|
Matcher matcher = pattern.matcher(line);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
|
@ -819,9 +819,9 @@ public class ContikiMoteType implements MoteType {
|
||||||
|
|
||||||
protected int getVariableSize(Vector<String> lines, String varName) {
|
protected int getVariableSize(Vector<String> lines, String varName) {
|
||||||
Pattern pattern = Pattern.compile(
|
Pattern pattern = Pattern.compile(
|
||||||
GUI.getExternalToolsSetting("MAPFILE_VAR_SIZE_1") +
|
Cooja.getExternalToolsSetting("MAPFILE_VAR_SIZE_1") +
|
||||||
varName +
|
varName +
|
||||||
GUI.getExternalToolsSetting("MAPFILE_VAR_SIZE_2"));
|
Cooja.getExternalToolsSetting("MAPFILE_VAR_SIZE_2"));
|
||||||
for (int i = 0; i < lines.size(); i++) {
|
for (int i = 0; i < lines.size(); i++) {
|
||||||
Matcher matcher = pattern.matcher(lines.get(i));
|
Matcher matcher = pattern.matcher(lines.get(i));
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
|
@ -843,42 +843,42 @@ public class ContikiMoteType implements MoteType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int parseMapDataSectionAddr(String[] mapFileData) {
|
public static int parseMapDataSectionAddr(String[] mapFileData) {
|
||||||
String regexp = GUI.getExternalToolsSetting("MAPFILE_DATA_START", "");
|
String regexp = Cooja.getExternalToolsSetting("MAPFILE_DATA_START", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return parseFirstHexInt(regexp, mapFileData);
|
return parseFirstHexInt(regexp, mapFileData);
|
||||||
}
|
}
|
||||||
public static int parseMapDataSectionSize(String[] mapFileData) {
|
public static int parseMapDataSectionSize(String[] mapFileData) {
|
||||||
String regexp = GUI.getExternalToolsSetting("MAPFILE_DATA_SIZE", "");
|
String regexp = Cooja.getExternalToolsSetting("MAPFILE_DATA_SIZE", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return parseFirstHexInt(regexp, mapFileData);
|
return parseFirstHexInt(regexp, mapFileData);
|
||||||
}
|
}
|
||||||
public static int parseMapBssSectionAddr(String[] mapFileData) {
|
public static int parseMapBssSectionAddr(String[] mapFileData) {
|
||||||
String regexp = GUI.getExternalToolsSetting("MAPFILE_BSS_START", "");
|
String regexp = Cooja.getExternalToolsSetting("MAPFILE_BSS_START", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return parseFirstHexInt(regexp, mapFileData);
|
return parseFirstHexInt(regexp, mapFileData);
|
||||||
}
|
}
|
||||||
public static int parseMapBssSectionSize(String[] mapFileData) {
|
public static int parseMapBssSectionSize(String[] mapFileData) {
|
||||||
String regexp = GUI.getExternalToolsSetting("MAPFILE_BSS_SIZE", "");
|
String regexp = Cooja.getExternalToolsSetting("MAPFILE_BSS_SIZE", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return parseFirstHexInt(regexp, mapFileData);
|
return parseFirstHexInt(regexp, mapFileData);
|
||||||
}
|
}
|
||||||
public static int parseMapCommonSectionAddr(String[] mapFileData) {
|
public static int parseMapCommonSectionAddr(String[] mapFileData) {
|
||||||
String regexp = GUI.getExternalToolsSetting("MAPFILE_COMMON_START", "");
|
String regexp = Cooja.getExternalToolsSetting("MAPFILE_COMMON_START", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return parseFirstHexInt(regexp, mapFileData);
|
return parseFirstHexInt(regexp, mapFileData);
|
||||||
}
|
}
|
||||||
public static int parseMapCommonSectionSize(String[] mapFileData) {
|
public static int parseMapCommonSectionSize(String[] mapFileData) {
|
||||||
String regexp = GUI.getExternalToolsSetting("MAPFILE_COMMON_SIZE", "");
|
String regexp = Cooja.getExternalToolsSetting("MAPFILE_COMMON_SIZE", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -886,14 +886,14 @@ public class ContikiMoteType implements MoteType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int parseCommandDataSectionAddr(String[] output) {
|
public static int parseCommandDataSectionAddr(String[] output) {
|
||||||
String regexp = GUI.getExternalToolsSetting("COMMAND_DATA_START", "");
|
String regexp = Cooja.getExternalToolsSetting("COMMAND_DATA_START", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return parseFirstHexInt(regexp, output);
|
return parseFirstHexInt(regexp, output);
|
||||||
}
|
}
|
||||||
public static int parseCommandDataSectionSize(String[] output) {
|
public static int parseCommandDataSectionSize(String[] output) {
|
||||||
String regexp = GUI.getExternalToolsSetting("COMMAND_DATA_END", "");
|
String regexp = Cooja.getExternalToolsSetting("COMMAND_DATA_END", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -909,14 +909,14 @@ public class ContikiMoteType implements MoteType {
|
||||||
return end - start;
|
return end - start;
|
||||||
}
|
}
|
||||||
public static int parseCommandBssSectionAddr(String[] output) {
|
public static int parseCommandBssSectionAddr(String[] output) {
|
||||||
String regexp = GUI.getExternalToolsSetting("COMMAND_BSS_START", "");
|
String regexp = Cooja.getExternalToolsSetting("COMMAND_BSS_START", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return parseFirstHexInt(regexp, output);
|
return parseFirstHexInt(regexp, output);
|
||||||
}
|
}
|
||||||
public static int parseCommandBssSectionSize(String[] output) {
|
public static int parseCommandBssSectionSize(String[] output) {
|
||||||
String regexp = GUI.getExternalToolsSetting("COMMAND_BSS_END", "");
|
String regexp = Cooja.getExternalToolsSetting("COMMAND_BSS_END", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -932,14 +932,14 @@ public class ContikiMoteType implements MoteType {
|
||||||
return end - start;
|
return end - start;
|
||||||
}
|
}
|
||||||
public static int parseCommandCommonSectionAddr(String[] output) {
|
public static int parseCommandCommonSectionAddr(String[] output) {
|
||||||
String regexp = GUI.getExternalToolsSetting("COMMAND_COMMON_START", "");
|
String regexp = Cooja.getExternalToolsSetting("COMMAND_COMMON_START", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return parseFirstHexInt(regexp, output);
|
return parseFirstHexInt(regexp, output);
|
||||||
}
|
}
|
||||||
public static int parseCommandCommonSectionSize(String[] output) {
|
public static int parseCommandCommonSectionSize(String[] output) {
|
||||||
String regexp = GUI.getExternalToolsSetting("COMMAND_COMMON_END", "");
|
String regexp = Cooja.getExternalToolsSetting("COMMAND_COMMON_END", "");
|
||||||
if (regexp.equals("")) {
|
if (regexp.equals("")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -972,9 +972,9 @@ public class ContikiMoteType implements MoteType {
|
||||||
|
|
||||||
private static int getRelVarAddr(String mapFileData[], String varName) {
|
private static int getRelVarAddr(String mapFileData[], String varName) {
|
||||||
String regExp =
|
String regExp =
|
||||||
GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_1") +
|
Cooja.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_1") +
|
||||||
varName +
|
varName +
|
||||||
GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_2");
|
Cooja.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_2");
|
||||||
String retString = getFirstMatchGroup(mapFileData, regExp, 1);
|
String retString = getFirstMatchGroup(mapFileData, regExp, 1);
|
||||||
|
|
||||||
if (retString != null) {
|
if (retString != null) {
|
||||||
|
@ -1002,7 +1002,7 @@ public class ContikiMoteType implements MoteType {
|
||||||
ArrayList<String> output = new ArrayList<String>();
|
ArrayList<String> output = new ArrayList<String>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String command = GUI.getExternalToolsSetting("PARSE_COMMAND");
|
String command = Cooja.getExternalToolsSetting("PARSE_COMMAND");
|
||||||
if (command == null) {
|
if (command == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1386,7 +1386,7 @@ public class ContikiMoteType implements MoteType {
|
||||||
setCompileCommands(compileCommands);
|
setCompileCommands(compileCommands);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean createdOK = configureAndInit(GUI.getTopParentContainer(), simulation, visAvailable);
|
boolean createdOK = configureAndInit(Cooja.getTopParentContainer(), simulation, visAvailable);
|
||||||
return createdOK;
|
return createdOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
@ -108,7 +108,7 @@ public abstract class AbstractCompileDialog extends JDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Simulation simulation;
|
protected Simulation simulation;
|
||||||
protected GUI gui;
|
protected Cooja gui;
|
||||||
protected MoteType moteType;
|
protected MoteType moteType;
|
||||||
|
|
||||||
protected JTabbedPane tabbedPane;
|
protected JTabbedPane tabbedPane;
|
||||||
|
@ -189,7 +189,7 @@ public abstract class AbstractCompileDialog extends JDialog {
|
||||||
lastFile = fp;
|
lastFile = fp;
|
||||||
}
|
}
|
||||||
if (lastFile == null) {
|
if (lastFile == null) {
|
||||||
String path = GUI.getExternalToolsSetting("COMPILE_LAST_FILE", null);
|
String path = Cooja.getExternalToolsSetting("COMPILE_LAST_FILE", null);
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
lastFile = new File(path);
|
lastFile = new File(path);
|
||||||
lastFile = gui.restorePortablePath(lastFile);
|
lastFile = gui.restorePortablePath(lastFile);
|
||||||
|
@ -209,7 +209,7 @@ public abstract class AbstractCompileDialog extends JDialog {
|
||||||
} else {
|
} else {
|
||||||
File helloworldSourceFile =
|
File helloworldSourceFile =
|
||||||
new java.io.File(
|
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 {
|
try {
|
||||||
helloworldSourceFile = helloworldSourceFile.getCanonicalFile();
|
helloworldSourceFile = helloworldSourceFile.getCanonicalFile();
|
||||||
fc.setCurrentDirectory(helloworldSourceFile.getParentFile());
|
fc.setCurrentDirectory(helloworldSourceFile.getParentFile());
|
||||||
|
@ -579,7 +579,7 @@ public abstract class AbstractCompileDialog extends JDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
lastFile = file;
|
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")) {
|
if (file.getName().endsWith(".c")) {
|
||||||
setDialogState(DialogState.SELECTED_SOURCE);
|
setDialogState(DialogState.SELECTED_SOURCE);
|
||||||
|
@ -797,7 +797,7 @@ public abstract class AbstractCompileDialog extends JDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create new mote interface checkbox */
|
/* Create new mote interface checkbox */
|
||||||
JCheckBox intfCheckBox = new JCheckBox(GUI.getDescriptionOf(intfClass));
|
JCheckBox intfCheckBox = new JCheckBox(Cooja.getDescriptionOf(intfClass));
|
||||||
intfCheckBox.setSelected(selected);
|
intfCheckBox.setSelected(selected);
|
||||||
intfCheckBox.putClientProperty("class", intfClass);
|
intfCheckBox.putClientProperty("class", intfClass);
|
||||||
intfCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
intfCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
|
|
|
@ -62,7 +62,7 @@ import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.Positioner;
|
import se.sics.cooja.Positioner;
|
||||||
|
@ -215,7 +215,7 @@ public class AddMoteDialog extends JDialog {
|
||||||
.getRegisteredPositioners();
|
.getRegisteredPositioners();
|
||||||
String[] posDistributions = new String[positioners.size()];
|
String[] posDistributions = new String[positioners.size()];
|
||||||
for (int i = 0; i < posDistributions.length; i++) {
|
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);
|
comboBox = new JComboBox(posDistributions);
|
||||||
|
@ -465,7 +465,7 @@ public class AddMoteDialog extends JDialog {
|
||||||
Class<? extends Positioner> positionerClass = null;
|
Class<? extends Positioner> positionerClass = null;
|
||||||
for (Class<? extends Positioner> positioner : simulation.getGUI()
|
for (Class<? extends Positioner> positioner : simulation.getGUI()
|
||||||
.getRegisteredPositioners()) {
|
.getRegisteredPositioners()) {
|
||||||
if (GUI.getDescriptionOf(positioner).equals(
|
if (Cooja.getDescriptionOf(positioner).equals(
|
||||||
positionDistributionBox.getSelectedItem())) {
|
positionDistributionBox.getSelectedItem())) {
|
||||||
positionerClass = positioner;
|
positionerClass = positioner;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ import javax.swing.KeyStroke;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.SimEventCentral;
|
import se.sics.cooja.SimEventCentral;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class BufferSettings extends JDialog {
|
||||||
private SimEventCentral central;
|
private SimEventCentral central;
|
||||||
|
|
||||||
public static void showDialog(JDesktopPane parent, Simulation simulation) {
|
public static void showDialog(JDesktopPane parent, Simulation simulation) {
|
||||||
if (GUI.isVisualizedInApplet()) {
|
if (Cooja.isVisualizedInApplet()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ public class BufferSettings extends JDialog {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI.setExternalToolsSetting("BUFFERSIZE_LOGOUTPUT", "" + central.getLogOutputBufferSize());
|
Cooja.setExternalToolsSetting("BUFFERSIZE_LOGOUTPUT", "" + central.getLogOutputBufferSize());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ import javax.swing.Action;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
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;
|
||||||
import se.sics.cooja.MoteType.MoteTypeCreationException;
|
import se.sics.cooja.MoteType.MoteTypeCreationException;
|
||||||
import se.sics.cooja.contikimote.ContikiMoteType;
|
import se.sics.cooja.contikimote.ContikiMoteType;
|
||||||
|
@ -359,7 +359,7 @@ public class CompileContiki {
|
||||||
BufferedWriter sourceFileWriter = null;
|
BufferedWriter sourceFileWriter = null;
|
||||||
try {
|
try {
|
||||||
Reader reader;
|
Reader reader;
|
||||||
String mainTemplate = GUI.getExternalToolsSetting("CONTIKI_MAIN_TEMPLATE_FILENAME");
|
String mainTemplate = Cooja.getExternalToolsSetting("CONTIKI_MAIN_TEMPLATE_FILENAME");
|
||||||
if ((new File(mainTemplate)).exists()) {
|
if ((new File(mainTemplate)).exists()) {
|
||||||
reader = new FileReader(mainTemplate);
|
reader = new FileReader(mainTemplate);
|
||||||
} else {
|
} else {
|
||||||
|
@ -455,11 +455,11 @@ public class CompileContiki {
|
||||||
boolean includeSymbols = false; /* TODO */
|
boolean includeSymbols = false; /* TODO */
|
||||||
|
|
||||||
/* Fetch configuration from external tools */
|
/* Fetch configuration from external tools */
|
||||||
String link1 = GUI.getExternalToolsSetting("LINK_COMMAND_1", "");
|
String link1 = Cooja.getExternalToolsSetting("LINK_COMMAND_1", "");
|
||||||
String link2 = GUI.getExternalToolsSetting("LINK_COMMAND_2", "");
|
String link2 = Cooja.getExternalToolsSetting("LINK_COMMAND_2", "");
|
||||||
String ar1 = GUI.getExternalToolsSetting("AR_COMMAND_1", "");
|
String ar1 = Cooja.getExternalToolsSetting("AR_COMMAND_1", "");
|
||||||
String ar2 = GUI.getExternalToolsSetting("AR_COMMAND_2", "");
|
String ar2 = Cooja.getExternalToolsSetting("AR_COMMAND_2", "");
|
||||||
String ccFlags = GUI.getExternalToolsSetting("COMPILER_ARGS", "");
|
String ccFlags = Cooja.getExternalToolsSetting("COMPILER_ARGS", "");
|
||||||
|
|
||||||
/* Replace MAPFILE variable */
|
/* Replace MAPFILE variable */
|
||||||
link1 = link1.replace("$(MAPFILE)", "obj_cooja/" + mapFile.getName());
|
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[] { "CONTIKI_APP", contikiAppNoExtension });
|
||||||
env.add(new String[] { "COOJA_SOURCEDIRS", "" });
|
env.add(new String[] { "COOJA_SOURCEDIRS", "" });
|
||||||
env.add(new String[] { "COOJA_SOURCEFILES", "" });
|
env.add(new String[] { "COOJA_SOURCEFILES", "" });
|
||||||
env.add(new String[] { "CC", GUI.getExternalToolsSetting("PATH_C_COMPILER") });
|
env.add(new String[] { "CC", Cooja.getExternalToolsSetting("PATH_C_COMPILER") });
|
||||||
env.add(new String[] { "OBJCOPY", GUI.getExternalToolsSetting("PATH_OBJCOPY") });
|
env.add(new String[] { "OBJCOPY", Cooja.getExternalToolsSetting("PATH_OBJCOPY") });
|
||||||
env.add(new String[] { "EXTRA_CC_ARGS", ccFlags });
|
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_1", link1 });
|
||||||
env.add(new String[] { "LINK_COMMAND_2", link2 });
|
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_1", ar1 });
|
||||||
env.add(new String[] { "AR_COMMAND_2", ar2 });
|
env.add(new String[] { "AR_COMMAND_2", ar2 });
|
||||||
env.add(new String[] { "SYMBOLS", includeSymbols?"1":"" });
|
env.add(new String[] { "SYMBOLS", includeSymbols?"1":"" });
|
||||||
|
|
|
@ -64,7 +64,7 @@ import javax.swing.JProgressBar;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
|
|
||||||
import se.sics.cooja.CoreComm;
|
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.MoteType.MoteTypeCreationException;
|
||||||
import se.sics.cooja.SectionMoteMemory;
|
import se.sics.cooja.SectionMoteMemory;
|
||||||
import se.sics.cooja.contikimote.ContikiMoteType;
|
import se.sics.cooja.contikimote.ContikiMoteType;
|
||||||
|
@ -152,8 +152,8 @@ public class ConfigurationWizard extends JDialog {
|
||||||
private static JButton button;
|
private static JButton button;
|
||||||
private static JProgressBar progressBar;
|
private static JProgressBar progressBar;
|
||||||
|
|
||||||
public static boolean startWizard(Container parentContainer, GUI gui) {
|
public static boolean startWizard(Container parentContainer, Cooja gui) {
|
||||||
if (GUI.isVisualizedInApplet()) {
|
if (Cooja.isVisualizedInApplet()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ public class ConfigurationWizard extends JDialog {
|
||||||
return true;
|
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};
|
String options[] = {"Start tests", OPTION_CLOSE_WIZARD};
|
||||||
int value = JOptionPane.showOptionDialog(parent,
|
int value = JOptionPane.showOptionDialog(parent,
|
||||||
"This wizard configures and tests your toolchain for simulation of Cooja motes.\n" +
|
"This wizard configures and tests your toolchain for simulation of Cooja motes.\n" +
|
||||||
|
@ -206,7 +206,7 @@ public class ConfigurationWizard extends JDialog {
|
||||||
return true;
|
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";
|
final String testDescription = "Step 1/4 - Compile and link Contiki library";
|
||||||
String value = OPTION_RUN_TEST;
|
String value = OPTION_RUN_TEST;
|
||||||
while (value.equals(OPTION_RUN_TEST)) {
|
while (value.equals(OPTION_RUN_TEST)) {
|
||||||
|
@ -260,7 +260,7 @@ public class ConfigurationWizard extends JDialog {
|
||||||
return false;
|
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";
|
final String testDescription = "Step 2/4 - Load Contiki library in Java";
|
||||||
String value = OPTION_RUN_TEST;
|
String value = OPTION_RUN_TEST;
|
||||||
while (value.equals(OPTION_RUN_TEST)) {
|
while (value.equals(OPTION_RUN_TEST)) {
|
||||||
|
@ -315,7 +315,7 @@ public class ConfigurationWizard extends JDialog {
|
||||||
return false;
|
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";
|
final String testDescription = "Step 3/4 - Library memory addresses";
|
||||||
String value = OPTION_RUN_TEST;
|
String value = OPTION_RUN_TEST;
|
||||||
while (value.equals(OPTION_RUN_TEST)) {
|
while (value.equals(OPTION_RUN_TEST)) {
|
||||||
|
@ -371,7 +371,7 @@ public class ConfigurationWizard extends JDialog {
|
||||||
return false;
|
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";
|
final String testDescription = "Step 4/4 - Memory replacement test";
|
||||||
String value = OPTION_RUN_TEST;
|
String value = OPTION_RUN_TEST;
|
||||||
while (value.equals(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) {
|
private static JPanel createConfigureComboBox(final String name) {
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
|
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);
|
JLabel label = new JLabel(name);
|
||||||
label.setToolTipText(name);
|
label.setToolTipText(name);
|
||||||
|
@ -490,7 +490,7 @@ public class ConfigurationWizard extends JDialog {
|
||||||
}
|
}
|
||||||
combo.addItemListener(new ItemListener() {
|
combo.addItemListener(new ItemListener() {
|
||||||
public void itemStateChanged(ItemEvent e) {
|
public void itemStateChanged(ItemEvent e) {
|
||||||
GUI.setExternalToolsSetting(name, (String) e.getItem());
|
Cooja.setExternalToolsSetting(name, (String) e.getItem());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
combo.setEditable(true);
|
combo.setEditable(true);
|
||||||
|
@ -616,7 +616,7 @@ public class ConfigurationWizard extends JDialog {
|
||||||
|
|
||||||
testOutput.addMessage("### Compiling C library source: " + cLibrarySourceFile.getName());
|
testOutput.addMessage("### Compiling C library source: " + cLibrarySourceFile.getName());
|
||||||
try {
|
try {
|
||||||
String contikiPath = GUI.getExternalToolsSetting("PATH_CONTIKI").replaceAll("\\\\", "/");
|
String contikiPath = Cooja.getExternalToolsSetting("PATH_CONTIKI").replaceAll("\\\\", "/");
|
||||||
CompileContiki.compile(
|
CompileContiki.compile(
|
||||||
"make " +
|
"make " +
|
||||||
"-f " + contikiPath + "/Makefile.include " +
|
"-f " + contikiPath + "/Makefile.include " +
|
||||||
|
@ -711,7 +711,7 @@ public class ConfigurationWizard extends JDialog {
|
||||||
testOutput.addMessage("");
|
testOutput.addMessage("");
|
||||||
successCommand = performCommandAddressTest(testOutput, normalStream, errorStream);
|
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) {
|
if (successMap && successCommand) {
|
||||||
testOutput.addMessage("### Both map file and command based address parsing succeeded");
|
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)) {
|
if (!performLoadTest(dummy, dummyStream, errorStream)) {
|
||||||
return false;
|
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 (parseWithCommand) {
|
||||||
if (!performCommandAddressTest(dummy, dummyStream, errorStream)) {
|
if (!performCommandAddressTest(dummy, dummyStream, errorStream)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -56,7 +56,7 @@ import javax.swing.event.DocumentListener;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.CoreComm;
|
import se.sics.cooja.CoreComm;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.ProjectConfig;
|
import se.sics.cooja.ProjectConfig;
|
||||||
|
@ -211,7 +211,7 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
||||||
|
|
||||||
return
|
return
|
||||||
/*"make clean TARGET=cooja\n" + */
|
/*"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) {
|
public File getExpectedFirmwareFile(File source) {
|
||||||
|
@ -326,7 +326,7 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
/* Show external tools dialog */
|
/* Show external tools dialog */
|
||||||
ExternalToolsDialog.showDialog(GUI.getTopParentContainer());
|
ExternalToolsDialog.showDialog(Cooja.getTopParentContainer());
|
||||||
|
|
||||||
/* Update and select environment tab */
|
/* Update and select environment tab */
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
|
|
@ -60,7 +60,7 @@ import javax.swing.KeyStroke;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.RadioMedium;
|
import se.sics.cooja.RadioMedium;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ public class CreateSimDialog extends JDialog {
|
||||||
Class<? extends RadioMedium> radioMediumClass =
|
Class<? extends RadioMedium> radioMediumClass =
|
||||||
simulation.getRadioMedium().getClass();
|
simulation.getRadioMedium().getClass();
|
||||||
|
|
||||||
String currentDescription = GUI.getDescriptionOf(radioMediumClass);
|
String currentDescription = Cooja.getDescriptionOf(radioMediumClass);
|
||||||
|
|
||||||
for (int i=0; i < dialog.radioMediumBox.getItemCount(); i++) {
|
for (int i=0; i < dialog.radioMediumBox.getItemCount(); i++) {
|
||||||
String menuDescription = (String) dialog.radioMediumBox.getItemAt(i);
|
String menuDescription = (String) dialog.radioMediumBox.getItemAt(i);
|
||||||
|
@ -167,7 +167,7 @@ public class CreateSimDialog extends JDialog {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CreateSimDialog(Window window, GUI gui) {
|
private CreateSimDialog(Window window, Cooja gui) {
|
||||||
super(window, "Create new simulation", ModalityType.APPLICATION_MODAL);
|
super(window, "Create new simulation", ModalityType.APPLICATION_MODAL);
|
||||||
Box vertBox = Box.createVerticalBox();
|
Box vertBox = Box.createVerticalBox();
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ public class CreateSimDialog extends JDialog {
|
||||||
|
|
||||||
Vector<String> radioMediumDescriptions = new Vector<String>();
|
Vector<String> radioMediumDescriptions = new Vector<String>();
|
||||||
for (Class<? extends RadioMedium> radioMediumClass: gui.getRegisteredRadioMediums()) {
|
for (Class<? extends RadioMedium> radioMediumClass: gui.getRegisteredRadioMediums()) {
|
||||||
String description = GUI.getDescriptionOf(radioMediumClass);
|
String description = Cooja.getDescriptionOf(radioMediumClass);
|
||||||
radioMediumDescriptions.add(description);
|
radioMediumDescriptions.add(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ public class CreateSimDialog extends JDialog {
|
||||||
|
|
||||||
String currentRadioMediumDescription = (String) radioMediumBox.getSelectedItem();
|
String currentRadioMediumDescription = (String) radioMediumBox.getSelectedItem();
|
||||||
for (Class<? extends RadioMedium> radioMediumClass: mySimulation.getGUI().getRegisteredRadioMediums()) {
|
for (Class<? extends RadioMedium> radioMediumClass: mySimulation.getGUI().getRegisteredRadioMediums()) {
|
||||||
String radioMediumDescription = GUI.getDescriptionOf(radioMediumClass);
|
String radioMediumDescription = Cooja.getDescriptionOf(radioMediumClass);
|
||||||
|
|
||||||
if (currentRadioMediumDescription.equals(radioMediumDescription)) {
|
if (currentRadioMediumDescription.equals(radioMediumDescription)) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class ExternalToolsDialog extends JDialog {
|
||||||
* Parent container for dialog
|
* Parent container for dialog
|
||||||
*/
|
*/
|
||||||
public static void showDialog(Container parentContainer) {
|
public static void showDialog(Container parentContainer) {
|
||||||
if (GUI.isVisualizedInApplet()) {
|
if (Cooja.isVisualizedInApplet()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,13 +153,13 @@ public class ExternalToolsDialog extends JDialog {
|
||||||
explanations.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
explanations.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||||
|
|
||||||
// MAIN PART
|
// MAIN PART
|
||||||
textFields = new JTextField[GUI.getExternalToolsSettingsCount()];
|
textFields = new JTextField[Cooja.getExternalToolsSettingsCount()];
|
||||||
for (int i = 0; i < GUI.getExternalToolsSettingsCount(); i++) {
|
for (int i = 0; i < Cooja.getExternalToolsSettingsCount(); i++) {
|
||||||
// Add text fields for every changeable property
|
// Add text fields for every changeable property
|
||||||
smallPane = new JPanel();
|
smallPane = new JPanel();
|
||||||
smallPane.setAlignmentX(Component.LEFT_ALIGNMENT);
|
smallPane.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
smallPane.setLayout(new BoxLayout(smallPane, BoxLayout.X_AXIS));
|
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));
|
label.setPreferredSize(new Dimension(LABEL_WIDTH, LABEL_HEIGHT));
|
||||||
|
|
||||||
textField = new JTextField(35);
|
textField = new JTextField(35);
|
||||||
|
@ -192,17 +192,17 @@ public class ExternalToolsDialog extends JDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTextFields() {
|
private void updateTextFields() {
|
||||||
for (int i = 0; i < GUI.getExternalToolsSettingsCount(); i++) {
|
for (int i = 0; i < Cooja.getExternalToolsSettingsCount(); i++) {
|
||||||
textFields[i].setText(GUI.getExternalToolsSetting(GUI.getExternalToolsSettingName(i), ""));
|
textFields[i].setText(Cooja.getExternalToolsSetting(Cooja.getExternalToolsSettingName(i), ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compareWithDefaults() {
|
private void compareWithDefaults() {
|
||||||
for (int i = 0; i < GUI.getExternalToolsSettingsCount(); i++) {
|
for (int i = 0; i < Cooja.getExternalToolsSettingsCount(); i++) {
|
||||||
String currentValue = textFields[i].getText();
|
String currentValue = textFields[i].getText();
|
||||||
|
|
||||||
// Compare with default value
|
// Compare with default value
|
||||||
String defaultValue = GUI.getExternalToolsDefaultSetting(GUI.getExternalToolsSettingName(i), "");
|
String defaultValue = Cooja.getExternalToolsDefaultSetting(Cooja.getExternalToolsSettingName(i), "");
|
||||||
if (currentValue.equals(defaultValue)) {
|
if (currentValue.equals(defaultValue)) {
|
||||||
textFields[i].setBackground(Color.WHITE);
|
textFields[i].setBackground(Color.WHITE);
|
||||||
textFields[i].setToolTipText("");
|
textFields[i].setToolTipText("");
|
||||||
|
@ -225,15 +225,15 @@ public class ExternalToolsDialog extends JDialog {
|
||||||
}
|
}
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (e.getActionCommand().equals("reset")) {
|
if (e.getActionCommand().equals("reset")) {
|
||||||
GUI.loadExternalToolsDefaultSettings();
|
Cooja.loadExternalToolsDefaultSettings();
|
||||||
updateTextFields();
|
updateTextFields();
|
||||||
compareWithDefaults();
|
compareWithDefaults();
|
||||||
} else if (e.getActionCommand().equals("ok")) {
|
} else if (e.getActionCommand().equals("ok")) {
|
||||||
for (int i = 0; i < GUI.getExternalToolsSettingsCount(); i++) {
|
for (int i = 0; i < Cooja.getExternalToolsSettingsCount(); i++) {
|
||||||
GUI.setExternalToolsSetting(GUI.getExternalToolsSettingName(i), textFields[i].getText()
|
Cooja.setExternalToolsSetting(Cooja.getExternalToolsSettingName(i), textFields[i].getText()
|
||||||
.trim());
|
.trim());
|
||||||
}
|
}
|
||||||
GUI.saveExternalToolsUserSettings();
|
Cooja.saveExternalToolsUserSettings();
|
||||||
if (myDialog != null && myDialog.isDisplayable()) {
|
if (myDialog != null && myDialog.isDisplayable()) {
|
||||||
myDialog.dispose();
|
myDialog.dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ import javax.swing.JPanel;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
import se.sics.cooja.motes.ImportAppMoteType;
|
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"));
|
fc.setSelectedFile(new File(new File(path), name.replace(".", "/") + ".class"));
|
||||||
} else {
|
} else {
|
||||||
File fp = simulation.getGUI()
|
File fp = simulation.getGUI()
|
||||||
.restorePortablePath(new File(GUI.getExternalToolsSetting("IMPORT_APP_LAST",
|
.restorePortablePath(new File(Cooja.getExternalToolsSetting("IMPORT_APP_LAST",
|
||||||
"mymote.class")));
|
"mymote.class")));
|
||||||
if (path.length() > 0 && !fp.getAbsolutePath().startsWith(path)) {
|
if (path.length() > 0 && !fp.getAbsolutePath().startsWith(path)) {
|
||||||
fc.setCurrentDirectory(new File(path));
|
fc.setCurrentDirectory(new File(path));
|
||||||
|
@ -249,7 +249,7 @@ public class ImportAppMoteDialog extends JDialog {
|
||||||
} else {
|
} else {
|
||||||
pathField.setText(loader.getTestClassPath().getPath());
|
pathField.setText(loader.getTestClassPath().getPath());
|
||||||
classField.setText(loader.getTestClassName());
|
classField.setText(loader.getTestClassName());
|
||||||
GUI.setExternalToolsSetting("IMPORT_APP_LAST",
|
Cooja.setExternalToolsSetting("IMPORT_APP_LAST",
|
||||||
simulation.getGUI().createPortablePath(classFile).getPath());
|
simulation.getGUI().createPortablePath(classFile).getPath());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ import javax.swing.JSeparator;
|
||||||
import javax.swing.ListModel;
|
import javax.swing.ListModel;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
|
|
||||||
public class MessageList extends JList {
|
public class MessageList extends JList {
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class MessageList extends JList {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMessage(final String message, final int type) {
|
public void addMessage(final String message, final int type) {
|
||||||
GUI.setProgressMessage(message, type);
|
Cooja.setProgressMessage(message, type);
|
||||||
|
|
||||||
MessageContainer msg = new MessageContainer(message, type);
|
MessageContainer msg = new MessageContainer(message, type);
|
||||||
messages.add(msg);
|
messages.add(msg);
|
||||||
|
|
|
@ -84,7 +84,7 @@ import javax.swing.tree.TreePath;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.COOJAProject;
|
import se.sics.cooja.COOJAProject;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.ProjectConfig;
|
import se.sics.cooja.ProjectConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,7 +97,7 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
private static final long serialVersionUID = 1896348946753376556L;
|
private static final long serialVersionUID = 1896348946753376556L;
|
||||||
private static Logger logger = Logger.getLogger(ProjectDirectoriesDialog.class);
|
private static Logger logger = Logger.getLogger(ProjectDirectoriesDialog.class);
|
||||||
|
|
||||||
private GUI gui;
|
private Cooja gui;
|
||||||
|
|
||||||
private JTable table = null;
|
private JTable table = null;
|
||||||
private JTextArea projectInfo = new JTextArea("Extension information:");
|
private JTextArea projectInfo = new JTextArea("Extension information:");
|
||||||
|
@ -115,8 +115,8 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
* @param currentProjects Current projects
|
* @param currentProjects Current projects
|
||||||
* @return New COOJA projects, or null
|
* @return New COOJA projects, or null
|
||||||
*/
|
*/
|
||||||
public static COOJAProject[] showDialog(Container parent, GUI gui, COOJAProject[] currentProjects) {
|
public static COOJAProject[] showDialog(Container parent, Cooja gui, COOJAProject[] currentProjects) {
|
||||||
if (GUI.isVisualizedInApplet()) {
|
if (Cooja.isVisualizedInApplet()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
newDefaultProjectDirs = newDefaultProjectDirs.replace('\\', '/');
|
newDefaultProjectDirs = newDefaultProjectDirs.replace('\\', '/');
|
||||||
|
|
||||||
String question = "External tools setting DEFAULT_PROJECTDIRS will change from:\n"
|
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"
|
+ "\n\n to:\n\n"
|
||||||
+ newDefaultProjectDirs.replace(';', '\n');
|
+ newDefaultProjectDirs.replace(';', '\n');
|
||||||
String title = "Change external tools settings?";
|
String title = "Change external tools settings?";
|
||||||
|
@ -275,7 +275,7 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI.setExternalToolsSetting("DEFAULT_PROJECTDIRS", newDefaultProjectDirs);
|
Cooja.setExternalToolsSetting("DEFAULT_PROJECTDIRS", newDefaultProjectDirs);
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -339,7 +339,7 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
String s1 = "Remove";
|
String s1 = "Remove";
|
||||||
String s2 = "Cancel";
|
String s2 = "Cancel";
|
||||||
Object[] options = { s1, s2 };
|
Object[] options = { s1, s2 };
|
||||||
int n = JOptionPane.showOptionDialog(GUI.getTopParentContainer(),
|
int n = JOptionPane.showOptionDialog(Cooja.getTopParentContainer(),
|
||||||
"Remove Cooja project?\n" + project,
|
"Remove Cooja project?\n" + project,
|
||||||
"Remove Cooja project?", JOptionPane.YES_NO_OPTION,
|
"Remove Cooja project?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.WARNING_MESSAGE, null, options, s1);
|
JOptionPane.WARNING_MESSAGE, null, options, s1);
|
||||||
|
@ -415,7 +415,7 @@ public class ProjectDirectoriesDialog extends JDialog {
|
||||||
String[] jars = project.getConfigJARs();
|
String[] jars = project.getConfigJARs();
|
||||||
projectInfo.append("JARs: " + Arrays.toString(jars) + "\n");
|
projectInfo.append("JARs: " + Arrays.toString(jars) + "\n");
|
||||||
for (String jar: jars) {
|
for (String jar: jars) {
|
||||||
File jarFile = GUI.findJarFile(project.dir, jar);
|
File jarFile = Cooja.findJarFile(project.dir, jar);
|
||||||
if (jarFile == null) {
|
if (jarFile == null) {
|
||||||
projectInfo.append("\tError: " + jar + " could not be found.\n");
|
projectInfo.append("\tError: " + jar + " could not be found.\n");
|
||||||
} else if (!jarFile.exists()) {
|
} else if (!jarFile.exists()) {
|
||||||
|
@ -742,7 +742,7 @@ class DirectoryTreePanel extends JPanel {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean containsConfig() {
|
boolean containsConfig() {
|
||||||
return new File(dir, GUI.PROJECT_CONFIG_FILENAME).exists();
|
return new File(dir, Cooja.PROJECT_CONFIG_FILENAME).exists();
|
||||||
}
|
}
|
||||||
boolean subtreeContainsProject() {
|
boolean subtreeContainsProject() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.SimEventCentral.MoteCountListener;
|
import se.sics.cooja.SimEventCentral.MoteCountListener;
|
||||||
|
@ -79,7 +79,7 @@ public class Mote2MoteRelations extends MoteInterface {
|
||||||
private Mote mote = null;
|
private Mote mote = null;
|
||||||
|
|
||||||
private ArrayList<Mote> relations = new ArrayList<Mote>();
|
private ArrayList<Mote> relations = new ArrayList<Mote>();
|
||||||
private GUI gui;
|
private Cooja gui;
|
||||||
|
|
||||||
private Observer logObserver = new Observer() {
|
private Observer logObserver = new Observer() {
|
||||||
public void update(Observable o, Object arg) {
|
public void update(Observable o, Object arg) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
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;
|
return createdOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteMemory;
|
import se.sics.cooja.MoteMemory;
|
||||||
import se.sics.cooja.MoteMemory.MemoryEventType;
|
import se.sics.cooja.MoteMemory.MemoryEventType;
|
||||||
|
@ -263,7 +263,7 @@ public class BufferListener extends VisPlugin {
|
||||||
* @param simulation Simulation
|
* @param simulation Simulation
|
||||||
* @param gui GUI
|
* @param gui GUI
|
||||||
*/
|
*/
|
||||||
public BufferListener(final Simulation simulation, final GUI gui) {
|
public BufferListener(final Simulation simulation, final Cooja gui) {
|
||||||
super("Buffer Listener - " + "?" + " motes", gui);
|
super("Buffer Listener - " + "?" + " motes", gui);
|
||||||
this.simulation = simulation;
|
this.simulation = simulation;
|
||||||
|
|
||||||
|
@ -788,7 +788,7 @@ public class BufferListener extends VisPlugin {
|
||||||
if (buffer != null) {
|
if (buffer != null) {
|
||||||
String status = buffer.getStatusString();
|
String status = buffer.getStatusString();
|
||||||
setTitle("Buffer Listener - " +
|
setTitle("Buffer Listener - " +
|
||||||
((status!=null)?status:GUI.getDescriptionOf(buffer)) + " " +
|
((status!=null)?status:Cooja.getDescriptionOf(buffer)) + " " +
|
||||||
"- " + memoryMonitors.size() + " buffers on " + motes.size() + " motes");
|
"- " + memoryMonitors.size() + " buffers on " + motes.size() + " motes");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1056,9 +1056,9 @@ public class BufferListener extends VisPlugin {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JFileChooser fc = new JFileChooser();
|
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);
|
fc.setSelectedFile(suggest);
|
||||||
int returnVal = fc.showSaveDialog(GUI.getTopParentContainer());
|
int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer());
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1069,7 +1069,7 @@ public class BufferListener extends VisPlugin {
|
||||||
String s2 = "Cancel";
|
String s2 = "Cancel";
|
||||||
Object[] options = { s1, s2 };
|
Object[] options = { s1, s2 };
|
||||||
int n = JOptionPane.showOptionDialog(
|
int n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"A file with the same name already exists.\nDo you want to remove it?",
|
"A file with the same name already exists.\nDo you want to remove it?",
|
||||||
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
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()) {
|
if (saveFile.exists() && !saveFile.canWrite()) {
|
||||||
logger.fatal("No write access to file: " + saveFile);
|
logger.fatal("No write access to file: " + saveFile);
|
||||||
return;
|
return;
|
||||||
|
@ -1280,7 +1280,7 @@ public class BufferListener extends VisPlugin {
|
||||||
parserMenu.removeAll();
|
parserMenu.removeAll();
|
||||||
|
|
||||||
for (Class<? extends Parser> bpClass: bufferParsers) {
|
for (Class<? extends Parser> 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.putClientProperty("CLASS", bpClass);
|
||||||
mi.addActionListener(parserSelectedListener);
|
mi.addActionListener(parserSelectedListener);
|
||||||
parserMenu.add(mi);
|
parserMenu.add(mi);
|
||||||
|
@ -1309,7 +1309,7 @@ public class BufferListener extends VisPlugin {
|
||||||
if (btClass == CustomVariableBuffer.class) {
|
if (btClass == CustomVariableBuffer.class) {
|
||||||
bufferMenu.addSeparator();
|
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.putClientProperty("CLASS", btClass);
|
||||||
mi.addActionListener(bufferSelectedListener);
|
mi.addActionListener(bufferSelectedListener);
|
||||||
bufferMenu.add(mi);
|
bufferMenu.add(mi);
|
||||||
|
@ -1329,7 +1329,7 @@ public class BufferListener extends VisPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
parser = bp;
|
parser = bp;
|
||||||
logTable.getColumnModel().getColumn(COLUMN_DATA).setHeaderValue(GUI.getDescriptionOf(bp));
|
logTable.getColumnModel().getColumn(COLUMN_DATA).setHeaderValue(Cooja.getDescriptionOf(bp));
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
@ -1831,9 +1831,9 @@ public class BufferListener extends VisPlugin {
|
||||||
offset = Integer.parseInt(element.getAttributeValue("offset"));
|
offset = Integer.parseInt(element.getAttributeValue("offset"));
|
||||||
}
|
}
|
||||||
public boolean configure(BufferListener bl) {
|
public boolean configure(BufferListener bl) {
|
||||||
String suggestName = GUI.getExternalToolsSetting("BUFFER_LISTENER_VARNAME", "node_id");
|
String suggestName = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VARNAME", "node_id");
|
||||||
String suggestSize = GUI.getExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "2");
|
String suggestSize = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "2");
|
||||||
String suggestOffset = GUI.getExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "0");
|
String suggestOffset = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "0");
|
||||||
BufferInput infoComponent =
|
BufferInput infoComponent =
|
||||||
new BufferInput(suggestName, suggestSize, suggestOffset);
|
new BufferInput(suggestName, suggestSize, suggestOffset);
|
||||||
|
|
||||||
|
@ -1868,9 +1868,9 @@ public class BufferListener extends VisPlugin {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable);
|
Cooja.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable);
|
||||||
GUI.setExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "" + size);
|
Cooja.setExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "" + size);
|
||||||
GUI.setExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "" + offset);
|
Cooja.setExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "" + offset);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1912,9 +1912,9 @@ public class BufferListener extends VisPlugin {
|
||||||
offset = Integer.parseInt(element.getAttributeValue("offset"));
|
offset = Integer.parseInt(element.getAttributeValue("offset"));
|
||||||
}
|
}
|
||||||
public boolean configure(BufferListener bl) {
|
public boolean configure(BufferListener bl) {
|
||||||
String suggestName = GUI.getExternalToolsSetting("BUFFER_LISTENER_VARNAME", "node_id");
|
String suggestName = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VARNAME", "node_id");
|
||||||
String suggestSize = GUI.getExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "2");
|
String suggestSize = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "2");
|
||||||
String suggestOffset = GUI.getExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "0");
|
String suggestOffset = Cooja.getExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "0");
|
||||||
BufferInput infoComponent =
|
BufferInput infoComponent =
|
||||||
new BufferInput(suggestName, suggestSize, suggestOffset);
|
new BufferInput(suggestName, suggestSize, suggestOffset);
|
||||||
|
|
||||||
|
@ -1948,9 +1948,9 @@ public class BufferListener extends VisPlugin {
|
||||||
/* Abort */
|
/* Abort */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
GUI.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable);
|
Cooja.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable);
|
||||||
GUI.setExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "" + size);
|
Cooja.setExternalToolsSetting("BUFFER_LISTENER_VARSIZE", "" + size);
|
||||||
GUI.setExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "" + offset);
|
Cooja.setExternalToolsSetting("BUFFER_LISTENER_VAROFFSET", "" + offset);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1979,7 +1979,7 @@ public class BufferListener extends VisPlugin {
|
||||||
variable = element.getAttributeValue("variable");
|
variable = element.getAttributeValue("variable");
|
||||||
}
|
}
|
||||||
public boolean configure(BufferListener bl) {
|
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 =
|
BufferInput infoComponent =
|
||||||
new BufferInput(suggestName, null, null);
|
new BufferInput(suggestName, null, null);
|
||||||
|
|
||||||
|
@ -1995,7 +1995,7 @@ public class BufferListener extends VisPlugin {
|
||||||
if (variable == null) {
|
if (variable == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
GUI.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable);
|
Cooja.setExternalToolsSetting("BUFFER_LISTENER_VARNAME", variable);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ import javax.swing.table.TableCellEditor;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
@ -98,14 +98,14 @@ public class DGRMConfigurator extends VisPlugin {
|
||||||
"Source", "Destination", "RX Ratio", "RSSI","LQI", "Delay"
|
"Source", "Destination", "RX Ratio", "RSSI","LQI", "Delay"
|
||||||
};
|
};
|
||||||
|
|
||||||
private GUI gui = null;
|
private Cooja gui = null;
|
||||||
private DirectedGraphMedium radioMedium = null;
|
private DirectedGraphMedium radioMedium = null;
|
||||||
private Observer radioMediumObserver;
|
private Observer radioMediumObserver;
|
||||||
private JTable graphTable = null;
|
private JTable graphTable = null;
|
||||||
private JComboBox combo = new JComboBox();
|
private JComboBox combo = new JComboBox();
|
||||||
private JButton removeButton;
|
private JButton removeButton;
|
||||||
|
|
||||||
public DGRMConfigurator(Simulation sim, GUI gui) {
|
public DGRMConfigurator(Simulation sim, Cooja gui) {
|
||||||
super("DGRM Configurator", gui);
|
super("DGRM Configurator", gui);
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
radioMedium = (DirectedGraphMedium) sim.getRadioMedium();
|
radioMedium = (DirectedGraphMedium) sim.getRadioMedium();
|
||||||
|
@ -296,7 +296,7 @@ public class DGRMConfigurator extends VisPlugin {
|
||||||
if (radioMedium.getEdges().length > 0) {
|
if (radioMedium.getEdges().length > 0) {
|
||||||
String[] options = new String[] { "Remove", "Cancel" };
|
String[] options = new String[] { "Remove", "Cancel" };
|
||||||
int n = JOptionPane.showOptionDialog(
|
int n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"Importing edges will remove all your existing edges.",
|
"Importing edges will remove all your existing edges.",
|
||||||
"Clear edge table?", JOptionPane.YES_NO_OPTION,
|
"Clear edge table?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
||||||
|
@ -310,9 +310,9 @@ public class DGRMConfigurator extends VisPlugin {
|
||||||
|
|
||||||
/* Select file to import edges from */
|
/* Select file to import edges from */
|
||||||
JFileChooser fc = new JFileChooser();
|
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);
|
fc.setSelectedFile(suggest);
|
||||||
int returnVal = fc.showOpenDialog(GUI.getTopParentContainer());
|
int returnVal = fc.showOpenDialog(Cooja.getTopParentContainer());
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -321,13 +321,13 @@ public class DGRMConfigurator extends VisPlugin {
|
||||||
logger.fatal("No read access to file: " + file);
|
logger.fatal("No read access to file: " + file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GUI.setExternalToolsSetting("DGRM_IMPORT_LINKS_FILE", file.getPath());
|
Cooja.setExternalToolsSetting("DGRM_IMPORT_LINKS_FILE", file.getPath());
|
||||||
|
|
||||||
/* Parse and import edges */
|
/* Parse and import edges */
|
||||||
try {
|
try {
|
||||||
importEdges(parseDGRMLinksFile(file, gui.getSimulation()));
|
importEdges(parseDGRMLinksFile(file, gui.getSimulation()));
|
||||||
} catch (Exception e) {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
|
@ -132,7 +132,7 @@ public class EventListener extends VisPlugin {
|
||||||
final MoteInterface moteInterface = (MoteInterface) obs;
|
final MoteInterface moteInterface = (MoteInterface) obs;
|
||||||
int moteID = myMote.getID();
|
int moteID = myMote.getID();
|
||||||
|
|
||||||
myParent.actOnChange("'" + GUI.getDescriptionOf(moteInterface.getClass())
|
myParent.actOnChange("'" + Cooja.getDescriptionOf(moteInterface.getClass())
|
||||||
+ "'" + " of mote '" + (moteID > 0 ? Integer.toString(moteID) : "?")
|
+ "'" + " of mote '" + (moteID > 0 ? Integer.toString(moteID) : "?")
|
||||||
+ "'" + " changed at time "
|
+ "'" + " changed at time "
|
||||||
+ myParent.mySimulation.getSimulationTime(), new AbstractAction(
|
+ myParent.mySimulation.getSimulationTime(), new AbstractAction(
|
||||||
|
@ -141,7 +141,7 @@ public class EventListener extends VisPlugin {
|
||||||
MoteInterfaceViewer plugin =
|
MoteInterfaceViewer plugin =
|
||||||
(MoteInterfaceViewer) mySimulation.getGUI().tryStartPlugin(
|
(MoteInterfaceViewer) mySimulation.getGUI().tryStartPlugin(
|
||||||
MoteInterfaceViewer.class, mySimulation.getGUI(), mySimulation, myMote);
|
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) {
|
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(),
|
+ " changed at time " + myParent.mySimulation.getSimulationTime(),
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ public class EventListener extends VisPlugin {
|
||||||
* @param simulationToControl
|
* @param simulationToControl
|
||||||
* Simulation to control
|
* Simulation to control
|
||||||
*/
|
*/
|
||||||
public EventListener(Simulation simulationToControl, GUI gui) {
|
public EventListener(Simulation simulationToControl, Cooja gui) {
|
||||||
super("Event Listener", gui);
|
super("Event Listener", gui);
|
||||||
|
|
||||||
mySimulation = simulationToControl;
|
mySimulation = simulationToControl;
|
||||||
|
@ -199,7 +199,7 @@ public class EventListener extends VisPlugin {
|
||||||
interfacePanel.setLayout(new BoxLayout(interfacePanel, BoxLayout.Y_AXIS));
|
interfacePanel.setLayout(new BoxLayout(interfacePanel, BoxLayout.Y_AXIS));
|
||||||
interfacePanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
|
interfacePanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
|
||||||
for (Class<? extends MoteInterface> interfaceClass : allInterfaces) {
|
for (Class<? extends MoteInterface> interfaceClass : allInterfaces) {
|
||||||
JCheckBox checkBox = new JCheckBox(GUI.getDescriptionOf(interfaceClass),
|
JCheckBox checkBox = new JCheckBox(Cooja.getDescriptionOf(interfaceClass),
|
||||||
false);
|
false);
|
||||||
checkBox.setToolTipText(interfaceClass.getName());
|
checkBox.setToolTipText(interfaceClass.getName());
|
||||||
checkBox.putClientProperty("interface_class", interfaceClass);
|
checkBox.putClientProperty("interface_class", interfaceClass);
|
||||||
|
|
|
@ -83,7 +83,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.HasQuickHelp;
|
import se.sics.cooja.HasQuickHelp;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.Plugin;
|
import se.sics.cooja.Plugin;
|
||||||
|
@ -206,7 +206,7 @@ public class LogListener extends VisPlugin implements HasQuickHelp {
|
||||||
* @param simulation Simulation
|
* @param simulation Simulation
|
||||||
* @param gui GUI
|
* @param gui GUI
|
||||||
*/
|
*/
|
||||||
public LogListener(final Simulation simulation, final GUI gui) {
|
public LogListener(final Simulation simulation, final Cooja gui) {
|
||||||
super("Mote output", gui);
|
super("Mote output", gui);
|
||||||
this.simulation = simulation;
|
this.simulation = simulation;
|
||||||
|
|
||||||
|
@ -742,9 +742,9 @@ public class LogListener extends VisPlugin implements HasQuickHelp {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JFileChooser fc = new JFileChooser();
|
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);
|
fc.setSelectedFile(suggest);
|
||||||
int returnVal = fc.showSaveDialog(GUI.getTopParentContainer());
|
int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer());
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -755,7 +755,7 @@ public class LogListener extends VisPlugin implements HasQuickHelp {
|
||||||
String s2 = "Cancel";
|
String s2 = "Cancel";
|
||||||
Object[] options = { s1, s2 };
|
Object[] options = { s1, s2 };
|
||||||
int n = JOptionPane.showOptionDialog(
|
int n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"A file with the same name already exists.\nDo you want to remove it?",
|
"A file with the same name already exists.\nDo you want to remove it?",
|
||||||
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
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()) {
|
if (saveFile.exists() && !saveFile.canWrite()) {
|
||||||
logger.fatal("No write access to file: " + saveFile);
|
logger.fatal("No write access to file: " + saveFile);
|
||||||
return;
|
return;
|
||||||
|
@ -838,9 +838,9 @@ public class LogListener extends VisPlugin implements HasQuickHelp {
|
||||||
}
|
}
|
||||||
|
|
||||||
JFileChooser fc = new JFileChooser();
|
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);
|
fc.setSelectedFile(suggest);
|
||||||
int returnVal = fc.showSaveDialog(GUI.getTopParentContainer());
|
int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer());
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
||||||
appendToFile = false;
|
appendToFile = false;
|
||||||
cb.setSelected(appendToFile);
|
cb.setSelected(appendToFile);
|
||||||
|
@ -848,7 +848,7 @@ public class LogListener extends VisPlugin implements HasQuickHelp {
|
||||||
}
|
}
|
||||||
|
|
||||||
File saveFile = fc.getSelectedFile();
|
File saveFile = fc.getSelectedFile();
|
||||||
GUI.setExternalToolsSetting("LOG_LISTENER_APPENDFILE", saveFile.getPath());
|
Cooja.setExternalToolsSetting("LOG_LISTENER_APPENDFILE", saveFile.getPath());
|
||||||
if (saveFile.exists() && !saveFile.canWrite()) {
|
if (saveFile.exists() && !saveFile.canWrite()) {
|
||||||
logger.fatal("No write access to file: " + saveFile);
|
logger.fatal("No write access to file: " + saveFile);
|
||||||
appendToFile = false;
|
appendToFile = false;
|
||||||
|
|
|
@ -44,7 +44,7 @@ import javax.script.ScriptException;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.SimEventCentral.LogOutputEvent;
|
import se.sics.cooja.SimEventCentral.LogOutputEvent;
|
||||||
import se.sics.cooja.SimEventCentral.LogOutputListener;
|
import se.sics.cooja.SimEventCentral.LogOutputListener;
|
||||||
|
@ -157,8 +157,8 @@ public class LogScriptEngine {
|
||||||
stepScript();
|
stepScript();
|
||||||
} catch (UndeclaredThrowableException e) {
|
} catch (UndeclaredThrowableException e) {
|
||||||
logger.fatal("Exception: " + e.getMessage(), e);
|
logger.fatal("Exception: " + e.getMessage(), e);
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
GUI.showErrorDialog(GUI.getTopParentContainer(),
|
Cooja.showErrorDialog(Cooja.getTopParentContainer(),
|
||||||
e.getMessage(),
|
e.getMessage(),
|
||||||
e, false);
|
e, false);
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ public class LogScriptEngine {
|
||||||
throwable.getMessage().contains("test script killed") ) {
|
throwable.getMessage().contains("test script killed") ) {
|
||||||
logger.info("Test script finished");
|
logger.info("Test script finished");
|
||||||
} else {
|
} else {
|
||||||
if (!GUI.isVisualized()) {
|
if (!Cooja.isVisualized()) {
|
||||||
logger.fatal("Test script error, terminating Cooja.");
|
logger.fatal("Test script error, terminating Cooja.");
|
||||||
logger.fatal("Script error:", e);
|
logger.fatal("Script error:", e);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
@ -317,8 +317,8 @@ public class LogScriptEngine {
|
||||||
logger.fatal("Script error:", e);
|
logger.fatal("Script error:", e);
|
||||||
deactivateScript();
|
deactivateScript();
|
||||||
simulation.stopSimulation();
|
simulation.stopSimulation();
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
GUI.showErrorDialog(GUI.getTopParentContainer(),
|
Cooja.showErrorDialog(Cooja.getTopParentContainer(),
|
||||||
"Script error", e, false);
|
"Script error", e, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,7 @@ public class LogScriptEngine {
|
||||||
private void deactive() {
|
private void deactive() {
|
||||||
deactivateScript();
|
deactivateScript();
|
||||||
|
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
log("[if test was run without visualization, Cooja would now have been terminated]\n");
|
log("[if test was run without visualization, Cooja would now have been terminated]\n");
|
||||||
stopSimulation = true;
|
stopSimulation = true;
|
||||||
simulation.invokeSimulationThread(stopSimulationRunnable);
|
simulation.invokeSimulationThread(stopSimulationRunnable);
|
||||||
|
|
|
@ -45,7 +45,7 @@ import javax.swing.JScrollPane;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MotePlugin;
|
import se.sics.cooja.MotePlugin;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
|
@ -79,7 +79,7 @@ public class MoteInformation extends VisPlugin implements MotePlugin {
|
||||||
* @param s Simulation
|
* @param s Simulation
|
||||||
* @param gui Simulator
|
* @param gui Simulator
|
||||||
*/
|
*/
|
||||||
public MoteInformation(Mote m, Simulation s, GUI gui) {
|
public MoteInformation(Mote m, Simulation s, Cooja gui) {
|
||||||
super("Mote Information (" + m + ")", gui);
|
super("Mote Information (" + m + ")", gui);
|
||||||
this.mote = m;
|
this.mote = m;
|
||||||
this.simulation = s;
|
this.simulation = s;
|
||||||
|
|
|
@ -49,7 +49,7 @@ import javax.swing.JSeparator;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.HasQuickHelp;
|
import se.sics.cooja.HasQuickHelp;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
|
@ -79,7 +79,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, Mote
|
||||||
*
|
*
|
||||||
* @param moteToView Mote to view
|
* @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);
|
super("Mote Interface Viewer (" + moteToView + ")", gui);
|
||||||
mote = moteToView;
|
mote = moteToView;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, Mote
|
||||||
|
|
||||||
Collection<MoteInterface> intfs = mote.getInterfaces().getInterfaces();
|
Collection<MoteInterface> intfs = mote.getInterfaces().getInterfaces();
|
||||||
for (MoteInterface intf : intfs) {
|
for (MoteInterface intf : intfs) {
|
||||||
selectInterfaceComboBox.addItem(GUI.getDescriptionOf(intf));
|
selectInterfaceComboBox.addItem(Cooja.getDescriptionOf(intf));
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInterfaceComboBox.addActionListener(new ActionListener() {
|
selectInterfaceComboBox.addActionListener(new ActionListener() {
|
||||||
|
@ -115,7 +115,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, Mote
|
||||||
selectedMoteInterface = null;
|
selectedMoteInterface = null;
|
||||||
Collection<MoteInterface> intfs = mote.getInterfaces().getInterfaces();
|
Collection<MoteInterface> intfs = mote.getInterfaces().getInterfaces();
|
||||||
for (MoteInterface intf : intfs) {
|
for (MoteInterface intf : intfs) {
|
||||||
if (GUI.getDescriptionOf(intf).equals(interfaceDescription)) {
|
if (Cooja.getDescriptionOf(intf).equals(interfaceDescription)) {
|
||||||
selectedMoteInterface = intf;
|
selectedMoteInterface = intf;
|
||||||
mote.getSimulation().getGUI().loadQuickHelp(MoteInterfaceViewer.this);
|
mote.getSimulation().getGUI().loadQuickHelp(MoteInterfaceViewer.this);
|
||||||
break;
|
break;
|
||||||
|
@ -219,7 +219,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, Mote
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQuickHelp() {
|
public String getQuickHelp() {
|
||||||
String help = "<b>" + GUI.getDescriptionOf(this) + "</b>";
|
String help = "<b>" + Cooja.getDescriptionOf(this) + "</b>";
|
||||||
help += "<p>Lists mote interfaces, and allows mote inspection and interaction via mote interface visualizers.";
|
help += "<p>Lists mote interfaces, and allows mote inspection and interaction via mote interface visualizers.";
|
||||||
|
|
||||||
MoteInterface intf = selectedMoteInterface;
|
MoteInterface intf = selectedMoteInterface;
|
||||||
|
@ -227,7 +227,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, Mote
|
||||||
if (intf instanceof HasQuickHelp) {
|
if (intf instanceof HasQuickHelp) {
|
||||||
help += "<p>" + ((HasQuickHelp)intf).getQuickHelp();
|
help += "<p>" + ((HasQuickHelp)intf).getQuickHelp();
|
||||||
} else {
|
} else {
|
||||||
help += "<p><b>" + GUI.getDescriptionOf(intf) + "</b>";
|
help += "<p><b>" + Cooja.getDescriptionOf(intf) + "</b>";
|
||||||
help += "<p>No help available";
|
help += "<p>No help available";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ import javax.swing.JScrollPane;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
@ -66,7 +66,7 @@ public class MoteTypeInformation extends VisPlugin {
|
||||||
* @param simulation Simulation
|
* @param simulation Simulation
|
||||||
* @param gui Cooja
|
* @param gui Cooja
|
||||||
*/
|
*/
|
||||||
public MoteTypeInformation(Simulation simulation, GUI gui) {
|
public MoteTypeInformation(Simulation simulation, Cooja gui) {
|
||||||
super("Mote Type Information", gui);
|
super("Mote Type Information", gui);
|
||||||
this.simulation = simulation;
|
this.simulation = simulation;
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public class MoteTypeInformation extends VisPlugin {
|
||||||
/* Mote types */
|
/* Mote types */
|
||||||
for (MoteType moteType: simulation.getMoteTypes()) {
|
for (MoteType moteType: simulation.getMoteTypes()) {
|
||||||
String moteTypeString =
|
String moteTypeString =
|
||||||
GUI.getDescriptionOf(moteType) +": " +
|
Cooja.getDescriptionOf(moteType) +": " +
|
||||||
"ID=" + moteType.getIdentifier() +
|
"ID=" + moteType.getIdentifier() +
|
||||||
", \"" + moteType.getDescription() + "\"";
|
", \"" + moteType.getDescription() + "\"";
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
import se.sics.cooja.VisPlugin;
|
import se.sics.cooja.VisPlugin;
|
||||||
|
@ -64,7 +64,7 @@ public class Notes extends VisPlugin {
|
||||||
private JTextArea notes = new JTextArea("Enter notes here");
|
private JTextArea notes = new JTextArea("Enter notes here");
|
||||||
private boolean decorationsVisible = true;
|
private boolean decorationsVisible = true;
|
||||||
|
|
||||||
public Notes(Simulation simulation, GUI gui) {
|
public Notes(Simulation simulation, Cooja gui) {
|
||||||
super("Notes", gui);
|
super("Notes", gui);
|
||||||
|
|
||||||
add(BorderLayout.CENTER, new JScrollPane(notes));
|
add(BorderLayout.CENTER, new JScrollPane(notes));
|
||||||
|
|
|
@ -84,7 +84,7 @@ import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.ConvertedRadioPacket;
|
import se.sics.cooja.ConvertedRadioPacket;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Plugin;
|
import se.sics.cooja.Plugin;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.RadioConnection;
|
import se.sics.cooja.RadioConnection;
|
||||||
|
@ -147,7 +147,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
|
|
||||||
private JTextField searchField = new JTextField(30);
|
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);
|
super("Radio messages", gui);
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
|
@ -961,7 +961,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JFileChooser fc = new JFileChooser();
|
JFileChooser fc = new JFileChooser();
|
||||||
int returnVal = fc.showSaveDialog(GUI.getTopParentContainer());
|
int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer());
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -972,7 +972,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
String s2 = "Cancel";
|
String s2 = "Cancel";
|
||||||
Object[] options = { s1, s2 };
|
Object[] options = { s1, s2 };
|
||||||
int n = JOptionPane.showOptionDialog(
|
int n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"A file with the same name already exists.\nDo you want to remove it?",
|
"A file with the same name already exists.\nDo you want to remove it?",
|
||||||
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
||||||
|
@ -1073,7 +1073,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
String alias = (String) JOptionPane.showInputDialog(
|
String alias = (String) JOptionPane.showInputDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"Enter alias for all packets with identical payload.\n" +
|
"Enter alias for all packets with identical payload.\n" +
|
||||||
"An empty string removes the current alias.\n\n" +
|
"An empty string removes the current alias.\n\n" +
|
||||||
connections.get(selectedRow).data + "\n",
|
connections.get(selectedRow).data + "\n",
|
||||||
|
|
|
@ -80,7 +80,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
import se.sics.cooja.VisPlugin;
|
import se.sics.cooja.VisPlugin;
|
||||||
|
@ -121,7 +121,7 @@ public class ScriptRunner extends VisPlugin {
|
||||||
private JSyntaxLinkFile actionLinkFile = null;
|
private JSyntaxLinkFile actionLinkFile = null;
|
||||||
private File linkedFile = null;
|
private File linkedFile = null;
|
||||||
|
|
||||||
public ScriptRunner(Simulation simulation, GUI gui) {
|
public ScriptRunner(Simulation simulation, Cooja gui) {
|
||||||
super("Simulation script editor", gui, false);
|
super("Simulation script editor", gui, false);
|
||||||
this.simulation = simulation;
|
this.simulation = simulation;
|
||||||
this.engine = null;
|
this.engine = null;
|
||||||
|
@ -147,7 +147,7 @@ public class ScriptRunner extends VisPlugin {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
String script = loadScript(file);
|
String script = loadScript(file);
|
||||||
if (script == null) {
|
if (script == null) {
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"Could not load example script: scripts/" + file,
|
"Could not load example script: scripts/" + file,
|
||||||
"Could not load script", JOptionPane.ERROR_MESSAGE);
|
"Could not load script", JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
|
@ -289,7 +289,7 @@ public class ScriptRunner extends VisPlugin {
|
||||||
codeEditor.setEditable(true);
|
codeEditor.setEditable(true);
|
||||||
} else {
|
} else {
|
||||||
updateScript(linkedFile);
|
updateScript(linkedFile);
|
||||||
GUI.setExternalToolsSetting("SCRIPTRUNNER_LAST_SCRIPTFILE", source.getAbsolutePath());
|
Cooja.setExternalToolsSetting("SCRIPTRUNNER_LAST_SCRIPTFILE", source.getAbsolutePath());
|
||||||
|
|
||||||
if (actionLinkFile != null) {
|
if (actionLinkFile != null) {
|
||||||
actionLinkFile.setMenuText("Unlink script: " + source.getName());
|
actionLinkFile.setMenuText("Unlink script: " + source.getName());
|
||||||
|
@ -321,7 +321,7 @@ public class ScriptRunner extends VisPlugin {
|
||||||
|
|
||||||
/* Create new engine */
|
/* Create new engine */
|
||||||
engine = new LogScriptEngine(simulation);
|
engine = new LogScriptEngine(simulation);
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
/* Attach visualized log observer */
|
/* Attach visualized log observer */
|
||||||
engine.setScriptLogObserver(new Observer() {
|
engine.setScriptLogObserver(new Observer() {
|
||||||
public void update(Observable obs, Object obj) {
|
public void update(Observable obs, Object obj) {
|
||||||
|
@ -380,8 +380,8 @@ public class ScriptRunner extends VisPlugin {
|
||||||
} catch (ScriptException e) {
|
} catch (ScriptException e) {
|
||||||
logger.fatal("Test script error: ", e);
|
logger.fatal("Test script error: ", e);
|
||||||
setScriptActive(false);
|
setScriptActive(false);
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
GUI.showErrorDialog(GUI.getTopParentContainer(),
|
Cooja.showErrorDialog(Cooja.getTopParentContainer(),
|
||||||
"Script error", e, false);
|
"Script error", e, false);
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
|
@ -443,23 +443,23 @@ public class ScriptRunner extends VisPlugin {
|
||||||
/* Start test in external process */
|
/* Start test in external process */
|
||||||
try {
|
try {
|
||||||
JPanel progressPanel = new JPanel(new BorderLayout());
|
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...");
|
progressDialog.setTitle("Running test...");
|
||||||
|
|
||||||
File coojaBuild;
|
File coojaBuild;
|
||||||
File coojaJAR;
|
File coojaJAR;
|
||||||
try {
|
try {
|
||||||
coojaBuild = new File(GUI.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/build");
|
coojaBuild = new File(Cooja.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/build");
|
||||||
coojaJAR = new File(GUI.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/dist/cooja.jar");
|
coojaJAR = new File(Cooja.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/dist/cooja.jar");
|
||||||
coojaBuild = coojaBuild.getCanonicalFile();
|
coojaBuild = coojaBuild.getCanonicalFile();
|
||||||
coojaJAR = coojaJAR.getCanonicalFile();
|
coojaJAR = coojaJAR.getCanonicalFile();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
coojaBuild = new File(GUI.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/build");
|
coojaBuild = new File(Cooja.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/build");
|
||||||
coojaJAR = new File(GUI.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/dist/cooja.jar");
|
coojaJAR = new File(Cooja.getExternalToolsSetting("PATH_CONTIKI"), "tools/cooja/dist/cooja.jar");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!coojaJAR.exists()) {
|
if (!coojaJAR.exists()) {
|
||||||
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
JOptionPane.showMessageDialog(Cooja.getTopParentContainer(),
|
||||||
"Can't start Cooja, cooja.jar not found:" +
|
"Can't start Cooja, cooja.jar not found:" +
|
||||||
"\n" + coojaJAR.getAbsolutePath()
|
"\n" + coojaJAR.getAbsolutePath()
|
||||||
+ "\n\nVerify that PATH_CONTIKI is correct in external tools settings.",
|
+ "\n\nVerify that PATH_CONTIKI is correct in external tools settings.",
|
||||||
|
@ -480,7 +480,7 @@ public class ScriptRunner extends VisPlugin {
|
||||||
/* User confirmation */
|
/* User confirmation */
|
||||||
String s1 = "Start";
|
String s1 = "Start";
|
||||||
String s2 = "Cancel";
|
String s2 = "Cancel";
|
||||||
int n = JOptionPane.showOptionDialog(GUI.getTopParentContainer(),
|
int n = JOptionPane.showOptionDialog(Cooja.getTopParentContainer(),
|
||||||
"Starting Cooja in " + coojaBuild.getPath() + ":\n" +
|
"Starting Cooja in " + coojaBuild.getPath() + ":\n" +
|
||||||
" " + command[0] + " " + command[1] + " " + command[2] + " " + command[3] + "\n",
|
" " + command[0] + " " + command[1] + " " + command[2] + " " + command[3] + "\n",
|
||||||
"Starting Cooja without GUI", JOptionPane.YES_NO_OPTION,
|
"Starting Cooja without GUI", JOptionPane.YES_NO_OPTION,
|
||||||
|
@ -655,7 +655,7 @@ public class ScriptRunner extends VisPlugin {
|
||||||
setLinkFile(file);
|
setLinkFile(file);
|
||||||
} else if ("active".equals(name)) {
|
} else if ("active".equals(name)) {
|
||||||
boolean active = Boolean.parseBoolean(element.getText());
|
boolean active = Boolean.parseBoolean(element.getText());
|
||||||
if (GUI.isVisualized()) {
|
if (Cooja.isVisualized()) {
|
||||||
try {
|
try {
|
||||||
setScriptActive(active);
|
setScriptActive(active);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -665,7 +665,7 @@ public class ScriptRunner extends VisPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GUI.isVisualized()) {
|
if (!Cooja.isVisualized()) {
|
||||||
/* Automatically activate script */
|
/* Automatically activate script */
|
||||||
try {
|
try {
|
||||||
setScriptActive(true);
|
setScriptActive(true);
|
||||||
|
@ -699,7 +699,7 @@ public class ScriptRunner extends VisPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
JFileChooser fileChooser = new JFileChooser();
|
JFileChooser fileChooser = new JFileChooser();
|
||||||
String suggest = GUI.getExternalToolsSetting("SCRIPTRUNNER_LAST_SCRIPTFILE", null);
|
String suggest = Cooja.getExternalToolsSetting("SCRIPTRUNNER_LAST_SCRIPTFILE", null);
|
||||||
if (suggest != null) {
|
if (suggest != null) {
|
||||||
fileChooser.setSelectedFile(new File(suggest));
|
fileChooser.setSelectedFile(new File(suggest));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -52,7 +52,7 @@ import javax.swing.SwingUtilities;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.HasQuickHelp;
|
import se.sics.cooja.HasQuickHelp;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
|
@ -83,7 +83,7 @@ public class SimControl extends VisPlugin implements HasQuickHelp {
|
||||||
*
|
*
|
||||||
* @param simulation Simulation to control
|
* @param simulation Simulation to control
|
||||||
*/
|
*/
|
||||||
public SimControl(Simulation simulation, GUI gui) {
|
public SimControl(Simulation simulation, Cooja gui) {
|
||||||
super("Simulation control", gui);
|
super("Simulation control", gui);
|
||||||
this.simulation = simulation;
|
this.simulation = simulation;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class SimInformation extends VisPlugin {
|
||||||
*
|
*
|
||||||
* @param simulationToView Simulation to view
|
* @param simulationToView Simulation to view
|
||||||
*/
|
*/
|
||||||
public SimInformation(Simulation simulationToView, GUI gui) {
|
public SimInformation(Simulation simulationToView, Cooja gui) {
|
||||||
super("Simulation Information", gui);
|
super("Simulation Information", gui);
|
||||||
|
|
||||||
simulation = simulationToView;
|
simulation = simulationToView;
|
||||||
|
@ -180,7 +180,7 @@ public class SimInformation extends VisPlugin {
|
||||||
smallPane.add(Box.createHorizontalGlue());
|
smallPane.add(Box.createHorizontalGlue());
|
||||||
|
|
||||||
Class<? extends RadioMedium> radioMediumClass = simulation.getRadioMedium().getClass();
|
Class<? extends RadioMedium> radioMediumClass = simulation.getRadioMedium().getClass();
|
||||||
String description = GUI.getDescriptionOf(radioMediumClass);
|
String description = Cooja.getDescriptionOf(radioMediumClass);
|
||||||
label = new JLabel(description);
|
label = new JLabel(description);
|
||||||
|
|
||||||
smallPane.add(label);
|
smallPane.add(label);
|
||||||
|
|
|
@ -81,7 +81,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.HasQuickHelp;
|
import se.sics.cooja.HasQuickHelp;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.Plugin;
|
import se.sics.cooja.Plugin;
|
||||||
|
@ -167,7 +167,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
* @param simulation Simulation
|
* @param simulation Simulation
|
||||||
* @param gui GUI
|
* @param gui GUI
|
||||||
*/
|
*/
|
||||||
public TimeLine(final Simulation simulation, final GUI gui) {
|
public TimeLine(final Simulation simulation, final Cooja gui) {
|
||||||
super("Timeline", gui);
|
super("Timeline", gui);
|
||||||
this.simulation = simulation;
|
this.simulation = simulation;
|
||||||
|
|
||||||
|
@ -257,9 +257,9 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
LogListener.class.getName());
|
LogListener.class.getName());
|
||||||
if (showLogOutputs) {
|
if (showLogOutputs) {
|
||||||
if (logEventFilterPlugin != null) {
|
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 {
|
} 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"};
|
String options[] = new String[] {"Cancel", "Show"};
|
||||||
optionPane.setOptions(options);
|
optionPane.setOptions(options);
|
||||||
optionPane.setInitialValue(options[1]);
|
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);
|
dialog.setVisible(true);
|
||||||
|
|
||||||
if (optionPane.getValue() == null || !optionPane.getValue().equals("Show")) {
|
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;
|
private static final long serialVersionUID = 975176793514425718L;
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JFileChooser fc = new JFileChooser();
|
JFileChooser fc = new JFileChooser();
|
||||||
int returnVal = fc.showSaveDialog(GUI.getTopParentContainer());
|
int returnVal = fc.showSaveDialog(Cooja.getTopParentContainer());
|
||||||
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
if (returnVal != JFileChooser.APPROVE_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -663,7 +663,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
String s2 = "Cancel";
|
String s2 = "Cancel";
|
||||||
Object[] options = { s1, s2 };
|
Object[] options = { s1, s2 };
|
||||||
int n = JOptionPane.showOptionDialog(
|
int n = JOptionPane.showOptionDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"A file with the same name already exists.\nDo you want to remove it?",
|
"A file with the same name already exists.\nDo you want to remove it?",
|
||||||
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
"Overwrite existing file?", JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE, null, options, s1);
|
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;
|
private static final long serialVersionUID = 7690116136861949864L;
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (popupLocation == null) {
|
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;
|
private static final long serialVersionUID = -8626118368774023257L;
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (popupLocation == null) {
|
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;
|
private static final long serialVersionUID = -2458733078524773995L;
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
logListenerAction.actionPerformed(null);
|
logListenerAction.actionPerformed(null);
|
||||||
|
@ -2474,7 +2474,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
"<p><b>LEDs</b>" +
|
"<p><b>LEDs</b>" +
|
||||||
"<br>Shows LED state: red, green, and blue. (Assumes all mote types have exactly three LEDs.)" +
|
"<br>Shows LED state: red, green, and blue. (Assumes all mote types have exactly three LEDs.)" +
|
||||||
"<p><b>Log outputs</b>" +
|
"<p><b>Log outputs</b>" +
|
||||||
"<br>Shows log outputs, as also shown in " + GUI.getDescriptionOf(LogListener.class) +
|
"<br>Shows log outputs, as also shown in " + Cooja.getDescriptionOf(LogListener.class) +
|
||||||
"<p><b>Watchpoints</b>" +
|
"<p><b>Watchpoints</b>" +
|
||||||
"<br>Shows triggered watchpoints, currently only supported by emulated motes. To add watchpoints, use the Msp Code Watcher plugin.";
|
"<br>Shows triggered watchpoints, currently only supported by emulated motes. To add watchpoints, use the Msp Code Watcher plugin.";
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.AddressMemory;
|
import se.sics.cooja.AddressMemory;
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MotePlugin;
|
import se.sics.cooja.MotePlugin;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
|
@ -121,7 +121,7 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
|
||||||
* @param simulation Simulation
|
* @param simulation Simulation
|
||||||
* @param gui GUI
|
* @param gui GUI
|
||||||
*/
|
*/
|
||||||
public VariableWatcher(Mote moteToView, Simulation simulation, GUI gui) {
|
public VariableWatcher(Mote moteToView, Simulation simulation, Cooja gui) {
|
||||||
super("Variable Watcher (" + moteToView + ")", gui);
|
super("Variable Watcher (" + moteToView + ")", gui);
|
||||||
this.mote = moteToView;
|
this.mote = moteToView;
|
||||||
moteMemory = (AddressMemory) moteToView.getMemory();
|
moteMemory = (AddressMemory) moteToView.getMemory();
|
||||||
|
|
|
@ -88,8 +88,8 @@ import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.ClassDescription;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.GUI.MoteRelation;
|
import se.sics.cooja.Cooja.MoteRelation;
|
||||||
import se.sics.cooja.HasQuickHelp;
|
import se.sics.cooja.HasQuickHelp;
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
import se.sics.cooja.MoteInterface;
|
import se.sics.cooja.MoteInterface;
|
||||||
|
@ -136,7 +136,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
public static final int MOTE_RADIUS = 8;
|
public static final int MOTE_RADIUS = 8;
|
||||||
private static final Color[] DEFAULT_MOTE_COLORS = { Color.WHITE };
|
private static final Color[] DEFAULT_MOTE_COLORS = { Color.WHITE };
|
||||||
|
|
||||||
private GUI gui = null;
|
private Cooja gui = null;
|
||||||
private Simulation simulation = null;
|
private Simulation simulation = null;
|
||||||
private final JPanel canvas;
|
private final JPanel canvas;
|
||||||
private boolean loadedConfig = false;
|
private boolean loadedConfig = false;
|
||||||
|
@ -205,7 +205,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
private ArrayList<Class<? extends MoteMenuAction>> moteMenuActions =
|
private ArrayList<Class<? extends MoteMenuAction>> moteMenuActions =
|
||||||
new ArrayList<Class<? extends MoteMenuAction>>();
|
new ArrayList<Class<? extends MoteMenuAction>>();
|
||||||
|
|
||||||
public Visualizer(Simulation simulation, GUI gui) {
|
public Visualizer(Simulation simulation, Cooja gui) {
|
||||||
super("Network", gui);
|
super("Network", gui);
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
this.simulation = simulation;
|
this.simulation = simulation;
|
||||||
|
@ -566,7 +566,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Activate default skins */
|
/* Activate default skins */
|
||||||
String[] defaultSkins = GUI.getExternalToolsSetting("VISUALIZER_DEFAULT_SKINS", "").split(";");
|
String[] defaultSkins = Cooja.getExternalToolsSetting("VISUALIZER_DEFAULT_SKINS", "").split(";");
|
||||||
for (String skin: defaultSkins) {
|
for (String skin: defaultSkins) {
|
||||||
if (skin.isEmpty()) {
|
if (skin.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -726,7 +726,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String description = GUI.getDescriptionOf(skinClass);
|
String description = Cooja.getDescriptionOf(skinClass);
|
||||||
JCheckBoxMenuItem item = new JCheckBoxMenuItem(description, false);
|
JCheckBoxMenuItem item = new JCheckBoxMenuItem(description, false);
|
||||||
item.putClientProperty("skinclass", skinClass);
|
item.putClientProperty("skinclass", skinClass);
|
||||||
|
|
||||||
|
@ -1335,7 +1335,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
for (Class<? extends VisualizerSkin> skinClass: visualizerSkins) {
|
for (Class<? extends VisualizerSkin> skinClass: visualizerSkins) {
|
||||||
if (wanted.equals(skinClass.getName())
|
if (wanted.equals(skinClass.getName())
|
||||||
/* Backwards compatibility */
|
/* Backwards compatibility */
|
||||||
|| wanted.equals(GUI.getDescriptionOf(skinClass))) {
|
|| wanted.equals(Cooja.getDescriptionOf(skinClass))) {
|
||||||
final Class<? extends VisualizerSkin> skin = skinClass;
|
final Class<? extends VisualizerSkin> skin = skinClass;
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -1384,7 +1384,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
}
|
}
|
||||||
sb.append(skin.getClass().getName());
|
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) */
|
/* Extract description (input to plugin) */
|
||||||
String desc = GUI.getDescriptionOf(mote.getInterfaces().getLED());
|
String desc = Cooja.getDescriptionOf(mote.getInterfaces().getLED());
|
||||||
|
|
||||||
MoteInterfaceViewer viewer =
|
MoteInterfaceViewer viewer =
|
||||||
(MoteInterfaceViewer) simulation.getGUI().tryStartPlugin(
|
(MoteInterfaceViewer) simulation.getGUI().tryStartPlugin(
|
||||||
|
@ -1471,7 +1471,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract description (input to plugin) */
|
/* Extract description (input to plugin) */
|
||||||
String desc = GUI.getDescriptionOf(serialPort);
|
String desc = Cooja.getDescriptionOf(serialPort);
|
||||||
|
|
||||||
MoteInterfaceViewer viewer =
|
MoteInterfaceViewer viewer =
|
||||||
(MoteInterfaceViewer) simulation.getGUI().tryStartPlugin(
|
(MoteInterfaceViewer) simulation.getGUI().tryStartPlugin(
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class ManualPositioner extends Positioner {
|
||||||
|
|
||||||
if (totalNumberOfMotes > 10) {
|
if (totalNumberOfMotes > 10) {
|
||||||
int value = JOptionPane.showConfirmDialog(
|
int value = JOptionPane.showConfirmDialog(
|
||||||
GUI.getTopParentContainer(),
|
Cooja.getTopParentContainer(),
|
||||||
"Do you really want to manually enter the positions of " + totalNumberOfMotes + " new motes ?\n",
|
"Do you really want to manually enter the positions of " + totalNumberOfMotes + " new motes ?\n",
|
||||||
"Manually enter mote positions?",
|
"Manually enter mote positions?",
|
||||||
JOptionPane.YES_NO_OPTION,
|
JOptionPane.YES_NO_OPTION,
|
||||||
|
@ -106,7 +106,7 @@ public class ManualPositioner extends Positioner {
|
||||||
dialog.xField.setValue(lastX);
|
dialog.xField.setValue(lastX);
|
||||||
dialog.yField.setValue(lastY);
|
dialog.yField.setValue(lastY);
|
||||||
dialog.zField.setValue(lastZ);
|
dialog.zField.setValue(lastZ);
|
||||||
dialog.setLocationRelativeTo(GUI.getTopParentContainer());
|
dialog.setLocationRelativeTo(Cooja.getTopParentContainer());
|
||||||
dialog.pack();
|
dialog.pack();
|
||||||
dialog.setModal(true);
|
dialog.setModal(true);
|
||||||
dialog.setResizable(false);
|
dialog.setResizable(false);
|
||||||
|
|
|
@ -48,7 +48,7 @@ import org.jdom.input.SAXBuilder;
|
||||||
import org.jdom.output.Format;
|
import org.jdom.output.Format;
|
||||||
import org.jdom.output.XMLOutputter;
|
import org.jdom.output.XMLOutputter;
|
||||||
|
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.Cooja;
|
||||||
import se.sics.cooja.MoteType;
|
import se.sics.cooja.MoteType;
|
||||||
import se.sics.cooja.Plugin;
|
import se.sics.cooja.Plugin;
|
||||||
import se.sics.cooja.ProjectConfig;
|
import se.sics.cooja.ProjectConfig;
|
||||||
|
@ -67,10 +67,10 @@ public class ExecuteJAR {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
if ((new File(GUI.LOG_CONFIG_FILE)).exists()) {
|
if ((new File(Cooja.LOG_CONFIG_FILE)).exists()) {
|
||||||
DOMConfigurator.configure(GUI.LOG_CONFIG_FILE);
|
DOMConfigurator.configure(Cooja.LOG_CONFIG_FILE);
|
||||||
} else {
|
} else {
|
||||||
DOMConfigurator.configure(GUI.class.getResource("/" + GUI.LOG_CONFIG_FILE));
|
DOMConfigurator.configure(Cooja.class.getResource("/" + Cooja.LOG_CONFIG_FILE));
|
||||||
}
|
}
|
||||||
} catch (AccessControlException e) {
|
} catch (AccessControlException e) {
|
||||||
BasicConfigurator.configure();
|
BasicConfigurator.configure();
|
||||||
|
@ -99,10 +99,10 @@ public class ExecuteJAR {
|
||||||
|
|
||||||
/* Load simulation */
|
/* Load simulation */
|
||||||
logger.info("Loading " + config);
|
logger.info("Loading " + config);
|
||||||
GUI.externalToolsUserSettingsFile = new File(
|
Cooja.externalToolsUserSettingsFile = new File(
|
||||||
System.getProperty("user.home"),
|
System.getProperty("user.home"),
|
||||||
GUI.EXTERNAL_TOOLS_USER_SETTINGS_FILENAME);
|
Cooja.EXTERNAL_TOOLS_USER_SETTINGS_FILENAME);
|
||||||
Simulation s = GUI.quickStartSimulationConfig(config, false, null);
|
Simulation s = Cooja.quickStartSimulationConfig(config, false, null);
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"Error when creating simulation"
|
"Error when creating simulation"
|
||||||
|
@ -142,7 +142,7 @@ public class ExecuteJAR {
|
||||||
File diskFile = new File(executeDir, SIMCONFIG_FILENAME);
|
File diskFile = new File(executeDir, SIMCONFIG_FILENAME);
|
||||||
if (OVERWRITE || !diskFile.exists()) {
|
if (OVERWRITE || !diskFile.exists()) {
|
||||||
logger.info("Unpacking simulation config: " + SIMCONFIG_FILENAME + " -> " + diskFile.getName());
|
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);
|
byte[] fileData = ArrayUtils.readFromStream(inputStream);
|
||||||
if (fileData == null) {
|
if (fileData == null) {
|
||||||
logger.info("Failed extracting file (read fail)");
|
logger.info("Failed extracting file (read fail)");
|
||||||
|
@ -160,7 +160,7 @@ public class ExecuteJAR {
|
||||||
diskFile = new File(executeDir, EXTERNALTOOLS_FILENAME);
|
diskFile = new File(executeDir, EXTERNALTOOLS_FILENAME);
|
||||||
if (OVERWRITE || !diskFile.exists()) {
|
if (OVERWRITE || !diskFile.exists()) {
|
||||||
logger.info("Unpacking external tools config: " + EXTERNALTOOLS_FILENAME + " -> " + diskFile.getName());
|
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);
|
byte[] fileData = ArrayUtils.readFromStream(inputStream);
|
||||||
if (fileData == null) {
|
if (fileData == null) {
|
||||||
logger.info("Failed extracting file (read fail)");
|
logger.info("Failed extracting file (read fail)");
|
||||||
|
@ -174,7 +174,7 @@ public class ExecuteJAR {
|
||||||
} else {
|
} else {
|
||||||
logger.info("Skip: external tools config already exists: " + diskFile);
|
logger.info("Skip: external tools config already exists: " + diskFile);
|
||||||
}
|
}
|
||||||
GUI.externalToolsUserSettingsFile = diskFile;
|
Cooja.externalToolsUserSettingsFile = diskFile;
|
||||||
|
|
||||||
/* Unpack files from JAR (with attribute EXPORT=copy) */
|
/* Unpack files from JAR (with attribute EXPORT=copy) */
|
||||||
SAXBuilder builder = new SAXBuilder();
|
SAXBuilder builder = new SAXBuilder();
|
||||||
|
@ -186,8 +186,8 @@ public class ExecuteJAR {
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Starting simulation");
|
logger.info("Starting simulation");
|
||||||
GUI.setLookAndFeel();
|
Cooja.setLookAndFeel();
|
||||||
GUI.quickStartSimulationConfig(new File(executeDir, SIMCONFIG_FILENAME), false, null);
|
Cooja.quickStartSimulationConfig(new File(executeDir, SIMCONFIG_FILENAME), false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,7 +196,7 @@ public class ExecuteJAR {
|
||||||
* @param gui GUI. Must contain simulation
|
* @param gui GUI. Must contain simulation
|
||||||
* @param outputFile Output file
|
* @param outputFile Output file
|
||||||
*/
|
*/
|
||||||
public static boolean buildExecutableJAR(GUI gui, File outputFile) {
|
public static boolean buildExecutableJAR(Cooja gui, File outputFile) {
|
||||||
String executeDir = null;
|
String executeDir = null;
|
||||||
executeDir = outputFile.getName();
|
executeDir = outputFile.getName();
|
||||||
if (!executeDir.endsWith(".jar")) {
|
if (!executeDir.endsWith(".jar")) {
|
||||||
|
@ -215,11 +215,11 @@ public class ExecuteJAR {
|
||||||
for (MoteType t: simulation.getMoteTypes()) {
|
for (MoteType t: simulation.getMoteTypes()) {
|
||||||
if (!t.getClass().getName().contains("SkyMoteType")) {
|
if (!t.getClass().getName().contains("SkyMoteType")) {
|
||||||
throw new RuntimeException(
|
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"
|
"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 */
|
/* Check dependencies: Contiki Test Editor */
|
||||||
|
@ -253,10 +253,10 @@ public class ExecuteJAR {
|
||||||
|
|
||||||
/* Unpacking project JARs */
|
/* Unpacking project JARs */
|
||||||
ProjectConfig config = gui.getProjectConfig();
|
ProjectConfig config = gui.getProjectConfig();
|
||||||
String[] projectJARs = config.getStringArrayValue(GUI.class.getName() + ".JARFILES");
|
String[] projectJARs = config.getStringArrayValue(Cooja.class.getName() + ".JARFILES");
|
||||||
for (String jar: projectJARs) {
|
for (String jar: projectJARs) {
|
||||||
/* Locate project */
|
/* Locate project */
|
||||||
File project = config.getUserProjectDefining(GUI.class, "JARFILES", jar);
|
File project = config.getUserProjectDefining(Cooja.class, "JARFILES", jar);
|
||||||
File jarFile = new File(project, jar);
|
File jarFile = new File(project, jar);
|
||||||
if (!jarFile.exists()) {
|
if (!jarFile.exists()) {
|
||||||
jarFile = new File(project, "lib/" + jar);
|
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"
|
"tools/cooja/lib/jdom.jar", "tools/cooja/lib/log4j.jar", "tools/cooja/dist/cooja.jar"
|
||||||
};
|
};
|
||||||
for (String jar: coreJARs) {
|
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()) {
|
if (!jarFile.exists()) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"Project JAR could not be found: " + jarFile.getAbsolutePath()
|
"Project JAR could not be found: " + jarFile.getAbsolutePath()
|
||||||
|
@ -334,11 +334,11 @@ public class ExecuteJAR {
|
||||||
File externalToolsConfig = new File(workingDir, EXTERNALTOOLS_FILENAME);
|
File externalToolsConfig = new File(workingDir, EXTERNALTOOLS_FILENAME);
|
||||||
FileOutputStream out = new FileOutputStream(externalToolsConfig);
|
FileOutputStream out = new FileOutputStream(externalToolsConfig);
|
||||||
Properties differingSettings = new Properties();
|
Properties differingSettings = new Properties();
|
||||||
Enumeration<Object> keyEnum = GUI.currentExternalToolsSettings.keys();
|
Enumeration<Object> keyEnum = Cooja.currentExternalToolsSettings.keys();
|
||||||
while (keyEnum.hasMoreElements()) {
|
while (keyEnum.hasMoreElements()) {
|
||||||
String key = (String) keyEnum.nextElement();
|
String key = (String) keyEnum.nextElement();
|
||||||
String defaultSetting = GUI.getExternalToolsDefaultSetting(key, "");
|
String defaultSetting = Cooja.getExternalToolsDefaultSetting(key, "");
|
||||||
String currentSetting = GUI.currentExternalToolsSettings.getProperty(key, "");
|
String currentSetting = Cooja.currentExternalToolsSettings.getProperty(key, "");
|
||||||
|
|
||||||
if (key.equals("DEFAULT_PROJECTDIRS")) {
|
if (key.equals("DEFAULT_PROJECTDIRS")) {
|
||||||
differingSettings.setProperty(key, "");
|
differingSettings.setProperty(key, "");
|
||||||
|
@ -442,7 +442,7 @@ public class ExecuteJAR {
|
||||||
return true;
|
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:
|
/* Checks configuration for EXPORT attributes:
|
||||||
* copy: file copy file to exported JAR, update file path.
|
* copy: file copy file to exported JAR, update file path.
|
||||||
* discard: remove config element */
|
* discard: remove config element */
|
||||||
|
@ -489,8 +489,8 @@ public class ExecuteJAR {
|
||||||
Attribute a = c.getAttribute("EXPORT");
|
Attribute a = c.getAttribute("EXPORT");
|
||||||
if (a != null && a.getValue().equals("copy")) {
|
if (a != null && a.getValue().equals("copy")) {
|
||||||
/* Copy file from JAR */
|
/* Copy file from JAR */
|
||||||
File file = GUI.restoreConfigRelativePath(config, new File(c.getText()));
|
File file = Cooja.restoreConfigRelativePath(config, new File(c.getText()));
|
||||||
InputStream inputStream = GUI.class.getResourceAsStream("/" + file.getName());
|
InputStream inputStream = Cooja.class.getResourceAsStream("/" + file.getName());
|
||||||
if (inputStream == null) {
|
if (inputStream == null) {
|
||||||
throw new RuntimeException("Could not unpack file: " + file);
|
throw new RuntimeException("Could not unpack file: " + file);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue