Search in sources :

Example 1 with IServingRelationship

use of com.archimatetool.model.IServingRelationship in project archi by archimatetool.

the class ZestViewerLabelProvider method selfStyleConnection.

// ========================================================================================
// ISelfStyleProvider
// ========================================================================================
@Override
public void selfStyleConnection(Object element, GraphConnection connection) {
    connection.setLineWidth(0);
    connection.setTooltip(getTooltip(element));
    connection.setLineColor(ColorConstants.black);
    connection.setText(getText(element));
    PolylineConnection conn = (PolylineConnection) connection.getConnectionFigure();
    if (element instanceof ISpecializationRelationship) {
        conn.setTargetDecoration(SpecializationConnectionFigure.createFigureTargetDecoration());
    } else if (element instanceof ICompositionRelationship) {
        conn.setSourceDecoration(CompositionConnectionFigure.createFigureSourceDecoration());
    } else if (element instanceof IAggregationRelationship) {
        conn.setSourceDecoration(AggregationConnectionFigure.createFigureSourceDecoration());
    } else if (element instanceof IAssignmentRelationship) {
        conn.setSourceDecoration(AssignmentConnectionFigure.createFigureSourceDecoration());
        conn.setTargetDecoration(AssignmentConnectionFigure.createFigureTargetDecoration());
    } else if (element instanceof IRealizationRelationship) {
        conn.setTargetDecoration(RealizationConnectionFigure.createFigureTargetDecoration());
        connection.setLineStyle(SWT.LINE_CUSTOM);
        conn.setLineDash(new float[] { 2 });
    } else if (element instanceof ITriggeringRelationship) {
        conn.setTargetDecoration(TriggeringConnectionFigure.createFigureTargetDecoration());
    } else if (element instanceof IFlowRelationship) {
        conn.setTargetDecoration(FlowConnectionFigure.createFigureTargetDecoration());
        connection.setLineStyle(SWT.LINE_CUSTOM);
        conn.setLineDash(new float[] { 6, 3 });
    } else if (element instanceof IServingRelationship) {
        conn.setTargetDecoration(ServingConnectionFigure.createFigureTargetDecoration());
    } else if (element instanceof IAccessRelationship) {
        switch(((IAccessRelationship) element).getAccessType()) {
            case IAccessRelationship.WRITE_ACCESS:
            default:
                conn.setSourceDecoration(null);
                // arrow at target endpoint
                conn.setTargetDecoration(AccessConnectionFigure.createFigureTargetDecoration());
                break;
            case IAccessRelationship.READ_ACCESS:
                // arrow at source endpoint
                conn.setSourceDecoration(AccessConnectionFigure.createFigureTargetDecoration());
                conn.setTargetDecoration(null);
                break;
            case IAccessRelationship.UNSPECIFIED_ACCESS:
                // no arrows
                conn.setSourceDecoration(null);
                conn.setTargetDecoration(null);
                break;
            case IAccessRelationship.READ_WRITE_ACCESS:
                // both arrows
                conn.setSourceDecoration(AccessConnectionFigure.createFigureTargetDecoration());
                conn.setTargetDecoration(AccessConnectionFigure.createFigureTargetDecoration());
                break;
        }
        connection.setLineStyle(SWT.LINE_CUSTOM);
        conn.setLineDash(new float[] { 2 });
    } else if (element instanceof IInfluenceRelationship) {
        conn.setTargetDecoration(InfluenceConnectionFigure.createFigureTargetDecoration());
        connection.setLineStyle(SWT.LINE_CUSTOM);
        conn.setLineDash(new float[] { 6, 3 });
    }
    conn.setAntialias(SWT.ON);
}
Also used : IInfluenceRelationship(com.archimatetool.model.IInfluenceRelationship) ICompositionRelationship(com.archimatetool.model.ICompositionRelationship) IRealizationRelationship(com.archimatetool.model.IRealizationRelationship) ITriggeringRelationship(com.archimatetool.model.ITriggeringRelationship) ISpecializationRelationship(com.archimatetool.model.ISpecializationRelationship) IAssignmentRelationship(com.archimatetool.model.IAssignmentRelationship) IAggregationRelationship(com.archimatetool.model.IAggregationRelationship) IFlowRelationship(com.archimatetool.model.IFlowRelationship) IAccessRelationship(com.archimatetool.model.IAccessRelationship) IServingRelationship(com.archimatetool.model.IServingRelationship) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Aggregations

IAccessRelationship (com.archimatetool.model.IAccessRelationship)1 IAggregationRelationship (com.archimatetool.model.IAggregationRelationship)1 IAssignmentRelationship (com.archimatetool.model.IAssignmentRelationship)1 ICompositionRelationship (com.archimatetool.model.ICompositionRelationship)1 IFlowRelationship (com.archimatetool.model.IFlowRelationship)1 IInfluenceRelationship (com.archimatetool.model.IInfluenceRelationship)1 IRealizationRelationship (com.archimatetool.model.IRealizationRelationship)1 IServingRelationship (com.archimatetool.model.IServingRelationship)1 ISpecializationRelationship (com.archimatetool.model.ISpecializationRelationship)1 ITriggeringRelationship (com.archimatetool.model.ITriggeringRelationship)1 PolylineConnection (org.eclipse.draw2d.PolylineConnection)1