Package jltk.gui

Class ListView


  • public class ListView
    extends Control
    A ListView contains objects line by line events: itemSelected, itemEdited
    Version:
    24.05.2022
    Author:
    ms
    • Field Detail

      • fxListView

        protected javafx.scene.control.ListView<String> fxListView
    • Constructor Detail

      • ListView

        public ListView​(double pLeft,
                        double pTop,
                        double pWidth,
                        double pHeight)
        Create the ListView on the main View
        Parameters:
        pLeft - The horizontal coordinate
        pTop - The vertical coordinate
        pWidth - The width of the combo box
        pHeight - The height of the combo box
      • ListView

        public ListView​(Window pWindow,
                        double pLeft,
                        double pTop,
                        double pWidth,
                        double pHeight)
        Creates the ListView
        Parameters:
        pLeft - The horizontal coordinate
        pTop - The vertical coordinate
        pWidth - The width of the list
        pHeight - The height of the list
        pWindow - The window, the list should be placed
    • Method Detail

      • append

        public void append​(String pText)
        Appends pText to the ListView
        Parameters:
        pText - The object to be append.
      • append

        public void append​(Object pObject)
        Appends pObject to the ListView
        Parameters:
        pObject - The object to be append.
      • append

        public void append​(String[] pArray)
        Appends the given String array to the ListView
        Parameters:
        pArray - a one-dimensiol string array
      • append

        public void append​(Object[] pArray)
        Appends the given array of objects to the ListView
        Parameters:
        pArray - a one-dimensiol array
      • insert

        public void insert​(int pIndex,
                           String pText)
        Inserts pText at the specified position in this ListView. Shifts the item currently at that position (if any) and any subsequent item to the bottom (adds one to their indices, first item has index 0).
        Parameters:
        pText - The text to be add.
      • insert

        public void insert​(int pIndex,
                           Object pObject)
        Inserts the string representation of pObject (.toString()) at the specified position in this ListView. Shifts the item currently at that position (if any) and any subsequent item to the bottom (adds one to their indices, first item has index 0).
        Parameters:
        pObject - The object to add.
      • set

        public void set​(int pIndex,
                        String pText)
        Replaces the item at the specified position in this ListView with pText (first item has index 0).
        Parameters:
        pText - The text to be set.
      • set

        public void set​(int pIndex,
                        Object pObject)
        Replaces the item at the specified position in this ListView with the string representation of pObject (.toString(), first item has index 0).
        Parameters:
        pText - The object to be set.
      • remove

        public void remove​(int pIndex)
        Remove the item at the specified index (first item has index 0).
        Parameters:
        pIndex - the Index of the item, should be removed.
      • removeAll

        public void removeAll()
        Removes all entries from the ListView
      • select

        public void select​(int pIndex)
        Selects (highlights) the item specified by pIndex
        Parameters:
        pIndex -
      • deselect

        public void deselect​(int pIndex)
        Deselects the item specified by pIndex
        Parameters:
        pIndex -
      • deselectAll

        public void deselectAll()
        Clears the selection of all selected indices.
      • isSelected

        public boolean isSelected​(int pIndex)
        Returns true, if the given index is currently selected, otherwise false.
        Parameters:
        pIndex - The index to check as to whether it is currently selected or not
        Returns:
        True if the given index is selected, false otherwise
      • getSelectedIndex

        public int getSelectedIndex()
        Returns the index of the selected item (first item has index 0).
        Returns:
        The index of the selected item
      • getSelectedIndices

        public int[] getSelectedIndices()
        Returns an int array containing all indices of the selected items (first item has index 0).
        Returns:
        int array with indices of the selected items.
      • getSize

        public int getSize()
        Returns the number of items in this ListView.
        Returns:
        The number of items.
      • getSelectedItem

        public String getSelectedItem()
        Returns the selected item as string.
        Returns:
        The string representation of the item.
      • getSelectedItems

        public String[] getSelectedItems()
        Return selected items as String array
        Returns:
        Selected items as String array
      • getAllItems

        public String[] getAllItems()
        Return all items as String array
        Returns:
        All items as String array
      • setOnItemSelected

        public void setOnItemSelected​(String pMethodName)
        Set the name of the method, which should be invoke, if an item of the ListView is selected.
      • setOnItemEdited

        public void setOnItemEdited​(String pMethodName)
        Set the name of the method, which should be invoke, if the edit of an item of the ListView is comitted.
      • enableMultiselect

        public void enableMultiselect()
        Allows one or more items to be selected at a time.
      • disableMultiselect

        public void disableMultiselect()
        Allows one item to be selected at a time.
      • enableEditable

        public void enableEditable()
        Makes the ListView editable
      • disableEditable

        public void disableEditable()
        Makes the LiestView read-only