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.

VNot.java 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. /**
  5. *
  6. */
  7. package com.vaadin.terminal.gwt.client.ui.dd;
  8. import com.vaadin.terminal.gwt.client.ApplicationConnection;
  9. import com.vaadin.terminal.gwt.client.UIDL;
  10. /**
  11. * TODO implementation could now be simplified/optimized
  12. *
  13. */
  14. final public class VNot extends VAcceptCriterion {
  15. private boolean b1;
  16. private VAcceptCriterion crit1;
  17. @Override
  18. public void accept(VDragEvent drag, UIDL configuration,
  19. VAcceptCallback callback) {
  20. if (crit1 == null) {
  21. crit1 = getCriteria(drag, configuration, 0);
  22. if (crit1 == null) {
  23. ApplicationConnection.getConsole().log(
  24. "Not criteria didn't found a child criteria");
  25. return;
  26. }
  27. }
  28. b1 = false;
  29. VAcceptCallback accept1cb = new VAcceptCallback() {
  30. public void accepted(VDragEvent event) {
  31. b1 = true;
  32. }
  33. };
  34. crit1.accept(drag, configuration.getChildUIDL(0), accept1cb);
  35. if (!b1) {
  36. callback.accepted(drag);
  37. }
  38. }
  39. private VAcceptCriterion getCriteria(VDragEvent drag, UIDL configuration,
  40. int i) {
  41. UIDL childUIDL = configuration.getChildUIDL(i);
  42. return VAcceptCriteria.get(childUIDL.getStringAttribute("name"));
  43. }
  44. @Override
  45. public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
  46. return false; // TODO enforce on server side
  47. }
  48. @Override
  49. public boolean validates(VDragEvent drag, UIDL configuration) {
  50. return false; // not used
  51. }
  52. }