Package xal.app.knobs

Class KnobsModel

  • All Implemented Interfaces:
    xal.tools.data.DataListener

    public class KnobsModel
    extends Object
    implements xal.tools.data.DataListener
    Model for the knobs document
    • Field Detail

      • MESSAGE_CENTER

        protected final xal.tools.messaging.MessageCenter MESSAGE_CENTER
        message center used to post events from this instance
      • _mainGroup

        protected final MainKnobGroup _mainGroup
        The main group which contains a list of all loaded applications
      • _groups

        protected final List<KnobGroup> _groups
        List of knob groups
      • _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
    • Constructor Detail

      • KnobsModel

        public KnobsModel​(xal.smf.Accelerator accelerator,
                          xal.smf.AcceleratorSeq sequence)
        KnobsModel
    • Method Detail

      • dataLabel

        public String dataLabel()
        dataLabel() provides the name used to identify the class in an external data source.
        Specified by:
        dataLabel in interface xal.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:
        update in interface xal.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:
        write in interface xal.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 knob
        knobName - 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 group
        group - 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.