Class EdgeAnimation

java.lang.Object
common.animation.EdgeAnimation
All Implemented Interfaces:
Animation, JobContainer

public class EdgeAnimation extends Object implements Animation, JobContainer
Created by IntelliJ IDEA. User: orsotronIII Date: 17-gen-2005 Time: 13.55.01 This class implements an animation for an edge of the graph that represents the queue net. Once the coords of the angles (which may only be straight angles)of that edge are set, the methods provide support for the output of this edge animation. This means that once the paint method is called, the bounding box for this animation is refreshed with the new frame.
  • Field Details

    • jobAnimations

      protected Vector<JobAnimation> jobAnimations
      vector containing all of the jobs that currently are running on this edge of the queue net
  • Constructor Details

    • EdgeAnimation

      public EdgeAnimation(Point[] angles, int margin)
      Creates a new instance of Edgeanimation. This must be initialized with a set of points which are coords of starting point of this edge, points where this edge turns with a straight angle (which may be omitted in case this edge does not turn), and finally ending point for this edge. All of the coords must be given in the real animation resolution scale.
      Parameters:
      angles - : coords of the angle points.
      margin - : width of border of this edge. Used to calculate boundingbox for this animation from coords of the angle points
    • EdgeAnimation

      public EdgeAnimation(Point[] angles, int margin, IconsToolkit toolkit)
      Creates a new instance of Edgeanimation. This must be initialized with a set of points which are coords of starting point of this edge, points where this edge turns with a straight angle (which may be omitted in case this edge does not turn), and finally ending point for this edge. All of the coords must be given in the real animation resolution scale.
      Parameters:
      angles - : coords of the angle points.
      margin - : width of border of this edge. Used to calculate boundingbox for this animation from coords of the angle points
      toolkit - : toolkit for customized renderization of this edge.
    • EdgeAnimation

      public EdgeAnimation(EdgeAnimation edge)
      Creates a new instance of Edgeanimation from another edge animation.
      Parameters:
      edge - : edge to be copied.
  • Method Details

    • addJob

      public void addJob(JobAnimation newJob)
      Puts another Job on this edge. The initial position is set to 0(e.g. the starting point of this edge)
      Specified by:
      addJob in interface JobContainer
      Parameters:
      newJob - : job to be added.
    • refresh

      public void refresh()
      Refreshes appearence of the image to be rendered. In facts, recalculates all of the jobs' new positions.
      Specified by:
      refresh in interface Animation
    • init

      public void init()
      Description copied from interface: Animation
      Initialization method for implementing class. The implementation of this method should prepare images for the animation, if this has not been done within constructor.
      Specified by:
      init in interface Animation
    • paint

      public void paint(Graphics g, ImageObserver io)
      Description copied from interface: Animation
      Paints image currently handled in a rectangle defined within Animation.setBounds(Rectangle) method
      Specified by:
      paint in interface Animation
    • getBGImage

      public Image getBGImage()
      Description copied from interface: Animation
      returns background image for this animation.
      Specified by:
      getBGImage in interface Animation
      Returns:
      :Background image for this animation
    • setBGImage

      public void setBGImage(Image img)
      Description copied from interface: Animation
      sets background image for this animation.
      Specified by:
      setBGImage in interface Animation
      Parameters:
      img - : background image for this animation
    • setBounds

      public void setBounds(Rectangle r)
      Description copied from interface: Animation
      Sets bounding box for this animation. If this box is set, animation will update only this certain area of the Graphics object passed within Animation.paint(Graphics, ImageObserver) method.
      Specified by:
      setBounds in interface Animation
      Parameters:
      r - : Bounding box for this animation.
    • getBounds

      public Rectangle getBounds()
      Description copied from interface: Animation
      Returns bounding box for this animation, e.g. the rectangle within which the frames for this animation will be painted
      Specified by:
      getBounds in interface Animation
      Returns:
      : Bounding box for this animation.