using new MotePlugin interface

This commit is contained in:
fros4943 2010-01-15 10:54:42 +00:00
parent a2b6c39ac2
commit 760818260c
8 changed files with 60 additions and 19 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MoteInformation.java,v 1.7 2009/09/17 11:09:23 fros4943 Exp $
* $Id: MoteInformation.java,v 1.8 2010/01/15 10:54:42 fros4943 Exp $
*/
package se.sics.cooja.plugins;
@ -46,7 +46,7 @@ import se.sics.cooja.*;
*/
@ClassDescription("Mote Information")
@PluginType(PluginType.MOTE_PLUGIN)
public class MoteInformation extends VisPlugin {
public class MoteInformation extends VisPlugin implements MotePlugin {
private static Logger logger = Logger.getLogger(MoteInformation.class);
private static final long serialVersionUID = 1L;
@ -171,4 +171,8 @@ public class MoteInformation extends VisPlugin {
}
}
public Mote getMote() {
return mote;
}
}

View file

@ -26,10 +26,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MoteInterfaceViewer.java,v 1.7 2009/06/30 12:46:26 fros4943 Exp $
* $Id: MoteInterfaceViewer.java,v 1.8 2010/01/15 10:54:42 fros4943 Exp $
*/
package se.sics.cooja.plugins;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
@ -38,17 +39,21 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collection;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import org.jdom.Element;
import se.sics.cooja.ClassDescription;
import se.sics.cooja.GUI;
import se.sics.cooja.Mote;
import se.sics.cooja.MoteInterface;
import se.sics.cooja.MotePlugin;
import se.sics.cooja.PluginType;
import se.sics.cooja.Simulation;
import se.sics.cooja.VisPlugin;
@ -61,7 +66,7 @@ import se.sics.cooja.GUI.HasQuickHelp;
*/
@ClassDescription("Mote Interface Viewer")
@PluginType(PluginType.MOTE_PLUGIN)
public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp {
public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, MotePlugin {
private static final long serialVersionUID = 1L;
private Mote mote;
@ -70,7 +75,6 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp {
private JComboBox selectInterfaceComboBox = null;
private JScrollPane mainScrollPane;
/**
* Create a new mote interface viewer.
*
@ -94,7 +98,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp {
selectInterfaceComboBox = new JComboBox();
final JPanel interfacePanel = new JPanel();
Vector<MoteInterface> intfs = mote.getInterfaces().getInterfaces();
Collection<MoteInterface> intfs = mote.getInterfaces().getInterfaces();
for (MoteInterface intf : intfs) {
selectInterfaceComboBox.addItem(GUI.getDescriptionOf(intf));
}
@ -235,4 +239,8 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp {
return help;
}
public Mote getMote() {
return mote;
}
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: VariableWatcher.java,v 1.9 2009/08/27 14:38:57 fros4943 Exp $
* $Id: VariableWatcher.java,v 1.10 2010/01/15 10:54:42 fros4943 Exp $
*/
package se.sics.cooja.plugins;
@ -69,6 +69,7 @@ import se.sics.cooja.AddressMemory;
import se.sics.cooja.ClassDescription;
import se.sics.cooja.GUI;
import se.sics.cooja.Mote;
import se.sics.cooja.MotePlugin;
import se.sics.cooja.PluginType;
import se.sics.cooja.Simulation;
import se.sics.cooja.VisPlugin;
@ -84,7 +85,7 @@ import se.sics.cooja.AddressMemory.UnknownVariableException;
*/
@ClassDescription("Variable Watcher")
@PluginType(PluginType.MOTE_PLUGIN)
public class VariableWatcher extends VisPlugin {
public class VariableWatcher extends VisPlugin implements MotePlugin {
private static final long serialVersionUID = 1L;
private AddressMemory moteMemory;
@ -114,6 +115,8 @@ public class VariableWatcher extends VisPlugin {
private NumberFormat integerFormat;
private Mote mote;
/**
* @param moteToView Mote
* @param simulation Simulation
@ -121,7 +124,7 @@ public class VariableWatcher extends VisPlugin {
*/
public VariableWatcher(Mote moteToView, Simulation simulation, GUI gui) {
super("Variable Watcher (" + moteToView + ")", gui);
this.mote = moteToView;
moteMemory = (AddressMemory) moteToView.getMemory();
JLabel label;
@ -588,6 +591,9 @@ public class VariableWatcher extends VisPlugin {
return true;
}
public Mote getMote() {
return mote;
}
}
/* Limit JTextField input class */