org.apache.pivot.wtk
Class FileBrowser

java.lang.Object
  extended by org.apache.pivot.wtk.Component
      extended by org.apache.pivot.wtk.Container
          extended by org.apache.pivot.wtk.FileBrowser
All Implemented Interfaces:
Iterable<Component>, Sequence<Component>, ConstrainedVisual, Visual

public class FileBrowser
extends Container

Component representing a file browser.


Nested Class Summary
static interface FileBrowser.Skin
          File browser skin interface.
 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Container
Container.EDT_Checker
 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T>
 
Constructor Summary
FileBrowser()
          Creates a new FileBrowser Note that this version set by default mode to open.
FileBrowser(String rootFolder)
          Creates a new FileBrowser Note that this version of the constructor must be used when a custom root folder has to be set.
 
Method Summary
 boolean addSelectedFile(File file)
          Adds a file to the file selection.
 void clearSelection()
          Clears the selection.
 Filter<File> getDisabledFileFilter()
          Returns the current file filter.
 File getFileAt(int x, int y)
           
 ListenerList<FileBrowserListener> getFileBrowserListeners()
           
 File getRootDirectory()
          Returns the current root directory.
 File getSelectedFile()
          When in single-select mode, returns the currently selected file.
 ImmutableList<File> getSelectedFiles()
          Returns the currently selected files.
 boolean isFileSelected(File file)
           
 boolean isMultiSelect()
          Returns the file browser's multi-select state.
 boolean removeSelectedFile(File file)
          Removes a file from the file selection.
 void setDisabledFileFilter(Filter<File> disabledFileFilter)
          Sets the file filter.
 void setMultiSelect(boolean multiSelect)
          Sets the file browser's multi-select state.
 void setRootDirectory(File rootDirectory)
          Sets the root directory.
 void setSelectedFile(File file)
          Sets the selection to a single file.
 Sequence<File> setSelectedFiles(Sequence<File> selectedFiles)
          Sets the selected files.
 
Methods inherited from class org.apache.pivot.wtk.Container
add, assertEventDispatchThread, assertEventDispatchThread, clear, containsFocus, descendantAdded, descendantGainedFocus, descendantLostFocus, descendantRemoved, get, getComponentAt, getContainerListeners, getContainerMouseListeners, getDescendantAt, getFocusTraversalPolicy, getGraphics, getLength, getNamedComponent, indexOf, insert, invalidate, isAncestor, isDoubleBuffered, iterator, layout, load, mouseClick, mouseDown, mouseMove, mouseOut, mouseUp, mouseWheel, move, paint, remove, remove, removeAll, repaint, requestFocus, setDoubleBuffered, setEventDispatchThreadChecker, setFocusTraversalPolicy, setParent, setVisible, store, transferFocus, update
 
Methods inherited from class org.apache.pivot.wtk.Component
clearFocus, contains, getAncestor, getAncestor, getAttribute, getAutomationID, getBaseline, getBaseline, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponentStateListeners, getComponentStyleListeners, getComponentTooltipListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getHeight, getHeightLimits, getLocation, getMaximumHeight, getMaximumWidth, getMenuHandler, getMinimumHeight, getMinimumWidth, getMouseLocation, getName, getNamedStyles, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getSize, getSkin, getStyles, getTooltipDelay, getTooltipText, getTooltipWrapText, getTypedStyles, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWidthLimits, getWindow, getX, getY, indexBoundsCheck, installSkin, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseOver, reenterMouse, repaint, repaint, repaint, repaint, repaint, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setCursor, setDragSource, setDropTarget, setEnabled, setFocused, setHeight, setHeightLimits, setHeightLimits, setLocation, setLocation, setMaximumHeight, setMaximumWidth, setMenuHandler, setMinimumHeight, setMinimumWidth, setName, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setSkin, setStyleName, setStyleNames, setStyleNames, setStyles, setStyles, setTooltipDelay, setTooltipText, setTooltipWrapText, setWidth, setWidthLimits, setWidthLimits, setX, setY, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileBrowser

public FileBrowser()
Creates a new FileBrowser

Note that this version set by default mode to open.


FileBrowser

public FileBrowser(String rootFolder)
Creates a new FileBrowser

Note that this version of the constructor must be used when a custom root folder has to be set.

Parameters:
rootFolder - The root folder full name.
Method Detail

getRootDirectory

public File getRootDirectory()
Returns the current root directory.

Returns:
The current root directory.

setRootDirectory

public void setRootDirectory(File rootDirectory)
Sets the root directory. Clears any existing file selection.

Parameters:
rootDirectory -

addSelectedFile

public boolean addSelectedFile(File file)
Adds a file to the file selection.

Parameters:
file -
Returns:
true if the file was added; false if it was already selected.

removeSelectedFile

public boolean removeSelectedFile(File file)
Removes a file from the file selection.

Parameters:
file -
Returns:
true if the file was removed; false if it was not already selected.

getSelectedFile

public File getSelectedFile()
When in single-select mode, returns the currently selected file.

Returns:
The currently selected file.

setSelectedFile

public void setSelectedFile(File file)
Sets the selection to a single file.

Parameters:
file -

getSelectedFiles

public ImmutableList<File> getSelectedFiles()
Returns the currently selected files.

Returns:
An immutable list containing the currently selected files. Note that the returned list is a wrapper around the actual selection, not a copy. Any changes made to the selection state will be reflected in the list, but events will not be fired.

setSelectedFiles

public Sequence<File> setSelectedFiles(Sequence<File> selectedFiles)
Sets the selected files.

Parameters:
selectedFiles - The files to select.
Returns:
The files that were selected, with duplicates eliminated.

clearSelection

public void clearSelection()
Clears the selection.


isFileSelected

public boolean isFileSelected(File file)

isMultiSelect

public boolean isMultiSelect()
Returns the file browser's multi-select state.


setMultiSelect

public void setMultiSelect(boolean multiSelect)
Sets the file browser's multi-select state.

Parameters:
multiSelect - true if multi-select is enabled; false, otherwise.

getDisabledFileFilter

public Filter<File> getDisabledFileFilter()
Returns the current file filter.

Returns:
The current file filter, or null if no filter is set.

setDisabledFileFilter

public void setDisabledFileFilter(Filter<File> disabledFileFilter)
Sets the file filter.

Parameters:
disabledFileFilter - The file filter to use, or null for no filter.

getFileAt

public File getFileAt(int x,
                      int y)

getFileBrowserListeners

public ListenerList<FileBrowserListener> getFileBrowserListeners()