Class CableSelector


  • public class CableSelector
    extends java.lang.Object
    A component that allows the user to select a cable, or skip

    Consists of a row of buttons that, when pressed, trigger the onSelect event. To the side, there is a button for skipping, which triggers the onSkip event.

    Author:
    Luna Otte
    • Constructor Summary

      Constructors 
      Constructor Description
      CableSelector​(sag.SAGPanel panel, CableConfig[] cableTypes)
      Creates a new CableSelector
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void hide()
      Hide the selector by pushing it offscreen
      CableSelector onSelect​(java.util.function.Predicate<CableConfig> selectAction)
      This event is triggered when the user selects a cable
      CableSelector onSkip​(java.lang.Runnable skipAction)
      This event is triggered when the user skips, instead of choosing a cable
      void show()
      Show the selector by pushing it onscreen
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CableSelector

        public CableSelector​(sag.SAGPanel panel,
                             CableConfig[] cableTypes)
        Creates a new CableSelector
        Parameters:
        panel - The panel that the CableSelector will be attached to
        cableTypes - All available cable types
    • Method Detail

      • onSelect

        public CableSelector onSelect​(java.util.function.Predicate<CableConfig> selectAction)
        This event is triggered when the user selects a cable

        The provided function must return a boolean value to indicate whether the selected cable should be highlighted visually.

        Parameters:
        selectAction - The action to be taken when a cable is selected
        Returns:
        The selector (for chaining methods)
      • onSkip

        public CableSelector onSkip​(java.lang.Runnable skipAction)
        This event is triggered when the user skips, instead of choosing a cable
        Parameters:
        skipAction - The action to be taken when the user skips
        Returns:
        The selector (for chaining methods)
      • show

        public void show()
        Show the selector by pushing it onscreen
      • hide

        public void hide()
        Hide the selector by pushing it offscreen