reverted previous plugin name changes, instead build displayed names when menu is created
This commit is contained in:
parent
37c407b177
commit
8947c7a3bb
|
@ -37,6 +37,7 @@ import java.awt.Dimension;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
|
@ -44,8 +45,10 @@ import javax.swing.Icon;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
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.GUI;
|
||||||
|
@ -68,10 +71,10 @@ import se.sics.cooja.interfaces.Position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AVR-based MicaZ mote types emulated in Avrora.
|
* AVR-based MicaZ mote types emulated in Avrora.
|
||||||
*
|
*
|
||||||
* @author Joakim Eriksson, Fredrik Osterlind
|
* @author Joakim Eriksson, Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
@ClassDescription("MicaZ mote...")
|
@ClassDescription("MicaZ mote")
|
||||||
@AbstractionLevelDescription("Emulated level")
|
@AbstractionLevelDescription("Emulated level")
|
||||||
public class MicaZMoteType implements MoteType {
|
public class MicaZMoteType implements MoteType {
|
||||||
private static Logger logger = Logger.getLogger(MicaZMoteType.class);
|
private static Logger logger = Logger.getLogger(MicaZMoteType.class);
|
||||||
|
|
|
@ -31,13 +31,25 @@
|
||||||
|
|
||||||
package se.sics.cooja.mspmote;
|
package se.sics.cooja.mspmote;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Container;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.MediaTracker;
|
||||||
|
import java.awt.Toolkit;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import javax.swing.*;
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import se.sics.cooja.*;
|
|
||||||
|
import se.sics.cooja.AbstractionLevelDescription;
|
||||||
|
import se.sics.cooja.ClassDescription;
|
||||||
|
import se.sics.cooja.GUI;
|
||||||
|
import se.sics.cooja.MoteInterface;
|
||||||
|
import se.sics.cooja.MoteType;
|
||||||
|
import se.sics.cooja.Simulation;
|
||||||
import se.sics.cooja.dialogs.CompileContiki;
|
import se.sics.cooja.dialogs.CompileContiki;
|
||||||
import se.sics.cooja.dialogs.MessageList;
|
import se.sics.cooja.dialogs.MessageList;
|
||||||
import se.sics.cooja.dialogs.MessageList.MessageContainer;
|
import se.sics.cooja.dialogs.MessageList.MessageContainer;
|
||||||
|
@ -53,7 +65,7 @@ import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspSerial;
|
import se.sics.cooja.mspmote.interfaces.MspSerial;
|
||||||
import se.sics.cooja.mspmote.interfaces.TR1001Radio;
|
import se.sics.cooja.mspmote.interfaces.TR1001Radio;
|
||||||
|
|
||||||
@ClassDescription("ESB mote...")
|
@ClassDescription("ESB mote")
|
||||||
@AbstractionLevelDescription("Emulated level")
|
@AbstractionLevelDescription("Emulated level")
|
||||||
public class ESBMoteType extends MspMoteType {
|
public class ESBMoteType extends MspMoteType {
|
||||||
private static Logger logger = Logger.getLogger(ESBMoteType.class);
|
private static Logger logger = Logger.getLogger(ESBMoteType.class);
|
||||||
|
@ -209,7 +221,7 @@ public class ESBMoteType extends MspMoteType {
|
||||||
|
|
||||||
return new File(parentDir, sourceNoExtension + ".esb");
|
return new File(parentDir, sourceNoExtension + ".esb");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getTargetName() {
|
protected String getTargetName() {
|
||||||
return "esb";
|
return "esb";
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,13 +56,13 @@ import se.sics.cooja.interfaces.MoteAttributes;
|
||||||
import se.sics.cooja.interfaces.Position;
|
import se.sics.cooja.interfaces.Position;
|
||||||
import se.sics.cooja.interfaces.RimeAddress;
|
import se.sics.cooja.interfaces.RimeAddress;
|
||||||
import se.sics.cooja.mspmote.interfaces.Exp5438LED;
|
import se.sics.cooja.mspmote.interfaces.Exp5438LED;
|
||||||
|
import se.sics.cooja.mspmote.interfaces.Msp802154Radio;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspClock;
|
import se.sics.cooja.mspmote.interfaces.MspClock;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspDebugOutput;
|
import se.sics.cooja.mspmote.interfaces.MspDebugOutput;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
||||||
import se.sics.cooja.mspmote.interfaces.Msp802154Radio;
|
|
||||||
import se.sics.cooja.mspmote.interfaces.UsciA1Serial;
|
import se.sics.cooja.mspmote.interfaces.UsciA1Serial;
|
||||||
|
|
||||||
@ClassDescription("EXP430F5438 mote...")
|
@ClassDescription("EXP430F5438 mote")
|
||||||
@AbstractionLevelDescription("Emulated level")
|
@AbstractionLevelDescription("Emulated level")
|
||||||
public class Exp5438MoteType extends MspMoteType {
|
public class Exp5438MoteType extends MspMoteType {
|
||||||
private static Logger logger = Logger.getLogger(Exp5438MoteType.class);
|
private static Logger logger = Logger.getLogger(Exp5438MoteType.class);
|
||||||
|
@ -190,7 +190,7 @@ public class Exp5438MoteType extends MspMoteType {
|
||||||
MspMoteID.class,
|
MspMoteID.class,
|
||||||
Msp802154Radio.class,
|
Msp802154Radio.class,
|
||||||
UsciA1Serial.class,
|
UsciA1Serial.class,
|
||||||
Exp5438LED.class,
|
Exp5438LED.class,
|
||||||
/*Exp5438LCD.class,*/ /* TODO */
|
/*Exp5438LCD.class,*/ /* TODO */
|
||||||
MspDebugOutput.class
|
MspDebugOutput.class
|
||||||
};
|
};
|
||||||
|
@ -202,7 +202,7 @@ public class Exp5438MoteType extends MspMoteType {
|
||||||
|
|
||||||
return new File(parentDir, sourceNoExtension + ".exp5438");
|
return new File(parentDir, sourceNoExtension + ".exp5438");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getTargetName() {
|
protected String getTargetName() {
|
||||||
return "exp5438";
|
return "exp5438";
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,18 +58,18 @@ import se.sics.cooja.interfaces.Mote2MoteRelations;
|
||||||
import se.sics.cooja.interfaces.MoteAttributes;
|
import se.sics.cooja.interfaces.MoteAttributes;
|
||||||
import se.sics.cooja.interfaces.Position;
|
import se.sics.cooja.interfaces.Position;
|
||||||
import se.sics.cooja.interfaces.RimeAddress;
|
import se.sics.cooja.interfaces.RimeAddress;
|
||||||
|
import se.sics.cooja.mspmote.interfaces.Msp802154Radio;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspClock;
|
import se.sics.cooja.mspmote.interfaces.MspClock;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspDebugOutput;
|
import se.sics.cooja.mspmote.interfaces.MspDebugOutput;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
||||||
|
import se.sics.cooja.mspmote.interfaces.MspSerial;
|
||||||
import se.sics.cooja.mspmote.interfaces.SkyButton;
|
import se.sics.cooja.mspmote.interfaces.SkyButton;
|
||||||
import se.sics.cooja.mspmote.interfaces.Msp802154Radio;
|
|
||||||
import se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem;
|
import se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem;
|
||||||
import se.sics.cooja.mspmote.interfaces.SkyFlash;
|
import se.sics.cooja.mspmote.interfaces.SkyFlash;
|
||||||
import se.sics.cooja.mspmote.interfaces.SkyLED;
|
import se.sics.cooja.mspmote.interfaces.SkyLED;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspSerial;
|
|
||||||
import se.sics.cooja.mspmote.interfaces.SkyTemperature;
|
import se.sics.cooja.mspmote.interfaces.SkyTemperature;
|
||||||
|
|
||||||
@ClassDescription("Sky mote...")
|
@ClassDescription("Sky mote")
|
||||||
@AbstractionLevelDescription("Emulated level")
|
@AbstractionLevelDescription("Emulated level")
|
||||||
public class SkyMoteType extends MspMoteType {
|
public class SkyMoteType extends MspMoteType {
|
||||||
private static Logger logger = Logger.getLogger(SkyMoteType.class);
|
private static Logger logger = Logger.getLogger(SkyMoteType.class);
|
||||||
|
@ -229,7 +229,7 @@ public class SkyMoteType extends MspMoteType {
|
||||||
|
|
||||||
return new File(parentDir, sourceNoExtension + ".sky");
|
return new File(parentDir, sourceNoExtension + ".sky");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getTargetName() {
|
protected String getTargetName() {
|
||||||
return "sky";
|
return "sky";
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,14 +55,14 @@ import se.sics.cooja.interfaces.Mote2MoteRelations;
|
||||||
import se.sics.cooja.interfaces.MoteAttributes;
|
import se.sics.cooja.interfaces.MoteAttributes;
|
||||||
import se.sics.cooja.interfaces.Position;
|
import se.sics.cooja.interfaces.Position;
|
||||||
import se.sics.cooja.interfaces.RimeAddress;
|
import se.sics.cooja.interfaces.RimeAddress;
|
||||||
|
import se.sics.cooja.mspmote.interfaces.Msp802154Radio;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspClock;
|
import se.sics.cooja.mspmote.interfaces.MspClock;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspDebugOutput;
|
import se.sics.cooja.mspmote.interfaces.MspDebugOutput;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
||||||
import se.sics.cooja.mspmote.interfaces.Msp802154Radio;
|
|
||||||
import se.sics.cooja.mspmote.interfaces.TyndallLED;
|
import se.sics.cooja.mspmote.interfaces.TyndallLED;
|
||||||
import se.sics.cooja.mspmote.interfaces.UsciA0Serial;
|
import se.sics.cooja.mspmote.interfaces.UsciA0Serial;
|
||||||
|
|
||||||
@ClassDescription("Tyndall mote...")
|
@ClassDescription("Tyndall mote")
|
||||||
@AbstractionLevelDescription("Emulated level")
|
@AbstractionLevelDescription("Emulated level")
|
||||||
public class TyndallMoteType extends MspMoteType {
|
public class TyndallMoteType extends MspMoteType {
|
||||||
private static Logger logger = Logger.getLogger(TyndallMoteType.class);
|
private static Logger logger = Logger.getLogger(TyndallMoteType.class);
|
||||||
|
@ -201,7 +201,7 @@ public class TyndallMoteType extends MspMoteType {
|
||||||
|
|
||||||
return new File(parentDir, sourceNoExtension + ".tyndall");
|
return new File(parentDir, sourceNoExtension + ".tyndall");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getTargetName() {
|
protected String getTargetName() {
|
||||||
return "tyndall";
|
return "tyndall";
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ import se.sics.cooja.mspmote.interfaces.MspDefaultSerial;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspLED;
|
import se.sics.cooja.mspmote.interfaces.MspLED;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
||||||
|
|
||||||
@ClassDescription("Wismote mote...")
|
@ClassDescription("Wismote mote")
|
||||||
@AbstractionLevelDescription("Emulated level")
|
@AbstractionLevelDescription("Emulated level")
|
||||||
public class WismoteMoteType extends AbstractMspMoteType {
|
public class WismoteMoteType extends AbstractMspMoteType {
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ import se.sics.cooja.mspmote.interfaces.MspDefaultSerial;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspLED;
|
import se.sics.cooja.mspmote.interfaces.MspLED;
|
||||||
import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
import se.sics.cooja.mspmote.interfaces.MspMoteID;
|
||||||
|
|
||||||
@ClassDescription("Z1 mote...")
|
@ClassDescription("Z1 mote")
|
||||||
@AbstractionLevelDescription("Emulated level")
|
@AbstractionLevelDescription("Emulated level")
|
||||||
public class Z1MoteType extends AbstractMspMoteType {
|
public class Z1MoteType extends AbstractMspMoteType {
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ import se.sics.cooja.interfaces.Radio;
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind, Adam Dunkels
|
* @author Fredrik Osterlind, Adam Dunkels
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Mote radio duty cycle...")
|
@ClassDescription("Mote radio duty cycle")
|
||||||
@PluginType(PluginType.SIM_PLUGIN)
|
@PluginType(PluginType.SIM_PLUGIN)
|
||||||
public class PowerTracker extends VisPlugin {
|
public class PowerTracker extends VisPlugin {
|
||||||
private static Logger logger = Logger.getLogger(PowerTracker.class);
|
private static Logger logger = Logger.getLogger(PowerTracker.class);
|
||||||
|
|
|
@ -829,7 +829,7 @@ public class GUI extends Observable {
|
||||||
}
|
}
|
||||||
|
|
||||||
String description = GUI.getDescriptionOf(moteTypeClass);
|
String description = GUI.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);
|
||||||
/* menuItem.setToolTipText(abstractionLevelDescription);*/
|
/* menuItem.setToolTipText(abstractionLevelDescription);*/
|
||||||
|
|
|
@ -90,7 +90,7 @@ import se.sics.cooja.util.StringUtils;
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Cooja mote...")
|
@ClassDescription("Cooja mote")
|
||||||
@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);
|
||||||
|
|
|
@ -40,7 +40,9 @@ import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.jdom.Element;
|
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.Mote;
|
import se.sics.cooja.Mote;
|
||||||
|
@ -52,7 +54,7 @@ import se.sics.cooja.util.ArrayUtils;
|
||||||
/**
|
/**
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Import Java mote...")
|
@ClassDescription("Import Java mote")
|
||||||
@AbstractionLevelDescription("Application level")
|
@AbstractionLevelDescription("Application level")
|
||||||
public class ImportAppMoteType extends AbstractApplicationMoteType {
|
public class ImportAppMoteType extends AbstractApplicationMoteType {
|
||||||
|
|
||||||
|
@ -109,7 +111,7 @@ public class ImportAppMoteType extends AbstractApplicationMoteType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean configureAndInit(Container parentContainer,
|
public boolean configureAndInit(Container parentContainer,
|
||||||
Simulation simulation, boolean visAvailable)
|
Simulation simulation, boolean visAvailable)
|
||||||
throws MoteTypeCreationException {
|
throws MoteTypeCreationException {
|
||||||
this.simulation = simulation;
|
this.simulation = simulation;
|
||||||
|
|
||||||
|
@ -256,7 +258,7 @@ public class ImportAppMoteType extends AbstractApplicationMoteType {
|
||||||
public boolean isTestSubclass(Class<?> type) {
|
public boolean isTestSubclass(Class<?> type) {
|
||||||
return type.isAssignableFrom(testClass);
|
return type.isAssignableFrom(testClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<?> getTestClass() {
|
public Class<?> getTestClass() {
|
||||||
return testClass;
|
return testClass;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ import se.sics.cooja.util.StringUtils;
|
||||||
/**
|
/**
|
||||||
* @author Fredrik Osterlind, Niclas Finne
|
* @author Fredrik Osterlind, Niclas Finne
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Buffer view...")
|
@ClassDescription("Buffer view")
|
||||||
@PluginType(PluginType.SIM_PLUGIN)
|
@PluginType(PluginType.SIM_PLUGIN)
|
||||||
public class BufferListener extends VisPlugin {
|
public class BufferListener extends VisPlugin {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -132,7 +132,7 @@ public class BufferListener extends VisPlugin {
|
||||||
|
|
||||||
final static int MAX_BUFFER_SIZE = 128;
|
final static int MAX_BUFFER_SIZE = 128;
|
||||||
|
|
||||||
private static ArrayList<Class<? extends Parser>> bufferParsers =
|
private static ArrayList<Class<? extends Parser>> bufferParsers =
|
||||||
new ArrayList<Class<? extends Parser>>();
|
new ArrayList<Class<? extends Parser>>();
|
||||||
static {
|
static {
|
||||||
registerBufferParser(ByteArrayParser.class);
|
registerBufferParser(ByteArrayParser.class);
|
||||||
|
@ -148,7 +148,7 @@ public class BufferListener extends VisPlugin {
|
||||||
|
|
||||||
/* TODO Hide identical lines? */
|
/* TODO Hide identical lines? */
|
||||||
|
|
||||||
private static ArrayList<Class<? extends Buffer>> bufferTypes =
|
private static ArrayList<Class<? extends Buffer>> bufferTypes =
|
||||||
new ArrayList<Class<? extends Buffer>>();
|
new ArrayList<Class<? extends Buffer>>();
|
||||||
static {
|
static {
|
||||||
registerBufferType(PacketbufBuffer.class);
|
registerBufferType(PacketbufBuffer.class);
|
||||||
|
@ -787,7 +787,7 @@ public class BufferListener extends VisPlugin {
|
||||||
private void updateTitle() {
|
private void updateTitle() {
|
||||||
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:GUI.getDescriptionOf(buffer)) + " " +
|
||||||
"- " + memoryMonitors.size() + " buffers on " + motes.size() + " motes");
|
"- " + memoryMonitors.size() + " buffers on " + motes.size() + " motes");
|
||||||
}
|
}
|
||||||
|
@ -872,7 +872,7 @@ public class BufferListener extends VisPlugin {
|
||||||
repaintTimeColumn();
|
repaintTimeColumn();
|
||||||
} else if ("parser".equals(name)) {
|
} else if ("parser".equals(name)) {
|
||||||
String parserClassname = element.getText();
|
String parserClassname = element.getText();
|
||||||
Class<? extends Parser> parserClass =
|
Class<? extends Parser> parserClass =
|
||||||
simulation.getGUI().tryLoadClass(this, Parser.class, parserClassname);
|
simulation.getGUI().tryLoadClass(this, Parser.class, parserClassname);
|
||||||
if (parserClass == null) {
|
if (parserClass == null) {
|
||||||
logger.warn("Could not create buffer parser: could not find class: " + parserClassname);
|
logger.warn("Could not create buffer parser: could not find class: " + parserClassname);
|
||||||
|
@ -960,7 +960,7 @@ public class BufferListener extends VisPlugin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BufferAccess {
|
public static class BufferAccess {
|
||||||
|
@ -1271,7 +1271,7 @@ public class BufferListener extends VisPlugin {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Class<? extends Parser> bpClass =
|
Class<? extends Parser> bpClass =
|
||||||
(Class<? extends Parser>)
|
(Class<? extends Parser>)
|
||||||
((JMenuItem) e.getSource()).getClientProperty("CLASS");
|
((JMenuItem) e.getSource()).getClientProperty("CLASS");
|
||||||
setParser(bpClass);
|
setParser(bpClass);
|
||||||
}
|
}
|
||||||
|
@ -1291,7 +1291,7 @@ public class BufferListener extends VisPlugin {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Class<? extends Buffer> btClass =
|
Class<? extends Buffer> btClass =
|
||||||
(Class<? extends Buffer>)
|
(Class<? extends Buffer>)
|
||||||
((JMenuItem) e.getSource()).getClientProperty("CLASS");
|
((JMenuItem) e.getSource()).getClientProperty("CLASS");
|
||||||
|
|
||||||
Buffer b = createBufferInstance(btClass);
|
Buffer b = createBufferInstance(btClass);
|
||||||
|
@ -1610,7 +1610,7 @@ public class BufferListener extends VisPlugin {
|
||||||
public static class PrintableCharactersParser extends StringParser {
|
public static class PrintableCharactersParser extends StringParser {
|
||||||
public String parseString(BufferAccess ba) {
|
public String parseString(BufferAccess ba) {
|
||||||
/* TODO Diff? */
|
/* TODO Diff? */
|
||||||
return new String(ba.mem).replaceAll("[^\\p{Print}]", "");
|
return new String(ba.mem).replaceAll("[^\\p{Print}]", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1692,7 +1692,7 @@ public class BufferListener extends VisPlugin {
|
||||||
if (diff != null && diff[x]) {
|
if (diff != null && diff[x]) {
|
||||||
red = true;
|
red = true;
|
||||||
}
|
}
|
||||||
int v = (int)0xff&ba.mem[x];
|
int v = 0xff&ba.mem[x];
|
||||||
int h = Math.min(v/16, 15); /* crop */
|
int h = Math.min(v/16, 15); /* crop */
|
||||||
if (red) {
|
if (red) {
|
||||||
g.setColor(Color.RED);
|
g.setColor(Color.RED);
|
||||||
|
|
|
@ -30,16 +30,42 @@
|
||||||
package se.sics.cooja.plugins;
|
package se.sics.cooja.plugins;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.event.*;
|
import java.awt.event.ActionEvent;
|
||||||
import java.util.*;
|
import java.awt.event.ActionListener;
|
||||||
import javax.swing.*;
|
import java.util.Collection;
|
||||||
|
import java.util.Observable;
|
||||||
|
import java.util.Observer;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import javax.swing.Action;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import se.sics.cooja.*;
|
import se.sics.cooja.ClassDescription;
|
||||||
import se.sics.cooja.GUI.PluginConstructionException;
|
import se.sics.cooja.GUI;
|
||||||
|
import se.sics.cooja.Mote;
|
||||||
|
import se.sics.cooja.MoteInterface;
|
||||||
|
import se.sics.cooja.MoteType;
|
||||||
|
import se.sics.cooja.PluginType;
|
||||||
|
import se.sics.cooja.Simulation;
|
||||||
|
import se.sics.cooja.VisPlugin;
|
||||||
import se.sics.cooja.contikimote.ContikiMoteType;
|
import se.sics.cooja.contikimote.ContikiMoteType;
|
||||||
import se.sics.cooja.interfaces.*;
|
import se.sics.cooja.interfaces.Button;
|
||||||
|
import se.sics.cooja.interfaces.LED;
|
||||||
|
import se.sics.cooja.interfaces.Log;
|
||||||
|
import se.sics.cooja.interfaces.PIR;
|
||||||
|
import se.sics.cooja.interfaces.Position;
|
||||||
|
import se.sics.cooja.interfaces.Radio;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows a user to observe several different parts of the simulator, stopping a
|
* Allows a user to observe several different parts of the simulator, stopping a
|
||||||
|
@ -47,7 +73,7 @@ import se.sics.cooja.interfaces.*;
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Breakpoints...")
|
@ClassDescription("Breakpoints")
|
||||||
@PluginType(PluginType.SIM_PLUGIN)
|
@PluginType(PluginType.SIM_PLUGIN)
|
||||||
public class EventListener extends VisPlugin {
|
public class EventListener extends VisPlugin {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -113,7 +139,7 @@ public class EventListener extends VisPlugin {
|
||||||
+ myParent.mySimulation.getSimulationTime(), new AbstractAction(
|
+ myParent.mySimulation.getSimulationTime(), new AbstractAction(
|
||||||
"View interface visualizer") {
|
"View interface visualizer") {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
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(GUI.getDescriptionOf(moteInterface.getClass()));
|
||||||
|
|
|
@ -103,7 +103,7 @@ import se.sics.cooja.util.ArrayQueue;
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind, Niclas Finne
|
* @author Fredrik Osterlind, Niclas Finne
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Mote output...")
|
@ClassDescription("Mote output")
|
||||||
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
||||||
public class LogListener extends VisPlugin implements HasQuickHelp {
|
public class LogListener extends VisPlugin implements HasQuickHelp {
|
||||||
private static final long serialVersionUID = 3294595371354857261L;
|
private static final long serialVersionUID = 3294595371354857261L;
|
||||||
|
@ -132,7 +132,7 @@ public class LogListener extends VisPlugin implements HasQuickHelp {
|
||||||
private ArrayQueue<LogData> logs = new ArrayQueue<LogData>();
|
private ArrayQueue<LogData> logs = new ArrayQueue<LogData>();
|
||||||
|
|
||||||
private Simulation simulation;
|
private Simulation simulation;
|
||||||
|
|
||||||
private JTextField filterTextField = null;
|
private JTextField filterTextField = null;
|
||||||
private JLabel filterLabel = new JLabel("Filter: ");
|
private JLabel filterLabel = new JLabel("Filter: ");
|
||||||
private Color filterTextFieldBackground;
|
private Color filterTextFieldBackground;
|
||||||
|
@ -208,18 +208,18 @@ public class LogListener extends VisPlugin implements HasQuickHelp {
|
||||||
menuBar.add(editMenu);
|
menuBar.add(editMenu);
|
||||||
menuBar.add(showMenu);
|
menuBar.add(showMenu);
|
||||||
this.setJMenuBar(menuBar);
|
this.setJMenuBar(menuBar);
|
||||||
|
|
||||||
editMenu.add(new JMenuItem(copyAllAction));
|
editMenu.add(new JMenuItem(copyAllAction));
|
||||||
editMenu.add(new JMenuItem(copyAllMessagesAction));
|
editMenu.add(new JMenuItem(copyAllMessagesAction));
|
||||||
editMenu.add(new JMenuItem(copyAction));
|
editMenu.add(new JMenuItem(copyAction));
|
||||||
editMenu.addSeparator();
|
editMenu.addSeparator();
|
||||||
editMenu.add(new JMenuItem(clearAction));
|
editMenu.add(new JMenuItem(clearAction));
|
||||||
|
|
||||||
|
|
||||||
fileMenu.add(new JMenuItem(saveAction));
|
fileMenu.add(new JMenuItem(saveAction));
|
||||||
appendCheckBox = new JCheckBoxMenuItem(appendAction);
|
appendCheckBox = new JCheckBoxMenuItem(appendAction);
|
||||||
fileMenu.add(appendCheckBox);
|
fileMenu.add(appendCheckBox);
|
||||||
|
|
||||||
colorCheckbox = new JCheckBoxMenuItem("Mote-specific coloring");
|
colorCheckbox = new JCheckBoxMenuItem("Mote-specific coloring");
|
||||||
showMenu.add(colorCheckbox);
|
showMenu.add(colorCheckbox);
|
||||||
colorCheckbox.addActionListener(new ActionListener() {
|
colorCheckbox.addActionListener(new ActionListener() {
|
||||||
|
@ -400,7 +400,7 @@ public class LogListener extends VisPlugin implements HasQuickHelp {
|
||||||
adjuster.packColumns();
|
adjuster.packColumns();
|
||||||
|
|
||||||
/* Popup menu */
|
/* Popup menu */
|
||||||
|
|
||||||
JPopupMenu popupMenu = new JPopupMenu();
|
JPopupMenu popupMenu = new JPopupMenu();
|
||||||
/*
|
/*
|
||||||
JMenu copyClipboard = new JMenu("Copy to clipboard");
|
JMenu copyClipboard = new JMenu("Copy to clipboard");
|
||||||
|
@ -543,7 +543,7 @@ public class LogListener extends VisPlugin implements HasQuickHelp {
|
||||||
|
|
||||||
updateTitle();
|
updateTitle();
|
||||||
pack();
|
pack();
|
||||||
|
|
||||||
/* XXX HACK: here we set the position and size of the window when it appears on a blank simulation screen. */
|
/* XXX HACK: here we set the position and size of the window when it appears on a blank simulation screen. */
|
||||||
this.setLocation(400, 160);
|
this.setLocation(400, 160);
|
||||||
this.setSize(gui.getDesktopPane().getWidth() - 400, 240);
|
this.setSize(gui.getDesktopPane().getWidth() - 400, 240);
|
||||||
|
|
|
@ -56,7 +56,7 @@ 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;
|
||||||
|
|
||||||
@ClassDescription("Notes...")
|
@ClassDescription("Notes")
|
||||||
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
||||||
public class Notes extends VisPlugin {
|
public class Notes extends VisPlugin {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -85,7 +85,7 @@ public class Notes extends VisPlugin {
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
if (e.isPopupTrigger()) {
|
if (e.isPopupTrigger()) {
|
||||||
popup.show(Notes.this, e.getX(), e.getY());
|
popup.show(Notes.this, e.getX(), e.getY());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void mouseReleased(MouseEvent e) {
|
public void mouseReleased(MouseEvent e) {
|
||||||
if (e.isPopupTrigger()) {
|
if (e.isPopupTrigger()) {
|
||||||
|
@ -109,11 +109,11 @@ public class Notes extends VisPlugin {
|
||||||
public String getNotes() {
|
public String getNotes() {
|
||||||
return notes.getText();
|
return notes.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotes(String text) {
|
public void setNotes(String text) {
|
||||||
this.notes.setText(text);
|
this.notes.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDecorationsVisible(boolean visible) {
|
private void setDecorationsVisible(boolean visible) {
|
||||||
if (!(Notes.this.getUI() instanceof BasicInternalFrameUI)) {
|
if (!(Notes.this.getUI() instanceof BasicInternalFrameUI)) {
|
||||||
return;
|
return;
|
||||||
|
@ -124,7 +124,7 @@ public class Notes extends VisPlugin {
|
||||||
ui.getNorthPane().setPreferredSize(null);
|
ui.getNorthPane().setPreferredSize(null);
|
||||||
} else {
|
} else {
|
||||||
ui.getNorthPane().setPreferredSize(new Dimension(0,0));
|
ui.getNorthPane().setPreferredSize(new Dimension(0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Notes.this.revalidate();
|
Notes.this.revalidate();
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
@ -135,7 +135,7 @@ public class Notes extends VisPlugin {
|
||||||
|
|
||||||
decorationsVisible = visible;
|
decorationsVisible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Element> getConfigXML() {
|
public Collection<Element> getConfigXML() {
|
||||||
ArrayList<Element> config = new ArrayList<Element>();
|
ArrayList<Element> config = new ArrayList<Element>();
|
||||||
Element element;
|
Element element;
|
||||||
|
|
|
@ -102,8 +102,8 @@ import se.sics.cooja.util.StringUtils;
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Radio messages...")
|
@ClassDescription("Radio messages")
|
||||||
@PluginType(PluginType.SIM_PLUGIN)
|
@PluginType(PluginType.SIM_PLUGIN)
|
||||||
public class RadioLogger extends VisPlugin {
|
public class RadioLogger extends VisPlugin {
|
||||||
private static Logger logger = Logger.getLogger(RadioLogger.class);
|
private static Logger logger = Logger.getLogger(RadioLogger.class);
|
||||||
private static final long serialVersionUID = -6927091711697081353L;
|
private static final long serialVersionUID = -6927091711697081353L;
|
||||||
|
@ -115,7 +115,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
|
|
||||||
private JSplitPane splitPane;
|
private JSplitPane splitPane;
|
||||||
private JTextPane verboseBox = null;
|
private JTextPane verboseBox = null;
|
||||||
|
|
||||||
private final static String[] COLUMN_NAMES = {
|
private final static String[] COLUMN_NAMES = {
|
||||||
"Time",
|
"Time",
|
||||||
"From",
|
"From",
|
||||||
|
@ -139,7 +139,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
public RadioLogger(final Simulation simulationToControl, final GUI gui) {
|
public RadioLogger(final Simulation simulationToControl, final GUI gui) {
|
||||||
super("Radio messages", gui);
|
super("Radio messages", gui);
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
simulation = simulationToControl;
|
simulation = simulationToControl;
|
||||||
radioMedium = simulation.getRadioMedium();
|
radioMedium = simulation.getRadioMedium();
|
||||||
|
|
||||||
|
@ -149,14 +149,14 @@ public class RadioLogger extends VisPlugin {
|
||||||
JMenu editMenu = new JMenu("Edit");
|
JMenu editMenu = new JMenu("Edit");
|
||||||
JMenu analyzerMenu = new JMenu("Analyzer");
|
JMenu analyzerMenu = new JMenu("Analyzer");
|
||||||
JMenu payloadMenu = new JMenu("Payload");
|
JMenu payloadMenu = new JMenu("Payload");
|
||||||
|
|
||||||
menuBar.add(fileMenu);
|
menuBar.add(fileMenu);
|
||||||
menuBar.add(editMenu);
|
menuBar.add(editMenu);
|
||||||
menuBar.add(analyzerMenu);
|
menuBar.add(analyzerMenu);
|
||||||
menuBar.add(payloadMenu);
|
menuBar.add(payloadMenu);
|
||||||
|
|
||||||
this.setJMenuBar(menuBar);
|
this.setJMenuBar(menuBar);
|
||||||
|
|
||||||
ArrayList<PacketAnalyzer> lowpanAnalyzers = new ArrayList<PacketAnalyzer>();
|
ArrayList<PacketAnalyzer> lowpanAnalyzers = new ArrayList<PacketAnalyzer>();
|
||||||
lowpanAnalyzers.add(new IEEE802154Analyzer(false));
|
lowpanAnalyzers.add(new IEEE802154Analyzer(false));
|
||||||
lowpanAnalyzers.add(new IPHCPacketAnalyzer());
|
lowpanAnalyzers.add(new IPHCPacketAnalyzer());
|
||||||
|
@ -297,7 +297,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
|
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
|
||||||
showInAllAction.actionPerformed(null);
|
showInAllAction.actionPerformed(null);
|
||||||
} else if (e.getKeyCode() == KeyEvent.VK_F &&
|
} else if (e.getKeyCode() == KeyEvent.VK_F &&
|
||||||
(e.getModifiers() & KeyEvent.CTRL_MASK) != 0) {
|
(e.getModifiers() & KeyEvent.CTRL_MASK) != 0) {
|
||||||
searchField.setVisible(true);
|
searchField.setVisible(true);
|
||||||
searchField.requestFocus();
|
searchField.requestFocus();
|
||||||
|
@ -333,14 +333,14 @@ public class RadioLogger extends VisPlugin {
|
||||||
editMenu.add(new JMenuItem(copyAction));
|
editMenu.add(new JMenuItem(copyAction));
|
||||||
editMenu.add(new JSeparator());
|
editMenu.add(new JSeparator());
|
||||||
editMenu.add(new JMenuItem(clearAction));
|
editMenu.add(new JMenuItem(clearAction));
|
||||||
|
|
||||||
payloadMenu.add(new JMenuItem(aliasAction));
|
payloadMenu.add(new JMenuItem(aliasAction));
|
||||||
|
|
||||||
fileMenu.add(new JMenuItem(saveAction));
|
fileMenu.add(new JMenuItem(saveAction));
|
||||||
|
|
||||||
|
|
||||||
JPopupMenu popupMenu = new JPopupMenu();
|
JPopupMenu popupMenu = new JPopupMenu();
|
||||||
|
|
||||||
JMenu focusMenu = new JMenu("Show in");
|
JMenu focusMenu = new JMenu("Show in");
|
||||||
focusMenu.add(new JMenuItem(showInAllAction));
|
focusMenu.add(new JMenuItem(showInAllAction));
|
||||||
focusMenu.addSeparator();
|
focusMenu.addSeparator();
|
||||||
|
@ -349,7 +349,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
popupMenu.add(focusMenu);
|
popupMenu.add(focusMenu);
|
||||||
|
|
||||||
//a group of radio button menu items
|
//a group of radio button menu items
|
||||||
|
|
||||||
ButtonGroup group = new ButtonGroup();
|
ButtonGroup group = new ButtonGroup();
|
||||||
JRadioButtonMenuItem rbMenuItem = new JRadioButtonMenuItem(
|
JRadioButtonMenuItem rbMenuItem = new JRadioButtonMenuItem(
|
||||||
createAnalyzerAction("No Analyzer", "none", null, true));
|
createAnalyzerAction("No Analyzer", "none", null, true));
|
||||||
|
@ -366,7 +366,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
group.add(rbMenuItem);
|
group.add(rbMenuItem);
|
||||||
analyzerMenu.add(rbMenuItem);
|
analyzerMenu.add(rbMenuItem);
|
||||||
|
|
||||||
|
|
||||||
/* Load additional analyzers specified by projects (cooja.config) */
|
/* Load additional analyzers specified by projects (cooja.config) */
|
||||||
String[] projectAnalyzerSuites =
|
String[] projectAnalyzerSuites =
|
||||||
gui.getProjectConfig().getStringArrayValue(RadioLogger.class, "ANALYZERS");
|
gui.getProjectConfig().getStringArrayValue(RadioLogger.class, "ANALYZERS");
|
||||||
|
@ -389,17 +389,17 @@ public class RadioLogger extends VisPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dataTable.setComponentPopupMenu(popupMenu);
|
dataTable.setComponentPopupMenu(popupMenu);
|
||||||
dataTable.setFillsViewportHeight(true);
|
dataTable.setFillsViewportHeight(true);
|
||||||
|
|
||||||
verboseBox = new JTextPane();
|
verboseBox = new JTextPane();
|
||||||
verboseBox.setContentType("text/html");
|
verboseBox.setContentType("text/html");
|
||||||
verboseBox.setEditable(false);
|
verboseBox.setEditable(false);
|
||||||
verboseBox.setComponentPopupMenu(popupMenu);
|
verboseBox.setComponentPopupMenu(popupMenu);
|
||||||
|
|
||||||
/* Search text field */
|
/* Search text field */
|
||||||
searchField.setVisible(false);
|
searchField.setVisible(false);
|
||||||
searchField.addKeyListener(new KeyAdapter() {
|
searchField.addKeyListener(new KeyAdapter() {
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||||
|
@ -413,14 +413,14 @@ public class RadioLogger extends VisPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
|
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
|
||||||
new JScrollPane(dataTable), new JScrollPane(verboseBox));
|
new JScrollPane(dataTable), new JScrollPane(verboseBox));
|
||||||
splitPane.setOneTouchExpandable(true);
|
splitPane.setOneTouchExpandable(true);
|
||||||
splitPane.setDividerLocation(150);
|
splitPane.setDividerLocation(150);
|
||||||
add(BorderLayout.NORTH, searchField);
|
add(BorderLayout.NORTH, searchField);
|
||||||
add(BorderLayout.CENTER, splitPane);
|
add(BorderLayout.CENTER, splitPane);
|
||||||
|
|
||||||
TableColumnAdjuster adjuster = new TableColumnAdjuster(dataTable);
|
TableColumnAdjuster adjuster = new TableColumnAdjuster(dataTable);
|
||||||
adjuster.setDynamicAdjustment(true);
|
adjuster.setDynamicAdjustment(true);
|
||||||
adjuster.packColumns();
|
adjuster.packColumns();
|
||||||
|
@ -455,7 +455,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
dataTable.scrollRectToVisible(dataTable.getCellRect(dataTable.getRowCount() - 1, 0, true));
|
dataTable.scrollRectToVisible(dataTable.getCellRect(dataTable.getRowCount() - 1, 0, true));
|
||||||
}
|
}
|
||||||
setTitle("Radio messages: " + dataTable.getRowCount() + " messages seen");
|
setTitle("Radio messages: " + dataTable.getRowCount() + " messages seen");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -476,7 +476,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
if (row < 0) {
|
if (row < 0) {
|
||||||
row = 0;
|
row = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reverse) {
|
if (!reverse) {
|
||||||
row++;
|
row++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -502,10 +502,10 @@ public class RadioLogger extends VisPlugin {
|
||||||
}
|
}
|
||||||
searchField.setBackground(Color.RED);
|
searchField.setBackground(Color.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects a logged radio packet close to the given time.
|
* Selects a logged radio packet close to the given time.
|
||||||
*
|
*
|
||||||
* @param time Start time
|
* @param time Start time
|
||||||
*/
|
*/
|
||||||
public void trySelectTime(final long time) {
|
public void trySelectTime(final long time) {
|
||||||
|
@ -520,9 +520,9 @@ public class RadioLogger extends VisPlugin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareDataString(RadioConnectionLog conn) {
|
private void prepareDataString(RadioConnectionLog conn) {
|
||||||
byte[] data;
|
byte[] data;
|
||||||
if (conn.packet == null) {
|
if (conn.packet == null) {
|
||||||
|
@ -564,7 +564,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
conn.data = data.length + ": 0x" + StringUtils.toHex(data, 4);
|
conn.data = data.length + ": 0x" + StringUtils.toHex(data, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean analyzePacket(PacketAnalyzer.Packet packet, StringBuffer brief, StringBuffer verbose) {
|
private boolean analyzePacket(PacketAnalyzer.Packet packet, StringBuffer brief, StringBuffer verbose) {
|
||||||
if (analyzers == null) return false;
|
if (analyzers == null) return false;
|
||||||
try {
|
try {
|
||||||
|
@ -688,7 +688,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RadioConnectionLog {
|
private class RadioConnectionLog {
|
||||||
long startTime;
|
long startTime;
|
||||||
long endTime;
|
long endTime;
|
||||||
|
@ -697,7 +697,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
|
|
||||||
String data = null;
|
String data = null;
|
||||||
String tooltip = null;
|
String tooltip = null;
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
RadioLogger.this.prepareDataString(this);
|
RadioLogger.this.prepareDataString(this);
|
||||||
|
@ -765,7 +765,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private Action copyAction = new AbstractAction("Copy selected") {
|
private Action copyAction = new AbstractAction("Copy selected") {
|
||||||
private static final long serialVersionUID = 8412062977916108054L;
|
private static final long serialVersionUID = 8412062977916108054L;
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
clipboard.setContents(stringSelection, null);
|
clipboard.setContents(stringSelection, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private Action copyAllAction = new AbstractAction("Copy all") {
|
private Action copyAllAction = new AbstractAction("Copy all") {
|
||||||
private static final long serialVersionUID = 1905586689441157304L;
|
private static final long serialVersionUID = 1905586689441157304L;
|
||||||
|
|
||||||
|
@ -805,7 +805,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
clipboard.setContents(stringSelection, null);
|
clipboard.setContents(stringSelection, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private Action saveAction = new AbstractAction("Save to file...") {
|
private Action saveAction = new AbstractAction("Save to file...") {
|
||||||
private static final long serialVersionUID = -3942984643211482179L;
|
private static final long serialVersionUID = -3942984643211482179L;
|
||||||
|
|
||||||
|
@ -865,7 +865,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
if (!(p instanceof TimeLine)) {
|
if (!(p instanceof TimeLine)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Select simulation time */
|
/* Select simulation time */
|
||||||
TimeLine plugin = (TimeLine) p;
|
TimeLine plugin = (TimeLine) p;
|
||||||
plugin.trySelectTime(time);
|
plugin.trySelectTime(time);
|
||||||
|
@ -885,7 +885,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
if (!(p instanceof LogListener)) {
|
if (!(p instanceof LogListener)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Select simulation time */
|
/* Select simulation time */
|
||||||
LogListener plugin = (LogListener) p;
|
LogListener plugin = (LogListener) p;
|
||||||
plugin.trySelectTime(time);
|
plugin.trySelectTime(time);
|
||||||
|
@ -918,7 +918,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
String alias = (String) JOptionPane.showInputDialog(
|
String alias = (String) JOptionPane.showInputDialog(
|
||||||
GUI.getTopParentContainer(),
|
GUI.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",
|
||||||
|
@ -940,7 +940,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
/* Remove current alias */
|
/* Remove current alias */
|
||||||
if (alias.equals("")) {
|
if (alias.equals("")) {
|
||||||
aliases.remove(connections.get(selectedRow).data);
|
aliases.remove(connections.get(selectedRow).data);
|
||||||
|
|
||||||
/* Should be null if empty */
|
/* Should be null if empty */
|
||||||
if (aliases.isEmpty()) {
|
if (aliases.isEmpty()) {
|
||||||
aliases = null;
|
aliases = null;
|
||||||
|
@ -954,7 +954,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public String getConnectionsString() {
|
public String getConnectionsString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
RadioConnectionLog[] cs = connections.toArray(new RadioConnectionLog[0]);
|
RadioConnectionLog[] cs = connections.toArray(new RadioConnectionLog[0]);
|
||||||
|
@ -963,7 +963,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
public void saveConnectionsToFile(String fileName) {
|
public void saveConnectionsToFile(String fileName) {
|
||||||
StringUtils.saveToFile(new File(fileName), getConnectionsString());
|
StringUtils.saveToFile(new File(fileName), getConnectionsString());
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,7 +87,7 @@ import se.sics.cooja.VisPlugin;
|
||||||
import se.sics.cooja.dialogs.MessageList;
|
import se.sics.cooja.dialogs.MessageList;
|
||||||
import se.sics.cooja.util.StringUtils;
|
import se.sics.cooja.util.StringUtils;
|
||||||
|
|
||||||
@ClassDescription("Simulation script editor...")
|
@ClassDescription("Simulation script editor")
|
||||||
@PluginType(PluginType.SIM_PLUGIN)
|
@PluginType(PluginType.SIM_PLUGIN)
|
||||||
public class ScriptRunner extends VisPlugin {
|
public class ScriptRunner extends VisPlugin {
|
||||||
private static final long serialVersionUID = 7614358340336799109L;
|
private static final long serialVersionUID = 7614358340336799109L;
|
||||||
|
|
|
@ -63,7 +63,7 @@ import se.sics.cooja.VisPlugin;
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Simulation control...")
|
@ClassDescription("Simulation control")
|
||||||
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
||||||
public class SimControl extends VisPlugin implements HasQuickHelp {
|
public class SimControl extends VisPlugin implements HasQuickHelp {
|
||||||
private static final int LABEL_UPDATE_INTERVAL = 150;
|
private static final int LABEL_UPDATE_INTERVAL = 150;
|
||||||
|
|
|
@ -56,7 +56,6 @@ import java.util.Observer;
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JCheckBoxMenuItem;
|
import javax.swing.JCheckBoxMenuItem;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
|
@ -70,7 +69,6 @@ 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;
|
||||||
|
@ -107,7 +105,7 @@ import se.sics.cooja.motes.AbstractEmulatedMote;
|
||||||
*
|
*
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Timeline...")
|
@ClassDescription("Timeline")
|
||||||
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
||||||
public class TimeLine extends VisPlugin implements HasQuickHelp {
|
public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
private static final long serialVersionUID = -883154261246961973L;
|
private static final long serialVersionUID = -883154261246961973L;
|
||||||
|
@ -177,16 +175,16 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
JMenu eventsMenu = new JMenu("Events");
|
JMenu eventsMenu = new JMenu("Events");
|
||||||
JMenu viewMenu = new JMenu("View");
|
JMenu viewMenu = new JMenu("View");
|
||||||
JMenu zoomMenu = new JMenu("Zoom");
|
JMenu zoomMenu = new JMenu("Zoom");
|
||||||
|
|
||||||
menuBar.add(fileMenu);
|
menuBar.add(fileMenu);
|
||||||
menuBar.add(editMenu);
|
menuBar.add(editMenu);
|
||||||
menuBar.add(viewMenu);
|
menuBar.add(viewMenu);
|
||||||
menuBar.add(zoomMenu);
|
menuBar.add(zoomMenu);
|
||||||
menuBar.add(eventsMenu);
|
menuBar.add(eventsMenu);
|
||||||
menuBar.add(motesMenu);
|
menuBar.add(motesMenu);
|
||||||
|
|
||||||
this.setJMenuBar(menuBar);
|
this.setJMenuBar(menuBar);
|
||||||
|
|
||||||
motesMenu.add(new JMenuItem(addMoteAction));
|
motesMenu.add(new JMenuItem(addMoteAction));
|
||||||
zoomMenu.add(new JMenuItem(zoomInAction));
|
zoomMenu.add(new JMenuItem(zoomInAction));
|
||||||
zoomMenu.add(new JMenuItem(zoomOutAction));
|
zoomMenu.add(new JMenuItem(zoomOutAction));
|
||||||
|
@ -203,7 +201,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
return radioChannels;
|
return radioChannels;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
fileMenu.add(new JMenuItem(saveDataAction));
|
fileMenu.add(new JMenuItem(saveDataAction));
|
||||||
fileMenu.add(new JMenuItem(statisticsAction));
|
fileMenu.add(new JMenuItem(statisticsAction));
|
||||||
editMenu.add(new JMenuItem(clearAction));
|
editMenu.add(new JMenuItem(clearAction));
|
||||||
|
@ -270,14 +268,14 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
eventsMenu.add(eventCheckBox);
|
eventsMenu.add(eventCheckBox);
|
||||||
|
|
||||||
/* Box: events to observe */
|
/* Box: events to observe */
|
||||||
|
|
||||||
eventCheckboxes = Box.createVerticalBox();
|
eventCheckboxes = Box.createVerticalBox();
|
||||||
/*
|
/*
|
||||||
eventCheckboxes.add(new JButton(addMoteAction));
|
eventCheckboxes.add(new JButton(addMoteAction));
|
||||||
eventCheckboxes.add(new JSeparator());
|
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);
|
||||||
|
@ -347,7 +345,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
||||||
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
|
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
|
||||||
timelineScrollPane.getHorizontalScrollBar().setUnitIncrement(50);
|
timelineScrollPane.getHorizontalScrollBar().setUnitIncrement(50);
|
||||||
|
|
||||||
timelineMoteRuler = new MoteRuler();
|
timelineMoteRuler = new MoteRuler();
|
||||||
timelineScrollPane.setRowHeaderView(timelineMoteRuler);
|
timelineScrollPane.setRowHeaderView(timelineMoteRuler);
|
||||||
timelineScrollPane.setBackground(Color.WHITE);
|
timelineScrollPane.setBackground(Color.WHITE);
|
||||||
|
@ -420,7 +418,7 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
timer.start();
|
timer.start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* XXX HACK: here we set the position and size of the window when it appears on a blank simulation screen. */
|
/* XXX HACK: here we set the position and size of the window when it appears on a blank simulation screen. */
|
||||||
this.setLocation(0, gui.getDesktopPane().getHeight() - 166);
|
this.setLocation(0, gui.getDesktopPane().getHeight() - 166);
|
||||||
this.setSize(gui.getDesktopPane().getWidth(), 166);
|
this.setSize(gui.getDesktopPane().getWidth(), 166);
|
||||||
|
@ -2513,5 +2511,5 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
|
||||||
"<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>Watchpoints</b>" +
|
"<p><b>Watchpoints</b>" +
|
||||||
"<br>Shows triggered watchpoints, currently only supported by MSPSim-based motes. To add watchpoints, use the Msp Code Watcher plugin.";
|
"<br>Shows triggered watchpoints, currently only supported by MSPSim-based motes. To add watchpoints, use the Msp Code Watcher plugin.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ import se.sics.cooja.plugins.skins.UDGMVisualizerSkin;
|
||||||
* @see UDGMVisualizerSkin
|
* @see UDGMVisualizerSkin
|
||||||
* @author Fredrik Osterlind
|
* @author Fredrik Osterlind
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Network...")
|
@ClassDescription("Network")
|
||||||
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
||||||
public class Visualizer extends VisPlugin implements HasQuickHelp {
|
public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
Loading…
Reference in New Issue