Class ncsa.horizon.viewer.SimpleViewer
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.viewer.SimpleViewer

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----ncsa.horizon.viewer.Viewer
                                   |
                                   +----ncsa.horizon.viewer.SimpleViewer

public class SimpleViewer
extends Viewer
implements Cloneable
Panel class to display an ncsa.horizon.viewable.Viewable object. This implementation is an fairly simple Java Canvas, with three basic options for Canvas/Image sizing.

Variable Index

 o SIZE_IMAGE_CENTER
Trim the image to the Viewer size (centered)
 o SIZE_IMAGE_FIT
Fit the image to the Viewer size (default)
 o SIZE_IMAGE_TRUNCATE
Trim the image to the Viewer size (centered)

Constructor Index

 o SimpleViewer()
Create a new instance of a SimpleViewer.

Method Index

 o addViewable(Viewable)
This method adds a reference to a viewable object.
 o clone()
Create a clone of this Viewer Panel.
 o displaySlice()
Display a default slice of the current Viewable.
 o displaySlice(Slice)
Display a slice from the current Viewable data, or do nothing if the current Viewable is not set.
 o getDisplaySize()
This method returns the size of the region that displays a Viewable
 o getViewable()
Return a reference to the current Viewable object, or null if none are attached to this Viewer.
 o getViewSlice()
Return a Slice object describing the data currently being viewed, or null if there is no Viewable currently being viewed.
 o imageUpdate(Image, int, int, int, int, int)
This implementation simple issues a repaint() when an image has become available.
 o paint(Graphics)
This implementationm simplyt calls the update() method.
 o setMode(int)
Set the display mode for sizing or trimming the viewable image.
 o update(Graphics)
Redraw current slice/viewable.

Variables

 o SIZE_IMAGE_FIT
  public final static int SIZE_IMAGE_FIT
Fit the image to the Viewer size (default)
 o SIZE_IMAGE_CENTER
  public final static int SIZE_IMAGE_CENTER
Trim the image to the Viewer size (centered)
 o SIZE_IMAGE_TRUNCATE
  public final static int SIZE_IMAGE_TRUNCATE
Trim the image to the Viewer size (centered)

Constructors

 o SimpleViewer
  public SimpleViewer()
Create a new instance of a SimpleViewer. The default display mode is SIZE_IMAGE_CENTER, which centers the image in the panel without resizing the image.

Methods

 o addViewable
  public void addViewable(Viewable image)
This method adds a reference to a viewable object.
Parameters:
image - the Viewable object to be added
Overrides:
addViewable in class Viewer
 o getViewable
  public Viewable getViewable()
Return a reference to the current Viewable object, or null if none are attached to this Viewer.
Returns:
The current Viewable object; null if none present.
Overrides:
getViewable in class Viewer
 o displaySlice
  public void displaySlice(Slice sl)
Display a slice from the current Viewable data, or do nothing if the current Viewable is not set. A null slice means display the default slice.
Overrides:
displaySlice in class Viewer
 o displaySlice
  public void displaySlice()
Display a default slice of the current Viewable.
Overrides:
displaySlice in class Viewer
 o getViewSlice
  public Slice getViewSlice()
Return a Slice object describing the data currently being viewed, or null if there is no Viewable currently being viewed. This implementation always returns null.
Returns:
The currently displayed Slice object; null if none present.
Overrides:
getViewSlice in class Viewer
 o getDisplaySize
  public Dimension getDisplaySize()
This method returns the size of the region that displays a Viewable
Returns:
Dimension of the compoonent
Overrides:
getDisplaySize in class Viewer
See Also:
Dimension, size()
 o clone
  public Object clone() throws CloneNotSupportedException
Create a clone of this Viewer Panel.
Returns:
A clone of this object.
Throws: CloneNotSupportedException
Occurs if the superclass has not implemented the clone() method.
Overrides:
clone in class Viewer
 o update
  public void update(Graphics g)
Redraw current slice/viewable.
Parameters:
g - The graphics context to paint.
Overrides:
update in class Component
 o imageUpdate
  public boolean imageUpdate(Image img,
                             int flags,
                             int x,
                             int y,
                             int w,
                             int h)
This implementation simple issues a repaint() when an image has become available.
Overrides:
imageUpdate in class Component
 o paint
  public void paint(Graphics g)
This implementationm simplyt calls the update() method.
Parameters:
g - The graphics context to paint.
Overrides:
paint in class Component
 o setMode
  public void setMode(int _mode)
Set the display mode for sizing or trimming the viewable image.
Parameters:
_mode - The mode to use. Valid modes are SIZE_IMAGE_FIT, SIZE_IMAGE_CENTER, and SIZE_IMAGE_TRUNCATE.

All Packages  Class Hierarchy  This Package  Previous  Next  Index