This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 54941 - progress indication review
Summary: progress indication review
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker (vote)
Assignee: Miloslav Metelka
URL:
Keywords: API_REVIEW
Depends on:
Blocks: 57016
  Show dependency tree
 
Reported: 2005-02-14 13:56 UTC by Milos Kleint
Modified: 2008-12-22 22:55 UTC (History)
8 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
initial version of API. (48.65 KB, application/octet-stream)
2005-02-24 15:10 UTC, Milos Kleint
Details
arch document (28.93 KB, text/plain)
2005-02-28 14:42 UTC, Milos Kleint
Details
updated progress arch document (this time in html for better reading (44.35 KB, text/html)
2005-03-04 10:01 UTC, Milos Kleint
Details
updated javadocs. (74.32 KB, application/x-compressed)
2005-04-19 13:23 UTC, Milos Kleint
Details
updated arch document with code snippets. (46.22 KB, text/html)
2005-04-19 15:22 UTC, Milos Kleint
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Milos Kleint 2005-02-14 13:56:24 UTC
I'd like to ask for inception review on new
Progress API.
Comment 1 Milos Kleint 2005-02-24 15:10:13 UTC
Created attachment 20505 [details]
initial version of API.
Comment 2 Milos Kleint 2005-02-28 14:42:01 UTC
Created attachment 20557 [details]
arch document
Comment 3 Milos Kleint 2005-02-28 14:50:13 UTC
reassigning to apireviews (inception review on 8/3/2005),
API javadoc and arch document attached.
UI spec at: 
http://ui.netbeans.org/docs/ui/progress_indication/progress_indication_spec.html
Comment 4 Jaroslav Tulach 2005-03-01 13:24:09 UTC
The responsible reviewer is going to be Mila. Pavel, Tonda and Petr 
will have the vote as they are either main consumers or requestors 
of the progress indicator effort. Review is going to be next 
tuesday. Mila please announce it on nbdev soon. 
Comment 5 Jan Becicka 2005-03-02 13:33:54 UTC
I miss "shutdown progress bar" use case. Could you add it, please? Thanks.
Comment 6 _ tboudreau 2005-03-02 20:37:49 UTC
Comments on the API:

Javadoc should clarify if display names are unique - if I call

ProgressHandle a = ProgressHandleFactory.createHandle ("foo");
ProgressHandle b = ProgressHandleFactory.createHandle ("foo");

a == b?  a != b?  a.equals(b)

---

Slightly prefer "Cancelable" over "CancelableTask"

---

Unclear what the distinction between createHandle() and createSystemHandle() is, but I can 
guess:  createHandle() blocks the UI and createSystemHandle() doesn't?  If so, would prefer 
method names which make clear the UI behavior - "system" won't be terribly clear to 
someone new to NetBeans.  Maybe createHandle (String s, boolean blockUI)?

Or maybe this is just some distinction in the way the UI is presented and has nothing to do 
with blocking.

---

Unclear what happens if I call createProgressComponent() twice.

---

If I understand the netbeans package naming convention correctly, shouldn't the package 
be "org.netbeans.api.progress", not "org.netbeans.progress.api"?

---

Typically for long running tasks, we show "Finished doing something" in the statusbar.  
You might want ProgressHandle.finish (String message) to do this.
Comment 7 Milos Kleint 2005-03-03 07:50:46 UTC
ProgressHandle a = ProgressHandleFactory.createHandle ("foo");
ProgressHandle b = ProgressHandleFactory.createHandle ("foo");

correct is: a != b

I thought the name of the method "createHandle" is more than a hint
that  you get 2 distinct instances. I can add a comment about it though.

--

Cancelable vs. CancelableTask, I was deciding between the two.. no
real preference, CancelableTask somehow pretends to be a task of it's
own which is not. I used to have Backgroundable interface as well, but
that one sounded strange. that's why I picked Cancelabletask.

--

systemhandles are just a distinction in the UI. (lower priority for
display in the status line etc)
how would you rephrase the javadoc to make it more obvious?
"Create a handle for a long lasting task that is not triggered by
explicit user action."

--
"Unclear what happens if I call createProgressComponent() twice."
You get an illegal state exception.

--

"org.netbeans.api.progress" vs. "org.netbeans.progress.api". 
refactoring is cheap nowadays ;)

