Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » Reloading the bpmn2 diagram(Is it possible?)
Reloading the bpmn2 diagram [message #1087285] Thu, 15 August 2013 12:11 Go to next message
Marco Roque is currently offline Marco RoqueFriend
Messages: 16
Registered: July 2012
Junior Member
Hi,


Has i mentioned before i'm manipulating the bpmn2 elements colors and other visual elements and i would like to clean it all up when i stop the animation.
Just like if i was opening the bpmn2 file in a diagram at the moment i stop.

Can i do this by code?

Or instead, do i have to call another customFeature that applies the bpmn2 visual preferences to the diagram elements?

Thank you,
Regards
Marco Roque

Re: Reloading the bpmn2 diagram [message #1087422 is a reply to message #1087285] Thu, 15 August 2013 16:07 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Marco,

You could use something like the following to reset the default colors and styles for all PictogramElements:

		TreeIterator<EObject> iter = getDiagram().eAllContents();
		while (iter.hasNext()) {
			EObject o = iter.next();
			if (o instanceof PictogramElement) {
				PictogramElement pe = (PictogramElement) o;
				GraphicsAlgorithm ga = pe.getGraphicsAlgorithm();
				EObject bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
				if (ga!=null && bo instanceof BaseElement)
					StyleUtil.applyStyle(ga, (BaseElement)bo);
			}
		}


HTH,
Bob
Re: Reloading the bpmn2 diagram [message #1087596 is a reply to message #1087285] Thu, 15 August 2013 22:06 Go to previous messageGo to next message
Marco Roque is currently offline Marco RoqueFriend
Messages: 16
Registered: July 2012
Junior Member
Hi Bob,

Thank you very much. The code really does what i wanted. I just tweaked it a little bit so the gateways and events don't get a rectangle background.
So the final result was this:

TreeIterator<EObject> iter = editor.getDiagramTypeProvider().getDiagram().eAllContents();
					while (iter.hasNext()) {
						EObject o = iter.next();
						if (o instanceof PictogramElement) {
							PictogramElement pe = (PictogramElement) o;
							EObject bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
							GraphicsAlgorithm ga = null;
							
							//Code for getting the graphicAlgorithms
							if(bo instanceof BaseElement && bo instanceof Gateway){
								ga = PictogramUtils.getPolygonFromPictogram(pe);
							}else if(bo instanceof BaseElement && bo instanceof Event){
								ga = PictogramUtils.getEllipseFromPictogram(pe);
							}else {
								ga = pe.getGraphicsAlgorithm();
							}
						
							if (ga!=null && bo instanceof BaseElement)
								StyleUtil.applyStyle(ga, (BaseElement)bo);
							
						}
					}

Regards,
Marco Roque
Re: Reloading the bpmn2 diagram [message #1090787 is a reply to message #1087596] Tue, 20 August 2013 16:43 Go to previous message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Cool, glad I could help Smile

I'd be REALLY interested in seeing what you're working on, as process debugging and tracing is on my list of advanced features after a 1.0 release (coming soon, I hope!) Is this something you could share with the open source community or is it proprietary?

Thanks,
Bob
Previous Topic:SequenceFlow appears on top of the other PictogramElements
Next Topic:how to enable customTasks in collaboration palette?
Goto Forum:
  


Current Time: Thu Apr 25 09:18:25 GMT 2024

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

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

Back to the top