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.

AcceptCriterion.java 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. /**
  5. *
  6. */
  7. package com.vaadin.event.dd.acceptCriteria;
  8. import java.io.Serializable;
  9. import com.vaadin.event.Transferable;
  10. import com.vaadin.event.dd.DragAndDropEvent;
  11. import com.vaadin.event.dd.DropHandler;
  12. import com.vaadin.terminal.PaintException;
  13. import com.vaadin.terminal.PaintTarget;
  14. /**
  15. * TODO Javadoc
  16. *
  17. * @since 6.3
  18. *
  19. */
  20. public interface AcceptCriterion extends Serializable {
  21. /**
  22. * Criterion that can be used create policy to accept/discard dragged
  23. * content (presented by {@link Transferable}).
  24. *
  25. * May depend on state, like in OR or AND, so to be really
  26. * ClientSideVerifiable needs to return true here (instead of just
  27. * implementing marker interface).
  28. */
  29. public boolean isClientSideVerifiable();
  30. public void paint(PaintTarget target) throws PaintException;
  31. /**
  32. * This needs to be implemented iff criterion does some lazy server side
  33. * initialization. The UIDL painted in this method will be passed to client
  34. * side drop handler implementation. Implementation can assume that
  35. * {@link #accepts(DragAndDropEvent)} is called before this method.
  36. *
  37. * @param target
  38. * @throws PaintException
  39. */
  40. public void paintResponse(PaintTarget target) throws PaintException;
  41. /**
  42. * Validates the data in event to be approriate for
  43. * {@link DropHandler#drop(com.vaadin.event.dd.DropEvent)} method.
  44. * <p>
  45. * Note, that event if your criterion is matched on client side, it is a
  46. * very good manner to validate the data on server side too.
  47. *
  48. * @param dragEvent
  49. * @return
  50. */
  51. public boolean accepts(DragAndDropEvent dragEvent);
  52. }