Skip to main content



      Home
Home » Eclipse Projects » BPMN 2.0 Modeler » Creating a custom task with multiple visible elements
Creating a custom task with multiple visible elements [message #1259332] Fri, 28 February 2014 04:06 Go to next message
Eclipse UserFriend
Hi,

I use a custom task to define a "Message Start Event", that should create a Start Event with a Message Event Definition. I found that this is done in the jBpm modeler by just defining a tool with a type like "StartEvent+MessageEventDefinition", but I want more control on the created object so I prefered to use a custom task.

I override the createBusinessObject method in my Create Feature (which extends AbstractCreateEventFeature<StartEvent>)to create the Message Event Definition attached to the Start Event:

@Override
public StartEvent createBusinessObject(ICreateContext context)
{
    StartEvent startEvent = super.createBusinessObject(context);
            
    // create the message event definition
    Shape shape = context.getTargetContainer();
    EObject container = BusinessObjectUtil.getBusinessObjectForPictogramElement(shape);
    Resource resource = container.eResource();
    EClass eclass = Bpmn2Package.eINSTANCE.getMessageEventDefinition();
    MessageEventDefinition messageEventDefinition = (MessageEventDefinition) Bpmn2ModelerFactory.create(resource, eclass);
            
    startEvent.getEventDefinitions().add(messageEventDefinition);
            
    return startEvent;
}


The problem is that whan I create a new Message Start Event in my diagram, I only see the Start Event circle, but not the message envelope. However, if I close the editor and re-open it, my Message Start Event is drawn correctly with the envelope inside the event.

Is there a way to refresh the start event after creating it ?

Thanks
Re: Creating a custom task with multiple visible elements [message #1260543 is a reply to message #1259332] Sat, 01 March 2014 11:07 Go to previous messageGo to next message
Eclipse UserFriend
This sounds familiar. Can you have a look at this bug report and let me know if this is caused by the same issue you're seeing?

Please try the latest 1.0.2 version of the editor, because this has already been fixed.

Thanks,
Bob
Re: Creating a custom task with multiple visible elements [message #1264572 is a reply to message #1259332] Wed, 05 March 2014 05:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi Bob,

I updated to version 1.0.2 but my problem is still there. The copy/paste functionality works well now as described in the bug report.

When I create my start message event programmatically, I only see the start event circle, but if I copy/paste my object, the copied object is shown with a message as expected.
Re: Creating a custom task with multiple visible elements [message #1265676 is a reply to message #1259332] Thu, 06 March 2014 07:03 Go to previous messageGo to next message
Eclipse UserFriend
Hi Bob,

I modified some code in my add feature, and it works better. The decorateShape method was like that (I copied that from the AddStartEventFeature class):

protected void decorateShape(IAddContext context, ContainerShape containerShape, StartEvent businessObject) {
			Graphiti.getPeService().setPropertyValue(containerShape, INTERRUPTING, Boolean.toString(true));
			IPeService peService = Graphiti.getPeService();
			peService.setPropertyValue(containerShape,
					"marker.start.event",
					AbstractUpdateEventFeature.getEventDefinitionsValue((StartEvent)businessObject));
		}


I changed the implementation to:

protected void decorateShape(IAddContext context, ContainerShape containerShape, StartEvent businessObject)
        {
            IPeService peService = Graphiti.getPeService();
            
            peService.setPropertyValue(containerShape, "interrupting", Boolean.toString(true));
            // Set a dummy value for the start event property to force an update
            // of the graphical element, so that event definitions are visible at creation time
            peService.setPropertyValue(containerShape, "marker.start.event", "dirty");
        }


Re: Creating a custom task with multiple visible elements [message #1265766 is a reply to message #1265676] Thu, 06 March 2014 09:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi Cédric,

I've looked into this some more and discovered two bugs here - congratulations on finding them Smile
Here are the bugzillas to track them:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=429699
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429774

I'll go ahead and apply the fixes in both version 1.0.2 and the upcoming 1.1.0 - these new builds will be available tonight on the update sites.

Thanks!
Bob
Re: Creating a custom task with multiple visible elements [message #1268242 is a reply to message #1259332] Mon, 10 March 2014 04:35 Go to previous message
Eclipse UserFriend
Hi Bob,

I tested the new 1.0.2 release and I confirm the two bugs are solved.

Thank you !
Previous Topic:Infinite loop when creating a custom task
Next Topic:Default profile
Goto Forum:
  


Current Time: Wed Jul 23 17:59:47 EDT 2025

Powered by FUDForum. Page generated in 0.03618 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top