Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 09:06 Go to next message
Cédric Casenove is currently offline Cédric CasenoveFriend
Messages: 15
Registered: December 2013
Junior Member
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 16:07 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 618
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

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 10:25 Go to previous messageGo to next message
Cédric Casenove is currently offline Cédric CasenoveFriend
Messages: 15
Registered: December 2013
Junior Member
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 12:03 Go to previous messageGo to next message
Cédric Casenove is currently offline Cédric CasenoveFriend
Messages: 15
Registered: December 2013
Junior Member
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 14:21 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 618
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

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 08:35 Go to previous message
Cédric Casenove is currently offline Cédric CasenoveFriend
Messages: 15
Registered: December 2013
Junior Member
Hi Bob,

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

Thank you !
Previous Topic:Default profile
Next Topic:Customize a Start Event Message
Goto Forum:
  


Current Time: Thu Nov 27 09:55:13 GMT 2014

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

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