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, toString
getInfo, getPriority, setInfo, setPriority
context
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
initialize, registerEventHandlers
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
public 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()
UIService
showUI
in interface UIService
UIService.getDefaultUI()
,
UIService.setDefaultUI(UserInterface)
public void showUI(String name)
UIService
public void showUI(UserInterface ui)
UIService
public boolean isVisible()
UIService
isVisible
in interface UIService
UIService.getDefaultUI()
,
UIService.setDefaultUI(UserInterface)
public boolean isVisible(String name)
UIService
public void setHeadless(boolean headless)
UIService
setHeadless
in interface UIService
public boolean isHeadless()
UIService
isHeadless
in interface UIService
public UserInterface getDefaultUI()
UIService
getDefaultUI
in interface UIService
UIService.showUI()
,
UIService.isVisible()
public void setDefaultUI(UserInterface ui)
UIService
setDefaultUI
in interface UIService
UIService.showUI()
public boolean isDefaultUI(String name)
UIService
isDefaultUI
in interface UIService
public UserInterface getUI(String name)
UIService
public List<UserInterface> getAvailableUIs()
UIService
getAvailableUIs
in interface UIService
public List<UserInterface> getVisibleUIs()
UIService
getVisibleUIs
in interface UIService
public List<PluginInfo<DisplayViewer<?>>> getViewerPlugins()
UIService
getViewerPlugins
in interface UIService
public void show(Object o)
UIService
Display
for the given object, and shows it using an
appropriate UI widget of the default user interface.public void show(String name, Object o)
UIService
Display
for the given object, and shows it using an
appropriate UI widget of the default user interface.public void show(Display<?> display)
UIService
Display
using an appropriate UI widget
of the default user interface.public void addDisplayViewer(DisplayViewer<?> viewer)
UIService
addDisplayViewer
in interface UIService
public DisplayViewer<?> getDisplayViewer(Display<?> display)
UIService
Display
.getDisplayViewer
in interface UIService
public DialogPrompt.Result showDialog(String message)
UIService
The prompt is displayed in the default user interface.
showDialog
in interface UIService
message
- The message in the dialog itself.public DialogPrompt.Result showDialog(String message, DialogPrompt.MessageType messageType)
UIService
The prompt is displayed in the default user interface.
showDialog
in interface UIService
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.public DialogPrompt.Result showDialog(String message, DialogPrompt.MessageType messageType, DialogPrompt.OptionType optionType)
UIService
The prompt is displayed in the default user interface.
showDialog
in interface UIService
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.public DialogPrompt.Result showDialog(String message, String title)
UIService
The prompt is displayed in the default user interface.
showDialog
in interface UIService
message
- The message in the dialog itself.title
- The title of the dialog.public DialogPrompt.Result showDialog(String message, String title, DialogPrompt.MessageType messageType)
UIService
The prompt is displayed in the default user interface.
showDialog
in interface UIService
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.public DialogPrompt.Result showDialog(String message, String title, DialogPrompt.MessageType messageType, DialogPrompt.OptionType optionType)
UIService
The prompt is displayed in the default user interface.
showDialog
in interface UIService
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.public File chooseFile(File file, String style)
UIService
The prompt is displayed in the default user interface.
chooseFile
in interface UIService
file
- 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)
UIService
The prompt is displayed in the default user interface.
chooseFile
in interface UIService
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:
public File[] chooseFiles(File parent, File[] files, FileFilter filter, String style)
UIService
The prompt is displayed in the default user interface.
chooseFiles
in interface UIService
files
- 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)
UIService
The prompt is displayed in the default user interface.
chooseFiles
in interface UIService
fileList
- 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)
UIService
The context menu is displayed in the default user interface.
showContextMenu
in interface UIService
public String getStatusMessage(StatusEvent statusEvent)
UIService
getStatusMessage
in interface UIService
StatusService.getStatusMessage(String, StatusEvent)
public void dispose()
Disposable
dispose
in interface Disposable
protected 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.