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.

DragSource.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.event.dd;
  5. import java.util.Map;
  6. import com.vaadin.event.Transferable;
  7. import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
  8. import com.vaadin.ui.Component;
  9. import com.vaadin.ui.Tree;
  10. /**
  11. * DragSource is a {@link Component} that builds a {@link Transferable} for a
  12. * drag and drop operation.
  13. * <p>
  14. * In Vaadin the drag and drop operation practically starts from client side
  15. * component. The client side component initially defines the data that will be
  16. * present in {@link Transferable} object on server side. If the server side
  17. * counterpart of the component implements this interface, terminal
  18. * implementation lets it create the {@link Transferable} instance from the raw
  19. * client side "seed data". This way server side implementation may translate or
  20. * extend the data that will be available for {@link DropHandler}.
  21. *
  22. * @since 6.3
  23. *
  24. */
  25. public interface DragSource extends Component {
  26. /**
  27. * DragSource may convert data added by client side component to meaningful
  28. * values for server side developer or add other data based on it.
  29. *
  30. * <p>
  31. * For example Tree converts item identifiers to generated string keys for
  32. * the client side. Vaadin developer don't and can't know anything about
  33. * these generated keys, only about item identifiers. When tree node is
  34. * dragged client puts that key to {@link Transferable}s client side
  35. * counterpart. In {@link Tree#getTransferable(Map)} the key is converted
  36. * back to item identifier that the server side developer can use.
  37. * <p>
  38. *
  39. * @since 6.3
  40. * @param rawVariables
  41. * the data that client side initially included in
  42. * {@link Transferable}s client side counterpart.
  43. * @return the {@link Transferable} instance that will be passed to
  44. * {@link DropHandler} (and/or {@link AcceptCriterion})
  45. */
  46. public Transferable getTransferable(Map<String, Object> rawVariables);
  47. }