edu.neu.ccs.gui
Class AbstractPaintable

java.lang.Object
  extended byedu.neu.ccs.gui.AbstractPaintable
All Implemented Interfaces:
JPTConstants, Paintable, SupportsPropertyChange, SwingConstants
Direct Known Subclasses:
ClippingWrapper, ImagePaintable, ImagePaintableLite, PaintableSequence, PaintableSequenceComposite, PointPaintable, ShapePaintable, TextPaintable, Tile

public abstract class AbstractPaintable
extends Object
implements Paintable

The abstract class AbstractPaintable defines objects that implement Paintable.

A derived class must implement the following three methods:

As of 2.4.0, the former interface MutatablePaintable has been merged into Paintable. Furthermore, the interface MutatablePaintable has been removed from the Java Power Tools as has the class AbstractMutatablePaintable.

Much programming experience proved that splitting the design into two interfaces and two abstract classes was more hassle than it was worth. Although splittling the design into two classes was conceptually simple, it made programming much more difficult since the necessary facilities were not all available everywhere.

In 2.6.0, the notion of a background paint was refactored from Tile into required “set” and “get” methods in the Paintable interface with corresponding implementation in this class. See the comments on the paint method for further details on how the background paint is applied.

Also, in 2.6.0, support was added to use a paintable as a tile for a rectangle. Once this facility was in place, we added the option for one paintable to use another paintable as a background tile that will paint the bounding box of the primary paintable before that paintable itself paints.

The order of painting is now:

Of course, no painting takes place if the paintable is set to be invisible.

In 2.6.0c, added the method makeSnapshot. This method is implemented via:

    PaintableTools.makeBufferedImage(this)

In 2.7.0, fixed a few tiny matters.

Since:
2.3
Version:
2.7.0

Field Summary
private  Paint background
          The background paint if any.
private  Paintable backgroundTile
          The background tile if any.
private  PropertyChangeSupport changeAdapter
          The main listener for this AbstractPaintable object to implement the interface SupportsPropertyChange.
private  XRect defaultBounds2D
          The default Bounds2D rectangle.
private  XPoint2D defaultCenter
          The default center.
private  XRect defaultOriginalBounds2D
          The default original Bounds2D rectangle.
private  XPoint2D defaultOriginalCenter
          The default original center.
private  PropertyChangeForwardingListener forwardingListener
          The forwarding listener for this AbstractPaintable object to implement the interface SupportsPropertyChange.
private  AffineTransform inverse
          The mutator inverse transform.
private  AffineTransform mutator
          The mutator transform.
private  float opacity
          The opacity for paintables that are partially transparent.
static String SET_BACKGROUND_PAINT
          Bound property name for set background paint.
static String SET_BACKGROUND_TILE
          Bound property name for set background tile.
private  boolean visible
          The visibility property of the paintable.
 
Fields inherited from interface edu.neu.ccs.gui.Paintable
REMOVE_PAINTABLE, SET_CLIPPING_SHAPE, SET_DEFAULT_BOUNDS2D, SET_DEFAULT_CENTER, SET_DEFAULT_ORIGINAL_BOUNDS2D, SET_DEFAULT_ORIGINAL_CENTER, SET_MUTATOR, SET_OPACITY, SET_PAINTABLE, SET_VISIBLE, SHIFT_PAINTABLE
 
Fields inherited from interface edu.neu.ccs.util.JPTConstants
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
AbstractPaintable()
           
 
Method Summary
 void addForwardingListener(Object object)
          Add the forwarding listener as a property change listener for the given object if the object supports property change.
 void addPostMutation(AffineTransform M)
          Composes the current mutator on the left with the given transform provided that the given transform is invertible.
 void addPostMutation(Mutator.Strategy strategy)
          Applies a Mutator.Strategy object to the paintable by constructing an affine transform using the mutated center of the paintable and then calling addPostMutation with this transform as the argument.
 void addPreMutation(AffineTransform M)
          Composes the current mutator on the right with the given transform provided that the given transform is invertible and the paintable object supports this operation.
 void addPreMutation(Mutator.Strategy strategy)
          Applies a Mutator.Strategy object to the paintable by constructing an affine transform using the original center of the paintable and then calling addPreMutation with this transform as the argument.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list for a specific property.
 void addPropertyChangeListeners(PropertyChangeListener[] listeners)
          Add all items in the given PropertyChangeListener array to the listener list.
 void addPropertyChangeListeners(String propertyName, PropertyChangeListener[] listeners)
          Add all items in the given PropertyChangeListener array to the listener list for a specific property.
 void affinetransform(double m00, double m10, double m01, double m11, double m02, double m12)
          Apply the affine transform given by the matrix coefficients m00, m10, m01, m11, m02, m12 as if the transform were centered at the center of the paintable.
 void applyOpacity(Graphics2D h)
          Applies the current opacity to calculate and set a net opacity.
 void clearBackgroundPaint()
          Clear the background paint.
 void clearBackgroundTile()
          Clear the background tile.
 void clearBothBackgrounds()
          Clear the both the background paint and the background tile.
 boolean contains(double x, double y)
          Tests if a point specified by coordinates is inside the paintable.
 boolean contains(Point2D p)
          Tests if a specified point is inside the paintable.
 void firePropertyChange(PropertyChangeEvent evt)
          Fire an existing PropertyChangeEvent to any registered listeners.
 void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
          Report a bound property update to any registered listeners.
 void firePropertyChange(String propertyName, byte oldValue, byte newValue)
          Report a bound property update to any registered listeners.
 void firePropertyChange(String propertyName, char oldValue, char newValue)
          Report a bound property update to any registered listeners.
 void firePropertyChange(String propertyName, double oldValue, double newValue)
          Report a bound property update to any registered listeners.
 void firePropertyChange(String propertyName, float oldValue, float newValue)
          Report a bound property update to any registered listeners.
 void firePropertyChange(String propertyName, int oldValue, int newValue)
          Report a bound property update to any registered listeners.
 void firePropertyChange(String propertyName, long oldValue, long newValue)
          Report a bound property update to any registered listeners.
 void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Report a bound property update to any registered listeners.
 void firePropertyChange(String propertyName, short oldValue, short newValue)
          Report a bound property update to any registered listeners.
