Class List<T>


  • public class List<T>
    extends Menu
    Menu dynamically populated with a list of items. The type T is not the type displayed but the type kept in memory for further treatment. The data is read through a ListData. The selection of an item triggers either a ListAction, either a ListOption.
    • Constructor Detail

      • List

        public List​(java.lang.String title,
                    ListData<T> data,
                    ListAction<T> action)
        Creates a List.
        Parameters:
        title - The title of the list.
        data - The implementation of ListData that refreshes the list
        action - The implementation of ListAction that will be triggered if an item is selected.
      • List

        public List​(java.lang.String title,
                    ListData<T> data,
                    ListOption<T> option)
        Creates a List.
        Parameters:
        title - The title of the list.
        data - The implementation of ListData that refreshes the list
        option - The sub-menu that will be opened if an item is selected.
      • List

        public List​(java.lang.String title,
                    java.lang.String shortcut,
                    ListData<T> data,
                    ListAction<T> action)
        Creates a List.
        Parameters:
        title - The title of the list.
        shortcut - The shortcut that opens the list if this is a sub-menu.
        data - The implementation of ListData that refreshes the list
        action - The implementation of ListAction that will be triggered if an item is selected.
      • List

        public List​(java.lang.String title,
                    java.lang.String shortcut,
                    ListData<T> data,
                    ListOption<T> option)
        Creates a List.
        Parameters:
        title - The title of the list.
        shortcut - The shortcut that opens the list if this is a sub-menu.
        data - The implementation of ListData that refreshes the list
        option - The sub-menu that will be opened if an item is selected.
    • Method Detail

      • add

        public void add​(Option option)
        Do never call add() if this is a list, it is forbidden to manually add an option in a List.
        Overrides:
        add in class Menu
        Parameters:
        option - The option to add.
      • addQuit

        public void addQuit​(java.lang.String shortcut)
        Description copied from class: Menu
        Adds an option to close all menus.
        Overrides:
        addQuit in class Menu
        Parameters:
        shortcut - The shortcut that will appear in the menu.
      • addQuit

        public void addQuit​(java.lang.String title,
                            java.lang.String shortcut)
        Description copied from class: Menu
        Adds an option to close all menus.
        Overrides:
        addQuit in class Menu
        Parameters:
        title - The title that will appear in the menu.
        shortcut - The shortcut that will appear in the menu.
      • addBack

        public void addBack​(java.lang.String shortcut)
        Adds an option to go back to the parent menu, if the list is empty, a go back option is automatically added with the 'q' shortcut.
        Overrides:
        addBack in class Menu
        Parameters:
        shortcut - The shortcut that will appear in the menu.
      • addBack

        public void addBack​(java.lang.String title,
                            java.lang.String shortcut)
        Description copied from class: Menu
        Adds an option to go back to the parent menu.
        Overrides:
        addBack in class Menu
        Parameters:
        title - The title that will appear in the menu.
        shortcut - The shortcut that will appear in the menu.
      • setListItemRenderer

        public void setListItemRenderer​(ListItemRenderer<T> listItemRenderer)
        Overrides the default display of an item with a custom one. listItemRenderer only applies to the current list.
        Parameters:
        listItemRenderer - The implementation of ListItemRenderer that customizes the display.