Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » change color with code
change color with code [message #1733087] Tue, 24 May 2016 10:07 Go to next message
Simone Maria Clementi is currently offline Simone Maria ClementiFriend
Messages: 1
Registered: May 2016
Junior Member
hi, can I change color of the elements (events, gateway, eccc) using code?
thanks
Re: change color with code [message #1733331 is a reply to message #1733087] Thu, 26 May 2016 14:00 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

Yes, please have a look at the org.eclipse.bpmn2.modeler.examples.dynamic sample project, specifically the SampleCustomTaskFeatureContainer's getAddFeature() method. This describes how to change the shape of a BPMN2 element as well as adding icons and changing the gradient color.

HTH,
Bob
Re: change color with code [message #1733471 is a reply to message #1733087] Fri, 27 May 2016 21:29 Go to previous messageGo to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 192
Registered: July 2009
Senior Member
You can also take a look into this tutorial which is explaining this topic:

https://wiki.eclipse.org/BPMN2-Modeler/DeveloperTutorials/CreateCustomShape

===
Ralph
Re: change color with code [message #1733494 is a reply to message #1733471] Sat, 28 May 2016 14:20 Go to previous messageGo to next message
Delacyr Ferreira is currently offline Delacyr FerreiraFriend
Messages: 20
Registered: February 2016
Junior Member
Hi everyone,

I'm changing the color of my elements through AbstractCustomFeature. It's available here [Line 93]

The issue here is that the new color is not have been persisting. When I close the model and open again, the new color was replaced by default color.

I guess the setFillColor method [Line 93] should be added in another place to persist the changes. Which place should be?
Re: change color with code [message #1733503 is a reply to message #1733494] Sat, 28 May 2016 22:38 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

Hmm, I wonder if it's possible that the color is not being saved in the bpmn XML, and when the file is reloaded, the editor just applies the default colors?
Re: change color with code [message #1733505 is a reply to message #1733503] Sat, 28 May 2016 23:08 Go to previous messageGo to next message
Delacyr Ferreira is currently offline Delacyr FerreiraFriend
Messages: 20
Registered: February 2016
Junior Member
When you say to reload the file, is it means just refresh the file or something else? I made a screencast, the editor just applies the default color if the file was closed and reopened. Nothing happened when I refresh the file.
Re: change color with code [message #1734132 is a reply to message #1733505] Sat, 04 June 2016 16:21 Go to previous message
Delacyr Ferreira is currently offline Delacyr FerreiraFriend
Messages: 20
Registered: February 2016
Junior Member
To solve the problem I added the setFillColor() at org.eclipse.bpmn2.modeler.ui.features.activity.task.TaskFeatureContainer.getAddFeature(...).new AddTaskFeature() {...}.decorateShape(IAddContext, ContainerShape, Task).

Now, when I close the diagram and open again, I won't lose the previous changes.
Previous Topic:How refresh diagram?
Next Topic:Validation Error Decorations do not show
Goto Forum:
  


Current Time: Thu Apr 25 10:04:03 GMT 2024

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

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

Back to the top