Search in sources :

Example 1 with ExpressionContainerGrid

use of org.kie.workbench.common.dmn.client.editors.expressions.ExpressionContainerGrid in project kie-wb-common by kiegroup.

the class DMNDocumentationDRDsFactory method setExpressionContainerGrid.

void setExpressionContainerGrid(final Diagram diagram, final String uuid) {
    final Node<View, Edge> node = getNode(diagram, uuid);
    final Object definition = DefinitionUtils.getElementDefinition(node);
    final HasExpression hasExpression = expressionHelper.getHasExpression(node);
    final Optional<HasName> hasName = Optional.of((HasName) definition);
    final ExpressionContainerGrid grid = getExpressionContainerGrid();
    grid.setExpression(node.getUUID(), hasExpression, hasName, false);
    clearSelections(grid);
}
Also used : HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) HasName(org.kie.workbench.common.dmn.api.definition.HasName) ExpressionContainerGrid(org.kie.workbench.common.dmn.client.editors.expressions.ExpressionContainerGrid) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ExpressionEditorView(org.kie.workbench.common.dmn.client.editors.expressions.ExpressionEditorView) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Example 2 with ExpressionContainerGrid

use of org.kie.workbench.common.dmn.client.editors.expressions.ExpressionContainerGrid in project kie-wb-common by kiegroup.

the class DMNDocumentationDRDsFactory method getNodeImage.

String getNodeImage(final Diagram diagram, final Node<View, Edge> node) {
    if (!hasExpression(node)) {
        return NONE;
    }
    setExpressionContainerGrid(diagram, node.getUUID());
    final ExpressionContainerGrid grid = getExpressionContainerGrid();
    final Viewport viewport = grid.getViewport();
    final int padding = 10;
    final int wide = (int) (grid.getWidth() + padding);
    final int high = (int) (grid.getHeight() + padding);
    viewport.setPixelSize(wide, high);
    return viewport.toDataURL(DataURLType.PNG);
}
Also used : Viewport(com.ait.lienzo.client.core.shape.Viewport) ExpressionContainerGrid(org.kie.workbench.common.dmn.client.editors.expressions.ExpressionContainerGrid)

Aggregations

ExpressionContainerGrid (org.kie.workbench.common.dmn.client.editors.expressions.ExpressionContainerGrid)2 Viewport (com.ait.lienzo.client.core.shape.Viewport)1 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)1 HasName (org.kie.workbench.common.dmn.api.definition.HasName)1 ExpressionEditorView (org.kie.workbench.common.dmn.client.editors.expressions.ExpressionEditorView)1 Edge (org.kie.workbench.common.stunner.core.graph.Edge)1 View (org.kie.workbench.common.stunner.core.graph.content.view.View)1