com.alee.extended.tree
Class WebFileTree

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 com.alee.laf.tree.WebTree<E>
                      extended by com.alee.extended.tree.WebAsyncTree<FileTreeNode>
                          extended by com.alee.extended.tree.WebFileTree
All Implemented Interfaces:
AsyncTreeModelListener<FileTreeNode>, FontMethods<WebTree<FileTreeNode>>, SwingMethods, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable

public class WebFileTree
extends WebAsyncTree<FileTreeNode>

This component is a file tree with asynchronous childs loading. It also contains a few additional methods to find, select and edit visible in tree files.

Author:
Mikle Garin
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTree
javax.swing.JTree.AccessibleJTree, javax.swing.JTree.DropLocation, 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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int delayedSelectionId
          Delayed selection ID to determine wether it is the last one requested or not.
protected  java.lang.Object delayedSelectionLock
          Delayed selection ID operations lock.
protected  FileDragAndDropHandler fileLookupDropHandler
          File lookup drop handler.
protected  boolean filesDropSearchEnabled
          Whether allow files location search by dropping a file onto the tree or not.
 
Fields inherited from class com.alee.extended.tree.WebAsyncTree
asyncLoading, asyncTreeListeners, cellEditorAdapter, comparator, filter, listenersLock, lock, syncLoadingLock
 
Fields inherited from class com.alee.laf.tree.WebTree
cellEditorListeners, CONTIGUOUS_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION, scrollToSelectionListener, SINGLE_TREE_SELECTION
 
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
WebFileTree()
          Costructs file tree with system hard drives as root.
WebFileTree(java.io.File... rootFiles)
          Constructs file tree with specified files as root.
WebFileTree(FileTreeRootType rootType)
          Constructs file tree with the specified root type.
WebFileTree(java.util.List<java.io.File> rootFiles)
          Constructs file tree with specified files as root.
WebFileTree(java.lang.String rootPath)
          Constructs file tree with file under specified path as root.
 
Method Summary
 boolean addFile(java.io.File parent, java.io.File file)
          Adds new file into tree structure.
 boolean addFile(FileTreeNode parentNode, java.io.File file)
          Adds new file into tree structure.
 boolean addFiles(java.io.File parent, java.io.File... files)
          Adds new files into tree structure.
 boolean addFiles(java.io.File parent, java.util.List<java.io.File> files)
          Adds new files into tree structure.
 boolean addFiles(FileTreeNode parentNode, java.io.File... files)
          Adds new files into tree structure.
 boolean addFiles(FileTreeNode parentNode, java.util.List<java.io.File> files)
          Adds new files into tree structure.
 void expandFile(java.io.File file)
          Expands tree structure to the specified file and expands that file node.
 void expandToFile(java.io.File file)
          Expands tree structure to the specified file.
 void expandToFile(java.io.File file, boolean select)
          Expands tree structure to the specified file.
 void expandToFile(java.io.File file, boolean select, boolean expand)
          Expands tree structure to the specified file.
 void expandToFile(java.io.File file, boolean select, boolean expand, java.lang.Runnable finalAction)
          Expands tree structure to the specified file.
 FileTreeNode getClosestNode(java.io.File file)
          Returns loaded and closest to file node.
protected  FileTreeNode getClosestNode(FileTreeNode node, java.util.List<java.io.File> path)
          Returns loaded and closest to file node.
 FileTreeDataProvider getDataProvider()
          Returns asynchronous tree data provider.
protected  FileTreeNode getDeepestPathNode(FileTreeNode pathNode, java.util.List<java.io.File> path)
          Returns deepest path node available.
 java.util.List<java.io.File> getFileChilds(FileTreeNode node)
          Returns files collected from loaded node childs.
 Filter<java.io.File> getFileFilter()
          Returns tree files filter.
