com.japisoft.treefilebrowser
Class JTreeFileBrowser

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.japisoft.treefilebrowser.JTreeFileBrowser
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JTreeFileBrowser
extends javax.swing.JComponent

Here a component for browsing a file system inside a tree view. You can update the default actions using the ActionModel. Each file look can be changed implementing a FileView.

Version:
1.1
Author:
(c) 2004 JAPISoft / http://www.japisoft.com
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
JTreeFileBrowser()
          Initialize the filebrowser without a main action
JTreeFileBrowser(javax.swing.Action mainAction)
          Initialize the filebrowser with a main action like Select a file, Open a file, Save a file
 
Method Summary
 void addFileSelectionListener(FileSelectionListener listener)
          Add a listener for knowing the current selected file
 void addNotify()
           
 ActionModel getActionModel()
           
 FileFilter getCurrentFileFilter()
           
 FileFilterModel getFileFilterModel()
           
 java.io.File getSelectedFile()
           
 java.io.File[] getSelectedFiles()
           
 boolean isEnabledFileMoving()
          Check if the file moving is enabled.
 boolean isEnabledFileRenaming()
           
 boolean isEnabledMultipleSelection()
           
 void refresh()
          Update the current directory
 void refreshParent()
          Refresh the parent directory
 void removeFileSelectionListener(FileSelectionListener listener)
          Remove a previous added listener
 void removeNotify()
           
 void setEnabledFileMoving(boolean enabled)
          Enabled File moving by Drag'n drop.
 void setEnabledFileRenaming(boolean enabled)
          Enabled the user to rename a file by a double-click.
 void setEnabledMultipleSelection(boolean enabled)
          Enable several file selection.
 void setFileView(FileView view)
          Here a view for each file appearance like the bound foreground or the icon
 void setSelectedFile(java.io.File selectedFile)
          Reset the current file
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JTreeFileBrowser

public JTreeFileBrowser(javax.swing.Action mainAction)
Initialize the filebrowser with a main action like Select a file, Open a file, Save a file

Parameters:
mainAction -

JTreeFileBrowser

public JTreeFileBrowser()
Initialize the filebrowser without a main action

Method Detail

getActionModel

public ActionModel getActionModel()
Returns:
a model for the available actions

getFileFilterModel

public FileFilterModel getFileFilterModel()
Returns:
a model for the available file filters. Note that you can change dynamically this model

getCurrentFileFilter

public FileFilter getCurrentFileFilter()
Returns:
the current file filter

setFileView

public void setFileView(FileView view)
Here a view for each file appearance like the bound foreground or the icon


setSelectedFile

public void setSelectedFile(java.io.File selectedFile)
Reset the current file


getSelectedFiles

public java.io.File[] getSelectedFiles()
Returns:
the selected files

getSelectedFile

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

setEnabledFileMoving

public void setEnabledFileMoving(boolean enabled)
Enabled File moving by Drag'n drop. By default true


isEnabledFileMoving

public boolean isEnabledFileMoving()
Check if the file moving is enabled. By default true


setEnabledFileRenaming

public void setEnabledFileRenaming(boolean enabled)
Enabled the user to rename a file by a double-click. By default true


isEnabledFileRenaming

public boolean isEnabledFileRenaming()

addNotify

public void addNotify()
Overrides:
addNotify in class javax.swing.JComponent

removeNotify

public void removeNotify()
Overrides:
removeNotify in class javax.swing.JComponent

addFileSelectionListener

public void addFileSelectionListener(FileSelectionListener listener)
Add a listener for knowing the current selected file


removeFileSelectionListener

public void removeFileSelectionListener(FileSelectionListener listener)
Remove a previous added listener


refresh

public void refresh()
Update the current directory


refreshParent

public void refreshParent()
Refresh the parent directory


setEnabledMultipleSelection

public void setEnabledMultipleSelection(boolean enabled)
Enable several file selection. By default false


isEnabledMultipleSelection

public boolean isEnabledMultipleSelection()
Returns:
true if multiple files selection are available