Class BaseAction

    • Field Summary

      • 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

      Constructors 
      Constructor Description
      BaseAction​(java.lang.String bundleKey)  
      BaseAction​(java.lang.String bundleKey, javax.swing.Icon icon)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static BaseAction create​(java.lang.String bundleKey, javax.swing.Icon icon, java.lang.Runnable action)  
      static javax.swing.JButton createButton​(java.lang.String bundleKey)  
      static javax.swing.JButton createButton​(java.lang.String bundleKey, javax.swing.Icon icon)
      Handy static function for when an Action isn't appropriate.
      protected boolean evaluateEnabled()
      Evaluates whether or not the action should be enabled
      void listenTo​(javax.swing.AbstractButton button)  
      void listenTo​(javax.swing.ListSelectionModel model)
      Sets up a listener so that every time the list selection model changes, the action's enabledness is re-evaluted
      void setBundleKey​(java.lang.String bundleKey)  
      void setIcon​(javax.swing.Icon icon)  
      void updateEnabled()  
      • 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
      • Methods inherited from interface javax.swing.Action

        accept
      • Methods inherited from interface java.awt.event.ActionListener

        actionPerformed
    • Constructor Detail

      • BaseAction

        public BaseAction​(java.lang.String bundleKey)
      • BaseAction

        public BaseAction​(java.lang.String bundleKey,
                          javax.swing.Icon icon)
        Parameters:
        bundleKey - A base key for looking up this action's name, description, mnemonic, and accelerator.
        • bundleKey Will be used for the action's command value
        • bundleKey + ".Name" Will be used for the action's name
        • bundleKey + ".Desc" Will be used for the action's short and long description
        • bundleKey + ".Mnemonic" Will be used for the action's mnemonic. Must be 1 character long. Optional.
        • bundleKey + ".Accel" Will be used for the action's accelerator. See KeyStroke.getKeyStroke(String). Optional.
        icon - An icon to display for this action.
    • Method Detail

      • create

        public static BaseAction create​(java.lang.String bundleKey,
                                        javax.swing.Icon icon,
                                        java.lang.Runnable action)
      • setBundleKey

        public void setBundleKey​(java.lang.String bundleKey)
      • setIcon

        public void setIcon​(javax.swing.Icon icon)
      • createButton

        public static javax.swing.JButton createButton​(java.lang.String bundleKey)
      • createButton

        public static javax.swing.JButton createButton​(java.lang.String bundleKey,
                                                       javax.swing.Icon icon)
        Handy static function for when an Action isn't appropriate. Uses the same key logic is BaseAction()
      • listenTo

        public void listenTo​(javax.swing.ListSelectionModel model)
        Sets up a listener so that every time the list selection model changes, the action's enabledness is re-evaluted
      • listenTo

        public void listenTo​(javax.swing.AbstractButton button)
      • updateEnabled

        public void updateEnabled()
      • evaluateEnabled

        protected boolean evaluateEnabled()
        Evaluates whether or not the action should be enabled