|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.berkeley.guir.lib.satin.objects.GraphicalObjectImpl
This is a sample implementation class for GraphicalObjects.
GraphicalObject
for background information on
Model-View-Controller, Interpreters, and Views.
This implementation of GraphicalObject separates all of the interaction
portions into an InteractionHandler
, all of the view portions into a
ViewHandler
, and all of the watch portions into a WatchableImpl
. Although there is a lot of indirection, we feel that this
significantly improves flexibility and generality.
defaultRender(SatinGraphics)
method. This method simply
tells the system how to draw the GraphicalObject under normal conditions.
Note that you cannot override render(SatinGraphics)
, as it is a
final method in this implementation.
You must also call setBoundingPoints2D(int, Shape)
before the
GraphicalObject is rendered. This method just sets the bounds of the
GraphicalObject, so the system knows where the GraphicalObject is and
what is looks like.
SatinConstants.COORD_LOCAL
.
SatinConstants.COORD_REL
.
SatinConstants.COORD_ABS
.
It is important to know what coordinate system you are in at all times. In general, this will likely be the most common bug you encounter. I wish there was a way to simplify this, but there seems to be times when you need easy access to the various coordinate systems. Let us know if you have any better ideas.
There are a host of utilities that convert from one coordinate system to
another, in GraphicalObjectLib
. Here's a quick overview:
GraphicalObjectLib.toLocalCoordinates(GraphicalObject,
GraphicalObject)
moves the first GraphicalObject to the coordinate
space of the other GraphicalObject, but keeping it in the same
absolute coordinates. In other words, you change the coordinate
system but it still appears in the same place.
GraphicalObjectLib.toLocalCoordinates(GraphicalObject,
Point2D, GraphicalObject)
and
GraphicalObjectLib.toLocalCoordinates(GraphicalObject,
Point2D, GraphicalObject, Point2D)
convert points from one coordinate
space to another.
GraphicalObjectLib.localToAbsolute(GraphicalObject, Point2D)
and GraphicalObjectLib.localToAbsolute(GraphicalObject,
Point2D, Point2D)
moves a point in some GraphicalObject's local
coordinates to absolute coordinates.
GraphicalObjectLib.absoluteToLocal(GraphicalObject, Point2D)
and GraphicalObjectLib.absoluteToLocal(GraphicalObject,
Point2D, Point2D)
do the opposite, moving from absolute to local
coordinates.
handleNewStroke(NewStrokeEvent)
handleUpdateStroke(UpdateStrokeEvent)
handleSingleStroke(SingleStrokeEvent)
For a more in-depth description of what happens behind the scenes, check out
GraphicalObject.onNewStroke(NewStrokeEvent)
. This event model is a
key aspect to understanding how the system works.
If you've skimmed over the docs, you probably noticed the methods
setGestureInterpreter(Interpreter)
,
setInkInterpreter(Interpreter)
, and setView(View)
.
Basically, these methods let you plug-in new Interpreters and Views.
You may want to look over the interface for Interpreter
and
View
before proceeding.
The Gesture Interpreter lets you try to process strokes as
gestures, such as cut and copy. The Ink Interpreter lets you
preprocess strokes as ink, such as straightening it up. Again, check out
GraphicalObject.onNewStroke(NewStrokeEvent)
for a diagram showing
exactly when these Interpreters are used.
Views let you specify how this GraphicalObject is displayed.
If you recall from earlier, there are two different rendering methods,
render(SatinGraphics)
and defaultRender(SatinGraphics)
.
Note that the defaultRender()
method is not part of
GraphicalObject, but part of this implementation. The reason for this is
that in this implementation, render()
simply delegates the
rendering to the current View. By default, the current View just calls
defaultRender()
. Thus the reason for two different rendering
methods.
So what if you want to have more than one Interpreter
or
View
? This is where MultiInterpreter
s and MultiView
s
come in.
MultiInterpreter
is a special kind of Interpreter that contains
multiple Interpreters. The MultiInterpreter simply decides in what order
the Interpreters are called and how to combine their results. A
MultiView
does the same thing for Views. An example of a
MultiView is the SemanticZoomMultiViewImpl
, which lets you
change how GraphicalObjects appear at different zoom levels.
One special kind of notification is the damage notification, used
to force the current GraphicalObject to be repainted. There are a host of
damage methods, with the primary differences being when the
repainting occurs and what area is to be repainted. For
example, calling damage(int)
with the
SatinConstants.DAMAGE_NOW
constant forces the GraphicalObject to be
repainted immediately, while calling damage(int, Rectangle2D)
with
the SatinConstants.DAMAGE_LATER
constant repaints the specified
rectangle at a later time, when it is more convenient for the system.
In most cases, the damage call is made for you automatically.
The more general mechanism for notifications is implemented in two methods,
notifyWatchersUpdate(Object)
and
notifyWatchersUpdate(String, Object, Object)
. Check out
SatinConstants
for some constants that define the existing types of
messages in Satin. Again, in most cases, notifications are automatically
sent for you, but there may be cases in your own subclasses that you want to
send out additional messages.
The notification and damage mechanisms can be disabled, via the
disableNotify()
and disableDamage()
methods.
They can also be re-enabled via the enableNotify()
and
enableDamage()
methods. The methods hasNotifyEnabled()
and
hasDamageEnabled()
can be used to check the current status.
The general notification mechanism and damage mechanism are independent of
one another. Disabling one has no effect on the other.
Please note that the enable/disable mechanism works like a counting
semaphore. Every time you call a disable
method, the disabled
value is incremented by one. Every time you call a enable
method, the disabled value is decremented by one. The mechanism is enabled
if and only if the value is 0.
toString()
, and clone()
and deepClone()
. The
system will still work (for the most part) if you don't override these,
but it won't be 100% correct.
The toString()
method is used to get debugging statements. The
default implementation of toString() provides a great deal of debugging
information about known state, but needs some help to print out debugging
information about state internal to your own GraphicalObject. Just override
toString(), make the super call to toString() as the first thing you do, and
just append the information.
The clone()
and deepClone()
methods are used for copying
GraphicalObjects. If you don't implement these methods correctly, then you
can't do copying-and-pasting.
Lastly, there is method that you may have to override for
correctness. GraphicalObject defines
minDistance(int, double, double)
assuming that you want the minimum
distance from the specified point to any point on your GraphicalObject,
handling open polygons and points inside the Polygon correctly. This will
probably be right for nearly every GraphicalObject.
This software is distributed under the Berkeley Software License.
Revisions: - SATIN-v1.0-1.0.0, Oct 06 1998, JH Created class - SATIN-v2.1-1.0.0, Aug 11 2000, JH Touched for SATIN release
Inner classes inherited from class edu.berkeley.guir.lib.satin.SatinConstants |
SatinConstants.ObjectPoolAffineTransform, SatinConstants.ObjectPoolPoint2D, SatinConstants.ObjectPoolPolygon2D, SatinConstants.ObjectPoolRectangle2D, SatinConstants.ObjectPoolStringBuffer, SatinConstants.UniqueAffineTransform, SatinConstants.UniquePoint2D, SatinConstants.UniquePolygon2D, SatinConstants.UniqueRectangle2D |
Fields inherited from interface edu.berkeley.guir.lib.satin.objects.GraphicalObject |
GESTUREINTRP_CLPROPERTY, INKINTRP_CLPROPERTY, STYLE_CLPROPERTY, VIEW_CLPROPERTY |
Constructor Summary | |
GraphicalObjectImpl()
Default constructor, does nothing fancy. |
|
GraphicalObjectImpl(GraphicalObjectImpl gob)
Constructor for clone-chaining purposes. |
Method Summary | |
void |
addIndexedProperty(String strPropertyName,
Object newVal)
|
Watcher |
addWatcher(Watcher w)
Add a watcher to this object. |
void |
applyTransform(AffineTransform newTx)
Apply an affine Transform to this Graphical Object. |
void |
bringDownALayer()
Bring this Graphical Object down one layer in its current group. |
void |
bringDownNLayers(int n)
Bring this Graphical Object down N layers in its current group. |
void |
bringToBottomLayer()
Bring this Graphical Object to the bottom of its current group. |
void |
bringToTopLayer()
Bring this Graphical Object to the top of its current group. |
void |
bringUpALayer()
Bring this Graphical Object up one layer in its current group. |
void |
bringUpNLayers(int n)
Bring this Graphical Object up N layers in its current group. |
void |
clearIndexedProperty(String strPropertyName)
|
void |
clearWatchers()
Delete all watchers on this object. |
Object |
clone()
My clone sleeps alone... |
protected GraphicalObjectImpl |
clone(GraphicalObjectImpl gobClone)
Clone all of the state in the current GraphicalObject into the passed GraphicalObject. |
boolean |
contains(double x,
double y)
See if this GraphicalObject contains the specified point. |
boolean |
contains(double x,
double y,
double w,
double h)
See if this GraphicalObject contains the specified rectangle. |
boolean |
contains(Point2D p)
See if this GraphicalObject contains the specified point. |
boolean |
contains(Rectangle2D r)
See if this GraphicalObject contains the specified rectangle. |
int |
countWatchers()
Count the number of watchers watching this object. |
protected InteractionHandler |
createNewInteractionHandler()
Override this method if you want to use your own InteractionHandler. |
protected ViewHandler |
createNewViewHandler()
Override this method if you want to use your own ViewHandler. |
void |
damage(int sync)
If this GraphicalObject hasNotifyEnabled() , mark this
GraphicalObject as damaged and repaint. |
void |
damage(int sync,
GraphicalObject gob)
If this GraphicalObject hasNotifyEnabled() , mark the specified
GraphicalObject as damaged and repaint. |
void |
damage(int sync,
Rectangle2D rect)
If this GraphicalObject hasNotifyEnabled() , mark the specified
region as damaged and repaint. |
void |
damage(int sync,
Rectangle2D oldBounds,
Rectangle2D newBounds)
If this GraphicalObject hasNotifyEnabled() , mark the specified
regions as damaged and repaint. |
Object |
deepClone()
If you do not override this method, it calls clone() by default. |
protected GraphicalObjectImpl |
deepClone(GraphicalObjectImpl gobClone)
|
protected abstract void |
defaultRender(SatinGraphics g)
The default method for rendering. |
void |
delete()
Delete this object. |
void |
disableDamage()
Turn off damage mechanism temporarily. |
void |
disableNotify()
Turn off ability to notify others. |
void |
enableDamage()
Re-enable damage mechanism. |
void |
enableNotify()
Turn on ability to notify others. |
boolean |
equals(Object obj)
Simply tests if the two IDs are the same or not. |
String |
getAbsoluteLayer()
Get the absolute layer this group is in. |
Polygon2D |
getBoundingPoints2D(int cdsys)
Get a Polygon describing the outer boundary of all of the visible views of this GraphicalObject. |
Polygon2D |
getBoundingPoints2D(int cdsys,
AffineTransform tx,
Polygon2D poly)
Get a Polygon describing the outer boundary of all of the visible views of this GraphicalObject. |
protected Polygon2D |
getBoundingPoints2DRef()
Get a reference of the relative bounding points instead of a copy. |
Rectangle |
getBounds()
|
Rectangle2D |
getBounds2D()
Get the relative bounds. |
Rectangle2D |
getBounds2D(int cdsys)
Get the bounds of all of the visible views of this GraphicalObject. |
Rectangle2D |
getBounds2D(int cdsys,
AffineTransform tx,
Rectangle2D rect)
Get the bounds of all of the visible views of this GraphicalObject. |
static boolean |
getClassDebugProperty()
|
Object |
getClassProperty(String strPropertyName)
Convenience method to get a reference to the specified property. |
Interpreter |
getClassPropertyGestureInterpreter()
Convenience method for getting the view class property. |
Interpreter |
getClassPropertyInkInterpreter()
Convenience method for getting the view class property. |
Style |
getClassPropertyStyle()
Convenience method for getting the view class property. |
View |
getClassPropertyView()
Convenience method for getting the view class property. |
Interpreter |
getGestureInterpreter()
Get the current Gesture Interpreter, which tries to handle strokes as gestures. |
float |
getHeight2D(int cdsys)
Get the height of all of the visible views of this GraphicalObject. |
List |
getIndexedProperty(String strPropertyName)
|
Object |
getIndexedProperty(String strPropertyName,
int index)
|
Interpreter |
getInkInterpreter()
Get the current Ink Interpreter, which tries to handle strokes as Ink. |
protected InteractionHandler |
getInteractionHandler()
Get the interaction handler, the object that we delegate most of our interactions to. |
AffineTransform |
getInverseTransform(int cdsys)
Get the inverse of the transform. |
AffineTransform |
getInverseTransform(int cdsys,
AffineTransform outTx)
Get the inverse transform. |
protected Polygon2D |
getLocalBoundingPoints2DRef()
Get a reference of the local bounding points instead of a copy. |
Point2D |
getLocation2D(int cdsys)
Get the location of the top-left corner of the bounding box for all of the visible views of this GraphicalObject. |
Point2D |
getLocation2D(int cdsys,
AffineTransform tx,
Point2D pt)
Get the location of the top-left corner of the bounding box for all of the visible views of this GraphicalObject. |
GraphicalObjectGroup |
getParentGroup()
Get the parent of this Graphical object. |
PathIterator |
getPathIterator(AffineTransform at)
Get the path iterator, relative coordinates. |
PathIterator |
getPathIterator(AffineTransform at,
double flatness)
|
String |
getPresentationName()
|
Object |
getProperty(String strPropertyName)
|
Iterator |
getPropertyNames()
|
String |
getRelativeLayer()
Get the current layer this Graphical Object is in. |
Sheet |
getSheet()
Get the sheet that this Graphical object is in. |
Style |
getStyle()
Get a copy of the current Style for this Graphical Object. |
Style |
getStyleRef()
Get a reference of the current Style for this Graphical Object. |
AffineTransform |
getTransform(int cdsys)
Get a copy of the current transform for this GraphicalObject. |
AffineTransform |
getTransform(int cdsys,
AffineTransform outTx)
Get a copy of the current transform, putting the results in outTx. |
AffineTransform |
getTransformRef()
Get a reference to the current transform. |
int |
getUniqueID()
Get the ID of this GraphicalObject. |
View |
getView()
Get the current View for this GraphicalObject, the object that handles how the the GraphicalObject is displayed. |
protected ViewHandler |
getViewHandler()
Get the view handler, the object that we delegate most of our views to. |
float |
getWidth2D(int cdsys)
Get the width of all of the visible views of this GraphicalObject. |
void |
handleNewStroke(NewStrokeEvent evt)
This callback is called when the stroke should be handled by this object. |
void |
handleSingleStroke(SingleStrokeEvent evt)
|
void |
handleUpdateStroke(UpdateStrokeEvent evt)
|
boolean |
hasClosedBoundingPoints()
Check if the bounding points describing this GraphicalObject is a closed Polygon (e.g. |
boolean |
hasDamageEnabled()
See if damage is enabled or not. |
boolean |
hasNotifyEnabled()
Check current ability to notify others. |
boolean |
intersects(double x,
double y,
double w,
double h)
Check if the specified rectangle intersects this GraphicalObject (relative coordinates). |
boolean |
intersects(Rectangle2D r)
Check if the specified rectangle intersects this GraphicalObject (relative coordinates). |
boolean |
isClippedToBounds()
Check whether the GraphicalObject should be clipped to bounds or not. |
protected boolean |
isDirty()
Check if this GraphicalObject's bounds are dirty (ie the GraphicalObject has been moved or reshaped, etc) and should be recalculated. |
boolean |
isSelectable()
Check whether or not this Graphical Object can be selected. |
boolean |
isVisible()
Check whether this GraphicalObject is visible or not. |
float |
minDistance(int cdsys,
double x,
double y)
Calculate the closest distance from the specified point to self. |
float |
minDistance(int cdsys,
Point2D pt)
Calls the other minDistance(int, double, double) method. |
protected float |
minLocalDistance(double x,
double y)
Assumes the specified point is in local coordinates. |
void |
moveBy(int cdsys,
double dx,
double dy)
Move relative to where we currently are. |
void |
moveBy(int cdsys,
Point2D pt)
Calls the other moveBy(int, double, double) method. |
void |
moveTo(int cdsys,
double x,
double y)
Move directly to the specified position. |
void |
moveTo(int cdsys,
Point2D pt)
Calls the other moveTo(int, double, double) method. |
void |
notifyWatchers()
Notify the watchers. |
void |
notifyWatchers(Object arg)
Notify the watchers. |
void |
notifyWatchersDelete()
Notify the watchers that this object has been deleted. |
void |
notifyWatchersUpdate(Object arg)
Notify the watchers that the object has been changed and the change needs to be handled by the watchers. |
void |
notifyWatchersUpdate(String strProperty,
Object oldVal,
Object newVal)
Notify the watchers that some value has been changed. |
void |
onNewStroke(NewStrokeEvent evt)
Here is an overview of how dispatching works in Satin. |
void |
onSingleStroke(SingleStrokeEvent evt)
|
void |
onUpdateStroke(UpdateStrokeEvent evt)
|
void |
postProcessNewStroke(NewStrokeEvent evt)
|
void |
postProcessSingleStroke(SingleStrokeEvent evt)
|
void |
postProcessUpdateStroke(UpdateStrokeEvent evt)
|
void |
preProcessNewStroke(NewStrokeEvent evt)
|
void |
preProcessSingleStroke(SingleStrokeEvent evt)
|
void |
preProcessUpdateStroke(UpdateStrokeEvent evt)
|
void |
redispatchNewStroke(NewStrokeEvent evt)
|
void |
redispatchSingleStroke(SingleStrokeEvent evt)
|
void |
redispatchUpdateStroke(UpdateStrokeEvent evt)
|
List |
removeIndexedProperty(String strPropertyName)
|
Object |
removeIndexedProperty(String strPropertyName,
int index)
|
Object |
removeProperty(String strPropertyName)
|
Watcher |
removeWatcher(Watcher w)
Delete a watcher on this object. |
void |
render(SatinGraphics g)
Don't override this method. |
protected void |
renderAllCoordBounds(SatinGraphics g,
Rectangle2D bounds)
Render the tiny boxes displaying the numerical coordinates of the bounding box. |
protected void |
renderBoundingBox(SatinGraphics g,
Rectangle2D bounds)
Render the bounding box around this GraphicalObject. |
protected void |
renderDebug(SatinGraphics g,
Rectangle2D rect)
Render the graphical debugging information. |
protected void |
renderDimensions(SatinGraphics g,
Rectangle2D bounds)
Render the height and width of this GraphicalObject. |
protected void |
renderSelected(SatinGraphics g,
Rectangle2D rect)
Render how this Graphical Object is displayed when selected. |
protected void |
renderSelectionHandle(SatinGraphics g,
int x,
int y)
Paint a selection handle centered at the specified coordinate. |
void |
setBoundingPoints2D(int cdsys,
Shape s)
Set the bounding points for our default view. |
static void |
setClassDebugProperty(boolean flag)
Set graphical debugging mode. |
void |
setClassProperty(String strPropertyName,
Object obj)
Convenience method to set a property. |
void |
setClassPropertyGestureInterpreter(Interpreter intrp)
Convenience method for setting the view class property. |
void |
setClassPropertyInkInterpreter(Interpreter intrp)
Convenience method for setting the view class property. |
void |
setClassPropertyStyle(Style s)
Convenience method for setting the view class property. |
void |
setClassPropertyView(View v)
Convenience method for setting the view class property. |
void |
setClipToBounds(boolean flag)
Set whether the GraphicalObject should be clipped to bounds or not. |
protected void |
setDirty()
Call this method if this GraphicalObject's bounds have been changed. |
Interpreter |
setGestureInterpreter(Interpreter intrp)
Set the current Gesture Interpreter, which tries to handle strokes as gestures. |
void |
setHasClosedBoundingPoints(boolean flag)
Set whether or not this GraphicalObject is a closed shape or not. |
void |
setIndexedProperty(String strPropertyName,
int index,
Object newVal)
|
Interpreter |
setInkInterpreter(Interpreter intrp)
Set the current Ink Interpreter, which tries to handle strokes as Ink. |
protected InteractionHandler |
setInteractionHandler(InteractionHandler newHandler)
Set the interaction handler. |
protected void |
setLocalBoundingPoints2DRef(Polygon2D poly)
Set the reference to the bounding points. |
void |
setParentGroup(GraphicalObjectGroup newParent)
This method should not normally be used. |
void |
setProperty(String strPropertyName,
Object newVal)
|
void |
setRelativeLayer(int layer)
A convenience method to set what layer this object is in. |
void |
setSelectable(boolean flag)
Set whether or not this Graphical Object can be selected. |
Style |
setStyle(Style newStyle)
Set the current Style for this Graphical Object. |
void |
setTransform(AffineTransform newTx)
Set and apply a copy of the specified AffineTransform to this GraphicalObject. |
protected void |
setTransformInternal(AffineTransform newTx)
An internal version of setTransform() that does not try to update the normalizing transform. |
void |
setUniqueID(int newID)
Set the ID of this GraphicalObject. |
void |
setView(View v)
Set the View for this GraphicalObject. |
protected ViewHandler |
setViewHandler(ViewHandler newHandler)
Set the view handler. |
void |
setVisible(boolean flag)
Set whether this GraphicalObject should be displayed or not. |
boolean |
shapeContains(GraphicalObject gob)
In most cases should not override this method. |
boolean |
shapeContains(int cdsys,
double x,
double y)
In most cases should not override this method. |
boolean |
shapeContains(int cdsys,
Point2D pt)
In most cases should not override this method. |
boolean |
shapeContains(int cdsys,
Shape s)
In most cases should not override this method. |
protected boolean |
shapeContainsInternal(Point2D pt)
Internal method. |
protected boolean |
shapeContainsInternal(Shape s)
Internal method. |
boolean |
shapeIntersects(GraphicalObject gob)
In most cases should not override this method. |
boolean |
shapeIntersects(int cdsys,
Shape s)
In most cases should not override this method. |
protected boolean |
shapeIntersectsInternal(Shape s)
Internal method. |
String |
toDebugString()
Some debugging info. |
String |
toString()
|
protected void |
updateBoundingPoints()
Update cached copies of our bounds. |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GraphicalObjectImpl()
public GraphicalObjectImpl(GraphicalObjectImpl gob)
Cloning in Java is broken, since there is no clone chaining (like there is constructor chaining). This means that the bottom-most subclass has to do all of the work, unless you have constructors like these to help out.
Method Detail |
public static void setClassDebugProperty(boolean flag)
public static boolean getClassDebugProperty()
public final void setClassProperty(String strPropertyName, Object obj)
public final Object getClassProperty(String strPropertyName)
public final void setClassPropertyView(View v)
public final View getClassPropertyView()
public final void setClassPropertyStyle(Style s)
public final Style getClassPropertyStyle()
public final void setClassPropertyGestureInterpreter(Interpreter intrp)
public final Interpreter getClassPropertyGestureInterpreter()
public final void setClassPropertyInkInterpreter(Interpreter intrp)
public final Interpreter getClassPropertyInkInterpreter()
protected InteractionHandler createNewInteractionHandler()
protected InteractionHandler getInteractionHandler()
protected InteractionHandler setInteractionHandler(InteractionHandler newHandler)
protected ViewHandler createNewViewHandler()
protected ViewHandler getViewHandler()
protected ViewHandler setViewHandler(ViewHandler newHandler)
public int getUniqueID()
GraphicalObject
getUniqueID
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public void setUniqueID(int newID)
GraphicalObject
setUniqueID
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public Iterator getPropertyNames()
getPropertyNames
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.getPropertyNames()
public Object getProperty(String strPropertyName)
getProperty
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.getProperty(String)
public void setProperty(String strPropertyName, Object newVal)
setProperty
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.setProperty(String, Object)
public Object removeProperty(String strPropertyName)
removeProperty
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.removeProperty(String)
public List getIndexedProperty(String strPropertyName)
getIndexedProperty
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.getIndexedProperty(String)
public Object getIndexedProperty(String strPropertyName, int index)
getIndexedProperty
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.getIndexedProperty(String, int)
public void setIndexedProperty(String strPropertyName, int index, Object newVal)
setIndexedProperty
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.setIndexedProperty(String, int, Object)
public void addIndexedProperty(String strPropertyName, Object newVal)
addIndexedProperty
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.addIndexedProperty(String, Object)
public Object removeIndexedProperty(String strPropertyName, int index)
removeIndexedProperty
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.removeIndexedProperty(String, int)
public List removeIndexedProperty(String strPropertyName)
removeIndexedProperty
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.removeIndexedProperty(String)
public void clearIndexedProperty(String strPropertyName)
clearIndexedProperty
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
FlexProperties.clearIndexedProperty(String)
public void setView(View v)
GraphicalObject
setView
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.getView()
,
View.setBoundingPoints2DRef(Polygon2D)
public View getView()
GraphicalObject
getView
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.setView(View)
public Interpreter getGestureInterpreter()
GraphicalObject
getGestureInterpreter
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public Interpreter setGestureInterpreter(Interpreter intrp)
GraphicalObject
setGestureInterpreter
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
intrp
- is the new Interpreter to use.public Interpreter getInkInterpreter()
GraphicalObject
getInkInterpreter
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public Interpreter setInkInterpreter(Interpreter intrp)
GraphicalObject
setInkInterpreter
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
intrp
- is the new Interpreter to use.public Style setStyle(Style newStyle)
GraphicalObject
Notifies Watchers of an update when called.
setStyle
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
the
- Style to set to. A null value means use default values.public Style getStyle()
GraphicalObject
getStyle
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public Style getStyleRef()
GraphicalObject
getStyleRef
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public String getRelativeLayer()
GraphicalObject
Main Tree |-- | A Collection | |-- | | Relative: 1 | | Absolute: 1 | | | | |-- | | | Relative: 1 | | | Absolute: 1.1 | | |-- | | | | |-- | | | Relative: 2 | | | Absolute: 1.2 | | |-- | |-- | | Another Collection | |-- | | Relative: 2 | | Absolute: 2 | | | | |-- | | | Relative: 1 | | | Absolute: 2.1 | | |-- | |-- |--
getRelativeLayer
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public void setRelativeLayer(int layer)
GraphicalObject
Notifies Watchers of an update when called.
setRelativeLayer
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
layer
- is the non-negative layer value to set to. If it is set
too high, it is just sent to the bottom-most layer.public String getAbsoluteLayer()
GraphicalObject
getAbsoluteLayer
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public void bringUpALayer()
GraphicalObject
Notifies Watchers of an update when called.
bringUpALayer
in interface GraphicalObject
public void bringUpNLayers(int n)
GraphicalObject
Notifies Watchers of an update when called.
bringUpNLayers
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
n
- is the number of layers to move this GraphicalObject up.public void bringDownALayer()
GraphicalObject
Notifies Watchers of an update when called.
bringDownALayer
in interface GraphicalObject
public void bringDownNLayers(int n)
GraphicalObject
Notifies Watchers of an update when called.
bringDownNLayers
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
n
- is the number of layers to move this GraphicalObject down.public void bringToTopLayer()
GraphicalObject
Notifies Watchers of an update when called.
bringToTopLayer
in interface GraphicalObject
public void bringToBottomLayer()
GraphicalObject
Notifies Watchers of an update when called.
bringToBottomLayer
in interface GraphicalObject
protected void setDirty()
isDirty()
protected boolean isDirty()
setDirty()
protected void updateBoundingPoints()
protected void setTransformInternal(AffineTransform newTx)
protected void setLocalBoundingPoints2DRef(Polygon2D poly)
protected Polygon2D getLocalBoundingPoints2DRef()
You can override this behavior to grab the bounding points from somewhere else instead of from the views if you want.
Because this method can be overridden, ViewHandler's method
ViewHandler.getViewBoundingPoints2DRef()
should not be called.
Instead, this method should be used.
protected Polygon2D getBoundingPoints2DRef()
You can override this behavior to grab the bounding points from somewhere else instead of from the views if you want.
public void applyTransform(AffineTransform newTx)
GraphicalObject
Notifies Watchers of an update when called.
applyTransform
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
newTx
- is a Transform to apply. No modifications are made to newTx.public void setTransform(AffineTransform newTx)
GraphicalObject
Notifies Watchers of an update when called.
setTransform
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
newTx
- is a Transform to apply. Removes the old one completely.
No modifications are made to newTx.public AffineTransform getTransform(int cdsys)
GraphicalObject
getTransform
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public AffineTransform getTransform(int cdsys, AffineTransform outTx)
GraphicalObject
getTransform
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system.outTx
- is the storage space.outTx
.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public AffineTransform getInverseTransform(int cdsys)
GraphicalObject
getInverseTransform
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public AffineTransform getInverseTransform(int cdsys, AffineTransform outTx)
GraphicalObject
getInverseTransform
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.outTx
- is the output storage. Use null to create a new object.outTx
SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public AffineTransform getTransformRef()
GraphicalObject
getTransformRef
in interface GraphicalObject
public void setParentGroup(GraphicalObjectGroup newParent)
setParentGroup
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
newParent
- is the parent to set to. Use null if this object does
not have a parent.public GraphicalObjectGroup getParentGroup()
GraphicalObject
getParentGroup
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public Sheet getSheet()
GraphicalObject
getSheet
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public void delete()
GraphicalObject
Also notifies Watchers of a delete when called.
delete
in interface GraphicalObject
public float minDistance(int cdsys, double x, double y)
GraphicalObject
minDistance
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system.x
- is the x-coordinate.y
- is the y-coordinate.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public float minDistance(int cdsys, Point2D pt)
GraphicalObject
GraphicalObject.minDistance(int, double, double)
method.minDistance
in interface GraphicalObject
protected float minLocalDistance(double x, double y)
public Point2D getLocation2D(int cdsys)
GraphicalObject
getLocation2D
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.GraphicalObject.getLocation2D(int, AffineTransform, Point2D)
,
SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public Point2D getLocation2D(int cdsys, AffineTransform tx, Point2D pt)
GraphicalObject
getLocation2D
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.tx
- is the transform to apply after the location is
retrieved. Use null for none.pt
- is where to store the output. Use null to create a
new point. Use for optimization purposes.pt
.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public Rectangle2D getBounds2D(int cdsys)
GraphicalObject
getBounds2D
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.GraphicalObject.getBounds2D(int)
,
SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public Rectangle2D getBounds2D(int cdsys, AffineTransform tx, Rectangle2D rect)
GraphicalObject
getBounds2D
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.tx
- is the transform to apply after the location is
retrieved. Use null for none.rect
- is the Rectangle to put the results in. Use null to create
a new Rectangle. Use for optimization purposes.rect
.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public Polygon2D getBoundingPoints2D(int cdsys)
GraphicalObject
getBoundingPoints2D
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public Polygon2D getBoundingPoints2D(int cdsys, AffineTransform tx, Polygon2D poly)
GraphicalObject
getBoundingPoints2D
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.tx
- is the transform to apply after the location is
retrieved. Use null for none.poly
- is the Polygon to put the results in. Use null to
create a new Polygon. Use for optimization purposes.poly
.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public float getWidth2D(int cdsys)
GraphicalObject
getWidth2D
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public float getHeight2D(int cdsys)
GraphicalObject
getHeight2D
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public void setHasClosedBoundingPoints(boolean flag)
GraphicalObject
setHasClosedBoundingPoints
in interface GraphicalObject
public boolean hasClosedBoundingPoints()
GraphicalObject
hasClosedBoundingPoints
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public boolean isSelectable()
GraphicalObject
isSelectable
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public void setSelectable(boolean flag)
GraphicalObject
setSelectable
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
flag
- is true to set this Graphical Object as selectable,
false otherwise.public void moveTo(int cdsys, double x, double y)
GraphicalObject
Notifies Watchers of an update when called.
moveTo
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.x
- is the x-coordinate to move to.y
- is the y-coordinate to move to.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public void moveTo(int cdsys, Point2D pt)
GraphicalObject
GraphicalObject.moveTo(int, double, double)
method.moveTo
in interface GraphicalObject
public void moveBy(int cdsys, double dx, double dy)
GraphicalObject
Notifies Watchers of an update when called.
moveBy
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.dx
- is the change in x-coordinate to move.dy
- is the change in y-coordinate to move.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public void moveBy(int cdsys, Point2D pt)
GraphicalObject
GraphicalObject.moveBy(int, double, double)
method.moveBy
in interface GraphicalObject
public void setBoundingPoints2D(int cdsys, Shape s)
GraphicalObject
Notifies Watchers of an update when called.
setBoundingPoints2D
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
cdsys
- is the coordinate system to use.s
- is the shape that describes our bounds.GraphicalObject.getView()
,
SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public void onNewStroke(NewStrokeEvent evt)
GraphicalObject
TimedStroke
as
it is dispatched. When a TimedStroke is created, a message is dispatched
to the Sheet
signifying that a Stroke is being created, via
onNewStroke(). As the TimedStroke is updated,
onUpdateStroke()
is called on the Sheet. After it is
completed, onSingleStroke()
is called on the Sheet.
--------------- ------------------ ------------------ --->|onNewStroke()|--->|onUpdateStroke()|--->|onSingleStroke()| --------------- ------------------ ------------------ | ^ | | |____|
Here's what happens in Sheet when onNewStroke() is called, in order.
onNewStroke()
- message that a new stroke is
being created
preProcessNewStroke()
- use interpreter to process
stroke as gesture
redispatchNewStroke()
- redispatch the stroke
to others
postProcessNewStroke()
- use interpreter to
process stroke as ink
handleNewStroke()
- handle the stroke, ie add,
ignore, etc.
onUpdateStroke()
and
onSingleStroke()
are called.
Here's a full example of what happens. Suppose you are drawing a stroke on top of a GraphicalObject (which in turn is contained by the Sheet). In the notation below, the sheet is designated with s and the GraphicalObject is designated with g. The indentation represents different levels of the call stack. Here are the methods that are called:
s.onNewStroke() // this occurs once per TimedStroke s.preProcessNewStroke() s.redispatchNewStroke() g.onNewStroke() g.preProcessNewStroke() g.getGestureInterpreter().handleNewStroke() g.redispatchNewStroke() g.postProcessNewStroke() g.getInkInterpreter().handleNewStroke() g.handleNewStroke() s.postProcessNewStroke() s.handleNewStroke() s.onUpdateStroke() // this occurs multiple times s.preProcessUpdateStroke() s.redispatchUpdateStroke() g.onUpdateStroke() g.preProcessUpdateStroke() g.getGestureInterpreter().handleUpdateStroke() g.redispatchUpdateStroke() g.postProcessUpdateStroke() g.getInkInterpreter().handleUpdateStroke() g.handleUpdateStroke() s.postProcessUpdateStroke() s.handleUpdateStroke() s.onSingleStroke() // this occurs once per TimedStroke s.preProcessSingleStroke() s.redispatchSingleStroke() g.onSingleStroke() g.preProcessSingleStroke() g.getGestureInterpreter().handleSingleStroke() g.redispatchSingleStroke() g.postProcessSingleStroke() g.getInkInterpreter().handleSingleStroke() g.handleSingleStroke() s.postProcessSingleStroke() s.handleSingleStroke()
onNewStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
evt
- is the event to dispatch. evt should be in this
GraphicalObject's local coordinate space when this method is
called.for information on how to manipulate the event.
public void preProcessNewStroke(NewStrokeEvent evt)
preProcessNewStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void redispatchNewStroke(NewStrokeEvent evt)
redispatchNewStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void postProcessNewStroke(NewStrokeEvent evt)
postProcessNewStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void handleNewStroke(NewStrokeEvent evt)
StrokeListener
SatinEvent.setConsumed()
with true to signify that it is
consumed and no one else should handle it. Furthermore, if you don't
want the stroke to be rendered, then call
SatinEvent.setShouldRender(boolean)
with false. By default, the
stroke will be rendered.handleNewStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void onUpdateStroke(UpdateStrokeEvent evt)
onUpdateStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void preProcessUpdateStroke(UpdateStrokeEvent evt)
preProcessUpdateStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void redispatchUpdateStroke(UpdateStrokeEvent evt)
redispatchUpdateStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void postProcessUpdateStroke(UpdateStrokeEvent evt)
postProcessUpdateStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void handleUpdateStroke(UpdateStrokeEvent evt)
handleUpdateStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void onSingleStroke(SingleStrokeEvent evt)
onSingleStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void preProcessSingleStroke(SingleStrokeEvent evt)
preProcessSingleStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void redispatchSingleStroke(SingleStrokeEvent evt)
redispatchSingleStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void postProcessSingleStroke(SingleStrokeEvent evt)
postProcessSingleStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
public void handleSingleStroke(SingleStrokeEvent evt)
handleSingleStroke
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.onNewStroke(NewStrokeEvent)
protected boolean shapeContainsInternal(Point2D pt)
protected boolean shapeContainsInternal(Shape s)
protected boolean shapeIntersectsInternal(Shape s)
public boolean shapeContains(GraphicalObject gob)
shapeContains
in interface GraphicalObject
for overriding.
public boolean shapeContains(int cdsys, Point2D pt)
shapeContains
in interface GraphicalObject
for overriding.
public boolean shapeContains(int cdsys, double x, double y)
shapeContains
in interface GraphicalObject
for overriding.
public boolean shapeContains(int cdsys, Shape s)
shapeContains
in interface GraphicalObject
for overriding.
public boolean shapeIntersects(GraphicalObject gob)
shapeIntersects
in interface GraphicalObject
for overriding.
public boolean shapeIntersects(int cdsys, Shape s)
shapeIntersects
in interface GraphicalObject
for overriding.
public boolean contains(double x, double y)
Use GraphicalObjectLib.toLocalCoordinates(GraphicalObject,
Point2D, GraphicalObject)
or
GraphicalObjectLib.toLocalCoordinates(GraphicalObject, Point2D,
GraphicalObject, Point2D)
to convert the point. Since you want the
coordinates in relative coordinates (ie our parent's coordinates),
you would do something like:
dst.contains(
GraphicalObjectLib.toLocalCoordinates(src, pt, dst.getParentGroup())
);
In most cases should not override this method.
contains
in interface Shape
x
- is the x-coordinate of the point (relative coords).y
- is the y-coordinate of the point (relative coords).for overriding.
public boolean contains(double x, double y, double w, double h)
In most cases should not override this method.
contains
in interface Shape
x
- is the top-left of the rectangle (in this GraphicalObject's
coordinate space, ie relative).y
- is the top-left of the rectangle (in this GraphicalObject's
coordinate space, ie relative).w
- is the width of the rectangle.h
- is the height of the rectangle.for overriding.
,
for an example of converting coordinate
systems correctly.
public boolean contains(Point2D p)
In most cases should not override this method.
contains
in interface Shape
p
- is the point to check (in this GraphicalObject's
coordinate space, ie relative).for overriding.
,
for an example of converting coordinate
systems correctly.
public boolean contains(Rectangle2D r)
In most cases should not override this method.
contains
in interface Shape
r
- is the rectangle to check (in this GraphicalObject's
coordinate space, ie relative).for overriding.
public Rectangle getBounds()
getBounds
in interface Shape
public Rectangle2D getBounds2D()
getBounds2D
in interface Shape
public PathIterator getPathIterator(AffineTransform at)
In most cases should not override this method.
getPathIterator
in interface Shape
for overriding.
public PathIterator getPathIterator(AffineTransform at, double flatness)
getPathIterator
in interface Shape
public boolean intersects(double x, double y, double w, double h)
In most cases should not override this method.
intersects
in interface Shape
for overriding.
,
for an example of converting coordinate
systems correctly.
public boolean intersects(Rectangle2D r)
In most cases should not override this method.
intersects
in interface Shape
for overriding.
public Watcher addWatcher(Watcher w)
Watchable
addWatcher
in interface Watchable
edu.berkeley.guir.lib.satin.watch.Watchable
w
- is the Watcher to add.public int countWatchers()
Watchable
countWatchers
in interface Watchable
public Watcher removeWatcher(Watcher w)
Watchable
removeWatcher
in interface Watchable
edu.berkeley.guir.lib.satin.watch.Watchable
public void clearWatchers()
Watchable
clearWatchers
in interface Watchable
public void enableNotify()
Watchable
enableNotify
in interface Watchable
edu.berkeley.guir.lib.satin.watch.Watchable
Watchable.disableNotify()
public void disableNotify()
Watchable
disableNotify
in interface Watchable
public boolean hasNotifyEnabled()
Watchable
hasNotifyEnabled
in interface Watchable
edu.berkeley.guir.lib.satin.watch.Watchable
Watchable.disableNotify()
,
Watchable.enableNotify()
public void notifyWatchers()
Watchable
notifyWatchers
in interface Watchable
public void notifyWatchers(Object arg)
Watchable
notifyWatchers
in interface Watchable
public void notifyWatchersUpdate(Object arg)
Watchable
notifyWatchersUpdate
in interface Watchable
edu.berkeley.guir.lib.satin.watch.Watchable
arg
- is the argument to send to all Watchers.public void notifyWatchersUpdate(String strProperty, Object oldVal, Object newVal)
Watchable
notifyWatchersUpdate
in interface Watchable
edu.berkeley.guir.lib.satin.watch.Watchable
strProperty
- is some agreed upon name for the property.oldVal
- is the old value.newVal
- is the new value. It should be a clone, not a
reference to the actual value, unless it is
prohibitively expensive to clone. Whether this is a
copy or a reference should be defined in the
SatinConstants file.SatinConstants
public void notifyWatchersDelete()
Watchable
notifyWatchersDelete
in interface Watchable
public void setVisible(boolean flag)
GraphicalObject
setVisible
in interface GraphicalObject
public boolean isVisible()
GraphicalObject
isVisible
in interface GraphicalObject
public void disableDamage()
GraphicalObject
This method is useful if you are doing multiple operations to the same GraphicalObject all at once, but don't want to damage the GraphicalObject until all the operations are done.
disableDamage
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.enableDamage()
,
GraphicalObject.hasDamageEnabled()
public void enableDamage()
GraphicalObject
enableDamage
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.disableDamage()
,
GraphicalObject.hasDamageEnabled()
public boolean hasDamageEnabled()
GraphicalObject
hasDamageEnabled
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
GraphicalObject.disableDamage()
,
GraphicalObject.enableDamage()
public void setClipToBounds(boolean flag)
GraphicalObject
setClipToBounds
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
flag
- specifies whether the GraphicalObject should be clipped
to bounds or not.public boolean isClippedToBounds()
GraphicalObject
isClippedToBounds
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
public void damage(int sync)
GraphicalObject
Watchable.hasNotifyEnabled()
, mark this
GraphicalObject as damaged and repaint.damage
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
sync
- is either SatinConstants.DAMAGE_NOW
or
SatinConstants.DAMAGE_LATER
SatinConstants.DAMAGE_NOW
,
SatinConstants.DAMAGE_LATER
public void damage(int sync, GraphicalObject gob)
GraphicalObject
Watchable.hasNotifyEnabled()
, mark the specified
GraphicalObject as damaged and repaint.damage
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
sync
- is either SatinConstants.DAMAGE_NOW
or
SatinConstants.DAMAGE_LATER
gob
- is the GraphicalObject to repaint.SatinConstants.DAMAGE_NOW
,
SatinConstants.DAMAGE_LATER
public void damage(int sync, Rectangle2D rect)
GraphicalObject
Watchable.hasNotifyEnabled()
, mark the specified
region as damaged and repaint.damage
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
sync
- is either SatinConstants.DAMAGE_NOW
or
SatinConstants.DAMAGE_LATER
rect
- is the rectangle to damage (absolute coordinates).SatinConstants.DAMAGE_NOW
,
SatinConstants.DAMAGE_LATER
public void damage(int sync, Rectangle2D oldBounds, Rectangle2D newBounds)
GraphicalObject
Watchable.hasNotifyEnabled()
, mark the specified
regions as damaged and repaint. This method is typically used when
transforms are applied, when the GraphicalObject was in one place
and is now in another.damage
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
sync
- is either SatinConstants.DAMAGE_NOW
or
SatinConstants.DAMAGE_LATER
oldRect
- is the rectangle to damage (absolute coordinates).newRect
- is the rectangle to damage (absolute coordinates).SatinConstants.DAMAGE_NOW
,
SatinConstants.DAMAGE_LATER
public final void render(SatinGraphics g)
render
in interface GraphicalObject
edu.berkeley.guir.lib.satin.objects.GraphicalObject
g
- is the Graphics context to draw in.protected abstract void defaultRender(SatinGraphics g)
protected void renderDebug(SatinGraphics g, Rectangle2D rect)
This method is called only if this Graphical Object's view is visible
(see and View#isVisible()
), and if it is not the
current stroke.
Default behavior is to render the absolute bounding box and absolute coordinates of the bounding box.
Override this method in a subclass to change how the debugging
information is rendered on screen. When this method is called,
SatinGraphics.ignoreTransforms()
has already been called for you.
After this method is done, SatinGraphics.dontIgnoreTransforms()
will be called for you. In other words, you are in absolute coordinates
for rendering.
g
- is the SatinGraphics context.rect
- is the bounding box (absolute coordinates).protected void renderSelected(SatinGraphics g, Rectangle2D rect)
This method is called only if this Graphical Object's view is visible
(see and View#isVisible()
).
Default behavior is to render selection handles around the bounding box.
Override this method in a subclass to change how the debugging
information is rendered on screen. When this method is called,
SatinGraphics.ignoreTransforms()
has already been called for you.
After this method is done, SatinGraphics.dontIgnoreTransforms()
will be called for you. In other words, you are in absolute coordinates
for rendering.
g
- is the SatinGraphics context.rect
- is the bounding box (absolute coordinates).protected void renderSelectionHandle(SatinGraphics g, int x, int y)
x
- is the x-coordinate to paint at.y
- is the y-coordinate to paint at.protected void renderAllCoordBounds(SatinGraphics g, Rectangle2D bounds)
protected void renderBoundingBox(SatinGraphics g, Rectangle2D bounds)
protected void renderDimensions(SatinGraphics g, Rectangle2D bounds)
public boolean equals(Object obj)
equals
in class Object
public Object clone()
clone
in interface GraphicalObject
clone
in class Object
protected GraphicalObjectImpl clone(GraphicalObjectImpl gobClone)
gobClone
- is a GraphicalObject that will get the same
GraphicalObject state as the current Graphical Object.public Object deepClone()
deepClone
in interface GraphicalObject
protected GraphicalObjectImpl deepClone(GraphicalObjectImpl gobClone)
public String getPresentationName()
public final String toString()
toString
in class Object
public String toDebugString()
Do not call method toString() in any implementation of toDebugString(). Method toString() calls toDebugString().
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |