use of org.jgraph.graph.DefaultEdge in project cayenne by apache.
the class BaseGraphBuilder method createRelationshipCell.
protected DefaultEdge createRelationshipCell(Relationship rel) {
if (!relCells.containsKey(getQualifiedName(rel))) {
Relationship reverse = rel.getReverseRelationship();
DefaultEdge edge = new DefaultEdge();
// GraphConstants.setLineStyle(edge.getAttributes(),
// GraphConstants.STYLE_ORTHOGONAL);
// GraphConstants.setRouting(edge.getAttributes(),
// GraphConstants.ROUTING_SIMPLE);
GraphConstants.setEditable(edge.getAttributes(), false);
GraphConstants.setLabelAlongEdge(edge.getAttributes(), true);
GraphConstants.setSelectable(edge.getAttributes(), false);
GraphConstants.setFont(edge.getAttributes(), EDGE_FONT);
updateRelationshipLabels(edge, rel, reverse);
relCells.put(getQualifiedName(rel), edge);
if (reverse != null) {
relCells.put(getQualifiedName(reverse), edge);
}
return edge;
}
return null;
}
use of org.jgraph.graph.DefaultEdge 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.DefaultEdge in project cayenne by apache.
the class ObjGraphBuilder method postProcessEntity.
@Override
protected void postProcessEntity(Entity entity, DefaultGraphCell cell) {
super.postProcessEntity(entity, cell);
GraphConstants.setBackground(cell.getAttributes(), ENTITY_COLOR);
GraphConstants.setOpaque(cell.getAttributes(), true);
DefaultEdge edge = createInheritanceEdge((ObjEntity) entity);
if (edge != null) {
createdObjects.add(edge);
}
}
use of org.jgraph.graph.DefaultEdge in project cayenne by apache.
the class BaseGraphBuilder method insertRelationshipCell.
protected void insertRelationshipCell(Relationship rel) {
DefaultEdge edge = createRelationshipCell(rel);
insert(edge);
}
use of org.jgraph.graph.DefaultEdge in project cayenne by apache.
the class BaseGraphBuilder method removeRelationshipCell.
protected void removeRelationshipCell(Relationship rel) {
final DefaultEdge edge = relCells.get(getQualifiedName(rel));
if (edge != null) {
runWithUndoDisabled(() -> graph.getGraphLayoutCache().remove(new Object[] { edge }));
relCells.remove(getQualifiedName(rel));
}
}
Aggregations