use of org.netxms.ui.eclipse.networkmaps.algorithms.SparseTree in project netxms by netxms.
the class NetworkMapWidget method setLayoutAlgorithm.
/**
* Set layout algorithm for map
* @param alg
*/
public void setLayoutAlgorithm(MapLayoutAlgorithm alg) {
LayoutAlgorithm algorithm;
switch(alg) {
case SPRING:
algorithm = new SpringLayoutAlgorithm();
break;
case RADIAL:
algorithm = new RadialLayoutAlgorithm();
break;
case HTREE:
algorithm = new TreeLayoutAlgorithm(TreeLayoutAlgorithm.LEFT_RIGHT);
break;
case VTREE:
algorithm = new TreeLayoutAlgorithm(TreeLayoutAlgorithm.TOP_DOWN);
break;
case SPARSE_VTREE:
TreeLayoutAlgorithm mainLayoutAlgorithm = new TreeLayoutAlgorithm(TreeLayoutAlgorithm.TOP_DOWN);
viewer.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
return e1.toString().compareToIgnoreCase(e2.toString());
}
});
algorithm = new CompositeLayoutAlgorithm(new LayoutAlgorithm[] { mainLayoutAlgorithm, new SparseTree() });
break;
default:
algorithm = new GridLayoutAlgorithm();
break;
}
viewer.setLayoutAlgorithm(algorithm);
}
Aggregations