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 159546 - Add a possibility to render check-boxes next to the tree node icon and display name
Summary: Add a possibility to render check-boxes next to the tree node icon and displa...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Martin Entlicher
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 159545
  Show dependency tree
 
Reported: 2009-03-03 16:21 UTC by Martin Entlicher
Modified: 2009-03-12 14:22 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
The API change for review. (21.59 KB, text/plain)
2009-03-03 16:54 UTC, Martin Entlicher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Entlicher 2009-03-03 16:21:31 UTC
To be able to implement issue #159545, we need a support for adding check-boxes next to the node icon.

We need it in Outline, but can be implemented in all views.

I'm going to attach a patch for review...
Comment 1 Martin Entlicher 2009-03-03 16:54:01 UTC
Created attachment 77648 [details]
The API change for review.
Comment 2 Martin Entlicher 2009-03-03 17:02:11 UTC
Please review this API change, which adds check-boxes to the nodes in tree column in Outline.

In RenderDataProvider.java I've deleted sentence: " An Outline will use its RenderDataProvider to fetch data for
<strong>all</strong> its columns, so it is possible to affect the display of both property columns and the tree column
via this interface." Please review if it's correct, since AFAIK RenderDataProvider is used to render the tree column only.

I've added CheckRenderDataProvider interface. That is used by DefaultOutlineCellRenderer to render the check-boxes.
Outline handles the mouse events to change the selected status of check-boxes.

To connect Nodes with Outline, I've introduced CheckNodeCookie, the connection is done by NodeRenderDataProvider.

This API and functionality is going to be used by issue #159545.
Comment 3 Martin Entlicher 2009-03-03 21:39:26 UTC
If there is nothing controversial, I would like to integrate this by the end of the week. Thanks.
Comment 4 Jiri Rechtacek 2009-03-04 09:40:51 UTC
Thanks. It would be worth improvement of OV. Just some comments:
JR01: Is there any chance to see it in action? Do you have any test for this change?
JR02: It's weird. Both extensions of interfaces org.openide.explorer.view.CheckNodeCookie and
org.netbeans.swing.outline.CheckRenderDataProvider have as same signature. Couldn't be shared?
Comment 5 Martin Entlicher 2009-03-04 11:12:01 UTC
JR01: I've added a screenshot to issue #159545 - http://www.netbeans.org/nonav/issues/showattachment.cgi/77653/BP_CH.png
      I didn't write any test for this, programmatically test that the check-box is rendered would be an overkill IMHO.

JR02: Although CheckRenderDataProvider and CheckNodeCookie are similar, I did not find a good way how to live with just
one of them. Outline does not depend on anything and it would not be much nice to use some class from Outline when
adding check-boxes into e.g. TreeView (if TreeView is extended in the future with check-boxes).
The two interfaces differ, their signature is not the same:
CheckRenderDataProvider have methods which take an Object as an argument - the node. There is one instance of it per the
whole view.
CheckNodeCookie have methods without arguments and they work in the context of the node the cookie is attached to.
Therefore you have one instance per node.
Comment 6 Martin Entlicher 2009-03-06 11:00:25 UTC
If there are no objections, I'll integrate this change tomorrow.
Thanks for the review.
Comment 7 Martin Entlicher 2009-03-08 11:42:55 UTC
Integrated in changeset:   119359:fbfb66e1cb38
http://hg.netbeans.org/main/rev/fbfb66e1cb38
Comment 8 Jesse Glick 2009-03-09 00:09:53 UTC
Just saw this now, hope it's not too late to advise:

[JG01] Don't use "Cookie" in the name and don't extend Node.Cookie. There is no more use for Node.Cookie after the
introduction of Node.getLookup.
Comment 9 Quality Engineering 2009-03-09 09:09:11 UTC
Integrated into 'main-golden', will be available in build *200903090201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/fbfb66e1cb38
User: mentlicher@netbeans.org
Log: #159546 - CheckRenderDataProvider and CheckNodeCookie introduced to be able to render check-boxes next to the tree node icon.
Comment 10 Martin Entlicher 2009-03-09 09:37:19 UTC
Jesse, I've just integrated the change yesterday in the evening. But I guess nobody started to use it yet.
I was thinking about how to actually name the class and the cookie was handy to use, the Cookie interface is not
deprecated, though I register the implementation into the Lookup.

I can change the name to e.g. "CheckableNode" if it would sound better, without extending the Node.Cookie interface and
explaining to add the impl into the Node's lookup...
Comment 11 Jesse Glick 2009-03-09 15:56:22 UTC
Node.Cookie is not @Deprecated as such - that would cause too many problems - but it is conceptually deprecated, i.e. no
new code should mention it unless that is truly required for interoperation with older code. "CheckableNode" sounds fine
to me. CCing Yarda in case he has any comments on the API style here.
Comment 12 Martin Entlicher 2009-03-09 16:49:13 UTC
After discussion with Tomas Holy, I've replaced CheckNodeCookie with CheckableNode:

http://hg.netbeans.org/main/rev/95ab2e9b0b9e

Thanks for your comments.
Comment 13 Quality Engineering 2009-03-10 09:26:44 UTC
Integrated into 'main-golden', will be available in build *200903100201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/95ab2e9b0b9e
User: mentlicher@netbeans.org
Log: #159546 - CheckNodeCookie is replaced with CheckableNode.
Comment 14 Quality Engineering 2009-03-10 21:16:57 UTC
Integrated into 'main-golden', will be available in build *200903101401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/48f645103e4c
User: mentlicher@netbeans.org
Log: #159546 - CheckNodeCookie is replaced with CheckableNode.
Comment 15 Jiri Skrivanek 2009-03-12 14:22:03 UTC
Parent node is not refreshed if a check box changes its state. I have to fire an event myself at
CheckRenderDataProvider.setSelected() implementation. IMO, it should fire an event that node has been changed after
crender.setSelected() is called at Outline.checkAt().