com.mucommander.ui.main
Class FolderPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.mucommander.ui.main.FolderPanel
All Implemented Interfaces:
ConfigurationListener, ThemeListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class FolderPanel
extends javax.swing.JPanel
implements java.awt.event.FocusListener, ConfigurationListener, ThemeListener

Folder pane that contains the table that displays the contents of the current directory and allows navigation, the drive button, and the location field.

Author:
Maxence Bernard
See Also:
Serialized Form

Nested Class Summary
 class FolderPanel.ChangeFolderThread
          This thread takes care of changing current folder without locking the main thread.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int BOOKMARKS_QUICK_LIST_INDEX
           
protected static BookmarksQL bookmarksQL
           
static int PARENT_FOLDERS_QUICK_LIST_INDEX
           
static int RECENT_ACCESSED_LOCATIONS_QUICK_LIST_INDEX
           
static int RECENT_EXECUTED_FILES_QUICK_LIST_INDEX
           
protected static RecentExecutedFilesQL recentExecutedFilesQL
           
protected static RecentLocationsQL recentLocationsQL
           
 
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
 
Method Summary
 void changeCurrentLocation()
          Allows the user to easily change the current folder and type a new one: requests focus on the location field and selects the folder string.
 void colorChanged(ColorChangedEvent event)
          Receives theme color changes notifications.
 void configurationChanged(ConfigurationEvent event)
          Listens to certain configuration variables.
 void dimBackground()
          Dims the scrollpane's background, called by FileTable.QuickSearch when a quick search is started.
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 void fontChanged(FontChangedEvent event)
          Not used.
 FolderPanel.ChangeFolderThread getChangeFolderThread()
          Returns the thread that is currently changing the current folder, null is the folder is not being changed.
 AbstractFile getCurrentFolder()
          Returns the folder that is currently being displayed by this panel.
 DrivePopupButton getDriveButton()
          Returns the DrivePopupButton contained by this panel.
 FileDragSourceListener getFileDragSourceListener()
           
 FileTable getFileTable()
          Returns the FileTable contained by this panel.
 FolderChangeMonitor getFolderChangeMonitor()
          Returns the FolderChangeMonitor which monitors changes in the current folder and automatically refreshes it.
 FolderHistory getFolderHistory()
          Returns the visited folders history, wrapped in a FolderHistory object.
 FoldersTreePanel getFoldersTreePanel()
          Returns a panel with a folders tree.
 LocationManager getLocationManager()
          Returns the LocationManager instance that notifies registered listeners of location changes that occur in this FolderPanel.
 LocationTextField getLocationTextField()
          Returns the LocationTextField contained by this panel.
 MainFrame getMainFrame()
          Returns the MainFrame that contains this panel.
 javax.swing.JScrollPane getScrollPane()
          Returns the JScrollPane that contains the FileTable component and allows it to scroll.
 int getTreeWidth()
          Returns width of a folders tree.
 boolean isFolderChanging()
          Returns true ´if the current folder is currently being changed, false otherwise.
 boolean isTreeVisible()
          Returns true if a directory tree is visible.
 void setBorderColor(java.awt.Color color)
           
 void setTreeVisible(boolean treeVisible)
          Enables/disables a directory tree visibility.
 void setTreeWidth(int width)
          Sets a width of a folders tree.
 void showQuickList(int index)
          Shows the pop up which is located the given index in fileTablePopups.
 java.lang.String toString()
          Overridden for debugging purposes.
 FolderPanel.ChangeFolderThread tryChangeCurrentFolder(AbstractFile folder)
          Tries to change the current folder to the new specified one and notifies the user in case of a problem.
 FolderPanel.ChangeFolderThread tryChangeCurrentFolder(AbstractFile folder, AbstractFile selectThisFileAfter)
          Tries to change current folder to the new specified one, and select the given file after the folder has been changed.
 FolderPanel.ChangeFolderThread tryChangeCurrentFolder(FileURL folderURL)
          Tries to change current folder to the new specified URL and notifies the user in case of a problem.
 FolderPanel.ChangeFolderThread tryChangeCurrentFolder(FileURL folderURL, CredentialsMapping credentialsMapping)
          Tries to change current folder to the new specified path and notifies the user in case of a problem.
 FolderPanel.ChangeFolderThread tryChangeCurrentFolder(java.lang.String folderPath)
          Tries to change the current folder to the specified path and notifies the user in case of a problem.
 FolderPanel.ChangeFolderThread tryRefreshCurrentFolder()
          Tries to refresh the current folder's contents and notifies the user in case of a problem.
 FolderPanel.ChangeFolderThread tryRefreshCurrentFolder(AbstractFile selectThisFileAfter)
          Refreshes current folder's contents and notifies the user if the current folder could not be refreshed.
 void undimBackground()
          Stops dimming the scrollpane's background (returns to a normal background color), called by FileTable.QuickSearch when a quick search is over.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, update
 
