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 19076 - Ability to find annotated name and icon without constructing a DataNode
Summary: Ability to find annotated name and icon without constructing a DataNode
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 3.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: phamernik
URL:
Keywords:
Depends on:
Blocks: 18829
  Show dependency tree
 
Reported: 2002-01-05 08:33 UTC by Jaroslav Tulach
Modified: 2008-12-22 17:47 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2002-01-05 08:33:01 UTC
It is often an issue to find out the "username" of a DataObject. (menu, issue
18829, actions API, etc.). Because such name is constructed in DataNode it is
always necessary to ask the DataObject for node delegate and thus create
unnecessary objects.

It might be wise to add

public static String DataNode.findAnnotatedName (DataObject obj);
public static Image DataNode.findAnnotatedIcon (DataObject obj);

which would do the same logic as in getDisplayName and getIcon of DataNode, just
allow others to use this without constructing the node.


Problem1: DataObject with different node (not data node) could have different
name. 
Answer1: I am not sure whether this is a real problem. Would work for most
cases, I guess.

Problem2: No place to attache PROP_DISPLAY_NAME listener - usually attached to
Node.
Answer2: One can listen on DataObject.PROP_NAME and rescan the name
appropriatelly.
Comment 1 Jesse Glick 2002-01-07 11:48:33 UTC
I'm not sure I see the point of such a method. Basically it would just
get the set of files, and process them with the FileSystem.Status. You
could do that yourself without such a method, right? So it would be
only a convenience.

The problems listed I see no good solution for. Consider e.g.
AntProjectNode, the node delegate for an AntProjectDataObject. Its
display name is not predictable from the data object without actually
constructing the node, and changes in its display name are not
predictable without constructing the node either.

IMHO rather than creating a new API which we know in advance will be
wrong in a number of cases and duplicates an existing API which is
known to be right, we should concentrate on optimizing the node
construction and ensuring that the node object does not consume a
significant amount of memory.
Comment 2 Jaroslav Tulach 2002-01-09 16:41:13 UTC
So close as wontfix and copy the implementation of those static
methods? I guess it is fine, except if somebody changes the default
impl in future. But I close it.
Comment 3 Jesse Glick 2002-01-10 12:33:41 UTC
It's true the default impl could change. However the nondefault impl
for certain objects already is different. So any solution which
doesn't actually ask the DataNode will be wrong sometimes anyway.
Comment 4 Jaroslav Tulach 2002-01-15 09:17:51 UTC
Ok. Silly idea.
Comment 5 Quality Engineering 2003-07-01 16:27:25 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.