edu.mit.ai.psg.ui.outliner
Class Outliner

java.lang.Object
  |
  +--edu.mit.ai.psg.ui.outliner.Outliner
Direct Known Subclasses:
Jexa

public class Outliner
extends Object

Outliner creates expandable/collapsible outline views of objects, where each node may have different renderings, and alternate renderings.

Standard call to start Outliner is outline(Object);

Outliner is a class for static convenience methods and parameters. It keeps outlineMaker which does all the real work.

The outline created for an object by an OutlineMaker depends on the class of the object. An OutlineMaker holds a table of OutlineRenderers indexed by classes and interfaces. When there are several applicable renderers, OutlineMakerDefault chooses the one for the most specific class or interface of the object is used. An object can be redisplayed with an alternate applicable renderer invoked through a pop-up menu (mouse-2 or shift-click).

The OutlineMakerDefault starts out with just a single renderer for the root class, Object. OutlineRendererDefault renders an object by printing the object's Object.toString() and does not create any children.

To use Outliner, a program must initialize its outlineMaker with domain specific renderers that do create children, by calling addRenderer(Class,OutlineRenderer). Each renderer must implement OutlineRenderer.

This design allows other tools to invoke a system-wide outliner through convenient static methods. Many uses will simply involve adding new OutlineRenderers to the default OutlineMaker. Yet, if necessary, the behavior of the system outline maker can be extended by initializing outlineMaker to some other instance of OutlineMaker, e.g., one that overrides some methods of OutlineMakerDefault. (An instance of OutlineMaker can also be used directly without Outliner.)


Field Summary
static OutlineMaker outlineMaker
          outlineMaker: the single instance through which static methods indirectly invoke their implementation methods.
protected static String outlinerResourceName
           
 
Constructor Summary
protected Outliner()
           
 
Method Summary
static void addRenderer(Class forInterface, OutlineRenderer renderer)
          Add an outline renderer for objects with this interface into outlineMaker's table.
static List getAllRenderers(Object obj)
          Search class and its interfaces and superclasses for each class/interface which has a renderer, and return all renderers found.
static String getCopyright()
           
static String getHomepage()
           
static OutlineRenderer getMostSpecificRenderer(Object obj)
          Search class and its interfaces and superclasses for a class/interface which has a renderer, and return the most specific renderer found.
static OutlineRenderer getNoteRenderer()
          get renderer used for notes in an outline, such as section separators, error messages, etc.
static String getNoWarranty()
           
protected static String getOutlinerBundleString(String resourceKey)
           
static String getVersion()
           
static JFrame makeFrame(Object obj)
          Make a new window frame displaying an outline of this object.
static JFrame makeFrame(String frameLabel, OutlineNode newRoot)
          Make a new window frame displaying outline.
static OutlineNode makeOutlineNode(Object obj)
           
static OutlineNode makeOutlineNode(Object label, Object obj)
          Make a new OutlineNode for obj to add to an outline.
static JFrame outline(Object obj)
          Make a new window frame outlining obj, show frame, and return it.
static boolean removeRenderer(Class forInterface, OutlineRenderer renderer)
          Remove renderer from the renderers for this interface or class (not super-interfaces or super-classes).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outlineMaker

public static OutlineMaker outlineMaker
outlineMaker: the single instance through which static methods indirectly invoke their implementation methods. Allows implementations of these methods to be overridden in a subclass, yet other tools can still invoke them through the static methods of this class. If overriding, initialize this with instance of subclass.

outlinerResourceName

protected static final String outlinerResourceName
Constructor Detail

Outliner

protected Outliner()
Method Detail

getCopyright

public static String getCopyright()

getNoWarranty

public static String getNoWarranty()

getVersion

public static String getVersion()

getHomepage

public static String getHomepage()

outline

public static JFrame outline(Object obj)
Make a new window frame outlining obj, show frame, and return it.

makeFrame

public static JFrame makeFrame(Object obj)
Make a new window frame displaying an outline of this object. To display it, optionally set its bounds, then frame.show().

makeFrame

public static JFrame makeFrame(String frameLabel,
                               OutlineNode newRoot)
Make a new window frame displaying outline. To display it, optionally set its bounds, then frame.show().
Parameters:
frameLabel - title of window frame
newRoot - root node of outline
See Also:
makeOutlineNode(Object)

makeOutlineNode

public static OutlineNode makeOutlineNode(Object obj)
See Also:
makeOutlineNode(Object, Object)

makeOutlineNode

public static OutlineNode makeOutlineNode(Object label,
                                          Object obj)
Make a new OutlineNode for obj to add to an outline. Uses renderer for obj's most specific class or interface.
See Also:
getMostSpecificRenderer(java.lang.Object)

getMostSpecificRenderer

public static OutlineRenderer getMostSpecificRenderer(Object obj)
Search class and its interfaces and superclasses for a class/interface which has a renderer, and return the most specific renderer found.

getAllRenderers

public static List getAllRenderers(Object obj)
Search class and its interfaces and superclasses for each class/interface which has a renderer, and return all renderers found.

addRenderer

public static void addRenderer(Class forInterface,
                               OutlineRenderer renderer)
Add an outline renderer for objects with this interface into outlineMaker's table. Most recently added renderer is default for an interface, so adding a renderer it already has makes it the default.
Parameters:
forInterface - Objects with this interface or class will be outlined with this function (unless a more specific one applies). If forInterface is null, then it will be used to render null.
renderer - must be a non-null OutlineRenderer

removeRenderer

public static boolean removeRenderer(Class forInterface,
                                     OutlineRenderer renderer)
Remove renderer from the renderers for this interface or class (not super-interfaces or super-classes). Returns true if found.

getNoteRenderer

public static OutlineRenderer getNoteRenderer()
get renderer used for notes in an outline, such as section separators, error messages, etc.

getOutlinerBundleString

protected static String getOutlinerBundleString(String resourceKey)

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu