|
Multivalent API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmultivalent.VObject
multivalent.Behavior
multivalent.Span
multivalent.std.span.MoveTextSpan
Executable copy editor markup that will move marked text to another point in the document. Set source text span by making selection and invoking menu CopyEd / Move Text. Set destination point by pressing mouse button down in source text, dragging to end point, and releasing (keyboard scrolling is still active in case the end point is not on the same screen). Source range can be moved in same way as other span annotations, that is, by selecting the new destination span and selecting Morph from the span-specific popup menu. Destination point can be moved by removing the current destination by invoking Re-set move to point from that same menu and setting the new one as before. Annotation can subsequently be executed by clicking in the source text.
The illegal operations of trying to place destination point in source text or subsequently moving source text on top of destination are checked and result in the removal of the destination point. If the destination point is one the same line as the start of the source text, the arrow arches up over the intervening text rather that plowing through the middle.
Implementation steps:
HyperlinkSpan.appearance(Context, boolean)
.)
HyperlinkSpan.eventAfter(AWTEvent, Point, Node)
.)
Span.moveq(Leaf,int, Leaf,int)
and Behavior.formatAfter(Node)
and catch Document.MSG_FORMATTED
semantic event to recompute display, and destroy()
to destroy destination point as well.)
Behavior.paintAfter(Context, Node)
.)
ActionSpan.action()
.)
Span.save()
and Span.restore(ESISNode, Map, Layer)
to include destination point -- superclass already saves range of source text.)
for another elaborately commented example {@link Behavior}.
Field Summary | |
---|---|
static java.lang.String |
MSG_RESET_DEST
Semantic event that removes the destination point so that it may be placed elsewhere. |
Fields inherited from class multivalent.Span |
---|
GI_END, GI_START, MSG_DELETE, MSG_EDIT, MSG_MORPH, MSG_UNATTACHED, pend, pstart |
Fields inherited from class multivalent.Behavior |
---|
ATTR_BEHAVIOR, name_ |
Fields inherited from class multivalent.VObject |
---|
attr_ |
Fields inherited from interface multivalent.ContextListener |
---|
LITTLE, LOT, PRIORITY_LENS, PRIORITY_MAX, PRIORITY_MIN, PRIORITY_SELECTION, PRIORITY_SPAN, PRIORITY_STRUCT, SOME |
Constructor Summary | |
---|---|
MoveTextSpan()
|
Method Summary | |
---|---|
boolean |
appearance(Context cx,
boolean all)
Draw source text differently depending on whether executable or waiting for destination point. |
void |
buildAfter(Document doc)
Attach destination point as well. |
void |
destroy()
Also remove destination point and recompute display (to remove circle and arrow). |
void |
event(java.awt.AWTEvent e)
Receives synthesized MouseEvent.MOUSE_ENTERED , MouseEvent.MOUSE_EXITED , MouseEvent.MOUSE_PRESSED , .... |
boolean |
eventAfter(java.awt.AWTEvent e,
java.awt.Point rel,
Node obsn)
If no destination point, click-drag to set (re-fire keyboard events out so can still scroll). |
void |
execute()
Remove source text, insert at destination point. |
boolean |
formatAfter(Node node)
After formatted affected area, recompute coordinates of circle and arrow. |
void |
moveq(Leaf ln,
int lo,
Leaf rn,
int ro)
Also recompute display. |
boolean |
paintAfter(Context cx,
Node node)
Draw line between source and destination. |
void |
restore(ESISNode n,
java.util.Map<java.lang.String,java.lang.Object> attr,
Layer layer)
Given ESIS subtree, pluck class-specific information from attributes, call super.restore() for locations. |
ESISNode |
save()
Source text location saved by superclass, so just need to save endpoint (using a Robust Location, of course). |
boolean |
semanticEventAfter(SemanticEvent se,
java.lang.String msg)
Handle MSG_RESET_DEST event.... |
boolean |
semanticEventBefore(SemanticEvent se,
java.lang.String msg)
Add "Re-Set move to point" to span-specific popup menu. |
protected void |
setDisplay()
Set observer, compute coordinates. |
protected void |
spanExit()
Several exit points in event(), so collect together. |
Methods inherited from class multivalent.Span |
---|
checkRep, close, closeAll, contains, contains, getEnd, getPriority, getStart, isSet, markDirty, move, move, move, moveq, moveq, moveqSwap, open, repaint, repaint, stretch, toString |
Methods inherited from class multivalent.Behavior |
---|
buildBefore, clipboardAfter, clipboardBefore, createUI, eventBefore, formatBefore, getBrowser, getDocument, getInstance, getInstance, getLayer, getLogger, getName, getPreference, getRoot, isEditable, paintBefore, putPreference, redo, restoreChildren, setName, undo |
Methods inherited from class multivalent.VObject |
---|
attrEntrySetIterator, attrKeysIterator, clearAttributes, getAttr, getAttr, getAttributes, getGlobal, getValue, hasAttributes, putAttr, removeAttr, setAttributes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MSG_RESET_DEST
"resetMoveTo": arg= MoveTextSpan
instance, in= MoveTextSpan
instance.
Constructor Detail |
---|
public MoveTextSpan()
Method Detail |
---|
public boolean semanticEventBefore(SemanticEvent se, java.lang.String msg)
semanticEventBefore
in class Span
public boolean semanticEventAfter(SemanticEvent se, java.lang.String msg)
MSG_RESET_DEST
event....
semanticEventAfter
in class Span
public boolean appearance(Context cx, boolean all)
appearance
in interface ContextListener
appearance
in class Span
all
- all attributes or exclude those that are not inheritedpublic boolean eventAfter(java.awt.AWTEvent e, java.awt.Point rel, Node obsn)
eventAfter
in class Behavior
public void event(java.awt.AWTEvent e)
Span
MouseEvent.MOUSE_ENTERED
, MouseEvent.MOUSE_EXITED
, MouseEvent.MOUSE_PRESSED
, ....
For the purposes of event passing, functions more as tree node than behavior (with before/after).
event
in interface EventListener
event
in class Span
protected void spanExit()
protected void setDisplay()
public boolean paintAfter(Context cx, Node node)
paintAfter
in class Behavior
public boolean formatAfter(Node node)
formatAfter
in class Behavior
public void destroy()
destroy
in class Span
public void moveq(Leaf ln, int lo, Leaf rn, int ro)
moveq
in class Span
public void execute()
public ESISNode save()
save
in class Span
public void restore(ESISNode n, java.util.Map<java.lang.String,java.lang.Object> attr, Layer layer)
Span
start
and end
are reserved to hold Robust Location data.
restore
in class Span
RobustLocation
public void buildAfter(Document doc)
buildAfter
in class Span
|
Multivalent API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |