You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DropHandler.java 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.event.dd;
  5. import java.io.Serializable;
  6. import com.vaadin.event.Transferable;
  7. import com.vaadin.event.dd.acceptcriteria.AcceptAll;
  8. import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
  9. import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion;
  10. /**
  11. * DropHandlers contain the actual business logic for drag and drop operations.
  12. * <p>
  13. * The {@link #drop(DragAndDropEvent)} method is used to receive the transferred
  14. * data and the #getAcceptCriterion()} method contains the (possibly client side
  15. * verifiable) criterion whether the dragged data will be handled at all.
  16. *
  17. * @since 6.3
  18. *
  19. */
  20. public interface DropHandler extends Serializable {
  21. /**
  22. * Drop method is called when the end user has finished the drag operation
  23. * on a {@link DropTarget} and {@link DragAndDropEvent} has passed
  24. * {@link AcceptCriterion} defined by {@link #getAcceptCriterion()} method.
  25. * The actual business logic of drag and drop operation is implemented into
  26. * this method.
  27. *
  28. * @param event
  29. * the event related to this drop
  30. */
  31. public void drop(DragAndDropEvent event);
  32. /**
  33. * Returns the {@link AcceptCriterion} used to evaluate whether the
  34. * {@link Transferable} will be handed over to
  35. * {@link DropHandler#drop(DragAndDropEvent)} method. If client side can't
  36. * verify the {@link AcceptCriterion}, the same criteria may be tested also
  37. * prior to actual drop - during the drag operation.
  38. * <p>
  39. * Based on information from {@link AcceptCriterion} components may display
  40. * some hints for the end user whether the drop will be accepted or not.
  41. * <p>
  42. * Vaadin contains a variety of criteria built in that can be composed to
  43. * more complex criterion. If the build in criteria are not enough,
  44. * developer can use a {@link ServerSideCriterion} or build own custom
  45. * criterion with client side counterpart.
  46. * <p>
  47. * If developer wants to handle everything in the
  48. * {@link #drop(DragAndDropEvent)} method, {@link AcceptAll} instance can be
  49. * returned.
  50. *
  51. * @return the {@link AcceptCriterion}
  52. */
  53. public AcceptCriterion getAcceptCriterion();
  54. }