Package org.scijava.ui
Interface UserInterface
-
- All Superinterfaces:
Comparable<Prioritized>,Contextual,Disposable,HasPluginInfo,Identifiable,Locatable,Logged,Prioritized,RichPlugin,SciJavaPlugin,Versioned
- All Known Implementing Classes:
AbstractUserInterface,HeadlessUI,HeadlessUI
public interface UserInterface extends RichPlugin, Disposable
An end-user SciJava application user interface.UIs discoverable at runtime must implement this interface and be annotated with @
Pluginwith attributePlugin.type()=UserInterface.class. While it possible to create a UI merely by implementing this interface, it is encouraged to instead extendAbstractUserInterface, for convenience.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default FilechooseFile(File file, String style)Prompts the user to choose a file.default FilechooseFile(String title, File file, String style)Prompts the user to choose a file.default File[]chooseFiles(File parent, File[] files, FileFilter filter, String style)Prompts the user to choose a list of files.default List<File>chooseFiles(File parent, List<File> fileList, FileFilter filter, String style)Prompts the user to choose a list of files.DisplayWindowcreateDisplayWindow(Display<?> display)Creates a new display window housing the given display, or null if not applicable.DialogPromptdialogPrompt(String message, String title, DialogPrompt.MessageType messageType, DialogPrompt.OptionType optionType)Creates a dialog prompter.default ApplicationFramegetApplicationFrame()Gets the main SciJava application frame, or null if not applicable.default ConsolePane<?>getConsolePane()Gets the main SciJava console pane, or null if not applicable.default DesktopgetDesktop()Gets the desktop, for use with multi-document interfaces (MDI), or null if not applicable.default StatusBargetStatusBar()Gets the main SciJava status bar, or null if not applicable.default SystemClipboardgetSystemClipboard()Gets the system clipboard associated with this UI, or null if not applicable.default ToolBargetToolBar()Gets the main SciJava toolbar, or null if not applicable.booleanisVisible()Whether this UI is visible onscreen.booleanrequiresEDT()Returns true if this UI requires the EDT.voidrestoreLocation()Restores the application frame's current location.voidsaveLocation()Persists the application frame's current location.voidshow()Shows the UI.default voidshow(Object o)Shows the object onscreen using an appropriate UI widget.voidshow(String name, Object o)Shows the object onscreen using an appropriate UI widget.voidshow(Display<?> display)Shows the display onscreen using an appropriate UI widget.voidshowContextMenu(String menuRoot, Display<?> display, int x, int y)Displays a popup context menu for the given display at the specified position.-
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.Versioned
getVersion
-
-
-
-
Method Detail
-
show
void show()
Shows the UI.Note that the actual UI components are created lazily when this method is called, rather then upon the UI's initial construction.
-
isVisible
boolean isVisible()
Whether this UI is visible onscreen.
-
show
default void show(Object o)
Shows the object onscreen using an appropriate UI widget.
-
show
void show(String name, Object o)
Shows the object onscreen using an appropriate UI widget.- Parameters:
name- The name to use when displaying the object.o- The object to be displayed.
-
show
void show(Display<?> display)
Shows the display onscreen using an appropriate UI widget.
-
getDesktop
default Desktop getDesktop()
Gets the desktop, for use with multi-document interfaces (MDI), or null if not applicable.
-
getApplicationFrame
default ApplicationFrame getApplicationFrame()
Gets the main SciJava application frame, or null if not applicable.
-
getToolBar
default ToolBar getToolBar()
Gets the main SciJava toolbar, or null if not applicable.
-
getStatusBar
default StatusBar getStatusBar()
Gets the main SciJava status bar, or null if not applicable.
-
getConsolePane
default ConsolePane<?> getConsolePane()
Gets the main SciJava console pane, or null if not applicable.
-
getSystemClipboard
default SystemClipboard getSystemClipboard()
Gets the system clipboard associated with this UI, or null if not applicable.
-
createDisplayWindow
DisplayWindow createDisplayWindow(Display<?> display)
Creates a new display window housing the given display, or null if not applicable.
-
dialogPrompt
DialogPrompt dialogPrompt(String message, String title, DialogPrompt.MessageType messageType, DialogPrompt.OptionType optionType)
Creates a dialog prompter.- 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 newly created DialogPrompt object, or null if not applicable.
-
chooseFile
default File chooseFile(File file, String style)
Prompts the user to choose a file.- Parameters:
file- The initial value displayed in the file chooser prompt.style- The style of chooser to use:- Returns:
- The
Filechosen by the user, or null if prompt is not available
-
chooseFile
default File chooseFile(String title, File file, String style)
Prompts the user to choose a file.- 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:- Returns:
- The
Filechosen by the user, or null if prompt is not available
-
chooseFiles
default File[] chooseFiles(File parent, File[] files, FileFilter filter, String style)
Prompts the user to choose a list of files.- Parameters:
parent- Parent folder for file selectionfiles- The initial value displayed in the file chooser prompt.filter- A filter allowing to restrict file choice.style- File selection style (files, directories, or both) and optional filters- Returns:
- The selected
Files chosen by the user, or null if the user cancels the prompt.
-
chooseFiles
default List<File> chooseFiles(File parent, List<File> fileList, FileFilter filter, String style)
Prompts the user to choose a list of files.- Parameters:
parent- Parent folder for file selectionfileList- The initial value displayed in the file chooser prompt.filter- A filter allowing to restrict file choice.style- File selection style (files, directories, or both) and optional filters- Returns:
- The selected
Files chosen by the user, or null if the user cancels the prompt.
-
showContextMenu
void showContextMenu(String menuRoot, Display<?> display, int x, int y)
Displays a popup context menu for the given display at the specified position.
-
saveLocation
void saveLocation()
Persists the application frame's current location.
-
restoreLocation
void restoreLocation()
Restores the application frame's current location.
-
requiresEDT
boolean requiresEDT()
Returns true if this UI requires the EDT.
-
-