org.w3c.jigadmin.editors
Class ResourceTreeBrowser

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 org.w3c.jigadmin.editors.ResourceTreeBrowser
All Implemented Interfaces:
java.awt.dnd.DropTargetListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable, ResourceActionListener
Direct Known Subclasses:
FrameBrowser

public class ResourceTreeBrowser
extends javax.swing.JTree
implements java.awt.dnd.DropTargetListener, ResourceActionListener

A JTree used to manage RemoteResource.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTree
javax.swing.JTree.AccessibleJTree, javax.swing.JTree.DynamicUtilTreeNode, javax.swing.JTree.EmptySelectionModel, javax.swing.JTree.TreeModelHandler, javax.swing.JTree.TreeSelectionRedirector
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String DELETE_RESOURCE_AC
           
protected  javax.swing.JDialog popup
           
protected  java.lang.String resClassname
           
protected  java.lang.String resIdentifier
           
protected  RemoteResourceWrapperNode rootNode
           
 
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.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
protected ResourceTreeBrowser(RemoteResourceWrapperNode root)
          Constructor
 
Method Summary
protected  void addResource(java.lang.String identifier, java.lang.String classname, RemoteResourceWrapper rrwf, javax.swing.tree.TreePath fpath)
          Add a resource to the resource wrapped.
protected  void addResourceToSelectedContainer()
          Add a (new) resource to the container associated to the selected node.
protected  void addResourceToSelectedContainer(java.lang.String classname, java.lang.String identifier)
          Add a resource to the selected container.
protected  void deleteResource(RemoteResourceWrapper rrw)
          Delete the resource wrapped by the given wrapper
protected  void deleteSelectedResources()
          Delete the resources associated to the selected nodes.
protected  void disposeAddResourcePopup()
          Dispose the "add resource" popup
protected  void doubleClick(javax.swing.tree.TreePath path)
          A double click occured on the node with the given path.
 void dragEnter(java.awt.dnd.DropTargetDragEvent dropTargetDragEvent)
          a Drag operation has encountered the DropTarget
 void dragExit(java.awt.dnd.DropTargetEvent dropTargetEvent)
          The Drag operation has departed the DropTarget without dropping.
 void dragOver(java.awt.dnd.DropTargetDragEvent dropTargetDragEvent)
          a Drag operation is ongoing on the DropTarget
 void drop(java.awt.dnd.DropTargetDropEvent dropTargetDropEvent)
          The Drag operation has terminated with a Drop on this DropTarget
 void dropActionChanged(java.awt.dnd.DropTargetDragEvent dropTargetDragEvent)
          The user as modified the current drop gesture
protected  boolean dropResource(ResourceCell cell)
          Drop a resource.
protected  AddResourcePanel getAddResourcePanel(java.lang.String title, RemoteResourceWrapper rrw)
          Get the Panel used to add a new resource
protected  java.lang.String getIdentifier(ResourceCell cell, RemoteResourceWrapper rrw)
          Get (compute) the resource identifier of the dropped resource.
protected  javax.swing.JPopupMenu getPopupMenu(RemoteResourceWrapper rrw)
          Get the popup menu relative to the selected resource.
static ResourceTreeBrowser getResourceTreeBrowser(RemoteResourceWrapper rrw, java.lang.String rootName)
          Get a ResourceTreeBrowser.
protected  RemoteResourceWrapper getSelectedResourceWrapper()
          Get the RemoteResourceWrapper associated to the selected node.
protected  RemoteResourceWrapper getSelectedResourceWrapper(javax.swing.tree.TreePath path)
          Get the RemoteResourceWrapper associated to the selected node.
 boolean isDragging()
          Is the mouse dragging something on the resource tree?
protected  void popupAddResourceDialog(java.lang.String title, RemoteResourceWrapper rrw)
          Popup a "add resource" Dialog
protected  void popupResource(RemoteResourceWrapper rrw)
          Popup a dialog where the user can edit the resource properties.
protected  void reindexResource(RemoteResourceWrapper rrw, boolean rec)
          Reindex the container wrapped by the given wrapper.
