Eclipse Community Forums
Forum Search:

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


Current Time: Sun Apr 20 04:15:33 EDT 2014

Powered by FUDForum. Page generated in 0.03424 seconds