JHotDraw 6.0b1

org.jhotdraw.figures
Class ImageFigure

java.lang.Object
  extended by org.jhotdraw.standard.AbstractFigure
      extended by org.jhotdraw.figures.AttributeFigure
          extended by org.jhotdraw.figures.ImageFigure
All Implemented Interfaces:
java.awt.image.ImageObserver, java.io.Serializable, java.lang.Cloneable, Figure, Storable

public class ImageFigure
extends AttributeFigure
implements java.awt.image.ImageObserver

A Figure that shows an Image. Images shown by an image figure are shared by using the Iconkit.

See Also:
Iconkit, Serialized Form

Field Summary
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ImageFigure()
           
ImageFigure(java.awt.Image image, java.lang.String fileName, java.awt.Point origin)
           
 
Method Summary
 void basicDisplayBox(java.awt.Point origin, java.awt.Point corner)
          Sets the display box of a figure.
protected  void basicMoveBy(int x, int y)
          Moves the figure.
 java.awt.Rectangle displayBox()
          Gets the display box of a figure.
 void draw(java.awt.Graphics g)
          Draws the figure in the given graphics.
 HandleEnumeration handles()
          Returns the handles of a Figure that can be used to manipulate some of its attributes.
 boolean imageUpdate(java.awt.Image img, int flags, int x, int y, int w, int h)
          Handles asynchroneous image updates.
 void read(StorableInput dr)
          Reads the ImageFigure from a StorableInput.
 void release()
          Releases a figure's resources.
 void write(StorableOutput dw)
          Writes the ImageFigure to a StorableOutput.
 
Methods inherited from class org.jhotdraw.figures.AttributeFigure
drawBackground, drawFrame, getAttribute, getAttribute, getDefaultAttribute, getDefaultAttribute, getFillColor, getFrameColor, initDefaultAttribute, setAttribute, setAttribute, setDefaultAttribute
 
Methods inherited from class org.jhotdraw.standard.AbstractFigure
addDependendFigure, addFigureChangeListener, addToContainer, canConnect, center, changed, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, figures, findFigureInside, getDecoratedFigure, getDependendFigures, getTextHolder, getZValue, includes, invalidate, invalidateRectangle, isEmpty, listener, moveBy, removeDependendFigure, removeFigureChangeListener, removeFromContainer, setZValue, size, visit, willChange
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageFigure

public ImageFigure()

ImageFigure

public ImageFigure(java.awt.Image image,
                   java.lang.String fileName,
                   java.awt.Point origin)
Method Detail

basicDisplayBox

public void basicDisplayBox(java.awt.Point origin,
                            java.awt.Point corner)
Description copied from class: AbstractFigure
Sets the display box of a figure. This is the method that subclassers override. Clients usually call displayBox.

Specified by:
basicDisplayBox in interface Figure
Specified by:
basicDisplayBox in class AbstractFigure
Parameters:
origin - the new origin
corner - the new corner
See Also:
AbstractFigure.displayBox(java.awt.Point, java.awt.Point)

handles

public HandleEnumeration handles()
Description copied from class: AbstractFigure
Returns the handles of a Figure that can be used to manipulate some of its attributes.

Specified by:
handles in interface Figure
Specified by:
handles in class AbstractFigure
Returns:
a type-safe iterator of handles
See Also:
Handle

displayBox

public java.awt.Rectangle displayBox()
Description copied from class: AbstractFigure
Gets the display box of a figure.

Specified by:
displayBox in interface Figure
Specified by:
displayBox in class AbstractFigure
See Also:
Figure.basicDisplayBox(java.awt.Point, java.awt.Point)

basicMoveBy

protected void basicMoveBy(int x,
                           int y)
Description copied from class: AbstractFigure
Moves the figure. This is the method that subclassers override. Clients usually call displayBox.

Specified by:
basicMoveBy in class AbstractFigure
See Also:
AbstractFigure.moveBy(int, int)

draw

public void draw(java.awt.Graphics g)
Description copied from class: AttributeFigure
Draws the figure in the given graphics. Draw is a template method calling drawBackground followed by drawFrame.

Specified by:
draw in interface Figure
Overrides:
draw in class AttributeFigure
Parameters:
g - the Graphics to draw into

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int flags,
                           int x,
                           int y,
                           int w,
                           int h)
Handles asynchroneous image updates.

Specified by:
imageUpdate in interface java.awt.image.ImageObserver

release

public void release()
Releases a figure's resources. Release is called when a figure is removed from a drawing. Informs the listeners that the figure is removed by calling figureRemoved.

Specified by:
release in interface Figure
Overrides:
release in class AbstractFigure
See Also:
Figure.release()

write

public void write(StorableOutput dw)
Writes the ImageFigure to a StorableOutput. Only a reference to the image, that is its pathname is saved.

Specified by:
write in interface Storable
Overrides:
write in class AttributeFigure

read

public void read(StorableInput dr)
          throws java.io.IOException
Reads the ImageFigure from a StorableInput. It registers the referenced figure to be loaded from the Iconkit.

Specified by:
read in interface Storable
Overrides:
read in class AttributeFigure
Throws:
java.io.IOException
See Also:
Iconkit.registerImage(java.lang.String)

JHotDraw 6.0b1