use of org.osate.ge.graphics.StyleBuilder in project osate2 by osate.
the class FlowSpecificationHandler method getGraphicalConfiguration.
@Override
public Optional<GraphicalConfiguration> getGraphicalConfiguration(final GetGraphicalConfigurationContext ctx) {
final BusinessObjectContext boc = ctx.getBusinessObjectContext();
final FlowSpecification fs = boc.getBusinessObject(FlowSpecification.class).orElseThrow();
final QueryService queryService = ctx.getQueryService();
final QueryResult srcResult = queryService.getFirstResult(SRC_QUERY, boc, fs).orElse(null);
final BusinessObjectContext src = srcResult == null ? null : srcResult.getBusinessObjectContext();
boolean partial = (srcResult != null && srcResult.isPartial());
BusinessObjectContext dst = null;
if (fs.getKind() == FlowKind.PATH) {
final QueryResult dstResult = queryService.getFirstResult(DST_QUERY, boc, fs).orElse(null);
dst = dstResult == null ? null : dstResult.getBusinessObjectContext();
partial |= (dstResult != null && dstResult.isPartial());
}
final StyleBuilder sb = StyleBuilder.create(AadlInheritanceUtil.isInherited(boc) ? Styles.INHERITED_ELEMENT : Style.EMPTY);
if (fs.getKind() == FlowKind.PATH) {
sb.lineWidth(4.0);
}
if (partial) {
sb.dotted();
}
return Optional.of(GraphicalConfigurationBuilder.create().graphic(AadlGraphics.getFlowSpecificationGraphic(fs)).style(sb.build()).source(src).destination(dst).build());
}
Aggregations