abstract  XRect getActualBounds2D()
          Returns the actual bounds of the original paintable or null if the paintable is effectively empty.
 Paint getBackgroundPaint()
          Returns the background paint.
 Paintable getBackgroundTile()
          Returns the background tile.
 XRect getBounds2D()
          Returns a copy of the 2-dimensional bounds of the paintable.
 XPoint2D getCenter()
          Returns a copy the center of the paintable.
 XPoint2D getCorner()
          Returns a copy the corner of the paintable.
 XRect getDefaultBounds2D()
          Returns a copy of the default Bounds2D rectangle, that is, the default for computation of getBounds2D.
 XPoint2D getDefaultCenter()
          Returns a copy of the default center, that is, the default for computation of getCenter.
 XRect getDefaultOriginalBounds2D()
          Returns a copy of the default original Bounds2D rectangle, that is, the default for computation of getOriginalBounds2D.
 XPoint2D getDefaultOriginalCenter()
          Returns a copy of the default original center, that is, the default for computation of getOriginalCenter.
 PropertyChangeForwardingListener getForwardingListener()
          Returns the PropertyChangeForwardingListener that will forward the property change events it receives to this object.
 AffineTransform getMutator()
          Returns a copy of the existing mutator transform.
 AffineTransform getMutatorInverse()
          Returns a copy of the existing mutator inverse transform.
 float getOpacity()
          Returns the opacity value of this paintable between 0 and 1.
 XRect getOriginalBounds2D()
          Returns a copy of the 2-dimensional bounds of the original paintable prior to any mutation.
 XPoint2D getOriginalCenter()
          Returns a copy of the original center of the paint region.
 Graphics2D getPreparedGraphics2D(Graphics g)
          Returns a copy of the given graphics context after modifying the copy to clip to within the bounds region, to set anti-aliasing on, and to apply the opacity of this paintable if needed.
 PropertyChangeListener[] getPropertyChangeListeners()
          Returns an array of all listeners that were added to this object.
 PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
          Returns an array of all listeners that were added to this object and associated with the named property.
 void glide(double degrees, double distance)
          Glides (translates) the paintable along a glide line at the given angle in degrees and the given glide distance.
 void glidereflect(double degrees, double distance)
          Glide reflects the paintable along the line through its center at the given angle in degrees and the given glide distance.
 boolean hasListeners(String propertyName)
          Check if there are any listeners for a specific property.
 void hreflect()
          Reflects the paintable along a horizontal axis through its center.
 boolean isVisible()
          Returns the current visibility property of this paintable.
 void lineartransform(double m00, double m10, double m01, double m11)
          Apply the linear transform given by the matrix coefficients m00, m10, m01, m11 as if the transform were centered at the center of the paintable.
 BufferedImage makeSnapshot()
          Constructs a BufferedImage object that is the same size as the bounding box of this paintable and then paints this paintable onto the buffered image with a suitable translation back to the origin.
 void move(double dx, double dy)
          Moves the paintable by a translation using the data in the point specified by coordinates.
 void move(Point2D p)
          Moves the paintable by a translation using the data in the point.
 void moveCenterTo(double x, double y)
          Moves the paintable by a translation in such a way that the paintable center specified by getCenter will move to the given point specified in coordinates.
 void moveCenterTo(Point2D p)
          Moves the paintable by a translation in such a way that the paintable center specified by getCenter will move to the given point.
 void moveCornerTo(double x, double y)
          Moves the paintable by a translation in such a way that the paintable corner specified by getCorner will move to the given point specified in coordinates.
 void moveCornerTo(Point2D p)
          Moves the paintable by a translation in such a way that the paintable corner specified by getCorner will move to the given point.
 void mutate(AffineTransform M)
          This method is implemented to do exactly the same operation as the corresponding method addPostMutation.
 void mutate(Mutator.Strategy strategy)
          This method is implemented to do exactly the same operation as the corresponding method addPostMutation.
abstract  boolean originalContains(double x, double y)
          Tests if a point specified by coordinates is inside the original paintable without mutation.
 boolean originalContains(Point2D p)
          Tests if a specified point is inside the original paintable without mutation.
abstract  void originalPaint(Graphics g)
          Paints onto a Graphics context using information from this object but without the use of the mutator transform.
 void paint(Graphics g)
          Paints onto a graphics context g using information from this object.
 void paintAsTiles(Graphics g, double w, double h)
          Repeatedly paints this object as a tile that covers the rectangle (0,0,w,h) in the graphics context g.
 void paintAsTiles(Graphics g, double x, double y, double w, double h)
          Repeatedly paints this object as a tile that covers the rectangle (x,y,w,h) in the graphics context g.
 void paintAsTiles(Graphics g, Rectangle2D rect)
          Repeatedly paints this object as a tile that covers the given rectangle in the graphics context g.
 void paintAt(Graphics g, AffineTransform T, double x, double y)
          Without changing the paintable or the graphics context, paint the paintable in a translated position specified by the point in coordinates and the affine transform T; before painting the transform T should be applied to the point.
 void paintAt(Graphics g, AffineTransform T, Point2D p)
          Without changing the paintable or the graphics context, paint the paintable in a translated position specified by the point in coordinates and the affine transform T; before painting the transform T should be applied to the point.
 void paintAt(Graphics g, double x, double y)
          Without changing the paintable or the graphics context, paint the paintable in a translated position specified by the point in coordinates.
 void paintAt(Graphics g, Point2D p)
          Without changing the paintable or the graphics context, paint the paintable in a translated position specified by the point.
