Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Change the appearance of outgoing connections when clicking on a specific node(I am trying to change the color of all outgoing links when any node has focus)
Change the appearance of outgoing connections when clicking on a specific node [message #635587] Wed, 27 October 2010 12:52 Go to next message
Mostafa ElShafei is currently offline Mostafa ElShafeiFriend
Messages: 39
Registered: October 2010
Member
Hello all,

I am trying to change the color of all outgoing links when any node has focus.

I have already added the following code to every xxxEditpart class :

public void updateFace() {
node = (XXX) ((Node) XXXEditPart.this.getModel()).getElement();
this.addMouseListener(new MouseListener(){
public void mousePressed(MouseEvent me) {
EList<Connection> temp = node.getOutgoingConnections();
System.out.println(temp.size());
for( int i = 0; i < temp.size(); i++)
{
//Set all outgoing connections to red
}
}
}

My question is how to change theIFigure appearance of the outgoingConnections returned list.

What is missing???

Thank you in advance for your help.
Re: Change the appearance of outgoing connections when clicking on a specific node [message #636847 is a reply to message #635587] Wed, 03 November 2010 05:34 Go to previous messageGo to next message
Mostafa ElShafei is currently offline Mostafa ElShafeiFriend
Messages: 39
Registered: October 2010
Member
Hello,

Is there any suggestions / help?

Thanks.
Re: Change the appearance of outgoing connections when clicking on a specific node [message #636865 is a reply to message #635587] Wed, 03 November 2010 08:04 Go to previous messageGo to next message
Asiri Rathnayake is currently offline Asiri RathnayakeFriend
Messages: 80
Registered: September 2010
Location: Colombo, Sri Lanka.
Member
Hi,

May be something like this:

for (Object outLink : XXXEditPart.this.getSourceConnections()) {
	if (outLink instanceof ConnectionEditPart) {
		ConnectionEditPart outLinkPart = (ConnectionEditPart) outLink;
		outLinkPart.getFigure().setBackgroundColor(new Color(null, 255, 0, 0));
	}
}

Haven't tried though Smile

- Asiri

[Updated on: Wed, 03 November 2010 08:06]

Report message to a moderator

Re: Change the appearance of outgoing connections when clicking on a specific node [message #636882 is a reply to message #636865] Wed, 03 November 2010 08:34 Go to previous message
Mostafa ElShafei is currently offline Mostafa ElShafeiFriend
Messages: 39
Registered: October 2010
Member
Thanks Asiri very much Very Happy

I appreciate your help. Smile

The following code do the trick:

for (Object outLink : XXXEditPart.this.getSourceConnections()) {
if (outLink instanceof ConnectionEditPart) {
ConnectionEditPart outLinkPart = (ConnectionEditPart) outLink;
outLinkPart.getFigure().setForegroundColor(new Color(null, 255, 0, 0));
}
}
Previous Topic:Border items and layout manager
Next Topic:Avoiding duplicate link between node.
Goto Forum:
  


Current Time: Fri Apr 26 10:23:19 GMT 2024

Powered by FUDForum. Page generated in 0.02721 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top