public Vector<AbstractAction> createEdgeActions(final DefaultEdge defaultEdge, final ModelJGraph graph) { Vector<AbstractAction> actions=new Vector<AbstractAction>(); final RoleEntity re=(RoleEntity)(defaultEdge.getUserObject()); Field[] fs=re.getClass().getFields(); if (fs.length>1)
private static void insertRelationshipInManager(NAryEdge nEdge, DefaultEdge[] edges, GraphCell[] selected, java.util.List currentAssignation) { // The NAryEdgeEntity of the relationship is built. NAryEdgeEntity nae = (NAryEdgeEntity) nEdge.getUserObject(); for (int i = 0; i < currentAssignation.size(); i++) { if (! ( ( (DefaultGraphCell) selected[i]).getUserObject()instanceof NAryEdgeEntity)) { nae.addObject(selected[i].hashCode() + "", ( (Entity) ( (DefaultGraphCell) selected[i]). getUserObject()), ( (RoleEntity) edges[i].getUserObject()), (String) currentAssignation.get(i), ( ( (DefaultGraphCell) selected[i]).getUserObject(). getClass().getName())); } } // Insert the Edge in the relationship manager. // this.rm.addRelationship((Entity) nEdge.getUserObject()); }
private void insertRelationshipInManager(NAryEdge nEdge, DefaultEdge[] edges, GraphCell[] selected, java.util.List currentAssignation) { // The NAryEdgeEntity of the relationship is built. NAryEdgeEntity nae = (NAryEdgeEntity) nEdge.getUserObject(); for (int i = 0; i < currentAssignation.size(); i++) { if (! ( ( (DefaultGraphCell) selected[i]).getUserObject()instanceof NAryEdgeEntity)) { nae.addObject(selected[i].hashCode() + "", ( (Entity) ( (DefaultGraphCell) selected[i]). getUserObject()), ( (RoleEntity) edges[i].getUserObject()), (String) currentAssignation.get(i), ( ( (DefaultGraphCell) selected[i]).getUserObject(). getClass().getName())); } } // Insert the Edge in the relationship manager. // this.rm.addRelationship((Entity) nEdge.getUserObject()); }
private static Hashtable edgesAttributes(DefaultEdge[] edges, String[] roleAssignation) { Hashtable edgesAttributes = new Hashtable(); for (int i = 0; i < roleAssignation.length; i++) { // Create a Map that holds the attributes for the edge RoleEntity re = (RoleEntity) edges[i].getUserObject(); Map attr = re.getAttributes(); // Source /*if (selectedAssignation[i].indexOf("source") >= 0) // Add a Line Begin Attribute GraphConstants.setLineBegin(attr, GraphConstants.SIMPLE);*/ // Target if (roleAssignation[i].toUpperCase().indexOf("TARGET") >= 0 || roleAssignation[i].endsWith("T")) { // Add a Line End Attribute GraphConstants.setLineEnd(attr, GraphConstants.ARROW_SIMPLE); // Associate the Edge with its Attributes } GraphConstants.setDisconnectable(attr,false); GraphConstants.setLineWidth(attr, 1); GraphConstants.setEndSize(attr, 7); GraphConstants.setBendable(attr,false); edgesAttributes.put(edges[i], attr); } return edgesAttributes; }
private Hashtable edgesAttributes(DefaultEdge[] edges, String[] roleAssignation) { Hashtable edgesAttributes = new Hashtable(); for (int i = 0; i < roleAssignation.length; i++) { // Create a Map that holds the attributes for the edge RoleEntity re = (RoleEntity) edges[i].getUserObject(); Map attr = re.getAttributes(); // Source /*if (selectedAssignation[i].indexOf("source") >= 0) // Add a Line Begin Attribute GraphConstants.setLineBegin(attr, GraphConstants.SIMPLE);*/ // Target if (roleAssignation[i].toUpperCase().indexOf("TARGET") >= 0 || roleAssignation[i].endsWith("T")) { // Add a Line End Attribute GraphConstants.setLineEnd(attr, GraphConstants.ARROW_SIMPLE); // Associate the Edge with its Attributes } GraphConstants.setDisconnectable(attr,false); GraphConstants.setLineWidth(attr, 1); GraphConstants.setEndSize(attr, 7); GraphConstants.setBendable(attr,false); edgesAttributes.put(edges[i], attr); } return edgesAttributes; }
private void createRelationshipMenu(JPopupMenu menu, NAryEdge nary) { String typeOfRelationship=((ingenias.editor.entities.NAryEdgeEntity)nary.getUserObject()).getType(); Vector<String> roles=new Vector<String>(nary.getRoles()); addActionsToPopupMenu(menu,af.createCellActions(nary, getGraph())); menu.addSeparator(); menu.add(createMenu("views",daf.createChangeViewActions(nary, graph))); for (int k=0;k<roles.size();k++){ DefaultEdge[] edgesPerRole=nary.getRoleEdges(roles.elementAt(k)); if (edgesPerRole.length>1){ for (int j=0;j<edgesPerRole.length;j++){ final RoleEntity re=(RoleEntity)(edgesPerRole[j].getUserObject()); Vector<AbstractAction> edgeMenuActions = af.createEdgeActions( nary.getRoleEdges(roles.elementAt(k))[j], getGraph()); DefaultGraphCell dgc=getOtherExtremeFromAryEdge(graph.getModel(), edgesPerRole[j]); menu.add(createMenu("role:"+roles.elementAt(k)+":"+ ((Entity)dgc.getUserObject()).getId(),edgeMenuActions)); } } else { if (edgesPerRole.length==1){ DefaultGraphCell dgc=getOtherExtremeFromAryEdge(graph.getModel(), nary.getRoleEdges(roles.elementAt(k))[0]); Vector<AbstractAction> edgeMenuActions = af.createEdgeActions(nary.getRoleEdges(roles.elementAt(k))[0], getGraph()); menu.add(createMenu("role:"+roles.elementAt(k)+":"+ ((Entity)dgc.getUserObject()).getId(),edgeMenuActions)); } } } }
private void hideRoleLabels() { Object[] cells = this.getGraph().getSelectionCells(); if (cells == null || cells.length == 0) { cells = this.getGraph().getRoots(); } for (int k = 0; k < cells.length; k++) { Object gc = cells[k]; if (gc instanceof DefaultEdge) { RoleEntity r = (RoleEntity) ( (org.jgraph.graph.DefaultEdge) gc). getUserObject(); r.hide(); } } this.getGraph().repaint(); }
private void showRoleLabels() { Object[] cells = this.getGraph().getSelectionCells(); if (cells == null || cells.length == 0) { cells = this.getGraph().getRoots(); } for (int k = 0; k < cells.length; k++) { Object gc = cells[k]; if (gc instanceof DefaultEdge) { RoleEntity r = (RoleEntity) ( (org.jgraph.graph.DefaultEdge) gc). getUserObject(); r.show(r.getAttributeToShow() + 1); } } this.getGraph().repaint(); }
for (int i = 0; i < selectedAssignation.length; i++) { Map attr = ( (RoleEntity) auxiliaryEdges[i].getUserObject()). getAttributes();
RoleEntity re=((RoleEntity)auxiliaryEdges[i].getUserObject());