Package xal.app.knobs

Class KnobListModel

    • Field Detail

      • _group

        protected KnobGroup _group
        The group which supplies the list of knobs to display
    • Constructor Detail

      • KnobListModel

        public KnobListModel()
        Constructor
    • Method Detail

      • setGroup

        public void setGroup​(KnobGroup group)
        Set the group which supplies the list of knobs to display
        Parameters:
        group - The group whose knobs are being displayed in the JList
      • getGroup

        public KnobGroup getGroup()
        Get the group whose knobs are being displayed in the JList using this model
        Returns:
        the group which supplies the knobs to display
      • getSize

        public int getSize()
        Get the number of knobs to display
        Specified by:
        getSize in interface ListModel<String>
        Returns:
        the number of knobs in the group
      • getElementAt

        public String getElementAt​(int index)
        Get the string to display for the knob at the specified index in the knobs list.
        Specified by:
        getElementAt in interface ListModel<String>
        Parameters:
        index - The index of the knob in the JList
        Returns:
        The label of the knob
        See Also:
        getKnobLabel(int)
      • getKnobLabel

        protected String getKnobLabel​(int index)
        Get the string to display for the knob. If the knob has a valid file path to the executable, the label appears in standard black. If the path is invalid, we use the warning label instead.
        See Also:
        warningLabel(java.lang.String)
      • warningLabel

        protected static String warningLabel​(String label)
        Change the color of the label to red.
        Parameters:
        label - The plain label of the knob.
        Returns:
        HTML which renders the label as red text
      • knobsAdded

        public void knobsAdded​(KnobGroup group,
                               Collection<Knob> addedKnobs)
        Handle the event indicating that knobs have been added to the group
        Specified by:
        knobsAdded in interface KnobGroupListener
        Parameters:
        group - The group to which the knobs have been added
        addedKnobs - The collection of added Knob instances
      • knobsRemoved

        public void knobsRemoved​(KnobGroup group,
                                 Collection<Knob> removedKnobs)
        Handle the event indicating that knobs have been removed from the group
        Specified by:
        knobsRemoved in interface KnobGroupListener
        Parameters:
        group - The group from which the knobs have been removed
        removedKnobs - The collection of removed Knob instances
      • labelChanged

        public void labelChanged​(KnobGroup group)
        The group's label has been changed
        Specified by:
        labelChanged in interface KnobGroupListener
        Parameters:
        group - the group whose label has been changed
      • knobModified

        public void knobModified​(KnobGroup group,
                                 Knob knob)
        Indicates that a knob has been modified.
        Specified by:
        knobModified in interface KnobGroupListener
        Parameters:
        group - the group whose knob has been modified
        knob - the knob which has been modified
      • selectedGroupChanged

        public void selectedGroupChanged​(KnobsController source,
                                         KnobGroup newSelectedGroup)
        Handle the event indicating that the knobs controller has a new selected group. Change the group used for managing the Knob list to the new selected group.
        Specified by:
        selectedGroupChanged in interface KnobsControllerListener
        Parameters:
        source - The knobs controller
        newSelectedGroup - The new selected group
      • selectedKnobsChanged

        public void selectedKnobsChanged​(KnobsController source,
                                         List<Knob> newSelectedKnobs)
        Handle the event indicating that the knobs controller has a new selected knob. This event is ignored.
        Specified by:
        selectedKnobsChanged in interface KnobsControllerListener
        Parameters:
        source - The knobs controller
        newSelectedKnobs - the new selected knobs