Package xal.app.knobs
Class KnobsModel
- java.lang.Object
-
- xal.app.knobs.KnobsModel
-
- All Implemented Interfaces:
xal.tools.data.DataListener
public class KnobsModel extends Object implements xal.tools.data.DataListener
Model for the knobs document
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classKnobsModel.GroupHandlerHandle KnobGroupListener events from the groups in the model
-
Field Summary
Fields Modifier and Type Field Description protected xal.smf.Accelerator_acceleratoraccelerator for node channel referencesprotected Comparator<KnobGroup>_groupComparatorcomparator for sorting groupsprotected KnobsModel.GroupHandler_groupHandlerhandler of group eventsprotected List<KnobGroup>_groupsList of knob groupsprotected MainKnobGroup_mainGroupThe main group which contains a list of all loaded applicationsprotected xal.smf.AcceleratorSeq_sequenceaccelerator sequence for knob generationstatic StringDATA_LABELDataAdaptor label used in reading and writingprotected KnobsModelListenerEVENT_PROXYproxy for posting eventsprotected xal.tools.messaging.MessageCenterMESSAGE_CENTERmessage center used to post events from this instance
-
Constructor Summary
Constructors Constructor Description KnobsModel(xal.smf.Accelerator accelerator, xal.smf.AcceleratorSeq sequence)KnobsModel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGroup(KnobGroup group)Add a group.voidaddGroups(Collection<KnobGroup> groups)Add a collection of groups.voidaddKnob(Knob knob)Add an knoblication to the table of knobs.voidaddKnobsModelListener(KnobsModelListener listener)Add a listener of KnobsModel events from this instancevoidaddKnobsToGroup(List<Knob> knobs, KnobGroup group)Add knobs to a specific group.KnobcreateKnobInGroup(KnobGroup group, String knobName)Create a new knob in the specified groupStringdataLabel()dataLabel() provides the name used to identify the class in an external data source.KnobGroupgetGroup(int index)Get the group at the index from the list of groups.intgetGroupCount()Get the number of groups including the main group.List<KnobGroup>getGroups()Get the list of groups.MainKnobGroupgetMainKnobGroup()Get the main knob group.xal.smf.AcceleratorSeqgetSequence()Get the accelerator sequence.voidremoveGroup(KnobGroup group)Remove the specified group.voidremoveKnobsModelListener(KnobsModelListener listener)Remove a listener of KnobsModel events from this instancevoidsetAccelerator(xal.smf.Accelerator accelerator)Set the accelerator.voidsetSequence(xal.smf.AcceleratorSeq sequence)Set the sequence.protected voidsortGroups()Sort the groups using the GroupComparator to assure that the MainKnobGroup instance appears ahead of all other groups and groups are otherwise sorted alphabetically.voidupdate(xal.tools.data.DataAdaptor adaptor)Instructs the receiver to update its data based on the given adaptor.voidwrite(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
DataAdaptor label used in reading and writing- See Also:
- Constant Field Values
-
MESSAGE_CENTER
protected final xal.tools.messaging.MessageCenter MESSAGE_CENTER
message center used to post events from this instance
-
EVENT_PROXY
protected final KnobsModelListener EVENT_PROXY
proxy for posting events
-
_mainGroup
protected final MainKnobGroup _mainGroup
The main group which contains a list of all loaded applications
-
_groupHandler
protected final KnobsModel.GroupHandler _groupHandler
handler of group events
-
_groupComparator
protected final Comparator<KnobGroup> _groupComparator
comparator for sorting groups
-
_accelerator
protected xal.smf.Accelerator _accelerator
accelerator for node channel references
-
_sequence
protected xal.smf.AcceleratorSeq _sequence
accelerator sequence for knob generation
-
-
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.
-
addKnobsModelListener
public void addKnobsModelListener(KnobsModelListener listener)
Add a listener of KnobsModel events from this instance- Parameters:
listener- The listener to add
-
removeKnobsModelListener
public void removeKnobsModelListener(KnobsModelListener listener)
Remove a listener of KnobsModel events from this instance- Parameters:
listener- The listener to remove
-
setAccelerator
public void setAccelerator(xal.smf.Accelerator accelerator)
Set the accelerator.- Parameters:
accelerator- the new accelerator
-
getSequence
public xal.smf.AcceleratorSeq getSequence()
Get the accelerator sequence.- Returns:
- the accelerator sequence
-
setSequence
public void setSequence(xal.smf.AcceleratorSeq sequence)
Set the sequence.- Parameters:
sequence- the new accelerator sequence
-
getMainKnobGroup
public MainKnobGroup getMainKnobGroup()
Get the main knob group.- Returns:
- the main knob group
-
getGroup
public KnobGroup getGroup(int index)
Get the group at the index from the list of groups. The main group is always at the 0 index. The other groups follow sequentially after that.- Parameters:
index- The index of the group to get- Returns:
- the group at the specified index
-
getGroups
public List<KnobGroup> getGroups()
Get the list of groups. The main group is always the first group in the list. The groups are sorted according to their comparable method, except for the main group.- Returns:
- the list of KnobGroup groups
-
getGroupCount
public int getGroupCount()
Get the number of groups including the main group.- Returns:
- the number of groups.
-
addGroups
public void addGroups(Collection<KnobGroup> groups)
Add a collection of groups.- Parameters:
groups- The collection of KnobGroup groups to add.
-
addGroup
public void addGroup(KnobGroup group)
Add a group.- Parameters:
group- The group to add.
-
createKnobInGroup
public Knob createKnobInGroup(KnobGroup group, String knobName)
Create a new knob in the specified group- Parameters:
group- The group to which to add the new knobknobName- the name for the knob
-
addKnobsToGroup
public void addKnobsToGroup(List<Knob> knobs, KnobGroup group)
Add knobs to a specific group.- Parameters:
knobs- the knobs to add to the groupgroup- The group to which to add the knobs
-
addKnob
public void addKnob(Knob knob)
Add an knoblication to the table of knobs.- Parameters:
knob- The application ot add.
-
removeGroup
public void removeGroup(KnobGroup group)
Remove the specified group. However this method will not allow one to remove the main group.- Parameters:
group- The group to remove
-
sortGroups
protected void sortGroups()
Sort the groups using the GroupComparator to assure that the MainKnobGroup instance appears ahead of all other groups and groups are otherwise sorted alphabetically.
-
-