Class ContextAction

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
    Direct Known Subclasses:
    CopyAction

    public abstract class ContextAction
    extends javax.swing.AbstractAction
    This class encapsulates basic functions for contextmenu actions.
    Author:
    Ilja Pavkovic - illsen@gumblfarz.de
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected EventDispatcher dispatcher  
      protected java.lang.Object selected  
      protected java.util.List<?> selectedObjects  
      • 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
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void actionPerformed​(java.awt.event.ActionEvent e)  
      static <T> java.util.List<T> filterObjects​(java.util.Collection<?> selectedObjects, java.lang.Class<T> clazz)
      This method filters
      protected java.lang.String getName()
      Returns the name of this menu action.
      protected abstract java.lang.String getNameTranslated()
      These methods are now needed to keep translation in the corresponding class. they MAY deliver null!
      protected void setName​(java.lang.String name)
      Sets the name of this menu action.
      java.lang.String toString()  
      • 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, wait, wait, wait
      • Methods inherited from interface javax.swing.Action

        accept
    • Field Detail

      • selected

        protected java.lang.Object selected
      • selectedObjects

        protected java.util.List<?> selectedObjects
    • Constructor Detail

      • ContextAction

        public ContextAction​(java.lang.Object selected,
                             EventDispatcher dispatcher)
      • ContextAction

        public ContextAction​(java.lang.Object selected,
                             java.util.List<?> selectedObjects,
                             EventDispatcher dispatcher)
    • Method Detail

      • filterObjects

        public static <T> java.util.List<T> filterObjects​(java.util.Collection<?> selectedObjects,
                                                          java.lang.Class<T> clazz)
        This method filters
        Parameters:
        selectedObjects - collection of selected objects
        clazz - class to filter objects
        Returns:
        list of filtered objects
      • actionPerformed

        public abstract void actionPerformed​(java.awt.event.ActionEvent e)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setName

        protected void setName​(java.lang.String name)
        Sets the name of this menu action.
      • getName

        protected java.lang.String getName()
        Returns the name of this menu action.
      • getNameTranslated

        protected abstract java.lang.String getNameTranslated()
        These methods are now needed to keep translation in the corresponding class. they MAY deliver null!