|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTree
org.fife.ui.ToolTipTree
org.fife.ui.rtextfilechooser.FileSystemTree
A tree containing all files in the local host's file system. So that you
can create components that contain a FileSystemTree, the
following property change events are fired when the tree is manipulated:
WILL_EXPAND_PROPERTY - When the tree is about to
expand one of its nodes. Upon receiving this property change event,
you could set the cursor to the system wait cursor, for example (as
the expansion could take some time; Java seems to have some trouble
calling File.isDirectory() on network files...).EXPANDED_PROPERTY - When the tree has completed
expanding the node. Upon receiving this property change event, you
could set the cursor back to the default.
| Nested Class Summary | |
static class |
FileSystemTree.FileSystemTreeModel
|
static class |
FileSystemTree.FileSystemTreeNode
The tree node used by the file tree. |
| Nested classes 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 inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
static java.lang.String |
EXPANDED_PROPERTY
|
protected org.fife.ui.rtextfilechooser.FileChooserIconManager |
iconManager
|
protected org.fife.ui.rtextfilechooser.FileSystemTreeActions.NewFileAction |
newFileAction
|
protected javax.swing.JPopupMenu |
popup
|
static java.lang.String |
WILL_EXPAND_PROPERTY
|
| Fields inherited from class javax.swing.JTree |
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, cellEditor, 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, 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 | |
FileSystemTree()
Constructor. |
|
FileSystemTree(java.io.File rootDir)
Constructor. |
|
| Method Summary | |
protected void |
collapseAllNodes()
Collapses all tree nodes. |
protected void |
configurePopupMenuActions()
Called right before the popup menu is displayed. |
java.lang.String |
convertValueToText(java.lang.Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
|
protected javax.swing.JPopupMenu |
createPopupMenu()
Creates the popup menu for this file system tree. |
FileSystemTree.FileSystemTreeNode |
createTreeNodeFor(java.io.File file)
Creates a tree node for the specified file. |
protected FileSystemTree.FileSystemTreeNode |
createTreeNodeForImpl(java.io.File file,
boolean directory)
Creates a tree node for the specified file. |
protected java.io.File[] |
filterAndSort(java.io.File[] files)
Does any filtering and sorting of an array of files so that they will be displayed properly. |
void |
fireTreeExpanded(javax.swing.tree.TreePath e)
Called when a node has expanded. |
void |
fireTreeWillExpand(javax.swing.tree.TreePath e)
Called when a node is about to be expanded. |
protected java.lang.String |
getName(java.io.File file)
Returns the display name for a given file. |
java.awt.Dimension |
getPreferredSize()
This method is overridden to ensure that this tree is given a little bit of room if it is placed into a JScrollPane (which
is likely). |
java.io.File |
getRoot()
Returns the directory being used as the invisible "root" of this tree. |
java.io.File |
getSelectedFile()
Returns the file currently selected by the user. |
java.lang.String |
getSelectedFileName()
Returns the name of the file currently selected by the user. |
java.io.File[] |
getSelectedFiles()
Returns any selected files. |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent e)
Returns the string to use for the tooltip. |
protected void |
processMouseEvent(java.awt.event.MouseEvent e)
Called when a mouse event occurs in this file system tree. |
void |
setRoot(java.io.File rootFile)
Changes the "root" of this tree. |
boolean |
setSelectedFile(java.io.File file)
Selects the given file in the tree. |
void |
updateUI()
Overridden so that the renderer is also updated on a LnF change. |
| Methods inherited from class org.fife.ui.ToolTipTree |
getToolTipLocation, getToolTipsEnabled, initialize, setToolTipsEnabled |
| Methods inherited from class javax.swing.JTree |
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, createTreeModel, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeWillCollapse, 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, 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 |
| 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, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, 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 |
public static final java.lang.String EXPANDED_PROPERTY
public static final java.lang.String WILL_EXPAND_PROPERTY
protected org.fife.ui.rtextfilechooser.FileChooserIconManager iconManager
protected javax.swing.JPopupMenu popup
protected org.fife.ui.rtextfilechooser.FileSystemTreeActions.NewFileAction newFileAction
| Constructor Detail |
public FileSystemTree()
public FileSystemTree(java.io.File rootDir)
rootDir - The root directory for the tree.
java.lang.IllegalArgumentException - If this directory does not exist.| Method Detail |
protected void collapseAllNodes()
protected void configurePopupMenuActions()
popup has been created before this
method is called. Subclasses should call the super implementation
when overriding this method.
public java.lang.String convertValueToText(java.lang.Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
protected javax.swing.JPopupMenu createPopupMenu()
public FileSystemTree.FileSystemTreeNode createTreeNodeFor(java.io.File file)
file - The file for which to create a tree node.
protected FileSystemTree.FileSystemTreeNode createTreeNodeForImpl(java.io.File file,
boolean directory)
file - The file for which to create a tree node.directory - Whether the specified file is a directory.
protected java.io.File[] filterAndSort(java.io.File[] files)
files - The array of files to filter and sort.
public void fireTreeExpanded(javax.swing.tree.TreePath e)
public void fireTreeWillExpand(javax.swing.tree.TreePath e)
throws javax.swing.tree.ExpandVetoException
javax.swing.tree.ExpandVetoExceptionprotected java.lang.String getName(java.io.File file)
file - The file for which to get the display name.
public java.awt.Dimension getPreferredSize()
JScrollPane (which
is likely). If you don't do this, the tree's preferred width will only
be the maximum width of one of its visible nodes, so it will appear
"squished" into whatever frame/dialog it's in.
public java.io.File getRoot()
null if none (i.e., if all
file system roots are being shown instead).setRoot(File)public java.io.File getSelectedFile()
getSelectedFile in interface FileSelectornull
if no file is selected.getSelectedFileName(),
setSelectedFile(java.io.File)public java.io.File[] getSelectedFiles()
getSelectedFile(), since this component only allows selection
of one file at a time.
getSelectedFiles in interface FileSelectorpublic java.lang.String getSelectedFileName()
null
if no file is selected.getSelectedFile(),
setSelectedFile(java.io.File)public java.lang.String getToolTipText(java.awt.event.MouseEvent e)
getToolTipText in class ToolTipTreeprotected void processMouseEvent(java.awt.event.MouseEvent e)
e - The mouse event.public void setRoot(java.io.File rootFile)
rootFile - The new root. If this is null, then all
of the file system's roots are used. If it is a directory, then
that directory is used. If it is a plain file, or does not
exist, an IllegalArgumentException is thrown.getRoot()public boolean setSelectedFile(java.io.File file)
file - The file to select.
getSelectedFile()public void updateUI()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||