use of eu.esdihumboldt.hale.ui.common.graph.figures.EntityFigure in project hale by halestudio.
the class TransformationTreeLabelProvider method getFigure.
/**
* @see GraphLabelProvider#getFigure(Object)
*/
@Override
public IFigure getFigure(Object element) {
if (element instanceof IdentityWrapper<?>) {
element = ((IdentityWrapper<?>) element).getValue();
}
ShapePainter shape = null;
String contextText = null;
String cardText = null;
if (element instanceof TransformationTree) {
shape = new TransformationNodeShape(10, SWT.NONE);
} else if (element instanceof TargetNode) {
TargetNode node = (TargetNode) element;
contextText = AlignmentUtil.getContextText(node.getEntityDefinition());
if (!hasTransformationAnnotations(element)) {
cardText = getCardinalityText(node.getEntityDefinition().getDefinition());
}
if (node.getAssignments().isEmpty()) {
shape = new TransformationNodeShape(10, SWT.NONE);
} else {
// shape = new TransformationNodeShape(10, SWT.LEFT);
shape = new FingerPost(10, SWT.LEFT);
}
} else if (element instanceof SourceNode) {
SourceNode node = (SourceNode) element;
contextText = AlignmentUtil.getContextText(node.getEntityDefinition());
if (!hasTransformationAnnotations(element)) {
cardText = getCardinalityText(node.getEntityDefinition().getDefinition());
}
if (node.getParent() == null) {
shape = new TransformationNodeShape(10, SWT.NONE);
} else {
shape = new FingerPost(10, SWT.RIGHT);
}
}
if (shape != null) {
CustomShapeFigure figure;
if (contextText != null || cardText != null) {
figure = new EntityFigure(shape, contextText, cardText, getCustomFigureFont());
} else {
figure = new CustomShapeLabel(shape, getCustomFigureFont());
}
figure.setMaximumWidth(MAX_FIGURE_WIDTH);
return figure;
}
element = TransformationTreeUtil.extractObject(element);
return super.getFigure(element);
}
Aggregations