Style with LineWidth and LineStyle does not work [message #727579] |
Wed, 21 September 2011 14:54 |
Christian B Messages: 68 Registered: August 2011 |
Member |
|
|
Hi,
i tried to use my own style (same way like the tutorial proposes):
public static Style getStyleForGroup(Diagram diagram) {
final String styleId = "group";
Style style = findStyle(diagram, styleId);
IGaService gaService = Graphiti.getGaService();
if (style == null) { // style not found - create new style
style = gaService.createStyle(diagram, styleId);
style.setForeground(gaService.manageColor(diagram,
GROUP_FOREGROUND));
style.setBackground(gaService.manageColor(diagram,
GROUP_BACKGROUND));
style.setLineWidth(5);
style.setLineStyle(LineStyle.DOT);
style.setTransparency(0.8);
}
return style;
}
I set the style for a rectangle this way:
Rectangle rectangle = gaService.createRectangle(containerShape);
rectangle.setStyle(StyleUtil.getStyleForGroup(targetDiagram));
The Problem ist, only backgroundcolor and foreground color work, linewidth, linestyle and transparency are ignored...
if i set these properties directly to the rectangle, it works:
Rectangle rectangle = gaService.createRectangle(containerShape);
rectangle.setStyle(StyleUtil.getStyleForGroup(targetDiagram));
rectangle.setTransparency(0.8);
rectangle.setLineStyle(LineStyle.DOT);
rectangle.setLineWidth(5);
Any ideas?
One further question: Is it possible to make only the rectangle transparent and not its border too?
[Updated on: Wed, 21 September 2011 14:54] Report message to a moderator
|
|
|
Re: Style for LineWidth and Linestyle does not work [message #727995 is a reply to message #727579] |
Thu, 22 September 2011 10:56 |
Michael Wenz Messages: 1931 Registered: July 2009 Location: Walldorf, Germany |
Senior Member |
|
|
That happens because linewidth, linestyle and transparency have default
values defined that are automatically set for new graphic algorithms and let
the values defined at the style be ignored. Would need to reset the values
at the graphics algorithms (to null) to get the values from the style.
This is very confusing and actually we have just improved that behavior for
the Juno M2 version of Graphiti, see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352542
HTH,
Michael
"buschcobolt" schrieb im Newsbeitrag news:j5ct5b$ue$1@news.eclipse.org...
Hi,
i tried to use my own style (same way like the tutorial proposes):
public static Style getStyleForGroup(Diagram diagram) {
final String styleId = "group";
Style style = findStyle(diagram, styleId);
IGaService gaService = Graphiti.getGaService();
if (style == null) { // style not found - create new style
style = gaService.createStyle(diagram, styleId);
style.setForeground(gaService.manageColor(diagram,
GROUP_FOREGROUND));
style.setBackground(gaService.manageColor(diagram,
GROUP_BACKGROUND));
style.setLineWidth(5);
style.setLineStyle(LineStyle.DOT);
style.setTransparency(0.8);
}
return style;
}
I set the style for a rectangle this way:
Rectangle rectangle = gaService.createRectangle(containerShape);
rectangle.setStyle(StyleUtil.getStyleForGroup(targetDiagram));
The Problem ist, only backgroundcolor and foreground color work, linewidth,
linestyle and transparency are ignored...
if i set these properties directly to the rectangle, it works:
Rectangle rectangle = gaService.createRectangle(containerShape);
rectangle.setStyle(StyleUtil.getStyleForGroup(targetDiagram));
rectangle.setTransparency(0.8);
rectangle.setLineStyle(LineStyle.DOT);
rectangle.setLineWidth(5);
Any ideas?
One further question: Is it possible to make only the rectangle transparent
and not its border too?
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03320 seconds