return;
}
List <XObject> objs = new ArrayList<XObject>();
final HashSet <TreeNode> parents = new HashSet<TreeNode>();
for (TreeItem it: items) {
TreeNode tn = (TreeNode) it.getModel();
objs.add(tn.getXObject());
parents.remove(tn);
parents.add((TreeNode) tn.getParent());
}
WPaloServiceProvider.getInstance().deleteElementTreeNodes(objs, user, new Callback<Boolean>(){
public void onSuccess(Boolean b) {
if (b) {
for (TreeNode p: parents) {
if (p != null) {
reload(p);
}
}
}
}
});
}
});
toolbar.add(deleteItem);
toolbar.add(new SeparatorToolItem());
final ToggleToolItem quickView = new ToggleToolItem("Quick View");
toolbar.add(quickView);
quickView.addSelectionListener(new SelectionListener<ComponentEvent>(){
public void componentSelected(ComponentEvent ce) {
quickViewEnabled = quickView.isPressed();
if (rootNode != null) {
reload(rootNode);
}
// store.removeAll();
// XNode root = new XNode(user, XConstants.TYPE_ROOT_REPORT_STRUCTURE_NODE);
// root.setName("DummyRoot");
// root.setId("ReportStructureNavigatorView#RootNode");
// root.setHasChildren(true);
// rootNode = new TreeNode(null, root);
// treeLoader.load(rootNode);
}
});
navigator.setTopComponent(toolbar);
reportsTree.addListener(Events.OnDoubleClick, new Listener<BaseEvent>(){
public void handleEvent(BaseEvent be) {
TreeNode node = (TreeNode) reportsTree.getSelectedItem().getModel();
if (node.getXObject() instanceof XTemplate) {
fireEvent(new AppEvent<TreeNode>(WPaloEvent.EDIT_TEMPLATE_ITEM, node));
}
}
});
navigator.add(reportsTree);
navigator.addListener(Events.Expand, new Listener<BaseEvent>(){
public void handleEvent(BaseEvent be) {
fireEvent(new AppEvent<TreeNode>(WPaloEvent.EDIT_REPORT_STRUCTURE, new TreeNode(null, user)));
}
});
Workbench wb = (Workbench)Registry.get(Workbench.ID);
wb.addToViewPanel(navigator);
}