|
Re: Draw Dashed Line for connections [message #1235536 is a reply to message #1235075] |
Fri, 24 January 2014 16:04 |
Soeren M Messages: 77 Registered: September 2011 |
Member |
|
|
cagkan toptas wrote on Thu, 23 January 2014 09:12Hi, I am beginner in Graphiti. I will be thankful if anyone could help me for my questions.
Question 1: According to the model I try to implement, I need dashed line connection between two Shapes. How can I draw this dashed line ? Is there a built in style for dashed line(or dotted line)?
You have to set the linestyle of ur polyline:
polyline.setLineStyle(LineStyle.DOT);
cagkan toptas wrote on Thu, 23 January 2014 09:12
Question 2: I want to make a connection between a Ereference(connection) and Eobject(shape). is it possible in Graphiti?
Regards,
Cagkan
I am not sure if u can add an anchor to a connection... in other words, Ive tested it, it is possible, but I was not able to connect a Connection with it...
[Updated on: Fri, 24 January 2014 16:07] Report message to a moderator
|
|
|
Re: Draw Dashed Line for connections [message #1236180 is a reply to message #1235536] |
Sun, 26 January 2014 13:10 |
cagkan toptas Messages: 5 Registered: January 2014 Location: italy |
Junior Member |
|
|
Thank you for answers. For question 1 it is okay. For question 2, I try to add chopboxanchor to connection when I add a reference between an object and a reference it connects my shape to point(100,100) in the screen (Can be seen at attached Picture)
// This is from AbstractAddFeature class (the red dotted line)
public PictogramElement add(IAddContext context) {
IAddConnectionContext addConContext = (IAddConnectionContext) context;
DataFlow addedEReference = (DataFlow) context.getNewObject();
IPeCreateService peCreateService = Graphiti.getPeCreateService();
// CONNECTION WITH POLYLINE
Connection connection = peCreateService
.createFreeFormConnection(getDiagram());
connection.setStart(addConContext.getSourceAnchor());
connection.setEnd(addConContext.getTargetAnchor());
IGaService gaService = Graphiti.getGaService();
Polyline polyline = gaService.createPolyline(connection);
polyline.setLineWidth(2);
polyline.setLineStyle(LineStyle.DOT);
polyline.setForeground(manageColor(E_REFERENCE_FOREGROUND));
// create link and wire it
link(connection, addedEReference);
ConnectionDecorator cd;
cd = peCreateService
.createConnectionDecorator(connection, false, 1.0, true);
createArrow(cd);
[b]// add a chopbox anchor to the connection [/b]
[b] peCreateService.createChopboxAnchor(connection);[/b]
return connection;
}
Did I added it true or I need to do something else?
[Updated on: Tue, 28 January 2014 02:30] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03329 seconds