Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## multivalent.std.lens
Class Lens

    java.lang.Object
      multivalent.VObject
          multivalent.Behavior
              multivalent.std.lens.Lens

All Implemented Interfaces:
  ContextListener

Direct Known Subclasses:
  BitMagnify, Bounds, CharNum, Cypher, LensOp, Magnify, Mirror, PlainView, Rescale, Rotate, Ruler, SignalLens

public abstract class Lens
extends Behavior
implements ContextListener

VWindows that transform their content and compose with one another. Lenses are tools, such as a magnifying glass or show OCR content, that are associated with the window as a whole (specifically, with the Root), as opposed to individual Documents. Unlike other VWindows, Lenses are coordinated by a Lens Manager, which composes their effects. During paintBefore, as lenses implement ContextListener, they can add themselves to a Context's list of omnipresent in order to modify in all Documents within its bounds. To put lens creation in UI, add a reference to WindowUI in hub. Can write a lens with opaque content, but then it's not really a lens, which transforms their content, so use a VWindow or Note.

> Xerox PARC Magic Lenses reference

Version:
  $Revision: 1.5 $ $Date: 2003/06/02 05:48:56 $
See Also:
  `LensMan`, `Context`, `ContextListener`, `WindowUI`

Field Summary
`static java.lang.String` | `ATTR_HEIGHT`
`static java.lang.String` | `ATTR_TITLE`
`static java.lang.String` | `ATTR_WIDTH`
`static java.lang.String` | `ATTR_X`
`static java.lang.String` | `ATTR_Y`
`static java.lang.String` | `VAR_SHARED_LAYER`
`protected VFrame` | `win_`

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
`Lens()`

Method Summary
`boolean` | `appearance(Context cx, boolean all)` Effect: Context attributes and signals.
`void` | `close()` Removes from LensMan.
`void` | `destroy()` Protocol.
`java.awt.Rectangle` | `getContentBounds()` Bounds of corresponding VFrame's content area, exclusive of title bar.
`protected LensMan` | `getLensMan()` Return lens manager behavior that coordinates lens intersections.
`int` | `getPriority()` `final` because lens priority given by window stacking order.
`boolean` | `paintAfter(Context cx, Node node)` Effect: arbitrary drawing on top.
`boolean` | `paintBefore(Context cx, Node node)` Effect: Graphics2D transformation matrix.
`void` | `restore(ESISNode n, java.util.Map<java.lang.String,java.lang.Object> attr, Layer layer)` Creates corresponding VFrame, and sets title and bounds, which are available for subclasses to tweak,
`ESISNode` | `save()` Build up save data as ESIS tree, then write that out.
`boolean` | `semanticEventAfter(SemanticEvent se, java.lang.String msg)` Catch corresponding VFrame's windowClosed, windowRaised, ....
`void` | `show()` Adds to LensMan.

Methods inherited from class multivalent.Behavior
`buildAfter, buildBefore, checkRep, clipboardAfter, clipboardBefore, createUI, eventAfter, eventBefore, formatAfter, formatBefore, getBrowser, getDocument, getInstance, getInstance, getLayer, getLogger, getName, getPreference, getRoot, isEditable, putPreference, redo, restoreChildren, semanticEventBefore, setName, toString, 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

### ATTR_X

    public static final java.lang.String ATTR_X

See Also:
  Constant Field Values

### ATTR_Y

    public static final java.lang.String ATTR_Y

See Also:
  Constant Field Values

### ATTR_WIDTH

    public static final java.lang.String ATTR_WIDTH

See Also:
  Constant Field Values

### ATTR_HEIGHT

    public static final java.lang.String ATTR_HEIGHT

See Also:
  Constant Field Values

### ATTR_TITLE

    public static final java.lang.String ATTR_TITLE

See Also:
  Constant Field Values

### VAR_SHARED_LAYER

    public static final java.lang.String VAR_SHARED_LAYER

See Also:
  Constant Field Values

### win_

    protected VFrame win_

Constructor Detail

### Lens

    public Lens()

Method Detail

### getContentBounds

    public java.awt.Rectangle getContentBounds()

  Bounds of corresponding VFrame's content area, exclusive of title bar.

### getLensMan

    protected LensMan getLensMan()

  Return lens manager behavior that coordinates lens intersections. Dynamically creates if doesn't already exist.

  See Also:
    `LensMan`

### getPriority

    public final int getPriority()

  `final` because lens priority given by window stacking order.

  Specified by:
    `getPriority` in interface `ContextListener`

### appearance

    public boolean appearance(Context cx,
                              boolean all)

  Effect: Context attributes and signals.

  Specified by:
    `appearance` in interface `ContextListener`
    `all` - all attributes or exclude those that are not inherited
  Returns:
    false so it composes with other lenses
  See Also:
    `ContextListener`, `SignalLens`

### paintBefore

    public boolean paintBefore(Context cx,
                               Node node)

  Effect: Graphics2D transformation matrix.

  Overrides:
    `paintBefore` in class `Behavior`
  Returns:
    `true` to short-circuit to paintAfter at that node, bypassing painting of the subtree.
  See Also:
    `Magnify`

### paintAfter

    public boolean paintAfter(Context cx,
                              Node node)

  Effect: arbitrary drawing on top. Can even traverse tree for special effects (that don't compose with other lenses). Warning: this type of effects don't compose as well with other lenses.

  Overrides:
    `paintAfter` in class `Behavior`
  Returns:
    false so it composes with other lenses
  See Also:
    `Ruler`, `Bounds`, `Cypher`

### semanticEventAfter

    public boolean semanticEventAfter(SemanticEvent se,
                                      java.lang.String msg)

  Catch corresponding VFrame's windowClosed, windowRaised, ....

  Overrides:
    `semanticEventAfter` in class `Behavior`

### save

    public ESISNode save()

  Description copied from class: `Behavior`
  Build up save data as ESIS tree, then write that out. Makes node with GI = behavior name, same attributes, and possibly some children. Attributes are cloned, so if you want to stuff attributes from state, do that before `super.save()`. Always have `Behavior.ATTR_BEHAVIOR` from save (short) classname.

  Overrides:
    `save` in class `Behavior`

### restore

    public void restore(ESISNode n,
                        java.util.Map<java.lang.String,java.lang.Object> attr,
                        Layer layer)

  Creates corresponding VFrame, and sets title and bounds, which are available for subclasses to tweak,

  Overrides:
    `restore` in class `Behavior`

### destroy

    public void destroy()

  Description copied from class: `Behavior`
  Protocol. Cleans up state before being decommissioned: remove from Layer, observed nodes, .... Clients shouldn't hold a pointer/handle to object after destroy() as it is in an invalid state. This protocol cannot be short-circuited.

  Overrides:
    `destroy` in class `Behavior`

### close

    public void close()

  Removes from LensMan.

### show

    public void show()

  Adds to LensMan.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD