Search in sources :

Example 1 with StartNoneEvent

use of org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent in project kie-wb-common by kiegroup.

the class StartEventConverter method noneEvent.

private BpmnNode noneEvent(StartEvent event) {
    Node<View<StartNoneEvent>, Edge> node = factoryManager.newNode(event.getId(), StartNoneEvent.class);
    StartNoneEvent definition = node.getContent().getDefinition();
    EventPropertyReader p = propertyReaderFactory.of(event);
    definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    definition.setSimulationSet(p.getSimulationSet());
    definition.setIsInterrupting(new IsInterrupting(event.isIsInterrupting()));
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getCircleDimensionSet());
    definition.setFontSet(p.getFontSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    return BpmnNode.of(node);
}
Also used : Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) IsInterrupting(org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) EventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader) CatchEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)

Example 2 with StartNoneEvent

use of org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent in project kie-wb-common by kiegroup.

the class StartNoneEventTest method testStartNoneEventNameEmpty.

@Test
public void testStartNoneEventNameEmpty() {
    StartNoneEvent startNoneEvent = new StartNoneEvent.StartNoneEventBuilder().build();
    startNoneEvent.getGeneral().setName(new Name(""));
    Set<ConstraintViolation<StartNoneEvent>> violations = this.validator.validate(startNoneEvent);
    assertTrue(violations.isEmpty());
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) Test(org.junit.Test)

Example 3 with StartNoneEvent

use of org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent in project kie-wb-common by kiegroup.

the class StartEventConverter method noneEvent.

private PropertyWriter noneEvent(Node<View<StartNoneEvent>, ?> n) {
    StartEvent event = bpmn2.createStartEvent();
    event.setId(n.getUUID());
    StartNoneEvent definition = n.getContent().getDefinition();
    CatchEventPropertyWriter p = propertyWriterFactory.of(event);
    event.setIsInterrupting(false);
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    p.setSimulationSet(definition.getSimulationSet());
    p.setBounds(n.getContent().getBounds());
    return p;
}
Also used : CatchEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter) StartEvent(org.eclipse.bpmn2.StartEvent) BaseStartEvent(org.kie.workbench.common.stunner.bpmn.definition.BaseStartEvent) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent)

Example 4 with StartNoneEvent

use of org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent in project kie-wb-common by kiegroup.

the class BPMNViewHandlersTest method testFontHandler.

@Test
@SuppressWarnings("unchecked")
public void testFontHandler() {
    final FontHandler<BPMNViewDefinition, ShapeView> fontHandler = new BPMNShapeViewHandlers.FontHandlerBuilder<>().build();
    final StartNoneEvent bean = new StartNoneEvent.StartNoneEventBuilder().build();
    bean.getFontSet().getFontColor().setValue("fontColor");
    bean.getFontSet().getFontFamily().setValue("fontFamily");
    bean.getFontSet().getFontSize().setValue(12d);
    bean.getFontSet().getFontBorderColor().setValue("borderColor");
    bean.getFontSet().getFontBorderSize().setValue(8d);
    fontHandler.handle(bean, view);
    verify(view, times(1)).setTitleFontColor(eq("fontColor"));
    verify(view, times(1)).setTitleFontFamily(eq("fontFamily"));
    verify(view, times(1)).setTitleFontSize(eq(12d));
    verify(view, times(1)).setTitleStrokeColor(eq("borderColor"));
    verify(view, times(1)).setTitleStrokeWidth(eq(8d));
}
Also used : ShapeView(org.kie.workbench.common.stunner.core.client.shape.view.ShapeView) BPMNViewDefinition(org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent) Test(org.junit.Test)

Example 5 with StartNoneEvent

use of org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent in project kie-wb-common by kiegroup.

the class BPMNViewHandlersTest method testViewHandler.

@Test
@SuppressWarnings("unchecked")
public void testViewHandler() {
    final ViewAttributesHandler<BPMNViewDefinition, ShapeView> fontHandler = new BPMNShapeViewHandlers.ViewAttributesHandlerBuilder<>().build();
    final StartNoneEvent bean = new StartNoneEvent.StartNoneEventBuilder().build();
    bean.getBackgroundSet().getBgColor().setValue("bgColor");
    bean.getBackgroundSet().getBorderColor().setValue("borderColor");
    bean.getBackgroundSet().getBorderSize().setValue(5d);
    fontHandler.handle(bean, view);
    verify(view, times(1)).setFillGradient(any(HasFillGradient.Type.class), eq("bgColor"), anyString());
    verify(view, times(1)).setStrokeColor(eq("borderColor"));
    verify(view, times(1)).setStrokeWidth(eq(5d));
}
Also used : ShapeView(org.kie.workbench.common.stunner.core.client.shape.view.ShapeView) BPMNViewDefinition(org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent) Test(org.junit.Test)

Aggregations

StartNoneEvent (org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent)13 Test (org.junit.Test)11 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)6 Graph (org.kie.workbench.common.stunner.core.graph.Graph)6 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)3 ConstraintViolation (javax.validation.ConstraintViolation)2 BPMNViewDefinition (org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition)2 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)2 ShapeView (org.kie.workbench.common.stunner.core.client.shape.view.ShapeView)2 StartEvent (org.eclipse.bpmn2.StartEvent)1 CatchEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter)1 CatchEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader)1 EventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader)1 BaseStartEvent (org.kie.workbench.common.stunner.bpmn.definition.BaseStartEvent)1 BusinessRuleTask (org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask)1 EndNoneEvent (org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent)1 NoneTask (org.kie.workbench.common.stunner.bpmn.definition.NoneTask)1 ParallelGateway (org.kie.workbench.common.stunner.bpmn.definition.ParallelGateway)1 ScriptTask (org.kie.workbench.common.stunner.bpmn.definition.ScriptTask)1 UserTask (org.kie.workbench.common.stunner.bpmn.definition.UserTask)1