org.skunk.dav.client.gui
Class Explorer

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--org.skunk.dav.client.gui.Explorer
All Implemented Interfaces:
javax.accessibility.Accessible, Buffer, EditListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Explorer
extends javax.swing.JPanel
implements Buffer, EditListener

An embeddable widget that presents conjoined tree and table views of a DAV file hierarchy.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
static java.lang.String TABLE_HEADERS_PROPERTY
           
 
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
Explorer()
           
 
Method Summary
 void addConnectionNode(ServerData sd, java.lang.Runnable postRunner)
          tries to connect to the server sd and displays a corresponding tree node in the explorer.
 void addTableModelListener(javax.swing.event.TableModelListener tml)
           
 void addTreeModelListener(javax.swing.event.TreeModelListener tml)
           
 DAVFileChooser.ChoiceStruct chooseFile(DAVTreeNode node, java.lang.String title, boolean editable, java.lang.String initialFileName)
          utility method for showing a DAVFileChooser
 void copy(DAVTreeNode parentNode, DAVFile file, java.lang.String destinationURL)
           
 void createCollection(DAVTreeNode parentNode, java.lang.String collectionName)
           
 void createFile(DAVTreeNode parentNode, java.lang.String fileName)
           
 void createFile(DAVTreeNode parentNode, java.lang.String fileName, byte[] bodyBytes)
           
 void createFile(DAVTreeNode parentNode, java.lang.String fileName, byte[] bodyBytes, java.lang.Runnable successRunner)
           
 void createFile(DAVTreeNode parentNode, java.lang.String fileName, java.lang.Runnable successRunner)
           
 void createFile(java.lang.String fullPath, byte[] bodyBytes)
           
 void createFile(java.lang.String fullPath, byte[] bodyBytes, java.lang.Runnable successRunner)
           
 void delete(DAVTreeNode parentNode, java.lang.String fileName)
           
 void displayCollection(DAVTreeNode parentNode, java.lang.String filename)
          displays a given collection in the explorer.
 void displayCollection(java.lang.String filename)
           
 void docking()
          hook method, called when component is docked
 void editPerformed(EditEvent event)
           
static java.util.Iterator explorers()
           
protected  void finalize()
           
 byte[] get(DAVFile file)
           
protected  DAVTreeNode getChildNode(DAVTreeNode parentNode, java.lang.String filename)
           
 javax.swing.JComponent getComponent()
           
 int getConnectedServerCount()
           
 ServerData[] getConnectedServers()
           
 ServerData getConnection(DAVTreeNode node)
           
 DAVFile getCurrentFile()
           
 DAVFileChooser getDAVFileChooser()
           
 DAVFileChooser getDAVFileChooser(DAVTreeNode node)
           
 DAVFileChooser getDAVFileChooser(ServerData[] serversToConnect)
           
static int getExplorerCount()
           
 DAVFile getFile(DAVTreeNode parentNode, java.lang.String filename)
           
 java.lang.String getName()
           
 DAVTreeNode getNodeForFile(DAVFile file)
           
 ServerData getSelectedConnection()
           
 DAVTreeNode getSelectedNode()
           
 DAVFile getSelectedTableFile()
           
 boolean getShowHorizontalLines()
           
 boolean getShowVerticalLines()
           
 DAVTableHeader[] getTableHeaders()
           
static Explorer guessActiveExplorer()
           
 boolean isConnected(ServerData sd)
           
 void lock(DAVTreeNode parentNode, DAVFile file)
           
 void lock(DAVTreeNode parentNode, DAVFile file, java.lang.Runnable runnable)
           
 void move(DAVTreeNode parentNode, DAVFile file, java.lang.String destinationURL)
           
 void proppatch(DAVTreeNode parentNode, DAVFile file, java.util.Map propertyValueMap)
           
 void refreshNode(DAVTreeNode node)
           
 void removeConnectionNode(ServerData sd)
           
 void removeConnectionNode(java.lang.String host, int port, java.lang.String initialPath)
           
 void removeTableModelListener(javax.swing.event.TableModelListener tml)
           
 void removeTreeModelListener(javax.swing.event.TreeModelListener tml)
           
 void selectLastNode()
           
 void selectNode(DAVTreeNode node)
           
 void setShowHorizontalLines(boolean showHorizontalLines)
           
 void setShowVerticalLines(boolean showVerticalLines)
           
protected  void setTableFile(DAVFile file)
           
 void setTableHeaders(DAVTableHeader[] tableHeaders)
           
 void stealLock(DAVTreeNode parentNode, DAVFile file)
           
 void undocking()
          hook method, called when component is undocked
 void unlock(DAVTreeNode parentNode, DAVFile file)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, 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, 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, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, 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, setLayout, 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, 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, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.skunk.dav.client.gui.Buffer
setName
 

Field Detail

TABLE_HEADERS_PROPERTY

public static final java.lang.String TABLE_HEADERS_PROPERTY
Constructor Detail

Explorer

public Explorer()
Method Detail

explorers

public static java.util.Iterator explorers()

getExplorerCount

public static int getExplorerCount()

guessActiveExplorer

public static Explorer guessActiveExplorer()

getName

public java.lang.String getName()
Specified by:
getName in interface Buffer
Overrides:
getName in class java.awt.Component
Following copied from interface: org.skunk.dav.client.gui.Buffer
Returns:
the buffer's name

getComponent

public javax.swing.JComponent getComponent()
Specified by:
getComponent in interface Buffer
Following copied from interface: org.skunk.dav.client.gui.Buffer
Returns:
the buffer's visual component

