JHotDraw 7.3.1

org.jhotdraw.draw
Interface ImageHolderFigure

All Superinterfaces:
java.lang.Cloneable, DOMStorable, Figure, java.io.Serializable
All Known Implementing Classes:
ImageFigure, SVGImageFigure

public interface ImageHolderFigure
extends Figure

The interface of a Figure which has some editable image contents.

The ImageTool can be used to create figures which implement this interface.


Design Patterns

Framework
The ImageTool and the ImageHolderFigure define the contracts of a smaller framework inside of the JHotDraw framework for structured drawing editors.
Contract: ImageHolderFigure, ImageTool.

Prototype
The ImageTool creates new figures by cloning a prototype ImageHolderFigure object.
Prototype: ImageHolderFigure; Client: ImageTool.


Version:
$Id: ImageHolderFigure.java 527 2009-06-07 14:28:19Z rawcoder $
Author:
Werner Randelshofer

Method Summary
 java.awt.image.BufferedImage getBufferedImage()
          Gets the buffered image from the figure.
 byte[] getImageData()
          Gets the image data.
 void loadImage(java.io.File f)
          Loads an image from a File.
 void loadImage(java.io.InputStream in)
          Loads an image from an Input Stream.
 void setBufferedImage(java.awt.image.BufferedImage image)
          Sets the buffered image for the figure.
 void setImage(byte[] imageData, java.awt.image.BufferedImage bufferedImage)
          Sets the image.
 
Methods inherited from interface org.jhotdraw.draw.Figure
addFigureListener, addNotify, canConnect, changed, clone, contains, createHandles, draw, findCompatibleConnector, findConnector, findFigureInside, get, getActions, getAttributes, getAttributesRestoreData, getBounds, getConnectors, getCursor, getDecomposition, getDrawingArea, getEndPoint, getLayer, getPreferredSize, getStartPoint, getTool, getToolTipText, getTransformRestoreData, handleDrop, handleMouseClick, includes, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removeNotify, requestRemove, restoreAttributesTo, restoreTransformTo, set, setBounds, transform, willChange
 
Methods inherited from interface org.jhotdraw.xml.DOMStorable
read, write
 

Method Detail

loadImage

void loadImage(java.io.File f)
               throws java.io.IOException
Loads an image from a File. By convention this method is never invoked on the AWT Event Dispatcher Thread.

Throws:
java.io.IOException

loadImage

void loadImage(java.io.InputStream in)
               throws java.io.IOException
Loads an image from an Input Stream. By convention this method is never invoked on the AWT Event Dispatcher Thread.

Throws:
java.io.IOException

getBufferedImage

java.awt.image.BufferedImage getBufferedImage()
Gets the buffered image from the figure.


setBufferedImage

void setBufferedImage(java.awt.image.BufferedImage image)
Sets the buffered image for the figure.


setImage

void setImage(byte[] imageData,
              java.awt.image.BufferedImage bufferedImage)
              throws java.io.IOException
Sets the image.

Parameters:
imageData - The image data. If this is null, a buffered image must be provided.
bufferedImage - An image constructed from the imageData. If this is null, imageData must be provided.
Throws:
java.io.IOException

getImageData

byte[] getImageData()
Gets the image data.

Returns:
imageData The image data, or null, if the ImageHolderFigure does not have an image.

Copyright 1996-2009 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.