|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.AbstractMedia
public abstract class AbstractMedia
Something that can be rendered on the media panel.
| Field Summary | |
|---|---|
protected Rectangle |
_bounds
The bounds of the media's rendering area. |
protected long |
_firstTick
The tick stamp associated with our first call to tick(long). |
protected AbstractMediaManager |
_mgr
Our manager. |
protected ObserverList<Object> |
_observers
Our observers. |
protected int |
_renderOrder
The layer in which to render. |
static int |
HUD_LAYER
A _renderOrder value at or above which, indicates that this media is in the HUD
(heads up display) and should not scroll when the view scrolls. |
| Constructor Summary | |
|---|---|
AbstractMedia(Rectangle bounds)
Instantiate an abstract media object. |
|
| Method Summary | |
|---|---|
protected void |
addObserver(Object obs)
Add the specified observer to this media element. |
boolean |
contains(double x,
double y)
|
boolean |
contains(double x,
double y,
double w,
double h)
|
boolean |
contains(Point2D p)
|
boolean |
contains(Rectangle2D r)
|
void |
fastForward(long timeDelta)
Called when the appropriate media manager has been paused for some length of time and is then unpaused. |
Rectangle |
getBounds()
Returns a rectangle containing all the pixels rendered by this media. |
Rectangle2D |
getBounds2D()
|
PathIterator |
getPathIterator(AffineTransform at)
|
PathIterator |
getPathIterator(AffineTransform at,
double flatness)
|
int |
getRenderOrder()
Returns the render order of this media element. |
protected void |
init()
Called when the media has had its manager set. |
void |
init(AbstractMediaManager manager)
Initialize the media. |
boolean |
intersects(double x,
double y,
double w,
double h)
|
boolean |
intersects(Rectangle2D r)
|
void |
invalidate()
Invalidate the media's bounding rectangle for later painting. |
protected void |
invalidateAfterChange(Rectangle obounds)
If this media's size or location are changing, it should create a new rectangle from its old bounds (new Rectangle(_bounds)), then effect the bounds changes and then call this method with the old bounds. |
protected int |
naturalCompareTo(AbstractMedia other)
"Naturally" compares this media with the specified other media (which by definition will have the same render order value). |
abstract void |
paint(Graphics2D gfx)
Called by the appropriate manager to request that the media render itself with the given graphics context. |
void |
queueNotification(ObserverList.ObserverOp<Object> amop)
Queues the supplied notification up to be dispatched to this abstract media's observers. |
protected void |
removeObserver(Object obs)
Remove the specified observer from this media element. |
int |
renderCompareTo(AbstractMedia other)
Compares this media to the specified media by render order. |
void |
setLocation(int x,
int y)
Set the location. |
void |
setRenderOrder(int renderOrder)
Sets the render order associated with this media. |
protected void |
shutdown()
Called by the media manager after the media is removed from service. |
abstract void |
tick(long tickStamp)
Called periodically by this media's manager to give it a chance to do its thing. |
String |
toString()
|
protected void |
toString(StringBuilder buf)
This should be overridden by derived classes (which should be sure to call super.toString()) to append the derived class
specific information to the string buffer. |
void |
viewLocationDidChange(int dx,
int dy)
Called by the AbstractMediaManager when we are in a VirtualMediaPanel that
just scrolled. |
protected void |
willStart(long tickStamp)
Prior to the first call to tick(long) on an abstract media, this method is called by the
AbstractMediaManager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int HUD_LAYER
_renderOrder value at or above which, indicates that this media is in the HUD
(heads up display) and should not scroll when the view scrolls.
protected int _renderOrder
protected Rectangle _bounds
protected AbstractMediaManager _mgr
protected ObserverList<Object> _observers
protected long _firstTick
tick(long).
This is set up automatically in willStart(long).
| Constructor Detail |
|---|
public AbstractMedia(Rectangle bounds)
| Method Detail |
|---|
public abstract void tick(long tickStamp)
tickStamp - a time stamp associated with this tick. Note: this is not obtained
from a call to System.currentTimeMillis() and cannot be compared to timestamps
obtained there from.public abstract void paint(Graphics2D gfx)
public void fastForward(long timeDelta)
public void invalidate()
public void setLocation(int x,
int y)
public Rectangle getBounds()
getBounds in interface Shapepublic Rectangle2D getBounds2D()
getBounds2D in interface Shape
public boolean contains(double x,
double y)
contains in interface Shapepublic boolean contains(Point2D p)
contains in interface Shape
public boolean intersects(double x,
double y,
double w,
double h)
intersects in interface Shapepublic boolean intersects(Rectangle2D r)
intersects in interface Shape
public boolean contains(double x,
double y,
double w,
double h)
contains in interface Shapepublic boolean contains(Rectangle2D r)
contains in interface Shapepublic PathIterator getPathIterator(AffineTransform at)
getPathIterator in interface Shape
public PathIterator getPathIterator(AffineTransform at,
double flatness)
getPathIterator in interface Shapepublic int renderCompareTo(AbstractMedia other)
public void setRenderOrder(int renderOrder)
This method may not be called during a tick.
HUD_LAYERpublic int getRenderOrder()
public void queueNotification(ObserverList.ObserverOp<Object> amop)
public void viewLocationDidChange(int dx,
int dy)
AbstractMediaManager when we are in a VirtualMediaPanel that
just scrolled.
public String toString()
toString in class Objectpublic final void init(AbstractMediaManager manager)
protected void init()
super.init().
protected void willStart(long tickStamp)
tick(long) on an abstract media, this method is called by the
AbstractMediaManager. It is called during the normal tick cycle, immediately prior
to the first call to tick(long).
Note: It is imperative that super.willStart() is called by any
entity that overrides this method because the AbstractMediaManager depends on the
setting of the _firstTick value to know whether or not to call this method.
protected void invalidateAfterChange(Rectangle obounds)
_bounds to this method. The rectangle passed in will be
modified and then passed on to the region manager which will modify it further.
protected void shutdown()
super.shutdown().
protected void addObserver(Object obs)
protected void removeObserver(Object obs)
protected int naturalCompareTo(AbstractMedia other)
Object.hashCode() which is not consistent across VM invocations.
protected void toString(StringBuilder buf)
super.toString()) to append the derived class
specific information to the string buffer.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||