protected  FileDragAndDropHandler getFileLookupDropHandler()
          Returns file drop handler that locates file in the tree when dropped.
 FileTreeNode getNode(java.io.File file)
          Returns node for the specified file if it is already loaded.
 java.io.File getSelectedFile()
          Returns selected file.
 java.util.List<java.io.File> getSelectedFiles()
          Returns selected files.
 java.util.List<FileTreeNode> getSelectedNodes()
          Returns selected nodes.
 boolean isFilesDropSearchEnabled()
          Returns whether files search by dropping system files on the tree enabled or not.
protected  void performFileSelection(FileTreeNode node, boolean expand)
          Performs the actual file selection.
 void reloadChilds(java.io.File folder)
          Reloads child files for the specified folder.
 void reloadChilds(java.io.File folder, boolean select)
          Reloads child files for the specified folder and selects folder node if requested.
 void reloadChildsSync(java.io.File folder)
          Reloads child files for the specified folder.
 void reloadChildsSync(java.io.File folder, boolean select)
          Reloads child files for the specified folder and selects folder node if requested.
 boolean removeFile(java.io.File file)
          Removes file from tree structure.
 boolean removeFiles(java.io.File... files)
          Removes files from tree structure.
 boolean removeFiles(java.util.List<java.io.File> files)
          Removes files from tree structure.
 void setFileFilter(Filter<java.io.File> filter)
          Sets tree files filter.
 void setFilesDropSearchEnabled(boolean filesDropSearchEnabled)
          Sets whether files search by dropping system files on the tree enabled or not
 void setModel(javax.swing.tree.TreeModel newModel)
          Sets the TreeModel that will provide the data.
 void setRootName(java.lang.String rootName)
          Changes displayed tree root name.
 void setSelectedFile(java.io.File file)
          Finds and selects specified file in tree.
 void setSelectedFile(java.io.File file, boolean expand)
          Finds and selects specified file in tree.
 void startEditingFile(java.io.File file)
          Starts editing cell with the specified file.
 
Methods inherited from class com.alee.extended.tree.WebAsyncTree
addAsyncTreeListener, addChildNode, addChildNodes, areChildsLoaded, childsLoadCompleted, childsLoadFailed, childsLoadStarted, clearComparator, clearFilter, expandAll, expandNode, expandPath, expandPath, expandPath, expandPath, expandPath, expandPath, expandPathEndImpl, expandPathImpl, findNode, fireChildsLoadCompleted, fireChildsLoadFailed, fireChildsLoadStarted, getAsyncModel, getAsyncTreeListeners, getComparator, getFilter, insertChildNodes, insertChildNodes, isAsyncLoading, isAsyncModel, performFullAsyncPathExpand, performFullPathExpand, performFullSyncPathExpand, performReload, reloadNode, reloadNode, reloadNode, reloadNodeSync, reloadNodeSync, reloadNodeSync, reloadNodeUnderPoint, reloadNodeUnderPoint, reloadPath, reloadPath, reloadPathSync, reloadPathSync, reloadRootNode, reloadSelectedNodes, reloadSelectedNodesSync, removeAsyncTreeListener, removeNode, removeNode, removeNodes, removeNodes, setAsyncLoading, setCellEditor, setChildNodes, setComparator, setDataProvider, setFilter, setMaximumThreadsAmount, updateNode, updateNode, updateNodeStructure, updateNodeStructure, updateSortingAndFiltering, updateSortingAndFiltering
 
