}
});
legend = new TreeMapLegend(container, treeMap, getModel(), getRenderer());
final SecurityDetailsViewer details = new SecurityDetailsViewer(sash, SWT.NONE, getModel().getClient(), true);
treeMap.addSelectionChangeListener(new ISelectionChangeListener<TaxonomyNode>()
{
@Override
public void selectionChanged(ITreeModel<IRectangle<TaxonomyNode>> model,
IRectangle<TaxonomyNode> rectangle, String label)
{
TaxonomyNode node = rectangle.getNode();
details.setInput(node.getBackingSecurity());
}
});
// layout tree map + legend
GridLayoutFactory.fillDefaults().numColumns(1).margins(10, 10).applyTo(container);
GridDataFactory.fillDefaults().grab(true, true).applyTo(treeMap);
GridDataFactory.fillDefaults().grab(true, false).applyTo(legend);
// layout sash
details.getControl().pack();
int width = details.getControl().getBounds().width;
sash.setWeights(new int[] { parent.getParent().getParent().getBounds().width - width, width });
treeMap.setRectangleRenderer(new ClassificationRectangleRenderer(getModel(), getRenderer()));
treeMap.setTreeModel(new Model(getModel().getRootNode()));
legend.setRootItem(getModel().getRootNode());