For customizing the TaskMonitorDialog the source code of a plugin could look
like this:

class HelloProgressPlugIn extends AbstractPlugIn implements ThreadedPlugIn {

    void initialize(PlugInContext pluginContext) {}

    boolean execute(PlugInContext pluginContext) {
        return true
    }

    void run(TaskMonitor monitor, PlugInContext context) {
        Thread.sleep(2000)
    }

    TaskMonitorDialog getTaskMonitorDialog() {
        // return customized taskmonitordialog.
    }

}

Then in TaskMonitorManager.execute() it asks HelloProgressPlugIn for a
TaskMonitorDialog using HelloProgressPlugIn.getTaskMonitorDialog() and sends
it to the constructor of TaskWrapper.

TaskWrapper itself calls the run()-method of plugin (i.e. HelloPressPlugIn).

This is my basic idea. Have to test this, whether it's feasible. Maybe I
have some time later this week.

Here again an excerpt of the call hierarchy for AbstractPlugIn.

=== AbstractPlugIn.toActionListener() ===

boolean executeComplete = plugIn.execute(plugInContext);
if (plugIn instanceof ThreadedPlugIn && executeComplete) {
     taskMonitorManager.execute((ThreadedPlugIn) plugIn, plugInContext);
}

=== TaskMonitorManager.execute() ===

final TaskWrapper taskWrapper = new TaskWrapper(plugIn, context,
progressDialog);

=== TaskWrapper.run() ===

plugIn.run(dialog, context);

--Benjamin


2009/12/30 Sunburned Surveyor <sunburned.surve...@gmail.com>

> It's been a while since I posted that thread, and I'm afraid I don't
> remember all of the details that made me ask the questions. I know I
> definitely had concerns about adding layers inside a thread. It still
> seems to me that this would trigger painting of the LayerViewPanel.
> When this repainting is triggered, does it occur on the AWT Event
> Dispatch Thread, or withing the thread that added the layer? If the
> latter is true, we could run into threading problems.
>
> I never did get a good solution to my problem. I think I ended up not
> displaying a progress bar. I would like to revisit the issue at some
> point.
>
> Benjamin: Did you find a solution for your particular case? If not, I
> would be interested in discussing the situation with you so I could
> explore some solutions.
>
> The Sunburned Surveyor
>
> On Thu, Dec 10, 2009 at 10:27 AM, Stefan Steiniger <sst...@geo.uzh.ch>
> wrote:
> > Hei
> >
> > Benjamin Gudehus wrote:
> >> Hi!
> >>
> >>     PS: Who send the first message? I did not get it.
> >>
> >> I found the first message here:
> >>
> http://www.mail-archive.com/jump-pilot-devel@lists.sourceforge.net/msg06770.html
> >
> > aha.. thanks. I was traveling in August - that's why I did not know it.
> > But its quite funny that Landon asked that. because the plugins I write
> > contain text from Jon, which says what is happening, and the wiki has
> > those infos too.
> >
> >
> >>
> >>     you know that this is possible using
> >>     * monitor.report("computing feature " + count + " of " +
> numFeatures);
> >>
> >>
> >> I already implemented my plugin using monitor.report(). But after run()
> >> finished the dialog disappears. I also want to customize it, to show a
> >> nice progress bar (JProgressBar).
> >>
> >> Maybe I try to make TaskMonitorManager more flexible, thus one can use
> >> customized dialogs for run(). I have some experience with testing
> >> threads and swing. I suppose some tests would be very useful.
> >
> > ah good.. go ahead! Useful extensions are always welcome.
> > my experiences are rather in GIS algorithms. Threading is a black box to
> > me :) Though Sascha Teichman did know quite a bit, but he hasn't written
> > since they got this new project a year ago.
> >
> >
> >
> ------------------------------------------------------------------------------
> > Return on Information:
> > Google Enterprise Search pays you back
> > Get the facts.
> > http://p.sf.net/sfu/google-dev2dev
> > _______________________________________________
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to