org.concord.biologica.ui
Class TreeView

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JScrollPane
                          |
                          +--org.concord.biologica.ui.TreeView
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, javax.swing.ScrollPaneConstants, SelectionPresenter, java.io.Serializable, javax.swing.event.TreeSelectionListener

public final class TreeView
extends javax.swing.JScrollPane
implements java.beans.PropertyChangeListener, javax.swing.event.TreeSelectionListener, SelectionPresenter

The tree view of BioLogica.

An object of this class will generate the following property change events:

Version:
$Revision: 1.1.1.1 $ $Date: 2001/04/28 00:39:21 $
Author:
$Author: ed $
See Also:
UIProp.ROOT_ENGINE_OBJECT, PropertyChangeListener, Serialized Form

Inner classes inherited from class javax.swing.JScrollPane
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.beans.PropertyChangeSupport changes
          Utility object which manages property change events and listeners.
protected  java.awt.Color selectionColor
          Selection color for a particular view
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TreeView()
          Creates a species tree view.
 
Method Summary
 void addNode(TreeViewNode parentNode, TreeViewNode newNode, int indexInParentNode)
          Add a new node to the tree with the given parent node.
 void addPropertyChangeListener(java.beans.PropertyChangeListener aListener)
          Add a property change listener for properties.
 void expandNode(TreeViewNode node)
          Expand the given node
static java.awt.Color getDefaultSelectionColor()
          Get the default selection color
 EngineObject getRootEngineObject()
          Get the root engine object of this view.
 java.awt.Color getSelectionColor()
          Get the selection color
 SelectionSet getSelectionSet()
          Get the current selection set
 void nodeChanged(TreeViewNode aTreeViewNode)
          Notification that a node in this tree has changed.
 void nodeObjectDeleted(TreeViewNode aTreeViewNode)
          Notification that the engine object corresponding to a node in this tree has been deleted.
 void nodeSelectedStateChanged(TreeViewNode aTreeViewNode, boolean oldSelected, boolean newSelected)
          Notification that a node's selected state in this tree changed.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Handle property change events
 void removePropertyChangeListener(java.beans.PropertyChangeListener aListener)
          Remove a property change listener for properties.
 void selectionChanged()
          Selection changed.
static void setDefaultSelectionColor(java.awt.Color aColor)
          Set the default selection color.
 void setRootEngineObject(EngineObject aRootEngineObject)
          Set the root engine object of this view.
 void setSelectionColor(java.awt.Color aColor)
          Set the selection color.
 void setSelectionSet(SelectionSet aSelectionSet)
          Set the current selection set.
 void valueChanged(javax.swing.event.TreeSelectionEvent event)
          Handle tree selection change events
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

changes

protected transient java.beans.PropertyChangeSupport changes
Utility object which manages property change events and listeners. Needed here since we don't inherit from UIView.

selectionColor

protected java.awt.Color selectionColor
Selection color for a particular view
Constructor Detail

TreeView

public TreeView()
Creates a species tree view.
Throws:
java.lang.IllegalArgumentException - - one of input arguments null
Method Detail

getDefaultSelectionColor

public static java.awt.Color getDefaultSelectionColor()
Get the default selection color
Returns:
Color - default selection color, never null

setDefaultSelectionColor

public static void setDefaultSelectionColor(java.awt.Color aColor)
Set the default selection color. This will be used as the default selection color for views created after calling this method.

Parameters:
aColor - Color - a default selection color, may not be null
Throws:
java.lang.IllegalArgumentException - - input argument illegal (null)

getSelectionColor

public java.awt.Color getSelectionColor()
Get the selection color
Returns:
Color - selection color for this

setSelectionColor

public void setSelectionColor(java.awt.Color aColor)
Set the selection color. If null is input, the color reverts back to the default selection color.

Parameters:
aColor - Color - a new selection color, may be null

getRootEngineObject

public EngineObject getRootEngineObject()
Get the root engine object of this view.
Returns:
EngineObject - the root engine object of this view, may be null

setRootEngineObject

public void setRootEngineObject(EngineObject aRootEngineObject)
Set the root engine object of this view.
Parameters:
aRootEngineObject - EngineObject - a new root engine object, may be null

selectionChanged

public void selectionChanged()
Selection changed. This is called by the SelectionSet object when the selection changes due to some event.

Specified by:
selectionChanged in interface SelectionPresenter
Parameters:
anEngineObject - EngineObject - a new engine object to select, may be null

getSelectionSet

public SelectionSet getSelectionSet()
Get the current selection set
Specified by:
getSelectionSet in interface SelectionPresenter
Returns:
SelectionSet - the current selection set

setSelectionSet

public void setSelectionSet(SelectionSet aSelectionSet)
Set the current selection set.
Specified by:
setSelectionSet in interface SelectionPresenter
Parameters:
aSelectionSet - SelectionSet - a new selection set

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Handle property change events
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - PropertyChangeEvent - the property change event

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent event)
Handle tree selection change events
Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener
Parameters:
event - TreeSelectionEvent - tree selection event

nodeSelectedStateChanged

public void nodeSelectedStateChanged(TreeViewNode aTreeViewNode,
                                     boolean oldSelected,
                                     boolean newSelected)
Notification that a node's selected state in this tree changed.
Parameters:
aTreeViewNode - TreeViewNode - the species tree node that changed
oldSelectedState - boolean - old selected state of node
newSelectedState - boolean - new selected state of node

nodeChanged

public void nodeChanged(TreeViewNode aTreeViewNode)
Notification that a node in this tree has changed. This is usually called by the node when something significant occurs to the node (e.g. its lock state changes, its text changes, etc.).

Parameters:
aTreeViewNode - TreeViewNode - the species tree node that changed

nodeObjectDeleted

public void nodeObjectDeleted(TreeViewNode aTreeViewNode)
Notification that the engine object corresponding to a node in this tree has been deleted.

Parameters:
aTreeViewNode - TreeViewNode - the species tree node whose object was deleted

addNode

public void addNode(TreeViewNode parentNode,
                    TreeViewNode newNode,
                    int indexInParentNode)
Add a new node to the tree with the given parent node.
Parameters:
parentNode - TreeViewNode - parent node
newNode - TreeViewNode - new node to add
indexInParentNode - - index in parent node

expandNode

public void expandNode(TreeViewNode node)
Expand the given node
Parameters:
node - TreeViewNode - node to expand

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener aListener)
Add a property change listener for properties.
Overrides:
addPropertyChangeListener in class javax.swing.JComponent
Parameters:
aListener - PropertyChangeListener - a new listener

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener aListener)
Remove a property change listener for properties.
Overrides:
removePropertyChangeListener in class javax.swing.JComponent
Parameters:
aListener - PropertyChangeListener - a listener to remove