public mxCell addJGraphTEdge( final DefaultWeightedEdge edge ) { if ( edgeToCellMap.containsKey( edge ) ) { // cell for edge already existed, skip creation and return original // cell. return edgeToCellMap.get( edge ); } mxCell cell = null; getModel().beginUpdate(); try { final Spot source = tmm.getTrackModel().getEdgeSource( edge ); final Spot target = tmm.getTrackModel().getEdgeTarget( edge ); cell = new mxCell( edge ); cell.setEdge( true ); cell.setId( null ); cell.setValue( String.format( "%.1f", tmm.getTrackModel().getEdgeWeight( edge ) ) ); cell.setGeometry( new mxGeometry() ); cell.getGeometry().setRelative( true ); addEdge( cell, defaultParent, vertexToCellMap.get( source ), vertexToCellMap.get( target ), null ); edgeToCellMap.put( edge, cell ); cellToEdgeMap.put( cell, edge ); } finally { getModel().endUpdate(); } return cell; }
public mxCell addJGraphTEdge( final DefaultWeightedEdge edge ) { if ( edgeToCellMap.containsKey( edge ) ) { // cell for edge already existed, skip creation and return original // cell. return edgeToCellMap.get( edge ); } mxCell cell = null; getModel().beginUpdate(); try { final Spot source = tmm.getTrackModel().getEdgeSource( edge ); final Spot target = tmm.getTrackModel().getEdgeTarget( edge ); cell = new mxCell( edge ); cell.setEdge( true ); cell.setId( null ); cell.setValue( String.format( "%.1f", tmm.getTrackModel().getEdgeWeight( edge ) ) ); cell.setGeometry( new mxGeometry() ); cell.getGeometry().setRelative( true ); addEdge( cell, defaultParent, vertexToCellMap.get( source ), vertexToCellMap.get( target ), null ); edgeToCellMap.put( edge, cell ); cellToEdgeMap.put( cell, edge ); } finally { getModel().endUpdate(); } return cell; }
/** * Hook method that creates the new edge for insertEdge. This * implementation does not set the source and target of the edge, these * are set when the edge is added to the model. * * @param parent Cell that specifies the parent of the new edge. * @param id Optional string that defines the Id of the new edge. * @param value Object to be used as the user object. * @param source Cell that defines the source of the edge. * @param target Cell that defines the target of the edge. * @param style Optional string that defines the cell style. * @return Returns the new edge to be inserted. */ public Object createEdge(Object parent, String id, Object value, Object source, Object target, String style) { mxCell edge = new mxCell(value, new mxGeometry(), style); edge.setId(id); edge.setEdge(true); edge.getGeometry().setRelative(true); return edge; }
/** * Hook method that creates the new edge for insertEdge. This * implementation does not set the source and target of the edge, these * are set when the edge is added to the model. * * @param parent Cell that specifies the parent of the new edge. * @param id Optional string that defines the Id of the new edge. * @param value Object to be used as the user object. * @param source Cell that defines the source of the edge. * @param target Cell that defines the target of the edge. * @param style Optional string that defines the cell style. * @return Returns the new edge to be inserted. */ public Object createEdge(Object parent, String id, Object value, Object source, Object target, String style) { mxCell edge = new mxCell(value, new mxGeometry(), style); edge.setId(id); edge.setEdge(true); edge.getGeometry().setRelative(true); return edge; }
/** * 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; }