public static GraphRelationshipFactory createDefaultGraphFactory(Browser browser) throws NotInitialised{ return new GraphRelationshipFactory(browser.getState()); }
public static Vector<Hashtable<String,String>> getPossibleRoleAssignment(String relationshipType, String[] connectedEntities, Graph graph, Browser browser) throws NotFound{ Vector<GraphCell> entities=new Vector<GraphCell>(); for (String entityID:connectedEntities) { DefaultGraphCell entity = findEntity(entityID,graph); if (entity==null) throw new ingenias.exception.NotFound("Entity "+entityID+" that you tried to connect did not exist in the graph "+graph.getName()); entities.add(entity); } GraphCell[] selected=new GraphCell[entities.size()]; selected=entities.toArray(selected); NAryEdge nEdge=(NAryEdge) RelationshipFactory.getNRelationshipInstance(relationshipType, selected,browser); Vector<Hashtable<String, String>> result = convertToVectorHashtable(connectedEntities, selected, nEdge); return result; }
public static Vector< String> getPossibleRelationships( List<String> connectedEntities, Graph graph) throws NotFound{ return getPossibleRelationships(connectedEntities.toArray(new String[connectedEntities.size()]),graph); }
Vector<DefaultGraphCell> selectedV=new Vector<DefaultGraphCell>(); for (String cellid:cells){ selectedV.add(this.findEntity(cellid, diagram)); ConnectionSet cs = nEdge.connections(selectedAssignation, auxiliaryEdges, getPorts(newSelected, diagram.getGraph())); Hashtable edgesAttributes = this.edgesAttributes(auxiliaryEdges, selectedAssignation); Point centerP=calculateCenter(selected); Rectangle2D edgeb=GraphConstants.getBounds(nEdge.getAttributes()); GraphConstants.setBounds(m,new Rectangle(centerP,new Dimension(0,0))); this.insertRelationshipInManager(nEdge, auxiliaryEdges, newSelected, currentAssignation);
private DefaultGraphCell findEntity(String id){ Vector<ModelJGraph> graphs = this.ids.gm.getUOModels(); int k=0; boolean found=false; DefaultGraphCell result=null; while (result==null && k<graphs.size()){ result=findEntity(id,new GraphImp(graphs.elementAt(k), ids)); k++; } return result; }
public static Vector<Hashtable<String, String>> getPossibleRoleAssignment(String relationshipType, List<String> connectedEntities, Graph graph, Browser browser) throws NotFound{ return getPossibleRoleAssignment(relationshipType,connectedEntities.toArray(new String[connectedEntities.size()]),graph,browser); }
public static Vector< String> getPossibleRelationships( String[] connectedEntities, Graph graph) throws NotFound{ Vector<GraphCell> entities=new Vector<GraphCell>(); for (String entityID:connectedEntities) { DefaultGraphCell entity = findEntity(entityID,graph); if (entity==null) throw new ingenias.exception.NotFound("Entity "+entityID+" that you tried to connect did not exist in the graph "+graph.getName()); entities.add(findEntity(entityID,graph)); } GraphCell[] selected=new GraphCell[entities.size()]; selected=entities.toArray(selected); Object[] relObjArray = graph.getGraph().getPossibleRelationships(selected); Vector<String> result = new Vector<String>(); for (Object rel:relObjArray){ result.add(rel.toString()); } return result; }
public Vector<Hashtable<String,String>> getPossibleRoleAssignment(String relationshipType, String[] connectedEntities) throws NotFound{ Vector<GraphCell> entities=new Vector<GraphCell>(); for (String entityID:connectedEntities) { DefaultGraphCell entity = findEntity(entityID); if (entity==null){ // the entity may have not been created yet as graphical object // The object manager may know about it. if (this.ids.om.findUserObject(entityID).size()>0) entity=new DefaultGraphCell(this.ids.om.findUserObject(entityID).firstElement()); else throw new ingenias.exception.NotFound("Entity "+entityID+" that you tried to connect did not exist in any graph "); } //throw new ingenias.exception.NotFound("Entity "+entityID+" that you tried to connect did not exist in any graph "); entities.add(entity); } GraphCell[] selected=new GraphCell[entities.size()]; selected=entities.toArray(selected); NAryEdge nEdge=(NAryEdge) RelationshipFactory.getNRelationshipInstance(relationshipType, selected,browser); Vector<Hashtable<String, String>> result = convertToVectorHashtable(connectedEntities, selected, nEdge); return result; }
public static GraphRelationshipFactory createDefaultEmptyGraphFactory(){ return new GraphRelationshipFactory(IDEState.emptyIDEState()); }