Package xal.app.knobs
Class KnobListModel
- java.lang.Object
-
- javax.swing.AbstractListModel<String>
-
- xal.app.knobs.KnobListModel
-
- All Implemented Interfaces:
Serializable,ListModel<String>,KnobGroupListener,KnobsControllerListener
public class KnobListModel extends AbstractListModel<String> implements KnobGroupListener, KnobsControllerListener
Manage the displayed list of knobs- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected KnobGroup_groupThe group which supplies the list of knobs to display-
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description KnobListModel()Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetElementAt(int index)Get the string to display for the knob at the specified index in the knobs list.KnobGroupgetGroup()Get the group whose knobs are being displayed in the JList using this modelprotected StringgetKnobLabel(int index)Get the string to display for the knob.intgetSize()Get the number of knobs to displayvoidknobModified(KnobGroup group, Knob knob)Indicates that a knob has been modified.voidknobsAdded(KnobGroup group, Collection<Knob> addedKnobs)Handle the event indicating that knobs have been added to the groupvoidknobsRemoved(KnobGroup group, Collection<Knob> removedKnobs)Handle the event indicating that knobs have been removed from the groupvoidlabelChanged(KnobGroup group)The group's label has been changedvoidselectedGroupChanged(KnobsController source, KnobGroup newSelectedGroup)Handle the event indicating that the knobs controller has a new selected group.voidselectedKnobsChanged(KnobsController source, List<Knob> newSelectedKnobs)Handle the event indicating that the knobs controller has a new selected knob.voidsetGroup(KnobGroup group)Set the group which supplies the list of knobs to displayprotected static StringwarningLabel(String label)Change the color of the label to red.-
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
-
-
-
Field Detail
-
_group
protected KnobGroup _group
The group which supplies the list of knobs to display
-
-
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
-
getElementAt
public String getElementAt(int index)
Get the string to display for the knob at the specified index in the knobs list.- Specified by:
getElementAtin interfaceListModel<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:
knobsAddedin interfaceKnobGroupListener- Parameters:
group- The group to which the knobs have been addedaddedKnobs- 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:
knobsRemovedin interfaceKnobGroupListener- Parameters:
group- The group from which the knobs have been removedremovedKnobs- The collection of removed Knob instances
-
labelChanged
public void labelChanged(KnobGroup group)
The group's label has been changed- Specified by:
labelChangedin interfaceKnobGroupListener- 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:
knobModifiedin interfaceKnobGroupListener- Parameters:
group- the group whose knob has been modifiedknob- 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:
selectedGroupChangedin interfaceKnobsControllerListener- Parameters:
source- The knobs controllernewSelectedGroup- 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:
selectedKnobsChangedin interfaceKnobsControllerListener- Parameters:
source- The knobs controllernewSelectedKnobs- the new selected knobs
-
-