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 178705 - Enhancement to the TreeGraphLayout (gaps between nodes can be minimized now)
Summary: Enhancement to the TreeGraphLayout (gaps between nodes can be minimized now)
Alias: None
Product: platform
Classification: Unclassified
Component: Graph (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: apireviews
Depends on:
Reported: 2009-12-16 01:43 UTC by ep-nb
Modified: 2010-06-05 07:47 UTC (History)
1 user (show)

See Also:
Exception Reporter:

the patch of changes (22.36 KB, patch)
2009-12-16 01:45 UTC, ep-nb
Details | Diff
Patch (22.37 KB, patch)
2010-05-10 04:03 UTC, ep-nb
Details | Diff
patch with api integration (26.55 KB, patch)
2010-05-10 05:03 UTC, ep-nb
Details | Diff
updated patch (29.86 KB, patch)
2010-05-18 04:21 UTC, ep-nb
Details | Diff
Patch with visual-test-case for the minimizeGap feature (7.16 KB, patch)
2010-05-18 11:27 UTC, David Kaspar
Details | Diff
fixed patch (32.53 KB, patch)
2010-05-20 04:05 UTC, ep-nb
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ep-nb 2009-12-16 01:43:04 UTC
If trees are very large, the old layout isn't a good solution. Therefore a minimization of gaps between the nodes is done (subtrees are moved as close together as possible). An example is shown at .
Also the old layout is supported now (the switch can be done by minimizeGap). An example is shown at . For both algorithms now a handling for a different height/width of nodes is done (depends on vertical). There a 3 possible choices for placement (Alignment.TOP, Alignment.Center and Alignment.Bottom). Alignment.TOP is used in the screenshots above.
Comment 1 ep-nb 2009-12-16 01:45:11 UTC
Created attachment 92649 [details]
the patch of changes
Comment 2 ep-nb 2010-05-10 04:03:23 UTC
Created attachment 98700 [details]
Comment 3 ep-nb 2010-05-10 05:03:03 UTC
Created attachment 98701 [details]
patch with api integration

added integration in GraphLayoutFactory and GraphLayoutSupport
Comment 4 Jaroslav Tulach 2010-05-17 11:08:33 UTC
Y01 Missing javadoc for new methods
Y02 Could the patch contain only semantic changes, not changes to formating?
Y03 Versioning changes are not present ( - increment spec version of a module, use @since tags
Y04 Update apichanges.xml:
Y05 Can you write a unit test that shows what is different? I guess not...
Comment 5 ep-nb 2010-05-18 04:21:37 UTC
Created attachment 99110 [details]
updated patch

(In reply to comment #4)
> Y01, Y02, Y03 and Y04:
i think i did them now.

> Y05 Can you write a unit test that shows what is different? I guess not...
I think it would be possible to show that the new layout prevents overlapping of the nodes now and that the minimziedGap uses less space then the old layout.
Comment 6 David Kaspar 2010-05-18 11:23:00 UTC
DK01 - GraphLayoutFactory.createTreeGraphLayout and GraphLayoutSupport.setTreeGraphLayoutProperties methods are using "alignment" parameter of "TreeGraphLayout.Alignment" type. This enum type is located in an implementation package and has to be moved to public-package e.g.
as org.netbeans.api.visual.graph.layout.TreeGraphLayoutAlignment enum.
Comment 7 David Kaspar 2010-05-18 11:27:06 UTC
Created attachment 99128 [details]
Patch with visual-test-case for the minimizeGap feature

I am attaching a visual test-case. It tests the TreeGraphLayout with minimizeGap parameter set to true. Please, commit it into the main repository together with the patch containing the feature itself.
Comment 8 David Kaspar 2010-05-18 11:47:31 UTC
DK02 - Optionally, if you want to, you can describe your feature at:
Comment 9 Geertjan Wielenga 2010-05-18 11:56:59 UTC
Why is that optional?
Comment 10 David Kaspar 2010-05-18 12:51:03 UTC
(In reply to comment #9)
> Why is that optional?

I would like to have it.
... but from the API point-of-view the feature is very well integrated as two additional properties of the TreeGraphLayout. Even right the TreeGraphLayout section does not have a description for any of the 5 already-existing properties... All properties (including the new ones) are already described in JavaDoc of GraphLayoutFactory.createTreeGraphLayout factory methods.
Comment 11 Jaroslav Tulach 2010-05-19 14:53:08 UTC
Re. DK01. Try to run "ant gen-sigtest", that shall yield some warning (hopefully). Such warning would later failed the nbms-and-javadoc job[1].

There are some typos in the apichange.xml. I suggested David to include picture comparing the two layouts in the javadoc, as such picture could speak more than thousands of words, but I am not sure how good idea it is.

Otherwise I found nothing wrong on the API change and I'll leave the integration privilege to David (if he accepts).

Comment 12 ep-nb 2010-05-20 04:05:49 UTC
Created attachment 99228 [details]
fixed patch

Introducing TreeGraphLayoutAlignment and API changes according do DK01 and fixing some typos in the apichange.xml.
Comment 13 David Kaspar 2010-05-24 15:13:38 UTC
Changing the keyword to API_REVIEW_FAST since the change is backward-compatible and does not its semantic.

Currently the trunk repository is closed for integrations because of branching decision. I am going to integrate the patch right after the decision is made and the repository is opened.
Comment 14 David Kaspar 2010-06-03 11:52:57 UTC
Committed to core-main repository as:
changeset: d08dfdfeefec
Comment 15 David Kaspar 2010-06-04 06:57:49 UTC
I have forgotten to add one new file. It is added at:
changeset: dc0e33a90549
Comment 16 Quality Engineering 2010-06-05 07:47:03 UTC
Integrated into 'main-golden', will be available in build *201006050001* on (upload may still be in progress)
User: David Kaspar <>
Log: #178705: Enhancement to the TreeGraphLayout (gaps between nodes can be minimized now)