/** * Obtains all hidden vertices of the specified cell * @param cell the cell whose children are to be determined * @return all the child hidden vertices */ private Set getHiddenChildren(Object cell) { List cellChildren = DefaultGraphModel.getDescendants(model, new Object[] {cell}); Set cells = new HashSet(); cells.add(cell); Iterator iter = cellChildren.iterator(); while (iter.hasNext()) { Object childCell = iter.next(); if (DefaultGraphModel.isVertex(model, childCell) && !graphLayoutCache.isVisible(childCell)) { cells.add(childCell); } } return cells; }
/** * Divides the graph into groups of sibling vertices, vertices that * share the same parent. This is mostly used for layouting of cell * relative to their group context. * */ protected void determineLayoutHierarchies() { if (model != null) { groupHierarchies = new ArrayList(); Set rootsSet = null; Object[] modelRoots = DefaultGraphModel.getRoots(model); for (int i = 0; i < modelRoots.length; i++) { if (DefaultGraphModel.isVertex(model, modelRoots[i])) { populateGroupHierarchies(modelRoots[i]); if (rootsSet == null) { rootsSet = new LinkedHashSet(); } rootsSet.add(modelRoots[i]); } } if (rootsSet != null) { groupHierarchies.add(rootsSet); } } }
/** * Returns all unconnected vertices in the graph. <br> * * @return Returns all the unconnected cells that the layout should take * into account */ public Collection getUnconnectedVertices(boolean ordered) { Collection vertices = getAll(); Set result = null; if (ordered && order != null) { result = new TreeSet(order); } else { result = new LinkedHashSet(); } Iterator it = vertices.iterator(); while (it.hasNext()) { Object cell = it.next(); // Check if cell is unconnected vertex if (DefaultGraphModel.isVertex(model, cell)) { Object[] edges = getEdges(cell); if (edges == null || edges.length == 0) { result.add(cell); } } } return result; }
/** * Creates a set of sibling vertices and adds them to the group * hierarchy collection. The list of hierarchies will naturally * form in an order * @param vertex The parent vertex to the returned vertices */ protected void populateGroupHierarchies(Object vertex) { LinkedHashSet result = null; if (vertex != null) { for (int i = 0; i < model.getChildCount(vertex); i++) { Object child = model.getChild(vertex, i); if (DefaultGraphModel.isVertex(model, child)) { if (result == null) { result = new LinkedHashSet(); } result.add(child); populateGroupHierarchies(child); } } } if (groupHierarchies == null) { groupHierarchies = new ArrayList(); } if (result != null) { groupHierarchies.add(result); } }
Object otherPort = model.getSource(otherEdge); Object otherCell = null; if (DefaultGraphModel.isVertex(model, otherPort)) { otherCell = otherPort; } else {
for (int i = 0; i < numChildCells; i++) { Object childCell = model.getChild(cell, i); if (DefaultGraphModel.isVertex(model, childCell) && graphLayoutCache.isVisible(childCell) && cell != childCell) {
while (iter.hasNext()) { Object childCell = iter.next(); if (DefaultGraphModel.isVertex(model, childCell) && (!cache.isVisible(childCell))) { cells1.add(childCell); while (iter.hasNext()) { Object childCell = iter.next(); if (DefaultGraphModel.isVertex(model, childCell) && (!cache.isVisible(childCell))) { cells2.add(childCell);
childVisible = graphLayoutCache.isVisible(childCell); if (DefaultGraphModel.isVertex(model, childCell) && childVisible && cell != childCell) {
if (DefaultGraphModel.isVertex(model, cell)) { if (ignoresUnconnectedCells) { Object[] edges = getEdges(cell);
CellView parent = getMapping(model.getParent(cell), false); if (parent != null) { if (DefaultGraphModel.isVertex(model, parent))
for (int i = 0; i < numChildren; i++) { Object child = model.getChild(cell, i); if (DefaultGraphModel.isVertex(model, child) && cell != child) { if (graphLayoutCache != null && !graphLayoutCache.isVisible(child)) {