Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Problem with transparancy in Styles
Problem with transparancy in Styles [message #778465] Thu, 12 January 2012 11:28 Go to next message
Veit Hoffmann is currently offline Veit Hoffmann
Messages: 20
Registered: July 2009
Junior Member
I have the impression that the transparancy set in a style is ignored.

When i register a style with transparency like this:
public static Style getStyleForOverlay(Diagram diagram) {
final String styleId = "OVERLAY"; //$NON-NLS-1$
Style style = findStyle(diagram, styleId);
IGaService gaService = Graphiti.getGaService();
if (style == null) { // style not found - create new style
style = gaService.createStyle(diagram, styleId);
...
style.setTransparency(0.7d);
}
return style;
}

A Figure is not transparent:
Rectangle rectangle = gaService.createRectangle(...);
....
rectangle.setStyle(StyleUtil.getStyleForOverlay(diagram));
only if i add:
rectangle.setTransparency(0.7d);

Is this an issue or am I doing something wrong?

Thanks in advance

Veit
Re: Problem with transparancy in Styles [message #780230 is a reply to message #778465] Tue, 17 January 2012 07:13 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1577
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hi,

well, partly an issue, partly wrong... ;-)

Styles and the default values do not really fit together. We have done some
rework on the styles for Graphiti 0.9.0 (see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352542). The standard creation
methods in the GAService do nothing about any default values defined in the
Graphiti metamodel; on the other hand styles are only checked if no value
(not even a default value) is set. In order to make the transparency from
the style being used, you have to unset the transparency for your rectangle.
In order to overcome this we have introduced createPlain methods in the
service that already do this; they should be used starting 0.9.0 when
working with styles. Until then, unsetting will do the job.

Michael
Re: Problem with transparancy in Styles [message #780365 is a reply to message #780230] Tue, 17 January 2012 12:04 Go to previous message
Veit Hoffmann is currently offline Veit Hoffmann
Messages: 20
Registered: July 2009
Junior Member
Hi,

thanks for the response. I gonna try the 0.9 creators then ;)

Veit

Am 17.01.2012 13:13, schrieb Michael Wenz:
> Hi,
>
> well, partly an issue, partly wrong... ;-)
>
> Styles and the default values do not really fit together. We have done
> some rework on the styles for Graphiti 0.9.0 (see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=352542). The standard
> creation methods in the GAService do nothing about any default values
> defined in the Graphiti metamodel; on the other hand styles are only
> checked if no value (not even a default value) is set. In order to make
> the transparency from the style being used, you have to unset the
> transparency for your rectangle. In order to overcome this we have
> introduced createPlain methods in the service that already do this; they
> should be used starting 0.9.0 when working with styles. Until then,
> unsetting will do the job.
>
> Michael
>
Previous Topic:How to change model in properties sheet without having an update command on the undo-stack?
Next Topic:guidance on creating Resource set and diagram creation
Goto Forum:
  


Current Time: Fri Aug 01 20:39:55 EDT 2014

Powered by FUDForum. Page generated in 0.08030 seconds