use of org.jgraph.graph.AttributeMap in project cayenne by apache.
the class BaseGraphBuilder method updateEntityCell.
/**
* Updates specified entity on the graph
*/
protected void updateEntityCell(Entity e) {
DefaultGraphCell cell = entityCells.get(e.getName());
if (cell != null) {
GraphConstants.setValue(cell.getAttributes(), getCellMetadata(e));
GraphConstants.setResize(cell.getAttributes(), true);
Map<DefaultGraphCell, AttributeMap> nested = new HashMap<>();
nested.put(cell, cell.getAttributes());
edit(nested);
}
}
use of org.jgraph.graph.AttributeMap in project cayenne by apache.
the class BaseGraphBuilder method updateRelationshipCell.
protected void updateRelationshipCell(Relationship rel) {
if (rel.getSourceEntity() != null && rel.getTargetEntity() != null) {
DefaultEdge edge = relCells.get(getQualifiedName(rel));
if (edge != null) {
updateRelationshipLabels(edge, rel, rel.getReverseRelationship());
Map<DefaultEdge, AttributeMap> nested = new HashMap<>();
nested.put(edge, edge.getAttributes());
edit(nested);
} else {
insertRelationshipCell(rel);
}
}
}
use of org.jgraph.graph.AttributeMap in project cayenne by apache.
the class ObjGraphBuilder method objEntityChanged.
public void objEntityChanged(EntityEvent e) {
remapEntity(e);
updateEntityCell(e.getEntity());
// maybe super entity was changed
ObjEntity entity = (ObjEntity) e.getEntity();
DefaultEdge inheritanceEdge = inheritanceEdges.get(entity);
if (inheritanceEdge != null) {
if (entity.getSuperEntity() == null) {
graph.getGraphLayoutCache().remove(new Object[] { inheritanceEdge });
inheritanceEdges.remove(entity);
} else {
inheritanceEdge.setTarget(entityCells.get(entity.getSuperEntity().getName()).getChildAt(0));
Map<DefaultEdge, AttributeMap> nested = new HashMap<>();
nested.put(inheritanceEdge, inheritanceEdge.getAttributes());
graph.getGraphLayoutCache().edit(nested);
}
} else {
if (entity.getSuperEntity() != null) {
DefaultEdge edge = createInheritanceEdge(entity);
graph.getGraphLayoutCache().insert(edge);
}
}
}
Aggregations