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 123469 - Explain icon badges in tooltips
Summary: Explain icon badges in tooltips
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: t_h
URL: http://wiki.netbeans.org/BadgedIcons
Keywords: API_REVIEW_FAST, PLAN, UI
: 126019 (view as bug list)
Depends on: 138739 138741 138742
Blocks:
  Show dependency tree
 
Reported: 2007-12-05 13:20 UTC by jrojcek
Modified: 2008-12-22 11:44 UTC (History)
9 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
API changes (org.openide.util.Utilities) (21.50 KB, text/plain)
2008-06-09 10:46 UTC, t_h
Details
[JG01] Example of usage (3.26 KB, text/plain)
2008-06-10 09:52 UTC, t_h
Details
Image methods were separated to new public ImageUtilities class (83.04 KB, text/plain)
2008-06-13 12:01 UTC, t_h
Details
diff with changes (git syntax) (35.26 KB, text/plain)
2008-06-13 15:59 UTC, t_h
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jrojcek 2007-12-05 13:20:39 UTC
Problem description:

We use icon badges in project explorer and other places to represent a state of object. For example an error/warning icons on project nodes, error state or 
compiled state of java files, state of the server nodes in Services tab or badges and _colors_ of versioned folders and files. Currently there's no way to tell 
what the badges mean. The user has to read help or browse documentation. This is a severe OOBE problem.

Solution:

We need a consistent way of providing explanatory textual description of badges and file colors in case of VCS. We are currently showing tooltips on 
mouse-over. The right solution could probably be a nice html tooltip, which could provide some basic info about the object's state.
Comment 1 Antonin Nebuzelsky 2008-04-15 13:21:13 UTC
Reassigning to Tomas for evaluation.
Comment 2 t_h 2008-06-09 10:46:51 UTC
Created attachment 62547 [details]
API changes (org.openide.util.Utilities)
Comment 3 t_h 2008-06-09 10:50:40 UTC
Proposed solution, see Utilities API changes in attachment.
Comment 4 jrojcek 2008-06-09 17:55:29 UTC
What's the intended appearance of tooltips explaining icon badges?
Comment 5 Jesse Glick 2008-06-09 22:56:15 UTC
[JG01] It is hard to evaluate this change without seeing at least some example changes to modules which would use it
productively.

[JG02] What is image2Icon good for, beyond creating a new ImageIcon? Why does icon2Image have to change?
Comment 6 t_h 2008-06-10 09:50:29 UTC
[jrojcek] For each badge (or colors) explanatory line (or more lines if needed) should be added to Node description text
(which is shown as tool tip).

