|
MATES 3.0-rc2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.mates.ui.graphical.DefaultTopologyVisualizer
JPanel that is used by default for drawing the topology. This
class may be extended to have customized topology drawing. For an
example of how to save a screenshot of the visualized topology, see
TopologyVisualizer
.
Nested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
protected java.awt.Font |
host_font
The font with which hosts' names are drawn. |
protected java.awt.Color |
host_highlight_color
The color in which hosts are highlighted. |
protected java.awt.Color |
tool_tip_color
The color in which a non-highlighted host's tooltip is drawn. |
protected int[] |
xlocation
Contains the x coordinate of where each host is
drawn in the graphics object. |
protected int[] |
ylocation
Contains the y coordinate of where each host is
drawn in the graphics object. |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
DefaultTopologyVisualizer()
Constructs a new DefaultTopologyVisualizer. |
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)
Finds the host closest to a point. |
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 |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
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. |
protected void |
paintHighlightToolTip(java.awt.Graphics graphics,
java.lang.String text,
int x,
int y)
Callback function for drawing a tool tip for a highlighted host. |
protected void |
paintHosts(java.awt.Graphics graphics,
Topology topology,
double[][] network)
Callback function for drawing the hosts. |
protected void |
paintLinks(java.awt.Graphics graphics,
Topology topology,
double[][] network)
Callback function for painting the links (i.e. edges) in the network. |
protected void |
paintRadioRanges(java.awt.Graphics graphics,
Topology topology,
double[][] network,
Host tool_tip_host,
Host highlighted_host)
Callback function for drawing the radio ranges. |
protected void |
paintScale(java.awt.Graphics graphics,
int width)
Callback function for painting the "scale" legend on the topology. |
protected void |
paintToolTip(java.awt.Graphics graphics,
java.lang.String text,
int x,
int y)
Callback function for drawing a tool tip. |
protected void |
paintTopology(java.awt.Graphics g,
int width,
int height)
Callback function for drawing the topology. |
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. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int[] xlocation
x
coordinate of where each host is
drawn in the graphics object. May be null
.
protected int[] ylocation
y
coordinate of where each host is
drawn in the graphics object. May be null
.
protected java.awt.Font host_font
protected java.awt.Color host_highlight_color
protected java.awt.Color tool_tip_color
Constructor Detail |
public DefaultTopologyVisualizer()
Method Detail |
public void paint(java.awt.Graphics graphics)
TopologyVisualizer
paint(graphics, true)
.
paint
in interface TopologyVisualizer
public void paint(java.awt.Graphics graphics, boolean double_buffer)
TopologyVisualizer
paint
in interface TopologyVisualizer
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void setViewScale(boolean view_scale)
TopologyVisualizer
setViewScale
in interface TopologyVisualizer
public void setDrawRadioRanges(boolean draw_radio_ranges)
TopologyVisualizer
setDrawRadioRanges
in interface TopologyVisualizer
public boolean getDrawRadioRanges()
TopologyVisualizer
getDrawRadioRanges
in interface TopologyVisualizer
public boolean getViewScale()
TopologyVisualizer
getViewScale
in interface TopologyVisualizer
public void highlightHost(Host host)
TopologyVisualizer
highlightHost
in interface TopologyVisualizer
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public boolean isPainting()
TopologyVisualizer
true
if and only if the topology is
currently being painted.
isPainting
in interface TopologyVisualizer
public void setSimulator(Simulator simulator)
TopologyVisualizer
setSimulator
in interface TopologyVisualizer
protected void paintRadioRanges(java.awt.Graphics graphics, Topology topology, double[][] network, Host tool_tip_host, Host highlighted_host)
Host.paintRadioRange(java.awt.Graphics, boolean,
boolean)
for each host in the network.
tool_tip_host
- the host for which a tool tip is to be drawn; may be null
.highlighted_host
- the currently-highlighted host; may be null
.protected void paintHosts(java.awt.Graphics graphics, Topology topology, double[][] network)
Host.paint(java.awt.Graphics)
for
each host in the network.
protected void paintLinks(java.awt.Graphics graphics, Topology topology, double[][] network)
protected void paintToolTip(java.awt.Graphics graphics, java.lang.String text, int x, int y)
protected void paintHighlightToolTip(java.awt.Graphics graphics, java.lang.String text, int x, int y)
protected void paintScale(java.awt.Graphics graphics, int width)
width
- the width of the topology being painted.protected void paintTopology(java.awt.Graphics g, int width, int height)
paintRadioRanges(java.awt.Graphics, org.mates.sim.network.Topology, double[][], org.mates.sim.Host, org.mates.sim.Host)
paintLinks(java.awt.Graphics, org.mates.sim.network.Topology, double[][])
paintHosts(java.awt.Graphics, org.mates.sim.network.Topology, double[][])
paintToolTip(java.awt.Graphics, java.lang.String, int, int)
paintHighlightToolTip(java.awt.Graphics, java.lang.String, int, int)
paintScale(java.awt.Graphics, int)
public Host getHostAt(int x, int y, int radius)
getHostAt
in interface TopologyVisualizer
x
,
y
), within a radius of radius
pixels.
Returns null
if no such host exists.public java.awt.Component getGUI()
TopologyVisualizer
JFrame
.
getGUI
in interface TopologyVisualizer
|
MATES 3.0-rc2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |