Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » Icon in the customTask shape
Icon in the customTask shape [message #1784623] Fri, 30 March 2018 16:06 Go to next message
Xabier Garat is currently offline Xabier GaratFriend
Messages: 28
Registered: November 2017
Junior Member
Hi,

I based my customTask in the dynamic example, but I don't want any icon in the shape. The I removed this code :
// add an image to the top-left corner of the rectangle
Image img = SampleImageProvider.createImage(roundedRect, customTaskDescriptor, 38, 38);
Graphiti.getGaService().setLocation(img, 2, 2);


But I still got an icon in my customTask.
How can I remove it ?

Thanks.
Re: Icon in the customTask shape [message #1784668 is a reply to message #1784623] Sun, 01 April 2018 20:24 Go to previous messageGo to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 145
Registered: July 2009
Senior Member
Hi,
have you tried
            Shape shape = containerShape.getChildren().get(0);
            // now clear all existing children of that shape...
            shape.getGraphicsAlgorithm().getGraphicsAlgorithmChildren().clear(); 


The containerShape has a default image which you need to remove.

Let me know if it works.

===
Ralph
Re: Icon in the customTask shape [message #1784795 is a reply to message #1784668] Wed, 04 April 2018 08:52 Go to previous messageGo to next message
Xabier Garat is currently offline Xabier GaratFriend
Messages: 28
Registered: November 2017
Junior Member
Hi,

I tried it but it did not work...
Re: Icon in the customTask shape [message #1784798 is a reply to message #1784795] Wed, 04 April 2018 09:34 Go to previous messageGo to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 145
Registered: July 2009
Senior Member
can you apply new shapes or colors? I fear you are in the wrong event and your shape is not updated after all?
Re: Icon in the customTask shape [message #1784799 is a reply to message #1784798] Wed, 04 April 2018 09:38 Go to previous messageGo to next message
Xabier Garat is currently offline Xabier GaratFriend
Messages: 28
Registered: November 2017
Junior Member
Yes, I can apply apply new shapes and colors, but allways with this icon.
Re: Icon in the customTask shape [message #1784800 is a reply to message #1784799] Wed, 04 April 2018 09:46 Go to previous messageGo to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 145
Registered: July 2009
Senior Member
Take a look at this code example:
https://github.com/imixs/imixs-bpmn/blob/master/org.imixs.eclipse.bpmn2.plugin/src/org/imixs/bpmn/ImixsLayoutTaskAdapter.java

This is the way we do it in the Imixs-Workflow project.
We replace the default image and add several custom icons.
But I have not tested it with out any image. But I do not believe this wont work because you have the full control.

Maybe one solution is it for you to add a blank place holder image?http://www.imixs.org
Re: Icon in the customTask shape [message #1784805 is a reply to message #1784800] Wed, 04 April 2018 10:12 Go to previous messageGo to next message
Xabier Garat is currently offline Xabier GaratFriend
Messages: 28
Registered: November 2017
Junior Member
Thinking about the blank icon solution, if I do this, will not I get a blank icon in the palette too ?
Re: Icon in the customTask shape [message #1784807 is a reply to message #1784805] Wed, 04 April 2018 10:16 Go to previous messageGo to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 145
Registered: July 2009
Senior Member
yes that is true. But I mean that you can set the blank image explizit like this:

			Shape shape = containerShape.getChildren().get(0);
			// now we need to clear all existing children of that shape...
			shape.getGraphicsAlgorithm().getGraphicsAlgorithmChildren().clear();

			// set background color
			ShapeStyle shapeStyle = new ShapeStyle();
			shapeStyle.setDefaultColors(PROCESSENTITY_BACKGROUND);

			// add the blank image into the upper left corner....
			Image imga = loadCustomTaskIcon("my-blank-image.png", shape.getGraphicsAlgorithm());
			Graphiti.getGaService().setLocationAndSize(imga, 2, 2, 24, 24);


But I can not see why this should be necessary..... strange.
Re: Icon in the customTask shape [message #1784809 is a reply to message #1784807] Wed, 04 April 2018 10:21 Go to previous messageGo to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 145
Registered: July 2009
Senior Member
Note: these are two different things - the one is the image defined in your plugin definition which is also affecting the palette. The other one it your shape layout method where you define what happens in the design panel.

index.php/fa/32528/0/

Re: Icon in the customTask shape [message #1784811 is a reply to message #1784807] Wed, 04 April 2018 10:40 Go to previous messageGo to next message
Xabier Garat is currently offline Xabier GaratFriend
Messages: 28
Registered: November 2017
Junior Member
I tried this, but I got the error "The method loadCustomTaskIcon(String, GraphicsAlgorithm) is undefined for the type new AddTextAnnotationFeature(){}"
I'm not working with a task...
Re: Icon in the customTask shape [message #1784814 is a reply to message #1784811] Wed, 04 April 2018 11:26 Go to previous messageGo to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 145
Registered: July 2009
Senior Member
This is how you can load the image:


		String imageId = fileName;
		String filename = "/icons/large/" + fileName;
		URL url = getClass().getClassLoader().getResource(filename);
		ImageDescriptor descriptor = ImageDescriptor.createFromURL(url);

		CustomTaskImageProvider.registerImage(imageId, descriptor);
		Image img = Graphiti.getGaService().createImage(ga, imageId);
		img.setProportional(false);
		img.setWidth(16);
		img.setHeight(16);
		img.setStretchH(true);
		img.setStretchV(true);
Re: Icon in the customTask shape [message #1784849 is a reply to message #1784814] Wed, 04 April 2018 18:54 Go to previous messageGo to next message
Xabier Garat is currently offline Xabier GaratFriend
Messages: 28
Registered: November 2017
Junior Member
It didn't work.
All the graphics element I added are now on the top left of my shape...
Re: Icon in the customTask shape [message #1784892 is a reply to message #1784849] Thu, 05 April 2018 09:59 Go to previous message
Xabier Garat is currently offline Xabier GaratFriend
Messages: 28
Registered: November 2017
Junior Member
Some news :
I can now add my image. I know it because when I drag my extension from the palette, orange dots which permits to resize the image are visible. But the rectangle shape is not visible anymore.
If I click on the feature, I select the blank icon.
Then, I think the rectangle (and maybe the previous icon ?) is "covered" by the blank icon.
Previous Topic:Receive Task validation error vs. BPMN specification
Next Topic:Feature null
Goto Forum:
  


Current Time: Thu Sep 20 16:04:47 GMT 2018

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

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

Back to the top