protected  void reindexSelectedResources(boolean rec)
          Reindex the containers associated to the selected nodes.
protected  javax.swing.tree.TreePath[] removeDescendants(javax.swing.tree.TreePath[] paths)
          Filter the TreePath array.
 void resourceActionPerformed(ResourceActionEvent e)
          A resource action occured.
protected  void setCursor(int cursor)
          Set the cursor.
protected  void setResourceToAdd(java.lang.String classname, java.lang.String identifier)
          Specify some properties of the resource to add
protected  void showReferenceDocumentation()
          Display (in another frame) the reference documentation relative to the resource associated to the selected node.
protected  void simpleClick(javax.swing.tree.TreePath path)
          A simle click occured on the node with the given path.
 
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, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DELETE_RESOURCE_AC

public static final java.lang.String DELETE_RESOURCE_AC
See Also:
Constant Field Values

rootNode

protected RemoteResourceWrapperNode rootNode

resIdentifier

protected java.lang.String resIdentifier

resClassname

protected java.lang.String resClassname

popup

protected javax.swing.JDialog popup
Constructor Detail

ResourceTreeBrowser

protected ResourceTreeBrowser(RemoteResourceWrapperNode root)
Constructor

Parameters:
root - The root node
Method Detail

isDragging

public boolean isDragging()
Is the mouse dragging something on the resource tree?

Returns:
a boolean

dragEnter

public void dragEnter(java.awt.dnd.DropTargetDragEvent dropTargetDragEvent)
a Drag operation has encountered the DropTarget

Specified by:
dragEnter in interface java.awt.dnd.DropTargetListener

dragExit

public void dragExit(java.awt.dnd.DropTargetEvent dropTargetEvent)
The Drag operation has departed the DropTarget without dropping.

Specified by:
dragExit in interface java.awt.dnd.DropTargetListener

dragOver

public void dragOver(java.awt.dnd.DropTargetDragEvent dropTargetDragEvent)
a Drag operation is ongoing on the DropTarget

Specified by:
dragOver in interface java.awt.dnd.DropTargetListener

dropActionChanged

public void dropActionChanged(java.awt.dnd.DropTargetDragEvent dropTargetDragEvent)
The user as modified the current drop gesture

Specified by:
dropActionChanged in interface java.awt.dnd.DropTargetListener

drop

public void drop(java.awt.dnd.DropTargetDropEvent dropTargetDropEvent)
The Drag operation has terminated with a Drop on this DropTarget

Specified by:
drop in interface java.awt.dnd.DropTargetListener

dropResource

protected boolean dropResource(ResourceCell cell)
Drop a resource.

Parameters:
cell - The resource cell
See Also:
ResourceCell

resourceActionPerformed

public void resourceActionPerformed(ResourceActionEvent e)
A resource action occured.

Specified by:
resourceActionPerformed in interface ResourceActionListener
Parameters:
e - the ResourceActionEvent

addResource

protected void addResource(java.lang.String identifier,
                           java.lang.String classname,
                           RemoteResourceWrapper rrwf,
                           javax.swing.tree.TreePath fpath)
                    throws RemoteAccessException
Add a resource to the resource wrapped.

Parameters:
identifier - The new resource identifier
classname - The new resource class name
rrwf - the Wrapper of the father resource
fpath - The path of the father node
Throws:
RemoteAccessException

addResourceToSelectedContainer

protected void addResourceToSelectedContainer(java.lang.String classname,
                                              java.lang.String identifier)
                                       throws RemoteAccessException
Add a resource to the selected container.

Parameters:
classname - the resource class name
identifier - the resource identifier
Throws:
RemoteAccessException

getIdentifier

protected java.lang.String getIdentifier(ResourceCell cell,
                                         RemoteResourceWrapper rrw)
                                  throws RemoteAccessException
Get (compute) the resource identifier of the dropped resource.

Parameters:
cell - the ResourceCell dropped
rrw - the RemoteResourceWrapper of the father
Returns:
a String instance
Throws:
RemoteAccessException
See Also:
ResourceCell

getSelectedResourceWrapper

protected RemoteResourceWrapper getSelectedResourceWrapper()
Get the RemoteResourceWrapper associated to the selected node.

