use of org.kie.workbench.common.dmn.api.property.background.BackgroundSet in project kie-wb-common by kiegroup.
the class DecisionConverter method nodeFromDMN.
@Override
public Node<View<Decision>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.Decision dmn) {
@SuppressWarnings("unchecked") Node<View<Decision>, ?> node = (Node<View<Decision>, ?>) factoryManager.newElement(dmn.getId(), Decision.class).asNode();
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
Name name = new Name(dmn.getName());
InformationItem informationItem = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
Decision decision = new Decision(id, description, name, new Question(), new AllowedAnswers(), informationItem, expression, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
node.getContent().setDefinition(decision);
return node;
}
use of org.kie.workbench.common.dmn.api.property.background.BackgroundSet in project kie-wb-common by kiegroup.
the class InputDataConverter method nodeFromDMN.
@Override
public Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.InputData dmn) {
@SuppressWarnings("unchecked") Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(dmn.getId(), InputData.class).asNode();
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
Name name = new Name(dmn.getName());
InformationItem informationItem = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
InputData inputData = new InputData(id, description, name, informationItem, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
node.getContent().setDefinition(inputData);
return node;
}
use of org.kie.workbench.common.dmn.api.property.background.BackgroundSet in project kie-wb-common by kiegroup.
the class KnowledgeSourceConverter method nodeFromDMN.
@Override
public Node<View<KnowledgeSource>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.KnowledgeSource dmn) {
@SuppressWarnings("unchecked") Node<View<KnowledgeSource>, ?> node = (Node<View<KnowledgeSource>, ?>) factoryManager.newElement(dmn.getId(), KnowledgeSource.class).asNode();
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
Name name = new Name(dmn.getName());
KnowledgeSourceType ksType = new KnowledgeSourceType(dmn.getType());
LocationURI locationURI = new LocationURI(dmn.getLocationURI());
KnowledgeSource ks = new KnowledgeSource(id, description, name, ksType, locationURI, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
node.getContent().setDefinition(ks);
return node;
}
use of org.kie.workbench.common.dmn.api.property.background.BackgroundSet in project kie-wb-common by kiegroup.
the class TextAnnotationConverter method nodeFromDMN.
@Override
public Node<View<TextAnnotation>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.TextAnnotation dmn) {
@SuppressWarnings("unchecked") Node<View<TextAnnotation>, ?> node = (Node<View<TextAnnotation>, ?>) factoryManager.newElement(dmn.getId(), TextAnnotation.class).asNode();
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
Text text = new Text(dmn.getText());
TextFormat textFormat = new TextFormat(dmn.getTextFormat());
TextAnnotation textAnnotation = new TextAnnotation(id, description, text, textFormat, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
node.getContent().setDefinition(textAnnotation);
return node;
}
use of org.kie.workbench.common.dmn.api.property.background.BackgroundSet in project kie-wb-common by kiegroup.
the class DMNMarshaller method internalAugment.
private void internalAugment(Stream<DMNShape> drgShapeStream, Id id, Bound ul, RectangleDimensionsSet dimensionsSet, Bound lr, BackgroundSet bgset, Consumer<FontSet> fontSetSetter) {
Optional<DMNShape> drgShapeOpt = drgShapeStream.filter(shape -> shape.getDmnElementRef().equals(id.getValue())).findFirst();
if (!drgShapeOpt.isPresent()) {
return;
}
DMNShape drgShape = drgShapeOpt.get();
((BoundImpl) ul).setX(drgShape.getBounds().getX());
((BoundImpl) ul).setY(drgShape.getBounds().getY());
dimensionsSet.setWidth(new Width(drgShape.getBounds().getWidth()));
dimensionsSet.setHeight(new Height(drgShape.getBounds().getHeight()));
((BoundImpl) lr).setX(drgShape.getBounds().getX() + drgShape.getBounds().getWidth());
((BoundImpl) lr).setY(drgShape.getBounds().getY() + drgShape.getBounds().getHeight());
if (null != drgShape.getBgColor()) {
bgset.setBgColour(new BgColour(ColorUtils.wbFromDMN(drgShape.getBgColor())));
}
if (null != drgShape.getBorderColor()) {
bgset.setBorderColour(new BorderColour(ColorUtils.wbFromDMN(drgShape.getBorderColor())));
}
if (null != drgShape.getBorderSize()) {
bgset.setBorderSize(new BorderSize(drgShape.getBorderSize().getValue()));
}
if (null != drgShape.getFontStyle()) {
fontSetSetter.accept(FontSetPropertyConverter.wbFromDMN(drgShape.getFontStyle()));
}
}
Aggregations