DragAndDropNodeInfo<RestResource> n = new DragAndDropNodeInfo<RestResource>(dataProvider, departmentCell,
selectionModel, new ResourceValueUpdater());
//nodeInfos.put(((OthersFolderResource) value).getUri(), n);
- othersmap.put(((SharedFolderResource) value).getUri(), dataProvider);
+ othersmap.put(((OthersFolderResource) value).getUri(), dataProvider);
configureFolderDrop(n);
configureDragOperation(n.getDraggableOptions());
return n;
DnDFolderPopupMenu popup ;
if(context.getDraggableData() instanceof FileResource){
- popup = new DnDFolderPopupMenu(images, ((MyFolderResource) context.getDroppableData()).getResource(), Arrays.asList(context.getDraggableData()));
+ if(context.getDroppableData() instanceof RestResourceWrapper)
+ popup = new DnDFolderPopupMenu(images, ((RestResourceWrapper) context.getDroppableData()).getResource(), Arrays.asList(context.getDraggableData()));
+ else
+ popup = new DnDFolderPopupMenu(images, null, Arrays.asList(context.getDraggableData()));
}
- else
- popup = new DnDFolderPopupMenu(images, ((MyFolderResource) context.getDroppableData()).getResource(), context.getDraggableData());
+
+ else{
+ if(context.getDroppableData() instanceof RestResourceWrapper)
+ popup = new DnDFolderPopupMenu(images, ((RestResourceWrapper) context.getDroppableData()).getResource(), context.getDraggableData());
+ else
+ popup = new DnDFolderPopupMenu(images, null, context.getDraggableData());
+ }
+
int left = context.getDroppable().getAbsoluteLeft() + 40;
int top = context.getDroppable().getAbsoluteTop() + 20;
popup.setPopupPosition(left, top);
@Override
public void onComplete() {
//trash = getResult();
+ ((TrashResource)value).setFolders(getResult().getFolders());
+ ((TrashResource)value).setFiles(getResult().getFiles());
for(RestResource r : getRootNodes().getList()){
if(r instanceof TrashResource)
getRootNodes().getList().set(getRootNodes().getList().indexOf(r),GSS.get().getTreeView().getTrash());
}
GSS.get().getTreeView().updateNodeChildren(GSS.get().getTreeView().getTrash());
+ //GSS.get().showFileList(true);
+ GSS.get().onResourceUpdate(value);
}
@Override
int statusCode = ((RestException)t).getHttpStatusCode();
// On IE status code 1223 may be returned instead of 204.
if(statusCode == 204 || statusCode == 1223){
- //trash = new TrashResource(GSS.get().getCurrentUserResource().getTrashPath());
+ ((TrashResource)value).setFolders(new ArrayList<FolderResource>());
+ ((TrashResource)value).setFiles(new ArrayList<FileResource>());
}
else{
GWT.log("", t);
});
}
else if(value instanceof OthersFolderResource){
-
+ GetCommand<FolderResource> gf = new GetCommand<FolderResource>(FolderResource.class, value.getUri(), null) {
+
+ @Override
+ public void onComplete() {
+ FolderResource rootResource = getResult();
+ //((MyFolderResource)value).getResource().setFiles(rootResource.getFiles());
+ ((OthersFolderResource)value).setResource(rootResource);
+ if(GSS.get().getTreeView().getSelection().getUri().equals(value.getUri()))
+ selectionModel.setSelected(value, true);
+ GSS.get().onResourceUpdate(value);
+
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ GWT.log("Error fetching root folder", t);
+ GSS.get().displayError("Unable to fetch root folder");
+ }
+
+ };
+ DeferredCommand.addCommand(gf);
+ }
+ else if(value instanceof SharedFolderResource){
+ GetCommand<FolderResource> gf = new GetCommand<FolderResource>(FolderResource.class, value.getUri(), null) {
+
+ @Override
+ public void onComplete() {
+ FolderResource rootResource = getResult();
+ //((MyFolderResource)value).getResource().setFiles(rootResource.getFiles());
+ ((SharedFolderResource)value).setResource(rootResource);
+ if(GSS.get().getTreeView().getSelection().getUri().equals(value.getUri()))
+ selectionModel.setSelected(value, true);
+ GSS.get().onResourceUpdate(value);
+
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ GWT.log("Error fetching root folder", t);
+ GSS.get().displayError("Unable to fetch root folder");
+ }
+
+ };
+ DeferredCommand.addCommand(gf);
+ }
+ else if(value instanceof SharedResource){
+ GetCommand<SharedResource> gf = new GetCommand<SharedResource>(SharedResource.class, value.getUri(), null) {
+
+ @Override
+ public void onComplete() {
+ SharedResource rootResource = getResult();
+ ((SharedResource)value).setFolders(getResult().getFolders());
+ ((SharedResource)value).setFiles(getResult().getFiles());
+
+ if(GSS.get().getTreeView().getSelection().getUri().equals(value.getUri()))
+ selectionModel.setSelected(value, true);
+ GSS.get().onResourceUpdate(value);
+
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ GWT.log("Error fetching root folder", t);
+ GSS.get().displayError("Unable to fetch root folder");
+ }
+
+ };
+ DeferredCommand.addCommand(gf);
+ }
+ else if(value instanceof OtherUserResource){
+ GetCommand<OtherUserResource> gf = new GetCommand<OtherUserResource>(OtherUserResource.class, value.getUri(), null) {
+
+ @Override
+ public void onComplete() {
+ OtherUserResource rootResource = getResult();
+ ((OtherUserResource)value).setFolders(getResult().getFolders());
+ ((OtherUserResource)value).setFiles(getResult().getFiles());
+
+ if(GSS.get().getTreeView().getSelection().getUri().equals(value.getUri()))
+ selectionModel.setSelected(value, true);
+ GSS.get().onResourceUpdate(value);
+
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ GWT.log("Error fetching root folder", t);
+ GSS.get().displayError("Unable to fetch root folder");
+ }
+
+ };
+ DeferredCommand.addCommand(gf);
}
}