Methods inherited from class com.alee.laf.tree.WebTree
addCellEditorListener, changeFontSize, createTreeModel, expandNode, expandRoot, getAllNodes, getClosestNodeForLocation, getClosestNodeForLocation, getClosestPathForLocation, getDefaultTreeModel, getDropCellShadeWidth, getFirstVisibleLeafNode, getFontName, getFontSize, getLinesColor, getNodeBounds, getNodeBounds, getNodeForLocation, getNodeForLocation, getNodeForPath, getNodeForRow, getPathForLocation, getPathForNode, getRootNode, getSelectedNode, getSelectionRound, getSelectionShadeWidth, getSelectionStyle, getSelectorBorderColor, getSelectorColor, getSelectorRound, getSelectorStroke, getTreeState, getTreeState, getWebUI, init, isAutoExpandSelectedNode, isBoldFont, isExpanded, isHighlightRolloverNode, isItalicFont, isPaintLines, isPlainFont, isRolloverSelectionEnabled, isScrollToSelection, isSelected, isSelectorEnabled, removeCellEditorListener, repaint, repaint, repaint, repaint, scrollToNode, scrollToSelection, scrollToStart, selectFirstVisibleLeafNode, selectNextRow, selectNextRow, selectNodeUnderPoint, selectNodeUnderPoint, selectPreviousRow, selectPreviousRow, setAutoExpandSelectedNode, setBoldFont, setBoldFont, setDropCellShadeWidth, setFontName, setFontSize, setFontSizeAndStyle, setFontSizeAndStyle, setFontStyle, setFontStyle, setHighlightRolloverNode, setItalicFont, setItalicFont, setLinesColor, setMultiplySelectionAllowed, setPaintLines, setPlainFont, setPlainFont, setRolloverSelectionEnabled, setScrollToSelection, setSelectedNode, setSelectedNodes, setSelectedNodes, setSelectionMode, setSelectionRound, setSelectionShadeWidth, setSelectionStyle, setSelectorBorderColor, setSelectorColor, setSelectorEnabled, setSelectorRound, setSelectorStroke, setTreeState, setTreeState, startEditingNode, startEditingSelectedNode, updateAllVisibleNodes, updateUI
 
Methods inherited from class javax.swing.JTree
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDescendantToggledPaths, getDragEnabled, getDropLocation, getDropMode, 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, setCellRenderer, setDragEnabled, setDropMode, setEditable, setExpandedState, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, startEditingAtPath, stopEditing, treeDidChange
 
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, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, 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

filesDropSearchEnabled

protected boolean filesDropSearchEnabled
Whether allow files location search by dropping a file onto the tree or not.


fileLookupDropHandler

protected FileDragAndDropHandler fileLookupDropHandler
File lookup drop handler.


delayedSelectionLock

protected final java.lang.Object delayedSelectionLock
Delayed selection ID operations lock.


delayedSelectionId

protected int delayedSelectionId
Delayed selection ID to determine wether it is the last one requested or not.

Constructor Detail

WebFileTree

public WebFileTree()
Costructs file tree with system hard drives as root.


WebFileTree

public WebFileTree(FileTreeRootType rootType)
Constructs file tree with the specified root type.

Parameters:
rootType - file tree root type

WebFileTree

public WebFileTree(java.lang.String rootPath)
Constructs file tree with file under specified path as root.

Parameters:
rootPath - path to root file

WebFileTree

public WebFileTree(java.io.File... rootFiles)
Constructs file tree with specified files as root.

Parameters:
rootFiles - root files

WebFileTree

public WebFileTree(java.util.List<java.io.File> rootFiles)
Constructs file tree with specified files as root.

Parameters:
rootFiles - root files
Method Detail

getDataProvider

public FileTreeDataProvider getDataProvider()
Returns asynchronous tree data provider.

Overrides:
getDataProvider in class WebAsyncTree<FileTreeNode>
Returns:
data provider

setModel

public void setModel(javax.swing.tree.TreeModel newModel)
Sets the TreeModel that will provide the data. This method also adds async tree model listener in the provided model.

Overrides:
setModel in class WebAsyncTree<FileTreeNode>
Parameters:
newModel - the TreeModel that is to provide the data

getFileLookupDropHandler

protected FileDragAndDropHandler getFileLookupDropHandler()
Returns file drop handler that locates file in the tree when dropped.

Returns:
file lookup drop handler

isFilesDropSearchEnabled

public boolean isFilesDropSearchEnabled()
Returns whether files search by dropping system files on the tree enabled or not.