--

Not part of the UI spec now. Could be added in future if required.
Comment 8 Jan Becicka 2005-03-04 08:59:02 UTC
> Cancelable vs. CancelableTask:
BTW we already have identical Cancellable interface in the openide:

package org.openide.util;
public interface Cancellable {
    public boolean cancel ();
}

---

It looks like this API solves scenario, when I know progress and I
want to show it. But it does not solve scenario when I want to listen
on someone's progress and I want to show it.
Consider this use case (Find Usages):
Refactoring module asks java model to get references of some Field. It
is long lasting task and refactoring module wants to listen on this
task and show progress indication to user. Currently it is implemented
this way:

JavaMetamodel.getManager().getProgressSupport().addProgressListener(l);
field.getReferences();
.
.
class L implements ProgressListener {
   public start(ProgressEvent e) {
      //do something
   }
   .
   public step(ProgressEvent e) ...
   .
}

It looks like proposed progress indication api does not solve progress
observing, which is necessary for us.
Comment 9 Milos Kleint 2005-03-04 09:53:05 UTC
Re: Jan Becicka

1. Cancelable from org.openide.util makes sense, I was not aware such
interface exists already..

2. I'm not sure I understand te problem here. Would this not work for you?
JavaMetamodel.getManager().getProgressSupport().addProgressListener(l);
field.getReferences();
.
.
class L implements ProgressListener {
   public start(ProgressEvent e) {
      ProgressHandle handle = ProgresshandleFactory.createHandle("xxx");
      handle.start()

   }
   .
   public step(ProgressEvent e) {
      handle.progress("Another step done");
   }
   public void stop(ProgressEvent event) {
       handle.finish();
   }
Comment 10 Milos Kleint 2005-03-04 10:01:02 UTC
Created attachment 20676 [details]
updated progress arch document (this time in html for better reading
Comment 11 Milos Kleint 2005-03-04 10:01:39 UTC
I have updated the arch document's usecase section.
Comment 12 Jan Becicka 2005-03-04 10:14:32 UTC
> 2. I'm not sure I understand te problem here. Would this not work
for you?

Yes. Exactly. It works for me this way, but it does not replace my own
"Progress API".
Background of my previous post:
There was an internal Progress API in javacore (ProgressListener and
ProgressEvent). This mini Progress API was used in javacore and also
in Refactoring API. DevRev required not to use javacore's progress API
in refactoring API and advised to create an copy of this API in
refactoring module. So we have 2 progress APIs. One in javacore module
and second in refactoring module. My expactation was, that this
unhandsome thing disappears with new official Progress API.
Comment 13 Milos Kleint 2005-03-04 10:28:00 UTC
ok, I understand now.
I think the currently defined scope of the API is to provide api for
UI components representing progress.

Your usecase is more close to the concept of Job (as is in eclipse for
example) which includes the progress listening, job scheduling, job
chaining, task prioritizing etc.
As we already have RequestProcessor, your progress listening API
should most probably go there IMHO. One of the default listener
implementations could be a bridge to the Progress API that displays
the status in th UI. (That would be on par with the Eclipse job api
example)
Comment 14 Milos Kleint 2005-03-07 08:16:27 UTC
I've talked to the refactoring guys and I think I understand the
usecase now:
1. there are 1+ contributors to the progress, all having equal share
of the total length.
2. each of the contributors fills it's part of the progress with a
variable number of steps. (number of steps can change during
processing as well)
3. contributors can be added during processing, than the remaining
lenght has to be split and accustomize the new additional progress
contributor.
4. processing happens serially, one progress contributor after another.

is that correct?

Comment 15 Martin Matula 2005-03-07 09:12:29 UTC
Seems correct.
But as we discussed, we were hoping to also get a general progress API
(not bound to any visual component) that could replace our
ProgressListener and ProgressProvider interfaces that we had to
duplicate in javacore and refactoring. It is a simple API for
reporting progress to other (not necessarily visual) clients.
Comment 16 Jesse Glick 2005-03-07 15:25:39 UTC
BTW: s/Cancelable/Cancellable/g

Any support for named/metered subtasks? (Does anyone care?)
Comment 17 _ pkuzel 2005-03-10 10:46:24 UTC
Various notes touching ProcessHAndle ("PH") API other UI spec:

  - (semantics) Swing's ProgressMonitor allows to define
    a silence interval. Typically 2 sec. During this interval
    no progress is shown. It allows to use progress API in all
    cases - no one can project actual operation length (does
    it fit to <1sec category or >1sec category for given input?).

  - (ui, api) I need second progress component instance. I place the
    component in dedicated window that shows detailed action progress
    (including partial results).
    Add BoundedRangeModel PH.getBoundedRangeModel().
    
  - (api) remove Components from API and replace with models (see above).

  - (ui, api) I need navigation action. It should call my Runnable.
    Add PH.setNavigationAction(Runnable).

  - (api) cancellation should not be static parameter. Better
    PH.setCancelAction(Cancellable);

  - (api) Make the API thread safe. I can have two paralell threads
    one estimating complexity (counting folders is really expensive)
    and one performing actual operation.

  - (api) estimates should not be static parameter (passed in start()).
    More accurate estimate can be provided while operarion in progress.
    Add PH.estimate(int units) and PH.estimate(long time) methods. 

  - (api) I do not like start() semantics. I'd prefer the factory method
    to return already started instance.
Comment 18 Milos Kleint 2005-03-10 11:09:57 UTC
Jesse Glick wrote: 
   Any support for named/metered subtasks? (Does anyone care?)

Not exactly sure what you mean. Yarda showed me a usecase when a directory
structure copy would need to lookup the progress task somehow and create a
subtask for itself to be added to the overall task. I think such a usecase can
be solved by another layer of APIs on top of the basic one (which is attached to
the issue) I would prefer to keep them separate for sake of simplicity of the
basic API, as anything with subtasks has different contract that a simple task.

refactoring has a usecase for subtasks that together compose a progressbar to be
shown, that's IMHO similar.
Comment 19 Milos Kleint 2005-03-22 07:55:55 UTC
the ui spec was updated
http://ui.netbeans.org/docs/ui/progress_indication/progress_indication_spec.html
Comment 20 Jaroslav Tulach 2005-04-15 13:46:25 UTC
Review will be on 27/04/2005 [17.00 CET]. Mila. Pavel, Tonda and Petr, I hope 
that this date works for you. Milos, please make sure that uptodate 
documentation (especially list of usecases) is linked from this issue. Mila 
please annouce this on nbdev. 
 
Comment 21 Milos Kleint 2005-04-19 13:23:20 UTC
Created attachment 21722 [details]
updated javadocs.
Comment 22 Milos Kleint 2005-04-19 15:22:28 UTC
Created attachment 21728 [details]
updated arch document with code snippets.
Comment 23 Antonin Nebuzelsky 2005-04-22 16:17:10 UTC
detailed list of use cases with design proposal for them is now on netbeans.org:
http://performance.netbeans.org/proposals/ProgressIndicationUsecases.html
Comment 24 _ pkuzel 2005-04-27 14:02:57 UTC
From "Detailed list of Progress Indication usecases"
> FIRST OPEN EMPTY EDITOR TAB WITH "PLEASE WAIT" TEXT, THEN RUN THE DIFF AS A
> REGULAR BACKGROUND TASK, AT THE END FILL THE EDITOR TAB WITH THE DIFF TEXT AND
> MAYBE FLASH THE TAB'S TITLE

During usability study users complained a lot about this approach. They want
progress directly in component that waits on background task results. 

I'm mentioning it because it raises requirement for showing progress on two
places (in component and in status line).
Comment 25 Milos Kleint 2005-05-10 08:26:08 UTC
integrated into trunk.
Comment 26 Miloslav Metelka 2005-05-31 18:06:12 UTC
The opinion document is available at
http://openide.netbeans.org/tutorial/reviews/opinions_54941.html
Apologies for delay.