incubator-ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1033395 - /incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
Date Wed, 10 Nov 2010 08:48:15 GMT
Author: marrs
Date: Wed Nov 10 08:48:15 2010
New Revision: 1033395

URL: http://svn.apache.org/viewvc?rev=1033395&view=rev
Log:
You can no longer attempt to drop an item in between other items, only on another item. Also,
if you select multiple items and then drag and drop, all of them will be associated to the
target you drop them on. Visually that still is not shown (you see only the one item while
dragging) but it does work.

Modified:
    incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java

Modified: incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java?rev=1033395&r1=1033394&r2=1033395&view=diff
==============================================================================
--- incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
(original)
+++ incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
Wed Nov 10 08:48:15 2010
@@ -54,8 +54,10 @@ import com.vaadin.event.dd.DropHandler;
 import com.vaadin.event.dd.TargetDetails;
 import com.vaadin.event.dd.acceptcriteria.AcceptAll;
 import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
+import com.vaadin.event.dd.acceptcriteria.Or;
 import com.vaadin.terminal.Sizeable;
 import com.vaadin.ui.AbstractSelect.AbstractSelectTargetDetails;
+import com.vaadin.ui.AbstractSelect.VerticalLocationIs;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Table.CellStyleGenerator;
 import com.vaadin.ui.Table.TableTransferable;
@@ -366,16 +368,34 @@ public class VaadinClient extends com.va
                 TableTransferable tt = (TableTransferable) transferable;
                 Object fromItemId = tt.getItemId();
                 System.out.println("FF: " + fromItemId);
+                // get the active selection
+                Set<?> selection = m_activeSelection;
                 System.out.println("T: " + targetDetails.getClass().getName());
                 if (targetDetails instanceof AbstractSelectTargetDetails) {
                     AbstractSelectTargetDetails ttd = (AbstractSelectTargetDetails) targetDetails;
                     Object toItemId = ttd.getItemIdOver();
                     System.out.println("TT: " + toItemId);
                     if (tt.getSourceComponent().equals(m_left)) {
-                        associateFromLeft((String) fromItemId, (String) toItemId);
+                        if (selection != null) {
+                            for (Object item : selection) {
+                                System.out.println("FS: " + item);
+                                associateFromLeft((String) item, (String) toItemId);
+                            }
+                        }
+                        else {
+                            associateFromLeft((String) fromItemId, (String) toItemId);
+                        }
                     }
                     else {
-                        associateFromRight((String) toItemId, (String) fromItemId);
+                        if (selection != null) {
+                            for (Object item : selection) {
+                                System.out.println("FS: " + item);
+                                associateFromRight((String) toItemId, (String) item);
+                            }
+                        }
+                        else {
+                            associateFromRight((String) toItemId, (String) fromItemId);
+                        }
                     }
                     updateTableData();
                 }
@@ -383,7 +403,8 @@ public class VaadinClient extends com.va
         }
 
         public AcceptCriterion getAcceptCriterion() {
-            return AcceptAll.get();
+//            return AcceptAll.get();
+            return new Or(VerticalLocationIs.MIDDLE);
         }
 
         protected abstract void associateFromLeft(String left, String right);
@@ -943,7 +964,7 @@ public class VaadinClient extends com.va
             setSelectable(true);
             setMultiSelect(true);
             setImmediate(true);
-            setDragMode(TableDragMode.ROW);
+            setDragMode(TableDragMode.MULTIROW);
             if (hasEdit) {
                 addListener(new ItemClickListener() {
                     public void itemClick(ItemClickEvent event) {



Mime
View raw message