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.

VAnd.java 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. @AcceptCriterion("com.vaadin.event.dd.acceptcriteria.And")
  10. final public class VAnd extends VAcceptCriterion implements VAcceptCallback {
  11. private boolean b1;
  12. static VAcceptCriterion getCriteria(VDragEvent drag, UIDL configuration,
  13. int i) {
  14. UIDL childUIDL = configuration.getChildUIDL(i);
  15. return VAcceptCriteria.get(childUIDL.getStringAttribute("name"));
  16. }
  17. @Override
  18. protected boolean accept(VDragEvent drag, UIDL configuration) {
  19. int childCount = configuration.getChildCount();
  20. for (int i = 0; i < childCount; i++) {
  21. VAcceptCriterion crit = getCriteria(drag, configuration, i);
  22. b1 = false;
  23. crit.accept(drag, configuration.getChildUIDL(i), this);
  24. if (!b1) {
  25. return false;
  26. }
  27. }
  28. return true;
  29. }
  30. public void accepted(VDragEvent event) {
  31. b1 = true;
  32. }
  33. }