    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.

##

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

##

SimpleViewer()
  Create a new instance of a SimpleViewer.

##

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

##

SIZE_IMAGE_FIT

      public final static int SIZE_IMAGE_FIT

  Fit the image to the Viewer size (default)

SIZE_IMAGE_CENTER

      public final static int SIZE_IMAGE_CENTER

  Trim the image to the Viewer size (centered)

SIZE_IMAGE_TRUNCATE

      public final static int SIZE_IMAGE_TRUNCATE

  Trim the image to the Viewer size (centered)

##

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.

##

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

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

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

displaySlice

      public void displaySlice()

  Display a default slice of the current Viewable.
  Overrides:
    displaySlice in class Viewer

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

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()

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

update

      public void update(Graphics g)

  Redraw current slice/viewable.
  Parameters:
    g - The graphics context to paint.
  Overrides:
    update in class Component

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

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

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