|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.mit.ai.psg.ui.outliner.awt.Outliner
Outliner --- creates expandable/collapsible outline views of objects.
Standard call to start Outliner is makeOutlineFrame(Object);
Outline elements may be expanded/collapsed by clicking on the +/- button, or double clicking on the object.
Outline created depends on class of object examined. The default
ToStringComponentGenerator just creates a component based on the
print string of the object and does not create any children. To
use Outliner a program must initialize it with domain specific
outline generators by calling
Outliner.putOutlineGenerator.
When there are several applicable outline generators, the one for the most specific class or interface of the object is used. An object can be redisplayed with an alternate applicable generator invoked through a pop-up menu (mouse-2 or shift-click).
A component outline generator implements
IOutlineComponentGenerator.
When invoked, it returns a java.awt.Component, usually a subclass of
OutlineTree so the component can be expanded to display its
children.
This Outliner class is designed to manage a single table of generators in an extensible manner, yet still be invokable from static methods. An extending class can replace Outliner.outliner with an instance of its own to override implementation methods. Other tools which invoke Outliner's static methods will then invoke the implementation methods of the extending class. Generator classes can add themselves to the table of generators (putOutlineGenerator) independently of (initialized before or after) an extended outliner.
| Field Summary | |
static Font |
defaultFont
Default font for new text, e.g., new Font("SansSerif", Font.PLAIN, 11) |
static IOutlineComponentGenerator |
defaultGenerator
Default IOutlineComponentGenerator called if no generator found in generators |
static Map |
generators
Map of IOutlineComponentGenerators keyed on interface or class
to which each applies. |
static Rectangle |
initialBounds
|
static Outliner |
outliner
outliner: an instance through which static methods indirectly invoke their implementation methods. |
| Constructor Summary | |
Outliner()
|
|
| Method Summary | |
void |
addListeners(Object object,
Component newComponent)
initialize object's outline Component by adding mouse event listeners. |
void |
addPopupMenuItems(PopupMenu menu,
Object obj,
Component component)
addPopUpMenuItems first adds menu item "Display outline in own frame". |
Vector |
getAllGenerators(Object obj)
Search class and its interfaces and superclasses for each class/interface which has a generator, and return all generators found. |
IOutlineComponentGenerator |
getExactOutlineGenerator(Class anInterface)
Get the generator for exactly this interface or class (not super-interfaces or super-classes) |
static IOutlineComponentGenerator |
getMostSpecificGenerator(Object obj)
Search class and its interfaces and superclasses for a class/interface which has a generator, and return the most specific generator found. |
IOutlineComponentGenerator |
getMostSpecificGeneratorImpl(Object obj)
Search for an outline component generator for object for the most specific class or interface declaration. |
static Component |
makeOutlineComponent(Object obj)
Generate a new AWT Component for obj to add to an outline. |
Component |
makeOutlineComponentImpl(Object obj)
(overrideable implementation method) |
static Frame |
makeOutlineFrame(Object obj)
Create a Frame window with an outline for obj (static method for other tools to call) |
static Frame |
makeOutlineFrame(Object obj,
String frameLabel)
|
Frame |
makeOutlineFrameImpl(Object obj)
overrideable/extendable implementation method |
Frame |
makeOutlineFrameImpl(Object obj,
String frameLabel)
|
static void |
putOutlineGenerator(Class forInterface,
IOutlineComponentGenerator generator)
Put a outline component generator for objects with this interface in table. |
static void |
removeOutlineGenerator(Class forInterface)
Remove the generator specific 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 |
public static Outliner outliner
public static Map generators
IOutlineComponentGenerators keyed on interface or class
to which each applies.putOutlineGenerator(Class, IOutlineComponentGenerator),
getExactOutlineGenerator(Class)public static IOutlineComponentGenerator defaultGenerator
public static Font defaultFont
Font.Font(String, int, int)public static Rectangle initialBounds
| Constructor Detail |
public Outliner()
| Method Detail |
public static Frame makeOutlineFrame(Object obj)
public static Frame makeOutlineFrame(Object obj,
String frameLabel)
public Frame makeOutlineFrameImpl(Object obj)
public Frame makeOutlineFrameImpl(Object obj,
String frameLabel)
public static Component makeOutlineComponent(Object obj)
public Component makeOutlineComponentImpl(Object obj)
public void addListeners(Object object,
Component newComponent)
public static IOutlineComponentGenerator getMostSpecificGenerator(Object obj)
public IOutlineComponentGenerator getMostSpecificGeneratorImpl(Object obj)
I.e.:
. for (c = obj.getClass(); c != null; c = c.getSuperclass()) {
. gen = getExactOutlineGenerator(c);
. if (gen != null) return gen;
. interfacesStack = new Stack(c.getInterfaces());
. while(! interfacesStack.isEmpty()) {
. i = interfacesStack.pop();
. gen = getExactOutlineGenerator(i);
. if (gen != null) return gen;
. interfacesStack.addAll(0, i.getInterfaces());
. }
. }
Overrideable implementation method (called by getMostSpecificGenerator).public Vector getAllGenerators(Object obj)
public IOutlineComponentGenerator getExactOutlineGenerator(Class anInterface)
public static void putOutlineGenerator(Class forInterface,
IOutlineComponentGenerator generator)
forInterface - Objects with this interface or class will be
outlined with this function (unless a more specific one applies)generator - should return a java.awt.Component,
typically an OutlineTree or a subclass.public static void removeOutlineGenerator(Class forInterface)
public void addPopupMenuItems(PopupMenu menu,
Object obj,
Component component)
|
Copyright (c) 1996-1999 Massachusetts Institute of Technology Feedback: jeva-feedback@ai.mit.edu |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||