Methods inherited from class java.awt.Container
add, 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, 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, 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, hide, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

recentLocationsQL

protected static RecentLocationsQL recentLocationsQL

recentExecutedFilesQL

protected static RecentExecutedFilesQL recentExecutedFilesQL

bookmarksQL

protected static BookmarksQL bookmarksQL

PARENT_FOLDERS_QUICK_LIST_INDEX

public static final int PARENT_FOLDERS_QUICK_LIST_INDEX
See Also:
Constant Field Values

RECENT_ACCESSED_LOCATIONS_QUICK_LIST_INDEX

public static final int RECENT_ACCESSED_LOCATIONS_QUICK_LIST_INDEX
See Also:
Constant Field Values

RECENT_EXECUTED_FILES_QUICK_LIST_INDEX

public static final int RECENT_EXECUTED_FILES_QUICK_LIST_INDEX
See Also:
Constant Field Values

BOOKMARKS_QUICK_LIST_INDEX

public static final int BOOKMARKS_QUICK_LIST_INDEX
See Also:
Constant Field Values
Method Detail

getFileDragSourceListener

public FileDragSourceListener getFileDragSourceListener()

getMainFrame

public MainFrame getMainFrame()
Returns the MainFrame that contains this panel.

Returns:
the MainFrame that contains this panel

getFileTable

public FileTable getFileTable()
Returns the FileTable contained by this panel.

Returns:
the FileTable contained by this panel

getScrollPane

public javax.swing.JScrollPane getScrollPane()
Returns the JScrollPane that contains the FileTable component and allows it to scroll.

Returns:
the JScrollPane that contains the FileTable component and allows it to scroll

getLocationTextField

public LocationTextField getLocationTextField()
Returns the LocationTextField contained by this panel.

Returns:
the LocationTextField contained by this panel

getDriveButton

public DrivePopupButton getDriveButton()
Returns the DrivePopupButton contained by this panel.

Returns:
the DrivePopupButton contained by this panel

getFolderHistory

public FolderHistory getFolderHistory()
Returns the visited folders history, wrapped in a FolderHistory object.

Returns:
the visited folders history, wrapped in a FolderHistory object

getLocationManager

public LocationManager getLocationManager()
Returns the LocationManager instance that notifies registered listeners of location changes that occur in this FolderPanel.

Returns:
the LocationManager instance that notifies registered listeners of location changes that occur in this FolderPanel

changeCurrentLocation

public void changeCurrentLocation()
Allows the user to easily change the current folder and type a new one: requests focus on the location field and selects the folder string.


getCurrentFolder

public AbstractFile getCurrentFolder()
Returns the folder that is currently being displayed by this panel.

Returns:
the folder that is currently being displayed by this panel

tryChangeCurrentFolder

public FolderPanel.ChangeFolderThread tryChangeCurrentFolder(AbstractFile folder)
Tries to change the current folder to the new specified one and notifies the user in case of a problem.

This method spawns a separate thread that takes care of the actual folder change and returns it. It does nothing and returns null if another folder change is already underway.

This method is not I/O-bound and returns immmediately without any chance of locking the calling thread.

Parameters:
folder - the folder to be made current folder
Returns:
the thread that performs the actual folder change, null if another folder change is already underway

tryChangeCurrentFolder

public FolderPanel.ChangeFolderThread tryChangeCurrentFolder(AbstractFile folder,
                                                             AbstractFile selectThisFileAfter)
Tries to change current folder to the new specified one, and select the given file after the folder has been changed. The user is notified by a dialog if the folder could not be changed.

This method spawns a separate thread that takes care of the actual folder change and returns it. It does nothing and returns null if another folder change is already underway.

This method is not I/O-bound and returns immmediately without any chance of locking the calling thread.

Parameters:
folder - the folder to be made current folder
selectThisFileAfter - the file to be selected after the folder has been changed (if it exists in the folder), can be null in which case FileTable rules will be used to select current file
Returns:
the thread that performs the actual folder change, null if another folder change is already underway

tryChangeCurrentFolder

public FolderPanel.ChangeFolderThread tryChangeCurrentFolder(java.lang.String folderPath)
Tries to change the current folder to the specified path and notifies the user in case of a problem.

This method spawns a separate thread that takes care of the actual folder change and returns it. It does nothing and returns null if another folder change is already underway or if the given path could not be resolved.

This method is not I/O-bound and returns immmediately without any chance of locking the calling thread.

Parameters:
folderPath - path to the new current folder. If this path does not resolve into a file, an error message will be displayed.
Returns:
the thread that performs the actual folder change, null if another folder change is already underway or if the given path could not be resolved

tryChangeCurrentFolder

public FolderPanel.ChangeFolderThread tryChangeCurrentFolder(FileURL folderURL)
Tries to change current folder to the new specified URL and notifies the user in case of a problem.

