Forums

Full Version: RadialTreeLayout - method setLayoutRoot(NodeItem)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Just to start with a little bug I discovered a while ago in the method setLayoutRoot() of the class RadialTreeLayout .

Code:
public void setLayoutRoot(NodeItem root) {

if ( !root.isInGroup(m_group) ) //<------------ problem when root is set NULL
  throw new IllegalArgumentException("Input node is not a member " + "of this layout's data group");

m_root = root;
}

The description of the method tells that the root can be set to NULL, but as it is it can't. As far as I see you have to set the root at one point to NULL, otherwise the given root is always used as the root and not the root of the actual spanning tree. Of course the fix of it is an easy one:

Code:
public void setLayoutRoot(NodeItem root) {

if ( root != NULL && !root.isInGroup(m_group) )
  throw new IllegalArgumentException("Input node is not a member " + "of this layout's data group");

m_root = root;
}
Reference URL's