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

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  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.UIDL;
  7. /**
  8. * TODO Javadoc!
  9. *
  10. * @since 6.3
  11. */
  12. final public class VDragSourceIs extends VAcceptCriterion {
  13. @Override
  14. public boolean validates(VDragEvent drag, UIDL configuration) {
  15. try {
  16. Paintable component = drag.getTransferable().getDragSource();
  17. int c = configuration.getIntAttribute("c");
  18. for (int i = 0; i < c; i++) {
  19. String requiredPid = configuration
  20. .getStringAttribute("component" + i);
  21. Paintable paintable = VDragAndDropManager.get()
  22. .getCurrentDropHandler().getApplicationConnection()
  23. .getPaintable(requiredPid);
  24. if (paintable == component) {
  25. return true;
  26. }
  27. }
  28. } catch (Exception e) {
  29. }
  30. return false;
  31. }
  32. }