Package xal.app.knobs
Class GroupListModel
- java.lang.Object
-
- javax.swing.AbstractListModel<String>
-
- xal.app.knobs.GroupListModel
-
- All Implemented Interfaces:
Serializable,ListModel<String>,KnobsModelListener
public class GroupListModel extends AbstractListModel<String> implements KnobsModelListener
GroupListModel is the list model used to manage the JList which displays the groups in the main model.- Author:
- tap
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int_dragIndexIndex of the list cell upon which a drag event has occurredprotected KnobsModel_modelThe main model-
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description GroupListModel(KnobsModel model)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearDragIndex()Clear the drag index by setting it to -1 to indicate that there is no drag over any cells in the group list.protected static StringdragLabel(String label)Get a version of the label to use for the list cell to indicate that the group has an application being dragged above it.StringgetElementAt(int index)Get the group at the specified index in the group listprotected StringgetGroupLabel(int index)Get the label for the group with the specified index in the list of the model's groups.intgetSize()Get the number of groups to displayvoidgroupsChanged(KnobsModel model)Handle the event indicating that the groups in the model have changed.voidmodified(KnobsModel model)Handle the event indicating that the knobs model has been modified.voidsetDragIndex(int index)Set the index of the drag cell indicating which group list cell has an application dragged over it.protected static StringstandardLabel(String label)Get the standard text of the label.-
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
-
-
-
Field Detail
-
_model
protected KnobsModel _model
The main model
-
_dragIndex
protected int _dragIndex
Index of the list cell upon which a drag event has occurred
-
-
Constructor Detail
-
GroupListModel
public GroupListModel(KnobsModel model)
Constructor- Parameters:
model- The knob model
-
-
Method Detail
-
getSize
public int getSize()
Get the number of groups to display
-
getElementAt
public String getElementAt(int index)
Get the group at the specified index in the group list- Specified by:
getElementAtin interfaceListModel<String>- Parameters:
index- The index in the group list- Returns:
- The group corresponding to the specified index
-
getGroupLabel
protected String getGroupLabel(int index)
Get the label for the group with the specified index in the list of the model's groups. If the group is being dragged over, then display the drag label otherwise display the standard label.- Parameters:
index- The index of the group for which to get the label- See Also:
standardLabel(java.lang.String),dragLabel(java.lang.String)
-
standardLabel
protected static String standardLabel(String label)
Get the standard text of the label. We simply return the label itself unchanged.- Parameters:
label- The label for which to get the standard form.- Returns:
- the unchanged plain text label.
-
dragLabel
protected static String dragLabel(String label)
Get a version of the label to use for the list cell to indicate that the group has an application being dragged above it.- Parameters:
label- The plain text label of the group- Returns:
- HTML bordered table cell with the label as contents of the table cell
-
clearDragIndex
public void clearDragIndex()
Clear the drag index by setting it to -1 to indicate that there is no drag over any cells in the group list.
-
setDragIndex
public void setDragIndex(int index)
Set the index of the drag cell indicating which group list cell has an application dragged over it.- Parameters:
index- The index of the group cell which has the application dragged over it.
-
groupsChanged
public void groupsChanged(KnobsModel model)
Handle the event indicating that the groups in the model have changed. This event causes the group list to refresh.- Specified by:
groupsChangedin interfaceKnobsModelListener- Parameters:
model- The model whose groups have changed.
-
modified
public void modified(KnobsModel model)
Handle the event indicating that the knobs model has been modified. This implementation does nothing.- Specified by:
modifiedin interfaceKnobsModelListener- Parameters:
model- The model which has been modified.
-
-