This method spawns a separate thread that takes care of the actual folder change and returns it. It does nothing and returns null if another folder change is already underway.

This method is not I/O-bound and returns immmediately without any chance of locking the calling thread.

Parameters:
folderURL - location to the new current folder. If this URL does not resolve into a file, an error message will be displayed.
Returns:
the thread that performs the actual folder change, null if another folder change is already underway

tryChangeCurrentFolder

public FolderPanel.ChangeFolderThread tryChangeCurrentFolder(FileURL folderURL,
                                                             CredentialsMapping credentialsMapping)
Tries to change current folder to the new specified path and notifies the user in case of a problem. If not null, the specified CredentialsMapping is used to authenticate the folder, and added to CredentialsManager if the folder has been successfully changed.

This method spawns a separate thread that takes care of the actual folder change and returns it. It does nothing and returns null if another folder change is already underway.

This method is not I/O-bound and returns immmediately without any chance of locking the calling thread.

Parameters:
folderURL - folder's URL to be made current folder. If this URL does not resolve into an existing file, an error message will be displayed.
credentialsMapping - the CredentialsMapping to use for authentication, can be null
Returns:
the thread that performs the actual folder change, null if another folder change is already underway

tryRefreshCurrentFolder

public FolderPanel.ChangeFolderThread tryRefreshCurrentFolder()
Tries to refresh the current folder's contents and notifies the user in case of a problem.

This method spawns a separate thread that takes care of the actual folder change and returns it. It does nothing and returns null if another folder change is already underway.

This method is not I/O-bound and returns immmediately without any chance of locking the calling thread.

Returns:
the thread that performs the actual folder change, null if another folder change is already underway

tryRefreshCurrentFolder

public FolderPanel.ChangeFolderThread tryRefreshCurrentFolder(AbstractFile selectThisFileAfter)
Refreshes current folder's contents and notifies the user if the current folder could not be refreshed.

This method spawns a separate thread that takes care of the actual folder change and returns it. It does nothing and returns null if another folder change is already underway.

This method is not I/O-bound and returns immmediately without any chance of locking the calling thread.

Parameters:
selectThisFileAfter - file to be selected after the folder has been refreshed (if it exists in the folder), can be null in which case FileTable rules will be used to select current file
Returns:
the thread that performs the actual folder change, null if another folder change is already underway

isFolderChanging

public boolean isFolderChanging()
Returns true ´if the current folder is currently being changed, false otherwise.

Returns:
true ´if the current folder is currently being changed, false otherwise

getChangeFolderThread

public FolderPanel.ChangeFolderThread getChangeFolderThread()
Returns the thread that is currently changing the current folder, null is the folder is not being changed.

Returns:
the thread that is currently changing the current folder, null is the folder is not being changed

getFolderChangeMonitor

public FolderChangeMonitor getFolderChangeMonitor()
Returns the FolderChangeMonitor which monitors changes in the current folder and automatically refreshes it.

Returns:
the FolderChangeMonitor which monitors changes in the current folder and automatically refreshes it

dimBackground

public void dimBackground()
Dims the scrollpane's background, called by FileTable.QuickSearch when a quick search is started.


undimBackground

public void undimBackground()
Stops dimming the scrollpane's background (returns to a normal background color), called by FileTable.QuickSearch when a quick search is over.


toString

public java.lang.String toString()
Overridden for debugging purposes.

Overrides:
toString in class java.awt.Component

setBorderColor

public void setBorderColor(java.awt.Color color)

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

configurationChanged

public void configurationChanged(ConfigurationEvent event)
Listens to certain configuration variables.

Specified by:
configurationChanged in interface ConfigurationListener
Parameters:
event - describes the configuration modification.

colorChanged

public void colorChanged(ColorChangedEvent event)
Receives theme color changes notifications.

Specified by:
colorChanged in interface ThemeListener

fontChanged

public void fontChanged(FontChangedEvent event)
Not used.

Specified by:
fontChanged in interface ThemeListener

showQuickList

public void showQuickList(int index)
Shows the pop up which is located the given index in fileTablePopups.

Parameters:
index - - index of the FileTablePopup in fileTablePopups.

isTreeVisible

public boolean isTreeVisible()
Returns true if a directory tree is visible.


getTreeWidth

public int getTreeWidth()
Returns width of a folders tree.

Returns:
a width of a folders tree

setTreeWidth

public void setTreeWidth(int width)
Sets a width of a folders tree.

Parameters:
width - new width

getFoldersTreePanel

public FoldersTreePanel getFoldersTreePanel()
Returns a panel with a folders tree.

Returns:
a panel with a folders tree

setTreeVisible

public void setTreeVisible(boolean treeVisible)
Enables/disables a directory tree visibility. Invoked by ToggleTreeAction.



This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard