Search this API

y.layout.tree
Class TreeMapLayouter.NodeWeightComparator

java.lang.Object
  extended by y.layout.tree.TreeMapLayouter.NodeWeightComparator
All Implemented Interfaces:
java.util.Comparator
Enclosing class:
TreeMapLayouter

public static class TreeMapLayouter.NodeWeightComparator
extends java.lang.Object
implements java.util.Comparator

A Comparator that compares two nodes with respect to their weight value defined via the DataProvider registered with TreeMapLayouter.NODE_WEIGHT_DPKEY.

Nodes are sorted in descending order, i.e., nodes with a higher weight (and consequently larger area in the tree map) are placed first. The sum of the child weights is used as the weight value for nodes that have children.

 
To sort nodes in ascending order, subclass this Comparator and swap the sign of the comparison method return value.
 
Your browser does not support SVG content.

Constructor Summary
TreeMapLayouter.NodeWeightComparator()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

TreeMapLayouter.NodeWeightComparator

public TreeMapLayouter.NodeWeightComparator()
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Specified by:
compare in interface java.util.Comparator

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.