use of de.cau.cs.kieler.klighd.labels.decoration.LabelDecorationConfigurator in project lingua-franca by lf-lang.
the class LinguaFrancaStyleExtensions method applyOnEdgePysicalDelayStyle.
public void applyOnEdgePysicalDelayStyle(KLabel label, Colors parentBackgroundColor) {
if (_onEdgePysicalDelayLabelConfigurator == 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 = 8;
padding.right = 16;
padding.bottom = Math.max(padding.bottom, 1);
KPolygon polygon = _kRenderingFactory.createKPolygon();
_kRenderingExtensions.from(polygon, LEFT, 0, 0, BOTTOM, 0, 0.5f);
_kRenderingExtensions.to(polygon, LEFT, 0, 0, TOP, 1, 0.5f);
_kRenderingExtensions.to(polygon, RIGHT, 0, 0, TOP, 1, 0.5f);
_kRenderingExtensions.to(polygon, RIGHT, 0, 0, BOTTOM, 0, 0.5f);
_kRenderingExtensions.setBackground(polygon, label.getProperty(LABEL_PARENT_BACKGROUND));
_kRenderingExtensions.setForeground(polygon, label.getProperty(LABEL_PARENT_BACKGROUND));
container.getChildren().add(polygon);
KSpline kSpline = _kRenderingFactory.createKSpline();
_kRenderingExtensions.from(kSpline, LEFT, -0.66f, 0, BOTTOM, -0.5f, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 1, 0, BOTTOM, -0.5f, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 3, 0, BOTTOM, 8, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 5, 0, BOTTOM, 0, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 5.5f, 0, BOTTOM, -1.5f, 0.5f);
container.getChildren().add(kSpline);
kSpline = _kRenderingFactory.createKSpline();
_kRenderingExtensions.from(kSpline, RIGHT, 15f, 0, BOTTOM, 3.5f, 0.5f);
_kRenderingExtensions.to(kSpline, RIGHT, 14f, 0, BOTTOM, 0, 0.5f);
_kRenderingExtensions.to(kSpline, RIGHT, 11, 0, BOTTOM, -8, 0.5f);
_kRenderingExtensions.to(kSpline, RIGHT, 9, 0, BOTTOM, 0, 0.5f);
_kRenderingExtensions.to(kSpline, RIGHT, 7, 0, BOTTOM, 8, 0.5f);
_kRenderingExtensions.to(kSpline, RIGHT, 4f, 0, BOTTOM, 2, 0.5f);
_kRenderingExtensions.to(kSpline, RIGHT, 1.5f, 0, BOTTOM, 0.5f, 0.5f);
_kRenderingExtensions.to(kSpline, RIGHT, 0.2f, 0, BOTTOM, -0.5f, 0.5f);
_kRenderingExtensions.to(kSpline, RIGHT, -0.7f, 0, BOTTOM, -0.5f, 0.5f);
container.getChildren().add(kSpline);
polygon = _kRenderingFactory.createKPolygon();
_kRenderingExtensions.from(polygon, LEFT, 4, 0, BOTTOM, 0, 0);
_kRenderingExtensions.to(polygon, LEFT, 8, 0, TOP, 0, 0);
_kRenderingExtensions.to(polygon, RIGHT, 12, 0, TOP, 0, 0);
_kRenderingExtensions.to(polygon, RIGHT, 16, 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, 4, 0, BOTTOM, 0, 0);
_kRenderingExtensions.to(polyline, LEFT, 8, 0, TOP, 0, 0);
container.getChildren().add(polyline);
polyline = _kRenderingFactory.createKPolyline();
_kRenderingExtensions.from(polyline, RIGHT, 16, 0, BOTTOM, 0, 0);
_kRenderingExtensions.to(polyline, RIGHT, 12, 0, TOP, 0, 0);
container.getChildren().add(polyline);
return padding;
}
});
_onEdgePysicalDelayLabelConfigurator = configurator;
}
label.setProperty(LABEL_PARENT_BACKGROUND, parentBackgroundColor);
_onEdgePysicalDelayLabelConfigurator.applyTo(label);
}
use of de.cau.cs.kieler.klighd.labels.decoration.LabelDecorationConfigurator in project lingua-franca by lf-lang.
the class LinguaFrancaStyleExtensions method applyOnEdgePysicalStyle.
public void applyOnEdgePysicalStyle(KLabel label, Colors parentBackgroundColor) {
if (_onEdgePysicalLabelConfigurator == null) {
LabelDecorationConfigurator configurator = LabelDecorationConfigurator.create().withInlineLabels(true);
configurator = configurator.withLabelTextRenderingProvider((KContainerRendering container, KLabel klabel) -> {
KText kText = _kRenderingFactory.createKText();
_kRenderingExtensions.setInvisible(kText, true);
container.getChildren().add(kText);
return kText;
});
configurator = configurator.addDecoratorRenderingProvider(new IDecoratorRenderingProvider() {
@Override
public ElkPadding createDecoratorRendering(final KContainerRendering container, final KLabel label, final LabelDecorationConfigurator.LayoutMode layoutMode) {
ElkPadding padding = new ElkPadding();
padding.left = 3;
padding.right = 3;
padding.bottom = Math.max(padding.bottom, 1);
KPolygon polygon = _kRenderingFactory.createKPolygon();
_kRenderingExtensions.from(polygon, LEFT, 0, 0, BOTTOM, 0, 0.5f);
_kRenderingExtensions.to(polygon, LEFT, 0, 0, TOP, 1, 0.5f);
_kRenderingExtensions.to(polygon, RIGHT, 0, 0, TOP, 1, 0.5f);
_kRenderingExtensions.to(polygon, RIGHT, 0, 0, BOTTOM, 0, 0.5f);
_kRenderingExtensions.setBackground(polygon, label.getProperty(LABEL_PARENT_BACKGROUND));
_kRenderingExtensions.setForeground(polygon, label.getProperty(LABEL_PARENT_BACKGROUND));
container.getChildren().add(polygon);
KSpline kSpline = _kRenderingFactory.createKSpline();
_kRenderingExtensions.from(kSpline, LEFT, (-0.66f), 0, BOTTOM, (-0.5f), 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 1, 0, BOTTOM, (-0.5f), 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.1f, BOTTOM, 8, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.2f, BOTTOM, 0, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.3f, BOTTOM, (-8), 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.4f, BOTTOM, 0, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.45f, BOTTOM, 4f, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.5f, BOTTOM, 8, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.55f, BOTTOM, 4f, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.6f, BOTTOM, 0, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.65f, BOTTOM, (-4), 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.7f, BOTTOM, (-8), 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.8f, BOTTOM, (-4), 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0, 0.9f, BOTTOM, 0, 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, (-1), 1, BOTTOM, (-0.5f), 0.5f);
_kRenderingExtensions.to(kSpline, LEFT, 0.66f, 1, BOTTOM, (-0.5f), 0.5f);
container.getChildren().add(kSpline);
return padding;
}
});
_onEdgePysicalLabelConfigurator = configurator;
}
label.setProperty(LABEL_PARENT_BACKGROUND, parentBackgroundColor);
_onEdgePysicalLabelConfigurator.applyTo(label);
}
use of de.cau.cs.kieler.klighd.labels.decoration.LabelDecorationConfigurator 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.labels.decoration.LabelDecorationConfigurator 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);
}
Aggregations