public final class DefaultUIService extends AbstractService implements UIService
UI_PROPERTY| Constructor and Description |
|---|
DefaultUIService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addDisplayViewer(DisplayViewer<?> viewer)
Registers the given viewer with the service.
|
void |
addUI(String name,
UserInterface ui)
Adds the given UI to those managed by the service.
|
void |
addUI(UserInterface ui)
Adds the given UI to those managed by the service.
|
File |
chooseFile(File file,
String style)
Prompts the user to choose a file.
|
File |
chooseFile(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.
|
void |
dispose()
Performs any needed cleanup of the object's services, in preparation for
the object being retired (e.g., to make garbage collection possible).
|
List<UserInterface> |
getAvailableUIs()
Gets the user interfaces available to the service.
|
UserInterface |
getDefaultUI()
Gets the default user interface.
|
DisplayViewer<?> |
getDisplayViewer(Display<?> display)
Gets the UI widget being used to visualize the given
Display. |
String |
getStatusMessage(StatusEvent statusEvent)
Gets the status message associated with the given event.
|
UserInterface |
getUI(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.
|
boolean |
isDefaultUI(String name)
Gets whether the UI with the given name (or class name) is the default one.
|
boolean |
isHeadless()
Gets whether the UI is running in headless mode (no UI).
|
boolean |
isVisible()
Gets whether the default UI is visible.
|
boolean |
isVisible(String name)
Gets whether the UI with the given name or class name is visible.
|
protected void |
onEvent(AppQuitEvent event) |
protected void |
onEvent(DisplayActivatedEvent e)
Called when a display is activated.
|
protected void |
onEvent(DisplayCreatedEvent e)
Called when a display is created.
|
protected void |
onEvent(DisplayDeletedEvent e)
Called when a display is deleted.
|
protected void |
onEvent(DisplayUpdatedEvent e)
Called when a display is updated.
|
protected void |
onEvent(StatusEvent event) |
void |
setDefaultUI(UserInterface ui)
Sets the default user interface.
|
void |
setHeadless(boolean headless)
Sets whether the application is running in headless mode (no UI).
|
void |
show(Display<?> display)
Creates and shows the given
Display using an appropriate UI widget
of the default user interface. |
void |
show(Object o)
Creates a
Display for the given object, and shows it using an
appropriate UI widget of the default user interface. |
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. |
void |
showContextMenu(String menuRoot,
Display<?> display,
int x,
int y)
Displays a popup context menu for the given display at the specified
position.
|
DialogPrompt.Result |
showDialog(String message)
Displays a dialog prompt.
|
DialogPrompt.Result |
showDialog(String message,
DialogPrompt.MessageType messageType)
Displays a dialog prompt.
|
DialogPrompt.Result |
showDialog(String message,
DialogPrompt.MessageType messageType,
DialogPrompt.OptionType optionType)
Displays a dialog prompt.
|
DialogPrompt.Result |
showDialog(String message,
String title)
Displays a dialog prompt.
|
DialogPrompt.Result |
showDialog(String message,
String title,
DialogPrompt.MessageType messageType)
Displays a dialog prompt.
|
DialogPrompt.Result |
showDialog(String message,
String title,
DialogPrompt.MessageType messageType,
DialogPrompt.OptionType optionType)
Displays a dialog prompt.
|
void |
showUI()
Displays the UI for the default user interface.
|
void |
showUI(String name)
Displays the UI with the given name (or class name).
|
void |
showUI(UserInterface ui)
Displays the given UI.
|
getContext, setContext, toStringgetInfo, getPriority, setInfo, setPrioritycontextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitinitialize, registerEventHandlersgetIdentifier, logcontext, getContext, setContextcompareTo, getPriority, setPrioritygetInfo, setInfogetLocationgetVersionpublic void addUI(UserInterface ui)
UIService
Note that a UI added explicitly via this method will never be considered
the default UI unless UIService.setDefaultUI(UserInterface) is also called.
public void addUI(String name, UserInterface ui)
UIService
Note that a UI added explicitly via this method will never be considered
the default UI unless UIService.setDefaultUI(UserInterface) is also called.
public void showUI()
UIServiceshowUI in interface UIServiceUIService.getDefaultUI(),
UIService.setDefaultUI(UserInterface)public void showUI(String name)
UIServicepublic void showUI(UserInterface ui)
UIServicepublic boolean isVisible()
UIServiceisVisible in interface UIServiceUIService.getDefaultUI(),
UIService.setDefaultUI(UserInterface)public boolean isVisible(String name)
UIServicepublic void setHeadless(boolean headless)
UIServicesetHeadless in interface UIServicepublic boolean isHeadless()
UIServiceisHeadless in interface UIServicepublic UserInterface getDefaultUI()
UIServicegetDefaultUI in interface UIServiceUIService.showUI(),
UIService.isVisible()public void setDefaultUI(UserInterface ui)
UIServicesetDefaultUI in interface UIServiceUIService.showUI()public boolean isDefaultUI(String name)
UIServiceisDefaultUI in interface UIServicepublic UserInterface getUI(String name)
UIServicepublic List<UserInterface> getAvailableUIs()
UIServicegetAvailableUIs in interface UIServicepublic List<UserInterface> getVisibleUIs()
UIServicegetVisibleUIs in interface UIServicepublic List<PluginInfo<DisplayViewer<?>>> getViewerPlugins()
UIServicegetViewerPlugins in interface UIServicepublic void show(Object o)
UIServiceDisplay for the given object, and shows it using an
appropriate UI widget of the default user interface.public void show(String name, Object o)
UIServiceDisplay for the given object, and shows it using an
appropriate UI widget of the default user interface.public void show(Display<?> display)
UIServiceDisplay using an appropriate UI widget
of the default user interface.public void addDisplayViewer(DisplayViewer<?> viewer)
UIServiceaddDisplayViewer in interface UIServicepublic DisplayViewer<?> getDisplayViewer(Display<?> display)
UIServiceDisplay.getDisplayViewer in interface UIServicepublic DialogPrompt.Result showDialog(String message)
UIServiceThe prompt is displayed in the default user interface.
showDialog in interface UIServicemessage - The message in the dialog itself.public DialogPrompt.Result showDialog(String message, DialogPrompt.MessageType messageType)
UIServiceThe prompt is displayed in the default user interface.
showDialog in interface UIServicemessage - 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.public DialogPrompt.Result showDialog(String message, DialogPrompt.MessageType messageType, DialogPrompt.OptionType optionType)
UIServiceThe prompt is displayed in the default user interface.
showDialog in interface UIServicemessage - 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.public DialogPrompt.Result showDialog(String message, String title)
UIServiceThe prompt is displayed in the default user interface.
showDialog in interface UIServicemessage - The message in the dialog itself.title - The title of the dialog.public DialogPrompt.Result showDialog(String message, String title, DialogPrompt.MessageType messageType)
UIServiceThe prompt is displayed in the default user interface.
showDialog in interface UIServicemessage - 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.public DialogPrompt.Result showDialog(String message, String title, DialogPrompt.MessageType messageType, DialogPrompt.OptionType optionType)
UIServiceThe prompt is displayed in the default user interface.
showDialog in interface UIServicemessage - 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.public File chooseFile(File file, String style)
UIServiceThe prompt is displayed in the default user interface.
chooseFile in interface UIServicefile - The initial value displayed in the file chooser prompt.style - The style of chooser to use:
public File chooseFile(String title, File file, String style)
UIServiceThe prompt is displayed in the default user interface.
chooseFile in interface UIServicetitle - 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:
public File[] chooseFiles(File parent, File[] files, FileFilter filter, String style)
UIServiceThe prompt is displayed in the default user interface.
chooseFiles in interface UIServicefiles - The initial value displayed in the file chooser prompt.filter - A filter allowing to restrict the choice of filespublic List<File> chooseFiles(File parent, List<File> fileList, FileFilter filter, String style)
UIServiceThe prompt is displayed in the default user interface.
chooseFiles in interface UIServicefileList - The initial value displayed in the file chooser prompt.filter - A filter allowing to restrict the choice of filespublic void showContextMenu(String menuRoot, Display<?> display, int x, int y)
UIServiceThe context menu is displayed in the default user interface.
showContextMenu in interface UIServicepublic String getStatusMessage(StatusEvent statusEvent)
UIServicegetStatusMessage in interface UIServiceStatusService.getStatusMessage(String, StatusEvent)public void dispose()
Disposabledispose in interface Disposableprotected void onEvent(DisplayCreatedEvent e)
protected void onEvent(DisplayDeletedEvent e)
protected void onEvent(DisplayUpdatedEvent e)
protected void onEvent(DisplayActivatedEvent e)
The goal here is to eventually synchronize the window activation state with the display activation state if the display activation state changed programmatically. We queue a call on the UI thread to activate the display viewer of the currently active window.
protected void onEvent(AppQuitEvent event)
protected void onEvent(StatusEvent event)
Copyright © 2015–2022 SciJava. All rights reserved.