protected  boolean possiblyContains(double x, double y)
          Tests if a point specified by coordinates is possibly inside the original paintable.
 void reflect(double degrees)
          Reflects the paintable along the line through its center at the given angle in degrees.
 void removeAndAddForwardingListener(Object oldobject, Object newobject)
          Remove the forwarding listener as a property change listener for the old object if the old object supports property change and add the forwarding listener as a property change listener for the new object if the new object supports property change.
 void removeForwardingListener(Object object)
          Remove the forwarding listener as a property change listener for the given object if the object supports property change.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Remove a PropertyChangeListener for a specific property.
 void rotate(double degrees)
          Rotates the paintable about its center by the given angle in degrees.
 void scale(double s)
          Scales the paintable about its center by the given factor s uniformly in all directions.
 void scale(double degrees, double s, double t)
          Scales the paintable about its center by the given factor s along the main axis at the given angle in degrees and the given factor t along the perpendicular axis.
 void setBackgroundPaint(Paint background)
          Sets the background paint.
 void setBackgroundTile(Object object)
          Sets the background tile paintable.
 void setDefaultBounds2D(Rectangle2D rectangle)
          Sets the default Bounds2D rectangle, that is, the default for computation of getBounds2D.
 void setDefaultCenter(Point2D center)
          Sets the default center, that is, the default for computation of getCenter.
 void setDefaultOriginalBounds2D(Rectangle2D rectangle)
          Sets the default original Bounds2D rectangle, that is, the default for computation of getOriginalBounds2D.
 void setDefaultOriginalCenter(Point2D center)
          Sets the default original center, that is, the default for computation of getOriginalCenter.
 void setMutator(AffineTransform M)
          Sets the mutator transform to the given transform provided that the given transform is invertible and the paintable object supports this operation.
 void setMutator(Mutator.Strategy strategy)
          Applies a Mutator.Strategy object to the paintable by constructing an affine transform using the original center of the paintable and then calling setMutator with this transform as the argument.
 void setOpacity(float opacity)
          Sets the opacity of this paintable to a value between 0 and 1.
 void setVisible(boolean visible)
          Sets the visibility property of this paintable.
 void shear(double degrees, double s)
          Shears the paintable about its center and with shear factor s along the line at the given angle in degrees.
 void vreflect()
          Reflects the paintable along a vertical axis through its center.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SET_BACKGROUND_PAINT

public static final String SET_BACKGROUND_PAINT
Bound property name for set background paint.

See Also:
Constant Field Values

SET_BACKGROUND_TILE

public static final String SET_BACKGROUND_TILE
Bound property name for set background tile.

See Also:
Constant Field Values

defaultBounds2D

private XRect defaultBounds2D
The default Bounds2D rectangle.


defaultCenter

private XPoint2D defaultCenter
The default center.


defaultOriginalBounds2D

private XRect defaultOriginalBounds2D
The default original Bounds2D rectangle.


defaultOriginalCenter

private XPoint2D defaultOriginalCenter
The default original center.


visible

private boolean visible
The visibility property of the paintable.


opacity

private float opacity
The opacity for paintables that are partially transparent.


background

private Paint background
The background paint if any.


backgroundTile

private Paintable backgroundTile
The background tile if any.


mutator

private AffineTransform mutator
The mutator transform.


inverse

private AffineTransform inverse
The mutator inverse transform.


changeAdapter

private final PropertyChangeSupport changeAdapter

The main listener for this AbstractPaintable object to implement the interface SupportsPropertyChange.

Note: In this implementation, PropertyChangeSupport is used rather than SwingPropertyChangeSupport to ensure thread safety.


forwardingListener

private final PropertyChangeForwardingListener forwardingListener

The forwarding listener for this AbstractPaintable object to implement the interface SupportsPropertyChange.

Constructor Detail

AbstractPaintable

public AbstractPaintable()
Method Detail

paint

public void paint(Graphics g)

Paints onto a graphics context g using information from this object.

In this default implementation, the following policies apply. Note the that bounds region refers to the rectangle returned by getBounds2D.

When this method call is complete, the internal state of g should be unchanged. This is the case in this implementation. Any method that overrides this method must ensure the same invariant regarding g.

Specified by:
paint in interface Paintable
Parameters:
g - the graphics context on which to paint

paintAt

public final void paintAt(Graphics g,
                          double x,
                          double y)

Without changing the paintable or the graphics context, paint the paintable in a translated position specified by the point in coordinates.

In particular, paintAt(g,0,0) is equivalent to paint(g).

Recommendation: The paintAt methods are intended to be used if a designer wants to define a paintable at or near the origin of coordinates and then independently compute or retrieve the position at which the paintable will be painted. If the paintAt methods are used, it is recommended that the programmer avoid mutating the paintable directly since that will almost certainly lead to confusion and bugs. Either use mutation or use paintAt but not both.

Specified by:
paintAt in interface Paintable
Parameters:
g - the graphics context on which to paint
x - the x-translation
y - the y-translation

paintAt

public final void paintAt(Graphics g,
                          Point2D p)

Without changing the paintable or the graphics context, paint the paintable in a translated position specified by the point.

Recommendation: The paintAt methods are intended to be used if a designer wants to define a paintable at or near the origin of coordinates and then independently compute or retrieve the position at which the paintable will be painted. If the paintAt methods are used, it is recommended that the programmer avoid mutating the paintable directly since that will almost certainly lead to confusion and bugs. Either use mutation or use paintAt but not both.

Specified by:
paintAt in interface Paintable
Parameters:
g - the graphics context on which to paint
p - the translation vector

paintAt

public final void paintAt(Graphics g,
                          AffineTransform T,
                          double x,
                          double y)

Without changing the paintable or the graphics context, paint the paintable in a translated position specified by the point in coordinates and the affine transform T; before painting the transform T should be applied to the point.

The application of this facility is to apply a transform to the position of painting that should be applied to the position alone and NOT to the paintable or to the graphics context.

For example, if T is a reflection through a horizontal axis that places the origin (0,0) at the lower left of a panel, then it would probably be a very bad idea to apply the reflection to the graphics context (which turns every object upside down) or to the paintable (which turns the paintable upside down). The transform should be applied to the position alone.

Recommendation: The paintAt methods are intended to be used if a designer wants to define a paintable at or near the origin of coordinates and then independently compute or retrieve the position at which the paintable will be painted. If the paintAt methods are used, it is recommended that the programmer avoid mutating the paintable directly since that will almost certainly lead to confusion and bugs. Either use mutation or use paintAt but not both.

Specified by:
paintAt in interface Paintable
Parameters:
g - the graphics context on which to paint
T - the affine transform to apply to the translation point
x - the original x-translation before transformation
y - the original y-translation before transformation

paintAt

public final void paintAt(Graphics g,
                          AffineTransform T,
                          Point2D p)

Without changing the paintable or the graphics context, paint the paintable in a translated position specified by the point in coordinates and the affine transform T; before painting the transform T should be applied to the point.

The application of this facility is to apply a transform to the position of painting that should be applied to the position alone and NOT to the paintable or to the graphics context.

