com.bigzip.plugin
Class ArchiveAction

java.lang.Object
  |
  +--javax.swing.AbstractAction
        |
        +--com.bigzip.plugin.ArchiveAction
All Implemented Interfaces:
javax.swing.Action, java.awt.event.ActionListener, java.lang.Cloneable, java.util.EventListener, java.io.Serializable

public class ArchiveAction
extends javax.swing.AbstractAction

Archive plugins need to subclass this class to provide the user with access to the operations that can be performed on the archive. The various properties describe the action for the benifit of the user interface. The actionPerformed methods needs to be implemented and will be called when the user invokes the action through the menu bar or toolbar. The class provides convenience methods for access the properties. It is recommended that subclass implementors use these methods instead of setting and getting the properties directory to insure that the correct type of objects are stored in the properties.

See Also:
Serialized Form

Field Summary
static java.lang.String ACCELERATOR
           
static java.lang.String ANIMATED_ICON
           
static java.lang.String ICON
           
static java.lang.String MNEMONIC
           
static java.lang.String SEPARATOR_BEFORE
           
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
ArchiveAction()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Performs the action when the user chooses the action in the toolbar or menu bar.
 javax.swing.KeyStroke getAccelerator()
           
protected  ArchiveEntry[] getAllEntries()
           
 javax.swing.ImageIcon getAnimatedIcon()
           
 javax.swing.ImageIcon getAnimatedMediumIcon()
           
 javax.swing.ImageIcon getLargeIcon()
           
 java.lang.String getLongDescription()
           
 javax.swing.ImageIcon getMediumIcon()
           
 javax.swing.AbstractButton getMenuItem()
          Returns the menu item to be used in the menu.
 char getMnemonic()
           
 java.lang.String getName()
           
protected  ArchiveEntry[] getSelectedEntries()
           
 java.lang.String getShortDescription()
           
 javax.swing.ImageIcon getSmallIcon()
           
 javax.swing.AbstractButton getToolbarButton()
          Returns the button to be used on the toolbar.
 boolean isSeparatorBefore()
           
 void setAccelerator(javax.swing.KeyStroke accelerator)
          Sets the accelerator for the action.
 void setAnimatedIcon(java.awt.Image image)
          Sets the large animated icon that will represent the action.
 void setAnimatedIcon(javax.swing.ImageIcon icon)
          Sets the large animated icon that will represent the action.
 void setAnimatedIcon(java.lang.String iconPath)
          Sets the large animated icon that will represent the action.
 void setEntryTablePane(com.bigzip.plugin.EntryTablePane entryTablePane)
          Sets the entry table pane used in BiGZiP.
 void setIcon(java.awt.Image image)
          Sets the large icon that will represent the action.
 void setIcon(javax.swing.ImageIcon icon)
          Sets the large icon that will represent the action.
 void setIcon(java.lang.String iconPath)
          Sets the large icon that will represent the action.
 void setLongDescription(java.lang.String description)
          Sets the long description provided by the action.
 void setMnemonic(char mnemonic)
          Sets the mnemonic used in the menu bar.
 void setName(java.lang.String name)
          Sets the label of the action.
 void setSeparatorBefore(boolean separatorBefore)
          Sets if a separator is to be placed before the action on the menu bar.
 void setShortDescription(java.lang.String description)
          Sets the short description provided by the action.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCELERATOR

public static final java.lang.String ACCELERATOR

ANIMATED_ICON

public static final java.lang.String ANIMATED_ICON

ICON

public static final java.lang.String ICON

MNEMONIC

public static final java.lang.String MNEMONIC

SEPARATOR_BEFORE

public static final java.lang.String SEPARATOR_BEFORE
Constructor Detail

ArchiveAction

public ArchiveAction()
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Performs the action when the user chooses the action in the toolbar or menu bar. Subclasses need to implement this method to make the actions useful. The defualt implementation does nothing.
Overrides:
actionPerformed in class javax.swing.AbstractAction
Parameters:
event - The action event detailing the action.

getAccelerator

public javax.swing.KeyStroke getAccelerator()
Returns:
The accelerator for the action.

getAllEntries

protected final ArchiveEntry[] getAllEntries()
Returns:
All the entries in the file table or null if the file table is empty.

getLongDescription

public java.lang.String getLongDescription()
Returns:
The long description of the action suitable for providing context sensitive help to the user.

getMenuItem

