Drag and Drop between Two tables

Hi every1 again!

Me again with questons.

What i try to do:
User want to drag some objects from One table into Rows of the Other table. No need to be able drop items just on the empty table, only on some ROWs of this table.

I made one table draggable.ROW, than made nice DropHandler for other Table and one nice AcceptCriterion.
Everything is working nice and all are happy.

Than i made log into aceptancecriterion like


System.out.println("Accept drop ? FALSE");

And found out that this will be called like MAD, i mean i draging one row to drop it, and getting like 3-10 or more calls of acceptance criterion. Huh?! This is not the way i wanted it to be. What i want that acceptance criterion will be asked ONE time after i release my mouse to make a drop and not hundert times while i am dragging my item to drop point, else this to much work for server. Like 200 user draggin 1 item over couple of tables will ruin whole server - > not nice.

How can i achieve this, that only one time acceptance criterion will ve execute for one complete drag and drop transaction. Any help is welcome.

Thanks in advance!

Update:
All Tables of mine were setImediate(true). I changed it now to setImediated(false). Still way to many calls to server.

After Reading some
DOCS
i found out that TableDropCriterion will help me a lot in my case.

So i implemented this and now i got only 2 calls to server in one DragAndDrop transaction.
Code i end up for my solution:


	private class LieferungItemOnLieferungDropAkzeptieren extends TableDropCriterion {
		@Override
		protected Set<Object> getAllowedItemIds(DragAndDropEvent dragEvent, Table table, Collection<Object> visibleItemIds) {
			System.out.println("getAllowedItemIds Akzept drop ? FALSE");
			HashSet<Object> allowed = new HashSet<Object>();
			if (dragEvent.getTransferable().getData("itemId") instanceof LieferungItem) {
				//i go all visible objects and look for their statusid, depends of this i decide if it is accepttable item or not
				for (Object object : visibleItemIds) {
					if (((Lieferung) object).getStatusid().equals(Status.lieferung_status_geplannt)) {
						allowed.add(object);
					}
				}
			}
			return allowed;
		}
	}

Used this criterion in my table drag and drop handler:


@Override
public AcceptCriterion getAcceptCriterion() {
	return new LieferungItemOnLieferungDropAkzeptieren();
}

Once again Google saved me by pointing to nice documentation of vaadin.

Now working to understand how to use ClientSide+ServerSide creterion simulationesly.