public class GamePUI extends PuiBase<Game,ApplicationController>
  • Field Details

  • Constructor Details

  • Method Details

    • setupLEDStrip

      public static LedStrip setupLEDStrip()
      Will set up and initialise the LED-Strip
      Returns:
      the LedStrip object
    • initializeParts

      public void initializeParts()
    • setupUiToActionBindings

      public void setupUiToActionBindings(ApplicationController controller)
    • setupModelToUiBindings

      public void setupModelToUiBindings(Game model)
      this is only used to store the model instance to call setupOwnModelToUiBindings(Game) later, because otherwise it is impossible to mock the LED-strip class.

      If the mock is passed to the Ctor it cannot be assigned to this.ledstrip in time before super calls setupModelToUiBindings(). So instead call it later but store the model until then.

      Parameters:
      model -
    • setupOwnModelToUiBindings

      public void setupOwnModelToUiBindings(Game model)
      This method binds the model reactively to the ledstrips.
      Parameters:
      model -
    • getSpiInterface

      public com.pi4j.io.spi.Spi getSpiInterface()
      get the spi interface of the MCP23S17 chips
      Returns:
      the pi4j Spi object
    • getInterruptPins

      public com.pi4j.io.gpio.digital.DigitalInput[] getInterruptPins()
      Get the pins to which the chips are connected
      Returns:
      an array of DigitalInput objects
    • instanceSegments

      public void instanceSegments()
    • lookUpChipAndPinNumberToEdge

      public Edge lookUpChipAndPinNumberToEdge(int chipNo, int pinNo)
    • lookUpSegmentIdToSegment

      public Segment lookUpSegmentIdToSegment(int segmentId)
    • lookUpEdge

      public Edge lookUpEdge(int fromIndex, int toIndex)
    • getAllEdges

      public List<Edge> getAllEdges()
    • init

      default void init(ApplicationController controller)
      needs to be called inside the constructor of your UI-part
    • initializeSelf

      default void initializeSelf()
      Everything that needs to be done to initialize the UI-part itself.

      For GUIs loading stylesheet-files or additional fonts are typical examples.

    • startUp

      default void startUp(ApplicationController controller)
      At the Startup, this method gets called.

      Perfect, if a function in the controller or in the pui needs to be run exactly once.