For example, if T is a reflection through a horizontal axis that places the origin (0,0) at the lower left of a panel, then it would probably be a very bad idea to apply the reflection to the graphics context (which turns every object upside down) or to the paintable (which turns the paintable upside down). The transform should be applied to the position alone.

Recommendation: The paintAt methods are intended to be used if a designer wants to define a paintable at or near the origin of coordinates and then independently compute or retrieve the position at which the paintable will be painted. If the paintAt methods are used, it is recommended that the programmer avoid mutating the paintable directly since that will almost certainly lead to confusion and bugs. Either use mutation or use paintAt but not both.

Specified by:
paintAt in interface Paintable
Parameters:
g - the graphics context on which to paint
T - the affine transform to apply to the translation point
p - the original translation point before transformation

paintAsTiles

public final void paintAsTiles(Graphics g,
                               double x,
                               double y,
                               double w,
                               double h)

Repeatedly paints this object as a tile that covers the rectangle (x,y,w,h) in the graphics context g. The painting is clipped to this rectangle. The graphics context is unchanged when this method is done.

This method works appropriately if the width or height is negative.

However, the method does nothing if:

Specified by:
paintAsTiles in interface Paintable
Parameters:
g - the graphics context
x - the x-corner of the rectangle to tile
y - the y-corner of the rectangle to tile
w - the width of the rectangle to tile
h - the height of the rectangle to tile

paintAsTiles

public final void paintAsTiles(Graphics g,
                               double w,
                               double h)

Repeatedly paints this object as a tile that covers the rectangle (0,0,w,h) in the graphics context g. The painting is clipped to this rectangle. The graphics context is unchanged when this method is done.

This method works appropriately if the width or height is negative.

However, the method does nothing if:

Specified by:
paintAsTiles in interface Paintable
Parameters:
g - the graphics context
w - the width of the rectangle to tile
h - the height of the rectangle to tile

paintAsTiles

public final void paintAsTiles(Graphics g,
                               Rectangle2D rect)

Repeatedly paints this object as a tile that covers the given rectangle in the graphics context g. The painting is clipped to this rectangle. The graphics context is unchanged when this method is done.

The method does nothing if:

Specified by:
paintAsTiles in interface Paintable
Parameters:
g - the graphics context
rect - the rectangle to tile

getPreparedGraphics2D

public final Graphics2D getPreparedGraphics2D(Graphics g)

Returns a copy of the given graphics context after modifying the copy to clip to within the bounds region, to set anti-aliasing on, and to apply the opacity of this paintable if needed.

For convenience, the graphics context is returned as a Graphics2D object.

Specified by:
getPreparedGraphics2D in interface Paintable
Parameters:
g - the given graphics context to copy
Returns:
a suitably prepared copy of the given graphics context

makeSnapshot

public final BufferedImage makeSnapshot()

Constructs a BufferedImage object that is the same size as the bounding box of this paintable and then paints this paintable onto the buffered image with a suitable translation back to the origin.

This method creates a snapshot of the current visual state of the paintable.

The BufferedImage returned will have size at least 1-by-1 even if this paintable has 0 width or height.

Implemented via:

    PaintableTools.makeBufferedImage(this)

Specified by:
makeSnapshot in interface Paintable

getBounds2D

public XRect getBounds2D()

Returns a copy of the 2-dimensional bounds of the paintable.

If the value of getDefaultBounds2D is non-null, then returns this value.

Otherwise, returns the the bounds rectangle of the image under the mutator transform of the original bounds rectangle as computed by getOriginalBounds2D. In particular, if the current mutator is the identity transform, then returns getOriginalBounds2D.

This method may be overridden in a derived class if a more exact bounds rectangle may be calculated.

This method must not return null.

Specified by:
getBounds2D in interface Paintable
Returns:
a copy of the 2-dimensional bounds of the paintable

getCenter

public XPoint2D getCenter()

Returns a copy the center of the paintable.

If the value of getDefaultCenter is non-null, then return this value.

Otherwise, returns the image under the mutator transform of getOriginalCenter. In particular, if the current mutator is the identity transform, then returns getOriginalCenter.

This method may be overridden in a derived class if a more exact center may be calculated.

This method must not return null.

Specified by:
getCenter in interface Paintable
Returns:
a copy the center of the mutated paintable

getCorner

public final XPoint2D getCorner()

Returns a copy the corner of the paintable.

The corner is the top-left corner of the bounds rectangle returned by getBounds2D.

Specified by:
getCorner in interface Paintable
Returns:
a copy the corner of the mutated paintable

contains

public boolean contains(double x,
                        double y)

Tests if a point specified by coordinates is inside the paintable.

Specified by:
contains in interface Paintable
Parameters:
x - the x-coordinate of the point
y - the y-coordinate of the point
Returns:
whether or not a specified point is inside the paintable

contains

public final boolean contains(Point2D p)

Tests if a specified point is inside the paintable.

Specified by:
contains in interface Paintable
Parameters:
p - a specified point
Returns:
whether or not a specified point is inside the paintable

setVisible

public final void setVisible(boolean visible)

Sets the visibility property of this paintable.

The default for the visibility property should be true

.

Fires property change: SET_VISIBLE.

Specified by:
setVisible in interface Paintable
Parameters:
visible - the visibility setting

isVisible

public final boolean isVisible()
Returns the current visibility property of this paintable.

Specified by:
isVisible in interface Paintable

setOpacity

public final void setOpacity(float opacity)

Sets the opacity of this paintable to a value between 0 and 1.

Note that an opacity of 0 will make the paintable invisible. This is not recommended. Instead use setVisible(false).

Fires property change: SET_OPACITY.

Specified by:
setOpacity in interface Paintable
Parameters:
opacity - the opacity of this paintable

getOpacity

public final float getOpacity()
Returns the opacity value of this paintable between 0 and 1.

Specified by:
getOpacity in interface Paintable
Returns:
the opacity of this paintable

setBackgroundPaint

public final void setBackgroundPaint(Paint background)

Sets the background paint.

The paint may be set to null to eliminate background painting.

Fires property change: SET_BACKGROUND_PAINT.

Specified by:
setBackgroundPaint in interface Paintable
Parameters:
background - the background paint

getBackgroundPaint

public final Paint getBackgroundPaint()
Returns the background paint.

