public final class TFileTree
extends javax.swing.JTree
JTree to browse files and directories.
There are a couple of file creation/modification/removal methods added
which notify the tree of any changes in the file system and update the
current path expansions and selection.javax.swing.JTree.AccessibleJTree, javax.swing.JTree.DropLocation, javax.swing.JTree.DynamicUtilTreeNode, javax.swing.JTree.EmptySelectionModel, javax.swing.JTree.TreeModelHandler, javax.swing.JTree.TreeSelectionRedirectorjavax.swing.JComponent.AccessibleJComponentANCHOR_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, visibleRowCountlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
TFileTree()
Creates an empty
TFileTree with no root. |
TFileTree(net.java.truevfs.access.TFile root)
Creates a new
TFileTree which traverses the given
root root file. |
TFileTree(TFileTreeModel model)
Creates a new
TFileTree which traverses the given
TFileTreeModel. |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelEditing() |
java.lang.String |
convertValueToText(java.lang.Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) |
void |
cp_p(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
Forwards the call to the
TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible. |
void |
cp_r(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
Forwards the call to the
TFileTreeModel
and scrolls the tree so that the recursively copied node
is selected and visible. |
void |
cp_rp(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
Forwards the call to the
TFileTreeModel
and scrolls the tree so that the recursively copied node
is selected and visible. |
void |
cp(java.io.InputStream in,
net.java.truevfs.access.TFile node)
Forwards the call to the
TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible. |
void |
cp(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
Forwards the call to the
TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible. |
boolean |
createNewFile(net.java.truevfs.access.TFile node)
Forwards the call to the
TFileTreeModel
and scrolls the tree so that the newly created file
is selected and visible. |
java.lang.String |
getDefaultExtension()
Getter for bound property defaultExtension.
|
TFileTreeModel |
getModel() |
boolean |
isDisplayingExtensions()
Getter for bound property displayingExtensions.
|
boolean |
isEditing() |
boolean |
isEditingExtensions()
Getter for bound property editingExtensions.
|
void |
mkdir(net.java.truevfs.access.TFile node,
boolean recursive)
Forwards the call to the
TFileTreeModel
and scrolls the tree so that the newly created directory
is selected and visible. |
void |
mv(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
Forwards the call to the
TFileTreeModel,
restores the expanded paths, selects node and scrolls to
it if necessary. |
protected void |
onEditingStopped(javax.swing.event.ChangeEvent evt)
Called when the editing of a cell has been stopped.
|
void |
refresh()
Refreshes the entire tree,
restores the expanded and selected paths and scrolls to the lead
selection path if necessary.
|
void |
refresh(net.java.truevfs.access.TFile node)
Refreshes the subtree for the given node,
restores the expanded and selected paths and scrolls to the lead
selection path if necessary.
|
void |
refresh(javax.swing.tree.TreePath[] paths)
Refreshes the subtree for the given paths,
restores the expanded and selected paths and scrolls to the lead
selection path if necessary.
|
void |
rm_r(net.java.truevfs.access.TFile node)
Forwards the call to the
TFileTreeModel
and scrolls the tree so that the successor to the deleted node
is selected and visible. |
void |
rm(net.java.truevfs.access.TFile node)
Forwards the call to the
TFileTreeModel
and scrolls the tree so that the successor to the deleted node
is selected and visible. |
void |
scrollNodeToVisible(net.java.truevfs.access.TFile node) |
void |
setDefaultExtension(java.lang.String defaultExtension)
Setter for bound property defaultExtension.
|
void |
setDisplayingExtensions(boolean displayingExtensions)
Setter for bound property displayingExtensions.
|
void |
setEditable(boolean editable) |
void |
setEditingExtensions(boolean editingExtensions)
Setter for bound property editingExtensions.
|
void |
setModel(javax.swing.tree.TreeModel model) |
void |
setSelectionNode(net.java.truevfs.access.TFile node) |
void |
setSelectionNodes(net.java.truevfs.access.TFile[] nodes) |
void |
startEditingAtPath(javax.swing.tree.TreePath path) |
boolean |
stopEditing() |
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, clearSelection, clearToggledPaths, collapsePath, collapseRow, createTreeModel, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDefaultTreeModel, getDescendantToggledPaths, getDragEnabled, getDropLocation, getDropMode, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, 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, 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, setDropMode, setExpandedState, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, treeDidChange, updateUIaddAncestorListener, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, updateadd, 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, transferFocusDownCycle, validate, validateTreeaction, 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, 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, transferFocusBackward, transferFocusUpCyclepublic TFileTree()
TFileTree with no root.
You shouldn't use this constructor.
It's only provided to implement the JavaBean pattern.public TFileTree(net.java.truevfs.access.TFile root)
TFileTree which traverses the given
root root file.public TFileTree(TFileTreeModel model)
TFileTree which traverses the given
TFileTreeModel.public TFileTreeModel getModel()
getModel in class javax.swing.JTreepublic void setModel(javax.swing.tree.TreeModel model)
setModel in class javax.swing.JTreejava.lang.ClassCastException - if model is not an instance
of TFileTreeModel.public void setEditable(boolean editable)
setEditable in class javax.swing.JTreepublic boolean isDisplayingExtensions()
public void setDisplayingExtensions(boolean displayingExtensions)
false, the extension of files will not be displayed
in this tree.
Defaults to true.displayingExtensions - New value of property displayingExtensions.public boolean isEditingExtensions()
public void setEditingExtensions(boolean editingExtensions)
false, the extension of a file will be truncated
before editing its name starts.
Defaults to true.editingExtensions - New value of property editingExtensions.@Nullable public java.lang.String getDefaultExtension()
public void setDefaultExtension(@CheckForNull
java.lang.String defaultExtension)
null and is ignored for
directories.defaultExtension - The new default extension.
If not null, this parameter is fixed to always
start with a '.'.public boolean isEditing()
isEditing in class javax.swing.JTreepublic void startEditingAtPath(javax.swing.tree.TreePath path)
startEditingAtPath in class javax.swing.JTreepublic void cancelEditing()
cancelEditing in class javax.swing.JTreepublic boolean stopEditing()
stopEditing in class javax.swing.JTreeprotected void onEditingStopped(javax.swing.event.ChangeEvent evt)
evt - The change event passed to
CellEditorListener.editingStopped(ChangeEvent).public java.lang.String convertValueToText(java.lang.Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
convertValueToText in class javax.swing.JTreepublic void refresh()
public void refresh(net.java.truevfs.access.TFile node)
node - The file or directory to refresh.
This may not be null.public void refresh(javax.swing.tree.TreePath[] paths)
paths - The array of TreePaths to refresh.
This may be null.public boolean createNewFile(net.java.truevfs.access.TFile node)
throws java.io.IOException
TFileTreeModel
and scrolls the tree so that the newly created file
is selected and visible.
If you would like to create a new file with initial content, please
check cp(InputStream, TFile).java.io.IOException - on any I/O error.public void mkdir(net.java.truevfs.access.TFile node,
boolean recursive)
throws java.io.IOException
TFileTreeModel
and scrolls the tree so that the newly created directory
is selected and visible.java.io.IOException - on any I/O error.public void cp(@WillClose
java.io.InputStream in,
net.java.truevfs.access.TFile node)
throws java.io.IOException
TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible.java.io.IOException - on any I/O error.public void cp(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
throws java.io.IOException
TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible.java.io.IOException - on any I/O error.public void cp_r(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
throws java.io.IOException
TFileTreeModel
and scrolls the tree so that the recursively copied node
is selected and visible.java.io.IOException - on any I/O error.public void cp_p(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
throws java.io.IOException
TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible.java.io.IOException - on any I/O error.public void cp_rp(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
throws java.io.IOException
TFileTreeModel
and scrolls the tree so that the recursively copied node
is selected and visible.java.io.IOException - on any I/O error.public void mv(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
throws java.io.IOException
TFileTreeModel,
restores the expanded paths, selects node and scrolls to
it if necessary.java.io.IOException - on any I/O error.public void rm(net.java.truevfs.access.TFile node)
throws java.io.IOException
TFileTreeModel
and scrolls the tree so that the successor to the deleted node
is selected and visible.java.io.IOException - on any I/O error.public void rm_r(net.java.truevfs.access.TFile node)
throws java.io.IOException
TFileTreeModel
and scrolls the tree so that the successor to the deleted node
is selected and visible.java.io.IOException - on any I/O error.public void setSelectionNode(net.java.truevfs.access.TFile node)
public void setSelectionNodes(net.java.truevfs.access.TFile[] nodes)
public void scrollNodeToVisible(net.java.truevfs.access.TFile node)