register visualizer skin

This commit is contained in:
fros4943 2010-09-24 12:49:37 +00:00
parent 4fe2f4b8d9
commit 83adbeee55

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: DirectedGraphMedium.java,v 1.4 2009/11/25 15:44:04 fros4943 Exp $
* $Id: DirectedGraphMedium.java,v 1.5 2010/09/24 12:49:37 fros4943 Exp $
*/
package se.sics.cooja.radiomediums;
@ -47,6 +47,8 @@ import se.sics.cooja.RadioConnection;
import se.sics.cooja.Simulation;
import se.sics.cooja.interfaces.Radio;
import se.sics.cooja.plugins.DGRMConfigurator;
import se.sics.cooja.plugins.Visualizer;
import se.sics.cooja.plugins.skins.DGRMVisualizerSkin;
/**
* Directed Graph Radio Medium.
@ -76,6 +78,7 @@ public class DirectedGraphMedium extends AbstractRadioMedium {
public DirectedGraphMedium() {
/* Do not initialize radio medium: use only for hash table */
super(null);
Visualizer.registerVisualizerSkin(DGRMVisualizerSkin.class);
}
public DirectedGraphMedium(Simulation simulation) {
@ -88,7 +91,8 @@ public class DirectedGraphMedium extends AbstractRadioMedium {
/* Register plugin.
* TODO Should be unregistered when radio medium is removed */
simulation.getGUI().registerTemporaryPlugin(DGRMConfigurator.class);
}
Visualizer.registerVisualizerSkin(DGRMVisualizerSkin.class);
}
public void addEdge(Edge e) {
edges.add(e);
@ -137,7 +141,7 @@ public class DirectedGraphMedium extends AbstractRadioMedium {
public void registerRadioInterface(Radio radio, Simulation sim) {
super.registerRadioInterface(radio, sim);
for (Edge edge: edges) {
for (Edge edge: getEdges()) {
if (edge.delayedLoadConfig == null) {
continue;
}
@ -207,7 +211,7 @@ public class DirectedGraphMedium extends AbstractRadioMedium {
new Hashtable<Radio,ArrayList<DestinationRadio>>();
/* Fill edge hash table with all edges */
for (Edge edge: edges) {
for (Edge edge: getEdges()) {
if (edge.source == null) {
/* XXX Wait until edge configuration has been loaded */
logger.warn("DGRM edges not loaded");
@ -342,7 +346,7 @@ public class DirectedGraphMedium extends AbstractRadioMedium {
ArrayList<Element> config = new ArrayList<Element>();
Element element;
for (Edge edge: edges) {
for (Edge edge: getEdges()) {
element = new Element("edge");
element.addContent(edge.getConfigXML());
config.add(element);