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.

VDragSourceIs.java 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.client.ui.dd;
  5. import com.vaadin.terminal.gwt.client.Paintable;
  6. import com.vaadin.terminal.gwt.client.PaintableMap;
  7. import com.vaadin.terminal.gwt.client.UIDL;
  8. /**
  9. * TODO Javadoc!
  10. *
  11. * @since 6.3
  12. */
  13. final public class VDragSourceIs extends VAcceptCriterion {
  14. @Override
  15. protected boolean accept(VDragEvent drag, UIDL configuration) {
  16. try {
  17. Paintable component = drag.getTransferable().getDragSource();
  18. int c = configuration.getIntAttribute("c");
  19. for (int i = 0; i < c; i++) {
  20. String requiredPid = configuration
  21. .getStringAttribute("component" + i);
  22. VDropHandler currentDropHandler = VDragAndDropManager.get()
  23. .getCurrentDropHandler();
  24. Paintable paintable = PaintableMap.get(
  25. currentDropHandler.getApplicationConnection())
  26. .getPaintable(requiredPid);
  27. if (paintable == component) {
  28. return true;
  29. }
  30. }
  31. } catch (Exception e) {
  32. }
  33. return false;
  34. }
  35. }