Class Binding


  • public class Binding
    extends Object
    Represents a key binding Bindings can be toggleable or not and can be inverted or not. An inverted binding just means that when pressed it will output false rather than true this makes it possible to represent a negative event X stops doing Y as well as positive events X does Y in the final output.
    Version:
    $Revision$
    Author:
    sjb90
    • Field Detail

      • m_Name

        protected String m_Name
        the name of the binding
      • m_Binding

        protected KeyStroke m_Binding
        the keystroke the name is bound to
      • m_Toggleable

        protected boolean m_Toggleable
        is the binding toggleable?
      • m_Inverted

        protected boolean m_Inverted
        is the binding inverted
      • m_Interval

        protected long m_Interval
        the interval to repete a toggleable binding
    • Constructor Detail

      • Binding

        public Binding​(String name,
                       String binding,
                       boolean toggle,
                       long interval,
                       boolean inverted)
                throws InvalidKeyException
        Constructor for the binding class.
        Parameters:
        name - the name of the binding
        binding - the key to bind to in String format
        toggle - is this binding toggleable
        inverted - is this binding inverted
        Throws:
        InvalidKeyException
      • Binding

        public Binding​(String name,
                       KeyStroke binding,
                       boolean toggle,
                       long interval,
                       boolean inverted)
                throws InvalidKeyException
        Constructor for the binding class.
        Parameters:
        name - the name of the binding
        binding - the key to bind to as a KeyStroke
        toggle - is this binding toggleable
        inverted - is this binding inverted
        Throws:
        InvalidKeyException
    • Method Detail

      • getName

        public String getName()
        getter for the name of the binding
        Returns:
        the name of the binding
      • getBinding

        public KeyStroke getBinding()
        getter for the keystroke of the binding
        Returns:
        the keystroke for this binding
      • isToggleable

        public boolean isToggleable()
        getter for the toggleable option
        Returns:
        true if this binding is toggleable
      • isInverted

        public boolean isInverted()
        getter for the inverted option
        Returns:
        true if this binding is inverted
      • toProperty

        public adams.core.Properties toProperty​(int prefix)
        Turns this Binding into a property
        Returns:
        a Properties object representing this key binding.
      • getInterval

        public long getInterval()
        a getter for the interval for this binding
        Returns:
        the interval for this binding