|
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 |
A GraphicalObject is anything with some state, dynamically redefinable views on that state, and dynamically redefinable behaviors to manipulate that state.
The idea behind a GraphicalObject is to separate an object into the Model, View, Controller pattern (MVC). The Model is the underlying data structures, the Controllers handle the input, and the Views handle the output. A Model can have multiple Controllers and Views.
In the standard MVC, the Model is the center of the triad, with Views and Controllers attached to it. What we are investigating with SATIN is to see if we can make the View more central, dynamically changing the Model and Controllers as necessary.
The reason for this is to support not what the computer recognizes, but what the human perceives. Since the View is the portion that the human perceives, we wish to make it more central to interaction. Interpreters try to recognize what's on the screen (ie what you perceive) and try to help you manage and manipulate the information in a useful way.
This software is distributed under the Berkeley Software License.
Revisions: - SATIN-v1.0-1.0.0, Oct 26 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 |
Field Summary | |
static String |
GESTUREINTRP_CLPROPERTY
Class property for View. |
static String |
INKINTRP_CLPROPERTY
Class property for View. |
static String |
STYLE_CLPROPERTY
Class property for Style. |
static String |
VIEW_CLPROPERTY
Class property for View. |
Method Summary | |
void |
addIndexedProperty(String strPropertyName,
Object newVal)
|
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)
|
Object |
clone()
Clone this object shallowly, copying references to any children this GraphicalObject has. |
void |
damage(int sync)
If this GraphicalObject Watchable.hasNotifyEnabled() , mark this
GraphicalObject as damaged and repaint. |
void |
damage(int sync,
GraphicalObject gob)
If this GraphicalObject Watchable.hasNotifyEnabled() , mark the specified
GraphicalObject as damaged and repaint. |
void |
damage(int sync,
Rectangle2D rect)
If this GraphicalObject Watchable.hasNotifyEnabled() , mark the specified
region as damaged and repaint. |
void |
damage(int sync,
Rectangle2D oldRect,
Rectangle2D newRect)
If this GraphicalObject Watchable.hasNotifyEnabled() , mark the specified
regions as damaged and repaint. |
Object |
deepClone()
Clone this object deeply, recursively deep-cloning any children this GraphicalObject has. |
void |
delete()
Delete this object. |
void |
disableDamage()
Turn off damage mechanism temporarily. |
void |
enableDamage()
Re-enable damage mechanism. |
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. |
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. |
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. |
AffineTransform |
getInverseTransform(int cdsys)
Get the inverse of the transform. |
AffineTransform |
getInverseTransform(int cdsys,
AffineTransform outTx)
Get the inverse transform. |
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. |
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. |
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 |
isClippedToBounds()
Check whether the GraphicalObject should be clipped to bounds or not. |
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. |
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 |
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)
|
void |
render(SatinGraphics g)
Render this graphical object in the specified Graphics context. |
void |
setBoundingPoints2D(int cdsys,
Shape s)
Set the bounding points for our default view. |
void |
setClipToBounds(boolean flag)
Set whether the GraphicalObject should be clipped to bounds or not. |
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. |
void |
setParentGroup(GraphicalObjectGroup newParent)
Set who the parent of this Graphical Object is. |
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. |
void |
setUniqueID(int newID)
Set the ID of this GraphicalObject. |
void |
setView(View v)
Set the View for this GraphicalObject. |
void |
setVisible(boolean flag)
Set whether this GraphicalObject should be displayed or not. |
boolean |
shapeContains(GraphicalObject gob)
See if the specified GraphicalObject fits entirely within our bounds. |
boolean |
shapeContains(int cdsys,
double x,
double y)
See if we contain the specified point. |
boolean |
shapeContains(int cdsys,
Point2D pt)
See if we contain the specified point. |
boolean |
shapeContains(int cdsys,
Shape s)
See if we contain the specified rectangle. |
boolean |
shapeIntersects(GraphicalObject gob)
See if the specified GraphicalObject intersects the this GraphicalObject. |
boolean |
shapeIntersects(int cdsys,
Shape s)
See if we intersect the specified shape. |
Methods inherited from interface edu.berkeley.guir.lib.satin.watch.Watchable |
addWatcher, clearWatchers, countWatchers, disableNotify, enableNotify, hasNotifyEnabled, notifyWatchers, notifyWatchers, notifyWatchersDelete, notifyWatchersUpdate, notifyWatchersUpdate, removeWatcher |
Methods inherited from interface java.awt.Shape |
contains, contains, contains, contains, getBounds, getBounds2D, getPathIterator, getPathIterator, intersects, intersects |
Field Detail |
public static final String STYLE_CLPROPERTY
SatinConstants.clprops
public static final String VIEW_CLPROPERTY
SatinConstants.clprops
public static final String GESTUREINTRP_CLPROPERTY
SatinConstants.clprops
public static final String INKINTRP_CLPROPERTY
SatinConstants.clprops
Method Detail |
public void setUniqueID(int newID)
public int getUniqueID()
public Iterator getPropertyNames()
FlexProperties.getPropertyNames()
public Object getProperty(String strPropertyName)
FlexProperties.getProperty(String)
public void setProperty(String strPropertyName, Object newVal)
FlexProperties.setProperty(String, Object)
public Object removeProperty(String strPropertyName)
FlexProperties.removeProperty(String)
public List getIndexedProperty(String strPropertyName)
FlexProperties.getIndexedProperty(String)
public Object getIndexedProperty(String strPropertyName, int index)
FlexProperties.getIndexedProperty(String, int)
public void setIndexedProperty(String strPropertyName, int index, Object newVal)
FlexProperties.setIndexedProperty(String, int, Object)
public void addIndexedProperty(String strPropertyName, Object newVal)
FlexProperties.addIndexedProperty(String, Object)
public Object removeIndexedProperty(String strPropertyName, int index)
FlexProperties.removeIndexedProperty(String, int)
public List removeIndexedProperty(String strPropertyName)
FlexProperties.removeIndexedProperty(String)
public void clearIndexedProperty(String strPropertyName)
FlexProperties.clearIndexedProperty(String)
public void setView(View v)
getView()
,
View.setBoundingPoints2DRef(Polygon2D)
public View getView()
setView(View)
public Interpreter setGestureInterpreter(Interpreter intrp)
intrp
- is the new Interpreter to use.public Interpreter getGestureInterpreter()
public Interpreter setInkInterpreter(Interpreter intrp)
intrp
- is the new Interpreter to use.public Interpreter getInkInterpreter()
public Style setStyle(Style newStyle)
Notifies Watchers of an update when called.
the
- Style to set to. A null value means use default values.public Style getStyle()
public Style getStyleRef()
public String getRelativeLayer()
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 | | |-- | |-- |--
public void setRelativeLayer(int layer)
Notifies Watchers of an update when called.
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()
public void bringUpALayer()
Notifies Watchers of an update when called.
public void bringUpNLayers(int n)
Notifies Watchers of an update when called.
n
- is the number of layers to move this GraphicalObject up.public void bringDownALayer()
Notifies Watchers of an update when called.
public void bringDownNLayers(int n)
Notifies Watchers of an update when called.
n
- is the number of layers to move this GraphicalObject down.public void bringToTopLayer()
Notifies Watchers of an update when called.
public void bringToBottomLayer()
Notifies Watchers of an update when called.
public void applyTransform(AffineTransform newTx)
Notifies Watchers of an update when called.
newTx
- is a Transform to apply. No modifications are made to newTx.public void setTransform(AffineTransform newTx)
Notifies Watchers of an update when called.
newTx
- is a Transform to apply. Removes the old one completely.
No modifications are made to newTx.public AffineTransform getTransformRef()
public AffineTransform getTransform(int cdsys)
cdsys
- is the coordinate system.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public AffineTransform getTransform(int cdsys, AffineTransform outTx)
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)
cdsys
- is the coordinate system to use.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public AffineTransform getInverseTransform(int cdsys, AffineTransform outTx)
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 float minDistance(int cdsys, double x, double y)
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)
minDistance(int, double, double)
method.public Point2D getLocation2D(int cdsys)
cdsys
- is the coordinate system to use.getLocation2D(int, AffineTransform, Point2D)
,
SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public Point2D getLocation2D(int cdsys, AffineTransform tx, Point2D pt)
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)
cdsys
- is the coordinate system to use.getBounds2D(int)
,
SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public Rectangle2D getBounds2D(int cdsys, AffineTransform tx, Rectangle2D rect)
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)
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)
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)
cdsys
- is the coordinate system to use.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public float getHeight2D(int cdsys)
cdsys
- is the coordinate system to use.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public void setHasClosedBoundingPoints(boolean flag)
public boolean hasClosedBoundingPoints()
public boolean shapeContains(GraphicalObject gob)
Don't confuse this method with
GraphicalObjectCollection.contains(GraphicalObject)
.
gob
- is the GraphicalObject to check. It doesn't matter what
coordinate space gob is in, it will be moved to the correct
space.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public boolean shapeContains(int cdsys, Point2D pt)
cdsys
- is the coordinate system of the point.pt
- is the point.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public boolean shapeContains(int cdsys, double x, double y)
cdsys
- is the coordinate system of the point.x
- is the x-coordinate.y
- is the y-coordinate.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public boolean shapeContains(int cdsys, Shape s)
cdsys
- is the coordinate system of the point.s
- is the shape to check.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public boolean shapeIntersects(GraphicalObject gob)
gob
- is checked to see if it intersects this GraphicalObject.
It doesn't matter what coordinate space gob is in, it will be
moved to the correct space.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public boolean shapeIntersects(int cdsys, Shape s)
cdsys
- is the coordinate system of the point.s
- is the shape to check.SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public boolean isSelectable()
public void setSelectable(boolean flag)
flag
- is true to set this Graphical Object as selectable,
false otherwise.public void moveTo(int cdsys, double x, double y)
Notifies Watchers of an update when called.
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)
moveTo(int, double, double)
method.public void moveBy(int cdsys, double dx, double dy)
Notifies Watchers of an update when called.
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)
moveBy(int, double, double)
method.public void setBoundingPoints2D(int cdsys, Shape s)
Notifies Watchers of an update when called.
cdsys
- is the coordinate system to use.s
- is the shape that describes our bounds.getView()
,
SatinConstants.COORD_LOCAL
,
SatinConstants.COORD_REL
,
SatinConstants.COORD_ABS
public void onNewStroke(NewStrokeEvent evt)
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()
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)
onNewStroke(NewStrokeEvent)
public void redispatchNewStroke(NewStrokeEvent evt)
onNewStroke(NewStrokeEvent)
public void postProcessNewStroke(NewStrokeEvent evt)
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 StrokeListener
onNewStroke(NewStrokeEvent)
public void onUpdateStroke(UpdateStrokeEvent evt)
onNewStroke(NewStrokeEvent)
public void preProcessUpdateStroke(UpdateStrokeEvent evt)
onNewStroke(NewStrokeEvent)
public void redispatchUpdateStroke(UpdateStrokeEvent evt)
onNewStroke(NewStrokeEvent)
public void postProcessUpdateStroke(UpdateStrokeEvent evt)
onNewStroke(NewStrokeEvent)
public void handleUpdateStroke(UpdateStrokeEvent evt)
handleUpdateStroke
in interface StrokeListener
onNewStroke(NewStrokeEvent)
public void onSingleStroke(SingleStrokeEvent evt)
onNewStroke(NewStrokeEvent)
public void preProcessSingleStroke(SingleStrokeEvent evt)
onNewStroke(NewStrokeEvent)
public void redispatchSingleStroke(SingleStrokeEvent evt)
onNewStroke(NewStrokeEvent)
public void postProcessSingleStroke(SingleStrokeEvent evt)
onNewStroke(NewStrokeEvent)
public void handleSingleStroke(SingleStrokeEvent evt)
handleSingleStroke
in interface StrokeListener
onNewStroke(NewStrokeEvent)
public void setVisible(boolean flag)
public boolean isVisible()
public void disableDamage()
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.
enableDamage()
,
hasDamageEnabled()
public void enableDamage()
disableDamage()
,
hasDamageEnabled()
public boolean hasDamageEnabled()
disableDamage()
,
enableDamage()
public void setClipToBounds(boolean flag)
flag
- specifies whether the GraphicalObject should be clipped
to bounds or not.public boolean isClippedToBounds()
public void damage(int sync)
Watchable.hasNotifyEnabled()
, mark this
GraphicalObject as damaged and repaint.sync
- is either SatinConstants.DAMAGE_NOW
or
SatinConstants.DAMAGE_LATER
SatinConstants.DAMAGE_NOW
,
SatinConstants.DAMAGE_LATER
public void damage(int sync, GraphicalObject gob)
Watchable.hasNotifyEnabled()
, mark the specified
GraphicalObject as damaged and repaint.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)
Watchable.hasNotifyEnabled()
, mark the specified
region as damaged and repaint.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 oldRect, Rectangle2D newRect)
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.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 void render(SatinGraphics g)
When this method is called for you, your Style and Transform has already been set. This has several implications.
First, you can just use the normal drawing methods, like drawLine(), and they will automatically use the thickness and other properties as set in Style. You can still set colors and fonts and such if you want, though.
Secondly, your coordinate system is set such that (0,0) is your top-left corner.
Third, since your transform is already set, you don't have to do anything special to get rotation. Just draw normally.
Fourth, while in render(), do not call any methods that use
SatinConstants.COORD_REL
or SatinConstants.COORD_ABS
,
since the transform has already been applied. Instead, use
SatinConstants.COORD_LOCAL
.
So in other words, all you have to do is just draw the GraphicalObject normally, and everything else will be handled for you. However, do NOT call anything that uses the transformed bounds, since that will apply the transform twice (the transform has already been applied once).
g
- is the Graphics context to draw in.public GraphicalObjectGroup getParentGroup()
public void setParentGroup(GraphicalObjectGroup newParent)
Please note that this does not necessarily add this GraphicalObject to the specified parent. Typically, this method will be called for you when a GraphicalObject is added to a Group or Patch.
newParent
- is the parent to set to. Use null if this object does
not have a parent.public Sheet getSheet()
public void delete()
Also notifies Watchers of a delete when called.
public Object clone()
clone
in interface Watchable
clone
in class Object
public Object deepClone()
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |