Interface UIService

    • Field Detail

    • Method Detail

      • addUI

        void addUI​(UserInterface ui)
        Adds the given UI to those managed by the service.

        Note that a UI added explicitly via this method will never be considered the default UI unless setDefaultUI(UserInterface) is also called.

        Parameters:
        ui - The UI to add.
      • addUI

        void addUI​(String name,
                   UserInterface ui)
        Adds the given UI to those managed by the service.

        Note that a UI added explicitly via this method will never be considered the default UI unless setDefaultUI(UserInterface) is also called.

        Parameters:
        name - The nickname for the UI.
        ui - The UI to add.
      • showUI

        void showUI​(String name)
        Displays the UI with the given name (or class name).
      • showUI

        void showUI​(UserInterface ui)
        Displays the given UI.
      • isVisible

        boolean isVisible​(String name)
        Gets whether the UI with the given name or class name is visible.
      • setHeadless

        void setHeadless​(boolean isHeadless)
        Sets whether the application should run in headless mode (no UI).

        Note that if the system itself is headless—which can be detected via the java.awt.headless system property or by calling GraphicsEnvironment.isHeadless()—then calling setHeadless(false) will have no effect; the system will still be headless, and isHeadless() will still return true.

        But if the system itself is not headless, calling setHeadless(true) will force isHeadless() to return true, instructing the application to behave in a headless manner insofar as it can.

      • isHeadless

        boolean isHeadless()
        Gets whether the UI is running in headless mode (no UI).

        More precisely: returns true when java.awt.headless system property is set, and/or GraphicsEnvironment.isHeadless() returns true, and/or setHeadless(boolean) was called with true to force headless behavior in an otherwise headful environment.

      • setDefaultUI

        void setDefaultUI​(UserInterface ui)
        Sets the default user interface.
        See Also:
        showUI()
      • isDefaultUI

        boolean isDefaultUI​(String name)
        Gets whether the UI with the given name (or class name) is the default one.
      • getAvailableUIs

        List<UserInterface> getAvailableUIs()
        Gets the user interfaces available to the service.
      • getVisibleUIs

        List<UserInterface> getVisibleUIs()
        Gets the user interfaces that are currently visible.
      • addDisplayViewer

        void addDisplayViewer​(DisplayViewer<?> viewer)
        Registers the given viewer with the service.
      • getDisplayViewer

        DisplayViewer<?> getDisplayViewer​(Display<?> display)
        Gets the UI widget being used to visualize the given Display.
      • show

        void show​(Object o)
        Creates a Display for the given object, and shows it using an appropriate UI widget of the default user interface.
      • show

        void show​(String name,
                  Object o)
        Creates a Display for the given object, and shows it using an appropriate UI widget of the default user interface.
        Parameters:
        name - The name to use when displaying the object.
        o - The object to be displayed.
      • show

        void show​(Display<?> display)
        Creates and shows the given Display using an appropriate UI widget of the default user interface.
      • showDialog

        DialogPrompt.Result showDialog​(String message)
        Displays a dialog prompt.

        The prompt is displayed in the default user interface.

        Parameters:
        message - The message in the dialog itself.
        Returns:
        The choice selected by the user when dismissing the dialog.
      • showDialog

        DialogPrompt.Result showDialog​(String message,
                                       DialogPrompt.MessageType messageType)
        Displays a dialog prompt.

        The prompt is displayed in the default user interface.

        Parameters:
        message - The message in the dialog itself.
        messageType - The type of message. This typically is rendered as an icon next to the message. For example, DialogPrompt.MessageType.WARNING_MESSAGE typically appears as an exclamation point.
        Returns:
        The choice selected by the user when dismissing the dialog.
      • showDialog

        DialogPrompt.Result showDialog​(String message,
                                       DialogPrompt.MessageType messageType,
                                       DialogPrompt.OptionType optionType)
        Displays a dialog prompt.

        The prompt is displayed in the default user interface.

        Parameters:
        message - The message in the dialog itself.
        messageType - The type of message. This typically is rendered as an icon next to the message. For example, DialogPrompt.MessageType.WARNING_MESSAGE typically appears as an exclamation point.
        optionType - The choices available when dismissing the dialog. These choices are typically rendered as buttons for the user to click.
        Returns:
        The choice selected by the user when dismissing the dialog.
      • showDialog

        DialogPrompt.Result showDialog​(String message,
                                       String title)
        Displays a dialog prompt.

        The prompt is displayed in the default user interface.

        Parameters:
        message - The message in the dialog itself.
        title - The title of the dialog.
        Returns:
        The choice selected by the user when dismissing the dialog.
      • showDialog

        DialogPrompt.Result showDialog​(String message,
                                       String title,
                                       DialogPrompt.MessageType messageType)
        Displays a dialog prompt.

        The prompt is displayed in the default user interface.

        Parameters:
        message - The message in the dialog itself.
        title - The title of the dialog.
        messageType - The type of message. This typically is rendered as an icon next to the message. For example, DialogPrompt.MessageType.WARNING_MESSAGE typically appears as an exclamation point.
        Returns:
        The choice selected by the user when dismissing the dialog.
      • showDialog

        DialogPrompt.Result showDialog​(String message,
                                       String title,
                                       DialogPrompt.MessageType messageType,
                                       DialogPrompt.OptionType optionType)
        Displays a dialog prompt.

        The prompt is displayed in the default user interface.

        Parameters:
        message - The message in the dialog itself.
        title - The title of the dialog.
        messageType - The type of message. This typically is rendered as an icon next to the message. For example, DialogPrompt.MessageType.WARNING_MESSAGE typically appears as an exclamation point.
        optionType - The choices available when dismissing the dialog. These choices are typically rendered as buttons for the user to click.
        Returns:
        The choice selected by the user when dismissing the dialog.
      • chooseFiles

        File[] chooseFiles​(File parent,
                           File[] files,
                           FileFilter filter,
                           String style)
        Prompts the user to select one or multiple files.

        The prompt is displayed in the default user interface.

        Parameters:
        files - The initial value displayed in the file chooser prompt.
        filter - A filter allowing to restrict the choice of files
      • chooseFiles

        List<File> chooseFiles​(File parent,
                               List<File> fileList,
                               FileFilter filter,
                               String style)
        Prompts the user to select one or multiple files.

        The prompt is displayed in the default user interface.

        Parameters:
        fileList - The initial value displayed in the file chooser prompt.
        filter - A filter allowing to restrict the choice of files
      • showContextMenu

        void showContextMenu​(String menuRoot,
                             Display<?> display,
                             int x,
                             int y)
        Displays a popup context menu for the given display at the specified position.

        The context menu is displayed in the default user interface.