Class

cogdebugger.ui.fieldvisualizations

ViewerSuperPanel

Related Doc: package fieldvisualizations

Permalink

class ViewerSuperPanel extends BorderPanel with EventDrivenViewer with Zoomable with RestorableState

A high-level visualization container that lets a user choose switch between available visualization options for a particular field.

Besides a target field, this class also requires as arguments a list of user-friendly visualization names and a factory that uses those names as keys to produce an actual Viewer instance. The superpanel itself is presented as a BorderPanel with a toolbar at the top and the visualization in the center. The selectable viewer's names are presented to the user in a ComboBox installed in the toolbar after any visualiztion specific controls (which are installed if a given Viewer implements the ToolbarItems trait). This combobox will only appear if there is more than one available visualization.

The first visualization named in the options argument is used as the default and will be immediately installed in the superpanel as part of initialization.

While viewerFactory can be any map from Strings to Viewers, consider making it some sort of lazy or memoized map, particularly if any of the Viewer instances has substantial startup time. cogdebugger.Memoize#apply cogdebugger.Memoize

This class was designed with the expectation that we'll wish to implement a subclass specific to each particualar type of field. A companion object with a straightforward factory method can make the instantiation of the subclass cleaner. E.g., for ColorFields (which currently only have one visualization):

class ColorFieldSuperPanel protected (target: ProbedField,
                                      options: List[String],
                                      factory: (String) => Viewer)
  extends ViewerSuperPanel2(target, options, factory)

object ColorFieldSuperPanel {

  val ColorPanelName = "Color Image"
  val viewerNames = List(ColorPanelName)

  def apply(target: ProbedField) = {
    //require( // Check for ColorField //, "Not a ColorField")
    val fieldShape  = target.fieldType.fieldShape
    val tensorShape = target.fieldType.tensorShape
    val memoizer = Memoize[String, EventDrivenViewer] {
      case ColorPanelName => new ColorFieldMemoryView(target, fieldShape) with MouseDragZoom
    }
    new ColorFieldSuperPanel(target, viewerNames, memoizer)
  }
}

Created by gonztobi on 4/10/2014.

Linear Supertypes
RestorableState, Zoomable, EventDrivenViewer, ProbeListener, Viewer, BorderPanel, LayoutContainer, Panel, Wrapper, Container, Component, UIElement, LazyPublisher, Publisher, Reactor, Proxy, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ViewerSuperPanel
  2. RestorableState
  3. Zoomable
  4. EventDrivenViewer
  5. ProbeListener
  6. Viewer
  7. BorderPanel
  8. LayoutContainer
  9. Panel
  10. Wrapper
  11. Container
  12. Component
  13. UIElement
  14. LazyPublisher
  15. Publisher
  16. Reactor
  17. Proxy
  18. AnyRef
  19. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ViewerSuperPanel(target: ProbedField, options: List[String], viewerFactory: (String) ⇒ Viewer)

    Permalink

    target

    ProbedField being visualized.

    options

    User-presentable strings corresponding to the visualizations available for the target field.

    viewerFactory

    A map from the Strings in options to their respective visualization instances.

