quicktime.app.actions
Class TransformMatrix

java.lang.Object
  |
  +--quicktime.app.actions.TransformMatrix
Direct Known Subclasses:
TranslateMatrix

public abstract class TransformMatrix
extends java.lang.Object

This class provides a standard mechanism for applying matrix manipulations to a Transformable target and supporting constraint bounding of the target's location after its matrix is altered.

The class presents two modes of operations, depending on which initialize and transformMatrix methods are applied and the class is generally used with this pairing. The notes for the initialize and transformMatrix methods document these usages.

A subclass defines the abstract methods to apply the particular transformation logic that they want to apply. If the kNoConstraint flag is applied then no constraints testing is done to keep the specified Transformable target constrained within the bounds of its enclosing space.


Field Summary
protected static int kBottomSide
          Used to nofify subclasses that the applied transformations have exceeded one of the sides of the enclosing space of the Transformable target.
static int kConstraintSpecifiedAll
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstraintSpecifiedBottom
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstraintSpecifiedHorizontal
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstraintSpecifiedLeft
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstraintSpecifiedRight
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstraintSpecifiedTop
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstraintSpecifiedVertical
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstrainWithinAll
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstrainWithinBottom
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstrainWithinHorizontal
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstrainWithinLeft
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstrainWithinRight
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstrainWithinTop
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
static int kConstrainWithinVertical
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
protected static int kLeftSide
          Used to nofify subclasses that the applied transformations have exceeded one of the sides of the enclosing space of the Transformable target.
static int kNoConstraint
          Use these as constraint flags to restrict transformations that relocated the the target within its space.
protected static int kRightSide
          Used to nofify subclasses that the applied transformations have exceeded one of the sides of the enclosing space of the Transformable target.
protected static int kTopSide
          Used to nofify subclasses that the applied transformations have exceeded one of the sides of the enclosing space of the Transformable target.
 int specifiedBottomConstraint
          Specify the number of pixels that the target is constrained to when it is positioned beyond the bottom side.
 int specifiedLeftConstraint
          Specify the number of pixels that the target is constrained to when it is positioned beyond the left hand side.
 int specifiedRightConstraint
          Specify the number of pixels that the target is constrained to when it is positioned beyond the right hand side.
 int specifiedTopConstraint
          Specify the number of pixels that the target is constrained to when it is positioned beyond the top side.
protected  Transformable target
          This is the Transformable target (which MUST be a member of the space) of the TransformMatrix action.
 
Constructor Summary
protected TransformMatrix()
          Create a TransformMatrix class
 
Method Summary
protected  void boundsReached(int whichSide)
          This method is called whenever a constraints test hits one of the sides of the enclosing space.
protected abstract  void doTransformation(Matrix theMatrix)
          Applies the transformation of the Matrix.
protected abstract  void doTransformation(Matrix theMatrix, int deltaX, int deltaY)
          Applies the transformation of the Matrix.
 boolean equals(java.lang.Object obj)
          Returns true if the incoming object is a Matrix action with the same target.
 void flipTransformationSettings()
          If a subclass is applying specified transformations to a matrix, then it should negate the value of these pre-defined transformation values.
 int getConstraint()
          Returns the current constraint setting
 Transformable getTarget()
           
 void initialize(QTDisplaySpace space, Transformable memberTarget)
          This method is called to initialize the TransformMatrix operation.
 void initialize(QTDisplaySpace space, Transformable memberTarget, int x, int y)
          This method is called to initialize the TransformMatrix operation.
 void setConstraint(int flag)
          Using the constrain constants transformation of the target's matrix can be constrained in any direction.
 java.lang.String toString()
          Return a string representation of this class.
 boolean transformTarget()
          This method will apply the transformation matrix to the target.
 boolean transformTarget(int newX, int newY)
          This method will apply the transformation matrix to the target.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kLeftSide

protected static final int kLeftSide
Used to nofify subclasses that the applied transformations have exceeded one of the sides of the enclosing space of the Transformable target.

kRightSide

protected static final int kRightSide
Used to nofify subclasses that the applied transformations have exceeded one of the sides of the enclosing space of the Transformable target.

kTopSide

protected static final int kTopSide
Used to nofify subclasses that the applied transformations have exceeded one of the sides of the enclosing space of the Transformable target.

kBottomSide

protected static final int kBottomSide
Used to nofify subclasses that the applied transformations have exceeded one of the sides of the enclosing space of the Transformable target.

kNoConstraint

public static final int kNoConstraint
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstrainWithinLeft

public static final int kConstrainWithinLeft
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstrainWithinRight

public static final int kConstrainWithinRight
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstrainWithinTop

public static final int kConstrainWithinTop
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstrainWithinBottom

public static final int kConstrainWithinBottom
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstrainWithinHorizontal

public static final int kConstrainWithinHorizontal
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstrainWithinVertical

public static final int kConstrainWithinVertical
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstrainWithinAll

public static final int kConstrainWithinAll
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstraintSpecifiedLeft

public static final int kConstraintSpecifiedLeft
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstraintSpecifiedRight

public static final int kConstraintSpecifiedRight
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstraintSpecifiedTop

public static final int kConstraintSpecifiedTop
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstraintSpecifiedBottom

public static final int kConstraintSpecifiedBottom
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstraintSpecifiedHorizontal

public static final int kConstraintSpecifiedHorizontal
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstraintSpecifiedVertical

public static final int kConstraintSpecifiedVertical
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

kConstraintSpecifiedAll

public static final int kConstraintSpecifiedAll
Use these as constraint flags to restrict transformations that relocated the the target within its space. The client of this class can either completely specify the number of pixels outside of the space that the target should be constrained to, or have the target completely constrained within the enclosing space, or specify that no constraints should be applied.

target

protected Transformable target
This is the Transformable target (which MUST be a member of the space) of the TransformMatrix action. It is this target that has its matrix transformed by the subclass. It is set in the intialize method.

specifiedRightConstraint

public int specifiedRightConstraint
Specify the number of pixels that the target is constrained to when it is positioned beyond the right hand side. Its default value is 1, which means that its position is constrained to showing only 1 column (the left hand column) of the target's pixels.

specifiedLeftConstraint

public int specifiedLeftConstraint
Specify the number of pixels that the target is constrained to when it is positioned beyond the left hand side. Its default value is 1, which means that its position is constrained to showing only 1 column (the right hand column) of the target's pixels.

specifiedTopConstraint

public int specifiedTopConstraint
Specify the number of pixels that the target is constrained to when it is positioned beyond the top side. Its default value is 1, which means that its position is constrained to showing only 1 row (the bottom row) of the target's pixels.

specifiedBottomConstraint

public int specifiedBottomConstraint
Specify the number of pixels that the target is constrained to when it is positioned beyond the bottom side. Its default value is 1, which means that its position is constrained to showing only 1 row (the top row) of the target's pixels.
Constructor Detail

TransformMatrix

protected TransformMatrix()
Create a TransformMatrix class
Method Detail

toString

public java.lang.String toString()
Return a string representation of this class.
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Returns true if the incoming object is a Matrix action with the same target.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to test
Returns:
true if equal, false if not

getTarget

public Transformable getTarget()
Returns:
the current target of this object.

setConstraint

public void setConstraint(int flag)
Using the constrain constants transformation of the target's matrix can be constrained in any direction.
Parameters:
flag - constraint flag

getConstraint

public int getConstraint()
Returns the current constraint setting

initialize

public void initialize(QTDisplaySpace space,
                       Transformable memberTarget)
                throws QTException
This method is called to initialize the TransformMatrix operation. Typically this is used with the transformMatrix (Matrix) call. This version of the initialize call is used used with the MatrixAction class that applies some kind of transformation in the matrix each time that action is tickled.

The TransformMatrix operation need only be initialized when the space itself changes its size.

Parameters:
space - the space which the Transformable object is a member of.
target - the target member of the specified space.

initialize

public void initialize(QTDisplaySpace space,
                       Transformable memberTarget,
                       int x,
                       int y)
                throws QTException
This method is called to initialize the TransformMatrix operation. Typically this is used with the transformMatrix (Matrix, int deltaX, int deltaY) call. This version of the initialize call is used used with the DragAction where each time the user selects an object to drag the TransformMatrix is reinitialized.
Parameters:
space - the space which the Transformable object is a member of.
target - the target member of the specified space.
x - the x-origin about which the transformation is applied. In consequent calls to the transformMatrix (Matrix, int deltaX, int deltaY) method, the deltaX value is a delta from this specified origin.
y - the y-origin about which the transformation is applied. In consequent calls to the transformMatrix (Matrix, int deltaX, int deltaY) method, the deltaY value is a delta from this specified origin.

transformTarget

public boolean transformTarget()
                        throws QTException
This method will apply the transformation matrix to the target. It will call the doTransformation (Matrix) method.
Returns:
true if the this transformation reached a constraining condition

transformTarget

public boolean transformTarget(int newX,
                               int newY)
                        throws QTException
This method will apply the transformation matrix to the target. It will call the doTransformation (Matrix, int deltaX, int deltaY) method.
Parameters:
newX - the new x position expressed in the local coordinates of the space.
newY - the new y position expressed in the local coordinates of the space.
Returns:
true if the this transformation reached a constraining condition

flipTransformationSettings

public void flipTransformationSettings()
If a subclass is applying specified transformations to a matrix, then it should negate the value of these pre-defined transformation values. This is used in conjunction with the transformMatrix usage.

doTransformation

protected abstract void doTransformation(Matrix theMatrix,
                                         int deltaX,
                                         int deltaY)
                                  throws QTException
Applies the transformation of the Matrix.
Parameters:
theMatrix - The matrix handed in is the original matrix of the target when the TransformMatrix object was initialized.
deltaX - the difference between the original x point when the TransformMatrix object was initialized and the current location.
deltaY - the difference between the original y point when the TransformMatrix object was initialized and the current location.

doTransformation

protected abstract void doTransformation(Matrix theMatrix)
                                  throws QTException
Applies the transformation of the Matrix.
Parameters:
theMatrix - The matrix handed in is the current matrix of the target.

boundsReached

protected void boundsReached(int whichSide)
This method is called whenever a constraints test hits one of the sides of the enclosing space.
Parameters:
whichSide - indicates which side the constraints test hit.