protected class NodeViewManifestationListener extends AbstractViewListener {
@Override
public void actionPerformed(TreeExpansionEvent event) {
final ElapsedTimer timer = new ElapsedTimer();
timer.startInterval();
JTree tree = (JTree) event.getSource();
final DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel();
final MCTMutableTreeNode selectedNode = node;
AbstractComponent component = getManifestedComponent();
for (AbstractComponent childComponent : component.getComponents()) {
Set<ViewInfo> nodeViews = childComponent.getViewInfos(ViewType.NODE);
if (!nodeViews.isEmpty()) {
ViewInfo nextViewInfo = nodeViews.iterator().next();
// Children are only allowed if the component is not a leaf or the component is another users drop box
boolean allowsChildren =!childComponent.isLeaf();
View childNodeView = nextViewInfo.createView(childComponent);
MCTMutableTreeNode childNode = new MCTMutableTreeNode(childNodeView, tree, allowsChildren);
if (allowsChildren){
MCTMutableTreeNode grandChildNode = new MCTMutableTreeNode(View.NULL_VIEW_MANIFESTATION, tree);
childNode.add(grandChildNode);
childNode.setProxy(true);
}
selectedNode.add(childNode);
childNodeView.addPropertyChangeListener(VIEW_STALE_PROPERTY, objectStaleListener);
}
}
treeModel.reload(selectedNode);
timer.stopInterval();
PERF_LOGGER.debug("Time to expand node {}: {}", component.getId(), timer.getIntervalInMillis());
}