Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Modify dynamically the icons of a node
Modify dynamically the icons of a node [message #634101] Wed, 20 October 2010 10:05 Go to next message
Paulo Del Aguila is currently offline Paulo Del Aguila
Messages: 14
Registered: October 2010
Junior Member
Hello everybody. This is my first topic, but i always read the forum. I need to modify dynamically the icons of a node, every time i change the type (Enum) in the model view. I try to use Exeed, but later i understand that is only for the visualization of ecore metamodels. I´m right? My question is, with epsilon or eugenia, its posible to do the modify?

Thanks for the answers Smile
Re: Modify dynamically the icons of a node [message #634121 is a reply to message #634101] Wed, 20 October 2010 11:02 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi,

Exeed can visualise any EMF model, not just Ecore metamodels.

http://eclipse.org/gmt/epsilon/doc/articles/eugenia-nodes-wi th-runtime-images/
demonstrates how changes to an attribute value can affect the
visualisation of a node in a GMF editor.

Cheers,
Dimitris

Paulo Del Aguila <pauloaguila@gmail.com> wrote:
> Hello everybody. This is my first topic, but i always read the forum.
> I need to modify dynamically the icons of a node, every time i change
> the type (Enum) in the model view. I try to use Exeed, but later i
> understand that is only for the visualization of ecore metamodels. I´m
> right? My question is, with epsilon or eugenia, its posible to do the
> modify?
>
> Thanks for the answers :)
>
Re: Modify dynamically the icons of a node [message #634259 is a reply to message #634121] Wed, 20 October 2010 20:41 Go to previous messageGo to next message
Paulo Del Aguila is currently offline Paulo Del Aguila
Messages: 14
Registered: October 2010
Junior Member
Hi Dimitrios, thanks for the support. But my case is different, i only want to modify the icon of a rectangle figure, and not the figure itself. I tried the setIcon method of WrappingLabel, but without sucess. Any idea? Thanks again Smile
Re: Modify dynamically the icons of a nod e [message #634283 is a reply to message #634259] Thu, 21 October 2010 03:14 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
It's hard to say without having any source code to look at :) Could you
please zip and send your code at epsilon.devs at gmail com so that I can
have a look?

Cheers,
Dimitris

Paulo Del Aguila <pauloaguila@gmail.com> wrote:
> Hi Dimitrios, thanks for the support. But my case is different, i only
> want to modify the icon of a rectangle figure, and not the figure
> itself. I tried the setIcon method of WrappingLabel, but without
> sucess. Any idea? Thanks again :)
>
Re: Modify dynamically the icons of a node [message #634389 is a reply to message #634121] Thu, 21 October 2010 10:13 Go to previous messageGo to next message
Paulo Del Aguila is currently offline Paulo Del Aguila
Messages: 14
Registered: October 2010
Junior Member
Thank you Dimitrios. I will send the zip, but the e-mail is epsilon.devs@gmail.com?

My emf code is:
@namespace(uri="classdiagram", prefix="classdiagram")
package classdiagram;

@gmf.diagram(foo="bar")
class Model {
val Clazz[*] classes;
}

@gmf.node(label="name")
class Clazz {
attr String name;
@gmf.compartment(layout="list", collapsible="false")
val Attribute[*] attributes;
}

@gmf.node(label="name,type", figure="rectangle", label.pattern="{0} : {1}")
class Attribute {
attr String name;
attr DataTypes type;
}

enum DataTypes {
INT = 0;
VARCHAR = 1;
DATE = 2;
FLOAT = 3;
}

By the way, I try to do something like that:

public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Attribute"));
}

this code is at AttributeItemProvider in classdiagram.provider package of classdiagram.edit folder.
The code i will modify is at classdiagram.diagram folder in classdiagram.diagram.edit.parts package. My doubt is which java class i will modify, the AttributeEditPart.java or AttributeNameTypeEditPart. I will modify the handleNotificationEvent method like that:
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
if (event.getEventType() == Notification.SET && event.getFeature() instanceof EAttribute) {
EAttribute atributo = (EAttribute) event.getFeature();
if (atributo.getName().equals("type")) {
//another method who sets the icons paths according to the DataTypes Enum
}
}...

After that i'm lost... Sad

Thanks for the support again.
Re: Modify dynamically the icons of a nod e [message #634391 is a reply to message #634283] Thu, 21 October 2010 10:20 Go to previous messageGo to next message
Paulo Del Aguila is currently offline Paulo Del Aguila
Messages: 14
Registered: October 2010
Junior Member
Thank you Dimitrios. I will send the zip, but the e-mail is epsilon.devs@gmail.com?

My emf code is:
@namespace(uri="classdiagram", prefix="classdiagram")
package classdiagram;

@gmf.diagram(foo="bar")
class Model {
val Clazz[*] classes;
}

@gmf.node(label="name")
class Clazz {
attr String name;
@gmf.compartment(layout="list", collapsible="false")
val Attribute[*] attributes;
}

@gmf.node(label="name,type", figure="rectangle", label.pattern="{0} : {1}")
class Attribute {
attr String name;
attr DataTypes type;
}

enum DataTypes {
INT = 0;
VARCHAR = 1;
DATE = 2;
FLOAT = 3;
}

By the way, I try to do something like that:

public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Attribute"));
}

this code is at AttributeItemProvider in classdiagram.provider package of classdiagram.edit folder.
The code i will modify is at classdiagram.diagram folder in classdiagram.diagram.edit.parts package. My doubt is which java class i will modify, the AttributeEditPart.java or AttributeNameTypeEditPart. I will modify the handleNotificationEvent method like that:
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
if (event.getEventType() == Notification.SET && event.getFeature() instanceof EAttribute) {
EAttribute atributo = (EAttribute) event.getFeature();
if (atributo.getName().equals("type")) {
//another method who sets the icons paths according to the DataTypes Enum
}
}...

After that i'm lost... Sad

Thanks for the support again.
Re: Modify dynamically the icons of a nod e [message #634416 is a reply to message #634391] Thu, 21 October 2010 11:17 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi,

Paulo Del Aguila wrote:
> Thank you Dimitrios. I will send the zip, but the e-mail is
> mailto:epsilon.devs@gmail.com?

Yes.

>
> My emf code is:
> @namespace(uri="classdiagram", prefix="classdiagram")
> package classdiagram;
>
> @gmf.diagram(foo="bar")
> class Model {
> val Clazz[*] classes;
> }
>
> @gmf.node(label="name")
> class Clazz {
> attr String name;
> @gmf.compartment(layout="list", collapsible="false")
> val Attribute[*] attributes;
> }
>
> @gmf.node(label="name,type", figure="rectangle", label.pattern="{0} : {1}")
> class Attribute {
> attr String name;
> attr DataTypes type;
> }
>
> enum DataTypes {
> INT = 0;
> VARCHAR = 1;
> DATE = 2;
> FLOAT = 3;
> }
>
> By the way, I try to do something like that:
>
> public Object getImage(Object object) {
> return overlayImage(object,
> getResourceLocator().getImage("full/obj16/Attribute"));
> }
>
> this code is at AttributeItemProvider in classdiagram.provider package
> of classdiagram.edit folder.
> The code i will modify is at classdiagram.diagram folder in
> classdiagram.diagram.edit.parts package. My doubt is which java class i
> will modify, the AttributeEditPart.java or AttributeNameTypeEditPart. I
> will modify the handleNotificationEvent method like that:
> protected void handleNotificationEvent(Notification event) {
> Object feature = event.getFeature();
> if (event.getEventType() == Notification.SET &&
> event.getFeature() instanceof EAttribute) {
> EAttribute atributo = (EAttribute) event.getFeature();
> if (atributo.getName().equals("type")) {
> //another method who sets the icons paths according to
> the DataTypes Enum
> }
> }...
>
> After that i'm lost... :(
>
> Thanks for the support again.

Cheers,
Dimitris
Previous Topic:Automatic validation.
Next Topic:Custom Metamodel Binding for E*L
Goto Forum:
  


Current Time: Sat Apr 19 00:39:06 EDT 2014

Powered by FUDForum. Page generated in 0.01831 seconds