net.sourceforge.nite.gui.util
Class OntologyTreeView

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTree
                  extended by net.sourceforge.nite.gui.util.OntologyTreeView
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable

public class OntologyTreeView
extends javax.swing.JTree

CLASS UNDER DEVELOPMENT. DON'T DEPEND ON THIS CLASS! CLASS UNDER DEVELOPMENT. DON'T DEPEND ON THIS CLASS! CLASS UNDER DEVELOPMENT. DON'T DEPEND ON THIS CLASS! CLASS UNDER DEVELOPMENT. DON'T DEPEND ON THIS CLASS! how to make a general view of ontology, so we can conveniently switch tree or popup without changing behaviour... misschien omdraaien dan: een popupmenu is iets wat je uit een ontologyTreeModel haalt... en de ontologytreemodel is de brug van nxt naar swing... A tree view with contents filled from an ontology in a NXT corpus.

main features:

Author:
Dennis Reidsma, UTwente
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTree
javax.swing.JTree.DynamicUtilTreeNode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static int SHOWKEYS_LABEL
           
static int SHOWKEYS_OFF
           
static int SHOWKEYS_TOOLTIP
           
 
Fields inherited from class javax.swing.JTree
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, LARGE_MODEL_PROPERTY, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, ROW_HEIGHT_PROPERTY, SCROLLS_ON_EXPAND_PROPERTY, SELECTION_MODEL_PROPERTY, SHOWS_ROOT_HANDLES_PROPERTY, TOGGLE_CLICK_COUNT_PROPERTY, TREE_MODEL_PROPERTY, VISIBLE_ROW_COUNT_PROPERTY
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 java.lang.String convertValueToText(java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
           
static OntologyTreeView getOntologyTreeView(NOMCorpus nom, java.lang.String displayAttribute, java.lang.String rootID)
          the object is stored in defaultmutabletreenode.getobject ofzo...
static OntologyTreeView getOntologyTreeView(NOMCorpus nom, java.lang.String displayAttribute, java.lang.String rootID, java.util.HashMap keyMap, int showKeys)
          Creates a new ontology tree view.
 void setColourMap(ValueColourMap map)
          Sets the colour map that will be used to colour the leaf labels.
 
Methods inherited from class javax.swing.JTree
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, collapsePath, collapseRow, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDragEnabled, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getNextMatch, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getSelectionPaths, getSelectionRows, getShowsRootHandles, getToggleClickCount, getToolTipText, getTreeExpansionListeners, getTreeSelectionListeners, getTreeWillExpandListeners, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isRowSelected, isSelectionEmpty, isVisible, makeVisible, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setCellRenderer, setDragEnabled, setEditable, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setModel, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, startEditingAtPath, stopEditing, treeDidChange, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SHOWKEYS_OFF

public static final int SHOWKEYS_OFF
See Also:
Constant Field Values

SHOWKEYS_LABEL

public static final int SHOWKEYS_LABEL
See Also:
Constant Field Values

SHOWKEYS_TOOLTIP

public static final int SHOWKEYS_TOOLTIP
See Also:
Constant Field Values
Method Detail

setColourMap

public void setColourMap(ValueColourMap map)

Sets the colour map that will be used to colour the leaf labels. The colour map should map the ontology elements (instances of NOMElement) to colours. If map is null, the tree view will use the global value colour map (default).

Parameters:
map - a colour map or null

convertValueToText

public java.lang.String convertValueToText(java.lang.Object value,
                                           boolean selected,
                                           boolean expanded,
                                           boolean leaf,
                                           int row,
                                           boolean hasFocus)
Overrides:
convertValueToText in class javax.swing.JTree

getOntologyTreeView

public static OntologyTreeView getOntologyTreeView(NOMCorpus nom,
                                                   java.lang.String displayAttribute,
                                                   java.lang.String rootID)
the object is stored in defaultmutabletreenode.getobject ofzo...

Parameters:
nom - the corpus in which the ontology resides
displayAttribute - the name of an attribute of the elements in the ontology which is used for the display text of corresponding elements in the popup menu
actionCallback - the ActionListener that is called when an item in the popupmenu is clicked.
rootID - the element ID of the top-node in the menu, of which all descendants should be added (it's a NOM ID, so it's prefixed with the colour, e.g. "daa#mrda_11a")
addLeavesForNodes - if true, the popup menu will contain leaf-elements for each non-leaf-node. This makes it possible to select intermediate nodes from the ontology hierarchy instead of only leaves.
includeRoot - if true, the popupmenu will have the rootElement as its first-level menu item

getOntologyTreeView

public static OntologyTreeView getOntologyTreeView(NOMCorpus nom,
                                                   java.lang.String displayAttribute,
                                                   java.lang.String rootID,
                                                   java.util.HashMap keyMap,
                                                   int showKeys)

Creates a new ontology tree view. Keystrokes will be shown depending on the showKeys parameter, which can be one of the following constants:

The keystrokes must be defined in the keyMap parameter, which should map ontology elements (instances of NOMElement) to the key strokes as they should be displayed (instances of String).