Specified by:
getBackgroundPaint in interface Paintable
Returns:
the background paint.

clearBackgroundPaint

public final void clearBackgroundPaint()

Clear the background paint.

Equivalent to:

    setBackgroundPaint(null);

Fires property change: SET_BACKGROUND_PAINT.

Specified by:
clearBackgroundPaint in interface Paintable

setBackgroundTile

public final void setBackgroundTile(Object object)

Sets the background tile paintable. The object passed should be a paintable or be convertible to a paintable via the method ComponentFactory.makePaintable.

The object may be set to null to eliminate background tiling.

Fires property change: SET_BACKGROUND_TILE.

Specified by:
setBackgroundTile in interface Paintable
Parameters:
object - the background tile object

getBackgroundTile

public final Paintable getBackgroundTile()
Returns the background tile.

Specified by:
getBackgroundTile in interface Paintable
Returns:
the background tile.

clearBackgroundTile

public final void clearBackgroundTile()

Clear the background tile.

Equivalent to:

    setBackgroundTile(null);

Fires property change: SET_BACKGROUND_TILE.

Specified by:
clearBackgroundTile in interface Paintable

clearBothBackgrounds

public final void clearBothBackgrounds()

Clear the both the background paint and the background tile.

Equivalent to:

    setBackgroundPaint(null);
     setBackgroundTile(null);

Fires property change: SET_BACKGROUND_PAINT.

Fires property change: SET_BACKGROUND_TILE.

Specified by:
clearBothBackgrounds in interface Paintable

setMutator

public void setMutator(AffineTransform M)

Sets the mutator transform to the given transform provided that the given transform is invertible and the paintable object supports this operation.

If the given transform is not invertible, the method does nothing.

Fires property change: SET_MUTATOR.

Remarks:

If the paintable object maintains a mutator object that transforms the paintable, then this method should set that mutator. Moreover, in this case, the method getMutator should return a copy of that mutator.

If the paintable object distributes mutation to internal data then this method may or may not make sense. The documentation of the implementation should state what, if anything, is done by this method. In particular, it is valid for the method getMutator to return an identity transform if no mutator is maintained explicitly.

Specified by:
setMutator in interface Paintable
Parameters:
M - the invertible affine transform to set as the mutator

addPreMutation

public void addPreMutation(AffineTransform M)

Composes the current mutator on the right with the given transform provided that the given transform is invertible and the paintable object supports this operation.

If the given transform is not invertible, the method does nothing.

Fires property change: SET_MUTATOR.

Remarks:

Normally, the action of the new mutator will be to apply the given transform and then to apply the old mutator.

If the paintable object distributes mutation to internal data then this method may or may not make sense. The documentation of the implementation should state what, if anything, is done by this method.

Specified by:
addPreMutation in interface Paintable
Parameters:
M - the invertible affine transform to compose

addPostMutation

public void addPostMutation(AffineTransform M)

Composes the current mutator on the left with the given transform provided that the given transform is invertible.

If the given transform is not invertible, the method does nothing.

Fires property change: SET_MUTATOR.

Remarks:

Normally, the action of the new mutator will be to apply the old mutator and then to apply the given transform.

This method should always have a meaningful interpretation for a paintable, that is, it should always be possible to apply a mutation that follows earlier mutations. If this method is implemented in a non-standard fashion, the documentation should state what is done.

Specified by:
addPostMutation in interface Paintable
Parameters:
M - the invertible affine transform to compose

setMutator

public void setMutator(Mutator.Strategy strategy)

Applies a Mutator.Strategy object to the paintable by constructing an affine transform using the original center of the paintable and then calling setMutator with this transform as the argument.

Fires property change: SET_MUTATOR.

This method may be implemented in a more sophisticated fashion if that is appropriate for a particular paintable.

Specified by:
setMutator in interface Paintable
Parameters:
strategy - the mutator strategy to apply

addPreMutation

public void addPreMutation(Mutator.Strategy strategy)

Applies a Mutator.Strategy object to the paintable by constructing an affine transform using the original center of the paintable and then calling addPreMutation with this transform as the argument.

Fires property change: SET_MUTATOR.

This method may be implemented in a more sophisticated fashion if that is appropriate for a particular paintable.

Specified by:
addPreMutation in interface Paintable
Parameters:
strategy - the mutator strategy to apply

addPostMutation

public void addPostMutation(Mutator.Strategy strategy)

Applies a Mutator.Strategy object to the paintable by constructing an affine transform using the mutated center of the paintable and then calling addPostMutation with this transform as the argument.

Fires property change: SET_MUTATOR.

This method may be implemented in a more sophisticated fashion if that is appropriate for a particular paintable.

Specified by:
addPostMutation in interface Paintable
Parameters:
strategy - the mutator strategy to apply

getMutator

public final AffineTransform getMutator()

Returns a copy of the existing mutator transform.

If the implementation other methods are overridden to distribute transforms to sub-objects, then this method may validly always return the identity transform. This method is final.

Specified by:
getMutator in interface Paintable
Returns:
a copy of the existing mutator transform

getMutatorInverse

public final AffineTransform getMutatorInverse()

Returns a copy of the existing mutator inverse transform.

If the implementation other methods are overridden to distribute transforms to sub-objects, then this method may validly always return the identity transform. This method is final.

Specified by:
getMutatorInverse in interface Paintable
Returns:
a copy of the existing mutator inverse transform

mutate

public final void mutate(AffineTransform M)

This method is implemented to do exactly the same operation as the corresponding method addPostMutation. In other words, this is simply a convenience method with a short name. This method is final.

Specified by:
mutate in interface Paintable
Parameters:
M - the invertible affine transform to compose
See Also:
addPostMutation(AffineTransform)

mutate

public final void mutate(Mutator.Strategy strategy)

This method is implemented to do exactly the same operation as the corresponding method addPostMutation. In other words, this is simply a convenience method with a short name. This method is final.

Specified by:
mutate in interface Paintable
Parameters:
strategy - the mutator strategy to apply
See Also:
addPostMutation(Mutator.Strategy)

move

public final void move(double dx,
                       double dy)

Moves the paintable by a translation using the data in the point specified by coordinates.

Specified by:
move in interface Paintable
Parameters:
dx - the x-coordinate of the translation
dy - the y-coordinate of the translation

move

public final void move(Point2D p)

