com.sas.visuals
Class ImageAnimation

com.sas.visuals.ImageAnimation
All Implemented Interfaces:
com.sas.awt.print.PrintableInterface, VisualInterface, com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.collection.ContentsChangedListener, com.sas.ComponentInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, com.sas.PublicClonable, AlarmListener, com.sas.ViewDefaultModelInterface, com.sas.ViewInterface, com.sas.visuals.IconInterface, MultipleValueEventSourceInterface, com.sas.visuals.PainterInterface, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class ImageAnimation
implements com.sas.collection.ContentsChangedListener, com.sas.ViewDefaultModelInterface

ImageAnimation is a class that increments and decrements an ImageAnimationIcon object when an alarm is fired and paints the image in that state. The ImageAnimationIcon displays .jpg or .gif image files. The images can be scrolled or flipped through in several directions. The model is an ordered list of image file names.

Notes:


See Also:
AnimationIconInterface, AnimationIconView, ImageAnimationIcon, Serialized Form

Field Summary
protected  com.sas.collection.OrderedCollection defaultSequenceModel
          OrderedCollection of images to be in the sequence of the animation
protected  ImageAnimationIcon imgAnimation
          ImageAnimationIcon object that is to be displayed and manipulated
static java.lang.String RB_KEY
           
 
Fields inherited from class com.sas.visuals.AnimationIconView
alarm, animationIcon, decrement, running
 
Fields inherited from class com.sas.visuals.IconView
icon
 
Constructor Summary
ImageAnimation()
          Default constructor.
 
Method Summary
 void contentsChanged(com.sas.collection.ContentsChangedEvent evt)
          Called when the contents of the model have changed.
protected  AnimationIconView createIconObject(AnimationIconView icon)
          Creates a clone of itself and sets the properties of the ImageAnimationIcon, which is part of the AnimationIconView object.
 void detachModel(com.sas.ModelInterface model)
          Detach the model from the ImageAnimation.
static int getDefaultHeight()
          Returns the default height in pixels
static int getDefaultWidth()
          Returns the default width in pixels
 int getDirection()
          Gets the direction the images will scroll in if imageScroll property is true.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
          Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about this ImageAnimation.
 java.lang.String[] getImageSequence()
          Returns the sequence of file names for the images to be displayed.
 java.net.URL[] getImageURLSequence()
          Returns the sequence of file names for the images to be displayed.
 java.util.Vector getRequiredInterfaces()
          Returns the required interfaces Vector for this component.
 int getScrollingSpeed()
          Gets the speed at which the images will scroll.
 boolean isDefaultModelAttached()
          Indicates whether defaultModel is attached or not
 boolean isImageScroll()
          Returns if the images are supposed to scroll over the area of the ImageAnimation component.
 boolean isSourceAppletRelative()
           
 void refresh(com.sas.ModelInterface model)
          Refresh the images from the model list of image file names.
protected  void refreshSequence(com.sas.collection.StaticOrderedCollectionInterface model)
          Refresh the sequence of images from a specified collection object.
 void setAnimationIcon(AnimationIconInterface animIcon)
          Sets the AnimationIconInterface object to be incremented/decremented and painted.
 void setBounds(int x, int y, int width, int height)
          Sets the bounds of the ImageAnimation component.
static void setDefaultHeight(int newHeight)
          Sets the default height in pixels
 void setDefaultValues()
          Sets the default internal values for the ImageAnimation.
static void setDefaultWidth(int newWidth)
          Sets the default width in pixels
 void setDirection(int d)
          Sets the direction the images will scroll in if imageScroll property is true.
 void setImageScroll(boolean s)
          Sets the images to scroll if set to true.
 void setImageSequence(java.lang.String[] sources)
          Sets the sequence of file names for the images to be displayed.
 void setImageURLSequence(java.net.URL[] sources)
          Sets the sequence of file names for the images to be displayed.
 void setScrollingSpeed(int s)
          Sets the speed at which the images will scroll.
 void setSourceAppletRelative(boolean b)
          Sets the source to be relative to the applet location.
 
Methods inherited from class com.sas.visuals.AnimationIconView
clone, fireAlarm, getAlarm, getAnimationIcon, isDecrement, isRunning, setAlarm, setDecrement, setRunning, start, stop
 
Methods inherited from class com.sas.visuals.IconView
computePreferredSize, getIcon, getInsets, paint, paint, setIcon, update
 
Methods inherited from class com.sas.awt.Component
getMinimumSize
 
Methods inherited from class com.sas.awt.ComponentVisualComponent
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getBackgroundColor, getBorder, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getFont, getForegroundColor, getHeight, getHorizontalPosition, getLinkInfo, getModelInterface, getPageBounds, getPreferredSize, getPrePainter, getPrintOptionsPanel, getVerticalPosition, getViewInterfaceSupportInfo, getVisualInterfaceSupportInfo, getWidth, initialize, initializeComponent, isDesignTime, isEnabled, isFocus, isLinked, isTransparent, isVisible, pageExists, print, printFinalize, printInitialize, propertyChange, queryLinks, queryLinks, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setBackgroundColor, setBorder, setComponentDescription, setComponentSupportInfo, setEnabled, setFocus, setFont, setForegroundColor, setHeight, setHorizontalPosition, setLinkInfo, setModelInterface, setPreferredSize, setPrePainter, setRequiredInterfaces, setTransparent, setVerticalPosition, setViewInterfaceSupportInfo, setVisible, setVisualInterfaceSupportInfo, setWidth, superGetFont, superGetMinimumSize, superGetPreferredSize, superIsEnabled, superIsVisible, superPaint, superSetBounds, superSetEnabled, superSetFont, superSetVisible, superUpdate, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject
 
Methods inherited from interface com.sas.visuals.IconInterface
getPreferredSize
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

imgAnimation

protected transient ImageAnimationIcon imgAnimation
ImageAnimationIcon object that is to be displayed and manipulated


defaultSequenceModel

protected com.sas.collection.OrderedCollection defaultSequenceModel
OrderedCollection of images to be in the sequence of the animation

Constructor Detail

ImageAnimation

public ImageAnimation()
Default constructor.

Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about this ImageAnimation.

Returns:
the ExtendedBeanInfo for this class

getDefaultHeight

public static int getDefaultHeight()
Returns the default height in pixels

Returns:
pixel value of the default height
See Also:
setDefaultHeight(int)

getDefaultWidth

public static int getDefaultWidth()
Returns the default width in pixels

Returns:
pixel value of default width
See Also:
setDefaultWidth(int)

setDefaultHeight

public static void setDefaultHeight(int newHeight)
Sets the default height in pixels

Parameters:
newHeight - the desired default height in pixels
See Also:
getDefaultHeight()

setDefaultWidth

public static void setDefaultWidth(int newWidth)
Sets the default width in pixels

Parameters:
newWidth - the desired default width in pixels
See Also:
setDefaultWidth(int)

getRequiredInterfaces

public java.util.Vector getRequiredInterfaces()
Returns the required interfaces Vector for this component.

Specified by:
getRequiredInterfaces in interface com.sas.ViewInterface
Overrides:
getRequiredInterfaces in class ComponentVisualComponent
Returns:
the required interfaces Vector for this component.
See Also:
ViewInterface.getRequiredInterfaces()

isDefaultModelAttached

public boolean isDefaultModelAttached()
Indicates whether defaultModel is attached or not

Specified by:
isDefaultModelAttached in interface com.sas.ViewDefaultModelInterface
Returns:
true if the component is using the default model, and false otherwise.

isImageScroll

public boolean isImageScroll()
Returns if the images are supposed to scroll over the area of the ImageAnimation component.

Returns:
whether or not the image animation is scrolling or stopped
See Also:
setImageScroll(boolean)

setImageScroll

public void setImageScroll(boolean s)
Sets the images to scroll if set to true.

Parameters:
s - if true the images will scroll over the component area; otherwise the images will be displayed in sequence in the same position.
See Also:
isImageScroll()

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Sets the bounds of the ImageAnimation component.

Specified by:
setBounds in interface VisualInterface
Overrides:
setBounds in class ComponentVisualComponent
See Also:
ComponentVisualComponent.setBounds(int, int, int, int)

getDirection

public int getDirection()
Gets the direction the images will scroll in if imageScroll property is true. The values can be: BOTTOM_TO_TOP, LEFT_TO_RIGHT, RIGHT_TO_LEFT, or TOP_TO_BOTTOM

