Package cl.obcom.desktopfx.core
Interface DesktopTask
public interface DesktopTask
Component dynamically loaded by the
Desktop
.-
Method Summary
Modifier and TypeMethodDescription<T extends Event>
voidaddEventHandler
(EventType<T> type, EventHandler<? super T> handler) Registers an event handler to thisDesktopTask
.createCompiler
(Object defaultLogic) Returns a new DesktopCompiler
with default user logic.Creates and returns a new mail message builder and sender.createNetServerClient
(String channelName) Returns a newNetServerClient
bound to thisDesktopTask
.createTask
(String plugin, String main, String title, Object argument) Creates a newDesktopTask
with supplied plugin, main, title and argument.createTask
(String plugin, String main, String title, Object argument, EventHandler<ModalEvent> handler) Creates a newDesktopTask
with supplied plugin, main, title, argument and handler.void
deleteSettings
(AccessLevel level, String name) Deletes settings with the specified access level and name.encodeCredentials
(String userCode, char[] password) Returns a string with the encoding of supplied credentials.Returns theApplication
of the Desktop.<T> T
getArgument
(Class<T> type) Returns the typed argument of thisDesktopTask
.Returns the codebase of the plugin of thisDesktopTask
.Returns the configuration parameters of the Desktop.Returns theDesktopTask
that created thisDesktopTask
.Returns the DDE Topic of thisDesktopTask
.Returns the image indexed by name ornull
if not found.Returns the name of the tree leaf of thisDesktopTask
.Returns the license of the Desktop.Returns the main name of thisDesktopTask
.Returns the Desktop NetServer Manager.Returns the class of the plugin of thisDesktopTask
.Returns the directory of the plugin of thisDesktopTask
.Returns the name of the plugin of thisDesktopTask
.Returns the node of the plugin of thisDesktopTask
.Returns the version of the plugin of thisDesktopTask
.Returns the content pane of the primaryStage
.Returns the root pane of the primaryStage
.Returns the primaryStage
of the Desktop.Returns the secure codebase of the plugin of thisDesktopTask
.Returns the environment name of the Application Server.Returns the file extension of a page of the Application Server.long
Returns the time of the Application Server (milliseconds).Returns the time zone of the Application Server.Returns the settings of thisDesktopTask
.Returns the shared settings of the Desktop.boolean
Returnstrue
if thisDesktopTask
shows the terminate dialog.getStage()
Returns theStage
of thisDesktopTask
.Returns the station of the Desktop.int
Returns the unique identification of the Desktop.getUser()
Returns the user of the Desktop.Returns the version string of the Desktop.Returns the window of thisDesktopTask
.void
Initialize the HTTP Security Headers of anHttpRequest.Builder
.void
initHttpSecurityHeaders
(URLConnection urlconn) Initialize the HTTP Security Headers of anURLConnection
.void
initWebServicePort
(Object port) Initialize a web service port.void
initWebServicePort
(Object port, jakarta.xml.ws.Service service, URL codebase) Initialize a web service port using supplied service and codebase.void
initWebServicePort
(Object port, URL endpoint) Initialize a web service port using supplied endpoint.boolean
Returnstrue
if thisDesktopTask
has terminated.listSettings
(AccessLevel level, String prefix) Returns the names of the settings saved at specified access level filtered by supplied name prefix.void
Locks the Desktop windows and waits for the user to supply a password.void
Sends a message to all that have subscribed to the named multicast.readSettings
(AccessLevel level, String name) Reads settings with the specified access level and name.<T extends Event>
voidremoveEventHandler
(EventType<T> type, EventHandler<? super T> handler) Unregisters an event handler from thisDesktopTask
.void
renameSettings
(AccessLevel level, String name, String newName) Renames settings with the specified access level and name.searchUser
(UserFilter filter, String title) Displays a dialog to seach for a user that matches a search criteria.searchUser
(Window owner, UserFilter filter, String title) Displays a dialog to seach for a user that matches a search criteria.void
Sends the mail message to one or more recipients.void
setShowTerminateDialog
(boolean show) Changes the whether thisDesktopTask
shows the terminate dialog.void
subscribe
(String name, EventHandler<MulticastEvent> handler) Subscribes thisDesktopTask
to the multicast with the specified name.void
terminate
(boolean cancellable) Terminates the execution of thisDesktopTask
.void
Terminates the execution of this modalDesktopTask
.void
unsubscribe
(String name, EventHandler<MulticastEvent> handler) Unsubscribes thisDesktopTask
from the multicast with the specified name.void
writeSettings
(AccessLevel level, String name, Settings settings) Writes settings with the specified access level and name.
-
Method Details
-
getVersion
String getVersion()Returns the version string of the Desktop.- Returns:
- the version string of the Desktop.
-
getUniqueID
int getUniqueID()Returns the unique identification of the Desktop.- Returns:
- the unique identification of the Desktop.
-
getConfig
DesktopConfig getConfig()Returns the configuration parameters of the Desktop.- Returns:
- the configuration parameters of the Desktop.
-
getUser
DesktopUser getUser()Returns the user of the Desktop.- Returns:
- the user of the Desktop.
-
getLicense
DesktopLicense getLicense()Returns the license of the Desktop.- Returns:
- the license of the Desktop.
-
getStation
DesktopStation getStation()Returns the station of the Desktop.- Returns:
- the station of the Desktop.
-
createCompiler
Returns a new DesktopCompiler
with default user logic.- Parameters:
defaultLogic
- an object with default user logic.- Returns:
- a new Desktop
Compiler
with default user logic. - Throws:
NullPointerException
- ifdefaultLogic
isnull
.
-
lockDesktop
void lockDesktop()Locks the Desktop windows and waits for the user to supply a password.This method will post a
Runnable
to the event queue and then return immediately to the caller. The postedRunnable
will lock the Desktop windows at a later time.If the Desktop is already locked, this method has no effect.
-
encodeCredentials
Returns a string with the encoding of supplied credentials.- Parameters:
userCode
- the identification of the user.password
- the plain-text password of the user.- Returns:
- a string with the encoding of supplied credentials.
- Throws:
NullPointerException
- if an argument isnull
.IllegalArgumentException
- if an argument is invalid.
-
getApplication
Application getApplication()Returns theApplication
of the Desktop.- Returns:
- the
Application
of the Desktop.
-
getPrimaryStage
Stage getPrimaryStage()Returns the primaryStage
of the Desktop.- Returns:
- the primary
Stage
of the Desktop.
-
getPrimaryRootPane
AnchorPane getPrimaryRootPane()Returns the root pane of the primaryStage
.- Returns:
- the root pane of the primary
Stage
.
-
getPrimaryContentPane
AnchorPane getPrimaryContentPane()Returns the content pane of the primaryStage
.- Returns:
- the content pane of the primary
Stage
.
-
getImage
Returns the image indexed by name ornull
if not found.- Parameters:
name
- the name of the required image (without extension).- Returns:
- the image indexed by
name
ornull
if not found. - Throws:
NullPointerException
- ifname
isnull
.
-
getServerTime
long getServerTime()Returns the time of the Application Server (milliseconds).- Returns:
- the time of the Application Server (milliseconds).
-
getServerTimeZone
TimeZone getServerTimeZone()Returns the time zone of the Application Server.- Returns:
- the time zone of the Application Server.
-
getServerEnvironName
String getServerEnvironName()Returns the environment name of the Application Server.- Returns:
- the environment name of the Application Server.
-
getServerPageExtension
String getServerPageExtension()Returns the file extension of a page of the Application Server.- Returns:
- the file extension of a page of the Application Server.
-
initHttpSecurityHeaders
Initialize the HTTP Security Headers of anURLConnection
.- Parameters:
urlconn
- the URL Connection to be initialized.- Throws:
NullPointerException
- ifurlconn
isnull
.
-
initHttpSecurityHeaders
Initialize the HTTP Security Headers of anHttpRequest.Builder
.- Parameters:
builder
- the HTTP Request Builder to be initialized.- Throws:
NullPointerException
- ifbuilder
isnull
.
-
initWebServicePort
Initialize a web service port.- Parameters:
port
- the web service port to initialize.- Throws:
NullPointerException
- ifport
isnull
.IllegalArgumentException
- if theport
is invalid.Exception
- if another error occurs.
-
initWebServicePort
Initialize a web service port using supplied endpoint.- Parameters:
port
- the web service port to initialize.endpoint
- the endpoint of the web service port.- Throws:
NullPointerException
- if an argument isnull
.IllegalArgumentException
- if theport
is invalid.Exception
- if another error occurs.
-
initWebServicePort
Initialize a web service port using supplied service and codebase.- Parameters:
port
- the web service port to initialize.service
- the web service associatted with the port.codebase
- the codebase used to compute the port endpoint.- Throws:
NullPointerException
- if an argument isnull
.IllegalArgumentException
- if theport
is invalid.Exception
- if another error occurs.
-
createMailSender
Creates and returns a new mail message builder and sender.- Returns:
- a new mail message builder and sender.
- Throws:
Exception
- if another error occurs.
-
sendMail
Sends the mail message to one or more recipients. When specifying multiple recipients, addresses must be separated by commas.- Parameters:
recipients
- the recipient mail address.subject
- the subject of the mail message.html
- the html message of the body of the message.- Throws:
NullPointerException
- if an argument isnull
.IllegalArgumentException
- if an argument is invalid.Exception
- if another error occurs.
-
searchUser
Displays a dialog to seach for a user that matches a search criteria.- Parameters:
filter
- determines if a user matches the search criteria.title
- title displayed in the search dialog (can be null).- Returns:
- the selected user or
null
if the dialog is cancelled. - Throws:
NullPointerException
- iffilter
isnull
.Exception
- if an unexpected error occurs.
-
searchUser
Displays a dialog to seach for a user that matches a search criteria.- Parameters:
owner
- the window owner of the dialog.filter
- determines if a user matches the search criteria.title
- title displayed in the search dialog (can be null).- Returns:
- the selected user or
null
if the dialog is cancelled. - Throws:
NullPointerException
- if a required argument isnull
.Exception
- if an unexpected error occurs.
-
getNetServerManager
Returns the Desktop NetServer Manager.- Returns:
- the Desktop NetServer Manager.
- Throws:
IllegalStateException
- if NetServer Manager is not available.Exception
- if another error occurs.
-
createNetServerClient
Returns a newNetServerClient
bound to thisDesktopTask
.- Parameters:
channelName
- the name of theNetServerChannel
.- Returns:
- a new
NetServerClient
bound to thisDesktopTask
. - Throws:
NullPointerException
- ifchannelName
isnull
.IllegalArgumentException
- if theNetServerChannel
is not defined.IllegalStateException
- if NetServer Manager is not available.Exception
- if another error occurs.
-
getPluginName
String getPluginName()Returns the name of the plugin of thisDesktopTask
.- Returns:
- the name of the plugin of this
DesktopTask
.
-
getPluginVersion
String getPluginVersion()Returns the version of the plugin of thisDesktopTask
.- Returns:
- the version of the plugin of this
DesktopTask
.
-
getPluginClass
Returns the class of the plugin of thisDesktopTask
.- Returns:
- the class of the plugin of this
DesktopTask
.
-
getPluginNode
Node getPluginNode()Returns the node of the plugin of thisDesktopTask
.- Returns:
- the node of the plugin of this
DesktopTask
.
-
getPluginDirectory
File getPluginDirectory()Returns the directory of the plugin of thisDesktopTask
.- Returns:
- the directory of the plugin of this
DesktopTask
.
-
getCodeBase
URL getCodeBase()Returns the codebase of the plugin of thisDesktopTask
.- Returns:
- the codebase of the plugin of this
DesktopTask
.
-
getSecureCodeBase
URL getSecureCodeBase()Returns the secure codebase of the plugin of thisDesktopTask
.- Returns:
- the secure codebase of the plugin of this
DesktopTask
.
-
getLeafName
String getLeafName()Returns the name of the tree leaf of thisDesktopTask
.- Returns:
- the name or
null
if none assigned.
-
getCreator
DesktopTask getCreator()Returns theDesktopTask
that created thisDesktopTask
.- Returns:
- the creator or
null
if creator is Desktop.
-
getMainName
String getMainName()Returns the main name of thisDesktopTask
.- Returns:
- the main name of this
DesktopTask
.
-
getArgument
Returns the typed argument of thisDesktopTask
.- Type Parameters:
T
- the required type of the argument object.- Parameters:
type
- the required class type of the argument object.- Returns:
- the typed argument or
null
if none available. - Throws:
NullPointerException
- iftype
isnull
.ClassCastException
- if argument cannot be cast totype
.
-
getSettings
Settings getSettings()Returns the settings of thisDesktopTask
.- Returns:
- the settings of this
DesktopTask
.
-
getWindow
TaskWindow getWindow()Returns the window of thisDesktopTask
.- Returns:
- the window of this
DesktopTask
.
-
getStage
Stage getStage()Returns theStage
of thisDesktopTask
.- Returns:
- the
Stage
of thisDesktopTask
.
-
getDdeTopic
Returns the DDE Topic of thisDesktopTask
.- Returns:
- the DDE Topic of this
DesktopTask
. - Throws:
Exception
- if an error occurs.
-
isTerminated
boolean isTerminated()Returnstrue
if thisDesktopTask
has terminated.- Returns:
true
if thisDesktopTask
has terminated.
-
terminate
void terminate(boolean cancellable) Terminates the execution of thisDesktopTask
. This is just a convenience method implemented by the following trivial call statement:terminate(cancellable, null);
- Parameters:
cancellable
- iftrue
the termination can be cancelled.- See Also:
-
terminate
Terminates the execution of this modalDesktopTask
.If
cancellable
istrue
, a dialog will be displayed asking the user for confirmation. Otherwise, theDesktopTask
will be terminated without confirmation.The
result
object is used to call the modal event handler provided tocreateTask
. If thisDesktopTask
is not modal (i.e., was created without a modal event handler), theresult
object is ignored and discarded.- Parameters:
cancellable
- iftrue
the termination can be cancelled.result
- an object with the result of the modal task (can be null).
-
getShowTerminateDialog
boolean getShowTerminateDialog()Returnstrue
if thisDesktopTask
shows the terminate dialog.- Returns:
true
if thisDesktopTask
shows the terminate dialog.
-
setShowTerminateDialog
void setShowTerminateDialog(boolean show) Changes the whether thisDesktopTask
shows the terminate dialog.- Parameters:
show
- iftrue
the terminate dialog is shown on terminate.
-
publish
Sends a message to all that have subscribed to the named multicast.- Parameters:
name
- the name of the multicast message.data
- the data of the multicast message (can be null).- Throws:
NullPointerException
- ifname
isnull
.Exception
- if another error occurs.
-
subscribe
Subscribes thisDesktopTask
to the multicast with the specified name. The supplied multicast handler is called every time someone publishes a multicast message with the given name.- Parameters:
name
- the name of the multicast message.handler
- the handler to call with a published message.- Throws:
NullPointerException
- if an argument isnull
.
-
unsubscribe
Unsubscribes thisDesktopTask
from the multicast with the specified name. Nothing happens if thisDesktopTask
is not subscribed to the named multicast.- Parameters:
name
- the name of the multicast message.handler
- the handler to call with a published message.- Throws:
NullPointerException
- if an argument isnull
.
-
addEventHandler
Registers an event handler to thisDesktopTask
. The handler is called when theDesktopTask
receives anEvent
of the specified type.- Type Parameters:
T
- the specific event class of the handler.- Parameters:
type
- the type of the events to receive by the handler.handler
- the handler to register.- Throws:
NullPointerException
- if thetype
orhandler
isnull
.IllegalStateException
- if theDesktopTask
has been terminated.
-
removeEventHandler
Unregisters an event handler from thisDesktopTask
. One handler might have been registered for different event types, so the caller needs to specify the particular event type from which to unregister the handler.- Type Parameters:
T
- the specific event class of the handler.- Parameters:
type
- the event type from which to unregister.handler
- the handler to unregister.- Throws:
NullPointerException
- if thetype
orhandler
isnull
.
-
createTask
Creates a newDesktopTask
with supplied plugin, main, title and argument. This is just a convenience method implemented by the following trivial call statement:createTask(plugin, main, title, argument, null);
- Parameters:
plugin
- the name of the plugin (can be null).main
- the name of the plugin class (required).title
- the title of the plugin window (can be null).argument
- a user-defined plugin argument (can be null).- Returns:
- the new
DesktopTask
created with supplied arguments. - Throws:
NullPointerException
- if a required argument isnull
.- See Also:
-
createTask
DesktopTask createTask(String plugin, String main, String title, Object argument, EventHandler<ModalEvent> handler) Creates a newDesktopTask
with supplied plugin, main, title, argument and handler. Ifplugin
isnull
, the name returned bygetPluginName()
is used. Iftitle
isnull
, a default title is provided. The value ofargument
can be retrieved by callinggetArgument(Class)
on the created task. Ifhandler
is notnull
, the created task will be modal, and thehandler
will be called with the object provided toterminate(boolean, Object)
.- Parameters:
plugin
- the name of the plugin (can be null).main
- the name of the plugin class (required).title
- the title of the plugin window (can be null).argument
- a user-defined plugin argument (can be null).handler
- called when the modal task terminates (can be null).- Returns:
- the new
DesktopTask
created with supplied arguments. - Throws:
NullPointerException
- if a required argument isnull
.
-
listSettings
Returns the names of the settings saved at specified access level filtered by supplied name prefix.- Parameters:
level
- the access level of the settings.prefix
- the name prefix used to filter the returned names.- Returns:
- the names of settings saved at specified access level.
- Throws:
NullPointerException
- if an argument isnull
.
-
readSettings
Reads settings with the specified access level and name.- Parameters:
level
- the access level of the settings.name
- the name of the required settings.- Returns:
- the requested settings or
null
if not found. - Throws:
NullPointerException
- if an argument isnull
.Exception
- if another error occurs.
-
writeSettings
Writes settings with the specified access level and name.- Parameters:
level
- the access level of the settings.name
- the name of the settings.settings
- the settings that will be saved.- Throws:
NullPointerException
- if an argument isnull
.Exception
- if another error occurs.
-
renameSettings
Renames settings with the specified access level and name.- Parameters:
level
- the access level of the settings.name
- the current name of the settings.newName
- the new name of the settings.- Throws:
NullPointerException
- if an argument isnull
.
-
deleteSettings
Deletes settings with the specified access level and name.- Parameters:
level
- the access level of the settings.name
- the name of the settings.- Throws:
NullPointerException
- if an argument isnull
.
-