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.

VOr.java 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. /**
  5. *
  6. */
  7. package com.vaadin.terminal.gwt.client.ui.dd;
  8. import com.vaadin.event.dd.acceptcriteria.Or;
  9. import com.vaadin.terminal.gwt.client.UIDL;
  10. /**
  11. *
  12. */
  13. @AcceptCriterion(Or.class)
  14. final public class VOr extends VAcceptCriterion implements VAcceptCallback {
  15. private boolean accepted;
  16. @Override
  17. public void accept(VDragEvent drag, UIDL configuration,
  18. VAcceptCallback callback) {
  19. int childCount = configuration.getChildCount();
  20. accepted = false;
  21. for (int i = 0; i < childCount; i++) {
  22. VAcceptCriterion crit = VAnd.getCriteria(drag, configuration, i);
  23. crit.accept(drag, configuration.getChildUIDL(i), this);
  24. if (accepted == true) {
  25. callback.accepted(drag);
  26. return;
  27. }
  28. }
  29. }
  30. @Override
  31. public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
  32. return false;
  33. }
  34. @Override
  35. protected boolean accept(VDragEvent drag, UIDL configuration) {
  36. return false; // not used here
  37. }
  38. public void accepted(VDragEvent event) {
  39. accepted = true;
  40. }
  41. }