Moves the paintable by a translation using the data in the point.

Specified by:
move in interface Paintable
Parameters:
p - the translation vector

moveCenterTo

public final void moveCenterTo(double x,
                               double y)

Moves the paintable by a translation in such a way that the paintable center specified by getCenter will move to the given point specified in coordinates.

Specified by:
moveCenterTo in interface Paintable
Parameters:
x - the x-coordinate of the desired center
y - the y-coordinate of the desired center

moveCenterTo

public final void moveCenterTo(Point2D p)

Moves the paintable by a translation in such a way that the paintable center specified by getCenter will move to the given point.

Specified by:
moveCenterTo in interface Paintable
Parameters:
p - the desired center

moveCornerTo

public final void moveCornerTo(double x,
                               double y)

Moves the paintable by a translation in such a way that the paintable corner specified by getCorner will move to the given point specified in coordinates.

Specified by:
moveCornerTo in interface Paintable
Parameters:
x - the x-coordinate of the desired corner
y - the y-coordinate of the desired corner

moveCornerTo

public final void moveCornerTo(Point2D p)

Moves the paintable by a translation in such a way that the paintable corner specified by getCorner will move to the given point.

Specified by:
moveCornerTo in interface Paintable
Parameters:
p - the desired corner

rotate

public final void rotate(double degrees)

Rotates the paintable about its center by the given angle in degrees.

Specified by:
rotate in interface Paintable
Parameters:
degrees - the rotation angle in degrees

reflect

public final void reflect(double degrees)
Reflects the paintable along the line through its center at the given angle in degrees.

Specified by:
reflect in interface Paintable
Parameters:
degrees - the angle in degrees of the line of reflection

hreflect

public final void hreflect()
Reflects the paintable along a horizontal axis through its center.

Specified by:
hreflect in interface Paintable

vreflect

public final void vreflect()
Reflects the paintable along a vertical axis through its center.

Specified by:
vreflect in interface Paintable

scale

public final void scale(double s)

Scales the paintable about its center by the given factor s uniformly in all directions.

Specified by:
scale in interface Paintable
Parameters:
s - the scale in all directions

scale

public final void scale(double degrees,
                        double s,
                        double t)

Scales the paintable about its center by the given factor s along the main axis at the given angle in degrees and the given factor t along the perpendicular axis.

Specified by:
scale in interface Paintable
Parameters:
degrees - the angle in degrees of the main scaling axis
s - the scale factor along the axis at angle degrees
t - the scale factor along the axis at angle degrees+90

shear

public final void shear(double degrees,
                        double s)

Shears the paintable about its center and with shear factor s along the line at the given angle in degrees.

In the special case when the center is at (0,0) and the angle in degrees is 0, this corresponds to the transform: (u,v) maps to (u+s*v,v), which fixes the x-axis and shears parallel to that axis.

In the general case, the fixed axis for the shear is the line at the given angle degrees through the center.

Specified by:
shear in interface Paintable
Parameters:
degrees - the angle in degrees of the fixed axis for shear
s - determines the amount of shear along lines parallel to the fixed axis for shear

glide

public final void glide(double degrees,
                        double distance)

Glides (translates) the paintable along a glide line at the given angle in degrees and the given glide distance.

Equivalent to specifing a translation via polar coordinates with the angle in degrees specified first and the distance specified second. The reason for specifying degrees first here is to be consistent with the usage of all other methods that have degrees as a parameter.

Specified by:
glide in interface Paintable
Parameters:
degrees - the angle in degrees of the line of glide
distance - the translation distance along the line of glide

glidereflect

public final void glidereflect(double degrees,
                               double distance)
Glide reflects the paintable along the line through its center at the given angle in degrees and the given glide distance.

Specified by:
glidereflect in interface Paintable
Parameters:
degrees - the angle in degrees of the line of glide reflection
distance - the translation distance along the line of glide reflection

lineartransform

public final void lineartransform(double m00,
                                  double m10,
                                  double m01,
                                  double m11)

Apply the linear transform given by the matrix coefficients m00, m10, m01, m11 as if the transform were centered at the center of the paintable. In other words, before applying the given transform, adjust it so that the center of the paintable remains fixed.

Note that the two coefficients of column 0 are given first and the two coefficients of column 1 are given next.

Specified by:
lineartransform in interface Paintable
Parameters:
m00 - the matrix coefficient in row 0 column 0
m10 - the matrix coefficient in row 1 column 0
m01 - the matrix coefficient in row 0 column 1
m11 - the matrix coefficient in row 1 column 1

affinetransform

public final void affinetransform(double m00,
                                  double m10,
                                  double m01,
                                  double m11,
                                  double m02,
                                  double m12)

Apply the affine transform given by the matrix coefficients m00, m10, m01, m11, m02, m12 as if the transform were centered at the center of the paintable.

Note that the two coefficients of column 0 are given first, the two coefficients of column 1 are given next, and the two coefficients of column 2 are given last.

Specified by:
affinetransform in interface Paintable
Parameters:
m00 - the matrix coefficient in row 0 column 0
m10 - the matrix coefficient in row 1 column 0
m01 - the matrix coefficient in row 0 column 1
m11 - the matrix coefficient in row 1 column 1
m02 - the matrix coefficient in row 0 column 2
m12 - the matrix coefficient in row 1 column 2

originalPaint

public abstract void originalPaint(Graphics g)

Paints onto a Graphics context using information from this object but without the use of the mutator transform.

A derived class must supply this method which is the foundation for the paint methods that use the mutator.

Normally this method will be called by the paint methods. Hence the designer of this method may assume that issues such as visibility, opacity, clipping, antialiasing, and mutation will be taken care of by the paint methods. Therefore, this method need only paint what must be painted with no adjustments.

When this method call is complete, the internal state of g should be unchanged. The override method must ensure this invariant.

Specified by:
originalPaint in interface Paintable
Parameters:
g - the graphics context on which to paint

getOriginalBounds2D

public final XRect getOriginalBounds2D()

Returns a copy of the 2-dimensional bounds of the original paintable prior to any mutation.

If the value of getDefaultOriginalBounds2D is non-null, then returns this value.

If the value of getActualBounds2D is non-null, then returns this value.

Otherwise, returns new XRect().

