use of de.cau.cs.kieler.klighd.krendering.KContainerRendering in project lingua-franca by lf-lang.
the class LinguaFrancaStyleExtensions method applyOnEdgeDelayStyle.
public void applyOnEdgeDelayStyle(KLabel label) {
if (_onEdgeDelayLabelConfigurator == null) {
LabelDecorationConfigurator configurator = LabelDecorationConfigurator.create().withInlineLabels(true);
configurator = configurator.withLabelTextRenderingProvider((KContainerRendering container, KLabel klabel) -> {
KText kText = _kRenderingFactory.createKText();
_kRenderingExtensions.setFontSize(kText, 8);
boldTextSelectionStyle(kText);
kText.setProperty(KlighdInternalProperties.MODEL_ELEMEMT, klabel.getProperty(KlighdInternalProperties.MODEL_ELEMEMT));
container.getChildren().add(kText);
return kText;
});
configurator = configurator.addDecoratorRenderingProvider(new IDecoratorRenderingProvider() {
@Override
public ElkPadding createDecoratorRendering(KContainerRendering container, KLabel label, LabelDecorationConfigurator.LayoutMode layoutMode) {
ElkPadding padding = new ElkPadding();
padding.left = 2;
padding.right = 2;
padding.bottom = Math.max(padding.bottom, 1);
KPolygon polygon = _kRenderingFactory.createKPolygon();
_kRenderingExtensions.from(polygon, LEFT, (-2), 0, BOTTOM, 0, 0);
_kRenderingExtensions.to(polygon, LEFT, 2, 0, TOP, 0, 0);
_kRenderingExtensions.to(polygon, RIGHT, (-2), 0, TOP, 0, 0);
_kRenderingExtensions.to(polygon, RIGHT, 2, 0, BOTTOM, 0, 0);
_kRenderingExtensions.setBackground(polygon, Colors.WHITE);
_kRenderingExtensions.setForeground(polygon, Colors.WHITE);
container.getChildren().add(polygon);
KPolyline polyline = _kRenderingFactory.createKPolyline();
_kRenderingExtensions.from(polyline, LEFT, (-2), 0, BOTTOM, 0, 0);
_kRenderingExtensions.to(polyline, LEFT, 2, 0, TOP, 0, 0);
container.getChildren().add(polyline);
polyline = _kRenderingFactory.createKPolyline();
_kRenderingExtensions.from(polyline, RIGHT, 2, 0, BOTTOM, 0, 0);
_kRenderingExtensions.to(polyline, RIGHT, (-2), 0, TOP, 0, 0);
container.getChildren().add(polyline);
return padding;
}
});
_onEdgeDelayLabelConfigurator = configurator;
}
_onEdgeDelayLabelConfigurator.applyTo(label);
}
use of de.cau.cs.kieler.klighd.krendering.KContainerRendering in project lingua-franca by lf-lang.
the class LinguaFrancaStyleExtensions method applyOnEdgeStyle.
public void applyOnEdgeStyle(KLabel label) {
if (_onEdgeLabelConfigurator == null) {
LabelDecorationConfigurator configurator = LabelDecorationConfigurator.create().withInlineLabels(true);
_onEdgeLabelConfigurator = configurator.withLabelTextRenderingProvider((KContainerRendering container, KLabel klabel) -> {
KText kText = _kRenderingFactory.createKText();
_kRenderingExtensions.setFontSize(kText, 9);
container.getChildren().add(kText);
return kText;
});
}
_onEdgeLabelConfigurator.applyTo(label);
}
use of de.cau.cs.kieler.klighd.krendering.KContainerRendering in project lingua-franca by lf-lang.
the class LinguaFrancaStyleExtensions method addCloudUploadIcon.
public KRendering addCloudUploadIcon(KContainerRendering parent) {
KContainerRendering cloudIcon = addCloudIcon(parent);
KPolygon cloudPolygon = _kContainerRenderingExtensions.addPolygon(cloudIcon);
_kRenderingExtensions.setBackground(cloudPolygon, Colors.WHITE);
_kRenderingExtensions.setForeground(cloudPolygon, Colors.WHITE);
cloudPolygon.getPoints().addAll(List.of(_kRenderingExtensions.createKPosition(LEFT, -1.5f, 0.5f, TOP, CLOUD_WIDTH / 3, 0.5f), _kRenderingExtensions.createKPosition(LEFT, -1.5f, 0.5f, TOP, 0, 0.58f), _kRenderingExtensions.createKPosition(LEFT, (-4), 0.5f, TOP, 0, 0.58f), _kRenderingExtensions.createKPosition(LEFT, 0, 0.5f, TOP, 0, 0.35f), _kRenderingExtensions.createKPosition(LEFT, 4, 0.5f, TOP, 0, 0.58f), _kRenderingExtensions.createKPosition(LEFT, 1.5f, 0.5f, TOP, 0, 0.58f), _kRenderingExtensions.createKPosition(LEFT, 1.5f, 0.5f, TOP, CLOUD_WIDTH / 3, 0.5f)));
return cloudIcon;
}
Aggregations