Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » diamond
diamond [message #240746] Tue, 15 January 2008 11:15 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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..,
Previous Topic:ScalableLayeredPane, how to update scrollbar after a setScale
Next Topic:Manhattan Router with bendpoints support.
Goto Forum:
  


Current Time: Fri Apr 19 23:18:27 GMT 2024

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

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

Back to the top