Icon in the customTask shape [message #1784623] |
Fri, 30 March 2018 16:06  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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 #1784807 is a reply to message #1784805] |
Wed, 04 April 2018 10:16   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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.

|
|
|
|
Re: Icon in the customTask shape [message #1784814 is a reply to message #1784811] |
Wed, 04 April 2018 11:26   |
Eclipse User |
|
|
|
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 #1784892 is a reply to message #1784849] |
Thu, 05 April 2018 09:59  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.03356 seconds