Customizing compartment item labels [message #638210] |
Wed, 10 November 2010 14:03 |
|
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 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03026 seconds