Class PassFailJFrame.Builder

java.lang.Object
PassFailJFrame.Builder
Enclosing class:
PassFailJFrame

public static final class PassFailJFrame.Builder extends Object
  • Method Details Link icon

    • title Link icon

      public PassFailJFrame.Builder title(String title)
    • instructions Link icon

      public PassFailJFrame.Builder instructions(String instructions)
    • testTimeOut Link icon

      public PassFailJFrame.Builder testTimeOut(long testTimeOut)
    • rows Link icon

      public PassFailJFrame.Builder rows(int rows)
      Sets the number of rows for displaying the instruction text. The default value is the number of lines in the text plus 1: ((int) instructions.lines().count() + 1).
      Parameters:
      rows - the number of rows for instruction text
      Returns:
      this builder
    • rowsAdd Link icon

      public PassFailJFrame.Builder rowsAdd(int rowsAdd)
      Adds a certain number of rows for displaying the instruction text.
      Parameters:
      rowsAdd - the number of rows to add to the number of rows
      Returns:
      this builder
      See Also:
      • rows
    • columns Link icon

      public PassFailJFrame.Builder columns(int columns)
      Sets the number of columns for displaying the instruction text.
      Parameters:
      columns - the number of columns for instruction text
      Returns:
      this builder
    • screenCapture Link icon

      public PassFailJFrame.Builder screenCapture()
    • logArea Link icon

      public PassFailJFrame.Builder logArea()
      Adds a log area below the "Pass", "Fail" buttons.

      The log area can be controlled by PassFailJFrame.log(String), PassFailJFrame.logClear() and PassFailJFrame.logSet(String).

      Returns:
      this builder
    • logArea Link icon

      public PassFailJFrame.Builder logArea(int rows)
      Adds a log area below the "Pass", "Fail" buttons.

      The log area can be controlled by PassFailJFrame.log(String), PassFailJFrame.logClear() and PassFailJFrame.logSet(String).

      The number of columns is taken from the number of columns in the instructional JTextArea.

      Parameters:
      rows - of the log area
      Returns:
      this builder
    • testUI Link icon

      Adds a WindowCreator which the framework will use to create the test UI window.
      Parameters:
      windowCreator - a WindowCreator to create the test UI window
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if windowCreator is null
      IllegalStateException - if a window creator or a list of test windows is already set
    • positionTestUI Link icon

      public PassFailJFrame.Builder positionTestUI(PassFailJFrame.PositionWindows positionWindows)
      Adds an implementation of PositionWindows which the framework will use to position multiple test UI windows.
      Parameters:
      positionWindows - an implementation of PositionWindows to position multiple test UI windows
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the positionWindows parameter is null
      IllegalStateException - if the positionWindows field is already set
    • positionTestUIRightRow Link icon

      public PassFailJFrame.Builder positionTestUIRightRow()
      Positions the test UI windows in a row to the right of the instruction frame. The top of the windows is aligned to that of the instruction frame.
      Returns:
      this builder
    • positionTestUIRightColumn Link icon

      public PassFailJFrame.Builder positionTestUIRightColumn()
      Positions the test UI windows in a column to the right of the instruction frame. The top of the first window is aligned to that of the instruction frame.
      Returns:
      this builder
    • positionTestUIRightColumnCentered Link icon

      public PassFailJFrame.Builder positionTestUIRightColumnCentered()
      Positions the test UI windows in a column to the right of the instruction frame centering the stack of the windows.
      Returns:
      this builder
    • positionTestUIBottomRow Link icon

      public PassFailJFrame.Builder positionTestUIBottomRow()
      Positions the test UI windows in a row to the bottom of the instruction frame. The left of the first window is aligned to that of the instruction frame.
      Returns:
      this builder
    • positionTestUIBottomRowCentered Link icon

      public PassFailJFrame.Builder positionTestUIBottomRowCentered()
      Positions the test UI windows in a row to the bottom of the instruction frame centering the row of the windows.
      Returns:
      this builder
    • positionTestUIBottomColumn Link icon

      public PassFailJFrame.Builder positionTestUIBottomColumn()
      Positions the test UI windows in a column to the bottom of the instruction frame. The left of the first window is aligned to that of the instruction frame.
      Returns:
      this builder
    • testUI Link icon

      public PassFailJFrame.Builder testUI(PassFailJFrame.WindowListCreator windowListCreator)
      Adds a WindowListCreator which the framework will use to create a list of test UI windows.
      Parameters:
      windowListCreator - a WindowListCreator to create test UI windows
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if windowListCreator is null
      IllegalStateException - if a window creator or a list of test windows is already set
    • testUI Link icon

      public PassFailJFrame.Builder testUI(Window window)
      Adds an already created test UI window. The window is positioned and shown automatically.
      Parameters:
      window - a test UI window
      Returns:
      this builder
    • testUI Link icon

      public PassFailJFrame.Builder testUI(Window... windows)
      Adds an array of already created test UI windows.
      Parameters:
      windows - an array of test UI windows
      Returns:
      this builder
    • testUI Link icon

      public PassFailJFrame.Builder testUI(List<? extends Window> windows)
      Adds a list of already created test UI windows.
      Parameters:
      windows - a list of test UI windows
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if windows is null or the list contains null
      IllegalStateException - if a window creator or a list of test windows is already set
    • testUI Link icon

      Adds a PanelCreator which the framework will use to create a component and place it into a dialog.
      Parameters:
      panelCreator - a PanelCreator to create a component with test UI
      Returns:
      this builder
      Throws:
      IllegalStateException - if split UI was enabled using a splitUI method
    • splitUI Link icon

      public PassFailJFrame.Builder splitUI(PassFailJFrame.PanelCreator panelCreator)
      Adds a PanelCreator which the framework will use to create a component with test UI and display it in a split pane.

      By default, horizontal orientation is used, and test UI is displayed to the right of the instruction UI.

      Parameters:
      panelCreator - a PanelCreator to create a component with test UI
      Returns:
      this builder
      Throws:
      IllegalStateException - if a PanelCreator is already set
      IllegalArgumentException - if panelCreator is null
    • splitUIRight Link icon

      public PassFailJFrame.Builder splitUIRight(PassFailJFrame.PanelCreator panelCreator)
      Adds a PanelCreator which the framework will use to create a component with test UI and display it to the right of instruction UI.
      Parameters:
      panelCreator - a PanelCreator to create a component with test UI
      Returns:
      this builder
      Throws:
      IllegalStateException - if a PanelCreator is already set
      IllegalArgumentException - if panelCreator is null
    • splitUIBottom Link icon

      public PassFailJFrame.Builder splitUIBottom(PassFailJFrame.PanelCreator panelCreator)
      Adds a PanelCreator which the framework will use to create a component with test UI and display it in the bottom of instruction UI.
      Parameters:
      panelCreator - a PanelCreator to create a component with test UI
      Returns:
      this builder
      Throws:
      IllegalStateException - if a PanelCreator is already set
      IllegalArgumentException - if panelCreator is null
    • position Link icon

      public PassFailJFrame.Builder position(PassFailJFrame.Position position)
    • build Link icon