Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ClientSideCriterion.java 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.event.dd.acceptcriteria;
  5. import java.io.Serializable;
  6. import com.vaadin.terminal.PaintException;
  7. import com.vaadin.terminal.PaintTarget;
  8. /**
  9. * Parent class for criteria that can be completely validated on client side.
  10. * All classes that provide criteria that can be completely validated on client
  11. * side should extend this class.
  12. *
  13. * It is recommended that subclasses of ClientSideCriterion re-validate the
  14. * condition on the server side in
  15. * {@link AcceptCriterion#accept(com.vaadin.event.dd.DragAndDropEvent)} after
  16. * the client side validation has accepted a transfer.
  17. *
  18. * @since 6.3
  19. */
  20. public abstract class ClientSideCriterion implements Serializable,
  21. AcceptCriterion {
  22. /*
  23. * All criteria that extend this must be completely validatable on client
  24. * side.
  25. *
  26. * (non-Javadoc)
  27. *
  28. * @see
  29. * com.vaadin.event.dd.acceptCriteria.AcceptCriterion#isClientSideVerifiable
  30. * ()
  31. */
  32. public final boolean isClientSideVerifiable() {
  33. return true;
  34. }
  35. public void paint(PaintTarget target) throws PaintException {
  36. target.startTag("-ac");
  37. target.addAttribute("name", getIdentifier());
  38. paintContent(target);
  39. target.endTag("-ac");
  40. }
  41. protected void paintContent(PaintTarget target) throws PaintException {
  42. }
  43. protected String getIdentifier() {
  44. return getClass().getCanonicalName();
  45. }
  46. public final void paintResponse(PaintTarget target) throws PaintException {
  47. // NOP, nothing to do as this is client side verified criterion
  48. }
  49. }