private static List< mxCell > getSelectionVertices( final mxGraph graph ) { // Build selection categories final Object[] selection = graph.getSelectionCells(); final ArrayList< mxCell > vertices = new ArrayList< >(); for ( final Object obj : selection ) { final mxCell cell = ( mxCell ) obj; if ( cell.isVertex() ) vertices.add( cell ); } return vertices; }
private static List< mxCell > getSelectionVertices( final mxGraph graph ) { // Build selection categories final Object[] selection = graph.getSelectionCells(); final ArrayList< mxCell > vertices = new ArrayList< >(); for ( final Object obj : selection ) { final mxCell cell = ( mxCell ) obj; if ( cell.isVertex() ) vertices.add( cell ); } return vertices; }
newGraph.clearSelection(); newGraph.selectAll(); Object[] cells = newGraph.getSelectionCells(); //here you have all cells for (Object c : cells) { mxCell cell = (mxCell) c; //cast if (cell.isVertex()) { //isVertex //todo }else{ //is not a vertex, so u can get source and target //todo cell.getChildCount(); //Returns the number of child cells. (edges) cell.getChildAt(x); //Returns the child at the specified index. (target) }
if ( lCell.isVertex() ) vertices.add( lCell ); else if ( lCell.isEdge() )
if ( lCell.isVertex() ) vertices.add( lCell ); else if ( lCell.isEdge() )
if ( null != cell ) if ( cell.isVertex() )
if ( null != cell ) if ( cell.isVertex() )
/** * Returns a clone of the cell. */ public Object clone() throws CloneNotSupportedException { mxCell clone = (mxCell) super.clone(); clone.setValue(cloneValue()); clone.setStyle(getStyle()); clone.setCollapsed(isCollapsed()); clone.setConnectable(isConnectable()); clone.setEdge(isEdge()); clone.setVertex(isVertex()); clone.setVisible(isVisible()); clone.setParent(null); clone.setSource(null); clone.setTarget(null); clone.children = null; clone.edges = null; mxGeometry geometry = getGeometry(); if (geometry != null) { clone.setGeometry((mxGeometry) geometry.clone()); } return clone; }
/** * Returns a clone of the cell. */ public Object clone() throws CloneNotSupportedException { mxCell clone = (mxCell) super.clone(); clone.setValue(cloneValue()); clone.setStyle(getStyle()); clone.setCollapsed(isCollapsed()); clone.setConnectable(isConnectable()); clone.setEdge(isEdge()); clone.setVertex(isVertex()); clone.setVisible(isVisible()); clone.setParent(null); clone.setSource(null); clone.setTarget(null); clone.children = null; clone.edges = null; mxGeometry geometry = getGeometry(); if (geometry != null) { clone.setGeometry((mxGeometry) geometry.clone()); } return clone; }