Class BeanPropertyKnob
- java.lang.Object
-
- cern.accsoft.steering.jmad.domain.knob.AbstractKnob
-
- cern.accsoft.steering.jmad.domain.knob.bean.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.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.lang.String
createKey(java.lang.Object bean, java.lang.String propertyName)
create a key for this bean- propertyName combinationprotected void
doSetTotalValue(double value)
has to be implemented by subclass to set the total value to madx.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.java.lang.String
getKey()
java.lang.String
getName()
static java.lang.String
getPropertyNameFromKey(java.lang.String key)
extracts the property-name from the keydouble
getTotalValue()
-
Methods inherited from class cern.accsoft.steering.jmad.domain.knob.AbstractKnob
addListener, getOffset, getValue, removeListener, setOffset, setValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface cern.accsoft.steering.jmad.domain.knob.Knob
getDescription, getType
-
-
-
-
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
-
-
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 propertypropertyName
- 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 classAbstractKnob
- 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
-
-