Interface UIService
-
- All Superinterfaces:
Comparable<Prioritized>,Contextual,Disposable,HasPluginInfo,Identifiable,Initializable,Locatable,Logged,Prioritized,RichPlugin,SciJavaPlugin,SciJavaService,Service,Versioned
- All Known Implementing Classes:
DefaultUIService
public interface UIService extends SciJavaService
Interface for service that handles user interfaces.- Author:
- Curtis Rueden
-
-
Field Summary
Fields Modifier and Type Field Description static StringUI_PROPERTYSystem property to set for overriding the default UI.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddDisplayViewer(DisplayViewer<?> viewer)Registers the given viewer with the service.voidaddUI(String name, UserInterface ui)Adds the given UI to those managed by the service.voidaddUI(UserInterface ui)Adds the given UI to those managed by the service.FilechooseFile(File file, String style)Prompts the user to choose a file.FilechooseFile(String title, File file, String style)Prompts the user to choose a file.File[]chooseFiles(File parent, File[] files, FileFilter filter, String style)Prompts the user to select one or multiple files.List<File>chooseFiles(File parent, List<File> fileList, FileFilter filter, String style)Prompts the user to select one or multiple files.List<UserInterface>getAvailableUIs()Gets the user interfaces available to the service.UserInterfacegetDefaultUI()Gets the default user interface.DisplayViewer<?>getDisplayViewer(Display<?> display)Gets the UI widget being used to visualize the givenDisplay.StringgetStatusMessage(StatusEvent statusEvent)Gets the status message associated with the given event.UserInterfacegetUI(String name)Gets the UI with the given name (or class name).List<PluginInfo<DisplayViewer<?>>>getViewerPlugins()Gets the list of known viewer plugins.List<UserInterface>getVisibleUIs()Gets the user interfaces that are currently visible.booleanisDefaultUI(String name)Gets whether the UI with the given name (or class name) is the default one.booleanisHeadless()Gets whether the UI is running in headless mode (no UI).booleanisVisible()Gets whether the default UI is visible.booleanisVisible(String name)Gets whether the UI with the given name or class name is visible.voidsetDefaultUI(UserInterface ui)Sets the default user interface.voidsetHeadless(boolean isHeadless)Sets whether the application should run in headless mode (no UI).voidshow(Object o)Creates aDisplayfor the given object, and shows it using an appropriate UI widget of the default user interface.voidshow(String name, Object o)Creates aDisplayfor the given object, and shows it using an appropriate UI widget of the default user interface.voidshow(Display<?> display)Creates and shows the givenDisplayusing an appropriate UI widget of the default user interface.voidshowContextMenu(String menuRoot, Display<?> display, int x, int y)Displays a popup context menu for the given display at the specified position.DialogPrompt.ResultshowDialog(String message)Displays a dialog prompt.DialogPrompt.ResultshowDialog(String message, String title)Displays a dialog prompt.DialogPrompt.ResultshowDialog(String message, String title, DialogPrompt.MessageType messageType)Displays a dialog prompt.DialogPrompt.ResultshowDialog(String message, String title, DialogPrompt.MessageType messageType, DialogPrompt.OptionType optionType)Displays a dialog prompt.DialogPrompt.ResultshowDialog(String message, DialogPrompt.MessageType messageType)Displays a dialog prompt.DialogPrompt.ResultshowDialog(String message, DialogPrompt.MessageType messageType, DialogPrompt.OptionType optionType)Displays a dialog prompt.voidshowUI()Displays the UI for the default user interface.voidshowUI(String name)Displays the UI with the given name (or class name).voidshowUI(UserInterface ui)Displays the given UI.-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.Disposable
dispose
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Field Detail
-
UI_PROPERTY
static final String UI_PROPERTY
System property to set for overriding the default UI.- See Also:
- Constant Field Values
-
-
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()
Displays the UI for the default user interface.- See Also:
getDefaultUI(),setDefaultUI(UserInterface)
-
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()
Gets whether the default UI is visible.- See Also:
getDefaultUI(),setDefaultUI(UserInterface)
-
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.headlesssystem property or by callingGraphicsEnvironment.isHeadless()—then callingsetHeadless(false)will have no effect; the system will still be headless, andisHeadless()will still return true.But if the system itself is not headless, calling
setHeadless(true)will forceisHeadless()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.headlesssystem property is set, and/orGraphicsEnvironment.isHeadless()returns true, and/orsetHeadless(boolean)was called withtrueto force headless behavior in an otherwise headful environment.
-
getDefaultUI
UserInterface getDefaultUI()
Gets the default user interface.- See Also:
showUI(),isVisible()
-
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.
-
getUI
UserInterface getUI(String name)
Gets the UI with the given name (or class name).
-
getAvailableUIs
List<UserInterface> getAvailableUIs()
Gets the user interfaces available to the service.
-
getVisibleUIs
List<UserInterface> getVisibleUIs()
Gets the user interfaces that are currently visible.
-
getViewerPlugins
List<PluginInfo<DisplayViewer<?>>> getViewerPlugins()
Gets the list of known viewer plugins.
-
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 givenDisplay.
-
show
void show(Object o)
Creates aDisplayfor the given object, and shows it using an appropriate UI widget of the default user interface.
-
show
void show(String name, Object o)
Creates aDisplayfor 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 givenDisplayusing 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_MESSAGEtypically 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_MESSAGEtypically 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_MESSAGEtypically 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_MESSAGEtypically 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.
-
chooseFile
File chooseFile(File file, String style)
Prompts the user to choose a file.The prompt is displayed in the default user interface.
- Parameters:
file- The initial value displayed in the file chooser prompt.style- The style of chooser to use:
-
chooseFile
File chooseFile(String title, File file, String style)
Prompts the user to choose a file.The prompt is displayed in the default user interface.
- Parameters:
title- Title to use in the file chooser dialog.file- The initial value displayed in the file chooser prompt.style- The style of chooser to use:
-
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.
-
getStatusMessage
String getStatusMessage(StatusEvent statusEvent)
Gets the status message associated with the given event.
-
-