Class MappedAction

java.lang.Object
se.datadosen.util.MappedAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, javax.swing.Action

public class MappedAction
extends java.lang.Object
implements javax.swing.Action
Since:
15
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.Map<java.beans.PropertyChangeListener,​java.beans.PropertyChangeListener> map  
    protected java.util.Map<java.lang.String,​java.lang.String> mapping  
    protected java.util.Map<java.lang.String,​java.lang.String> reverseMapping  
    protected javax.swing.Action target  

    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

    Constructors 
    Constructor Description
    MappedAction​(javax.swing.Action target)  
    MappedAction​(javax.swing.Action target, java.lang.String from, java.lang.String to)
    Map Action constants, for instance Action.NAME to Action.SHORT_DESCRIPTION
  • Method Summary

    Modifier and Type Method Description
    void actionPerformed​(java.awt.event.ActionEvent e)  
    void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)  
    java.lang.Object getValue​(java.lang.String key)  
    boolean isEnabled()  
    MappedAction map​(java.lang.String from, java.lang.String to)
    Add another mapping
    static MappedAction nameToToolTip​(javax.swing.Action a)
    Convenience constructor suitable when tying buttons to actions where one doesn't want button text
    static MappedAction noIcon​(javax.swing.Action a)
    Convenience constructor suitable when tying menus to actions where one doesn't want icons
    void putValue​(java.lang.String key, java.lang.Object value)  
    void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)  
    void setEnabled​(boolean b)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface javax.swing.Action

    accept
  • Field Details

    • target

      protected javax.swing.Action target
    • mapping

      protected java.util.Map<java.lang.String,​java.lang.String> mapping
    • reverseMapping

      protected java.util.Map<java.lang.String,​java.lang.String> reverseMapping
    • map

      protected java.util.Map<java.beans.PropertyChangeListener,​java.beans.PropertyChangeListener> map
  • Constructor Details

    • MappedAction

      public MappedAction​(javax.swing.Action target)
    • MappedAction

      public MappedAction​(javax.swing.Action target, java.lang.String from, java.lang.String to)
      Map Action constants, for instance Action.NAME to Action.SHORT_DESCRIPTION
      Parameters:
      target -
      from -
      to -
  • Method Details

    • map

      public MappedAction map​(java.lang.String from, java.lang.String to)
      Add another mapping
      Parameters:
      from -
      to -
      Returns:
    • getValue

      public java.lang.Object getValue​(java.lang.String key)
      Specified by:
      getValue in interface javax.swing.Action
    • putValue

      public void putValue​(java.lang.String key, java.lang.Object value)
      Specified by:
      putValue in interface javax.swing.Action
    • setEnabled

      public void setEnabled​(boolean b)
      Specified by:
      setEnabled in interface javax.swing.Action
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface javax.swing.Action
    • addPropertyChangeListener

      public void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
      Specified by:
      addPropertyChangeListener in interface javax.swing.Action
    • removePropertyChangeListener

      public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
      Specified by:
      removePropertyChangeListener in interface javax.swing.Action
    • actionPerformed

      public void actionPerformed​(java.awt.event.ActionEvent e)
      Specified by:
      actionPerformed in interface java.awt.event.ActionListener
    • nameToToolTip

      public static MappedAction nameToToolTip​(javax.swing.Action a)
      Convenience constructor suitable when tying buttons to actions where one doesn't want button text
    • noIcon

      public static MappedAction noIcon​(javax.swing.Action a)
      Convenience constructor suitable when tying menus to actions where one doesn't want icons