MATES 3.0-rc2

org.mates.ui.graphical
Interface TopologyVisualizer

All Known Implementing Classes:
DefaultTopologyVisualizer

public interface TopologyVisualizer

Interface for drawing the topology.
To save a screenshot of the topology, you need an implementation of this interface, such as DefaultTopologyVisualizer. For example,

 private class ScreenshotProvider extends DefaultTopologyVisualizer
 {
     public ScreenshotProvider(org.mates.sim.Simulator simulator) {
         super();
         setSimulator(simulator);
     }
     public void paint(java.awt.Graphics g) {
         super.paint(g, false); // we shouldn't double-buffer by default!
     }
 }

 boolean saveTopologyScreenshot(org.mates.sim.Simulator simulator, Java.io.File saveFile) 
 throws java.lang.IllegalArgumentException,
        java.lang.ClassNotFoundException,
        java.io.IOException
 {
     ScreenshotProvider sp = new ScreenshotProvider(simulator);
     sp.setSize(new java.awt.Dimension(simulator.getDomainWidth(), simulator.getDomainHeight()));
     return org.mates.util.Screenshot.saveScreenshot(sp, sp.getWidth(), sp.getHeight(), saveFile);
 }
 

Author:
Evan Sultanik

Method Summary
 boolean getDrawRadioRanges()
          Returns whether or not radio ranges will be drawn.
 java.awt.Component getGUI()
          Returns the GUI component associated with this visualizer.
 Host getHostAt(int x, int y, int radius)
          Returns true if and only if a host exists within radius pixels of the coordinate (x, y).
 boolean getViewScale()
          Returns whether or not a scale is drawn for the topology.
 void highlightHost(Host host)
          Highlights a host in the topology.
 boolean isPainting()
          Returns true if and only if the topology is currently being painted.
 void paint(java.awt.Graphics graphics)
          Paints the topology, using double-buffering.
 void paint(java.awt.Graphics graphics, boolean double_buffer)
          Paints the topology, with optional double-buffering.
 void setDrawRadioRanges(boolean draw_radio_ranges)
          Sets whether or not radio ranges of hosts are drawn.
 void setSimulator(Simulator simulator)
          Sets the simulator associated with this visualizer.
 void setViewScale(boolean view_scale)
          Sets whether or not a scale is drawn for the topology.
 

Method Detail

paint

public void paint(java.awt.Graphics graphics)
Paints the topology, using double-buffering. This should be equivalent to paint(graphics, true).


paint

public void paint(java.awt.Graphics graphics,
                  boolean double_buffer)
Paints the topology, with optional double-buffering.


setViewScale

public void setViewScale(boolean view_scale)
Sets whether or not a scale is drawn for the topology.


setDrawRadioRanges

public void setDrawRadioRanges(boolean draw_radio_ranges)
Sets whether or not radio ranges of hosts are drawn.


getDrawRadioRanges

public boolean getDrawRadioRanges()
Returns whether or not radio ranges will be drawn.


getViewScale

public boolean getViewScale()
Returns whether or not a scale is drawn for the topology.


highlightHost

public void highlightHost(Host host)
Highlights a host in the topology. This will usually be called when a host is clicked or selected in the Hosts tab.


isPainting

public boolean isPainting()
Returns true if and only if the topology is currently being painted.


setSimulator

public void setSimulator(Simulator simulator)
Sets the simulator associated with this visualizer.


getHostAt

public Host getHostAt(int x,
                      int y,
                      int radius)
Returns true if and only if a host exists within radius pixels of the coordinate (x, y).


getGUI

public java.awt.Component getGUI()
Returns the GUI component associated with this visualizer. Usually, this component will be a JFrame.


MATES 3.0-rc2

Submit a bug or request a feature
http://mates.sourceforge.net/

Copyright 2004 Evan Sultanik