Returns:
a RemoteResourceWrapper

getSelectedResourceWrapper

protected RemoteResourceWrapper getSelectedResourceWrapper(javax.swing.tree.TreePath path)
Get the RemoteResourceWrapper associated to the selected node.

Parameters:
path - the selected path
Returns:
a RemoteResourceWrapper

getAddResourcePanel

protected AddResourcePanel getAddResourcePanel(java.lang.String title,
                                               RemoteResourceWrapper rrw)
                                        throws RemoteAccessException
Get the Panel used to add a new resource

Parameters:
title - The title
rrw - The wrapper of the father RemoteResource
Returns:
a AddResourcePanel instance
Throws:
RemoteAccessException
See Also:
AddResourcePanel

popupAddResourceDialog

protected void popupAddResourceDialog(java.lang.String title,
                                      RemoteResourceWrapper rrw)
Popup a "add resource" Dialog

Parameters:
title - the popup title
rrw - The wrapper of the father RemoteResource

disposeAddResourcePopup

protected void disposeAddResourcePopup()
Dispose the "add resource" popup


setResourceToAdd

protected void setResourceToAdd(java.lang.String classname,
                                java.lang.String identifier)
Specify some properties of the resource to add

Parameters:
classnema - the new resource class name
identifier - the new resource identifier

addResourceToSelectedContainer

protected void addResourceToSelectedContainer()
Add a (new) resource to the container associated to the selected node.


removeDescendants

protected javax.swing.tree.TreePath[] removeDescendants(javax.swing.tree.TreePath[] paths)
Filter the TreePath array. Remove all nodes that have one of their parent in this array.

Parameters:
paths - the TreePath array
Returns:
the filtered array

reindexSelectedResources

protected void reindexSelectedResources(boolean rec)
Reindex the containers associated to the selected nodes. Display an error message (dialog) if there is no node selected or if one of the selected resource is not a ResourceContainer.

Parameters:
rec - recursivly?

reindexResource

protected void reindexResource(RemoteResourceWrapper rrw,
                               boolean rec)
                        throws RemoteAccessException
Reindex the container wrapped by the given wrapper. Display an error message (dialog) if the resource is not a ResourceContainer.

Parameters:
rrw - the RemoteResourceWrapper
rec - recursivly?
Throws:
RemoteAccessException - if a Remote Error occurs

deleteSelectedResources

protected void deleteSelectedResources()
Delete the resources associated to the selected nodes. Display an error message if there is no node selected or if the resource is not editable.


deleteResource

protected void deleteResource(RemoteResourceWrapper rrw)
                       throws RemoteAccessException
Delete the resource wrapped by the given wrapper

Parameters:
rrw - The RemoteResourceWrapper
Throws:
RemoteAccessException

showReferenceDocumentation

protected void showReferenceDocumentation()
Display (in another frame) the reference documentation relative to the resource associated to the selected node. Display en error message (dialog) if no node is selected.


simpleClick

protected void simpleClick(javax.swing.tree.TreePath path)
A simle click occured on the node with the given path.

Parameters:
path - The path where the click occured.

doubleClick

protected void doubleClick(javax.swing.tree.TreePath path)
A double click occured on the node with the given path.

Parameters:
path - The path where the double click occured.

popupResource

protected void popupResource(RemoteResourceWrapper rrw)
Popup a dialog where the user can edit the resource properties.

Parameters:
rrw - the wrapper if the resource to edit.

setCursor

protected void setCursor(int cursor)
Set the cursor.

Parameters:
a - cursor type

getPopupMenu

protected javax.swing.JPopupMenu getPopupMenu(RemoteResourceWrapper rrw)
Get the popup menu relative to the selected resource.

Parameters:
rrw - the wrapper of the resource
Returns:
a JPopupMenu instance

getResourceTreeBrowser

public static ResourceTreeBrowser getResourceTreeBrowser(RemoteResourceWrapper rrw,
                                                         java.lang.String rootName)
Get a ResourceTreeBrowser.

Parameters:
rrw - The root resource
rootName - The root identifier.
Returns:
a ResourceTreeBrowser instance