removed mote type visualizer (only showing identifier)

This commit is contained in:
fros4943 2008-02-07 13:15:22 +00:00
parent cbdb1c242d
commit b0e07a06cf

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.4 2007/04/02 16:44:44 fros4943 Exp $
* $Id: MoteInformation.java,v 1.5 2008/02/07 13:15:22 fros4943 Exp $
*/
package se.sics.cooja.plugins;
@ -101,17 +101,18 @@ public class MoteInformation extends VisPlugin {
mainPane.add(smallPane);
mainPane.add(Box.createRigidArea(new Dimension(0,25)));
// Visualize mote type
// Visualize state
smallPane = new JPanel(new BorderLayout());
label = new JLabel("-- STATE --");
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
smallPane.add(BorderLayout.WEST, label);
if (mote.getState() == Mote.State.ACTIVE)
if (mote.getState() == Mote.State.ACTIVE) {
label = new JLabel("active");
else if (mote.getState() == State.LPM)
} else if (mote.getState() == State.LPM) {
label = new JLabel("low power mode");
else
} else {
label = new JLabel("dead");
}
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
stateLabel = label;
@ -126,16 +127,13 @@ public class MoteInformation extends VisPlugin {
smallPane = new JPanel(new BorderLayout());
label = new JLabel("-- MOTE TYPE --");
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
smallPane.add(BorderLayout.NORTH, label);
JPanel moteVis = mote.getType().getTypeVisualizer();
if (moteVis != null) {
moteVis.setBorder(BorderFactory.createEtchedBorder());
smallPane.add(moteVis);
mainPane.add(smallPane);
mainPane.add(Box.createRigidArea(new Dimension(0,25)));
}
smallPane.add(BorderLayout.WEST, label);
label = new JLabel(moteToView.getType().getIdentifier() + ": \"" + moteToView.getType().getDescription() + "\"");
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
smallPane.add(BorderLayout.EAST, label);
mainPane.add(smallPane);
mainPane.add(Box.createRigidArea(new Dimension(0,25)));
// All interfaces
smallPane = new JPanel(new BorderLayout());
@ -211,12 +209,13 @@ public class MoteInformation extends VisPlugin {
// Register as state observer to detect if mote changes state
mote.addStateObserver(stateObserver = new Observer() {
public void update(Observable obs, Object obj) {
if (mote.getState() == State.ACTIVE)
if (mote.getState() == State.ACTIVE) {
stateLabel.setText("active");
else if (mote.getState() == Mote.State.LPM)
} else if (mote.getState() == Mote.State.LPM) {
stateLabel.setText("low power mode");
else
} else {
stateLabel.setText("dead");
}
}
});
}
@ -228,10 +227,11 @@ public class MoteInformation extends VisPlugin {
// Release all interface visualizations
for (JPanel interfaceVisualization: visibleMoteInterfaces) {
MoteInterface moteInterface = (MoteInterface) interfaceVisualization.getClientProperty("my_interface");
if (moteInterface != null && interfaceVisualization != null)
if (moteInterface != null && interfaceVisualization != null) {
moteInterface.releaseInterfaceVisualizer(interfaceVisualization);
else
} else {
logger.warn("Could not release panel");
}
}
}