Package jisa.gui

Class GUI


  • public class GUI
    extends javafx.application.Application
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javafx.application.Application

        javafx.application.Application.Parameters
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double SPACING  
      • Fields inherited from class javafx.application.Application

        STYLESHEET_CASPIAN, STYLESHEET_MODENA
    • Constructor Summary

      Constructors 
      Constructor Description
      GUI()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends Instrument>
      T
      askUserForInstrument​(java.lang.String message, java.lang.Class<T> type)  
      static <T extends Instrument>
      T
      askUserForInstrument​(java.lang.String message, kotlin.reflect.KClass<T> type)  
      static Address browseVISA()
      Opens a window listing all instruments detected by VISA etc, allowing the user to select one.
      static int choiceWindow​(java.lang.String title, java.lang.String header, java.lang.String message, java.lang.String... options)  
      static boolean confirmWindow​(java.lang.String title, java.lang.String header, java.lang.String text)
      Opens a confirmation dialogue, returning the users response as a boolean.
      static <T extends Instrument>
      T
      connectTo​(java.lang.Class<T> driver, Address address)  
      static java.lang.String directorySelect()  
      static java.lang.String directorySelect​(java.lang.String startPath)
      Opens a file-select dialogue box for choosing a file path to write to.
      static void errorAlert​(java.lang.String text)
      Displays an error dialogue box, halting the thread until the user closes it.
      static void errorAlert​(java.lang.String title, java.lang.String text)
      Displays an error dialogue box, halting the thread until the user closes it.
      static void errorAlert​(java.lang.String title, java.lang.String header, java.lang.String text)
      Displays an error dialogue box, halting the thread until the user closes it.
      static void errorAlert​(java.lang.String title, java.lang.String header, java.lang.String text, double width)
      Displays an error dialogue box, halting the thread until the user closes it.
      static void infoAlert​(java.lang.String text)
      Displays an information dialogue box, halting the thread until the user closes it.
      static void infoAlert​(java.lang.String title, java.lang.String text)
      Displays an information dialogue box, halting the thread until the user closes it.
      static void infoAlert​(java.lang.String title, java.lang.String header, java.lang.String text)
      Displays an information dialogue box, halting the thread until the user closes it.
      static void infoAlert​(java.lang.String title, java.lang.String header, java.lang.String text, double width)
      Displays an information dialogue box, halting the thread until the user closes it.
      static java.lang.String[] inputWindow​(java.lang.String title, java.lang.String header, java.lang.String message, java.lang.String... fields)
      Opens a dialogue box with text-boxes for user-input, returning the user-input values as an array of Strings.
      static java.util.List<java.lang.String> openFileMultipleSelect()  
      static java.util.List<java.lang.String> openFileMultipleSelect​(java.lang.String startPath)
      Opens a file-select dialogue box for choosing an already existing file to open.
      static java.lang.String openFileSelect()  
      static java.lang.String openFileSelect​(java.lang.String startPath)
      Opens a file-select dialogue box for choosing an already existing file to open.
      void runMeasurement​(Measurement measurement)  
      static void runNow​(java.lang.Runnable toRun)
      Runs the supplied Runnable on the GUI thread, waits until it has finished.
      static java.lang.String saveFileSelect()  
      static java.lang.String saveFileSelect​(java.lang.String startPath)
      Opens a file-select dialogue box for choosing a file path to write to.
      void start​(javafx.stage.Stage primaryStage)  
      static void stopGUI()
      Stops the GUI thread.
      static void touch()
      Dummy method used to initiate first accessing of the GUI thread early.
      static void waitForExit()  
      static void warningAlert​(java.lang.String text)
      Displays a warning dialogue box, halting the thread until the user closes it.
      static void warningAlert​(java.lang.String title, java.lang.String text)
      Displays a warning dialogue box, halting the thread until the user closes it.
      static void warningAlert​(java.lang.String title, java.lang.String header, java.lang.String text)
      Displays a warning dialogue box, halting the thread until the user closes it.
      static void warningAlert​(java.lang.String title, java.lang.String header, java.lang.String text, double width)
      Displays a warning dialogue box, halting the thread until the user closes it.
      • Methods inherited from class javafx.application.Application

        getHostServices, getParameters, getUserAgentStylesheet, init, launch, launch, notifyPreloader, setUserAgentStylesheet, stop
      • Methods inherited from class java.lang.Object

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

      • GUI

        public GUI()
    • Method Detail

      • touch

        public static void touch()
        Dummy method used to initiate first accessing of the GUI thread early.
      • connectTo

        public static <T extends Instrument> T connectTo​(java.lang.Class<T> driver,
                                                         Address address)
      • askUserForInstrument

        public static <T extends Instrument> T askUserForInstrument​(java.lang.String message,
                                                                    java.lang.Class<T> type)
      • askUserForInstrument

        public static <T extends Instrument> T askUserForInstrument​(java.lang.String message,
                                                                    kotlin.reflect.KClass<T> type)
      • errorAlert

        public static void errorAlert​(java.lang.String title,
                                      java.lang.String header,
                                      java.lang.String text,
                                      double width)
        Displays an error dialogue box, halting the thread until the user closes it.
        Parameters:
        title - Window title
        header - Header text
        text - Message text
        width - Width of the window, in pixels
      • infoAlert

        public static void infoAlert​(java.lang.String title,
                                     java.lang.String header,
                                     java.lang.String text,
                                     double width)
        Displays an information dialogue box, halting the thread until the user closes it.
        Parameters:
        title - Window title
        header - Header text
        text - Message text
        width - Width of the window, in pixels
      • warningAlert

        public static void warningAlert​(java.lang.String title,
                                        java.lang.String header,
                                        java.lang.String text)
        Displays a warning dialogue box, halting the thread until the user closes it.
        Parameters:
        title - Window title
        header - Header text
        text - Message text
      • errorAlert

        public static void errorAlert​(java.lang.String title,
                                      java.lang.String header,
                                      java.lang.String text)
        Displays an error dialogue box, halting the thread until the user closes it.
        Parameters:
        title - Window title
        header - Header text
        text - Message text
      • errorAlert

        public static void errorAlert​(java.lang.String title,
                                      java.lang.String text)
        Displays an error dialogue box, halting the thread until the user closes it.
        Parameters:
        title - Window title and header text
        text - Message text
      • errorAlert

        public static void errorAlert​(java.lang.String text)
        Displays an error dialogue box, halting the thread until the user closes it.
        Parameters:
        text - Message text
      • infoAlert

        public static void infoAlert​(java.lang.String title,
                                     java.lang.String header,
                                     java.lang.String text)
        Displays an information dialogue box, halting the thread until the user closes it.
        Parameters:
        title - Window title
        header - Header text
        text - Message text
      • infoAlert

        public static void infoAlert​(java.lang.String title,
                                     java.lang.String text)
        Displays an information dialogue box, halting the thread until the user closes it.
        Parameters:
        title - Window title and header text
        text - Message text
      • infoAlert

        public static void infoAlert​(java.lang.String text)
        Displays an information dialogue box, halting the thread until the user closes it.
        Parameters:
        text - Message text
      • warningAlert

        public static void warningAlert​(java.lang.String title,
                                        java.lang.String header,
                                        java.lang.String text,
                                        double width)
        Displays a warning dialogue box, halting the thread until the user closes it.
        Parameters:
        title - Window title
        header - Header text
        text - Message text
        width - Width of the window, in pixels
      • warningAlert

        public static void warningAlert​(java.lang.String title,
                                        java.lang.String text)
        Displays a warning dialogue box, halting the thread until the user closes it.
        Parameters:
        title - Window title and header text
        text - Message text
      • warningAlert

        public static void warningAlert​(java.lang.String text)
        Displays a warning dialogue box, halting the thread until the user closes it.
        Parameters:
        text - Message text
      • saveFileSelect

        public static java.lang.String saveFileSelect​(java.lang.String startPath)
        Opens a file-select dialogue box for choosing a file path to write to.
        Returns:
        Selected file path, null if cancelled
      • saveFileSelect

        public static java.lang.String saveFileSelect()
      • directorySelect

        public static java.lang.String directorySelect​(java.lang.String startPath)
        Opens a file-select dialogue box for choosing a file path to write to.
        Returns:
        Selected file path, null if cancelled
      • directorySelect

        public static java.lang.String directorySelect()
      • openFileSelect

        public static java.lang.String openFileSelect​(java.lang.String startPath)
        Opens a file-select dialogue box for choosing an already existing file to open.
        Returns:
        Selected file path, null if cancelled
      • openFileSelect

        public static java.lang.String openFileSelect()
      • openFileMultipleSelect

        public static java.util.List<java.lang.String> openFileMultipleSelect​(java.lang.String startPath)
        Opens a file-select dialogue box for choosing an already existing file to open.
        Returns:
        Selected file path, null if cancelled
      • openFileMultipleSelect

        public static java.util.List<java.lang.String> openFileMultipleSelect()
      • confirmWindow

        public static boolean confirmWindow​(java.lang.String title,
                                            java.lang.String header,
                                            java.lang.String text)
        Opens a confirmation dialogue, returning the users response as a boolean.
        Parameters:
        title - Window title
        header - Header text
        text - Message text
        Returns:
        Boolean result, true for okay, false for cancel
      • inputWindow

        public static java.lang.String[] inputWindow​(java.lang.String title,
                                                     java.lang.String header,
                                                     java.lang.String message,
                                                     java.lang.String... fields)
        Opens a dialogue box with text-boxes for user-input, returning the user-input values as an array of Strings.
        Parameters:
        title - Window title
        header - Header text
        message - Message text
        fields - Names of the input-fields
        Returns:
        Array of input values
      • choiceWindow

        public static int choiceWindow​(java.lang.String title,
                                       java.lang.String header,
                                       java.lang.String message,
                                       java.lang.String... options)
      • browseVISA

        public static Address browseVISA()
        Opens a window listing all instruments detected by VISA etc, allowing the user to select one.
        Returns:
        Address object of the selected instrument
      • waitForExit

        public static void waitForExit()
      • stopGUI

        public static void stopGUI()
        Stops the GUI thread. It cannot be restarted afterwards.
      • runNow

        public static void runNow​(java.lang.Runnable toRun)
        Runs the supplied Runnable on the GUI thread, waits until it has finished.
        Parameters:
        toRun - Code to run on GUI thread
      • start

        public void start​(javafx.stage.Stage primaryStage)
                   throws java.lang.Exception
        Specified by:
        start in class javafx.application.Application
        Throws:
        java.lang.Exception
      • runMeasurement

        public void runMeasurement​(Measurement measurement)