Class PleaseWaitRunnable

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected PleaseWaitRunnable​(java.awt.Component parent, java.lang.String title, boolean ignoreException)
      Create the runnable object with a given message for the user
      protected PleaseWaitRunnable​(java.lang.String title)
      Create the runnable object with a given message for the user.
      protected PleaseWaitRunnable​(java.lang.String title, boolean ignoreException)
      Create the runnable object with a given message for the user.
      protected PleaseWaitRunnable​(java.lang.String title, ProgressMonitor progressMonitor, boolean ignoreException)
      Create the runnable object with a given message for the user
    • Constructor Detail

      • PleaseWaitRunnable

        protected PleaseWaitRunnable​(java.lang.String title)
        Create the runnable object with a given message for the user.
        Parameters:
        title - message for the user
      • PleaseWaitRunnable

        protected PleaseWaitRunnable​(java.lang.String title,
                                     boolean ignoreException)
        Create the runnable object with a given message for the user.
        Parameters:
        title - message for the user
        ignoreException - If true, exception will be silently ignored. If false then exception will be handled by showing a dialog. When this runnable is executed using executor framework then use false unless you read result of task (because exception will get lost if you don't)
      • PleaseWaitRunnable

        protected PleaseWaitRunnable​(java.awt.Component parent,
                                     java.lang.String title,
                                     boolean ignoreException)
        Create the runnable object with a given message for the user
        Parameters:
        parent - the parent component for the please wait dialog. Must not be null.
        title - message for the user
        ignoreException - If true, exception will be silently ignored. If false then exception will be handled by showing a dialog. When this runnable is executed using executor framework then use false unless you read result of task (because exception will get lost if you don't)
        Throws:
        java.lang.IllegalArgumentException - if parent is null
      • PleaseWaitRunnable

        protected PleaseWaitRunnable​(java.lang.String title,
                                     ProgressMonitor progressMonitor,
                                     boolean ignoreException)
        Create the runnable object with a given message for the user
        Parameters:
        title - message for the user
        progressMonitor - progress monitor
        ignoreException - If true, exception will be silently ignored. If false then exception will be handled by showing a dialog. When this runnable is executed using executor framework then use false unless you read result of task (because exception will get lost if you don't)
    • Method Detail

      • afterFinish

        protected void afterFinish()
        Can be overridden if something needs to run after progress monitor is closed.
      • run

        public final void run()
        Specified by:
        run in interface java.lang.Runnable
      • cancel

        protected abstract void cancel()
        User pressed cancel button.
      • realRun

        protected abstract void realRun()
                                 throws org.xml.sax.SAXException,
                                        java.io.IOException,
                                        OsmTransferException
        Called in the worker thread to do the actual work. When any of the exception is thrown, a message box will be displayed and closeDialog is called. finish() is called in any case.
        Throws:
        org.xml.sax.SAXException - if a SAX error occurs
        java.io.IOException - if an I/O error occurs
        OsmTransferException - if a communication error with the OSM server occurs
      • finish

        protected abstract void finish()
        Finish up the data work. Is guaranteed to be called if realRun is called. Finish is called in the gui thread just after the dialog disappeared.
      • canRunInBackground

        public ProgressTaskId canRunInBackground()
        Task can run in background if returned value != null. Note that it's tasks responsibility to ensure proper synchronization, PleaseWaitRunnable doesn't with it.
        Returns:
        If returned value is != null then task can run in background. TaskId could be used in future for "Always run in background" checkbox