|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JTree com.alee.laf.tree.WebTree<E> com.alee.extended.tree.WebAsyncTree<FileTreeNode> com.alee.extended.tree.WebFileTree
public class WebFileTree
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.
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 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 |
---|
protected boolean filesDropSearchEnabled
protected FileDragAndDropHandler fileLookupDropHandler
protected final java.lang.Object delayedSelectionLock
protected int delayedSelectionId
Constructor Detail |
---|
public WebFileTree()
public WebFileTree(FileTreeRootType rootType)
rootType
- file tree root typepublic WebFileTree(java.lang.String rootPath)
rootPath
- path to root filepublic WebFileTree(java.io.File... rootFiles)
rootFiles
- root filespublic WebFileTree(java.util.List<java.io.File> rootFiles)
rootFiles
- root filesMethod Detail |
---|
public FileTreeDataProvider getDataProvider()
getDataProvider
in class WebAsyncTree<FileTreeNode>
public void setModel(javax.swing.tree.TreeModel newModel)
setModel
in class WebAsyncTree<FileTreeNode>
newModel
- the TreeModel that is to provide the dataprotected FileDragAndDropHandler getFileLookupDropHandler()
public boolean isFilesDropSearchEnabled()
public void setFilesDropSearchEnabled(boolean filesDropSearchEnabled)
filesDropSearchEnabled
- whether files search by dropping system files on the tree enabled or notpublic Filter<java.io.File> getFileFilter()
public void setFileFilter(Filter<java.io.File> filter)
filter
- new files filterpublic void setRootName(java.lang.String rootName)
rootName
- new root namepublic void setSelectedFile(java.io.File file)
file
- file to selectpublic void setSelectedFile(java.io.File file, boolean expand)
file
- file to selectexpand
- whether to expand selected file or notpublic void expandFile(java.io.File file)
file
- file to expandpublic void expandToFile(java.io.File file)
file
- file to expand tree sctructure topublic void expandToFile(java.io.File file, boolean select)
file
- file to expand tree sctructure toselect
- whether to select file or notpublic void expandToFile(java.io.File file, boolean select, boolean expand)
file
- file to expand tree sctructure toselect
- whether to select file or notexpand
- whether to expand file or notpublic void expandToFile(java.io.File file, boolean select, boolean expand, java.lang.Runnable finalAction)
file
- file to expand tree sctructure toselect
- whether to select file or notexpand
- whether to expand file or notfinalAction
- action performed after maximum possible file path has been expandedprotected void performFileSelection(FileTreeNode node, boolean expand)
node
- node to selectexpand
- should expand the nodepublic java.io.File getSelectedFile()
public java.util.List<java.io.File> getSelectedFiles()
public java.util.List<FileTreeNode> getSelectedNodes()
getSelectedNodes
in class WebTree<FileTreeNode>
public boolean addFile(java.io.File parent, java.io.File file)
parent
- parent filefile
- added file
public boolean addFile(FileTreeNode parentNode, java.io.File file)
parentNode
- parent nodefile
- added file
public boolean addFiles(java.io.File parent, java.io.File... files)
parent
- parent filefiles
- added files
public boolean addFiles(FileTreeNode parentNode, java.io.File... files)
parentNode
- parent nodefiles
- added files
public boolean addFiles(java.io.File parent, java.util.List<java.io.File> files)
parent
- parent filefiles
- added files
public boolean addFiles(FileTreeNode parentNode, java.util.List<java.io.File> files)
parentNode
- parent nodefiles
- added files
public boolean removeFile(java.io.File file)
file
- removed file
public boolean removeFiles(java.io.File... files)
files
- removed files
public boolean removeFiles(java.util.List<java.io.File> files)
files
- removed files
public void startEditingFile(java.io.File file)
file
- file to editpublic java.util.List<java.io.File> getFileChilds(FileTreeNode node)
node
- node
public FileTreeNode getNode(java.io.File file)
file
- file to search for
public FileTreeNode getClosestNode(java.io.File file)
file
- file to look for
protected FileTreeNode getClosestNode(FileTreeNode node, java.util.List<java.io.File> path)
node
- node to look intopath
- path of the file to look for
protected FileTreeNode getDeepestPathNode(FileTreeNode pathNode, java.util.List<java.io.File> path)
pathNode
- current path nodepath
- files path
public void reloadChildsSync(java.io.File folder)
folder
- folder to reload childs forpublic void reloadChildsSync(java.io.File folder, boolean select)
folder
- folder to reload childs forselect
- whether select folder node or notpublic void reloadChilds(java.io.File folder)
folder
- folder to reload childs forpublic void reloadChilds(java.io.File folder, boolean select)
folder
- folder to reload childs forselect
- whether select folder node or not
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |