diamond [message #240746] |
Tue, 15 January 2008 11:15 |
Eclipse User |
|
|
|
Originally posted by: shady_86.sify.com
how can a diamond (relation in an E-R Diagram) be created in the GEF framework, since there is no predefined function for this shape in draw2d.
|
|
|
Re: diamond [message #240772 is a reply to message #240746] |
Wed, 16 January 2008 05:28 |
Eclipse User |
|
|
|
Originally posted by: shady_86.sify.com
i tried it in this way
private IFigure createFigureForModel() {
return new Diamond();
}
=============================================
public class Diamond extends Figure {
public Diamond(Rectangle rect) {
setBounds(getBounds());
}
protected void paintFigure(Graphics g) {
Rectangle r = getParent().getBounds().getCopy();
setBounds(r);
PointList points = new PointList();
points.addPoint(new Point(r.x + r.width / 2, r.y));
points.addPoint(new Point(r.x + r.width, r.y + r.height / 2));
points.addPoint(new Point(r.x + r.width / 2, r.y + r.height));
points.addPoint(new Point(r.x, r.y + r.height / 2));
g.fillPolygon(points);
g.drawPolygon(points);
}
}
=====================================
but the figure generated is working improperly, i mean the drawing board is jumping and if i try to resize the figure the figure also starts jumping,
please tell me the correct way to do it..,
|
|
|
Re: diamond [message #240787 is a reply to message #240772] |
Thu, 17 January 2008 04:28 |
Eclipse User |
|
|
|
Originally posted by: shady_86.sify.com
no issues i have solved the problem.
i was using figures of draw2d which does not actually support the gef traits,
so i tried using shape of gef and i got my solution..,
|
|
|
Powered by
FUDForum. Page generated in 0.02887 seconds