com.mucommander.ui.action
Class FileAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by com.mucommander.ui.action.MuAction
          extended by com.mucommander.ui.action.FileAction
All Implemented Interfaces:
ActivePanelListener, TableSelectionListener, java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
SelectedFileAction

public abstract class FileAction
extends MuAction
implements TableSelectionListener, ActivePanelListener

FileAction is an abstract action that operates on the currently active FileTable. It is enabled only when the table condition as tested by getFileTableCondition() method is satisfied.

Those tests are performed when:

Author:
Maxence Bernard
See Also:
Serialized Form

Field Summary
protected  FileFilter filter
          Filter that restricts the enabled condition to files that match it (can be null)
 
Fields inherited from class com.mucommander.ui.action.MuAction
ALTERNATE_ACCELERATOR_PROPERTY_KEY, mainFrame
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
FileAction(MainFrame mainFrame, java.util.Hashtable properties)
           
 
Method Summary
 void activePanelChanged(FolderPanel folderPanel)
          This method is invoked when the currently active (i.e.
protected abstract  boolean getFileTableCondition(FileTable fileTable)
          This method is called to determine if the current FileTable state allows this action to be enabled.
 void markedFilesChanged(FileTable source)
          Updates this action's enabled status based on the new currently marked files.
 void selectedFileChanged(FileTable source)
          Updates this action's enabled status based on the new currently selected file.
protected  void updateEnabledState(FileTable fileTable)
          Enables/disables this action if both of the getFileTableCondition(FileTable) and file filter (if there is one) tests are satisfied.
 
Methods inherited from class com.mucommander.ui.action.MuAction
actionPerformed, getAccelerator, getAcceleratorText, getAlternateAccelerator, getIcon, getKeyStrokeRepresentation, getLabel, getMainFrame, getModifiersRepresentation, getStandardAccelerator, getStandardAccelerator, getStandardAlternateAccelerator, getStandardAlternateAccelerator, getStandardIcon, getStandardIcon, getStandardIconPath, getStandardIconPath, getStandardLabel, getStandardLabel, getStandardLabelKey, getStandardLabelKey, getStandardTooltip, getStandardTooltip, getStandardTooltipKey, getStandardTooltipKey, getToolTipText, honourNoEventsMode, isAccelerator, performAction, performActionInSeparateThread, reportError, reportError, reportGenericError, setAccelerator, setAlternateAccelerator, setHonourNoEventsMode, setIcon, setLabel, setPerformActionInSeparateThread, setToolTipText
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter

protected FileFilter filter
Filter that restricts the enabled condition to files that match it (can be null)

Constructor Detail

FileAction

public FileAction(MainFrame mainFrame,
                  java.util.Hashtable properties)
Method Detail

updateEnabledState

protected void updateEnabledState(FileTable fileTable)
Enables/disables this action if both of the getFileTableCondition(FileTable) and file filter (if there is one) tests are satisfied.

This method is called each time:

Parameters:
fileTable - the currently active FileTable

getFileTableCondition

protected abstract boolean getFileTableCondition(FileTable fileTable)
This method is called to determine if the current FileTable state allows this action to be enabled. If false is returned, the action will be disabled. If true is returned, the action will be enabled if the file filter (if there is one) matches the selected file.

Parameters:
fileTable - currently active FileTable

selectedFileChanged

public void selectedFileChanged(FileTable source)
Updates this action's enabled status based on the new currently selected file.

Specified by:
selectedFileChanged in interface TableSelectionListener
Parameters:
source - the FileTable instance on which the file selection has changed

markedFilesChanged

public void markedFilesChanged(FileTable source)
Updates this action's enabled status based on the new currently marked files.

Specified by:
markedFilesChanged in interface TableSelectionListener
Parameters:
source - the FileTable instance on which the files marked have changed

activePanelChanged

public void activePanelChanged(FolderPanel folderPanel)
Description copied from interface: ActivePanelListener
This method is invoked when the currently active (i.e. that has focus) folder panel has changed on the MainFrame.

Specified by:
activePanelChanged in interface ActivePanelListener
Parameters:
folderPanel - the new active FolderPanel.


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