Package xal.app.knobs

Class GroupListModel

    • 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
        Specified by:
        getSize in interface ListModel<String>
        Returns:
        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:
        getElementAt in interface ListModel<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:
        groupsChanged in interface KnobsModelListener
        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:
        modified in interface KnobsModelListener
        Parameters:
        model - The model which has been modified.