Returns:
true if files search by dropping system files on the tree enabled, false otherwise

setFilesDropSearchEnabled

public void setFilesDropSearchEnabled(boolean filesDropSearchEnabled)
Sets whether files search by dropping system files on the tree enabled or not

Parameters:
filesDropSearchEnabled - whether files search by dropping system files on the tree enabled or not

getFileFilter

public Filter<java.io.File> getFileFilter()
Returns tree files filter.

Returns:
files filter

setFileFilter

public void setFileFilter(Filter<java.io.File> filter)
Sets tree files filter.

Parameters:
filter - new files filter

setRootName

public void setRootName(java.lang.String rootName)
Changes displayed tree root name.

Parameters:
rootName - new root name

setSelectedFile

public void setSelectedFile(java.io.File file)
Finds and selects specified file in tree. This method might not have any effect in case the specified field doesn't exist under the file tree root.

Parameters:
file - file to select

setSelectedFile

public void setSelectedFile(java.io.File file,
                            boolean expand)
Finds and selects specified file in tree. This method might not have any effect in case the specified field doesn't exist under the file tree root.

Parameters:
file - file to select
expand - whether to expand selected file or not

expandFile

public void expandFile(java.io.File file)
Expands tree structure to the specified file and expands that file node. This method might not have any effect in case the specified field doesn't exist under the file tree root.

Parameters:
file - file to expand

expandToFile

public void expandToFile(java.io.File file)
Expands tree structure to the specified file. This method might not have any effect in case the specified field doesn't exist under the file tree root.

Parameters:
file - file to expand tree sctructure to

expandToFile

public void expandToFile(java.io.File file,
                         boolean select)
Expands tree structure to the specified file. This method might not have any effect in case the specified field doesn't exist under the file tree root.

Parameters:
file - file to expand tree sctructure to
select - whether to select file or not

expandToFile

public void expandToFile(java.io.File file,
                         boolean select,
                         boolean expand)
Expands tree structure to the specified file. This method might not have any effect in case the specified field doesn't exist under the file tree root.

Parameters:
file - file to expand tree sctructure to
select - whether to select file or not
expand - whether to expand file or not

expandToFile

public void expandToFile(java.io.File file,
                         boolean select,
                         boolean expand,
                         java.lang.Runnable finalAction)
Expands tree structure to the specified file. This method might not have any effect in case the specified field doesn't exist under the file tree root.

Parameters:
file - file to expand tree sctructure to
select - whether to select file or not
expand - whether to expand file or not
finalAction - action performed after maximum possible file path has been expanded

performFileSelection

protected void performFileSelection(FileTreeNode node,
                                    boolean expand)
Performs the actual file selection.

Parameters:
node - node to select
expand - should expand the node

getSelectedFile

public java.io.File getSelectedFile()
Returns selected file.

Returns:
selected file

getSelectedFiles

public java.util.List<java.io.File> getSelectedFiles()
Returns selected files.

Returns:
selected files

getSelectedNodes

public java.util.List<FileTreeNode> getSelectedNodes()
Returns selected nodes.

Overrides:
getSelectedNodes in class WebTree<FileTreeNode>
Returns:
selected nodes

addFile

public boolean addFile(java.io.File parent,
                       java.io.File file)
Adds new file into tree structure. This method will have effect only if node with parent file exists and it has already loaded childs.

Parameters:
parent - parent file
file - added file
Returns:
true if tree structure was changed by the operation, false otherwise

addFile

public boolean addFile(FileTreeNode parentNode,
                       java.io.File file)
Adds new file into tree structure. This method will have effect only if node with parent file exists and it has already loaded childs.

Parameters:
parentNode - parent node
file - added file
Returns:
true if tree structure was changed by the operation, false otherwise

addFiles

public boolean addFiles(java.io.File parent,
                        java.io.File... files)
Adds new files into tree structure. This method will have effect only if node with parent file exists and it has already loaded childs.

