[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] [solved] Re: Set backgound color depending on model elements property

Hi,

A short description how I solved the problem, in case anyone is interested.

In the generated class *.diagram.edit.parts.ClassAEditPart, I've overridden method refreshBackgroundColor() something like this:

protected void refreshBackgroundColor() {
Color backgroundColor = THIS_BACK; // THIS_BACK is created by setting background color in figure
View notationView = getNotationView();
EObject element = notationView.getElement();
if (element instanceof ClassA) {
ClassA a = (ClassA) element;
backgroundColor = a.getColor();
}


		setBackgroundColor(backgroundColor);
	}

Best,
Marc

On 2009-02-16 23:46:26 +0100, Marc Moser <moser@xxxxxxxxxxxx> said:

Hi,

I have a class ClassA with an attribute color:String in my domain model. Now I'd like to update the background color of the nodes representing instances of ClassA based on the color property. I did not find anything in the graph/mapping models, so I guess I need to code it manually. Can anyone give me a hint at what classes I need to look and how I could possibly achieve what I want?

Many thanks!

Best regards,
Marc Moser