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.1KB

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