List of usage examples for com.vaadin.client ServerConnector getParent
@Override
public ServerConnector getParent();
From source file:fi.jasoft.draganddrop.client.DragAndDropConnector.java
License:Apache License
private static DragAndDropConnector getTargetConnector(Node node) { assert node != null : "Cannot get connector for null node"; List<DragAndDropConnector> matchingConnectors = new ArrayList<DragAndDropConnector>(); for (DragAndDropConnector connector : extensions) { if (connector.getTargetComponent().getWidget().getElement().isOrHasChild(node)) { matchingConnectors.add(connector); }//w w w .j a v a2 s . c o m } // Only one matching connector, return it if (matchingConnectors.size() == 1) { return matchingConnectors.get(0); } // Inner connectors with drag and drop enabled, need to search for the // inner most child (maximum depth) int depth = 0; DragAndDropConnector con = null; for (int i = 0; i < matchingConnectors.size(); i++) { ServerConnector c = matchingConnectors.get(i); int d = 0; while (c != null) { d++; c = c.getParent(); } if (d > depth) { depth = d; con = matchingConnectors.get(i); } } return con; }