Specified by:
getOriginalBounds2D in interface Paintable
Returns:
a copy of the 2-dimensional bounds of the original paintable

getActualBounds2D

public abstract XRect getActualBounds2D()

Returns the actual bounds of the original paintable or null if the paintable is effectively empty.

A derived class must supply this method.

Specified by:
getActualBounds2D in interface Paintable

getOriginalCenter

public XPoint2D getOriginalCenter()

Returns a copy of the original center of the paint region.

In this class, the method is implemented as follows.

If the value of getDefaultOriginalCenter is non-null, then returns this value.

Otherwise, returns the center of the rectangle returned by the method getOriginalBounds2D.

A derived class may override this method if the object geometry suggests that a different center is more appropriate. However, if the user has set a default original center, this center must be returned by an override method.

This method must not return null.

Specified by:
getOriginalCenter in interface Paintable
Returns:
a copy of the center of the paint region

originalContains

public abstract boolean originalContains(double x,
                                         double y)

Tests if a point specified by coordinates is inside the original paintable without mutation.

A derived class must supply this method.

Specified by:
originalContains in interface Paintable
Parameters:
x - the x-coordinate of the point
y - the y-coordinate of the point
Returns:
whether or not a specified point is inside the original paintable

originalContains

public final boolean originalContains(Point2D p)

Tests if a specified point is inside the original paintable without mutation.

Specified by:
originalContains in interface Paintable
Parameters:
p - a specified Point2D
Returns:
whether or not a specified point is inside the original paintable

possiblyContains

protected final boolean possiblyContains(double x,
                                         double y)

Tests if a point specified by coordinates is possibly inside the original paintable.

This method returns true if and only if:

This is a possible helper method for implementing the method originalContains. Its use is up to the designer of a derived class.

Parameters:
x - the x-coordinate of the point
y - the y-coordinate of the point
Returns:
whether or not a specified point is possibly inside the paintable

applyOpacity

public final void applyOpacity(Graphics2D h)

Applies the current opacity to calculate and set a net opacity.

The following conditions must hold:

In the case that the graphics context has a Composite set of type AlphaComposite with rule SRC_OVER, then the net opacity is the product of the current opacity of this object and the alpha value of the AlphaComposite.

Otherwise the net opacity equals the current opacity of this object.

Specified by:
applyOpacity in interface Paintable
Parameters:
h - the graphics context whose opacity will be changed

setDefaultBounds2D

public final void setDefaultBounds2D(Rectangle2D rectangle)

Sets the default Bounds2D rectangle, that is, the default for computation of getBounds2D.

It is valid to set the default Bounds2D rectangle to null to force a computation of the bounds. Setting the default Bounds2D rectangle to a rectangle with zero width or height is equivalent to setting it to null.

Fires property change: SET_DEFAULT_BOUNDS2D.

Specified by:
setDefaultBounds2D in interface Paintable
Parameters:
rectangle - the default Bounds2D rectangle

getDefaultBounds2D

public final XRect getDefaultBounds2D()

Returns a copy of the default Bounds2D rectangle, that is, the default for computation of getBounds2D.

Returns null to signal no setting.

Specified by:
getDefaultBounds2D in interface Paintable
Returns:
a copy of the default Bounds2D rectangle

setDefaultCenter

public final void setDefaultCenter(Point2D center)

Sets the default center, that is, the default for computation of getCenter.

It is valid to set the default center to null to force a computation of the center.

Fires property change: SET_DEFAULT_CENTER.

Specified by:
setDefaultCenter in interface Paintable
Parameters:
center - the default center

getDefaultCenter

public final XPoint2D getDefaultCenter()

Returns a copy of the default center, that is, the default for computation of getCenter.

Returns null to signal no setting.

Specified by:
getDefaultCenter in interface Paintable
Returns:
a copy of the default center

setDefaultOriginalBounds2D

public final void setDefaultOriginalBounds2D(Rectangle2D rectangle)

Sets the default original Bounds2D rectangle, that is, the default for computation of getOriginalBounds2D.

It is valid to set the default original Bounds2D rectangle to null to force a computation of the bounds. Setting the default original Bounds2D rectangle to a rectangle with zero width or height is equivalent to setting it to null.

Fires property change: SET_DEFAULT_ORIGINAL_BOUNDS2D.

Specified by:
setDefaultOriginalBounds2D in interface Paintable
Parameters:
rectangle - the default original Bounds2D rectangle

getDefaultOriginalBounds2D

public final XRect getDefaultOriginalBounds2D()

Returns a copy of the default original Bounds2D rectangle, that is, the default for computation of getOriginalBounds2D.

Returns null to signal no setting.

Specified by:
getDefaultOriginalBounds2D in interface Paintable
Returns:
a copy of the default original Bounds2D rectangle

setDefaultOriginalCenter

public final void setDefaultOriginalCenter(Point2D center)

Sets the default original center, that is, the default for computation of getOriginalCenter.

It is valid to set the default original center to null to force a computation of the center.

Fires property change: SET_DEFAULT_ORIGINAL_CENTER.

Specified by:
setDefaultOriginalCenter in interface Paintable
Parameters:
center - the default original center

getDefaultOriginalCenter

public final XPoint2D getDefaultOriginalCenter()

Returns a copy of the default original center, that is, the default for computation of getOriginalCenter.

Returns null to signal no setting.

Specified by:
getDefaultOriginalCenter in interface Paintable
Returns:
a copy of the default original center

addPropertyChangeListener

public final void addPropertyChangeListener(PropertyChangeListener listener)

Add a PropertyChangeListener to the listener list. The listener is registered for all properties.

Specified by:
addPropertyChangeListener in interface SupportsPropertyChange
Parameters:
listener - the PropertyChangeListener to be added

addPropertyChangeListener

public final void addPropertyChangeListener(String propertyName,
                                            PropertyChangeListener listener)

Add a PropertyChangeListener to the listener list for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property.

Specified by:
addPropertyChangeListener in interface SupportsPropertyChange
Parameters:
propertyName - the name of the property to listen on
listener - the PropertyChangeListener to be added

addPropertyChangeListeners

public final void addPropertyChangeListeners(PropertyChangeListener[] listeners)

Add all items in the given PropertyChangeListener array to the listener list. These items are registered for all properties.

Specified by:
addPropertyChangeListeners in interface SupportsPropertyChange
Parameters:
listeners - the PropertyChangeListener array to be added

