Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340712 - Unable to create dashed connection using a Style object
Summary: Unable to create dashed connection using a Style object
Status: CLOSED WORKSFORME
Alias: None
Product: Graphiti
Classification: Modeling
Component: Core (show other bugs)
Version: 0.8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-22 18:38 EDT by Ali AKAR CLA
Modified: 2011-10-25 08:52 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ali AKAR CLA 2011-03-22 18:38:48 EDT
I can create my dashed connection with the code below and it works fine:

IGaService gaService = Graphiti.getGaService();
Polyline polyline = gaService.createPolyline(connection);
polyline.setLineWidth(2);
polyline.setForeground(manageColor(IColorConstant.BLACK));
polyline.setLineStyle(LineStyle.DASH);

But, if I create a style and then set the style on the polyline as shown below, it doesn't work:

IGaService gaService = Graphiti.getGaService();
dashedStyle = gaService.createStyle(diagram, styleId);
dashedStyle.setLineStyle(LineStyle.DASH);
dashedStyle.setLineWidth(2);         dashedStyle.setForeground(gaService.manageColor(diagram,IColorConstant.BLACK));

polyline.setStyle(dashedStyle);

-----------------------------------------------

Michael Wenz wrote this:

This appears to be a bug. In order for the Graphiti framework to use the line style set at the style object, the value at the GA needs to be LineStyle.UNSPECIFIED. Since this is not set as default for the attribute at AbstractStyle, the framework uses SOLID (0, standard default value). As a workaround you may set the value at the Polyline explicitly to UNSPECIFIED.
Comment 1 Christian Brand CLA 2011-05-25 07:45:49 EDT
The value "SOLID" as line styles' default makes sense while for most of all Graphiti users this is the right one. So I do not really see this as a bug of the framework. Customers, which make use of styles need to know which attributes need to be reset. Perhaps some words in the documentation should avoid problems like this one.
Comment 2 Michael Wenz CLA 2011-07-20 04:15:49 EDT
One further comment from my side: I have opened a Bugzilla for checking the feasibility of the styles concept as it is implented today. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=352542
Comment 3 Michael Wenz CLA 2011-10-25 08:52:39 EDT
Fix for root cause provided via other bugzilla