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; }
private DefaultGraphCell createCell(K stateKey, Point2D placement) { // System.out.println(name + " " + placement + " " + index); String cellName = stateKey.toString(); DefaultGraphCell stateCell = new DefaultGraphCell(new String(cellName)); Font font = new Font("Arial", Font.PLAIN, 12); GraphConstants.setFont(stateCell.getAttributes(), font); GraphConstants.setAutoSize(stateCell.getAttributes(), true); GraphConstants.setOpaque(stateCell.getAttributes(), true); Color color = colorStateCell(stateKey); GraphConstants.setBackground(stateCell.getAttributes(), color); GraphConstants.setBounds(stateCell.getAttributes(), new Rectangle2D.Double(placement.getX(), placement.getY(), 0, 0)); stateCell.addPort(); return stateCell; }
private DefaultGraphCell createCell(String name, Point2d placement, int index) { // System.out.println(name + " " + placement + " " + index); stateCells[index] = new DefaultGraphCell(new String(name)); Font f = new Font("Arial", Font.PLAIN, 12); GraphConstants.setFont(stateCells[index].getAttributes(), f); GraphConstants.setAutoSize(stateCells[index].getAttributes(), true); GraphConstants.setOpaque(stateCells[index].getAttributes(), true); Color color = colorStateCell(stateMachine.states.get(indexOfStateinStateMachine(name))); GraphConstants.setBackground(stateCells[index].getAttributes(), color); GraphConstants.setBounds(stateCells[index].getAttributes(), new Rectangle2D.Double(placement.getX(), placement.getY(), 0, 0)); stateCells[index].addPort(); return stateCells[index]; }
private DefaultGraphCell createCell(String name, Point2D placement, int index) { // System.out.println(name + " " + placement + " " + index); stateCells[index] = new DefaultGraphCell(new String(name)); Font f = new Font("Arial", Font.PLAIN, 12); GraphConstants.setFont(stateCells[index].getAttributes(), f); GraphConstants.setAutoSize(stateCells[index].getAttributes(), true); GraphConstants.setOpaque(stateCells[index].getAttributes(), true); Color color = colorStateCell(stateMachine.states.get(indexOfStateinStateMachine(name))); GraphConstants.setBackground(stateCells[index].getAttributes(), color); GraphConstants.setBounds(stateCells[index].getAttributes(), new Rectangle2D.Double(placement.getX(), placement.getY(), 0, 0)); stateCells[index].addPort(); return stateCells[index]; }
protected DefaultGraphCell createEntityCell(Entity entity) { DefaultGraphCell cell = new DefaultGraphCell(getCellMetadata(entity)); GraphConstants.setResize(cell.getAttributes(), true); GraphConstants.setBorder(cell.getAttributes(), new LineBorder(Color.BLACK)); GraphConstants.setEditable(cell.getAttributes(), false); entityCells.put(entity.getName(), cell); cell.addPort(); return cell; }
DefaultGraphCell mapCell = new DefaultGraphCell(); createdObjects.add(mapCell);
DefaultGraphCell gm = new DefaultGraphCell("GraphModel"); attributes.put(gm, createBounds(new AttributeMap(), 20, 100, Color.blue)); gm.addPort(null, "GraphModel/Center"); DefaultGraphCell dgm = new DefaultGraphCell("DefaultGraphModel"); attributes.put(dgm, createBounds(new AttributeMap(), 20, 180, Color.blue)); cs.connect(dgmImplementsGm, gm.getChildAt(0), dgm.getChildAt(0)); attributes.put(dgmImplementsGm, implementStyle); DefaultGraphCell modelGroup = new DefaultGraphCell("ModelGroup"); modelGroup.add(gm); modelGroup.add(dgm); modelGroup.add(dgmImplementsGm); DefaultGraphCell jc = new DefaultGraphCell("JComponent"); attributes.put(jc, createBounds(new AttributeMap(), 180, 20, Color.green)); jc.addPort(null, "JComponent/Center"); DefaultGraphCell jg = new DefaultGraphCell("JGraph"); attributes.put(jg, createBounds(new AttributeMap(), 180, 100, Color.green)); DefaultGraphCell cu = new DefaultGraphCell("ComponentUI"); attributes .put(cu, createBounds(new AttributeMap(), 340, 20, Color.red)); cu.addPort(null, "ComponentUI/Center"); DefaultGraphCell gu = new DefaultGraphCell("GraphUI"); attributes.put(gu,