public javax.swing.AbstractButton getMenuItem()
Returns the menu item to be used in the menu. The default implementation of this method will create a new JMenuItem. The menu bar will initialize the label, icon and tooltip text. The method will need to add an action listener (usually this) to the menu item. Subclasses can override this method to provice more appropriate menu items can as checkbox menu items.
Returns:
The menu item to be used.

getMnemonic

public char getMnemonic()
Returns:
The mnemonic used in the menu bar.

getName

public java.lang.String getName()
Returns:
The label of the action that will be displayed in menus and on toolbars.

getSelectedEntries

protected final ArchiveEntry[] getSelectedEntries()
Returns:
The entries selected in file table or null if no entries are selected.

getShortDescription

public java.lang.String getShortDescription()
Returns:
A short description of the action suitable for tooltips.

getAnimatedIcon

public javax.swing.ImageIcon getAnimatedIcon()
Returns:
A large, animated icon than can represent the action on toolbars.

getAnimatedMediumIcon

public javax.swing.ImageIcon getAnimatedMediumIcon()
Returns:
A medium, animated icon than can represent the action on toolbars. If the medium animated icon is not set then the standard icon is resized to suit.

getLargeIcon

public javax.swing.ImageIcon getLargeIcon()
Returns:
A large icon that can represent on the action on toolbars.

getMediumIcon

public javax.swing.ImageIcon getMediumIcon()
Returns:
A medium icon that can be used on the small setting version of the toolbars when small icons are selected. If the small icon has not been set then the standard icon will be resized to suit.

getSmallIcon

public javax.swing.ImageIcon getSmallIcon()
Returns:
A small icon that can be used next to the label on menu items and on toolbars when small icons are selected. If the small icon has not been set then the standard icon will be resized to suit.

getToolbarButton

public javax.swing.AbstractButton getToolbarButton()
Returns the button to be used on the toolbar. The default implementation of this method will create a new JButton. The toolbar will initialize the icon, label and tooltip text. The method will need to add an action listener (usually this) to the button. Subclasses can override this method to provide more appropriate buttons such as toggle buttons.
Returns:
The button to be used.

isSeparatorBefore

public boolean isSeparatorBefore()
Returns:
True if a separator is to be placed before the action on the menu bar.

setAccelerator

public void setAccelerator(javax.swing.KeyStroke accelerator)
Sets the accelerator for the action.
Parameters:
accelerator - The accelerator.

setLongDescription

public void setLongDescription(java.lang.String description)
Sets the long description provided by the action.
Parameters:
description - The long description.

setName

public void setName(java.lang.String name)
Sets the label of the action.
Parameters:
name - The action label.

setAnimatedIcon

public void setAnimatedIcon(javax.swing.ImageIcon icon)
Sets the large animated icon that will represent the action.
Parameters:
icon - The large animated icon, size should be 45x45 or there about.

setAnimatedIcon

public void setAnimatedIcon(java.awt.Image image)
Sets the large animated icon that will represent the action.
Parameters:
icon - The large animated icon, size should be 45x45 or there about.

setAnimatedIcon

public void setAnimatedIcon(java.lang.String iconPath)
Sets the large animated icon that will represent the action.
Parameters:
iconPath - The path to the large animated icon, size should be 45x45 or there about.

setIcon

public void setIcon(javax.swing.ImageIcon icon)
Sets the large icon that will represent the action.
Parameters:
icon - The large icon, size should be 45x45 or there about.

setIcon

public void setIcon(java.awt.Image image)
Sets the large icon that will represent the action.
Parameters:
image - The large image, size should be 45x45 or there about.

setIcon

public void setIcon(java.lang.String iconPath)
Sets the large icon that will represent the action.
Parameters:
iconPath - The path to the large icon, size should be 45x45 or there about.

setMnemonic

public void setMnemonic(char mnemonic)
Sets the mnemonic used in the menu bar.
Parameters:
mnemonic - The mnemonic.

setSeparatorBefore

public void setSeparatorBefore(boolean separatorBefore)
Sets if a separator is to be placed before the action on the menu bar.
Parameters:
separatorBefore - True if a separator is to appear.

setShortDescription

public void setShortDescription(java.lang.String description)
Sets the short description provided by the action.
Parameters:
description - The short description.

setEntryTablePane

public final void setEntryTablePane(com.bigzip.plugin.EntryTablePane entryTablePane)
Sets the entry table pane used in BiGZiP. Called by the BiGZiP when the action is added to the menu and tool bars after openning or creating an archive.