HStaticAnimation

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.havi.ui
Class HStaticAnimation

    java.lang.Object
      java.awt.Component
          org.havi.ui.HComponent
              org.havi.ui.HVisible
                  org.havi.ui.HStaticAnimation

All Implemented Interfaces:
  ImageObserver, Serializable, TestOpacity, HAnimateEffect, HMatteLayer, HNoInputPreferred, HState

Direct Known Subclasses:
  HAnimation

    public class HStaticAnimation

extends HVisible
implements HNoInputPreferred, HAnimateEffect

The `HStaticAnimation` is a user interface component used to display animated graphical content but which does not permit the user to navigate (focus) upon it. By default it uses the `HAnimateLook` to render itself.

The `HStaticAnimation` class supports animating images a finite number of times or infinitely (continuously), and either forward or in alternating directions with a specified time delay between the rendering of consecutive images.

Calling `setVisible(false)` on `HStaticAnimation` shall not automatically stop the animation hence applications are not required to call the `play()` method again when the animation again becomes visible. It is implementation dependent whether the animation continues from the last visible position or from where it would be if it kept running.

The parameters to the constructors are as follows, in cases where parameters are not used, then the constructor should use the default values.

### Default parameter values exposed in the constructors

Parameter | Description | Default value | Set method | Get method
--- | --- | --- | --- | ---
x | x-coordinate of top left hand corner of this component in pixels, relative to its parent container (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds
y | y-coordinate of top left hand corner of this component in pixels, relative to its parent container (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds
width | width of this component in pixels (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds
height | height of this component in pixels (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds
imagesNormal | The array of images to be used as the content for the `HState.NORMAL_STATE` state of this component. | null | `setAnimateContent` | `getAnimateContent`
delay | The delay between the presentation of successive content in the animation, in units of 0.1 second | 1 (i.e. 0.1 seconds) | `setDelay` | `getDelay`
repeatCount | The number of times that the animation is to be played. | `REPEAT_INFINITE` | `setRepeatCount` | `getRepeatCount`
playMode | The playing mode for the animation. | `PLAY_REPEATING` | `setPlayMode` | `getPlayMode`

### Default parameter values not exposed in the constructors

Description | Default value | Set method | Get method
--- | --- | --- | ---
Associated matte (`HMatte`). | none (i.e. getMatte() returns `null`) | `setMatte` | `getMatte`
The text layout manager responsible for text formatting. | An `HDefaultTextLayoutManager` object. | `HVisible.setTextLayoutManager(org.havi.ui.HTextLayoutManager)` | `HVisible.getTextLayoutManager()`
The background painting mode | `HVisible.NO_BACKGROUND_FILL` | `HVisible.setBackgroundMode(int)` | `HVisible.getBackgroundMode()`
The default preferred size | not set (i.e. NO_DEFAULT_SIZE) unless specified by `width` and `height` parameters | `HVisible.setDefaultSize(java.awt.Dimension)` | `HVisible.getDefaultSize()`
The horizontal content alignment | `HVisible.HALIGN_CENTER` | `HVisible.setHorizontalAlignment(int)` | `HVisible.getHorizontalAlignment()`
The vertical content alignment | `HVisible.VALIGN_CENTER` | `HVisible.setVerticalAlignment(int)` | `HVisible.getVerticalAlignment()`
The content scaling mode | `HVisible.RESIZE_NONE` | `HVisible.setResizeMode(int)` | `HVisible.getResizeMode()`
The border mode | `true` | `HVisible.setBordersEnabled(boolean)` | `HVisible.getBordersEnabled()`
The initial piece of content to be presented, i.e. its position in the content array. | 0 | `setPosition` | `getPosition`
By default the animation should be stopped. Hence, to start the animation its start method must be explicitly invoked. This mechanism allows for animations that are programmatically controlled, e.g. via the setPosition method. | "stopped" | `start` / `stop` | `isAnimated`
The default "look" for this class. | A platform specific `HAnimateLook` | `HStaticAnimation.setDefaultLook` | `HStaticAnimation.getDefaultLook`
The "look" for this object. | The `HAnimateLook` returned from HStaticAnimation.getDefaultLook when this object was created. | `HStaticAnimation.setLook` | `HStaticAnimation.getLook`

See Also:
  Serialized Form

Field Summary

Fields inherited from class org.havi.ui.HVisible
`ADJUSTMENT_VALUE_CHANGE, ANIMATE_CONTENT_CHANGE, ANIMATION_POSITION_CHANGE, BACKGROUND_FILL, BORDER_CHANGE, CARET_POSITION_CHANGE, CONTENT_CHANGE, ECHO_CHAR_CHANGE, EDIT_MODE_CHANGE, FIRST_CHANGE, GRAPHIC_CONTENT_CHANGE, HALIGN_CENTER, HALIGN_JUSTIFY, HALIGN_LEFT, HALIGN_RIGHT, ITEM_VALUE_CHANGE, LAST_CHANGE, LIST_CONTENT_CHANGE, LIST_ICONSIZE_CHANGE, LIST_LABELSIZE_CHANGE, LIST_MULTISELECTION_CHANGE, LIST_SCROLLPOSITION_CHANGE, LIST_SELECTION_CHANGE, MIN_MAX_CHANGE, NO_BACKGROUND_FILL, NO_DEFAULT_HEIGHT, NO_DEFAULT_SIZE, NO_DEFAULT_WIDTH, ORIENTATION_CHANGE, REPEAT_COUNT_CHANGE, RESIZE_ARBITRARY, RESIZE_NONE, RESIZE_PRESERVE_ASPECT, SIZE_CHANGE, STATE_CHANGE, TEXT_CONTENT_CHANGE, TEXT_VALUE_CHANGE, THUMB_OFFSETS_CHANGE, UNKNOWN_CHANGE, VALIGN_BOTTOM, VALIGN_CENTER, VALIGN_JUSTIFY, VALIGN_TOP`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface org.havi.ui.HAnimateEffect
`PLAY_ALTERNATING, PLAY_REPEATING, REPEAT_INFINITE`

Fields inherited from interface org.havi.ui.HState
`ACTIONED_FOCUSED_STATE, ACTIONED_STATE, ACTIONED_STATE_BIT, ALL_STATES, DISABLED_ACTIONED_FOCUSED_STATE, DISABLED_ACTIONED_STATE, DISABLED_FOCUSED_STATE, DISABLED_STATE, DISABLED_STATE_BIT, FIRST_STATE, FOCUSED_STATE, FOCUSED_STATE_BIT, LAST_STATE, NORMAL_STATE`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`HStaticAnimation()` Creates an `HStaticAnimation` object.
`HStaticAnimation(Image[] imagesNormal, int delay, int playMode, int repeatCount)` Creates an `HStaticAnimation` object.
`HStaticAnimation(Image[] imagesNormal, int delay, int playMode, int repeatCount, int x, int y, int width, int height)` Creates an `HStaticAnimation` object.

Method Summary
`static HAnimateLook` | `getDefaultLook()` Returns the currently set default `HLook` for `HStaticAnimation` components.
`int` | `getDelay()` Gets the presentation delay for this `HStaticAnimation`.
`int` | `getPlayMode()` Gets the playing mode for this `HStaticAnimation`.
`int` | `getPosition()` Get the current index into the content array which this `HStaticAnimation` is using to display content.
`int` | `getRepeatCount()` Gets the number of times that this `HStaticAnimation` is to be played.
`boolean` | `isAnimated()` This method indicates the animation (running) state of the `HStaticAnimation`.
`static void` | `setDefaultLook(HAnimateLook hlook)` Sets the default `HLook` for further `HStaticAnimation` Components.
`void` | `setDelay(int count)` Sets the delay between the presentation of successive pieces of content (frames).
`void` | `setLook(HLook hlook)` Sets the `HLook` for this component.
`void` | `setPlayMode(int mode)` Sets the playing mode for this `HStaticAnimation`.
`void` | `setPosition(int position)` Set this `HStaticAnimation` to display the content at the specified position.
`void` | `setRepeatCount(int count)` Sets the number of times that this `HStaticAnimation` should be played.
`void` | `start()` This method starts this `HStaticAnimation` playing.
`void` | `stop()` This method indicates that the running `HStaticAnimation` should be stopped.

Methods inherited from class org.havi.ui.HVisible
`getAnimateContent, getBackgroundMode, getBordersEnabled, getContent, getDefaultSize, getGraphicContent, getHorizontalAlignment, getInteractionState, getLook, getLookData, getMaximumSize, getMinimumSize, getPreferredSize, getResizeMode, getTextContent, getTextLayoutManager, getVerticalAlignment, isFocusTraversable, isOpaque, paint, setAnimateContent, setBackgroundMode, setBordersEnabled, setContent, setDefaultSize, setEnabled, setGraphicContent, setHorizontalAlignment, setLookData, setResizeMode, setTextContent, setTextLayoutManager, setVerticalAlignment, update`

Methods inherited from class org.havi.ui.HComponent
`getMatte, isDoubleBuffered, isEnabled, setMatte`

Methods inherited from class java.awt.Component
`addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, areFocusTraversalKeysSet, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, doLayout, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getCursor, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, hasFocus, imageUpdate, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, list, list, list, list, list, paintAll, prepareImage, prepareImage, print, printAll, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, setBackground, setBounds, setBounds, setCursor, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### HStaticAnimation

    public HStaticAnimation()

  Creates an `HStaticAnimation` object. See the class description for details of constructor parameters and default values. For constructors which specify content as parameters, see 'State-based content' in HVisible for unspecified content associated with other HStates.

### HStaticAnimation

    public HStaticAnimation(Image[] imagesNormal,
                            int delay,
                            int playMode,
                            int repeatCount,
                            int x,
                            int y,
                            int width,
                            int height)

  Creates an `HStaticAnimation` object. See the class description for details of constructor parameters and default values. For constructors which specify content as parameters, see 'State-based content' in HVisible for unspecified content associated with other HStates.

### HStaticAnimation

    public HStaticAnimation(Image[] imagesNormal,
                            int delay,
                            int playMode,
                            int repeatCount)

  Creates an `HStaticAnimation` object. See the class description for details of constructor parameters and default values. For constructors which specify content as parameters, see 'State-based content' in HVisible for unspecified content associated with other HStates.

Method Detail

### setLook

    public void setLook(HLook hlook)
                 throws HInvalidLookException

  Sets the `HLook` for this component.

  Overrides:
    `setLook` in class `HVisible`
  Parameters:
    `hlook` - The `HLook` that is to be used for this component. Note that this parameter may be null, in which case the component will not draw itself until a look is set.
  Throws:
    `HInvalidLookException` - If the `HLook` is not an `HAnimateLook`.

### setDefaultLook

    public static void setDefaultLook(HAnimateLook hlook)

  Sets the default `HLook` for further `HStaticAnimation` Components.

  Parameters:
    `hlook` - The `HLook` that will be used by default when creating a new `HStaticAnimation` component. Note that this parameter may be null, in which case newly created components shall not draw themselves until a non-null look is set using the `setLook` method.

### getDefaultLook

    public static HAnimateLook getDefaultLook()

  Returns the currently set default `HLook` for `HStaticAnimation` components.

  Returns:
    The `HLook` that is used by default when creating a new `HStaticAnimation` component.

### start

    public void start()

  This method starts this `HStaticAnimation` playing. If `start` is called when the animation is already running it resets the animation according to the current play mode, as returned by `getPlayMode`.

  Specified by:
    `start` in interface `HAnimateEffect`

### stop

    public void stop()

  This method indicates that the running `HStaticAnimation` should be stopped. After calling this method, there is no guarantee that one or more frames will not be displayed before the animation actually stops playing. If the animation is already stopped further calls to `stop` have no effect.

  Specified by:
    `stop` in interface `HAnimateEffect`

### isAnimated

    public boolean isAnimated()

  This method indicates the animation (running) state of the `HStaticAnimation`.

  Specified by:
    `isAnimated` in interface `HAnimateEffect`
  Returns:
    `true` if this `HStaticAnimation` is running, i.e. the `start` method has been invoked - `false` otherwise.

### setPosition

    public void setPosition(int position)

  Set this `HStaticAnimation` to display the content at the specified position. If the animation is already running a call to `setPosition` will change the current value and affect the animation immediately.

  Specified by:
    `setPosition` in interface `HAnimateEffect`
  Parameters:
    `position` - an index into the content array which specifies the next piece of content to be displayed. If `position` is less than 0, then the array element at index 0 is displayed, if `position` is greater than or equal to the length of the content array, then the array element at index [`length`-1] will be used.

### getPosition

    public int getPosition()

  Get the current index into the content array which this `HStaticAnimation` is using to display content.

  Specified by:
    `getPosition` in interface `HAnimateEffect`
  Returns:
    the index of the content currently being displayed, in the range `0 <= index < length`

### setRepeatCount

    public void setRepeatCount(int count)

  Sets the number of times that this `HStaticAnimation` should be played. If the animation is already running a call to `setRepeatCount` will change the current value and reset the current number of repeats to 0, affecting the animation immediately.

  Specified by:
    `setRepeatCount` in interface `HAnimateEffect`
  Parameters:
    `count` - the number of times that an `HStaticAnimation` should be played. Valid values of the repeat count are one or more, and `REPEAT_INFINITE`.

### getRepeatCount

    public int getRepeatCount()

  Gets the number of times that this `HStaticAnimation` is to be played. Note that this method does not return the number of repeats that are remaining to be played.

  Except for `HAnimateEffect` implementations that specify a different default, `getRepeatCount()` returns `REPEAT_INFINITE` if no call to `setRepeatCount()` has previously been made.

  Specified by:
    `getRepeatCount` in interface `HAnimateEffect`
  Returns:
    the total number of times that an `HStaticAnimation` is to be played. The returned value shall be greater than zero, or `REPEAT_INFINITE`.

### setDelay

    public void setDelay(int count)

  Sets the delay between the presentation of successive pieces of content (frames).

  After calling `setDelay` on a currently playing `HStaticAnimation`, there is no guarantee that one or more frames will not be displayed using the previous delay until the new delay value takes effect.

  Specified by:
    `setDelay` in interface `HAnimateEffect`
  Parameters:
    `count` - the content presentation delay in units of 0.1 seconds duration. If count is less than one "unit", then it shall be treated as if it were a delay of one "unit", i.e. 0.1 seconds.

### getDelay

    public int getDelay()

  Gets the presentation delay for this `HStaticAnimation`.

  Specified by:
    `getDelay` in interface `HAnimateEffect`
  Returns:
    the presentation delay in units of 0.1 seconds.

### setPlayMode

    public void setPlayMode(int mode)

  Sets the playing mode for this `HStaticAnimation`. If the animation is already running a call to `setPlayMode` will change the current value and affect the animation immediately. The position of the animation is unchanged.

  Specified by:
    `setPlayMode` in interface `HAnimateEffect`
  Parameters:
    `mode` - the play mode for this `HStaticAnimation`, which must be either `HAnimateEffect.PLAY_ALTERNATING` or `HAnimateEffect.PLAY_REPEATING`.

### getPlayMode

    public int getPlayMode()

  Gets the playing mode for this `HStaticAnimation`.

  Specified by:
    `getPlayMode` in interface `HAnimateEffect`
  Returns:
    the play mode for this `HStaticAnimation`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD