Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » Creating new features in my elements for some actions
Creating new features in my elements for some actions [message #1726007] Wed, 09 March 2016 02:02 Go to next message
Delacyr Ferreira is currently offline Delacyr FerreiraFriend
Messages: 20
Registered: February 2016
Junior Member
Hello guys, I'm from Brazil, so let me know about any misunderstanding with translation.

For a better understanding, I will going to show a mockup of what I would like to do, but I can not use links while I have fewer than 5 messages. Then, let me try to explain:

Step 1 - I want to select some elements in a model, perhaps through a checkbox or a simple button through that appears when the cursor is on the element.

Step 2 - After that, when I select a specific element, I want to change his color.

Step 3 - After selecting the desired elements, generate a new model with only the selected elements.

Step 4 - When generating a new model with the selected elements, recover the original color of it or just change again to his original color, if possible.

Some additional issues:
- Can I create a new button or checkbox button just creating a new class? E.g.: SelectActivityFeature.java in org.eclipse.bpmn2.modeler.ui.features package?
- How can the elements selection option is made available only on a specific model and not on all models of the project?
- How to change the color of selected elements?
- Can we generate a new model with only the selected elements?

Sorry for the broad topic, I didn't want to pollute the forum with so many topics, but any help is very welcome. Thank you.
Re: Creating new features in my elements for some actions [message #1726107 is a reply to message #1726007] Wed, 09 March 2016 16:17 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 Delacyr, and welcome to the forum!

It sounds like the "Button Pad" is exactly what you're looking for to add your feature. Just to be clear, this is the group of icons that pops up when you move the mouse over a shape:

http://content.screencast.com/users/BobBrodt/folders/Jing/media/243ead98-2c81-4c9a-bf36-0494b93c13c7/2016-03-09_0847.png

The contents of this pad is determined in Bpmn2ToolBehaviorProvider#getContextButtonPad(IPictogramElementContext context). You will need to concentrate on step 2 (see comments in getContextButtonPad()). To add your custom feature to the pad, you will need to define a <featureContainer> element in your extension plugin. This lets you provide your own overrides for all of the Graphiti get<Something>Feature() methods, including getCustomFeatures() which is where you will want to add your ICustomFeature. Have a look at the org.eclipse.bpmn2.modeler.examples.customtask example plugin.

Be sure to provide overrides for ICustomFeature#isAvailable() and ICustomFeature#canExecute() - this is where you calculate whether or not the custom feature has enough context to run with. The ICustomContext passed in to your custom feature will contain the list of selected PictogramElements - this should be enough information to decide whether or not your feature can do its job.

Your custom feature is entirely responsible for constructing and initializing the new model object you want, and hooking it in to the rest of the model. Keep in mind that all objects that are referenced (but not contained) by the model, must be contained somewhere in the model hierarchy or you will get a "model object is not contained in any Resource" exception thrown by EMF when you try to save the file.

Typically, you can get the root of the model (a BPMN2 "Definitions" object) using an object that is currently connected to the model (one of the selected shapes maybe?) and calling ModelUtil.getDefinitions(). This method knows how to navigate to the root given a BPMN2 model object or a Graphiti object, or an EMF Resource. From the Definitions root, it is up to you to figure out how to navigate to the node where you want to insert your new model object. If you give me a hint what this object is, I might be able to help.

Finally, the color change on selection. As you can already see, when you click on a shape, Graphiti gives you feedback by changing its color. There are two sets of color changes: one for the "primary" selection (the first shape selected) and one for "secondary" (additional selections). I'm not sure if this will suit your needs or not, but I'll have to investigate this some more to figure out how it works Wink

Hope this helps!
Bob
Re: Creating new features in my elements for some actions [message #1726273 is a reply to message #1726107] Thu, 10 March 2016 21:39 Go to previous messageGo to next message
Delacyr Ferreira is currently offline Delacyr FerreiraFriend
Messages: 20
Registered: February 2016
Junior Member
Thank you Bob, I'll try absorb your reply. When doubts are appearing, I'll came back here.
Re: Creating new features in my elements for some actions [message #1727553 is a reply to message #1726107] Wed, 23 March 2016 18:32 Go to previous messageGo to next message
Delacyr Ferreira is currently offline Delacyr FerreiraFriend
Messages: 20
Registered: February 2016
Junior Member
Hi Bob and everyone! About to add a button to the pad in the activities element, I got it! Now comes the second part that I'll explain below.

Beyond the Process, Collaboration and Choreography diagram type, I have a new type, named vrProcess (this diagram is used for variability representation in a business process through a set of stereotypes based on the feature model).

With images, is much better to understand!

By example, we have the vrProcess diagram below, where Task 1 is a variation point e contains Task 2 and Task 3 as variants.

http://imgur.com/IsWVhrP

Now, with the created button, I want to select In the diagram some variants to generate a new Process diagram (not vrProcess anymore). I created a button, but it has no action yet. How can I do to create two options to this button, like Select and Deselect option? Like the mockup below:

http://i.imgur.com/l9vmnOw.png

and

http://i.imgur.com/DOxUxJM.png

With selected variants, the intention is generate a new Process (not vrProcess anymore) diagram containing the selected elements and the remaining (non varpoint) elements through a menu button, like below:

http://i.imgur.com/IO9hcht.png

The new model should be like this:

http://i.imgur.com/NjjARN5.png

Any help is very welcome guys! Thank you so much!

[Updated on: Wed, 23 March 2016 18:46]

Report message to a moderator

Re: Creating new features in my elements for some actions [message #1727662 is a reply to message #1727553] Thu, 24 March 2016 21:09 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

Wow, first let me say this is a really cool idea Smile

Second, I want to say that I can think of a couple of different ways to implement this in the editor, some of these may or may not be possible:
1. the BPMN2 Modeler is a multi-page editor, meaning it should be possible to display different variants on a separate tab of the editor. Have a look at this screencast I recorded a while ago, which demonstrates the push-down/pull-up feature we will be adding to the next (Neon) release. This functionality could also be used to add new BPMNDiagram elements to the model which represent an instantiation of a vr template. With just a little more coding effort, you could provide the ability to select a particular instantiation and save it as a new bpmn2 file.
2. I can imagine that you may want to have more than just a single Task as a variant for a template item. For example you may want to provide a Task with an exception handler (Boundary Event plus Sequence Flow plus handler Task or Sub Process). This use case almost demands that you provide a new drawing canvas (editor tab) for the variant.
3. I'm not sure how useful it would be, but you may want to provide variants for other BPMN elements (not just Activities) like Events and Gateways - I haven't thought this through yet...

Anyway, to answer your specific question about how to change the Button Pad icon, you will have to implement your own AbstractCustomFeature# getImageId(). This method will have to identify whether the variant is currently selected and provide a different icon ID (think "checkbox" icons).

I would love to continue this conversation off-line; drop me a line at bbrodt@redhat.com if you have questions.

Cheers,
Bob
Re: Creating new features in my elements for some actions [message #1728602 is a reply to message #1727662] Tue, 05 April 2016 18:42 Go to previous messageGo to next message
Delacyr Ferreira is currently offline Delacyr FerreiraFriend
Messages: 20
Registered: February 2016
Junior Member
Thank you so much, Bob. Did you receive my email? Smile
Re: Creating new features in my elements for some actions [message #1728607 is a reply to message #1728602] Tue, 05 April 2016 19:33 Go to previous message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Yes I did - it was sent to my "Spam" folder Wink
Previous Topic:Exception while opening bpmn Editor After Mars.2 Update
Next Topic:NPE While creating SequenceFlow between events after Mars.2 update
Goto Forum:
  


Current Time: Wed Feb 21 04:09:59 GMT 2018

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

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