Returns:
a com.sas.visuals.Direction value
See Also:
setDirection(int)

setDirection

public void setDirection(int d)
Sets the direction the images will scroll in if imageScroll property is true.

Parameters:
d - one of the Direction values. The values can be: BOTTOM_TO_TOP, LEFT_TO_RIGHT, RIGHT_TO_LEFT, or TOP_TO_BOTTOM
See Also:
getDirection()

getScrollingSpeed

public int getScrollingSpeed()
Gets the speed at which the images will scroll. The speed returned is an int specifying the number of pixels the images will shift each time the alarm is fired.

Returns:
the number of pixels the image shifts per alarm fire.

setScrollingSpeed

public void setScrollingSpeed(int s)
Sets the speed at which the images will scroll.

Parameters:
s - the number of pixels the images should chift every time the alarm is fired.

contentsChanged

public void contentsChanged(com.sas.collection.ContentsChangedEvent evt)
Called when the contents of the model have changed.

Specified by:
contentsChanged in interface com.sas.collection.ContentsChangedListener
Parameters:
evt - the ContentsChangedEvent from the model that changed.

createIconObject

protected AnimationIconView createIconObject(AnimationIconView icon)
Creates a clone of itself and sets the properties of the ImageAnimationIcon, which is part of the AnimationIconView object. Called by super in AnimationIconView during cloning.

Overrides:
createIconObject in class AnimationIconView
Returns:
copy of the AnimationIconView Object passed in, with new properties.

detachModel

public void detachModel(com.sas.ModelInterface model)
Detach the model from the ImageAnimation.

Specified by:
detachModel in interface com.sas.ViewInterface
Overrides:
detachModel in class ComponentVisualComponent
Parameters:
model - ModelInterface object to be removed from this ImageAnimation object
See Also:
ViewInterface.detachModel(com.sas.ModelInterface)

refresh

public void refresh(com.sas.ModelInterface model)
Refresh the images from the model list of image file names.

Specified by:
refresh in interface com.sas.ViewInterface
Overrides:
refresh in class ComponentVisualComponent
Parameters:
model - ModelInterface object that is refreshed when it is changed
See Also:
ViewInterface.refresh(com.sas.ModelInterface)

refreshSequence

protected void refreshSequence(com.sas.collection.StaticOrderedCollectionInterface model)
Refresh the sequence of images from a specified collection object.

Parameters:
model - the collection object to refresh the images with.

setDefaultValues

public void setDefaultValues()
Sets the default internal values for the ImageAnimation.

Specified by:
setDefaultValues in interface VisualInterface
Specified by:
setDefaultValues in interface com.sas.ComponentInterface
Overrides:
setDefaultValues in class AnimationIconView
See Also:
ComponentInterface.setDefaultValues()

isSourceAppletRelative

public boolean isSourceAppletRelative()

setSourceAppletRelative

public void setSourceAppletRelative(boolean b)
Sets the source to be relative to the applet location. If set to true, then the images' path can be relative to where the applet is loaded from, else full path names of the image is required.

Parameters:
b - true to set image paths relative to where applet is loaded.

getImageSequence

public java.lang.String[] getImageSequence()
Returns the sequence of file names for the images to be displayed.

Returns:
an array of image file names
See Also:
setImageSequence(java.lang.String[])

setImageSequence

public void setImageSequence(java.lang.String[] sources)
Sets the sequence of file names for the images to be displayed.

Parameters:
sources - an array of image file names
See Also:
getImageSequence()

getImageURLSequence

public java.net.URL[] getImageURLSequence()
Returns the sequence of file names for the images to be displayed.

Returns:
an array of image file names
See Also:
setImageURLSequence(java.net.URL[])

setImageURLSequence

public void setImageURLSequence(java.net.URL[] sources)
Sets the sequence of file names for the images to be displayed.

Parameters:
sources - an array of image file names
See Also:
getImageURLSequence()

setAnimationIcon

public void setAnimationIcon(AnimationIconInterface animIcon)
Sets the AnimationIconInterface object to be incremented/decremented and painted.

Overrides:
setAnimationIcon in class AnimationIconView
Parameters:
animIcon - the AnimationIconInterface object animated by this class.
See Also:
AnimationIconView.getAnimationIcon()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.