|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.AbstractPaintable
edu.neu.ccs.gui.ClippingWrapper
The class ClippingWrapper will wrap a Paintable
and a clipping Shape to obtain a Paintable that
clips the original Paintable to the Shape.
In 2.3.5, the class was refactored to be consistent with
the new Paintable interface and
the new AbstractPaintable class.
In 2.4.0, this class was updated to be consistent with
refinements to the Paintable interface.
| Field Summary | |
private Shape |
clippingshape
The clipping shape. |
private Paintable |
paintable
The wrapped paintable. |
| Fields inherited from class edu.neu.ccs.gui.AbstractPaintable |
SET_BACKGROUND_PAINT, SET_BACKGROUND_TILE |
| 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 | |
ClippingWrapper()
The constructor that leaves the paintable and clipping shape as null. |
|
ClippingWrapper(Paintable paintable)
The constructor to specify the paintable to be wrapped. |
|
ClippingWrapper(Paintable paintable,
Shape clippingshape)
The constructor to specify the paintable to be wrapped and the clipping shape. |
|
| Method Summary | |
XRect |
getActualBounds2D()
Returns the actual bounds of the clipped paintable or null if the result is effectively empty. |
Shape |
getClippingShape()
Returns the clipping shape. |
Paintable |
getPaintable()
Returns the wrapped paintable. |
boolean |
originalContains(double x,
double y)
Tests if a point specified by coordinates is inside the clipped paintable without mutation. |
void |
originalPaint(Graphics g)
Paints onto a Graphics context using information
from this object but without the use of the mutator transform. |
void |
setClippingShape(Shape clippingshape)
Sets the clipping shape. |
void |
setPaintable(Paintable paintable)
Sets the paintable to be wrapped. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Paintable paintable
private Shape clippingshape
| Constructor Detail |
public ClippingWrapper()
null.
ClippingWrapper(Paintable),
ClippingWrapper(Paintable, Shape)public ClippingWrapper(Paintable paintable)
paintable - the paintable to be wrappedClippingWrapper(),
ClippingWrapper(Paintable, Shape)
public ClippingWrapper(Paintable paintable,
Shape clippingshape)
paintable - the paintable to be wrappedclippingshape - the clipping shapeClippingWrapper(),
ClippingWrapper(Paintable)| Method Detail |
public final void originalPaint(Graphics g)
Paints onto a Graphics context using information
from this object but without the use of the mutator transform.
If the wrapped paintable is null, this method will
not paint.
If the clipping shape is null, no clipping will be
done.
originalPaint in interface PaintableoriginalPaint in class AbstractPaintableg - the graphics context on which to paintpublic final XRect getActualBounds2D()
Returns the actual bounds of the clipped paintable or
null if the result is effectively empty.
Since the internal paintable may have a mutation or defaults
this method calls getBounds2D on the internal
paintable. Hence any mutation or defaults set for the internal
paintable are respected.
Then, if the clipping shape is non-null, its bounds
are intersected with the paintable bounds. If the resulting bounds
are non-trivial, they are returned. Otherwise, null
is returned.
getActualBounds2D in interface PaintablegetActualBounds2D in class AbstractPaintableAbstractPaintable.getBounds2D()
public final boolean originalContains(double x,
double y)
Tests if a point specified by coordinates is inside the clipped paintable without mutation.
originalContains in interface PaintableoriginalContains in class AbstractPaintablex - the x-coordinate of the pointy - the y-coordinate of the point
public final void setPaintable(Paintable paintable)
Sets the paintable to be wrapped.
The paintable may be set to null to eliminate the
paintable. This object will then paint nothing.
Fires property change: SET_PAINTABLE.
paintable - the paintable to be wrappedgetPaintable()public final Paintable getPaintable()
setPaintable(Paintable)public final void setClippingShape(Shape clippingshape)
Sets the clipping shape.
The clipping shape may be set to null to eliminate
special clipping of the wrapped paintable.
Fires property change: SET_CLIPPING_SHAPE.
clippingshape - the clipping shapegetClippingShape()public final Shape getClippingShape()
setClippingShape(Shape)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||