disallowed starting plugins/visualizer skins for non-compatible motes/simulations
This commit is contained in:
parent
e18cc3b6b9
commit
24aafe5554
8 changed files with 95 additions and 51 deletions
|
@ -102,6 +102,7 @@ import se.sics.cooja.ClassDescription;
|
|||
import se.sics.cooja.GUI;
|
||||
import se.sics.cooja.PluginType;
|
||||
import se.sics.cooja.Simulation;
|
||||
import se.sics.cooja.SupportedArguments;
|
||||
import se.sics.cooja.VisPlugin;
|
||||
import se.sics.cooja.interfaces.DirectionalAntennaRadio;
|
||||
import se.sics.cooja.interfaces.Position;
|
||||
|
@ -123,6 +124,7 @@ import se.sics.mrm.ChannelModel.TxPair;
|
|||
*/
|
||||
@ClassDescription("MRM Radio environment")
|
||||
@PluginType(PluginType.SIM_PLUGIN)
|
||||
@SupportedArguments(radioMediums = {MRM.class})
|
||||
public class AreaViewer extends VisPlugin {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static Logger logger = Logger.getLogger(AreaViewer.class);
|
||||
|
@ -211,9 +213,9 @@ public class AreaViewer extends VisPlugin {
|
|||
private JRadioButton panModeButton;
|
||||
private JRadioButton zoomModeButton;
|
||||
private JRadioButton trackModeButton;
|
||||
|
||||
|
||||
private Action paintEnvironmentAction;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes an AreaViewer.
|
||||
*
|
||||
|
@ -267,7 +269,7 @@ public class AreaViewer extends VisPlugin {
|
|||
trackModeButton.setActionCommand("set track rays mode");
|
||||
trackModeButton.addActionListener(canvasModeHandler);
|
||||
trackModeButton.setEnabled(false);
|
||||
|
||||
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(selectModeButton);
|
||||
group.add(panModeButton);
|
||||
|
@ -676,7 +678,7 @@ public class AreaViewer extends VisPlugin {
|
|||
panModeButton.doClick();
|
||||
//canvasModeHandler.actionPerformed(new ActionEvent(e, 0, "set zoom mode"));
|
||||
}
|
||||
|
||||
|
||||
if (popUpToolTip != null) {
|
||||
popUpToolTip.hide();
|
||||
popUpToolTip = null;
|
||||
|
@ -751,16 +753,16 @@ public class AreaViewer extends VisPlugin {
|
|||
};
|
||||
trackedComponents = currentChannelModel.getRaysOfTransmission(txPair);
|
||||
canvas.repaint();
|
||||
|
||||
|
||||
/* Show popup */
|
||||
JToolTip t = AreaViewer.this.createToolTip();
|
||||
|
||||
String logHtml =
|
||||
"<html>" +
|
||||
String logHtml =
|
||||
"<html>" +
|
||||
trackedComponents.log.replace("\n", "<br>").replace(" pi", " π") +
|
||||
"</html>";
|
||||
t.setTipText(logHtml);
|
||||
|
||||
|
||||
if (t.getTipText() == null || t.getTipText().equals("")) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -31,17 +31,38 @@
|
|||
|
||||
package se.sics.mrm;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JFormattedTextField;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jdom.Element;
|
||||
|
||||
import se.sics.cooja.*;
|
||||
import se.sics.cooja.ClassDescription;
|
||||
import se.sics.cooja.GUI;
|
||||
import se.sics.cooja.PluginType;
|
||||
import se.sics.cooja.Simulation;
|
||||
import se.sics.cooja.SupportedArguments;
|
||||
import se.sics.mrm.ChannelModel.Parameter;
|
||||
|
||||
/**
|
||||
|
@ -51,6 +72,7 @@ import se.sics.mrm.ChannelModel.Parameter;
|
|||
*/
|
||||
@ClassDescription("MRM Settings")
|
||||
@PluginType(PluginType.SIM_PLUGIN)
|
||||
@SupportedArguments(radioMediums = {MRM.class})
|
||||
public class FormulaViewer extends se.sics.cooja.VisPlugin {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static Logger logger = Logger.getLogger(FormulaViewer.class);
|
||||
|
@ -164,14 +186,14 @@ public class FormulaViewer extends se.sics.cooja.VisPlugin {
|
|||
collapsableArea,
|
||||
channelModel.getParameterDoubleValue(Parameter.captureEffectPreambleDuration)
|
||||
);
|
||||
|
||||
|
||||
addDoubleParameter(
|
||||
Parameter.captureEffectSignalTreshold,
|
||||
Parameter.getDescription(Parameter.captureEffectSignalTreshold),
|
||||
collapsableArea,
|
||||
channelModel.getParameterDoubleValue(Parameter.captureEffectSignalTreshold)
|
||||
);
|
||||
|
||||
|
||||
// Transmitter parameters
|
||||
collapsableArea = createCollapsableArea("Transmitter parameters", allComponents);
|
||||
areaTransmitter = collapsableArea;
|
||||
|
@ -429,14 +451,14 @@ public class FormulaViewer extends se.sics.cooja.VisPlugin {
|
|||
textField.setBackground(null);
|
||||
textField.setToolTipText(null);
|
||||
}
|
||||
|
||||
|
||||
allDoubleParameters.add(textField);
|
||||
|
||||
contentPane.add(panel);
|
||||
|
||||
return textField;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates and adds a panel with a label and a
|
||||
* text field which accepts integers.
|
||||
|
@ -534,7 +556,7 @@ public class FormulaViewer extends se.sics.cooja.VisPlugin {
|
|||
} else {
|
||||
checkBox.setText("");
|
||||
}
|
||||
|
||||
|
||||
allBooleanParameters.add(checkBox);
|
||||
|
||||
contentPane.add(panel);
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.apache.log4j.Logger;
|
|||
import se.sics.cooja.ClassDescription;
|
||||
import se.sics.cooja.Mote;
|
||||
import se.sics.cooja.Simulation;
|
||||
import se.sics.cooja.SupportedArguments;
|
||||
import se.sics.cooja.interfaces.Position;
|
||||
import se.sics.cooja.interfaces.Radio;
|
||||
import se.sics.cooja.plugins.Visualizer;
|
||||
|
@ -47,6 +48,7 @@ import se.sics.mrm.ChannelModel.RadioPair;
|
|||
import se.sics.mrm.ChannelModel.TxPair;
|
||||
|
||||
@ClassDescription("Radio environment (MRM)")
|
||||
@SupportedArguments(radioMediums = {MRM.class})
|
||||
public class MRMVisualizerSkin implements VisualizerSkin {
|
||||
private static Logger logger = Logger.getLogger(MRMVisualizerSkin.class);
|
||||
|
||||
|
@ -79,7 +81,7 @@ public class MRMVisualizerSkin implements VisualizerSkin {
|
|||
|
||||
public void paintBeforeMotes(Graphics g) {
|
||||
final Mote selectedMote = visualizer.getSelectedMote();
|
||||
if (simulation == null
|
||||
if (simulation == null
|
||||
|| selectedMote == null
|
||||
|| selectedMote.getInterfaces().getRadio() == null) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue