Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 07:56 Go to next message
Peter Thijs is currently offline Peter ThijsFriend
Messages: 17
Registered: July 2009
Junior Member
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 10:03 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
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 13:21 Go to previous messageGo to next message
Ramon is currently offline RamonFriend
Messages: 10
Registered: July 2009
Junior Member
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 14:53 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
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] Thu, 08 November 2012 02:04 Go to previous message
vinay ag is currently offline vinay agFriend
Messages: 1
Registered: November 2012
Junior Member

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: Fri Mar 29 05:14:27 GMT 2024

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

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

Back to the top