addPropertyChangeListeners

public final void addPropertyChangeListeners(String propertyName,
                                             PropertyChangeListener[] listeners)

Add all items in the given PropertyChangeListener array to the listener list for a specific property. These items will be invoked only when a call on firePropertyChange names that specific property.

Specified by:
addPropertyChangeListeners in interface SupportsPropertyChange
Parameters:
listeners - the PropertyChangeListener array to be added

removePropertyChangeListener

public final void removePropertyChangeListener(PropertyChangeListener listener)

Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Specified by:
removePropertyChangeListener in interface SupportsPropertyChange
Parameters:
listener - the PropertyChangeListener to be removed

removePropertyChangeListener

public final void removePropertyChangeListener(String propertyName,
                                               PropertyChangeListener listener)

Remove a PropertyChangeListener for a specific property.

Specified by:
removePropertyChangeListener in interface SupportsPropertyChange
Parameters:
propertyName - the name of the property that was listened on
listener - the PropertyChangeListener to be removed

getPropertyChangeListeners

public final PropertyChangeListener[] getPropertyChangeListeners()

Returns an array of all listeners that were added to this object.

Specified by:
getPropertyChangeListeners in interface SupportsPropertyChange
Returns:
an array with all listeners

getPropertyChangeListeners

public final PropertyChangeListener[] getPropertyChangeListeners(String propertyName)

Returns an array of all listeners that were added to this object and associated with the named property.

Specified by:
getPropertyChangeListeners in interface SupportsPropertyChange
Parameters:
propertyName - the name of the property to seek
Returns:
an array with all listeners for the given named property

hasListeners

public final boolean hasListeners(String propertyName)

Check if there are any listeners for a specific property.

Specified by:
hasListeners in interface SupportsPropertyChange
Parameters:
propertyName - the name of the property to check
Returns:
whether or not there are any listeners for a specific property

firePropertyChange

public final void firePropertyChange(String propertyName,
                                     Object oldValue,
                                     Object newValue)

Report a bound property update to any registered listeners. No event is fired if the old and new values are equal and non-null.

Specified by:
firePropertyChange in interface SupportsPropertyChange
Parameters:
propertyName - the programmatic name of the property that was changed
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

public final void firePropertyChange(String propertyName,
                                     boolean oldValue,
                                     boolean newValue)

Report a bound property update to any registered listeners. No event is fired if the old and new values are equal.

Specified by:
firePropertyChange in interface SupportsPropertyChange
Parameters:
propertyName - the programmatic name of the property that was changed
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

public final void firePropertyChange(String propertyName,
                                     char oldValue,
                                     char newValue)

Report a bound property update to any registered listeners. No event is fired if the old and new values are equal.

Specified by:
firePropertyChange in interface SupportsPropertyChange
Parameters:
propertyName - the programmatic name of the property that was changed
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

public final void firePropertyChange(String propertyName,
                                     byte oldValue,
                                     byte newValue)

Report a bound property update to any registered listeners. No event is fired if the old and new values are equal.

Specified by:
firePropertyChange in interface SupportsPropertyChange
Parameters:
propertyName - the programmatic name of the property that was changed
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

public final void firePropertyChange(String propertyName,
                                     short oldValue,
                                     short newValue)

Report a bound property update to any registered listeners. No event is fired if the old and new values are equal.

Specified by:
firePropertyChange in interface SupportsPropertyChange
Parameters:
propertyName - the programmatic name of the property that was changed
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

public final void firePropertyChange(String propertyName,
                                     int oldValue,
                                     int newValue)

Report a bound property update to any registered listeners. No event is fired if the old and new values are equal.

Specified by:
firePropertyChange in interface SupportsPropertyChange
Parameters:
propertyName - the programmatic name of the property that was changed
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

public final void firePropertyChange(String propertyName,
                                     long oldValue,
                                     long newValue)

Report a bound property update to any registered listeners. No event is fired if the old and new values are equal.

Specified by:
firePropertyChange in interface SupportsPropertyChange
Parameters:
propertyName - the programmatic name of the property that was changed
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

public final void firePropertyChange(String propertyName,
                                     float oldValue,
                                     float newValue)

Report a bound property update to any registered listeners. No event is fired if the old and new values are equal.

Specified by:
firePropertyChange in interface SupportsPropertyChange
Parameters:
propertyName - the programmatic name of the property that was changed
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

public final void firePropertyChange(String propertyName,
                                     double oldValue,
                                     double newValue)

Report a bound property update to any registered listeners. No event is fired if the old and new values are equal.

Specified by:
firePropertyChange in interface SupportsPropertyChange
Parameters:
propertyName - the programmatic name of the property that was changed
oldValue - the old value of the property
newValue - the new value of the property

firePropertyChange

public final void firePropertyChange(PropertyChangeEvent evt)

Fire an existing PropertyChangeEvent to any registered listeners. No event is fired if the given event's old and new values are equal and non-null.

Specified by:
firePropertyChange in interface SupportsPropertyChange
Parameters:
evt - the PropertyChangeEvent object

getForwardingListener

public final PropertyChangeForwardingListener getForwardingListener()

Returns the PropertyChangeForwardingListener that will forward the property change events it receives to this object.

Specified by:
getForwardingListener in interface SupportsPropertyChange
Returns:
the forwarding listener

addForwardingListener

public final void addForwardingListener(Object object)
Add the forwarding listener as a property change listener for the given object if the object supports property change.

Specified by:
addForwardingListener in interface SupportsPropertyChange
Parameters:
object - the object that should add the forwarding listener

removeForwardingListener

public final void removeForwardingListener(Object object)
Remove the forwarding listener as a property change listener for the given object if the object supports property change.

Specified by:
removeForwardingListener in interface SupportsPropertyChange
Parameters:
object - the object that should remove the forwarding listener

removeAndAddForwardingListener

public final void removeAndAddForwardingListener(Object oldobject,
                                                 Object newobject)
Remove the forwarding listener as a property change listener for the old object if the old object supports property change and add the forwarding listener as a property change listener for the new object if the new object supports property change.

Specified by:
removeAndAddForwardingListener in interface SupportsPropertyChange
Parameters:
oldobject - the old object that should remove the forwarding listener
newobject - the new object that should add the forwarding listener