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

12345678910111213141516171819202122232425262728293031323334353637383940
  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. @AcceptCriterion("com.vaadin.event.dd.acceptcriteria.SourceIs")
  14. final public class VDragSourceIs extends VAcceptCriterion {
  15. @Override
  16. protected boolean accept(VDragEvent drag, UIDL configuration) {
  17. try {
  18. ComponentConnector component = drag.getTransferable()
  19. .getDragSource();
  20. int c = configuration.getIntAttribute("c");
  21. for (int i = 0; i < c; i++) {
  22. String requiredPid = configuration
  23. .getStringAttribute("component" + i);
  24. VDropHandler currentDropHandler = VDragAndDropManager.get()
  25. .getCurrentDropHandler();
  26. ComponentConnector paintable = (ComponentConnector) ConnectorMap
  27. .get(currentDropHandler.getApplicationConnection())
  28. .getConnector(requiredPid);
  29. if (paintable == component) {
  30. return true;
  31. }
  32. }
  33. } catch (Exception e) {
  34. }
  35. return false;
  36. }
  37. }