|
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.HyperlinkSpan
This is the familiar point-to-point link. Note that it's not built in -- you can add new link types easily.
Elaborately commented to serve as a simple example of translating Multivalent protocols into Java methods;
also see ClipProvenance
.
ActionSpan
,
ScriptSpan
Field Summary | |
---|---|
static java.lang.String |
ATTR_URI
|
static java.lang.String |
MSG_COPY_LINK
Copy link URI to clipboard. |
static byte |
STATE_ACTIVE
Link state . |
static byte |
STATE_HOVER
Link state . |
static byte |
STATE_LINK
Link state . |
static byte |
STATE_VISITED
Link state . |
protected java.lang.Object |
target_
Target of link can be given as a String or URL. |
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 | |
---|---|
HyperlinkSpan()
|
Method Summary | |
---|---|
boolean |
appearance(Context cx,
boolean all)
Spans are ContextListener's, which are behaviors that compose together to determine the Context display properties at every point in the document. |
void |
event(java.awt.AWTEvent e)
Once we set the grab, subsequent events go directly to here, not to eventBefore/eventAfter. |
boolean |
eventAfter(java.awt.AWTEvent e,
java.awt.Point rel,
Node n)
On a mouse button down, directly receive all furture low-level events by setting a grab in Browser, until a mouse button up. |
int |
getPriority()
Prefer for style sheet to set appearance. |
byte |
getState()
Run-of-the-mill field getter. |
java.lang.Object |
getTarget()
Run-of-the-mill field getter. |
java.net.URI |
getURI()
Run-of-the-mill field getter. |
void |
go()
Override this for special action when hyperlink is clicked. |
void |
restore(ESISNode n,
java.util.Map<java.lang.String,java.lang.Object> attr,
Layer layer)
Restore almost always invokes its superclass, which when it chains up to Behavior sets the behavior's attributes and adds it to the passed layer. |
ESISNode |
save()
Stuff instance state into attributes; if save buffer not null, write out corresponding XML. |
boolean |
semanticEventAfter(SemanticEvent se,
java.lang.String msg)
Catch "copyLink" sent in semanticEventBefore . |
boolean |
semanticEventBefore(SemanticEvent se,
java.lang.String msg)
Add to the DOCPOPUP menu--the menu that pops up when the alternative mouse button is clicked over some part of the document (as opposed to the menubar) and the click is not short-circuited out by some behavior. |
void |
setMessage(java.lang.String msg)
Message to show when mouse hovers over link. |
void |
setSeen(boolean seen)
Run-of-the-mill field setter. |
protected void |
setState(byte state)
Run-of-the-mill field setter. |
void |
setTarget(java.lang.Object o)
Sets target that isn't String or URI or URL. |
void |
setURI(java.lang.String txt)
Computes full, canonical URL from a relative specification. |
java.lang.String |
toString()
Subclasses should extend to check any attributes they add. |
Methods inherited from class multivalent.Span |
---|
buildAfter, checkRep, close, closeAll, contains, contains, destroy, getEnd, getStart, isSet, markDirty, move, move, move, moveq, moveq, moveq, moveqSwap, open, repaint, repaint, stretch |
Methods inherited from class multivalent.Behavior |
---|
buildBefore, clipboardAfter, clipboardBefore, createUI, eventBefore, formatAfter, formatBefore, getBrowser, getDocument, getInstance, getInstance, getLayer, getLogger, getName, getPreference, getRoot, isEditable, paintAfter, 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 ATTR_URI
public static final byte STATE_LINK
state
.
public static final byte STATE_VISITED
state
.
public static final byte STATE_HOVER
state
.
public static final byte STATE_ACTIVE
state
.
public static final java.lang.String MSG_COPY_LINK
"copyLink".
protected java.lang.Object target_
Constructor Detail |
---|
public HyperlinkSpan()
Method Detail |
---|
public void setSeen(boolean seen)
protected void setState(byte state)
public byte getState()
public java.lang.Object getTarget()
public java.net.URI getURI()
public void setTarget(java.lang.Object o)
public void setMessage(java.lang.String msg)
public void setURI(java.lang.String txt)
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 int getPriority()
getPriority
in interface ContextListener
getPriority
in class Span
public void restore(ESISNode n, java.util.Map<java.lang.String,java.lang.Object> attr, Layer layer)
restore
in class Span
RobustLocation
public ESISNode save()
Span
save
in class Span
public boolean eventAfter(java.awt.AWTEvent e, java.awt.Point rel, Node n)
eventAfter
in class Behavior
public void event(java.awt.AWTEvent e)
event
in interface EventListener
event
in class Span
public void go()
Document.MSG_OPEN
semantic event to target_.
If target is a SemanticEvent, then it is fired.
public boolean semanticEventBefore(SemanticEvent se, java.lang.String msg)
Span.MSG_EDIT
if the span is in an editable layer (e.g., if link comes from
the HTML sent by a random server, it isn't editable, whereas link annotations you
added are), "copyLink", "open in new window", and "open in shared window".
semanticEventBefore
in class Span
public boolean semanticEventAfter(SemanticEvent se, java.lang.String msg)
semanticEventBefore
.
The pair of Document.MSG_OPEN
are handled by another behavior.
Many subclasses have various parameters or attributes, such as URL here
or annotation text elsewhere, and the Span class supports editing by
catching Span.MSG_EDIT
and throwing up an associated HTML document with
a FORM in a note window. When that window is closed, it sends SystemEvents.MSG_FORM_DATA
.
semantic event with the name-value pairs of the form as a parameter.
semanticEventAfter
in class Span
public java.lang.String toString()
Span
toString
in class Span
|
Multivalent API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |