Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Changing child element attribute on change of Parenet element attribute
Changing child element attribute on change of Parenet element attribute [message #54633] Mon, 25 September 2006 04:47 Go to next message
Eclipse UserFriend
Originally posted by: vikas.goyal.hp.com

Hi,

I want to modify the attribute of child depends on Parent node
attribute. My requirnment is like this:
When I change Node A attribute from Customizabel to false then for
all the child elements of Node A i.e Node B , Node C, Node D Attribute
Customizable should become false.


<Node A>
<Customizable = "true">
<Node B>
<Customizable="true" >
</Node B>
<Node C>
<Customizable="true" >
<Node D>
<Customizable="true" >
</Node D>
</Node C>
</Node A>

For this I am trying to manipulate ItemProvider class in edit package. In
this class I have notifyChanged() method and which is firing
fireNotifyChanged method.

Please advice is this the write method to manipulate and how to
proceed on this.


Thanks & Regards,
Vikas
Re: Changing child element attribute on change of Parenet element attribute [message #55169 is a reply to message #54633] Mon, 25 September 2006 10:29 Go to previous messageGo to next message
Eclipse UserFriend
Perhaps, this attribute should be marked as 'derived' in the metamodel? I'd
rather fix that in the domain model than manipulate ItemProvider.

Artem

"Vikas Goyal" <vikas.goyal@hp.com> wrote in message
news:0c3aec1f9a1613381eaa3db3dd38ea3c$1@www.eclipse.org...
> Hi,
> I want to modify the attribute of child depends on Parent node
> attribute. My requirnment is like this:
> When I change Node A attribute from Customizabel to false then for all
> the child elements of Node A i.e Node B , Node C, Node D Attribute
> Customizable should become false.
>
>
> <Node A>
> <Customizable = "true">
> <Node B>
> <Customizable="true" >
> </Node B>
> <Node C>
> <Customizable="true" > <Node D>
> <Customizable="true" > </Node D> </Node C> </Node A>
> For this I am trying to manipulate ItemProvider class in edit package. In
> this class I have notifyChanged() method and which is firing
> fireNotifyChanged method.
> Please advice is this the write method to manipulate and how to
> proceed on this.
>
>
> Thanks & Regards,
> Vikas
Re: Changing child element attribute on change of Parenet element attribute [message #55252 is a reply to message #55169] Mon, 25 September 2006 10:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vikas.goyal.hp.com

Hi Artem
Could you please tell me the significance of derived. Can you suggest me
some pointer which help me to understand it.


Thanks & Regards,
Vikas
Re: Changing child element attribute on change of Parenet element attribute [message #55385 is a reply to message #55252] Mon, 25 September 2006 13:38 Go to previous messageGo to next message
Eclipse UserFriend
Basically, "the value of a derived feature is computed from other features",
and it looks like "Customizabel" attribute for child elements in your
example derives its value from parent.
'Derived' is just a property of EAttribute you need to set in your
meta-model. In addition, you might want to set this EAttribute volatile and
transiend as well, and you'll need to implement getter method with
appropriate logic (navigate to parent to get value). Take a look at
http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org .eclipse.emf/doc/org.eclipse.emf.doc/references/overview/EMF .html(scroll
to "Generation control flags")

Artem

"Vikas Goyal" <vikas.goyal@hp.com> wrote in message
news:2f6dc039285e993b791a00467d0403f3$1@www.eclipse.org...
> Hi Artem Could you please tell me the significance of derived. Can you
> suggest me some pointer which help me to understand it.
>
>
> Thanks & Regards,
> Vikas
>
>
Re: Changing child element attribute on change of Parenet element attribute [message #55867 is a reply to message #54633] Tue, 26 September 2006 10:25 Go to previous message
Eclipse UserFriend
Vikas Goyal wrote:

Another way to achieve this behavior is to make the feature Unsettable
And the feature is unset by default. Then in the getter Method you check
if the feature is set or not; if it is set you return the value it had ;
other wise you return the parents.getter.

The getCustomizable should look like this

if (!isSetCustomizable()){
EObject container = eContainer();
if (container instanceof Node) {
Node node = (Node) container;
return node.getCustomizable();
}
}else {
return customizable;
}

so, as soon as you set the value on a parent, the getters of the
children will return the same value a the parent unless it is set in the
child, and so on




> Hi,
> I want to modify the attribute of child depends on Parent node
> attribute. My requirnment is like this:
> When I change Node A attribute from Customizabel to false then for
> all the child elements of Node A i.e Node B , Node C, Node D Attribute
> Customizable should become false.
>
>
> <Node A>
> <Customizable = "true">
> <Node B>
> <Customizable="true" >
> </Node B>
> <Node C>
> <Customizable="true" > <Node D>
> <Customizable="true" > </Node D>
> </Node C> </Node A>
> For this I am trying to manipulate ItemProvider class in edit package.
> In this class I have notifyChanged() method and which is firing
> fireNotifyChanged method.
> Please advice is this the write method to manipulate and how to
> proceed on this.
>
>
> Thanks & Regards,
> Vikas
Previous Topic:UML2 example
Next Topic:constraining node movement/resize
Goto Forum:
  


Current Time: Mon May 05 23:45:36 EDT 2025

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

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

Back to the top