|
|
|
|
Re: Modify dynamically the icons of a node [message #634389 is a reply to message #634121] |
Thu, 21 October 2010 14:13 |
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...
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 14:20 |
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...
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 15:17 |
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
|
|
|
Powered by
FUDForum. Page generated in 0.03873 seconds