Package jisa.gui

Class ListDisplay<T>

    • Field Detail

      • list

        protected javafx.scene.control.ListView<jisa.gui.ListDisplay.ListItem> list
    • Constructor Detail

      • ListDisplay

        public ListDisplay​(java.lang.String title)
    • Method Detail

      • add

        public ListDisplay.Item<T> add​(T object,
                                       java.lang.String title,
                                       java.lang.String subTitle,
                                       javafx.scene.image.Image image)
        Adds an object to the ListDisplay, displaying it with the given title, sub-title and image, returning a handle in the form of an Item object.
        Parameters:
        object - Object to add
        title - Title to show
        subTitle - Sub-title to show
        image - Image to show
        Returns:
        Item handle
      • remove

        public void remove​(ListDisplay.Item<T> toRemove)
        Removes the specified item from the list (if it contains it in the first place).
      • clear

        public void clear()
      • addDefaultMenuItem

        public void addDefaultMenuItem​(java.lang.String text,
                                       ListDisplay.ItemRunnable<T> action)
        Add a context menu item to all current and future items in the DisplayList.
        Parameters:
        text - Text to show on menu option
        action - Action to perform when clicked
      • getSelected

        public ListDisplay.Item<T> getSelected()
        Returns the currently selected item in the list.
        Returns:
        Currently selected item
      • getSelectedIndex

        public int getSelectedIndex()
        Returns the index of the currently selected item in the list.
        Returns:
        Index of currently selected item
      • select

        public void select​(ListDisplay.Item<T> item)
        Selects the specified item in the list.
        Parameters:
        item - Item to select
      • select

        public void select​(int index)
        Selects the item with the specified index in the list.
        Parameters:
        index - Index of item to select
      • setOnChange

        public void setOnChange​(SRunnable onChange)
        Sets what is done when the currently selected item in the list is changed.
        Parameters:
        onChange - Action to perform
      • size

        public int size()
      • isEmpty

        public boolean isEmpty()
      • triggerOnChange

        protected void triggerOnChange()
      • iterator

        public java.util.Iterator<ListDisplay.Item<T>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>