Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Making figures sensitive to attributes of semantic elements
Making figures sensitive to attributes of semantic elements [message #478076] Thu, 06 August 2009 03:56 Go to next message
Eclipse UserFriend
As described in

http://wiki.eclipse.org/index.php/GMF_Tips#Making_figures_se nsitive_to_attributes_of_semantic_elements

one can make a figure sensitive to attributes of its semantic elements.
For this a method called updateFace() that sets the different styles of
the figure depending on the value of the attributes is implemented.
Subsequently, this method is called (amogst others) in the constructor
of the figure.

However, when saving+closing a diagram and opening it again the figure
is drawn on the canvas without the ‘style modifications’ as specified in
the updateFace() method, although the updateFace() method is called from
the constructor of the figure when the diagram is opened.

Does someone know what the problem might be?
Re: Making figures sensitive to attributes of semantic elements [message #478457 is a reply to message #478076] Thu, 06 August 2009 06:03 Go to previous messageGo to next message
Eclipse UserFriend
Hello Peter,

> specified in the updateFace() method, although the updateFace() method
> is called from the constructor of the figure when the diagram is
> opened.
Can you put a breakpoint there to see why does it work incorrectly?

-----------------
Alex Shatalin
Re: Making figures sensitive to attributes of semantic elements [message #478914 is a reply to message #478457] Fri, 07 August 2009 09:21 Go to previous messageGo to next message
Eclipse UserFriend
Hello Alex,

I've added breakpoints. The method updateFace() (see below for its
implementation) sets a different background color for node 'A' depending on
the attribute 'prop'. When opening a diagram containing one node 'A' with
the 'prop' attribute of 'A' set to true, the constructor of 'A' calls the
updateFace() method. The value of loc.isProp() evaluates to true, and the
bgcolor of the figure is assigned lightGreen. However, on the canvas, the
node appears with a bgcolor white.

Can you plz. give me some additional pointers how to debug this (unexpected)
behavior?

Thanks in advance,

Ramon



public void updateFace() {
A loc = (A) (AEditPart.this
.resolveSemanticElement());
if (loc.isProp()) {
this.setBackgroundColor(ColorConstants.lightGreen);
} else {
this.setBackgroundColor(ColorConstants.white);
}
}


Alex Shatalin wrote:

> Hello Peter,
>
>> specified in the updateFace() method, although the updateFace() method
>> is called from the constructor of the figure when the diagram is
>> opened.
> Can you put a breakpoint there to see why does it work incorrectly?
>
> -----------------
> Alex Shatalin
Re: Making figures sensitive to attributes of semantic elements [message #480537 is a reply to message #478914] Mon, 17 August 2009 10:53 Go to previous messageGo to next message
Eclipse UserFriend
Hello ramon,

> Can you plz. give me some additional pointers how to debug this
> (unexpected) behavior?
Try placing breakpoint into this.setBackgroundColor() method to see where
it was called after constructor execution.

-----------------
Alex Shatalin
Re: Making figures sensitive to attributes of semantic elements [message #975658 is a reply to message #480537] Wed, 07 November 2012 21:04 Go to previous message
Eclipse UserFriend

The solution to this problem is calling the "updateFace()" method from the editpart's "activate()" method:

public void activate() {
getPrimaryShape().updateFace();
super.activate();
}
Previous Topic:Rendering SVG image on FEG editor
Next Topic:Constraint causes - org.eclipse.core.runtime.AssertionFailedException: null argument:
Goto Forum:
  


Current Time: Sun Jul 13 19:38:46 EDT 2025

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

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

Back to the top