com.ontotext.gate.vr
Class EditableTreeView

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JTree
                  extended bycom.ontotext.gate.vr.EditableTreeView
All Implemented Interfaces:
Accessible, DragGestureListener, DragSourceListener, DropTargetListener, EventListener, ImageObserver, MenuContainer, Scrollable, Serializable, TreeSelectionListener

public class EditableTreeView
extends JTree
implements TreeSelectionListener, DragGestureListener, DropTargetListener, DragSourceListener

Extends JTree in order to provide means for editing the hierarchy of an ontology borislav popov

See Also:
Serialized Form

Nested Class Summary
(package private)  class EditableTreeView.AddSubActListener
           
(package private)  class EditableTreeView.EditURIListener
           
(package private)  class EditableTreeView.MyMouseAdapter
           
(package private)  class EditableTreeView.RemoveActListener
           
(package private)  class EditableTreeView.RenameListener
           
private  class EditableTreeView.ViewPropertiesListener
          Listener for choosing [view Properties] from the popup menu
 
Nested classes inherited from class javax.swing.JTree
JTree.AccessibleJTree, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, JTree.TreeModelHandler, JTree.TreeSelectionRedirector
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  JMenuItem add_item
           
private  DragSource dragSource
          dragSource needed for Drag'n'Drop
private  DragSourceContext dragSourceContext
          dragSourceContext needed for Drag'n'Drop
private  JMenuItem editURI_item
           
private  JPopupMenu m_popUpMenu
           
private  OEMainPanel mainPanel
           
private  JMenuItem remove_item
           
private  JMenuItem rename_item
           
protected  ClassNode selectedNode
          The currently selected node
protected  TreePath selectedTreePath
          Stores the selected node info
private  Transferable transferable
          transferable obejct needed for Drag'n'Drop
private  JMenuItem view_properties_item
           
 
Fields inherited from class javax.swing.JTree
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, editable, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, invokesStopCellEditing, LARGE_MODEL_PROPERTY, largeModel, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, rootVisible, ROW_HEIGHT_PROPERTY, rowHeight, SCROLLS_ON_EXPAND_PROPERTY, scrollsOnExpand, SELECTION_MODEL_PROPERTY, selectionModel, selectionRedirector, SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles, TOGGLE_CLICK_COUNT_PROPERTY, toggleClickCount, TREE_MODEL_PROPERTY, treeModel, treeModelListener, VISIBLE_ROW_COUNT_PROPERTY, visibleRowCount
 
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.Container
 
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
 
Constructor Summary
EditableTreeView(OntoTreeModel model)
           
 
Method Summary
 void dragDropEnd(DragSourceDropEvent e)
           
 void dragEnter(DragSourceDragEvent dsde)
           
 void dragEnter(DropTargetDragEvent e)
           
 void dragExit(DragSourceEvent dsde)
           
 void dragExit(DropTargetEvent e)
           
 void dragGestureRecognized(DragGestureEvent event)
           
 void dragOver(DragSourceDragEvent e)
           
 void dragOver(DropTargetDragEvent e)
           
 void drop(DropTargetDropEvent e)
           
 void dropActionChanged(DragSourceDragEvent e)
           
 void dropActionChanged(DropTargetDragEvent e)
           
 OEMainPanel getmainPanel()
          Gets the main panel of this tree view
 ClassNode getSelectedNode()
          Returns the selected node
private  void init()
          Initializes the tree view.
 void setMainPanel(OEMainPanel panel)
          Sets the main panel of this tree view.
 void setModel(OntoTreeModel model)
           
static void synchronizeTreeExpansion(JTree orig, JTree mirror)
          Synchronizes the expansion of the given trees.
private  String testDropTarget(TreePath destination, TreePath dropper)
          Convenience method to test whether drop location is valid
 void valueChanged(TreeSelectionEvent evt)
          sets selected node
 
Methods inherited from class javax.swing.JTree
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModel, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDefaultTreeModel, getDescendantToggledPaths, getDragEnabled, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getNextMatch, getPathBetweenRows, 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, paramString, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setCellRenderer, setDragEnabled, setEditable, setExpandedState, 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, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

selectedTreePath

protected TreePath selectedTreePath
Stores the selected node info


selectedNode

protected ClassNode selectedNode
The currently selected node


m_popUpMenu

private JPopupMenu m_popUpMenu

add_item

private JMenuItem add_item

rename_item

private JMenuItem rename_item

editURI_item

private JMenuItem editURI_item

remove_item

private JMenuItem remove_item

view_properties_item

private JMenuItem view_properties_item

mainPanel

private OEMainPanel mainPanel

dragSource

private DragSource dragSource
dragSource needed for Drag'n'Drop


dragSourceContext

private DragSourceContext dragSourceContext
dragSourceContext needed for Drag'n'Drop


transferable

private Transferable transferable
transferable obejct needed for Drag'n'Drop

Constructor Detail

EditableTreeView

public EditableTreeView(OntoTreeModel model)
Method Detail

synchronizeTreeExpansion

public static void synchronizeTreeExpansion(JTree orig,
                                            JTree mirror)
Synchronizes the expansion of the given trees.

Parameters:
orig - the original tree
mirror - the tree to mimic the expansion of the original

setMainPanel

public void setMainPanel(OEMainPanel panel)
Sets the main panel of this tree view. should be called anytime a tree is created.

Parameters:
panel - the main panel

getmainPanel

public OEMainPanel getmainPanel()
Gets the main panel of this tree view

Returns:
the main panel

setModel

public void setModel(OntoTreeModel model)

init

private void init()
Initializes the tree view.


dragGestureRecognized

public void dragGestureRecognized(DragGestureEvent event)
Specified by:
dragGestureRecognized in interface DragGestureListener

drop

public void drop(DropTargetDropEvent e)
Specified by:
drop in interface DropTargetListener

dragExit

public void dragExit(DragSourceEvent dsde)
Specified by:
dragExit in interface DragSourceListener

dragExit

public void dragExit(DropTargetEvent e)
Specified by:
dragExit in interface DropTargetListener

dragEnter

public void dragEnter(DragSourceDragEvent dsde)
Specified by:
dragEnter in interface DragSourceListener

dragEnter

public void dragEnter(DropTargetDragEvent e)
Specified by:
dragEnter in interface DropTargetListener

dropActionChanged

public void dropActionChanged(DragSourceDragEvent e)
Specified by:
dropActionChanged in interface DragSourceListener

dropActionChanged

public void dropActionChanged(DropTargetDragEvent e)
Specified by:
dropActionChanged in interface DropTargetListener

dragOver

public void dragOver(DragSourceDragEvent e)
Specified by:
dragOver in interface DragSourceListener

dragOver

public void dragOver(DropTargetDragEvent e)
Specified by:
dragOver in interface DropTargetListener

dragDropEnd

public void dragDropEnd(DragSourceDropEvent e)
Specified by:
dragDropEnd in interface DragSourceListener

testDropTarget

private String testDropTarget(TreePath destination,
                              TreePath dropper)
Convenience method to test whether drop location is valid

Parameters:
destination - The destination path
dropper - The path for the node to be dropped
Returns:
null if no problems, otherwise an explanation

valueChanged

public void valueChanged(TreeSelectionEvent evt)
sets selected node

Specified by:
valueChanged in interface TreeSelectionListener

getSelectedNode

public ClassNode getSelectedNode()
Returns the selected node