edu.mit.ai.psg.ui.outliner
Interface OutlineMaker

All Known Implementing Classes:
OutlineMakerDefault

public interface OutlineMaker

An OutlineMaker takes objects and creates outline window frames holding an outline of each object, built by the OutlineRenderer for the object's most specific class or interface.

An OutlineMaker:

  1. keeps a table of OutlineRenderers indexed by classes and interfaces, and manages additions to and lookups from this table. (e.g., addRenderer(java.lang.Class, edu.mit.ai.psg.ui.outliner.OutlineRenderer), getMostSpecificRenderer(java.lang.Object)).
  2. makes OutlineNodes for objects (and perhaps their children as an outline is expanded) by finding the object's most specific class or interface with a renderer, and invoking OutlineRenderer.makeOutlineNode(java.lang.Object, java.lang.Object). (e.g., makeOutlineNode(Object).)
  3. makes new window frames displaying an outline for objects, starting with either the object or an OutlineNode. (e.g., makeFrame(Object).)
  4. provides popup menu items that apply to all outlines. (addPopupMenuItems(java.awt.PopupMenu, edu.mit.ai.psg.ui.outliner.OutlineNode, javax.swing.tree.TreePath, javax.swing.JTree))
Most applications require just a single OutlineMaker, referenced through the static convenience methods of Outliner.


Method Summary
 void addPopupMenuItems(PopupMenu menu, OutlineNode outlineNode, TreePath treePath, JTree jTree)
          Add items to the popup menu for an outline node.
 void addRenderer(Class forInterface, OutlineRenderer renderer)
          Add an outline renderer for objects with this interface into renderer table.
 List getAllInterfacesWithRenderers(Object obj)
          Search class and its interfaces and superclasses for each class/interface which has a renderer, and return all classes/interfaces found.
 List getAllRenderers(Object obj)
          Search class and its interfaces and superclasses for each class/interface which has a renderer, and return all renderers found.
 OutlineRenderer getExactRenderer(Class anInterface)
          Get one renderer for exactly this interface or class (not super-interfaces or super-classes).
 List getExactRenderers(Class anInterface)
          return a List of renderers for exactly this interface or class.
 JTree getFrameJTree(JFrame frame)
          given a window frame returned by makeFrame, get its JTree
 Class getMostSpecificInterfaceWithRenderers(Object obj)
          Search outline renderers for object for the most specific class or interface of obj.
 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.
 OutlineRenderer getNoteRenderer()
          get renderer used for notes in an outline, such as section separators, error messages, etc.
 JTree getPaneJTree(Container frame)
          given a window pane initalized by initializePane, get its JTree
 void initializePane(Container contentPane, OutlineNode displayRoot)
          initialize contentPane with a javax.swing.JScrollPane displaying the JTree from makeOutlineJTree(edu.mit.ai.psg.ui.outliner.OutlineNode).
 JFrame makeFrame(Object object)
          make a new window frame displaying an outline of this object
 JFrame makeFrame(String frameLabel, OutlineNode newRoot)
          make a new window frame displaying outline
 String makeFrameTitle(Object object)
          make title for new frame displaying outline of object
 JTree makeOutlineJTree(OutlineNode displayRoot)
          create and initialize a JTree for displaying outline tree.
 OutlineModel makeOutlineModel(OutlineNode hiddenRoot)
          return a new OutlineModel with hidden root of tree (called by makeOutlineJTree(edu.mit.ai.psg.ui.outliner.OutlineNode))
 OutlineNode makeOutlineNode(Object obj)
           
 OutlineNode makeOutlineNode(Object label, Object obj)
          Make a new OutlineNode for obj to add to an outline.
 JFrame outline(Object object)
          make and open a new window frame displaying an outline of this object
 boolean removeRenderer(Class forInterface, OutlineRenderer renderer)
          Remove renderer from the renderers for this interface or class (not super-interfaces or super-classes).
 void setFrameJTree(JFrame frame, JTree jtree)
          given a window frame returned by makeFrame, set its JTree
 void setPaneJTree(Container frame, JTree jtree)
          given a window pane initialized by initializePane, set its JTree
 

Method Detail

outline

public JFrame outline(Object object)
make and open a new window frame displaying an outline of this object
See Also:
makeFrame(java.lang.Object)

makeFrame

public JFrame makeFrame(Object object)
make a new window frame displaying an outline of this object
See Also:
makeFrameTitle(java.lang.Object)

makeFrame

public JFrame makeFrame(String frameLabel,
                        OutlineNode newRoot)
make a new window frame displaying outline
Parameters:
frameLabel - title of window frame
newRoot - root node of outline
See Also:
makeOutlineNode(Object)

makeFrameTitle

public String makeFrameTitle(Object object)
make title for new frame displaying outline of object
See Also:
makeFrame(Object)

getFrameJTree

public JTree getFrameJTree(JFrame frame)
given a window frame returned by makeFrame, get its JTree

setFrameJTree

public void setFrameJTree(JFrame frame,
                          JTree jtree)
given a window frame returned by makeFrame, set its JTree

initializePane

public void initializePane(Container contentPane,
                           OutlineNode displayRoot)
initialize contentPane with a javax.swing.JScrollPane displaying the JTree from makeOutlineJTree(edu.mit.ai.psg.ui.outliner.OutlineNode).

getPaneJTree

public JTree getPaneJTree(Container frame)
given a window pane initalized by initializePane, get its JTree

setPaneJTree

public void setPaneJTree(Container frame,
                         JTree jtree)
given a window pane initialized by initializePane, set its JTree

makeOutlineJTree

public JTree makeOutlineJTree(OutlineNode displayRoot)
create and initialize a JTree for displaying outline tree. Adds a hidden root node so every displayed node has a parent node in which it can be replaced by a new renderer. (Calls makeOutlineModel(edu.mit.ai.psg.ui.outliner.OutlineNode)(hiddenRoot).)
See Also:
JTree.setRootVisible(boolean)

makeOutlineModel

public OutlineModel makeOutlineModel(OutlineNode hiddenRoot)
return a new OutlineModel with hidden root of tree (called by makeOutlineJTree(edu.mit.ai.psg.ui.outliner.OutlineNode))

makeOutlineNode

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

makeOutlineNode

public 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 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.

getMostSpecificInterfaceWithRenderers

public Class getMostSpecificInterfaceWithRenderers(Object obj)
Search outline renderers for object for the most specific class or interface of obj.
Throws:
NoSuchElementException - if none found (e.g., renderer for Object.class has been removed)

getAllRenderers

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

getAllInterfacesWithRenderers

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

getExactRenderer

public OutlineRenderer getExactRenderer(Class anInterface)
Get one renderer for exactly this interface or class (not super-interfaces or super-classes). null is treated as the class of null. Returns null if no renderers; otherwise chooses most recently used or added renderer.

getExactRenderers

public List getExactRenderers(Class anInterface)
return a List of renderers for exactly this interface or class. (not super-interfaces or super-classes). List is ordered so most recently added renderer (default for this interface or class) is first.

addRenderer

public void addRenderer(Class forInterface,
                        OutlineRenderer renderer)
Add an outline renderer for objects with this interface into renderer 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 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 OutlineRenderer getNoteRenderer()
get renderer used for notes in an outline, such as section separators, error messages, etc.

addPopupMenuItems

public void addPopupMenuItems(PopupMenu menu,
                              OutlineNode outlineNode,
                              TreePath treePath,
                              JTree jTree)
Add items to the popup menu for an outline node. This method for adding items that will appear in all popup menus. OutlineRenderer.addPopupMenuItems(java.awt.PopupMenu, edu.mit.ai.psg.ui.outliner.OutlineNode, javax.swing.tree.TreePath, javax.swing.JTree) is for adding items particular to the class or interface renderered by that OutlineRenderer.
See Also:
OutlineRenderer.addPopupMenuItems(java.awt.PopupMenu, edu.mit.ai.psg.ui.outliner.OutlineNode, javax.swing.tree.TreePath, javax.swing.JTree), OutlineCommand

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu