From 1f959b7e51106bf30bf8a83af71516ebce7855db Mon Sep 17 00:00:00 2001 From: koutsoub Date: Thu, 3 Feb 2011 11:57:16 +0200 Subject: [PATCH] configuring dnd --- src/gr/ebs/gss/client/CellTreeView.java | 24 +++++++++++++++++++++++- src/gr/ebs/gss/client/CellTreeViewModel.java | 14 ++++++++++++-- src/gr/ebs/gss/client/FileList.java | 19 +++++-------------- 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/gr/ebs/gss/client/CellTreeView.java b/src/gr/ebs/gss/client/CellTreeView.java index 22b6836..d38b783 100644 --- a/src/gr/ebs/gss/client/CellTreeView.java +++ b/src/gr/ebs/gss/client/CellTreeView.java @@ -471,7 +471,29 @@ public class CellTreeView extends Composite{ } } } - + public void openNodeContainingResource(RestResource resource){ + TreeNode node = tree.getRootTreeNode(); + openNodeContainingResource(node,resource); + } + private void openNodeContainingResource(TreeNode node, RestResource resource){ + int count = node.getChildCount(); + for(int i=0;iOnActivate:"+context.getDroppableData()); + if(context.getDroppableData()!=null && context.getDroppableData() instanceof RestResource){ + GSS.get().getTreeView().openNodeContainingResource((RestResource) context.getDroppableData()); + } + + } + }); options.setOnDrop(new DroppableFunction() { public void f(DragAndDropContext context) { diff --git a/src/gr/ebs/gss/client/FileList.java b/src/gr/ebs/gss/client/FileList.java index cd2d468..a55c33e 100644 --- a/src/gr/ebs/gss/client/FileList.java +++ b/src/gr/ebs/gss/client/FileList.java @@ -29,6 +29,7 @@ import gr.ebs.gss.client.rest.resource.TrashResource; import gr.ebs.gss.client.rest.resource.UserResource; import gr.ebs.gss.client.rest.resource.UserSearchResource; import gwtquery.plugins.draggable.client.DraggableOptions; +import gwtquery.plugins.draggable.client.StopDragException; import gwtquery.plugins.draggable.client.DraggableOptions.DragFunction; import gwtquery.plugins.draggable.client.DraggableOptions.RevertOption; import gwtquery.plugins.draggable.client.events.DragContext; @@ -349,17 +350,8 @@ public class FileList extends Composite { public void onDragStart(DragStartEvent event) { FileResource value = event.getDraggableData(); - /* if(!selectionModel.isSelected(value)){ - //event.getHelper().removeFromParent(); - - return; - }*/ - com.google.gwt.dom.client.Element helper = event.getHelper(); - SafeHtmlBuilder sb = new SafeHtmlBuilder(); - // reuse the contact cell to render the inner html of the drag helper. - ///new CotactCell(images.blank()).render(new Context(0,0, value), value, sb); sb.appendHtmlConstant(""); sb.appendEscaped(value.getName()); sb.appendHtmlConstant(""); @@ -492,15 +484,14 @@ public class FileList extends Composite { // prevents dragging when user click on the category drop-down list draggableOptions.setCancel("select"); - draggableOptions.setOnDragStart(new DragFunction() { + draggableOptions.setOnBeforeDragStart(new DragFunction() { @Override public void f(DragContext context) { FileResource value = context.getDraggableData(); - if(!selectionModel.isSelected(value)){ - dragStop.onDragStop(new DragStopEvent(context)); - return; - } + if(!selectionModel.isSelected(value)){ + throw new StopDragException(); + } } }); -- 1.7.10.4