Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Customizing compartment item labels
Customizing compartment item labels [message #638210] Wed, 10 November 2010 14:03 Go to next message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

Hi,

I'm writing a simple ER diagram editor, based on a EMF model; I got no problems in reading the model and displaying it in a diagram, where I can see tables, rows and relations correctly (Tables are Nodes, Attributes are Nodes in a compartment owned by Table and Relations are Connections). Now I want to introduce some improvement, e.g. the attribute in the row is Primary Key? If so, I want it displayed in bold....and so on. So, where and how I can modify the compartment item label (and, why not, the icon)? I googled a lot, but I'm not able to find a solution.

Anyone has suggestions about?

Thanks, regards

Giovanni
Re: Customizing compartment item labels [message #638247 is a reply to message #638210] Wed, 10 November 2010 16:18 Go to previous messageGo to next message
Asiri Rathnayake is currently offline Asiri RathnayakeFriend
Messages: 80
Registered: September 2010
Location: Colombo, Sri Lanka.
Member
Hi,

In your AttributeEditPart you would need to do something like below:

/**
 * @generated NOT
 */
protected IFigure createNodeShape() {
	AttributeFigure figure = new AttributeFigure();
	Attribute attr = (Attribute) ((View) getModel()).getElement());
	if (attr.isPrimaryKey()) {
		figure.getAttributeNameLabel().setIcon(....);
		// Do other decorations.
	}
	return primaryShape = figure;
}

Now you would need to define corresponding child access methods in order for this to work.

Hope this helps.

- Asiri
Re: Customizing compartment item labels [message #638424 is a reply to message #638247] Thu, 11 November 2010 09:40 Go to previous message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

Hi Asiri,

thank you, it helps me to solve problem.

Regards,

Giovanni.
Previous Topic:OCL Constraint: No two diagram elements have the same name.
Next Topic:How to generate single EditPart class for different contexts of the same EObject?
Goto Forum:
  


Current Time: Fri Apr 26 09:51:21 GMT 2024

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

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

Back to the top