/** * Returns an list containing all graph cells taht have the same userObject. * * @param userObject The userObject for which all graph cels should be found. * @return java.util.List */ private List<Object> getCellsWithUserObject(Object userObject) { List<Object> cells = new ArrayList<Object>(); if (userObject != null) { // get the graph model, which contains all the cells of the graph GraphModel model = graph.getModel(); // loop through all the cells of the model for (int i = 0; i < model.getRootCount(); i++) { Object root = model.getRootAt(i); // get the userObject for the curent graph cell Object rootUserObject = getUserObject(root); if (rootUserObject != null) { if (userObject == rootUserObject) { // the userObject of the current graph cell is teh same like the wanted userObject cells.add(root); } } } } return cells; }