visual
Class Visualization

java.lang.Object
  extended by visual.Visualization
Direct Known Subclasses:
Screen, Stage

public class Visualization
extends java.lang.Object

A collection of Content objects to be rendered (and a collection of GUI components that will render them)

See Also:
"The Design and Implementation of Multimedia Software © 2011"

Constructor Summary
Visualization()
          Default Constructor
 
Method Summary
 void add(SimpleContent r)
          Add a SimpleContent to the "front" of this Visualization Note: This method only adds the SimpleContent if it is not already in the Visualization.
 void addKeyListener(java.awt.event.KeyListener kl)
          Add a KeyListener
 void addMouseListener(java.awt.event.MouseListener ml)
          Add a MouseListener
 void addMouseMotionListener(java.awt.event.MouseMotionListener mml)
          Add a MouseMotionListener
 void addView(VisualizationView view)
          Add a view to this Visualization
 void clear()
          Clear this Visualization of all SimpleContent objects
protected  VisualizationView createDefaultView()
          Create the default view associated with this Visualization Note: This method should only be called by constructors.
 VisualizationView getView()
          Get the "main" view (i.e., the "main" VisualizationView that is used to present the SimpleContent objects) associated with this Visualization.
 java.util.Iterator<VisualizationView> getViews()
          Get all of the views associated with this Visualization
 java.util.Iterator<SimpleContent> iterator()
          Get an Iterator that contains all of the SimpleContent objects
 void remove(SimpleContent r)
          Remove the given SimpleContent from this Canvas
 void removeKeyListener(java.awt.event.KeyListener kl)
          Remove a KeyListener
 void removeMouseListener(java.awt.event.MouseListener ml)
          Remove a MouseListener
 void removeMouseMotionListener(java.awt.event.MouseMotionListener mml)
          Remove a MouseMotionListener
 void removeView(VisualizationView view)
          Remove a view from this Visualization
protected  void repaint()
          Repaint the view(s) assocaited with this Visualization
 void setBackground(java.awt.Color background)
          Set the background color Note: If you want to have a background image just make it the first SimpleContent
 void setView(VisualizationView view)
          Change the "main" view associated with this Visualization Note: A visualization can actually have multiple views associated with it.
 void toBack(SimpleContent r)
          Move the given SimpleContent to the "back" Note: The SimpleContent must have already been added for this method to have an effect.
 void toFront(SimpleContent r)
          Move the given SimpleContent to the "front".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Visualization

public Visualization()
Default Constructor

Method Detail

add

public void add(SimpleContent r)
Add a SimpleContent to the "front" of this Visualization Note: This method only adds the SimpleContent if it is not already in the Visualization. However, the "underlying" content (e.g., BufferedImage, Shape) in two different SimpleContent objects can be the same. To change the order of a SimpleContent that is already on the canvas use toBack() or toFront().

Parameters:
r - The SimpleContent to add

addKeyListener

public void addKeyListener(java.awt.event.KeyListener kl)
Add a KeyListener

Parameters:
kl - The listener to add

addMouseListener

public void addMouseListener(java.awt.event.MouseListener ml)
Add a MouseListener

Parameters:
ml - The listener to add

addMouseMotionListener

public void addMouseMotionListener(java.awt.event.MouseMotionListener mml)
Add a MouseMotionListener

Parameters:
mml - The listener to add

addView

public void addView(VisualizationView view)
Add a view to this Visualization

Parameters:
view - The view to add

clear

public void clear()
Clear this Visualization of all SimpleContent objects


createDefaultView

protected VisualizationView createDefaultView()
Create the default view associated with this Visualization Note: This method should only be called by constructors. It should be overridden by derived classes that need to use a specialized view


getView

public VisualizationView getView()
Get the "main" view (i.e., the "main" VisualizationView that is used to present the SimpleContent objects) associated with this Visualization. Note: A visualization can actually have multiple views associated with it. This is a convenience method that can be used when there is only one such view.

Returns:
The view

getViews

public java.util.Iterator<VisualizationView> getViews()
Get all of the views associated with this Visualization

Returns:
The views

iterator

public java.util.Iterator<SimpleContent> iterator()
Get an Iterator that contains all of the SimpleContent objects

Returns:
The SimpleContent objects

remove

public void remove(SimpleContent r)
Remove the given SimpleContent from this Canvas

Parameters:
r - The SimpleContent to remove

removeKeyListener

public void removeKeyListener(java.awt.event.KeyListener kl)
Remove a KeyListener

Parameters:
kl - The listener to remove

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener ml)
Remove a MouseListener

Parameters:
ml - The listener to remove

removeMouseMotionListener

public void removeMouseMotionListener(java.awt.event.MouseMotionListener mml)
Remove a MouseMotionListener

Parameters:
mml - The listener to remove

removeView

public void removeView(VisualizationView view)
Remove a view from this Visualization

Parameters:
view - The view to remove

repaint

protected void repaint()
Repaint the view(s) assocaited with this Visualization


setBackground

public void setBackground(java.awt.Color background)
Set the background color Note: If you want to have a background image just make it the first SimpleContent

Parameters:
background - The background color

setView

public void setView(VisualizationView view)
Change the "main" view associated with this Visualization Note: A visualization can actually have multiple views associated with it. This is a convenience method that can be used when there is only one such view.

Parameters:
view - The new view to use as the "main" view

toBack

public void toBack(SimpleContent r)
Move the given SimpleContent to the "back" Note: The SimpleContent must have already been added for this method to have an effect.

Parameters:
r - The SimpleContent to move to the back

toFront

public void toFront(SimpleContent r)
Move the given SimpleContent to the "front". Note: The SimpleContent must have already been added for this method to have an effect.

Parameters:
r - The SimpleContent to move to the front


Design and Implementation of Multimedia Software, Jones and Bartlett Publishers