docking

public void docking()
Description copied from interface: Buffer
hook method, called when component is docked
Specified by:
docking in interface Buffer

undocking

public void undocking()
Description copied from interface: Buffer
hook method, called when component is undocked
Specified by:
undocking in interface Buffer

editPerformed

public void editPerformed(EditEvent event)
Specified by:
editPerformed in interface EditListener

getTableHeaders

public DAVTableHeader[] getTableHeaders()
Returns:
array of table headers

setTableHeaders

public void setTableHeaders(DAVTableHeader[] tableHeaders)

getShowVerticalLines

public boolean getShowVerticalLines()

setShowVerticalLines

public void setShowVerticalLines(boolean showVerticalLines)

getShowHorizontalLines

public boolean getShowHorizontalLines()

setShowHorizontalLines

public void setShowHorizontalLines(boolean showHorizontalLines)

addConnectionNode

public void addConnectionNode(ServerData sd,
                              java.lang.Runnable postRunner)
tries to connect to the server sd and displays a corresponding tree node in the explorer. If the attempt succeeded, the Runnable postRunner will then be executed.
Parameters:
sd - the ServerData representing the target server
postRunner - the Runnable to be executed upon success

removeConnectionNode

public void removeConnectionNode(java.lang.String host,
                                 int port,
                                 java.lang.String initialPath)

removeConnectionNode

public void removeConnectionNode(ServerData sd)

getConnectedServerCount

public int getConnectedServerCount()

getConnectedServers

public ServerData[] getConnectedServers()

isConnected

public boolean isConnected(ServerData sd)

get

public byte[] get(DAVFile file)

delete

public void delete(DAVTreeNode parentNode,
                   java.lang.String fileName)

lock

public void lock(DAVTreeNode parentNode,
                 DAVFile file)

lock

public void lock(DAVTreeNode parentNode,
                 DAVFile file,
                 java.lang.Runnable runnable)

unlock

public void unlock(DAVTreeNode parentNode,
                   DAVFile file)

stealLock

public void stealLock(DAVTreeNode parentNode,
                      DAVFile file)

proppatch

public void proppatch(DAVTreeNode parentNode,
                      DAVFile file,
                      java.util.Map propertyValueMap)

copy

public void copy(DAVTreeNode parentNode,
                 DAVFile file,
                 java.lang.String destinationURL)

move

public void move(DAVTreeNode parentNode,
                 DAVFile file,
                 java.lang.String destinationURL)

getConnection

public ServerData getConnection(DAVTreeNode node)

getSelectedConnection

public ServerData getSelectedConnection()

selectLastNode

public void selectLastNode()

selectNode

public void selectNode(DAVTreeNode node)

displayCollection

public void displayCollection(java.lang.String filename)

displayCollection

public void displayCollection(DAVTreeNode parentNode,
                              java.lang.String filename)
displays a given collection in the explorer.
Parameters:
parentNode - the node of the containing collection
filename - the name of the collection resource to display

getChildNode

protected DAVTreeNode getChildNode(DAVTreeNode parentNode,
                                   java.lang.String filename)

getNodeForFile

public DAVTreeNode getNodeForFile(DAVFile file)

createCollection

public void createCollection(DAVTreeNode parentNode,
                             java.lang.String collectionName)

createFile

public void createFile(java.lang.String fullPath,
                       byte[] bodyBytes)

createFile

public void createFile(java.lang.String fullPath,
                       byte[] bodyBytes,
                       java.lang.Runnable successRunner)

createFile

public void createFile(DAVTreeNode parentNode,
                       java.lang.String fileName)

createFile

public void createFile(DAVTreeNode parentNode,
                       java.lang.String fileName,
                       java.lang.Runnable successRunner)

createFile

public void createFile(DAVTreeNode parentNode,
                       java.lang.String fileName,
                       byte[] bodyBytes)

createFile

public void createFile(DAVTreeNode parentNode,
                       java.lang.String fileName,
                       byte[] bodyBytes,
                       java.lang.Runnable successRunner)

setTableFile

protected void setTableFile(DAVFile file)

getCurrentFile

public DAVFile getCurrentFile()

getSelectedTableFile

public DAVFile getSelectedTableFile()

getFile

public DAVFile getFile(DAVTreeNode parentNode,
                       java.lang.String filename)

getSelectedNode

public DAVTreeNode getSelectedNode()

refreshNode

public void refreshNode(DAVTreeNode node)

chooseFile

public DAVFileChooser.ChoiceStruct chooseFile(DAVTreeNode node,
                                              java.lang.String title,
                                              boolean editable,
                                              java.lang.String initialFileName)
utility method for showing a DAVFileChooser
Parameters:
node - a node on the DAVServer where the user may choose a file
title - the title of the choice dialog
editable - whether the user may freely enter a new filename
initialFileName - the initial contents of the filename entry field
Returns:
a struct of information about the chosen file, or null

getDAVFileChooser

public DAVFileChooser getDAVFileChooser(ServerData[] serversToConnect)

getDAVFileChooser

public DAVFileChooser getDAVFileChooser()

getDAVFileChooser

public DAVFileChooser getDAVFileChooser(DAVTreeNode node)

addTableModelListener

public void addTableModelListener(javax.swing.event.TableModelListener tml)

removeTableModelListener

public void removeTableModelListener(javax.swing.event.TableModelListener tml)

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener tml)

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener tml)

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object