[JG02] Utilities.loadImage() was changed to create subclass of BufferedImage which contains tool tip String and also
implements Icon (idea of jst). Then the conversion between Image and Icon can be just casting. E.g. before change
VisualizerNode loaded Image and then created ImageIcon so each VisualizerNode had its own Icon instance - now if
VisualizerNodes use same image as an icon they share the same instance (this change is also part of posted diff). So,
its just positive side-effect.
Comment 7 t_h 2008-06-10 09:52:16 UTC
Created attachment 62597 [details]
[JG01] Example of usage
Comment 8 jrojcek 2008-06-10 11:26:35 UTC
Okay, for now I would just expect the appearance would look okay for both, the badge and color explanation. It would be nice if there was at least a mini UI 
spec written for it so that everybody can _see_ that's what we want to achieve.
Comment 9 t_h 2008-06-10 15:55:29 UTC
This is just API to have the possibility to add the tool tip to badge icon in simple way. It is up to providers of
badges to decide text and format of their tool tips. Of course, some guidelines could be useful for them.
Comment 10 t_h 2008-06-13 12:01:57 UTC
Created attachment 62807 [details]
Image methods were separated to new public ImageUtilities class
Comment 11 t_h 2008-06-13 12:08:57 UTC
On jst suggestion I moved all image/icon methods from Utilities to new public class ImageUtilities (former IconManager)
and made those methods deprecated in Utilities. I plan to commit these changes tomorrow (if no more suggestions).
Comment 12 Jaroslav Tulach 2008-06-13 13:00:19 UTC
Comment to implementation:
+        if (icon instanceof Image) {
+            String toolTip = ImageUtilities.getImageToolTip((Image) icon);
should maybe be:
String toolTip = ImageUtilities.getImageToolTip(ImageUtilities.icon2Image(icon));

ImageUtilities should have private constructor.

Why "@author Jaroslav Tulach" - it should be "@author Tomáš Holý"!?

Comment 13 t_h 2008-06-13 13:34:17 UTC
>String toolTip = ImageUtilities.getImageToolTip(ImageUtilities.icon2Image(icon));
If icon is not Image there cannot be tool tip so I think this would be unnecessary conversion.

>ImageUtilities should have private constructor.
ok, added.

>Why "@author Jaroslav Tulach" - it should be "@author Tomáš Holý"!?
It is in fact extended IconManager (with more appropriate name) so I preserved original author, but ok I will add myself
Comment 14 Jesse Glick 2008-06-13 15:07:48 UTC
Diffs for review should use Git syntax (--git or [diff] git=1) to show renames correctly. I would hope that
IconManager.java was 'hg rename'd to ImageUtilities.java so that e.g. 'hg annotate' will work on old code; same for the
unit tests.


Use e.g. "{@link ImageUtilities#mergeImages}" in Javadoc.
Comment 15 t_h 2008-06-13 15:59:32 UTC
Created attachment 62818 [details]
diff with changes (git syntax)
Comment 17 Andrei Badea 2008-06-16 10:39:10 UTC
[AB01] This change is likely to add several hundred deprecation warnings to the build. Please fix at least the modules
in main to use ImageUtilities instead of Utilities.
Comment 18 t_h 2008-06-17 14:26:01 UTC
There is > 900 files to change. I suggest to remove deprecation in Utilities.
Comment 19 Jesse Glick 2008-06-18 02:34:01 UTC
Or fix existing usages in bulk using Jackpot:

org.openide.util.Utilities.loadImage($args$) => org.openide.util.ImageUtilities.loadImage($args$);
org.openide.util.Utilities.icon2Image($args$) => org.openide.util.ImageUtilities.icon2Image($args$);
org.openide.util.Utilities.mergeImages($args$) => org.openide.util.ImageUtilities.mergeImages($args$);

Currently it seems this refactoring mostly works but fails to import ImageUtilities (and clean up any unused import of
Utilities), which is probably a bug in Jackpot.

BTW current statistics on usages and the number of files and modules affected:

main$ (for r in . contrib; do hg -R $r loc -r tip -0 '**.java'; done) | xargs -0 egrep
'Utilities\.(loadImage|icon2Image|mergeImages)' | wc -l
2597
main$ (for r in . contrib; do hg -R $r loc -r tip -0 '**.java'; done) | xargs -0 egrep -l
'Utilities\.(loadImage|icon2Image|mergeImages)' | wc -l
1316
main$ (for r in . contrib; do hg -R $r loc -r tip -0 '**.java'; done) | xargs -0 egrep -l
'Utilities\.(loadImage|icon2Image|mergeImages)' | perl -pi -e 's!^(contrib/)?([^/]+)/.+!\1\2!g' | uniq | wc -l
366

Quite a job to fix up all those. Probably impractical without a script of some kind.
Comment 20 t_h 2008-06-18 09:20:43 UTC
I tried some automatic replacement tool and replacement of method name was the simplest task. Problem was with imports
and module dependency version. If Jackpot fails to do that I would suggest to remove deprecations for now and leave
there just message to use new version in ImageUtilities.

Also typical usage of loadImage() is: "new ImageIcon(Utilities.loadImage(...));" which should be replaced by
"ImageUtilities.image2Icon(ImageUtilities.loadImage(...))" to avoid conversions to new instances.
Comment 21 Quality Engineering 2008-06-20 15:54:29 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #271 build
Changeset: http://hg.netbeans.org/main/rev/e4e7a594d0de
User: Martin Krauskopf <mkrauskopf@netbeans.org>
Log: Migrating to new ImageUtilities APIs (see issue #123469 for details)
Comment 22 Antonin Nebuzelsky 2008-07-11 20:46:46 UTC
API in 6.5m1 and UI in 6.5m2.

Thanks to all involved.
Comment 23 nvarun 2008-07-29 19:08:52 UTC
Just a suggestion, though not that important yet it makes sense. The tooltip in somecases shows-
 |> Contains main class

Why not main method? Just curious to know! It should be either of the following

 |> This is main class

OR

 |> Contains main method
Comment 24 Lukas Hasik 2008-07-30 09:17:22 UTC
nvarun, report new bug to provider of the text (probably java). Thank you
Comment 25 Marian Mirilovic 2008-08-05 08:34:30 UTC
*** Issue 126019 has been marked as a duplicate of this issue. ***