use of name.abuchen.portfolio.ui.views.SecurityDetailsViewer in project portfolio by buchen.
the class TreeMapViewer method createControl.
@Override
public Control createControl(Composite parent) {
Composite sash = new Composite(parent, SWT.NONE);
sash.setLayout(new SashLayout(sash, SWT.HORIZONTAL | SWT.END));
Composite container = new Composite(sash, SWT.NONE);
container.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
treeMap = new TreeMap<>(container);
treeMap.setTreeMapLayout(new SquarifiedLayout<TaxonomyNode>(10));
treeMap.setLabelProvider((model, rectangle) -> rectangle.getNode().getName());
legend = new TreeMapLegend(container, treeMap, getModel(), getRenderer());
final SecurityDetailsViewer details = new SecurityDetailsViewer(sash, SWT.NONE, getModel().getClient(), true);
treeMap.addSelectionChangeListener((model, rectangle, 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().setLayoutData(new SashLayoutData(SWTHelper.getPackedWidth(details.getControl())));
treeMap.setRectangleRenderer(new ClassificationRectangleRenderer(getModel(), getRenderer()));
treeMap.setTreeModel(new Model(getModel()));
legend.setRootItem(getModel().getChartRenderingRootNode());
return sash;
}
Aggregations