de.matthiasmann.twl
Class FolderBrowser

java.lang.Object
  extended by de.matthiasmann.twl.Widget
      extended by de.matthiasmann.twl.FolderBrowser

public class FolderBrowser
extends Widget

A folder browser with plugable file system.


Nested Class Summary
 
Nested classes/interfaces inherited from class de.matthiasmann.twl.Widget
Widget.OffscreenMouseAdjustments, Widget.RenderOffscreen
 
Field Summary
 
Fields inherited from class de.matthiasmann.twl.Widget
STATE_DISABLED, STATE_HAS_FOCUSED_CHILD, STATE_HAS_OPEN_POPUPS, STATE_KEYBOARD_FOCUS
 
Constructor Summary
FolderBrowser()
           
FolderBrowser(FileSystemModel fsm)
           
 
Method Summary
 void addCallback(java.lang.Runnable cb)
           
 void addSelectionChangedCallback(java.lang.Runnable cb)
           
 void adjustSize()
          Auto adjust the size of this widget based on it's preferred size.
protected  void doCallback()
           
protected  void fireSelectionChangedCallback()
           
 java.lang.Object getCurrentFolder()
          Get the current displayed folder
 FileSystemModel getFileSystemModel()
           
 java.util.Comparator<java.lang.String> getFolderComparator()
           
 java.lang.Object getSelectedFolder()
          Get the current selected folder in the list box
 boolean goToParentFolder()
           
 boolean handleEvent(Event evt)
          Called when an event occurred that this widget could be interested in.
protected  void layout()
          Called when the layoutInvalid flag is set.
 void removeCallback(java.lang.Runnable cb)
           
 void removeSelectionChangedCallback(java.lang.Runnable cb)
           
 boolean selectFolder(java.lang.Object current)
           
 boolean setCurrentFolder(java.lang.Object folder)
           
 void setFolderComparator(java.util.Comparator<java.lang.String> folderComparator)
           
 
Methods inherited from class de.matthiasmann.twl.Widget
add, addActionMapping, addPropertyChangeListener, addPropertyChangeListener, afterAddToGUI, allChildrenRemoved, applyTheme, applyThemeBackground, applyThemeBorder, applyThemeInputMap, applyThemeMaxSize, applyThemeMinSize, applyThemeMouseCursor, applyThemeOffscreenExtra, applyThemeOverlay, applyThemeTooltip, beforeRemoveFromGUI, borderChanged, canAcceptKeyboardFocus, childAdded, childInvalidateLayout, childRemoved, childVisibilityChanged, computeSize, destroy, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, focusFirstChild, focusLastChild, focusNextChild, focusPrevChild, getActionMap, getAnimationState, getBackground, getBorderBottom, getBorderHorizontal, getBorderLeft, getBorderRight, getBorderTop, getBorderVertical, getBottom, getChild, getChildAt, getChildIndex, getGUI, getHeight, getInnerBottom, getInnerHeight, getInnerRight, getInnerWidth, getInnerX, getInnerY, getInputMap, getKeyboardFocusOrder, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getMouseCursor, getMouseCursor, getNumChildren, getOffscreenExtraBottom, getOffscreenExtraLeft, getOffscreenExtraRight, getOffscreenExtraTop, getOrCreateActionMap, getOverlay, getParent, getPreferredHeight, getPreferredInnerHeight, getPreferredInnerWidth, getPreferredWidth, getRenderOffscreen, getRight, getRootWidget, getTheme, getThemePath, getThemeTooltipContent, getTintAnimator, getTooltipContent, getTooltipContentAt, getWidgetAt, getWidth, getX, getY, giveupKeyboardFocus, handleKeyStrokeAction, hasKeyboardFocus, hasOpenPopups, hasSharedAnimationState, insertChild, invalidateLayout, invalidateLayoutLocally, isAbsoluteTheme, isClip, isDepthFocusTraversal, isEnabled, isFocusKeyEnabled, isInside, isLocallyEnabled, isMouseInside, isVisible, keyboardFocusChildChanged, keyboardFocusGained, keyboardFocusGained, keyboardFocusLost, layoutChildFullInnerArea, layoutChildrenFullInnerArea, moveChild, paint, paintBackground, paintChild, paintChildren, paintDragOverlay, paintOverlay, paintWidget, positionChanged, reapplyTheme, removeAllChildren, removeChild, removeChild, removePropertyChangeListener, removePropertyChangeListener, requestKeyboardFocus, requestKeyboardFocus, resetTooltip, setActionMap, setBackground, setBorderSize, setBorderSize, setBorderSize, setBorderSize, setCanAcceptKeyboardFocus, setClip, setDepthFocusTraversal, setEnabled, setFocusKeyEnabled, setInnerSize, setInputMap, setMaxSize, setMinSize, setMouseCursor, setOffscreenExtra, setOffscreenExtra, setOverlay, setPosition, setRenderOffscreen, setSize, setTheme, setTintAnimator, setTooltipContent, setVisible, sizeChanged, updateTintAnimation, updateTooltip, validateLayout, widgetDisabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FolderBrowser

public FolderBrowser()

FolderBrowser

public FolderBrowser(FileSystemModel fsm)
Method Detail

addCallback

public void addCallback(java.lang.Runnable cb)

removeCallback

public void removeCallback(java.lang.Runnable cb)

doCallback

protected void doCallback()

getFolderComparator

public java.util.Comparator<java.lang.String> getFolderComparator()

setFolderComparator

public void setFolderComparator(java.util.Comparator<java.lang.String> folderComparator)

getFileSystemModel

public FileSystemModel getFileSystemModel()

getCurrentFolder

public java.lang.Object getCurrentFolder()
Get the current displayed folder

Returns:
the displayed folder or null if root is displayed

setCurrentFolder

public boolean setCurrentFolder(java.lang.Object folder)

goToParentFolder

public boolean goToParentFolder()

getSelectedFolder

public java.lang.Object getSelectedFolder()
Get the current selected folder in the list box

Returns:
a folder or null if nothing is selected

selectFolder

public boolean selectFolder(java.lang.Object current)

addSelectionChangedCallback

public void addSelectionChangedCallback(java.lang.Runnable cb)

removeSelectionChangedCallback

public void removeSelectionChangedCallback(java.lang.Runnable cb)

fireSelectionChangedCallback

protected void fireSelectionChangedCallback()

handleEvent

public boolean handleEvent(Event evt)
Description copied from class: Widget
Called when an event occurred that this widget could be interested in.

The default implementation handles only keyboard events and delegates them to the child widget which has keyboard focus. If focusKey handling is enabled then this widget cycles the keyboard focus through it's children. If the key was not consumed by a child or focusKey and an inputMap is specified then the event is translated by the InputMap and handleKeyStrokeAction is called when a mapping was found.

If the widget wants to receive mouse events then it must return true for all mouse events except for MOUSE_WHEEL (which is optional) event. Otherwise the following mouse event are not send. Before mouse movement or button events are send a MOUSE_ENTERED event is send first.

Overrides:
handleEvent in class Widget
Parameters:
evt - The event - do not store this object - it may be reused
Returns:
true if the widget handled this event
See Also:
Widget.setFocusKeyEnabled(boolean), Widget.handleKeyStrokeAction(java.lang.String, de.matthiasmann.twl.Event), Widget.setInputMap(de.matthiasmann.twl.InputMap)

adjustSize

public void adjustSize()
Description copied from class: Widget
Auto adjust the size of this widget based on it's preferred size. Subclasses can provide more functionality

Overrides:
adjustSize in class Widget

layout

protected void layout()
Description copied from class: Widget
Called when the layoutInvalid flag is set. The default implementation does nothing.

Overrides:
layout in class Widget