mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-11-20 10:35:34 +00:00
verify that visualizer skin is compatible with the current simulation before starting it,
set udgm/dgrm/mrm radio medium skins to be started as default
This commit is contained in:
parent
e96a375e33
commit
f703965b67
@ -41,4 +41,10 @@ COMMAND_DATA_END = ^([0-9A-Fa-f]*)[ \t]A[ \t]_edata$
|
|||||||
COMMAND_BSS_START = ^([0-9A-Fa-f]*)[ \t]A[ \t]__bss_start$
|
COMMAND_BSS_START = ^([0-9A-Fa-f]*)[ \t]A[ \t]__bss_start$
|
||||||
COMMAND_BSS_END = ^([0-9A-Fa-f]*)[ \t]A[ \t]_end$
|
COMMAND_BSS_END = ^([0-9A-Fa-f]*)[ \t]A[ \t]_end$
|
||||||
|
|
||||||
VISUALIZER_DEFAULT_SKINS=se.sics.cooja.plugins.skins.IDVisualizerSkin;se.sics.cooja.plugins.skins.GridVisualizerSkin
|
VISUALIZER_DEFAULT_SKINS=\
|
||||||
|
se.sics.cooja.plugins.skins.IDVisualizerSkin;\
|
||||||
|
se.sics.cooja.plugins.skins.GridVisualizerSkin;\
|
||||||
|
se.sics.cooja.plugins.skins.DGRMVisualizerSkin;\
|
||||||
|
se.sics.cooja.plugins.skins.TrafficVisualizerSkin;\
|
||||||
|
se.sics.cooja.plugins.skins.UDGMVisualizerSkin;\
|
||||||
|
se.sics.mrm.MRMVisualizerSkin
|
||||||
|
@ -494,6 +494,11 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isSkinCompatible(skinClass)) {
|
||||||
|
/*logger.warn("Skin is not compatible with current simulation: " + skinClass);*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create and activate new skin */
|
/* Create and activate new skin */
|
||||||
try {
|
try {
|
||||||
VisualizerSkin newSkin = skinClass.newInstance();
|
VisualizerSkin newSkin = skinClass.newInstance();
|
||||||
@ -707,6 +712,25 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/* Should skin be enabled in this simulation? */
|
||||||
|
if (!isSkinCompatible(skinClass)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skinMenu instanceof JMenu) {
|
||||||
|
((JMenu)skinMenu).add(item);
|
||||||
|
}
|
||||||
|
if (skinMenu instanceof JPopupMenu) {
|
||||||
|
((JPopupMenu)skinMenu).add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSkinCompatible(Class<? extends VisualizerSkin> skinClass) {
|
||||||
|
if (skinClass == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if skin depends on any particular radio medium */
|
/* Check if skin depends on any particular radio medium */
|
||||||
boolean showMenuItem = true;
|
boolean showMenuItem = true;
|
||||||
if (skinClass.getAnnotation(SupportedArguments.class) != null) {
|
if (skinClass.getAnnotation(SupportedArguments.class) != null) {
|
||||||
@ -720,16 +744,9 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!showMenuItem) {
|
if (!showMenuItem) {
|
||||||
continue;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (skinMenu instanceof JMenu) {
|
|
||||||
((JMenu)skinMenu).add(item);
|
|
||||||
}
|
|
||||||
if (skinMenu instanceof JPopupMenu) {
|
|
||||||
((JPopupMenu)skinMenu).add(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleMousePress(MouseEvent mouseEvent) {
|
private void handleMousePress(MouseEvent mouseEvent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user