Package xal.app.knobs
Class KnobGroup
- java.lang.Object
-
- xal.app.knobs.KnobGroup
-
- All Implemented Interfaces:
Comparable<KnobGroup>,KnobListener,xal.tools.data.DataListener
- Direct Known Subclasses:
MainKnobGroup
public class KnobGroup extends Object implements Comparable<KnobGroup>, xal.tools.data.DataListener, KnobListener
Group of knobs
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Knob>_knobsThe list of knobs in this groupprotected String_labelThe label for this groupstatic StringDATA_LABELThe DataAdaptor labelprotected KnobGroupListenerEVENT_PROXYThe proxy for posting KnobGroupListener eventsprotected xal.tools.messaging.MessageCenterMESSAGE_CENTERThe message center for this group's originated events
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddKnob(Knob knob)Add a knob to this group and notify listenersvoidaddKnobGroupListener(KnobGroupListener listener)Add a listener of KnobGroupListener events generated by this AppGroupvoidaddKnobs(Collection<Knob> knobs)Add the collection of knobs to this group and notify listenersbooleanallowsLabelEdit()Determine if the group allows editing of its labelintcompareTo(KnobGroup group)Compare two instances.booleancontains(Knob knob)Determine if this group contains the specified knobvoidcurrentSettingChanged(Knob knob, double value)event indicating that the knob's current value setting has changedStringdataLabel()dataLabel() provides the name used to identify the class in an external data source.voidelementAdded(Knob knob, KnobElement element)event indicating that an element has been addedvoidelementModified(Knob knob, KnobElement element)event indicating that the specified knob element has been modifiedvoidelementRemoved(Knob knob, KnobElement element)event indicating that an element has been removedKnobgetKnob(int index)Get the knob at the specified indexintgetKnobCount()Get the count of knobs in this groupList<Knob>getKnobs()Get the list of this group's applicationsStringgetLabel()Get the label for this groupvoidlimitsChanged(Knob knob, double lowerLimit, double upperLimit)event indicating that the knob's limits have changedvoidnameChanged(Knob knob, String newName)event indicating that the specified knob's name has changedvoidreadyStateChanged(Knob knob, boolean isReady)ready state changedvoidremoveKnob(Knob knob)Remove the specified knob from this group and notify listenersvoidremoveKnobGroupListener(KnobGroupListener listener)Remove a listener of KnobGroupListener events generated by this AppGroupvoidremoveKnobs(List<Knob> knobs)Remove the specified knob from this group and notify listenersvoidsetLabel(String label)Set the label for this groupprotected voidsortKnobs()Sort the knobs alphabeticallyStringtoString()Provide a string representation of the group.voidupdate(xal.tools.data.DataAdaptor adaptor)Instructs the receiver to update its data based on the given adaptor.voidvalueSettingPublished(Knob knob)event indicating that the knob's most previously pending set operation has completedvoidwrite(xal.tools.data.DataAdaptor adaptor)Instructs the receiver to write its data to the adaptor for external storage.
-
-
-
Field Detail
-
DATA_LABEL
public static final String DATA_LABEL
The DataAdaptor label- See Also:
- Constant Field Values
-
MESSAGE_CENTER
protected final xal.tools.messaging.MessageCenter MESSAGE_CENTER
The message center for this group's originated events
-
EVENT_PROXY
protected final KnobGroupListener EVENT_PROXY
The proxy for posting KnobGroupListener events
-
_label
protected String _label
The label for this group
-
-
Method Detail
-
dataLabel
public String dataLabel()
dataLabel() provides the name used to identify the class in an external data source.- Specified by:
dataLabelin interfacexal.tools.data.DataListener- Returns:
- The tag for this data node.
-
update
public void update(xal.tools.data.DataAdaptor adaptor)
Instructs the receiver to update its data based on the given adaptor.- Specified by:
updatein interfacexal.tools.data.DataListener- Parameters:
adaptor- The data adaptor corresponding to this object's data node.
-
write
public void write(xal.tools.data.DataAdaptor adaptor)
Instructs the receiver to write its data to the adaptor for external storage.- Specified by:
writein interfacexal.tools.data.DataListener- Parameters:
adaptor- The data adaptor corresponding to this object's data node.
-
addKnobGroupListener
public void addKnobGroupListener(KnobGroupListener listener)
Add a listener of KnobGroupListener events generated by this AppGroup- Parameters:
listener- The listener to add
-
removeKnobGroupListener
public void removeKnobGroupListener(KnobGroupListener listener)
Remove a listener of KnobGroupListener events generated by this AppGroup- Parameters:
listener- The listener to remove
-
getLabel
public String getLabel()
Get the label for this group- Returns:
- this group's label
-
setLabel
public void setLabel(String label)
Set the label for this group- Parameters:
label- The new label for this group
-
allowsLabelEdit
public boolean allowsLabelEdit()
Determine if the group allows editing of its label- Returns:
- true
-
getKnob
public Knob getKnob(int index)
Get the knob at the specified index- Parameters:
index- The index of the knob to get- Returns:
- The knob at the index in this group's list
-
getKnobs
public List<Knob> getKnobs()
Get the list of this group's applications- Returns:
- The list of this group's applications
-
getKnobCount
public int getKnobCount()
Get the count of knobs in this group- Returns:
- the count of knobs in this group
-
contains
public boolean contains(Knob knob)
Determine if this group contains the specified knob- Parameters:
knob- The knob for which to check- Returns:
- true if this group contains the knob and false if not
-
addKnobs
public void addKnobs(Collection<Knob> knobs)
Add the collection of knobs to this group and notify listeners- Parameters:
knobs- The collection of knobs to add
-
addKnob
public void addKnob(Knob knob)
Add a knob to this group and notify listeners- Parameters:
knob- The knob to add
-
removeKnobs
public void removeKnobs(List<Knob> knobs)
Remove the specified knob from this group and notify listeners- Parameters:
knobs- The knobs to remove
-
removeKnob
public void removeKnob(Knob knob)
Remove the specified knob from this group and notify listeners- Parameters:
knob- The knob to remove
-
toString
public String toString()
Provide a string representation of the group.- Overrides:
toStringin classObject- Returns:
- the group's label
- See Also:
getLabel()
-
sortKnobs
protected void sortKnobs()
Sort the knobs alphabetically
-
compareTo
public int compareTo(KnobGroup group)
Compare two instances. The two instances are compared by label and the comparison is based on alphebetical sorting.- Specified by:
compareToin interfaceComparable<KnobGroup>- Parameters:
group- the other object against which to compare this one- Returns:
- a positive number if this comes after the argument, negative if this comes before and 0 if they are equal
- See Also:
getLabel()
-
nameChanged
public void nameChanged(Knob knob, String newName)
event indicating that the specified knob's name has changed- Specified by:
nameChangedin interfaceKnobListener
-
readyStateChanged
public void readyStateChanged(Knob knob, boolean isReady)
ready state changed- Specified by:
readyStateChangedin interfaceKnobListener
-
limitsChanged
public void limitsChanged(Knob knob, double lowerLimit, double upperLimit)
event indicating that the knob's limits have changed- Specified by:
limitsChangedin interfaceKnobListener
-
currentSettingChanged
public void currentSettingChanged(Knob knob, double value)
event indicating that the knob's current value setting has changed- Specified by:
currentSettingChangedin interfaceKnobListener
-
valueSettingPublished
public void valueSettingPublished(Knob knob)
event indicating that the knob's most previously pending set operation has completed- Specified by:
valueSettingPublishedin interfaceKnobListener
-
elementAdded
public void elementAdded(Knob knob, KnobElement element)
event indicating that an element has been added- Specified by:
elementAddedin interfaceKnobListener
-
elementRemoved
public void elementRemoved(Knob knob, KnobElement element)
event indicating that an element has been removed- Specified by:
elementRemovedin interfaceKnobListener
-
elementModified
public void elementModified(Knob knob, KnobElement element)
event indicating that the specified knob element has been modified- Specified by:
elementModifiedin interfaceKnobListener
-
-