General cleanup and fixes of texts and labels

This commit is contained in:
Adam Dunkels 2012-05-31 18:04:40 +02:00
parent cb00219096
commit 34c2cef205
15 changed files with 105 additions and 87 deletions

View File

@ -1052,7 +1052,7 @@ public class Simulation extends Observable implements Runnable {
// Change current radio medium to new one // Change current radio medium to new one
if (radioMedium == null) { if (radioMedium == null) {
logger.fatal("Radio medium could not be created!"); logger.fatal("Radio medium could not be created.");
return; return;
} }
this.currentRadioMedium = radioMedium; this.currentRadioMedium = radioMedium;

View File

@ -72,14 +72,14 @@ import se.sics.cooja.dialogs.MessageList.MessageContainer;
import se.sics.cooja.util.StringUtils; import se.sics.cooja.util.StringUtils;
/** /**
* The Contiki mote type holds the native library used to communicate with an * The Cooja mote type holds the native library used to communicate with an
* underlying Contiki system. All communication with that system should always * underlying Contiki system. All communication with that system should always
* pass through this mote type. * pass through this mote type.
* <p> * <p>
* This type also contains information about sensors and mote interfaces a mote * This type also contains information about sensors and mote interfaces a mote
* of this type has. * of this type has.
* <p> * <p>
* All core communication with the Contiki mote should be via this class. When a * All core communication with the Cooja mote should be via this class. When a
* mote type is created it allocates a CoreComm to be used with this type, and * mote type is created it allocates a CoreComm to be used with this type, and
* loads the variable and segments addresses. * loads the variable and segments addresses.
* <p> * <p>
@ -90,7 +90,7 @@ import se.sics.cooja.util.StringUtils;
* *
* @author Fredrik Osterlind * @author Fredrik Osterlind
*/ */
@ClassDescription("Contiki Mote Type") @ClassDescription("Cooja Mote Type")
@AbstractionLevelDescription("OS level") @AbstractionLevelDescription("OS level")
public class ContikiMoteType implements MoteType { public class ContikiMoteType implements MoteType {
private static Logger logger = Logger.getLogger(ContikiMoteType.class); private static Logger logger = Logger.getLogger(ContikiMoteType.class);
@ -199,7 +199,7 @@ public class ContikiMoteType implements MoteType {
private SectionMoteMemory initialMemory = null; private SectionMoteMemory initialMemory = null;
/** /**
* Creates a new uninitialized Contiki mote type. This mote type needs to load * Creates a new uninitialized Cooja mote type. This mote type needs to load
* a library file and parse a map file before it can be used. * a library file and parse a map file before it can be used.
*/ */
public ContikiMoteType() { public ContikiMoteType() {
@ -216,7 +216,7 @@ public class ContikiMoteType implements MoteType {
if (visAvailable) { if (visAvailable) {
if (getDescription() == null) { if (getDescription() == null) {
setDescription("Contiki Mote Type #" + (simulation.getMoteTypes().length+1)); setDescription("Cooja Mote Type #" + (simulation.getMoteTypes().length+1));
} }
/* Compile Contiki from dialog */ /* Compile Contiki from dialog */
@ -251,7 +251,7 @@ public class ContikiMoteType implements MoteType {
javaClassName = CoreComm.getAvailableClassName(); javaClassName = CoreComm.getAvailableClassName();
if (javaClassName == null) { if (javaClassName == null) {
throw new MoteTypeCreationException("Could not allocate a core communicator!"); throw new MoteTypeCreationException("Could not allocate a core communicator.");
} }
/* Delete output files */ /* Delete output files */
@ -425,7 +425,7 @@ public class ContikiMoteType implements MoteType {
/* Parse command output */ /* Parse command output */
if (mapFile == null || if (mapFile == null ||
!mapFile.exists()) { !mapFile.exists()) {
throw new MoteTypeCreationException("Map file " + mapFile + " could not be found!"); throw new MoteTypeCreationException("Map file " + mapFile + " could not be found");
} }
String[] mapData = loadMapFile(mapFile); String[] mapData = loadMapFile(mapFile);
if (mapData == null) { if (mapData == null) {
@ -512,7 +512,7 @@ public class ContikiMoteType implements MoteType {
offset = tmp.getIntValueOf("referenceVar"); offset = tmp.getIntValueOf("referenceVar");
logger.info(getContikiFirmwareFile().getName() + logger.info(getContikiFirmwareFile().getName() +
": offsetting Contiki mote address space: " + offset); ": offsetting Cooja mote address space: " + offset);
} }
/* Create initial memory: data+bss+optional common */ /* Create initial memory: data+bss+optional common */
@ -1138,7 +1138,7 @@ public class ContikiMoteType implements MoteType {
} }
/** /**
* Generates a unique Contiki mote type ID. * Generates a unique Cooja mote type ID.
* *
* @param existingTypes Already existing mote types, may be null * @param existingTypes Already existing mote types, may be null
* @param reservedIdentifiers Already reserved identifiers, may be null * @param reservedIdentifiers Already reserved identifiers, may be null
@ -1315,7 +1315,7 @@ public class ContikiMoteType implements MoteType {
} else if (name.equals("symbols")) { } else if (name.equals("symbols")) {
hasSystemSymbols = Boolean.parseBoolean(element.getText()); hasSystemSymbols = Boolean.parseBoolean(element.getText());
} else if (name.equals("commstack")) { } else if (name.equals("commstack")) {
logger.warn("COOJA's communication stack config was removed: " + element.getText()); logger.warn("The Cooja communication stack config was removed: " + element.getText());
logger.warn("Instead assuming default network stack."); logger.warn("Instead assuming default network stack.");
netStack = NetworkStack.DEFAULT; netStack = NetworkStack.DEFAULT;
} else if (name.equals("netstack")) { } else if (name.equals("netstack")) {
@ -1342,10 +1342,10 @@ public class ContikiMoteType implements MoteType {
name.equals("process") || name.equals("process") ||
name.equals("sensor") || name.equals("sensor") ||
name.equals("coreinterface")) { name.equals("coreinterface")) {
/* Backwards compatibility: old contiki mote type is being loaded */ /* Backwards compatibility: old cooja mote type is being loaded */
if (!warnedOldVersion) { if (!warnedOldVersion) {
warnedOldVersion = true; warnedOldVersion = true;
logger.warn("Old simulation config detected: contiki mote types may not load correctly"); logger.warn("Old simulation config detected: Cooja mote types may not load correctly");
} }
if (name.equals("compilefile")) { if (name.equals("compilefile")) {
@ -1368,7 +1368,7 @@ public class ContikiMoteType implements MoteType {
moteInterfacesClasses.toArray(arr); moteInterfacesClasses.toArray(arr);
setCoreInterfaces(ContikiMoteType.getRequiredCoreInterfaces(arr)); setCoreInterfaces(ContikiMoteType.getRequiredCoreInterfaces(arr));
/* Backwards compatibility: old contiki mote type is being loaded */ /* Backwards compatibility: old cooja mote type is being loaded */
if (getContikiSourceFile() == null && if (getContikiSourceFile() == null &&
warnedOldVersion && warnedOldVersion &&
oldVersionSource != null) oldVersionSource != null)

View File

@ -681,7 +681,7 @@ public abstract class AbstractCompileDialog extends JDialog {
private void addMoteInterfacesTab(JTabbedPane parent) { private void addMoteInterfacesTab(JTabbedPane parent) {
moteIntfBox = Box.createVerticalBox(); moteIntfBox = Box.createVerticalBox();
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
JLabel label = new JLabel("COOJA interacts with simulated motes via mote interfaces. You normally do not need to change these settings!"); JLabel label = new JLabel("Cooja interacts with simulated motes via mote interfaces. These settings normally do not need to be changed.");
Box b = Box.createHorizontalBox(); Box b = Box.createHorizontalBox();
b.add(new JButton(defaultAction)); b.add(new JButton(defaultAction));
b.add(label); b.add(label);

View File

@ -139,12 +139,12 @@ public class AddMoteDialog extends JDialog {
buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(Box.createHorizontalGlue());
button = new JButton("Cancel"); button = new JButton("Do not add motes");
button.setActionCommand("cancel"); button.setActionCommand("cancel");
button.addActionListener(myEventHandler); button.addActionListener(myEventHandler);
buttonPane.add(button); buttonPane.add(button);
button = new JButton("Create and Add"); button = new JButton("Add motes");
button.setActionCommand("add"); button.setActionCommand("add");
button.addActionListener(myEventHandler); button.addActionListener(myEventHandler);
this.getRootPane().setDefaultButton(button); this.getRootPane().setDefaultButton(button);
@ -554,9 +554,9 @@ public class AddMoteDialog extends JDialog {
newMotes = null; newMotes = null;
JOptionPane.showMessageDialog( JOptionPane.showMessageDialog(
AddMoteDialog.this, AddMoteDialog.this,
"Out of memory!\nException message: \"" + e2.getMessage() + "\"\n\n" + "Out of memory.\nException message: \"" + e2.getMessage() + "\"\n\n" +
"Reduce number of nodes or start COOJA with more memory (\">ant run_bigmem\").", "Reduce number of nodes or start Cooja with more memory (\">ant run_bigmem\").",
"Not enough heap memory!", JOptionPane.ERROR_MESSAGE "Not enough heap memory.", JOptionPane.ERROR_MESSAGE
); );
} }
} }

View File

@ -131,7 +131,7 @@ public class ConfigurationWizard extends JDialog {
private static final String OPTION_RUN_TEST = "Run test"; private static final String OPTION_RUN_TEST = "Run test";
private static final String OPTION_NEXT_TEST = "Next test"; private static final String OPTION_NEXT_TEST = "Next test";
private static final String OPTION_CLOSE_WIZARD = "Close Wizard"; private static final String OPTION_CLOSE_WIZARD = "Close wizard";
private static final String testTemplate = "test_template.c"; private static final String testTemplate = "test_template.c";
@ -189,14 +189,14 @@ public class ConfigurationWizard extends JDialog {
public static boolean showWizardInfo(Container parent, GUI gui) { public static boolean showWizardInfo(Container parent, GUI 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 simulating Contiki motes in COOJA.\n" + "This wizard configures and tests your toolchain for simulation of Cooja motes.\n" +
"Throughout the wizard, Contiki libraries are compiled and loaded while allowing you to \n" + "Throughout the wizard, Contiki libraries are compiled and loaded while allowing you to \n" +
"alter external tools settings such as compiler arguments.\n" + "alter external tools settings such as compiler arguments.\n" +
"\n" + "\n" +
"Changes made in this wizard are reflected in menu Settings, External tools paths.\n" + "Changes made in this wizard are reflected in menu Settings, External tools paths.\n" +
"\n" + "\n" +
"NOTE: You do not need to complete this wizard for emulating motes, such as Sky motes.\n", "NOTE: You do not need to complete this wizard for emulated motes, such as Sky motes.\n",
"Contiki mote configuration wizard", "Cooja mote configuration wizard",
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE,
null, options, options[0]); null, options, options[0]);
@ -213,7 +213,7 @@ public class ConfigurationWizard extends JDialog {
while (value.equals(OPTION_RUN_TEST)) { while (value.equals(OPTION_RUN_TEST)) {
value = showStepDialog( value = showStepDialog(
parent, parent,
"Generates, compiles and links a COOJA/Contiki stub.\n", "Generates, compiles and links a Cooja/Contiki stub.\n",
testDescription, testDescription,
new String[] { new String[] {
"COMPILER_ARGS", "LINK_COMMAND_1", "LINK_COMMAND_2", "AR_COMMAND_1", "AR_COMMAND_2" "COMPILER_ARGS", "LINK_COMMAND_1", "LINK_COMMAND_2", "AR_COMMAND_1", "AR_COMMAND_2"
@ -378,8 +378,8 @@ public class ConfigurationWizard extends JDialog {
while (value.equals(OPTION_RUN_TEST)) { while (value.equals(OPTION_RUN_TEST)) {
value = showStepDialog( value = showStepDialog(
parent, parent,
"Tests copying memory sections between Contiki and COOJA.\n" + "Tests copying memory sections between Contiki and Cooja.\n" +
"Variable values are both altered in Contiki and in COOJA.\n" + "Variable values are both altered in Contiki and in Cooja.\n" +
"\n" + "\n" +
"This is the final test!\n", "This is the final test!\n",
testDescription, testDescription,

View File

@ -152,7 +152,7 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
((ContikiMoteType)moteType).javaClassName = CoreComm.getAvailableClassName(); ((ContikiMoteType)moteType).javaClassName = CoreComm.getAvailableClassName();
if (((ContikiMoteType)moteType).javaClassName == null) { if (((ContikiMoteType)moteType).javaClassName == null) {
logger.fatal("Could not allocate a core communicator!"); logger.fatal("Could not allocate a core communicator.");
return ""; return "";
} }

View File

@ -209,7 +209,7 @@ public class CreateSimDialog extends JDialog {
horizBox = Box.createHorizontalBox(); horizBox = Box.createHorizontalBox();
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT)); horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT); horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
label = new JLabel("Simulation title"); label = new JLabel("Simulation name");
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT)); label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
textField = new JTextField(); textField = new JTextField();
@ -228,7 +228,7 @@ public class CreateSimDialog extends JDialog {
horizBox = Box.createHorizontalBox(); horizBox = Box.createHorizontalBox();
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT)); horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT); horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
label = new JLabel("Radio Medium"); label = new JLabel("Radio medium");
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT)); label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
Vector<String> radioMediumDescriptions = new Vector<String>(); Vector<String> radioMediumDescriptions = new Vector<String>();
@ -259,7 +259,7 @@ public class CreateSimDialog extends JDialog {
horizBox = Box.createHorizontalBox(); horizBox = Box.createHorizontalBox();
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT)); horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT); horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
label = new JLabel("Random startup (max, ms)"); label = new JLabel("Mote startup delay (ms)");
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT)); label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
numberField = new JFormattedTextField(integerFormat); numberField = new JFormattedTextField(integerFormat);
@ -279,7 +279,7 @@ public class CreateSimDialog extends JDialog {
horizBox = Box.createHorizontalBox(); horizBox = Box.createHorizontalBox();
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT)); horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT); horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
label = new JLabel("Main random seed"); label = new JLabel("Random seed");
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT)); label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
numberField = new JFormattedTextField(integerFormat); numberField = new JFormattedTextField(integerFormat);
@ -287,6 +287,19 @@ public class CreateSimDialog extends JDialog {
numberField.setColumns(4); numberField.setColumns(4);
randomSeed = numberField; randomSeed = numberField;
horizBox.add(label);
horizBox.add(Box.createHorizontalStrut(150));
horizBox.add(numberField);
horizBox.setToolTipText("Simulation random seed. Controls the random behavior such as mote startup delays, node positions etc.");
advancedBox.add(horizBox);
advancedBox.add(Box.createVerticalStrut(5));
horizBox = Box.createHorizontalBox();
horizBox.setMaximumSize(new Dimension(Integer.MAX_VALUE,LABEL_HEIGHT));
horizBox.setAlignmentX(Component.LEFT_ALIGNMENT);
label = new JLabel("New random seed on reload");
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
randomSeedGenerated = new JCheckBox(); randomSeedGenerated = new JCheckBox();
randomSeedGenerated.setToolTipText("Automatically generate random seed at simulation load"); randomSeedGenerated.setToolTipText("Automatically generate random seed at simulation load");
randomSeedGenerated.addActionListener(new ActionListener() { randomSeedGenerated.addActionListener(new ActionListener() {
@ -301,11 +314,10 @@ public class CreateSimDialog extends JDialog {
} }
}); });
horizBox.add(label); horizBox.add(label);
horizBox.add(Box.createHorizontalStrut(150)); horizBox.add(Box.createHorizontalStrut(116));
horizBox.add(numberField);
horizBox.add(randomSeedGenerated); horizBox.add(randomSeedGenerated);
horizBox.setToolTipText("Simulation random seed. Controls the random behavior such as mote startup delays, node positions etc.");
advancedBox.add(horizBox); advancedBox.add(horizBox);
advancedBox.add(Box.createVerticalStrut(5)); advancedBox.add(Box.createVerticalStrut(5));

View File

@ -89,7 +89,7 @@ import se.sics.cooja.GUI;
import se.sics.cooja.ProjectConfig; import se.sics.cooja.ProjectConfig;
/** /**
* This dialog allows a user to manage COOJA projects: extensions to COOJA that * This dialog allows a user to manage Cooja extensions: extensions to COOJA that
* provide new functionality such as radio mediums, plugins, and mote types. * provide new functionality such as radio mediums, plugins, and mote types.
* *
* @author Fredrik Osterlind * @author Fredrik Osterlind
@ -101,7 +101,7 @@ public class ProjectDirectoriesDialog extends JDialog {
private GUI gui; private GUI gui;
private JTable table = null; private JTable table = null;
private JTextArea projectInfo = new JTextArea("Project information:"); private JTextArea projectInfo = new JTextArea("Extension information:");
private DirectoryTreePanel treePanel = null; private DirectoryTreePanel treePanel = null;
private ArrayList<COOJAProject> currentProjects = new ArrayList<COOJAProject>(); private ArrayList<COOJAProject> currentProjects = new ArrayList<COOJAProject>();
@ -132,7 +132,7 @@ public class ProjectDirectoriesDialog extends JDialog {
super( super(
parent instanceof Dialog?(Dialog)parent: parent instanceof Dialog?(Dialog)parent:
parent instanceof Window?(Window)parent: parent instanceof Window?(Window)parent:
(Frame)parent, "COOJA projects", ModalityType.APPLICATION_MODAL); (Frame)parent, "Cooja extensions", ModalityType.APPLICATION_MODAL);
table = new JTable(new AbstractTableModel() { table = new JTable(new AbstractTableModel() {
private static final long serialVersionUID = 591599455927509191L; private static final long serialVersionUID = 591599455927509191L;
@ -189,7 +189,7 @@ public class ProjectDirectoriesDialog extends JDialog {
} }
}); });
/* Add current projects */ /* Add current extensions */
for (COOJAProject project : projects) { for (COOJAProject project : projects) {
addProjectDir(project); addProjectDir(project);
} }
@ -237,7 +237,18 @@ public class ProjectDirectoriesDialog extends JDialog {
buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
button = new JButton("Save as default"); button = new JButton("Apply for session");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ProjectDirectoriesDialog.this.returnedProjects = currentProjects.toArray(new COOJAProject[0]);
dispose();
}
});
buttonPane.add(button);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
button = new JButton("Save");
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Object[] options = { "Ok", "Cancel" }; Object[] options = { "Ok", "Cancel" };
@ -270,16 +281,6 @@ public class ProjectDirectoriesDialog extends JDialog {
}); });
buttonPane.add(button); buttonPane.add(button);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
button = new JButton("OK");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ProjectDirectoriesDialog.this.returnedProjects = currentProjects.toArray(new COOJAProject[0]);
dispose();
}
});
buttonPane.add(button);
this.getRootPane().setDefaultButton(button); this.getRootPane().setDefaultButton(button);
} }
@ -348,8 +349,8 @@ public class ProjectDirectoriesDialog extends JDialog {
String s2 = "Cancel"; String s2 = "Cancel";
Object[] options = { s1, s2 }; Object[] options = { s1, s2 };
int n = JOptionPane.showOptionDialog(GUI.getTopParentContainer(), int n = JOptionPane.showOptionDialog(GUI.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);
if (n != JOptionPane.YES_OPTION) { if (n != JOptionPane.YES_OPTION) {
return; return;
@ -386,8 +387,8 @@ public class ProjectDirectoriesDialog extends JDialog {
} }
JPanel topPanel = new JPanel(new BorderLayout()); JPanel topPanel = new JPanel(new BorderLayout());
topPanel.add(BorderLayout.CENTER, new JLabel(" A COOJA project depends on a cooja.config file, and extends COOJA with radio mediums, mote types, plugins etc.")); /* topPanel.add(BorderLayout.CENTER, new JLabel("A Cooja project depends on a cooja.config file, and extends Cooja with radio mediums, mote types, plugins etc."));
topPanel.setBackground(Color.WHITE); topPanel.setBackground(Color.WHITE);*/
getContentPane().add(BorderLayout.NORTH, topPanel); getContentPane().add(BorderLayout.NORTH, topPanel);
getContentPane().add(BorderLayout.CENTER, mainPane); getContentPane().add(BorderLayout.CENTER, mainPane);
getContentPane().add(BorderLayout.SOUTH, buttonPane); getContentPane().add(BorderLayout.SOUTH, buttonPane);
@ -410,9 +411,9 @@ public class ProjectDirectoriesDialog extends JDialog {
if (!project.configExists()) { if (!project.configExists()) {
return; return;
} }
projectInfo.append("Parsing: " +
(project.configRead()?"OK":"FAILED") + "\n\n");
if (!project.configRead()) { if (!project.configRead()) {
projectInfo.append("Parsing: " +
(project.configRead()?"OK":"FAILED") + "\n\n");
return; return;
} }
@ -425,9 +426,9 @@ public class ProjectDirectoriesDialog extends JDialog {
for (String jar: jars) { for (String jar: jars) {
File jarFile = GUI.findJarFile(project.dir, jar); File jarFile = GUI.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()) {
projectInfo.append("\tERROR: " + jarFile.getAbsolutePath() + " could not be found!\n"); projectInfo.append("\tError: " + jarFile.getAbsolutePath() + " could not be found.\n");
} else { } else {
projectInfo.append("\t" + jarFile.getAbsolutePath() + " found\n"); projectInfo.append("\t" + jarFile.getAbsolutePath() + " found\n");
} }
@ -440,10 +441,10 @@ public class ProjectDirectoriesDialog extends JDialog {
projectInfo.append("Radio mediums: " + Arrays.toString(project.getConfigRadioMediums()) + "\n"); projectInfo.append("Radio mediums: " + Arrays.toString(project.getConfigRadioMediums()) + "\n");
} }
if (project.getConfigMoteInterfaces() != null) { if (project.getConfigMoteInterfaces() != null) {
projectInfo.append("Contiki mote interfaces: " + Arrays.toString(project.getConfigMoteInterfaces()) + "\n"); projectInfo.append("Cooja mote interfaces: " + Arrays.toString(project.getConfigMoteInterfaces()) + "\n");
} }
if (project.getConfigCSources() != null) { if (project.getConfigCSources() != null) {
projectInfo.append("Contiki mote C sources: " + Arrays.toString(project.getConfigCSources()) + "\n"); projectInfo.append("Cooja mote C sources: " + Arrays.toString(project.getConfigCSources()) + "\n");
} }
} }

View File

@ -483,7 +483,7 @@ public class LogListener extends VisPlugin {
updateTitle(); updateTitle();
pack(); pack();
setSize(gui.getDesktopPane().getWidth(), 150); setSize(gui.getDesktopPane().getWidth(), 150);
setLocation(0, gui.getDesktopPane().getHeight() - 300); setLocation(0, gui.getDesktopPane().getHeight() - 310);
} }
public void registerNewLogOutput(Mote mote, long time, String msg) { public void registerNewLogOutput(Mote mote, long time, String msg) {
@ -515,8 +515,8 @@ public class LogListener extends VisPlugin {
} }
private void updateTitle() { private void updateTitle() {
setTitle("Log Listener (listening on " setTitle("Log Listener listening on "
+ simulation.getEventCentral().getLogOutputObservationsCount() + " log interfaces)"); + simulation.getEventCentral().getLogOutputObservationsCount() + " log interfaces");
} }
public void closePlugin() { public void closePlugin() {

View File

@ -404,7 +404,7 @@ public class LogScriptEngine {
new Thread() { new Thread() {
public void run() { public void run() {
try { Thread.sleep(2000); } catch (InterruptedException e) { } try { Thread.sleep(2000); } catch (InterruptedException e) { }
logger.warn("Killing COOJA"); logger.warn("Killing Cooja");
System.exit(1); System.exit(1);
}; };
}.start(); }.start();
@ -450,7 +450,7 @@ public class LogScriptEngine {
deactivateScript(); deactivateScript();
if (GUI.isVisualized()) { if (GUI.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);
} else { } else {

View File

@ -103,7 +103,7 @@ public class ScriptRunner extends VisPlugin {
"helloworld.js", "Wait for 'Hello, world'", "helloworld.js", "Wait for 'Hello, world'",
"log_all.js", "Just log all printf()'s and timeout", "log_all.js", "Just log all printf()'s and timeout",
"shell.js", "Basic shell interaction", "shell.js", "Basic shell interaction",
"plugins.js", "Interact with surrounding COOJA plugins", "plugins.js", "Interact with surrounding Cooja plugins",
}; };
private Simulation simulation; private Simulation simulation;
@ -442,7 +442,7 @@ public class ScriptRunner extends VisPlugin {
if (!coojaJAR.exists()) { if (!coojaJAR.exists()) {
JOptionPane.showMessageDialog(GUI.getTopParentContainer(), JOptionPane.showMessageDialog(GUI.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.",
"cooja.jar not found", JOptionPane.ERROR_MESSAGE); "cooja.jar not found", JOptionPane.ERROR_MESSAGE);
@ -463,9 +463,9 @@ public class ScriptRunner extends VisPlugin {
String s1 = "Start"; String s1 = "Start";
String s2 = "Cancel"; String s2 = "Cancel";
int n = JOptionPane.showOptionDialog(GUI.getTopParentContainer(), int n = JOptionPane.showOptionDialog(GUI.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,
JOptionPane.QUESTION_MESSAGE, null, new Object[] { s1, s2 }, s1); JOptionPane.QUESTION_MESSAGE, null, new Object[] { s1, s2 }, s1);
if (n != JOptionPane.YES_OPTION) { if (n != JOptionPane.YES_OPTION) {
return; return;
@ -540,10 +540,10 @@ public class ScriptRunner extends VisPlugin {
} }
} }
if (testSucceeded) { if (testSucceeded) {
progressDialog.setTitle("Test run completed. Test succeeded!"); progressDialog.setTitle("Test run completed. Test succeeded.");
button.setText("Test OK"); button.setText("Test OK");
} else { } else {
progressDialog.setTitle("Test run completed. Test failed!"); progressDialog.setTitle("Test run completed. Test failed.");
button.setText("Test failed"); button.setText("Test failed");
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {

View File

@ -102,6 +102,7 @@ public class SimControl extends VisPlugin {
smallPanel.add(startButton = new JButton(startAction)); smallPanel.add(startButton = new JButton(startAction));
smallPanel.add(stopButton = new JButton(stopAction)); smallPanel.add(stopButton = new JButton(stopAction));
smallPanel.add(new JButton(stepAction)); smallPanel.add(new JButton(stepAction));
smallPanel.add(new JButton(reloadAction));
smallPanel.setAlignmentX(Component.LEFT_ALIGNMENT); smallPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
controlPanel.add(smallPanel); controlPanel.add(smallPanel);
@ -371,9 +372,14 @@ public class SimControl extends VisPlugin {
startButton.requestFocus(); startButton.requestFocus();
} }
}; };
private Action stepAction = new AbstractAction("Step millisecond") { private Action stepAction = new AbstractAction("Step") {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
simulation.stepMillisecondSimulation(); simulation.stepMillisecondSimulation();
} }
}; };
private Action reloadAction = new AbstractAction("Reload") {
public void actionPerformed(ActionEvent e) {
simulation.getGUI().reloadCurrentSimulation(simulation.isRunning());
}
};
} }

View File

@ -69,6 +69,7 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSlider; import javax.swing.JSlider;
import javax.swing.JSplitPane; import javax.swing.JSplitPane;
import javax.swing.JToolTip; import javax.swing.JToolTip;
@ -161,13 +162,17 @@ public class TimeLine extends VisPlugin {
* @param gui GUI * @param gui GUI
*/ */
public TimeLine(final Simulation simulation, final GUI gui) { public TimeLine(final Simulation simulation, final GUI gui) {
super("Timeline (Add motes to observe by clicking +)", gui); super("Timeline", gui);
this.simulation = simulation; this.simulation = simulation;
currentPixelDivisor = ZOOM_LEVELS[ZOOM_LEVELS.length/2]; currentPixelDivisor = ZOOM_LEVELS[ZOOM_LEVELS.length/2];
/* Box: events to observe */ /* Box: events to observe */
eventCheckboxes = Box.createVerticalBox(); eventCheckboxes = Box.createVerticalBox();
eventCheckboxes.add(new JButton(addMoteAction));
eventCheckboxes.add(new JSeparator());
JCheckBox eventCheckBox; JCheckBox eventCheckBox;
eventCheckBox = createEventCheckbox("Radio RX/TX", "Show radio transmissions, receptions, and collisions"); eventCheckBox = createEventCheckbox("Radio RX/TX", "Show radio transmissions, receptions, and collisions");
eventCheckBox.setSelected(showRadioRXTX); eventCheckBox.setSelected(showRadioRXTX);
@ -237,15 +242,9 @@ public class TimeLine extends VisPlugin {
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
timelineScrollPane.getHorizontalScrollBar().setUnitIncrement(50); timelineScrollPane.getHorizontalScrollBar().setUnitIncrement(50);
JButton timelineAddMoteButton = new JButton(addMoteAction);
timelineAddMoteButton.setText("+");
timelineAddMoteButton.setToolTipText("Add mote");
timelineAddMoteButton.setBorderPainted(false);
timelineAddMoteButton.setFont(new Font("SansSerif", Font.PLAIN, 11));
timelineMoteRuler = new MoteRuler(); timelineMoteRuler = new MoteRuler();
timelineScrollPane.setRowHeaderView(timelineMoteRuler); timelineScrollPane.setRowHeaderView(timelineMoteRuler);
timelineScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, timelineAddMoteButton);
timelineScrollPane.setBackground(Color.WHITE); timelineScrollPane.setBackground(Color.WHITE);
splitPane = new JSplitPane( splitPane = new JSplitPane(
@ -265,8 +264,8 @@ public class TimeLine extends VisPlugin {
recalculateMoteHeight(); recalculateMoteHeight();
pack(); pack();
setSize(gui.getDesktopPane().getWidth(), 150); setSize(gui.getDesktopPane().getWidth(), 160);
setLocation(0, gui.getDesktopPane().getHeight() - 150); setLocation(0, gui.getDesktopPane().getHeight() - 160);
numberMotesWasUpdated(); numberMotesWasUpdated();
@ -913,9 +912,9 @@ public class TimeLine extends VisPlugin {
private void numberMotesWasUpdated() { private void numberMotesWasUpdated() {
/* Plugin title */ /* Plugin title */
if (allMoteEvents.isEmpty()) { if (allMoteEvents.isEmpty()) {
setTitle("Timeline (Add motes to observe by clicking +)"); setTitle("Timeline");
} else { } else {
setTitle("Timeline (" + allMoteEvents.size() + " motes)"); setTitle("Timeline showing " + allMoteEvents.size() + " motes");
} }
timelineMoteRuler.revalidate(); timelineMoteRuler.revalidate();
timelineMoteRuler.repaint(); timelineMoteRuler.repaint();

View File

@ -381,7 +381,7 @@ public class UDGM extends AbstractRadioMedium {
/* Backwards compatibility */ /* Backwards compatibility */
if (element.getName().equals("success_ratio")) { if (element.getName().equals("success_ratio")) {
SUCCESS_RATIO_TX = Double.parseDouble(element.getText()); SUCCESS_RATIO_TX = Double.parseDouble(element.getText());
logger.warn("Loading old COOJA Config, XML element \"sucess_ratio\" parsed at \"sucess_ratio_tx\""); logger.warn("Loading old Cooja Config, XML element \"sucess_ratio\" parsed at \"sucess_ratio_tx\"");
} }
if (element.getName().equals("success_ratio_tx")) { if (element.getName().equals("success_ratio_tx")) {

View File

@ -348,7 +348,7 @@ public class ExecuteJAR {
} }
} }
differingSettings.store(out, "COOJA External Tools (User specific)"); differingSettings.store(out, "Cooja External Tools (User specific)");
out.close(); out.close();
logger.info("Wrote external tools config: " + externalToolsConfig.getName()); logger.info("Wrote external tools config: " + externalToolsConfig.getName());
} catch (Exception e2) { } catch (Exception e2) {
@ -368,7 +368,7 @@ public class ExecuteJAR {
newConfig.setProperty(name, pConfig.getStringValue(name)); newConfig.setProperty(name, pConfig.getStringValue(name));
} }
FileOutputStream out = new FileOutputStream(newConfigFile); FileOutputStream out = new FileOutputStream(newConfigFile);
newConfig.store(out, "COOJA Project Config"); newConfig.store(out, "Cooja Project Config");
logger.info("Wrote project config: " + newConfigFile.getName()); logger.info("Wrote project config: " + newConfigFile.getName());
} catch (Exception e1) { } catch (Exception e1) {
e1.printStackTrace(); e1.printStackTrace();