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

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.client.ui.dd;
  5. import com.vaadin.terminal.gwt.client.ComponentConnector;
  6. import com.vaadin.terminal.gwt.client.ConnectorMap;
  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. ComponentConnector component = drag.getTransferable()
  18. .getDragSource();
  19. int c = configuration.getIntAttribute("c");
  20. for (int i = 0; i < c; i++) {
  21. String requiredPid = configuration
  22. .getStringAttribute("component" + i);
  23. VDropHandler currentDropHandler = VDragAndDropManager.get()
  24. .getCurrentDropHandler();
  25. ComponentConnector paintable = (ComponentConnector) ConnectorMap
  26. .get(currentDropHandler.getApplicationConnection())
  27. .getConnector(requiredPid);
  28. if (paintable == component) {
  29. return true;
  30. }
  31. }
  32. } catch (Exception e) {
  33. }
  34. return false;
  35. }
  36. }