Class BeanPropertyKnob

  • All Implemented Interfaces:
    Knob
    Direct Known Subclasses:
    TwissInitialConditionKnob

    public abstract class BeanPropertyKnob
    extends AbstractKnob
    this class provides a knob, which just needs a bean and a property of it.

    Be careful: Remove these Knobs from all lists, when the bean shall be destroyed!

    This class is designed to be sub classed by more dedicated knobs, that have to provide the actual bean by the getBean() method.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String NAME_PROPETY_SEPARATOR
      the separator between bean-name and property-name, which is used when creating keys
    • Constructor Summary

      Constructors 
      Constructor Description
      BeanPropertyKnob​(java.lang.String propertyName)
      the constructor, which needs a property-name.
    • Field Detail

      • NAME_PROPETY_SEPARATOR

        public static final java.lang.String NAME_PROPETY_SEPARATOR
        the separator between bean-name and property-name, which is used when creating keys
        See Also:
        Constant Field Values
    • Constructor Detail

      • BeanPropertyKnob

        public BeanPropertyKnob​(java.lang.String propertyName)
        the constructor, which needs a property-name.
        Parameters:
        propertyName - the name of the property, which we will vary
    • Method Detail

      • createKey

        public static final java.lang.String createKey​(java.lang.Object bean,
                                                       java.lang.String propertyName)
        create a key for this bean- propertyName combination
        Parameters:
        bean - the on which to use the property
        propertyName - the name of the property
        Returns:
        a combined key
      • getPropertyNameFromKey

        public static final java.lang.String getPropertyNameFromKey​(java.lang.String key)
        extracts the property-name from the key
        Parameters:
        key - the key from which to extract the property name
        Returns:
        the name of the property
      • doSetTotalValue

        protected final void doSetTotalValue​(double value)
        Description copied from class: AbstractKnob
        has to be implemented by subclass to set the total value to madx. The only call from this is from setTotalValue, which also notifies the listeners.
        Specified by:
        doSetTotalValue in class AbstractKnob
        Parameters:
        value - the value to set
      • getKey

        public java.lang.String getKey()
        Returns:
        a unique key (within all knobs of the same type)
      • getName

        public java.lang.String getName()
        Returns:
        the name of the knob
      • getTotalValue

        public double getTotalValue()
        Returns:
        the total value (value+offset)
      • getBean

        protected abstract java.lang.Object getBean()
        must be implemented by subclass in order to provide the bean instance to/from which to get/set values.
        Returns:
        the bean