|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nwoods.jgo.JGoObject
com.nwoods.jgo.JGoDrawable
com.nwoods.jgo.JGoStroke
JGoStroke is a JGoObject that represents a poly line. In other words, it is an object made up of an arbirary number of line segments, where each segment shares two endpoints with other segments, except the first and last segments.
The appearance (color, thickness, style) of the stroke is determined by the pen; change it by calling setPen().
Manipulate stroke points by using the addPoint(), setPoint(), insertPoint(), removePoint(), removeAllPoints() and getNumPoints() methods. Stroke points are indexed by integers starting with 0.
By default there is an implied directionality of the stroke. It defines the "from" end as the first point of the stroke and the "to" end as the last point of the stroke.
The stroke can be shown with a highlight. Specify the highlight pen; by default there is no highlight. The highlight is achieved by drawing the stroke twice: first the highlight and then the regular stroke. Usually the highlight pen should be significantly wider than the stroke's regular pen. Note that this highlight is not a selection indication. If you do want to change the stroke (and thus the document) when a view on the document selects this stroke to use this highlight to indicate selection, you should override gainedSelection and lostSelection to set the highlight pen.
Each stroke supports optional arrow heads at either end of the stroke. Arrow heads are drawn as four-sided polygons with a solid pen of width 1; the stroke's brush is used to fill the arrow head.
You can get a triangular arrow head by setting the ArrowShaftLength to be equal to the ArrowLength. You can get a diamond arrow head by setting the ArrowShaftLength to be twice the ArrowLength. You can get a simple line drawn arrow head by setting the ArrowShaftLength to zero.
Both arrow heads will always point "out". In other words, calling setArrowHeads(true, true) will produce a stroke pointing "both ways". If you want the decoration at the "from" end to be something different than an arrow head, you will have to override drawArrowhead() and do your own drawing.
The ArrowLength, ArrowShaftLength, and ArrowWidth properties are double-float values.
Field Summary | |
static int |
ChangedAddPoint
a CHANGED event hint: a stroke point has been added |
static int |
ChangedAllPoints
a CHANGED event hint: all stroke points have been changed. |
static int |
ChangedArrowHeads
a CHANGED event hint: changed the presence of arrow heads at the either end of the stroke |
static int |
ChangedArrowLength
a CHANGED event hint: changed the length of the arrow heads |
static int |
ChangedArrowShaftLength
a CHANGED event hint: changed the length of the arrow heads on the stroke |
static int |
ChangedArrowWidth
a CHANGED event hint: changed the length of the arrow heads |
static int |
ChangedCubic
a CHANGED event hint: the highlighting of the stroke has changed |
static int |
ChangedHighlight
a CHANGED event hint: the highlighting of the stroke has changed |
static int |
ChangedModifiedPoint
a CHANGED event hint: a stroke point has changed position |
static int |
ChangedRemovePoint
a CHANGED event hint: one or more stroke points have been removed |
protected java.util.ArrayList |
myPoints
the list of points in this stroke. |
Fields inherited from class com.nwoods.jgo.JGoObject |
Bottom, BottomCenter, BottomLeft, BottomMiddle, BottomRight, Center, CenterLeft, CenterRight, Changed4ResizeHandles, ChangedAutoRescale, ChangedBrush, ChangedDraggable, ChangedDragsNode, ChangedGeometry, ChangedGrabChildSelection, ChangedInitializing, ChangedPen, ChangedResizable, ChangedSelectable, ChangedUpdatePartner, ChangedVisible, ChangedZOrder, LastChangedHint, Left, LeftCenter, NoHandle, NoSpot, NumReservedHandles, RepaintAll, Right, RightCenter, SideLeft, SideRight, Top, TopCenter, TopLeft, TopMiddle, TopRight |
Constructor Summary | |
JGoStroke()
Create a new stroke with no points in it. |
Method Summary | |
int |
addPoint(int x,
int y)
Add a point to the stroke. |
int |
addPoint(org.eclipse.swt.graphics.Point point)
Add a point to the stroke. |
protected void |
calculateFilledArrowhead(int x0,
int y0,
int x1,
int y1,
int atend,
int[] headx,
int[] heady)
Used to calculate a polygon for an arrowhead at the end of the line (x0,y0) --> (x1,y1). |
void |
changeValue(JGoDocumentChangedEdit e,
boolean undo)
This method is called by the JGoDocumentChangedEdit.undo and redo methods to actually perform the property value change for a JGoObject. |
protected org.eclipse.swt.graphics.Rectangle |
computeBoundingRect()
Compute the bounds of this stroke by determining the bounding rectangle for all of the points. |
void |
copyNewValueForRedo(JGoDocumentChangedEdit e)
This method is called when a JGoDocumentChangedEdit is created for a JGoDocumentEvent.CHANGED event, when a JGoObject has been changed. |
JGoObject |
copyObject(JGoCopyEnvironment env)
Create a copy of the JGoStroke, including the points that define it. |
void |
copyOldValueForUndo(JGoDocumentChangedEdit e)
This method is called when a JGoDocumentChangedEdit is created for a JGoDocumentEvent.CHANGED event, when a JGoObject has been changed. |
java.util.Vector |
copyPoints()
Return a copy of the Vector of Points representing the points of this stroke. |
java.util.ArrayList |
copyPointsArray()
Return a copy of the ArrayList of Points representing the points of this stroke. |
protected void |
drawArrowhead(Graphics2D g,
boolean atend,
int[] headx,
int[] heady)
Draw the arrow head, given the X and Y arrays for the four points used in the polygon for the arrow head. |
protected void |
drawArrowHeads(Graphics2D g)
Draw the arrowheads on the screen. |
void |
expandRectByPenWidth(org.eclipse.swt.graphics.Rectangle rect)
Modify the given rectangle representing an object's bounding rectangle to account for any additional drawing region caused by the thickness of the pen. |
protected void |
gainedSelection(JGoSelection selection)
Called whenever this stroke is added to a selection in some view. |
protected void |
geometryChange(org.eclipse.swt.graphics.Rectangle prevRect)
Called if we're moved or scaled. |
org.eclipse.swt.graphics.Point |
getArrowFromAnchorPoint()
Return the anchor point of the "From" arrow, in document coordinates |
org.eclipse.swt.graphics.Point |
getArrowFromEndPoint()
Return the end point of the "From" arrow, in document coordinates |
double |
getArrowLength()
Return the overall length of the arrowhead. |
double |
getArrowShaftLength()
Return the length of the arrowhead along the stroke. |
org.eclipse.swt.graphics.Point |
getArrowToAnchorPoint()
Return the anchor point of the "To" arrow, in document coordinates |
org.eclipse.swt.graphics.Point |
getArrowToEndPoint()
Return the end point of the "To" arrow, in document coordinates |
double |
getArrowWidth()
Return the width of the arrowhead, perpendicular to the shaft. |
org.eclipse.swt.graphics.Point |
getEndPoint()
Return the ending point for this line. |
int |
getFirstPickPoint()
Return the first point which can be selected and moved. |
JGoPen |
getHighlight()
Returns the current highlighting pen for this stroke. |
int |
getLastPickPoint()
Return the last point that can be selected and moved. |
static boolean |
getNearestIntersectionOnLine(int Ax,
int Ay,
int Bx,
int By,
int Px,
int Py,
int Qx,
int Qy,
org.eclipse.swt.graphics.Point R)
Find the intersection point of the finite line segment A-B and the infinite line P-Q that is closest to point P. |
boolean |
getNearestIntersectionPoint(int px,
int py,
int cx,
int cy,
org.eclipse.swt.graphics.Point result)
Consider each segment, whether straight or cubic/Bezier, when finding nearest the intersection with a line. |
static boolean |
getNearestPointOnLine(int Ax,
int Ay,
int Bx,
int By,
int Px,
int Py,
org.eclipse.swt.graphics.Point R)
Return a point on a straight line segment that is closest to a given point. |
static boolean |
getNearestPointOnLine(org.eclipse.swt.graphics.Point A,
org.eclipse.swt.graphics.Point B,
org.eclipse.swt.graphics.Point P,
org.eclipse.swt.graphics.Point R)
Return a point on a straight line segment that is closest to a given point. |
int |
getNumPoints()
Get the number of points in this stroke. |
org.eclipse.swt.graphics.Point |
getPoint(int i)
Return a point given its index. |
int |
getPointX(int i)
Return the X coordinate for the point at the given index. |
int |
getPointY(int i)
Return the Y coordinate for the point at the given index. |
int |
getSegmentNearPoint(org.eclipse.swt.graphics.Point pnt)
Return the segment which is close to the given point, if any. |
org.eclipse.swt.graphics.Point |
getStartPoint()
Return the starting point for this line. |
org.eclipse.swt.graphics.Rectangle |
handleResize(Graphics2D g,
JGoView view,
org.eclipse.swt.graphics.Rectangle prevRect,
org.eclipse.swt.graphics.Point newPoint,
int whichHandle,
int event,
int minWidth,
int minHeight)
Called as we are moving a point in the stroke. |
boolean |
hasArrowAtEnd()
Return whether or not this line has an arrowhead at its end. |
boolean |
hasArrowAtStart()
Return whether or not this line has an arrowhead at its start. |
int |
insertPoint(int i,
int x,
int y)
Add a point to the stroke at a particular position in the stroke's list of points. |
int |
insertPoint(int i,
org.eclipse.swt.graphics.Point point)
Add a point to the stroke at a particular position in the stroke's list of points. |
boolean |
isCubic()
Return whether the style of this stroke is Cubic (Bezier). |
boolean |
isPointInObj(org.eclipse.swt.graphics.Point pnt)
Checks whether or not the given point is on or near the stroke. |
void |
paint(Graphics2D g,
JGoView view)
Draw the stroke on the graphics context. |
void |
removeAllPoints()
Delete all the points from the stroke. |
void |
removePoint(int i)
Remove the point from the stroke given its index. |
void |
setArrowHeads(boolean from,
boolean to)
Sets whether or not there are arrow heads at either end of this line. |
void |
setArrowLength(double len)
Set the overall length of the arrowhead. |
void |
setArrowShaftLength(double len)
Set the length of the arrowhead on the stroke, to determine the fullness of the arrowhead. |
void |
setArrowWidth(double width)
Set the width of the arrowhead, measured as the widest distance perpendicular to the arrow's shaft. |
void |
setCubic(boolean c)
Set whether the points in this stroke are to be interpreted as the start, two control, and end points of a Cubic (Bezier) curve. |
void |
setHighlight(JGoPen pen)
Sets the current "pen stroke" to use when drawing the highlight for this stroke. |
void |
setPoint(int i,
int x,
int y)
Change the location of the given point. |
void |
setPoint(int i,
org.eclipse.swt.graphics.Point point)
Change the location of the given point. |
void |
setPoints(java.util.ArrayList points)
Reset all of the points of this stroke to instead be the points in the given ArrayList of points. |
void |
setPoints(java.util.Vector points)
Reset all of the points of this stroke to instead be the points in the given Vector of points. |
DomNode |
SVGReadObject(DomDoc svgDoc,
JGoDocument jGoDoc,
DomElement svgElement,
DomElement jGoChildElement)
Read this object in from a DomDoc representing a Scalable Vector Graphics (SVG) XML document. |
void |
SVGUpdateReference(java.lang.String attr,
java.lang.Object referencedObject)
This method will be called to fill in object references. |
void |
SVGWriteObject(DomDoc svgDoc,
DomElement jGoElementGroup)
Write this object out to a DomDoc representing a Scalable Vector Graphics (SVG) XML document. |
Methods inherited from class com.nwoods.jgo.JGoDrawable |
draw3DRect, draw3DRect, drawEllipse, drawEllipse, drawEllipse, drawLine, drawLine, drawPath, drawPolygon, drawPolygon, drawRect, drawRect, drawRect, drawRoundRect, drawRoundRect, getBrush, getPen, setBrush, setPen, SVGAddPathArgs, SVGReadAttributes, SVGWriteAttributes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ChangedAddPoint
public static final int ChangedRemovePoint
public static final int ChangedModifiedPoint
public static final int ChangedArrowHeads
public static final int ChangedArrowLength
public static final int ChangedArrowShaftLength
public static final int ChangedHighlight
public static final int ChangedCubic
public static final int ChangedAllPoints
public static final int ChangedArrowWidth
protected java.util.ArrayList myPoints
Constructor Detail |
public JGoStroke()
By default it draws a thin black line (JGoPen.black) and fills any arrowheads with black (JGoBrush.black).
Method Detail |
public JGoObject copyObject(JGoCopyEnvironment env)
copyObject
in class JGoDrawable
env
- the environment for the copy operation - keeps track of copied objects.public void SVGWriteObject(DomDoc svgDoc, DomElement jGoElementGroup)
JGoXMLSaveRestore
This method will be called by com.nwoods.jgo.svg.DefaultDocument.SVGWriteDoc() for every JGoObject contained within a JGoDocument. The following example uses a JGoRectangle to illustrate the format of a generated SVG JGoObject:
<g>
<JGoClass class="com.nwoods.jgo.JGoRectangle"\>
<rect height="75" style="stroke:black;stroke-width:1;fill:rgb(255,0,0);" width="75" x="65" y="71"/>
<JGoClass class="com.nwoods.jgo.JGoDrawable" drawablebrush="jgoid1" drawablepen="jgoid2" embeddedpenbrush="false"/>
<JGoClass class="com.nwoods.jgo.JGoObject" obj_flags="1054"/>
</g>
Note that the entire JGoObject is enclosed in a group (<g>). Each subclass of the JGoObject is described by a <JGoClass> element, starting with the most specific class and moving to the more general. Each <JGoClass> element has a "class" attribute which defines the class name. Each <JGoClass> element may also have several other attributes which uniquely describe that state of that class. Following the <JGoClass> element, each class may also genereate any other elements that are required, including representations of contained objects and standard SVG elements such as the <rect> element shown in the above example. The generation of SVG elements in the output makes it possible for the output to be read by SVG viewers and other SVG aware applications. The information contained in the <JGoClass> elements allows us to accurately save and restore all the information in a particular JGoObject subclass.
If this class contains a reference to another object, call DomDoc.registerReferencingNode() to register that reference. This will cause the element representing the referenced object to be identified with a unique id attribute, and cause the element representing the referring object to have a user defined attribute containing a reference to that id. See DomDoc.registerReferencingNode() for more information.
Typically, an implementation of this method will generate a <JGoClass> element using the DomDoc.createJGoClassElement() method, adding whatever attributes are necessary to describe the class. It will then call its superclass so that the superclass can add its own <JGoClass> element and other information to jGoElementGroup within the DomDoc.
Refer to com.nwoods.jgo.examples.flower.ActivityNode.SVGWriteObject() and com.nwoods.jgo.examples.SimpleNode.SVGWriteObject() for examples using this method.
Refer to the file com.nwoods.jgo.svg\xsvg.dtd for a formal description of JGo extensions to the SVG document type.
SVGWriteObject
in interface JGoXMLSaveRestore
SVGWriteObject
in class JGoDrawable
public DomNode SVGReadObject(DomDoc svgDoc, JGoDocument jGoDoc, DomElement svgElement, DomElement jGoChildElement)
JGoXMLSaveRestore
This method will be called by com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc() for every <JGoClass> element encountered in a DomDoc. First, an object of the type specified by the class attribute will be created and then the SVGReadObject() method will be called on that newly created object. Refer to SVGWriteObject() for a description of the expected format of the SVG document.
This method may also be called by com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc() when reading any SVG document, including those not generated by JGo and therefore not containing any <JGoClass> elements. In such cases, the DefaultDocument.SVGReadElement() method may be subclassed to examine the SVG element and cause the appropriate JGoObject to be created to represent that element and call SVGReadObject() on that newly created object. By default, standard JGoObjects such as JGoRectangles, JGoStrokes, etc will be created to represent these objects.
If this class contains a reference to another object, call DomDoc.registerReferencingObject() to register that reference. This will cause the JGoObject.SVGUpdateReference() to be called on the referencing object after all the objects have been created, passing in the object befing referenced. See DomDoc.registerReferencingObject() for more information.
Typically, an implementation of this method starts by verifying that the element being read is a <JGoClass> element (which will be true if jGoChildElement is not null). This will always be true unless you have subclassed the DefaultDocument.SVGReadElement() method as described above. It will then read the expected attributes of the <JGoClass> element (as written by SVGReadObject()), call SVGReadObject() on its superclass, and finally return the next element by calling svgElement.getNextSibling().
Refer to com.nwoods.jgo.examples.flower.ActivityNode.SVGReadObject() and com.nwoods.jgo.examples.SimpleNode.SVGReadObject() for examples using this method.
SVGReadObject
in interface JGoXMLSaveRestore
SVGReadObject
in class JGoDrawable
public void SVGUpdateReference(java.lang.String attr, java.lang.Object referencedObject)
JGoObject
This is called by com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc() after all the objects have been created and if DomDoc.registerReferencingObject() has been previously called by SVGReadObject().
Typically, an implementation of this method will first call the superclass and then fill in the appropriate object reference based on the attr argument.
Refer to com.nwoods.jgo.examples.SimpleNode.SVGWriteObject() for an example using this method.
SVGUpdateReference
in class JGoDrawable
public void paint(Graphics2D g, JGoView view)
paint
in class JGoObject
g
- the graphics context on which to draw.view
- the view we're drawing inpublic boolean isCubic()
public void setCubic(boolean c)
When there are more than four points, the end point of the first Bezier segment is used as the start point for the next Bezier segment. If the number of points is not exactly one more than a multiple of three, the last segment uses the last two points as the second control point and the end point and it ignores the one or two points just before the last two. If there are fewer than four points, this stroke cannot be drawn as a Bezier curve, but will be drawn as straight line segments when there are two or three points.
public final int addPoint(org.eclipse.swt.graphics.Point point)
point
- the point to add.
public int addPoint(int x, int y)
x
- the x coordinate of the new point to add.y
- the y coordinate of the new point to add.
public final int insertPoint(int i, org.eclipse.swt.graphics.Point point)
i
- the index of the new pointpoint
- the point to add.
public int insertPoint(int i, int x, int y)
i
- the index of the new pointx
- the x coordinate of the new point to addy
- the y coordinate of the new point to add
public void removePoint(int i)
i
- the index of the point to remove.public org.eclipse.swt.graphics.Point getPoint(int i)
The returned point must not be modified; to change the position of a point one must call setPoint().
i
- the index of the point to return.
public int getPointX(int i)
i
- the index of the point whose X coordinate we return,public int getPointY(int i)
i
- the index of the point whose Y coordinate we return,public final void setPoint(int i, org.eclipse.swt.graphics.Point point)
i
- the index of the point to change.point
- the new location for the point.public void setPoint(int i, int x, int y)
i
- the index of the point to change.x
- the new x coordinate location for the point.y
- the new y coordinate location for the point.public void removeAllPoints()
public void setPoints(java.util.Vector points)
points
- a Vector of Point referencespublic void setPoints(java.util.ArrayList points)
points
- a ArrayList of Point referencespublic java.util.Vector copyPoints()
public java.util.ArrayList copyPointsArray()
public int getNumPoints()
public org.eclipse.swt.graphics.Point getStartPoint()
public org.eclipse.swt.graphics.Point getEndPoint()
public int getFirstPickPoint()
Subclasses should override this function if they want something other than the default behavior.
public int getLastPickPoint()
Subclasses should override this function if they want something other than the default behavior.
public org.eclipse.swt.graphics.Rectangle handleResize(Graphics2D g, JGoView view, org.eclipse.swt.graphics.Rectangle prevRect, org.eclipse.swt.graphics.Point newPoint, int whichHandle, int event, int minWidth, int minHeight)
handleResize
in class JGoObject
g
- the graphics context to draw onview
- the view we're being resizing inprevRect
- the previous bounding rectangle (unused)newPoint
- the location of the new pointwhichHandle
- the handle number of the point being movedevent
- the eventminWidth
- the minimum width of the object (unused)minHeight
- the minimim height of the object (unused)protected void geometryChange(org.eclipse.swt.graphics.Rectangle prevRect)
geometryChange
in class JGoObject
prevRect
- this stroke's previous rectangle.protected void gainedSelection(JGoSelection selection)
The default behavior creates resize handles at each of the stroke's points.
gainedSelection
in class JGoObject
selection
- the selection to which this object was addedprotected org.eclipse.swt.graphics.Rectangle computeBoundingRect()
computeBoundingRect
in class JGoObject
public void expandRectByPenWidth(org.eclipse.swt.graphics.Rectangle rect)
expandRectByPenWidth
in class JGoDrawable
rect
- the rectangle to be enlargedpublic boolean isPointInObj(org.eclipse.swt.graphics.Point pnt)
isPointInObj
in class JGoObject
pnt
- the point to check
public int getSegmentNearPoint(org.eclipse.swt.graphics.Point pnt)
This returns -1 if the given point is not at all near the stroke, or if it is in the bounding rectangle but not near any segment. For Bezier style strokes, the index of the first of each set of points is returned, e.g. 0, 3, 7, ....
pnt
- the point to checkpublic static boolean getNearestPointOnLine(org.eclipse.swt.graphics.Point A, org.eclipse.swt.graphics.Point B, org.eclipse.swt.graphics.Point P, org.eclipse.swt.graphics.Point R)
A
- one end of the line segmentB
- the other end of the line segmentP
- the point to be closest toR
- a Point that is modified to hold a point that is on the finite
length straight line segment from A to B
public static boolean getNearestPointOnLine(int Ax, int Ay, int Bx, int By, int Px, int Py, org.eclipse.swt.graphics.Point R)
All coordinates are in document coordinates.
Ax
- the X coordinate of one end of the line segmentAy
- the Y coordinate of one end of the line segmentBx
- the X coordinate of the other end of the line segmentBy
- the Y coordinate of the other end of the line segmentPx
- the X coordinate of the point to be closest toPy
- the Y coordinate of the point to be closest toR
- a Point that is modified to hold a point that is on the finite
length straight line segment from A to B
public static boolean getNearestIntersectionOnLine(int Ax, int Ay, int Bx, int By, int Px, int Py, int Qx, int Qy, org.eclipse.swt.graphics.Point R)
Ax
- the X coordinate of one end of the line segmentAy
- the Y coordinate of one end of the line segmentBx
- the X coordinate of the other end of the line segmentBy
- the Y coordinate of the other end of the line segmentPx
- the X coordinate of the point to be closest toPy
- the Y coordinate of the point to be closest toQx
- the X coordinate of a point describing the infinite line from PQy
- the Y coordinate of a point describing the infinite line from PR
- a Point that is modified to hold the intersection point that is on the finite
length straight line segment from A to B
public boolean getNearestIntersectionPoint(int px, int py, int cx, int cy, org.eclipse.swt.graphics.Point result)
getNearestIntersectionPoint
in class JGoDrawable
public void setArrowHeads(boolean from, boolean to)
from
- if true, draw an arrow head at the end of the line.to
- if true, draw an arrow head at the start of the line.public boolean hasArrowAtEnd()
public boolean hasArrowAtStart()
public org.eclipse.swt.graphics.Point getArrowToEndPoint()
public org.eclipse.swt.graphics.Point getArrowToAnchorPoint()
public org.eclipse.swt.graphics.Point getArrowFromEndPoint()
public org.eclipse.swt.graphics.Point getArrowFromAnchorPoint()
public void setArrowLength(double len)
len
- the length of the arrowheadpublic double getArrowLength()
This defaults to 10.
public void setArrowShaftLength(double len)
len
- the length of the arrowheadpublic double getArrowShaftLength()
This defaults to 8.
public void setArrowWidth(double width)
public double getArrowWidth()
protected void drawArrowHeads(Graphics2D g)
g
- the graphics context on which to drawprotected void calculateFilledArrowhead(int x0, int y0, int x1, int y1, int atend, int[] headx, int[] heady)
protected void drawArrowhead(Graphics2D g, boolean atend, int[] headx, int[] heady)
By default this draws a filled polygon with a solid pen of width 1 with the same color as the rest of the stroke.
public void setHighlight(JGoPen pen)
pen
- the pen to use when drawing the highlightpublic JGoPen getHighlight()
public void copyOldValueForUndo(JGoDocumentChangedEdit e)
JGoObject
The exact nature of the Object depends on the particular event hint or sub-hint, of course, but is typically a Rectangle or Point or some similar structure that is actually owned by the object. The responsibility for copying rests with the document event listener rather than the code calling JGoObject.update for efficiency when there is no undo/redo manager.
copyOldValueForUndo
in class JGoObject
e
- the UndoableEdit that also remembers the kind of change and any
appropriate previous state that should be copied in-placepublic void copyNewValueForRedo(JGoDocumentChangedEdit e)
JGoObject
Just as the previous/old value/state information is stored as one or both of an integer and an Object, the new value/state information may be stored as either or both of an integer or an Object.
The responsibility for copying rests with the document event listener rather than the code calling JGoObject.update for efficiency when there is no undo/redo manager.
copyNewValueForRedo
in class JGoDrawable
public void changeValue(JGoDocumentChangedEdit e, boolean undo)
JGoObject
You will want to override this method to handle changing the additional state of your object subclasses.
changeValue
in class JGoDrawable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |