|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Panel
|
+--edu.mit.ai.psg.ui.outlines.OutlineTree
OutlineTree: Base component class for outline components which can expand or collapse to show their children. (Similar to trees in many UI toolkits, but elements can be labeled.)
See method generateChildren()
for instructions on how to add children.
Derived classes may tailor the behavior to generate children when
item is expanded. See method actionPerformed(ActionEvent)
for how to do this.
Derived classes may tailor the popup menu provided with for their
instances by adding an appropriate title string identifying the
moused object at the top of its pop-up menu by overriding method
addPopupMenuTitle(PopupMenu), or by adding additional popup menu
items specific to the derived outline by overriding method
addPopupMenuItems(PopupMenu).
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
| Constructor Summary | |
OutlineTree(Component component)
|
|
| Method Summary | |
void |
actionPerformed(ActionEvent e)
ActionPerformed: Toggles whether tree is displayed expanded (showing children) or not (only showing root). |
protected void |
addImpl(Component comp,
Object label,
int index)
|
void |
addPopupMenuItems(PopupMenu menu)
Add popup menu items specific to this kind of outline, if any |
void |
addPopupMenuTitle(PopupMenu menu)
Add a menu item identifying the object the popup menu is for. |
void |
doLayout()
|
void |
generateChildren()
GenerateChildren(): Subclasses may override this method with one which generates children. To add children, for each child, call this from subclass method: . |
Component |
getChildComponent(int index)
|
Component |
getChildLabel(int index)
|
int |
getChildrenCount()
|
Dimension |
getMinimumSize()
|
Dimension |
getPreferredSize()
|
Component |
getRootComponent()
|
boolean |
hasChildren()
|
void |
invalidateAndRepaintTree()
|
boolean |
isExpanded()
|
Component |
makeLabelComponent(String string)
|
void |
setExpanded(boolean isExpanded)
|
| Methods inherited from class java.awt.Panel |
addNotify |
| Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
countComponents,
deliverEvent,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getInsets,
getLayout,
getMaximumSize,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paint,
paintComponents,
paramString,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setFont,
setLayout,
update,
validate,
validateTree |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public OutlineTree(Component component)
| Method Detail |
public Component getRootComponent()
public boolean isExpanded()
public void setExpanded(boolean isExpanded)
public boolean hasChildren()
public int getChildrenCount()
public Component getChildComponent(int index)
public Component getChildLabel(int index)
public void generateChildren()
To add children, for each child, call this from subclass method:
. this.add(Outliner.makeOutlineComponent(childObject),
. makeLabelComponent("childLabel"));
Or if children are not labeled, then call this instead:. this.add(Outliner.makeOutlineComponent(obj));
public Component makeLabelComponent(String string)
public void addPopupMenuTitle(PopupMenu menu)
public void addPopupMenuItems(PopupMenu menu)
public void actionPerformed(ActionEvent e)
. public void actionPerformed(ActionEvent e) {
. if (! isExpanded() && ! hasChildren())
. generateChildren();
. super.actionPerformed(e)
. } public void invalidateAndRepaintTree()
protected void addImpl(Component comp,
Object label,
int index)
public void doLayout()
public Dimension getPreferredSize()
public Dimension getMinimumSize()
|
Copyright (c) 1996-1999 Massachusetts Institute of Technology Feedback: jeva-bugs@ai.mit.edu |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||