final TreeItem item = reportsTree.getSelectedItem();
if (item == null) {
return;
}
final XObject parent = ((TreeNode) item.getModel()).getXObject();
RequestNameDialog rnd = new RequestNameDialog(
"Create new static folder",
"Name",
new ResultListener<String>(){
public void requestCancelled() {
}
public void requestFinished(String result) {
WPaloServiceProvider.getInstance().
createStaticFolder(result, parent, user, new Callback<XStaticReportFolder>(){
public void onSuccess(XStaticReportFolder folder) {
if (folder == null) {
return;
}
treeLoader.loadChildren((TreeNode) item.getModel());
}});
}
});
rnd.show();
}
});
toolbar.add(addStaticFolder);
TextToolItem addDynamicFolder = new TextToolItem("", "icon-create-dynamic-folder");
addDynamicFolder.setToolTip("Create a new dynamic folder");
addDynamicFolder.addSelectionListener(new SelectionListener<ComponentEvent>(){
public void componentSelected(ComponentEvent ce) {
final TreeItem item = reportsTree.getSelectedItem();
if (item == null) {
return;
}
final XObject parent = ((TreeNode) item.getModel()).getXObject();
RequestNameDialog rnd = new RequestNameDialog(
"Create new dynamic folder",
"Name",
new ResultListener<String>(){
public void requestCancelled() {
}
public void requestFinished(String result) {
WPaloServiceProvider.getInstance().
createDynamicFolder(result, parent, user, new Callback<XDynamicReportFolder>(){
public void onSuccess(XDynamicReportFolder folder) {
if (folder == null) {
return;
}
treeLoader.loadChildren((TreeNode) item.getModel());
}});
}
});
rnd.show();
}
});
toolbar.add(addDynamicFolder);
TextToolItem addSheet = new TextToolItem("", "icon-create-sheet");