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.

ServerSideCriterion.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.event.dd.acceptcriteria;
  5. import java.io.Serializable;
  6. import com.vaadin.event.Transferable;
  7. import com.vaadin.terminal.PaintException;
  8. import com.vaadin.terminal.PaintTarget;
  9. import com.vaadin.terminal.gwt.client.ui.dd.VServerAccept;
  10. /**
  11. * Parent class for criteria which are verified on the server side during a drag
  12. * operation to accept/discard dragged content (presented by
  13. * {@link Transferable}).
  14. * <p>
  15. * Subclasses should implement the
  16. * {@link AcceptCriterion#accept(com.vaadin.event.dd.DragAndDropEvent)} method.
  17. * <p>
  18. * As all server side state can be used to make a decision, this is more
  19. * flexible than {@link ClientSideCriterion}. However, this does require
  20. * additional requests from the browser to the server during a drag operation.
  21. *
  22. * @see AcceptCriterion
  23. * @see ClientSideCriterion
  24. *
  25. * @since 6.3
  26. */
  27. @ClientCriterion(VServerAccept.class)
  28. public abstract class ServerSideCriterion implements Serializable,
  29. AcceptCriterion {
  30. private static final long serialVersionUID = 2128510128911628902L;
  31. public final boolean isClientSideVerifiable() {
  32. return false;
  33. }
  34. public void paint(PaintTarget target) throws PaintException {
  35. target.startTag("-ac");
  36. target.addAttribute("name", getIdentifier());
  37. paintContent(target);
  38. target.endTag("-ac");
  39. }
  40. public void paintContent(PaintTarget target) {
  41. }
  42. public void paintResponse(PaintTarget target) throws PaintException {
  43. }
  44. protected String getIdentifier() {
  45. return ServerSideCriterion.class.getCanonicalName();
  46. }
  47. }