Parameters:
parent - parent file
files - added files
Returns:
true if tree structure was changed by the operation, false otherwise

addFiles

public boolean addFiles(FileTreeNode parentNode,
                        java.io.File... files)
Adds new files into tree structure. This method will have effect only if node with parent file exists and it has already loaded childs.

Parameters:
parentNode - parent node
files - added files
Returns:
true if tree structure was changed by the operation, false otherwise

addFiles

public boolean addFiles(java.io.File parent,
                        java.util.List<java.io.File> files)
Adds new files into tree structure. This method will have effect only if node with parent file exists and it has already loaded childs.

Parameters:
parent - parent file
files - added files
Returns:
true if tree structure was changed by the operation, false otherwise

addFiles

public boolean addFiles(FileTreeNode parentNode,
                        java.util.List<java.io.File> files)
Adds new files into tree structure. This method will have effect only if node with parent file exists and it has already loaded childs.

Parameters:
parentNode - parent node
files - added files
Returns:
true if tree structure was changed by the operation, false otherwise

removeFile

public boolean removeFile(java.io.File file)
Removes file from tree structure. This method will have effect only if node with the specified file exists.

Parameters:
file - removed file
Returns:
true if tree structure was changed by the operation, false otherwise

removeFiles

public boolean removeFiles(java.io.File... files)
Removes files from tree structure. This method only works if nodes with the specified files exist.

Parameters:
files - removed files
Returns:
true if tree structure was changed by the operation, false otherwise

removeFiles

public boolean removeFiles(java.util.List<java.io.File> files)
Removes files from tree structure. This method only works if nodes with the specified files exist.

Parameters:
files - removed files
Returns:
true if tree structure was changed by the operation, false otherwise

startEditingFile

public void startEditingFile(java.io.File file)
Starts editing cell with the specified file.

Parameters:
file - file to edit

getFileChilds

public java.util.List<java.io.File> getFileChilds(FileTreeNode node)
Returns files collected from loaded node childs. This method will not force childs load.

Parameters:
node - node
Returns:
files from node childs

getNode

public FileTreeNode getNode(java.io.File file)
Returns node for the specified file if it is already loaded. Returns null if node for this file was not loaded yet or if the specified file doesn't exist under the file tree root.

Parameters:
file - file to search for
Returns:
file node

getClosestNode

public FileTreeNode getClosestNode(java.io.File file)
Returns loaded and closest to file node. Might return null in case file path parts were not found in tree.

Parameters:
file - file to look for
Returns:
closest to file node

getClosestNode

protected FileTreeNode getClosestNode(FileTreeNode node,
                                      java.util.List<java.io.File> path)
Returns loaded and closest to file node. Might return null in case file path parts were not found in tree.

Parameters:
node - node to look into
path - path of the file to look for
Returns:
closest to file node

getDeepestPathNode

protected FileTreeNode getDeepestPathNode(FileTreeNode pathNode,
                                          java.util.List<java.io.File> path)
Returns deepest path node available.

Parameters:
pathNode - current path node
path - files path
Returns:
deepest path node available

reloadChildsSync

public void reloadChildsSync(java.io.File folder)
Reloads child files for the specified folder. Unlike asynchronous methods this one works in EDT and forces to wait until the nodes load finishes.

Parameters:
folder - folder to reload childs for

reloadChildsSync

public void reloadChildsSync(java.io.File folder,
                             boolean select)
Reloads child files for the specified folder and selects folder node if requested. Unlike asynchronous methods this one works in EDT and forces to wait until the nodes load finishes.

Parameters:
folder - folder to reload childs for
select - whether select folder node or not

reloadChilds

public void reloadChilds(java.io.File folder)
Reloads child files for the specified folder.

Parameters:
folder - folder to reload childs for

reloadChilds

public void reloadChilds(java.io.File folder,
                         boolean select)
Reloads child files for the specified folder and selects folder node if requested.

Parameters:
folder - folder to reload childs for
select - whether select folder node or not