use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.di.JSIDiagramElement in project kie-wb-common by kiegroup.
the class NodeEntriesFactory method getEdges.
private List<JSIDMNEdge> getEdges(final JSIDMNDiagram dmnDiagram) {
final List<JSIDMNEdge> edges = new ArrayList<>();
final List<JSIDiagramElement> dmnDiagramElements = dmnDiagram.getDMNDiagramElement();
forEach(dmnDiagramElements, dmnDiagramElement -> {
if (JSIDMNEdge.instanceOf(dmnDiagramElement)) {
final JSIDMNEdge jsiEdge = Js.uncheckedCast(dmnDiagramElement);
edges.add(jsiEdge);
}
});
return edges;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.di.JSIDiagramElement in project kie-wb-common by kiegroup.
the class NodeEntriesFactory method getShapesByDiagramId.
private Map<JSIDMNShape, String> getShapesByDiagramId(final JSITDefinitions definitions) {
final Map<JSIDMNShape, String> dmnShapesByDiagramId = new HashMap<>();
final List<JSIDMNDiagram> diagrams = definitions.getDMNDI().getDMNDiagram();
forEach(diagrams, diagram -> {
final String diagramId = diagram.getId();
final List<JSIDiagramElement> diagramElements = diagram.getDMNDiagramElement();
forEach(diagramElements, diagramElement -> {
if (JSIDMNShape.instanceOf(diagramElement)) {
final JSIDMNShape shape = Js.uncheckedCast(diagramElement);
dmnShapesByDiagramId.put(shape, diagramId);
}
});
});
return dmnShapesByDiagramId;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.di.JSIDiagramElement in project kie-wb-common by kiegroup.
the class DMNDiagramElementsUtils method generateDRGElement.
private JSIDMNDiagram generateDRGElement(final JSITDefinitions dmnDefinitions) {
final JSIDMNDiagram drg = DRGDiagramUtils.newJSIDRGInstance();
final double[] globalOriginX = { 0 };
forEach(getDmnDiagram(dmnDefinitions), dmnDiagram -> {
final List<JSIDiagramElement> elements = dmnDiagram.getDMNDiagramElement();
final double[] diagramOriginX = { globalOriginX[0] };
forEach(elements, element -> {
final JSIDiagramElement copy = Js.uncheckedCast(jsCopy(element));
if (JSIDMNShape.instanceOf(copy)) {
final JSIDMNShape shape = Js.uncheckedCast(copy);
final JSIBounds bounds = shape.getBounds();
final double currentMax = bounds.getX() + bounds.getWidth();
shape.setId(uniqueId());
bounds.setX(diagramOriginX[0] + bounds.getX());
if (currentMax > globalOriginX[0]) {
globalOriginX[0] = currentMax;
}
}
if (JSIDMNEdge.instanceOf(copy)) {
final JSIDMNEdge shape = Js.uncheckedCast(copy);
shape.setId(uniqueId());
shape.setOtherAttributes(null);
forEach(shape.getWaypoint(), jsiPoint -> jsiPoint.setX(diagramOriginX[0] + jsiPoint.getX()));
}
drg.addDMNDiagramElement(Js.uncheckedCast(JsUtils.getWrappedElement(copy)));
});
});
return drg;
}
Aggregations