JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.gui.swing
Class Tree

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--org.objectweb.jac.aspects.gui.swing.AbstractView
                                |
                                +--org.objectweb.jac.aspects.gui.swing.Tree
All Implemented Interfaces:
Accessible, DragGestureListener, DragSourceListener, DropTargetListener, EventListener, ImageObserver, KeyListener, MenuContainer, MouseListener, Serializable, TreeExpansionListener, TreeListener, TreeSelectionListener, View, ViewIdentity

public class Tree
extends AbstractView
implements View, TreeSelectionListener, MouseListener, TreeExpansionListener, TreeListener, KeyListener, DragGestureListener, DragSourceListener, DropTargetListener

This class defines a Swing component tree view for objects that are related to a root object through relations or collections.

See Also:
GuiAC, Serialized Form

Field Summary
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Tree(ViewFactory factory, DisplayContext context, String pathDef, boolean showRelations)
          Constructs a new tree view.
 
Method Summary
 void close()
          Close this view.
protected  boolean doDelete(boolean softRun)
          Delete selected objects.
 void dragDropEnd(DragSourceDropEvent e)
           
 void dragEnter(DragSourceDragEvent e)
           
 void dragEnter(DropTargetDragEvent e)
           
 void dragExit(DragSourceEvent e)
           
 void dragExit(DropTargetEvent e)
           
 void dragGestureRecognized(DragGestureEvent e)
           
 void dragOver(DragSourceDragEvent e)
           
 void dragOver(DropTargetDragEvent e)
           
 void drop(DropTargetDropEvent e)
           
 void dropActionChanged(DragSourceDragEvent e)
           
 void dropActionChanged(DropTargetDragEvent e)
           
 void expandRoot()
          Expands nodes linked to the tree root.
 void keyPressed(KeyEvent event)
           
 void keyReleased(KeyEvent event)
           
 void keyTyped(KeyEvent event)
           
 void mouseClicked(MouseEvent me)
          Do nothing.
 void mouseEntered(MouseEvent me)
          Do nothing.
 void mouseExited(MouseEvent me)
          Do nothing.
 void mousePressed(MouseEvent e)
          Shows a popup if needed.
 void mouseReleased(MouseEvent e)
          Closes a popup if needed.
 void setSelection(TreePath selection)
           
 void treeCollapsed(TreeExpansionEvent event)
           
 void treeExpanded(TreeExpansionEvent event)
           
 void valueChanged(TreeSelectionEvent event)
          Handles the tree view selection changes.
 
Methods inherited from class org.objectweb.jac.aspects.gui.swing.AbstractView
getContext, getDescription, getFactory, getLabel, getMessage, getParameters, getParentView, getRootView, getStyle, getType, getViewBorder, isClosed, isDescendantOf, setContext, setDescription, setFactory, setFocus, setHeight, setLabel, setMessage, setParameters, setParentView, setStyle, setType, setViewBorder, setWidth, toString
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.objectweb.jac.aspects.gui.View
getContext, getDescription, getFactory, getLabel, getMessage, getParentView, getRootView, getStyle, getViewBorder, isClosed, isDescendantOf, setContext, setDescription, setFactory, setFocus, setHeight, setLabel, setMessage, setParentView, setStyle, setViewBorder, setWidth, validate
 
Methods inherited from interface org.objectweb.jac.aspects.gui.ViewIdentity
getParameters, getType, setParameters, setType
 

Constructor Detail

Tree

public Tree(ViewFactory factory,
            DisplayContext context,
            String pathDef,
            boolean showRelations)
Constructs a new tree view.

Parameters:
showRelations - if false, the relations are not showed as tree elements
Method Detail

dragGestureRecognized

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

dragDropEnd

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

dragEnter

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

dragExit

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

dragOver

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

dropActionChanged

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

drop

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

dragEnter

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

dragExit

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

dragOver

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

dropActionChanged

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

expandRoot

public void expandRoot()
Expands nodes linked to the tree root. Useful because it is not automatically done and nodes or expand buttons are not displayed at the beginning (you can't open children).


close

public void close()
Description copied from interface: View
Close this view. This should be upcalled when the view is closed in order to free resources or close other dependant views.

Specified by:
close in interface View
Overrides:
close in class AbstractView

treeCollapsed

public void treeCollapsed(TreeExpansionEvent event)
Specified by:
treeCollapsed in interface TreeExpansionListener

treeExpanded

public void treeExpanded(TreeExpansionEvent event)
Specified by:
treeExpanded in interface TreeExpansionListener

valueChanged

public void valueChanged(TreeSelectionEvent event)
Handles the tree view selection changes.

Specified by:
valueChanged in interface TreeSelectionListener

mouseClicked

public void mouseClicked(MouseEvent me)
Do nothing.

Specified by:
mouseClicked in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Shows a popup if needed.

Specified by:
mousePressed in interface MouseListener
Parameters:
e - mouse event descriptor

mouseReleased

public void mouseReleased(MouseEvent e)
Closes a popup if needed.

Specified by:
mouseReleased in interface MouseListener
Parameters:
e - mouse event descriptor

mouseExited

public void mouseExited(MouseEvent me)
Do nothing.

Specified by:
mouseExited in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent me)
Do nothing.

Specified by:
mouseEntered in interface MouseListener

keyTyped

public void keyTyped(KeyEvent event)
Specified by:
keyTyped in interface KeyListener

keyPressed

public void keyPressed(KeyEvent event)
Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent event)
Specified by:
keyReleased in interface KeyListener

setSelection

public void setSelection(TreePath selection)
Specified by:
setSelection in interface TreeListener

doDelete

protected boolean doDelete(boolean softRun)
Delete selected objects.

Parameters:
softRun - if true, will not actually call delete, but just return if the user is allowed to see a delete button.
Returns:
true if the user is allowed to see a delete button for all of the selected objects.

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli