Package adams.gui.tools
Class FileCommanderPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.tools.FileCommanderPanel
-
- All Implemented Interfaces:
StatusMessageHandler,StatusMessageHandlerExt,Stoppable,StoppableWithFeedback,MenuBarProvider,ImageObserver,MenuContainer,Serializable,Accessible
public class FileCommanderPanel extends BasePanel implements MenuBarProvider, StatusMessageHandlerExt, StoppableWithFeedback
File manager with two-pane interface, similar to the Midnight Commander.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected List<AbstractFileCommanderAction>m_Actionsthe available actions.protected KeyAdapterm_ActivePanelKeyListenerthe key listener for actions on the active table.protected BaseSplitButtonm_ButtonActionthe action button.protected BaseFlatButtonm_ButtonCopythe button for copying.protected BaseFlatButtonm_ButtonDeletethe button for deleting.protected BaseFlatButtonm_ButtonDuplicatethe button for duplicating.protected BaseFlatButtonm_ButtonMkDirthe button for creating a directory.protected BaseFlatButtonm_ButtonMovethe button for moving.protected BaseFlatButtonm_ButtonQuitthe button for quitting.protected BaseFlatButtonm_ButtonReloadthe button for reloading the files.protected BaseFlatButtonm_ButtonRenamethe button for renaming.protected BaseFlatButtonm_ButtonStopthe button for stopping an operation.protected BaseFlatButtonm_ButtonViewthe button for viewing the file.protected FileOperationsm_FileOperationsthe current file operations.protected FileCommanderDirectoryPanelm_FilesActivethe active panel.protected FileCommanderDirectoryPanelm_FilesInactivethe inactive panel.protected JMenuBarm_MenuBarthe menubar.protected JMenuItemm_MenuItemLeftShowHiddenwhether left panel shows hidden files.protected JMenuItemm_MenuItemRightShowHiddenwhether right panel shows hidden files.protected JPanelm_PanelButtonsthe panel with the buttons.protected FileCommanderDirectoryPanelm_PanelLeftthe left panel.protected FileCommanderDirectoryPanelm_PanelRightthe right panel.protected BaseStatusBarm_StatusBarthe statusbar.protected booleanm_Stoppedwhether the operation was stopped by the user.protected SwingWorkerm_Workerthe worker thread.-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors Constructor Description FileCommanderPanel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidchooserChanged(FileCommanderDirectoryPanel source)Gets called when a panel's chooser changes.voidcopy()Copies the selected files/dirs to the other directory.voiddelete()Deletes the selected files/dirs.voidduplicate()Duplicates the selected file/dir.protected voidfinishInit()Finishes the initialization.FileCommanderDirectoryPanelgetActive()Returns the currently active panel.StringgetDirectory(boolean left)Returns the current directory.FileCommanderDirectoryPanelgetInactive()Returns the currently inactive panel.JMenuBargetMenuBar()Creates a menu bar (singleton per panel object).protected voidinitGUI()Initializes the widgets.protected voidinitialize()Initializes the members.booleanisBusy()Returns whether we're currently busy.booleanisStopped()Whether the execution has been stopped.voidmkdir()Creates a new directory.voidmove()Moves multiple selected files/dirs to the other directory.voidquit()Closes the commander.protected voidreload()Reloads the files.voidrename()Renames a file/dir.voidsetActive(FileCommanderDirectoryPanel active)Updates the active state of the panel.voidsetDirectory(String dir, boolean left)Sets the current directory.protected voidsetFilter(boolean left)Prompts the user to enter a regular expression as filter.voidshowStatus(boolean left, String msg)Displays a message.voidshowStatus(String msg)Displays a message.voidstopExecution()Stops the execution.protected voidupdateButtons()Updates the state of the buttons.protected voidupdateFileOperations()Updates the file operations object.protected voidview()Views the selected file.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
m_PanelLeft
protected FileCommanderDirectoryPanel m_PanelLeft
the left panel.
-
m_PanelRight
protected FileCommanderDirectoryPanel m_PanelRight
the right panel.
-
m_FilesActive
protected FileCommanderDirectoryPanel m_FilesActive
the active panel.
-
m_FilesInactive
protected FileCommanderDirectoryPanel m_FilesInactive
the inactive panel.
-
m_PanelButtons
protected JPanel m_PanelButtons
the panel with the buttons.
-
m_ButtonReload
protected BaseFlatButton m_ButtonReload
the button for reloading the files.
-
m_ButtonRename
protected BaseFlatButton m_ButtonRename
the button for renaming.
-
m_ButtonView
protected BaseFlatButton m_ButtonView
the button for viewing the file.
-
m_ButtonCopy
protected BaseFlatButton m_ButtonCopy
the button for copying.
-
m_ButtonDuplicate
protected BaseFlatButton m_ButtonDuplicate
the button for duplicating.
-
m_ButtonMove
protected BaseFlatButton m_ButtonMove
the button for moving.
-
m_ButtonMkDir
protected BaseFlatButton m_ButtonMkDir
the button for creating a directory.
-
m_ButtonDelete
protected BaseFlatButton m_ButtonDelete
the button for deleting.
-
m_ButtonAction
protected BaseSplitButton m_ButtonAction
the action button.
-
m_ButtonStop
protected BaseFlatButton m_ButtonStop
the button for stopping an operation.
-
m_ButtonQuit
protected BaseFlatButton m_ButtonQuit
the button for quitting.
-
m_StatusBar
protected BaseStatusBar m_StatusBar
the statusbar.
-
m_MenuBar
protected JMenuBar m_MenuBar
the menubar.
-
m_MenuItemLeftShowHidden
protected JMenuItem m_MenuItemLeftShowHidden
whether left panel shows hidden files.
-
m_MenuItemRightShowHidden
protected JMenuItem m_MenuItemRightShowHidden
whether right panel shows hidden files.
-
m_Worker
protected SwingWorker m_Worker
the worker thread.
-
m_Actions
protected List<AbstractFileCommanderAction> m_Actions
the available actions.
-
m_FileOperations
protected FileOperations m_FileOperations
the current file operations.
-
m_Stopped
protected boolean m_Stopped
whether the operation was stopped by the user.
-
m_ActivePanelKeyListener
protected KeyAdapter m_ActivePanelKeyListener
the key listener for actions on the active table.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classBasePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInitin classBasePanel
-
setActive
public void setActive(FileCommanderDirectoryPanel active)
Updates the active state of the panel.- Parameters:
active- the new active panel
-
updateButtons
protected void updateButtons()
Updates the state of the buttons.
-
getMenuBar
public JMenuBar getMenuBar()
Creates a menu bar (singleton per panel object). Can be used in frames.- Specified by:
getMenuBarin interfaceMenuBarProvider- Returns:
- the menu bar
-
isBusy
public boolean isBusy()
Returns whether we're currently busy.- Returns:
- true if busy
-
setDirectory
public void setDirectory(String dir, boolean left)
Sets the current directory.- Parameters:
dir- the directory to useleft- if true the left panel gets updated
-
getDirectory
public String getDirectory(boolean left)
Returns the current directory.- Parameters:
left- if true the directory of the left panel is retrieved- Returns:
- the current directory
-
reload
protected void reload()
Reloads the files.
-
view
protected void view()
Views the selected file.
-
copy
public void copy()
Copies the selected files/dirs to the other directory.
-
duplicate
public void duplicate()
Duplicates the selected file/dir. Only for local files/dirs.
-
rename
public void rename()
Renames a file/dir.
-
move
public void move()
Moves multiple selected files/dirs to the other directory.
-
mkdir
public void mkdir()
Creates a new directory.
-
delete
public void delete()
Deletes the selected files/dirs.
-
quit
public void quit()
Closes the commander.
-
setFilter
protected void setFilter(boolean left)
Prompts the user to enter a regular expression as filter.- Parameters:
left- whether to apply it to the left or right panel
-
getActive
public FileCommanderDirectoryPanel getActive()
Returns the currently active panel.- Returns:
- the active panel
-
getInactive
public FileCommanderDirectoryPanel getInactive()
Returns the currently inactive panel.- Returns:
- the inactive panel
-
showStatus
public void showStatus(String msg)
Displays a message.- Specified by:
showStatusin interfaceStatusMessageHandler- Parameters:
msg- the message to display
-
showStatus
public void showStatus(boolean left, String msg)Displays a message.- Specified by:
showStatusin interfaceStatusMessageHandlerExt- Parameters:
left- whether to show the message on the left or rightmsg- the message to display
-
updateFileOperations
protected void updateFileOperations()
Updates the file operations object.
-
chooserChanged
protected void chooserChanged(FileCommanderDirectoryPanel source)
Gets called when a panel's chooser changes.- Parameters:
source- the panel that triggered the event
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceStoppable
-
isStopped
public boolean isStopped()
Whether the execution has been stopped.- Specified by:
isStoppedin interfaceStoppableWithFeedback- Returns:
- true if stopped
-
-