|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--edu.neu.ccs.gui.PaintableSequenceComposite
The class PaintableSequenceComposite is a base
class for the construction of Paintable classes.
Although the class is not abstract, nothing useful can be done
with it directly.
A derived class can control exactly what is inserted into the
internal PaintableSequence via the protected access
method getPaintableSequence() but this sequence is
not visible to a public caller. Thus, all features of a
PaintableSequence are available to a derived class
without public exposure of this implementation.
Aside from the protected access method
getPaintableSequence(),
all methods simply implement the two interfaces
Paintable() and SupportsPropertyChange()
and do this by delegation to the internal paintable sequence.
| Field Summary |
| 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 |
| 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 | |
PaintableSequenceComposite()
|
|
| 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 |
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. |
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. |
Rectangle2D |
getBounds2D()
Returns a copy of the 2-dimensional bounds of the paint region affected by the paint method. |
Point2D |
getCenter()
Returns a copy of the center of the paint region affected by the paint method. |
PropertyChangeForwardingListener |
getForwardingListener()
Returns the PropertyChangeForwardingListener that
will forward the property change events it receives to this object. |
float |
getOpacity()
Returns the opacity value of this paintable between 0 and 1. |
protected PaintableSequence |
getPaintableSequence()
Returns the internal paintable sequence. |
Graphics2D |
getPreparedGraphics2D(Graphics g)
Returns a copy of the given graphics context after modifying the copy to set anti-aliasing on, to clip to within the bounds region, and to apply the opacity of the 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. |
boolean |
hasListeners(String propertyName)
Check if there are any listeners for a specific property. |
boolean |
isVisible()
Returns the current visibility property of this paintable. |
void |
paint(Graphics g)
Paints onto a Graphics context g using information
from this object provided that the visibility property of the
object is set to true. |
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 |
setOpacity(float opacity)
Sets the opacity value of this paintable between 0 and 1. |
void |
setVisible(boolean visible)
Sets the visibility property of this paintable. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PaintableSequenceComposite()
| Method Detail |
protected PaintableSequence getPaintableSequence()
Returns the internal paintable sequence.
public void paint(Graphics g)
PaintablePaints onto a Graphics context g using information
from this object provided that the visibility property of the
object is set to true.
After this method call is complete, the internal state of g
should be unchanged. In addition, this method should not paint
outside of the region returned by getBounds2D.
Implementation recommendation:
To achieve the above goals, it is recommended that the graphics
context g be copied to a new graphics context h and that the clip
region of h be intersected with the Bounds2D rectangle. This may
be done directly or may be achieved in one step by using the
method getPreparedGraphics2D which also takes care of
other issues.
paint in interface Paintableg - the graphics context on which to paintpublic Rectangle2D getBounds2D()
Paintablepaint method.
getBounds2D in interface Paintablepublic Point2D getCenter()
PaintableReturns a copy of the center of the paint region affected
by the paint method.
By default, this method may be implemented to return the center of the rectangle returned by getBounds2D(). However, a different result is permitted if the object geometry so dictates.
getCenter in interface Paintable
public boolean contains(double x,
double y)
PaintableTests if a point specified by coordinates is inside the paintable.
This method must return false if one or more of the
following conditions occurs:
getBounds2D.isVisible returns false.
contains in interface Paintablex - the x-coordinate of the pointy - the y-coordinate of the point
public boolean contains(Point2D p)
PaintableTests if a specified point is inside the paintable.
This method must return false if one or more of the
following conditions occurs:
null.getBounds2D.isVisible returns false.
contains in interface Paintablep - a specified Point2D
public void setVisible(boolean visible)
PaintableSets the visibility property of this paintable.
The default for the visibility property should be true
setVisible in interface Paintablevisible - the visibility settingPaintable.isVisible()public boolean isVisible()
Paintable
isVisible in interface PaintablePaintable.setVisible(boolean)public void setOpacity(float opacity)
Paintable
setOpacity in interface Paintableopacity - the opacity value of this paintable between 0 and 1Paintable.getOpacity()public float getOpacity()
Paintable
getOpacity in interface PaintablePaintable.setOpacity(float)public Graphics2D getPreparedGraphics2D(Graphics g)
PaintableReturns a copy of the given graphics context after modifying the copy to set anti-aliasing on, to clip to within the bounds region, and to apply the opacity of the paintable if needed.
For convenience, return the graphics context as a
Graphics2D object.
getPreparedGraphics2D in interface Paintableg - the given graphics context to copy
public void addPropertyChangeListener(PropertyChangeListener listener)
SupportsPropertyChangeAdd a PropertyChangeListener to the listener list.
The listener is registered for all properties.
This method is found in:
- Component
- JComponent
- PropertyChangeSupport
- SwingPropertyChangeSupport
addPropertyChangeListener in interface SupportsPropertyChangelistener - the PropertyChangeListener to be added
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
SupportsPropertyChangeAdd 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.
This method is found in:
- Component
- JComponent
- PropertyChangeSupport
- SwingPropertyChangeSupport
addPropertyChangeListener in interface SupportsPropertyChangepropertyName - the name of the property to listen onlistener - the PropertyChangeListener to be addedpublic void addPropertyChangeListeners(PropertyChangeListener[] listeners)
SupportsPropertyChangeAdd all items in the given PropertyChangeListener array
to the listener list. These items are registered for all properties.
addPropertyChangeListeners in interface SupportsPropertyChangelisteners - the PropertyChangeListener array to be added
public void addPropertyChangeListeners(String propertyName,
PropertyChangeListener[] listeners)
SupportsPropertyChangeAdd 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.
addPropertyChangeListeners in interface SupportsPropertyChangelisteners - the PropertyChangeListener array to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
SupportsPropertyChangeRemove a PropertyChangeListener from the listener list.
This removes a PropertyChangeListener that was registered
for all properties.
This method is found in:
- Component
- JComponent
- PropertyChangeSupport
- SwingPropertyChangeSupport
removePropertyChangeListener in interface SupportsPropertyChangelistener - the PropertyChangeListener to be removed
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
SupportsPropertyChangeRemove a PropertyChangeListener for a specific property.
This method is found in:
- Component
- JComponent
- PropertyChangeSupport
- SwingPropertyChangeSupport
removePropertyChangeListener in interface SupportsPropertyChangepropertyName - the name of the property that was listened onlistener - the PropertyChangeListener to be removedpublic PropertyChangeListener[] getPropertyChangeListeners()
SupportsPropertyChangeReturns an array of all listeners that were added to this object.
This method is found in:
- Component
- JComponent
- PropertyChangeSupport
- SwingPropertyChangeSupport
getPropertyChangeListeners in interface SupportsPropertyChangepublic PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
SupportsPropertyChangeReturns an array of all listeners that were added to this object and associated with the named property.
This method is found in:
- Component
- JComponent
- PropertyChangeSupport
- SwingPropertyChangeSupport
getPropertyChangeListeners in interface SupportsPropertyChangepropertyName - the name of the property to seek
public boolean hasListeners(String propertyName)
SupportsPropertyChangeCheck if there are any listeners for a specific property.
This method is found in:
- PropertyChangeSupport
- SwingPropertyChangeSupport
hasListeners in interface SupportsPropertyChangepropertyName - the name of the property to check
public void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
SupportsPropertyChangeReport a bound property update to any registered listeners. No event is fired if the old and new values are equal and non-null.
This method is found in:
Component as a protected methodJComponent as a protected methodPropertyChangeSupportSwingPropertyChangeSupport
firePropertyChange in interface SupportsPropertyChangepropertyName - the programmatic name of the property that was changedoldValue - the old value of the propertynewValue - the new value of the property
public void firePropertyChange(String propertyName,
boolean oldValue,
boolean newValue)
SupportsPropertyChangeReport a bound property update to any registered listeners. No event is fired if the old and new values are equal.
This is merely a convenience wrapper around the more general firePropertyChange method that takes Object values.
This method is found in:
Component as a protected methodJComponentPropertyChangeSupportSwingPropertyChangeSupport
firePropertyChange in interface SupportsPropertyChangepropertyName - the programmatic name of the property that was changedoldValue - the old value of the propertynewValue - the new value of the property
public void firePropertyChange(String propertyName,
char oldValue,
char newValue)
SupportsPropertyChangeReport a bound property update to any registered listeners. No event is fired if the old and new values are equal.
This is merely a convenience wrapper around the more general firePropertyChange method that takes Object values.
This method is found in:
- JComponent
firePropertyChange in interface SupportsPropertyChangepropertyName - the programmatic name of the property that was changedoldValue - the old value of the propertynewValue - the new value of the property
public void firePropertyChange(String propertyName,
byte oldValue,
byte newValue)
SupportsPropertyChangeReport a bound property update to any registered listeners. No event is fired if the old and new values are equal.
This is merely a convenience wrapper around the more general firePropertyChange method that takes Object values.
This method is found in:
- JComponent
firePropertyChange in interface SupportsPropertyChangepropertyName - the programmatic name of the property that was changedoldValue - the old value of the propertynewValue - the new value of the property
public void firePropertyChange(String propertyName,
short oldValue,
short newValue)
SupportsPropertyChangeReport a bound property update to any registered listeners. No event is fired if the old and new values are equal.
This is merely a convenience wrapper around the more general firePropertyChange method that takes Object values.
This method is found in:
- JComponent
firePropertyChange in interface SupportsPropertyChangepropertyName - the programmatic name of the property that was changedoldValue - the old value of the propertynewValue - the new value of the property
public void firePropertyChange(String propertyName,
int oldValue,
int newValue)
SupportsPropertyChangeReport a bound property update to any registered listeners. No event is fired if the old and new values are equal.
This is merely a convenience wrapper around the more general firePropertyChange method that takes Object values.
This method is found in:
Component as a protected methodJComponentPropertyChangeSupportSwingPropertyChangeSupport
firePropertyChange in interface SupportsPropertyChangepropertyName - the programmatic name of the property that was changedoldValue - the old value of the propertynewValue - the new value of the property
public void firePropertyChange(String propertyName,
long oldValue,
long newValue)
SupportsPropertyChangeReport a bound property update to any registered listeners. No event is fired if the old and new values are equal.
This is merely a convenience wrapper around the more general firePropertyChange method that takes Object values.
This method is found in:
- JComponent
firePropertyChange in interface SupportsPropertyChangepropertyName - the programmatic name of the property that was changedoldValue - the old value of the propertynewValue - the new value of the property
public void firePropertyChange(String propertyName,
float oldValue,
float newValue)
SupportsPropertyChangeReport a bound property update to any registered listeners. No event is fired if the old and new values are equal.
This is merely a convenience wrapper around the more general firePropertyChange method that takes Object values.
This method is found in:
- JComponent
firePropertyChange in interface SupportsPropertyChangepropertyName - the programmatic name of the property that was changedoldValue - the old value of the propertynewValue - the new value of the property
public void firePropertyChange(String propertyName,
double oldValue,
double newValue)
SupportsPropertyChangeReport a bound property update to any registered listeners. No event is fired if the old and new values are equal.
This is merely a convenience wrapper around the more general firePropertyChange method that takes Object values.
This method is found in:
- JComponent
firePropertyChange in interface SupportsPropertyChangepropertyName - the programmatic name of the property that was changedoldValue - the old value of the propertynewValue - the new value of the propertypublic void firePropertyChange(PropertyChangeEvent evt)
SupportsPropertyChangeFire 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.
This method is found in:
- PropertyChangeSupport
- SwingPropertyChangeSupport
firePropertyChange in interface SupportsPropertyChangeevt - the PropertyChangeEvent objectpublic PropertyChangeForwardingListener getForwardingListener()
SupportsPropertyChangeReturns the PropertyChangeForwardingListener that
will forward the property change events it receives to this object.
getForwardingListener in interface SupportsPropertyChangepublic void addForwardingListener(Object object)
SupportsPropertyChange
addForwardingListener in interface SupportsPropertyChangeobject - the object that should add the forwarding listenerpublic void removeForwardingListener(Object object)
SupportsPropertyChange
removeForwardingListener in interface SupportsPropertyChangeobject - the object that should remove the forwarding listener
public void removeAndAddForwardingListener(Object oldobject,
Object newobject)
SupportsPropertyChange
removeAndAddForwardingListener in interface SupportsPropertyChangeoldobject - the old object that should remove the forwarding listenernewobject - the new object that should add the forwarding listener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||