Type Members

  1. type Constraints = scala.swing.BorderPanel.Position.Value

    Permalink
    Definition Classes
    BorderPanel → LayoutContainer
  2. class Content extends BufferWrapper[Component]

    Permalink
    Attributes
    protected
    Definition Classes
    Wrapper
  3. trait SuperMixin extends JComponent

    Permalink
    Attributes
    protected
    Definition Classes
    Component
  4. class Worker extends SwingWorker[Unit, Unit]

    Permalink
    Definition Classes
    EventDrivenViewer

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val _contents: Content

    Permalink
    Attributes
    protected
    Definition Classes
    Wrapper
  5. def add(c: Component, l: Constraints): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    BorderPanel → LayoutContainer
  6. def areValid(c: Constraints): (Boolean, String)

    Permalink
    Attributes
    protected
    Definition Classes
    BorderPanel → LayoutContainer
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def background: Color

    Permalink
    Definition Classes
    UIElement
  9. def background_=(c: Color): Unit

    Permalink
    Definition Classes
    UIElement
  10. def border: Border

    Permalink
    Definition Classes
    Component
  11. def border_=(b: Border): Unit

    Permalink
    Definition Classes
    Component
  12. def bounds: Rectangle

    Permalink
    Definition Classes
    UIElement
  13. var busy: Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    EventDrivenViewer
  14. def changeDisplay(key: String): Unit

    Permalink

    Change the currently active display.

    Change the currently active display. Also adds/removes some controls from the toolbar as appropriate (e.g. adds zoom buttons for Zoomable views or removes them for views that cannot be zoomed).

    key

    Key into the displayOptions map for the desired view.

  15. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. def constraintsFor(comp: Component): scala.swing.BorderPanel.Position.Value

    Permalink
    Attributes
    protected
    Definition Classes
    BorderPanel → LayoutContainer
  17. def contents: Seq[Component]

    Permalink
    Definition Classes
    Wrapper → Container
  18. var currentView: Viewer

    Permalink
    Attributes
    protected
  19. def cursor: Cursor

    Permalink
    Definition Classes
    UIElement
  20. def cursor_=(c: Cursor): Unit

    Permalink
    Definition Classes
    UIElement
  21. def deafTo(ps: Publisher*): Unit

    Permalink
    Definition Classes
    Reactor
  22. def displayable: Boolean

    Permalink
    Definition Classes
    UIElement
  23. def enabled: Boolean

    Permalink
    Definition Classes
    Component
  24. def enabled_=(b: Boolean): Unit

    Permalink
    Definition Classes
    Component
  25. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  26. def equals(that: Any): Boolean

    Permalink
    Definition Classes
    Proxy → Any
  27. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  28. def focusable: Boolean

    Permalink
    Definition Classes
    Component
  29. def focusable_=(b: Boolean): Unit

    Permalink
    Definition Classes
    Component
  30. def font: Font

    Permalink
    Definition Classes
    UIElement
  31. def font_=(f: Font): Unit

    Permalink
    Definition Classes
    UIElement
  32. def foreground: Color

    Permalink
    Definition Classes
    UIElement
  33. def foreground_=(c: Color): Unit

    Permalink
    Definition Classes
    UIElement
  34. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  35. def hasFocus: Boolean

    Permalink
    Definition Classes
    Component
  36. def hashCode(): Int

    Permalink
    Definition Classes
    Proxy → Any
  37. def ignoreRepaint: Boolean

    Permalink
    Definition Classes
    UIElement
  38. def ignoreRepaint_=(b: Boolean): Unit

    Permalink
    Definition Classes
    UIElement
  39. var initP: JComponent

    Permalink
    Definition Classes
    Component
  40. def inputVerifier: (Component) ⇒ Boolean

    Permalink
    Definition Classes
    Component
  41. def inputVerifier_=(v: (Component) ⇒ Boolean): Unit

    Permalink
    Definition Classes
    Component
  42. def isBusy: Boolean

    Permalink
    Definition Classes
    EventDrivenViewerProbeListener
  43. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  44. var lastData: libcog.AbstractFieldMemory

    Permalink
    Attributes
    protected
  45. var lastTime: Long

    Permalink
    Attributes
    protected
  46. def layout: Map[Component, Constraints]

    Permalink
    Definition Classes
    LayoutContainer
  47. def layoutManager: BorderLayout

    Permalink
    Definition Classes
    BorderPanel
  48. def listenTo(ps: Publisher*): Unit

    Permalink
    Definition Classes
    Reactor
  49. val listeners: RefSet[Reaction] { val underlying: scala.collection.mutable.HashSet[scala.ref.Reference[scala.swing.Reactions.Reaction]] }

    Permalink
    Attributes
    protected
    Definition Classes
    Publisher
  50. def locale: Locale

    Permalink
    Definition Classes
    UIElement
  51. def location: Point

    Permalink
    Definition Classes
    UIElement
  52. def locationOnScreen: Point

    Permalink
    Definition Classes
    UIElement
  53. def maximumSize: Dimension

    Permalink
    Definition Classes
    UIElement
  54. def maximumSize_=(x: Dimension): Unit

    Permalink
    Definition Classes
    UIElement
  55. def minimumSize: Dimension

    Permalink
    Definition Classes
    UIElement
  56. def minimumSize_=(x: Dimension): Unit

    Permalink
    Definition Classes
    UIElement
  57. object mouse

    Permalink
    Definition Classes
    Component
  58. def name: String

    Permalink
    Definition Classes
    Component
  59. def name_=(s: String): Unit

    Permalink
    Definition Classes
    Component
  60. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  61. def notify(event: ProbeEvent): Unit

    Permalink
    Definition Classes
    EventDrivenViewerProbeListener
  62. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  63. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  64. def onFirstSubscribe(): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Component → UIElement → LazyPublisher
  65. def onLastUnsubscribe(): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    UIElement → LazyPublisher
  66. def opaque: Boolean

    Permalink
    Definition Classes
    Component
  67. def opaque_=(b: Boolean): Unit

    Permalink
    Definition Classes
    Component
  68. def paint(g: Graphics2D): Unit

    Permalink
    Definition Classes
    Component
  69. def paintBorder(g: Graphics2D): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Component
  70. def paintChildren(g: Graphics2D): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Component
  71. def paintComponent(g: Graphics2D): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Component
  72. lazy val peer: JPanel with SuperMixin

    Permalink
    Definition Classes
    BorderPanel → Panel → Wrapper → Component → UIElement
  73. def preferredSize: Dimension

    Permalink
    Definition Classes
    UIElement
  74. def preferredSize_=(x: Dimension): Unit

    Permalink
    Definition Classes
    UIElement
  75. val properties: ArrayBuffer[Property[_]]

    Permalink

    A list of properties that should be persisted when the app closes, and restored the next time it's launched.

    A list of properties that should be persisted when the app closes, and restored the next time it's launched. A common example of a persistent is the zoom/magnification level of the viewer. Be sure to add any relevenant properties to this list in your Viewer subclasses!

    Definition Classes
    Viewer
  76. def propertiesTag: NodeSeq

    Permalink

    Returns the XML representation of this viewer's properties, suitable for saving into a file.

    Returns the XML representation of this viewer's properties, suitable for saving into a file.

    Definition Classes
    Viewer
  77. def publish(e: Event): Unit

    Permalink
    Definition Classes
    Publisher
  78. val reactions: Reactions

    Permalink
    Definition Classes
    Reactor
  79. def repaint(rect: Rectangle): Unit

    Permalink
    Definition Classes
    UIElement
  80. def repaint(): Unit

    Permalink
    Definition Classes
    UIElement
  81. def requestFocus(): Unit

    Permalink
    Definition Classes
    Component
  82. def requestFocusInWindow(): Boolean

    Permalink
    Definition Classes
    Component
  83. def reset(): Unit

    Permalink

    Reset the visualization.

    Reset the visualization. An optional operation; subclasses must override this method or else it does nothing.

    Definition Classes
    Viewer
  84. def restore(tag: Node): Unit

    Permalink

    Restore this object to the state described in the given XML node.

    Restore this object to the state described in the given XML node.

    Definition Classes
    ViewerSuperPanelRestorableState
  85. def revalidate(): Unit

    Permalink
    Definition Classes
    Component
  86. def save: Elem

    Permalink

    Encode the state of this panel into an XML tag.

    Encode the state of this panel into an XML tag.

    Definition Classes
    ViewerSuperPanelRestorableState
  87. var savedState: Node

    Permalink
    Attributes
    protected
  88. val selectedViewerProperty: OneOfNProperty

    Permalink
  89. def self: Component

    Permalink
    Definition Classes
    UIElement → Proxy
  90. def showing: Boolean

    Permalink
    Definition Classes
    UIElement
  91. def size: Dimension

    Permalink
    Definition Classes
    UIElement
  92. def subscribe(listener: Reaction): Unit

    Permalink
    Definition Classes
    LazyPublisher → Publisher
  93. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  94. def toString(): String

    Permalink
    Definition Classes
    Component → Proxy → AnyRef → Any
  95. val toolbar: ToolBar { ... /* 3 definitions in type refinement */ }

    Permalink

    A toolbar that hosts common controls for the visualizations installed as children in this SuperPanel, as well as the combo box that allows switching between different visualizations.

  96. def toolkit: Toolkit

    Permalink
    Definition Classes
    UIElement
  97. def tooltip: String

    Permalink
    Definition Classes
    Component
  98. def tooltip_=(t: String): Unit

    Permalink
    Definition Classes
    Component
  99. def unsubscribe(listener: Reaction): Unit

    Permalink
    Definition Classes
    LazyPublisher → Publisher
  100. def update(src: AnyRef, data: libcog.AbstractFieldMemory, simTime: Long): Unit

    Permalink

    Updates the visualization based on the contents of data.

    Updates the visualization based on the contents of data.

    The src argument was orignally meant to reference the kernel/field/object that generated the data, in order to support composite visualizations (that is, viewers that produce a visual based on the data from several different sources), but launching such viewers in the current UI is clunky at beset, so this feature isn't used. Viewers that only visualize a single field's data can probably safely ignore this arument (and indeed, most of the current ones do).

    src

    The field or object that generated the data argument

    data

    New field data that needs to be rendered by this viewer

    simTime

    The ComputeGraph's step count at the time the data argument was generated

    Definition Classes
    ViewerSuperPanelViewer
  101. def update(newData: libcog.AbstractFieldMemory, step: Long): Unit

    Permalink

    Updates the visualization based on the contents of data.

  102. def updateCurrentView(data: libcog.AbstractFieldMemory, step: Long): Unit

    Permalink
  103. def visible: Boolean

    Permalink
    Definition Classes
    UIElement
  104. def visible_=(b: Boolean): Unit

    Permalink
    Definition Classes
    UIElement
  105. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  106. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  107. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  108. def xLayoutAlignment: Double

    Permalink
    Definition Classes
    Component
  109. def xLayoutAlignment_=(x: Double): Unit

    Permalink
    Definition Classes
    Component
  110. def xmlToProperties(node: Node): Unit

    Permalink

    Parses the XML tag produced by the propertiesTag method and restores any saved valued to this Viewer.

    Parses the XML tag produced by the propertiesTag method and restores any saved valued to this Viewer.

    Definition Classes
    Viewer
  111. def yLayoutAlignment: Double

    Permalink
    Definition Classes
    Component
  112. def yLayoutAlignment_=(y: Double): Unit

    Permalink
    Definition Classes
    Component
  113. def zoomIn(): Unit

    Permalink
    Definition Classes
    ViewerSuperPanelZoomable
  114. def zoomOut(): Unit

    Permalink
    Definition Classes
    ViewerSuperPanelZoomable

Inherited from RestorableState

Inherited from Zoomable

Inherited from EventDrivenViewer

Inherited from ProbeListener

Inherited from Viewer

Inherited from BorderPanel

Inherited from LayoutContainer

Inherited from Panel

Inherited from Wrapper

Inherited from Container

Inherited from Component

Inherited from UIElement

Inherited from LazyPublisher

Inherited from Publisher

Inherited from Reactor

Inherited from Proxy

Inherited from AnyRef

Inherited from Any

Ungrouped