Interface DesktopTask


public interface DesktopTask
Component dynamically loaded by the Desktop.
  • 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.
    • getSharedSettings

      Settings getSharedSettings() throws Exception
      Returns the shared settings of the Desktop.
      Returns:
      the shared settings of the Desktop.
      Throws:
      Exception - if an error occurs.
    • createCompiler

      Compiler createCompiler(Object defaultLogic)
      Returns a new Desktop Compiler with default user logic.
      Parameters:
      defaultLogic - an object with default user logic.
      Returns:
      a new Desktop Compiler with default user logic.
      Throws:
      NullPointerException - if defaultLogic is null.
    • 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 posted Runnable will lock the Desktop windows at a later time.

      If the Desktop is already locked, this method has no effect.

    • encodeCredentials

      String encodeCredentials(String userCode, char[] password)
      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 is null.
      IllegalArgumentException - if an argument is invalid.
    • getApplication

      Application getApplication()
      Returns the Application of the Desktop.
      Returns:
      the Application of the Desktop.
    • getPrimaryStage

      Stage getPrimaryStage()
      Returns the primary Stage of the Desktop.
      Returns:
      the primary Stage of the Desktop.
    • getPrimaryRootPane

      AnchorPane getPrimaryRootPane()
      Returns the root pane of the primary Stage.
      Returns:
      the root pane of the primary Stage.
    • getPrimaryContentPane

      AnchorPane getPrimaryContentPane()
      Returns the content pane of the primary Stage.
      Returns:
      the content pane of the primary Stage.
    • getImage

      Image getImage(String name)
      Returns the image indexed by name or null if not found.
      Parameters:
      name - the name of the required image (without extension).
      Returns:
      the image indexed by name or null if not found.
      Throws:
      NullPointerException - if name is null.
    • 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

      void initHttpSecurityHeaders(URLConnection urlconn)
      Initialize the HTTP Security Headers of an URLConnection.
      Parameters:
      urlconn - the URL Connection to be initialized.
      Throws:
      NullPointerException - if urlconn is null.
    • initHttpSecurityHeaders

      void initHttpSecurityHeaders(HttpRequest.Builder builder)
      Initialize the HTTP Security Headers of an HttpRequest.Builder.
      Parameters:
      builder - the HTTP Request Builder to be initialized.
      Throws:
      NullPointerException - if builder is null.
    • initWebServicePort

      void initWebServicePort(Object port) throws Exception
      Initialize a web service port.
      Parameters:
      port - the web service port to initialize.
      Throws:
      NullPointerException - if port is null.
      IllegalArgumentException - if the port is invalid.
      Exception - if another error occurs.
    • initWebServicePort

      void initWebServicePort(Object port, URL endpoint) throws Exception
      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 is null.
      IllegalArgumentException - if the port is invalid.
      Exception - if another error occurs.
    • initWebServicePort

      void initWebServicePort(Object port, jakarta.xml.ws.Service service, URL codebase) throws Exception
      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 is null.
      IllegalArgumentException - if the port is invalid.
      Exception - if another error occurs.
    • createMailSender

      MailSender createMailSender() throws Exception
      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

      void sendMail(String recipients, String subject, String html) throws Exception
      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 is null.
      IllegalArgumentException - if an argument is invalid.
      Exception - if another error occurs.
    • searchUser

      DesktopUser searchUser(UserFilter filter, String title) throws Exception
      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 - if filter is null.
      Exception - if an unexpected error occurs.
    • searchUser

      DesktopUser searchUser(Window owner, UserFilter filter, String title) throws Exception
      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 is null.
      Exception - if an unexpected error occurs.
    • getNetServerManager

      NetServerManager getNetServerManager() throws Exception
      Returns the Desktop NetServer Manager.
      Returns:
      the Desktop NetServer Manager.
      Throws:
      IllegalStateException - if NetServer Manager is not available.
      Exception - if another error occurs.
    • createNetServerClient

      NetServerClient createNetServerClient(String channelName) throws Exception
      Returns a new NetServerClient bound to this DesktopTask.
      Parameters:
      channelName - the name of the NetServerChannel.
      Returns:
      a new NetServerClient bound to this DesktopTask.
      Throws:
      NullPointerException - if channelName is null.
      IllegalArgumentException - if the NetServerChannel 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 this DesktopTask.
      Returns:
      the name of the plugin of this DesktopTask.
    • getPluginVersion

      String getPluginVersion()
      Returns the version of the plugin of this DesktopTask.
      Returns:
      the version of the plugin of this DesktopTask.
    • getPluginClass

      Class<? extends Node> getPluginClass()
      Returns the class of the plugin of this DesktopTask.
      Returns:
      the class of the plugin of this DesktopTask.
    • getPluginNode

      Node getPluginNode()
      Returns the node of the plugin of this DesktopTask.
      Returns:
      the node of the plugin of this DesktopTask.
    • getPluginDirectory

      File getPluginDirectory()
      Returns the directory of the plugin of this DesktopTask.
      Returns:
      the directory of the plugin of this DesktopTask.
    • getCodeBase

      URL getCodeBase()
      Returns the codebase of the plugin of this DesktopTask.
      Returns:
      the codebase of the plugin of this DesktopTask.
    • getSecureCodeBase

      URL getSecureCodeBase()
      Returns the secure codebase of the plugin of this DesktopTask.
      Returns:
      the secure codebase of the plugin of this DesktopTask.
    • getLeafName

      String getLeafName()
      Returns the name of the tree leaf of this DesktopTask.
      Returns:
      the name or null if none assigned.
    • getCreator

      DesktopTask getCreator()
      Returns the DesktopTask that created this DesktopTask.
      Returns:
      the creator or null if creator is Desktop.
    • getMainName

      String getMainName()
      Returns the main name of this DesktopTask.
      Returns:
      the main name of this DesktopTask.
    • getArgument

      <T> T getArgument(Class<T> type)
      Returns the typed argument of this DesktopTask.
      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 - if type is null.
      ClassCastException - if argument cannot be cast to type.
    • getSettings

      Settings getSettings()
      Returns the settings of this DesktopTask.
      Returns:
      the settings of this DesktopTask.
    • getWindow

      TaskWindow getWindow()
      Returns the window of this DesktopTask.
      Returns:
      the window of this DesktopTask.
    • getStage

      Stage getStage()
      Returns the Stage of this DesktopTask.
      Returns:
      the Stage of this DesktopTask.
    • getDdeTopic

      DdeTopic getDdeTopic() throws Exception
      Returns the DDE Topic of this DesktopTask.
      Returns:
      the DDE Topic of this DesktopTask.
      Throws:
      Exception - if an error occurs.
    • isTerminated

      boolean isTerminated()
      Returns true if this DesktopTask has terminated.
      Returns:
      true if this DesktopTask has terminated.
    • terminate

      void terminate(boolean cancellable)
      Terminates the execution of this DesktopTask. This is just a convenience method implemented by the following trivial call statement:
      terminate(cancellable, null);
      Parameters:
      cancellable - if true the termination can be cancelled.
      See Also:
    • terminate

      void terminate(boolean cancellable, Object result)
      Terminates the execution of this modal DesktopTask.

      If cancellable is true, a dialog will be displayed asking the user for confirmation. Otherwise, the DesktopTask will be terminated without confirmation.

      The result object is used to call the modal event handler provided to createTask. If this DesktopTask is not modal (i.e., was created without a modal event handler), the result object is ignored and discarded.

      Parameters:
      cancellable - if true the termination can be cancelled.
      result - an object with the result of the modal task (can be null).
    • getShowTerminateDialog

      boolean getShowTerminateDialog()
      Returns true if this DesktopTask shows the terminate dialog.
      Returns:
      true if this DesktopTask shows the terminate dialog.
    • setShowTerminateDialog

      void setShowTerminateDialog(boolean show)
      Changes the whether this DesktopTask shows the terminate dialog.
      Parameters:
      show - if true the terminate dialog is shown on terminate.
    • publish

      void publish(String name, Object data) throws Exception
      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 - if name is null.
      Exception - if another error occurs.
    • subscribe

      void subscribe(String name, EventHandler<MulticastEvent> handler)
      Subscribes this DesktopTask 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 is null.
    • unsubscribe

      void unsubscribe(String name, EventHandler<MulticastEvent> handler)
      Unsubscribes this DesktopTask from the multicast with the specified name. Nothing happens if this DesktopTask 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 is null.
    • addEventHandler

      <T extends Event> void addEventHandler(EventType<T> type, EventHandler<? super T> handler)
      Registers an event handler to this DesktopTask. The handler is called when the DesktopTask receives an Event 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 the type or handler is null.
      IllegalStateException - if the DesktopTask has been terminated.
    • removeEventHandler

      <T extends Event> void removeEventHandler(EventType<T> type, EventHandler<? super T> handler)
      Unregisters an event handler from this DesktopTask. 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 the type or handler is null.
    • createTask

      DesktopTask createTask(String plugin, String main, String title, Object argument)
      Creates a new DesktopTask 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 is null.
      See Also:
    • createTask

      DesktopTask createTask(String plugin, String main, String title, Object argument, EventHandler<ModalEvent> handler)
      Creates a new DesktopTask with supplied plugin, main, title, argument and handler. If plugin is null, the name returned by getPluginName() is used. If title is null, a default title is provided. The value of argument can be retrieved by calling getArgument(Class) on the created task. If handler is not null, the created task will be modal, and the handler will be called with the object provided to terminate(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 is null.
    • listSettings

      List<String> listSettings(AccessLevel level, String prefix)
      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 is null.
    • readSettings

      Settings readSettings(AccessLevel level, String name) throws Exception
      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 is null.
      Exception - if another error occurs.
    • writeSettings

      void writeSettings(AccessLevel level, String name, Settings settings) throws Exception
      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 is null.
      Exception - if another error occurs.
    • renameSettings

      void renameSettings(AccessLevel level, String name, String newName)
      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 is null.
    • deleteSettings

      void deleteSettings(AccessLevel level, String name)
      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 is null.