Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » PROBLEMA WITH CUSTOMIZE FIGURE
icon9.gif  PROBLEMA WITH CUSTOMIZE FIGURE [message #493787] Wed, 28 October 2009 01:19 Go to next message
marco  is currently offline marco Friend
Messages: 82
Registered: September 2009
Member
package marco.diagram.figures;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;

public class ArchitectureFigure extends Figure {

@Override
public void paint(Graphics graphics) {

Rectangle r = getBounds();

// Define the points of a diamond
Point p1 = new Point(r.x, r.y);
Point p2 = new Point(r.x + r.width-1, r.y);
Point p3 = new Point(r.x + r.width-1, r.y + r.height-1);
Point p4 = new Point(r.x , r.y + r.height-1);
Point p5 = new Point(r.x + r.width-1, r.y + r.height/12);
Point p6 = new Point(r.x , r.y + r.height/12 );
Point p7 = new Point(r.x + r.width-1, r.y + r.height/10);
Point p8 = new Point(r.x , r.y + r.height/10 );

PointList pointList= new PointList();
pointList.addPoint(p1);
pointList.addPoint(p2);
pointList.addPoint(p3);
pointList.addPoint(p4);
pointList.addPoint(p8);
pointList.addPoint(p7);
pointList.addPoint(p5);
pointList.addPoint(p6);
pointList.addPoint(p8);

graphics.drawPolygon(pointList);


// I ALSO TRIED THAT BUT NOTHING HAS
// CHANGED
/*
graphics.drawLine(p1,p2);
graphics.drawLine(p2,p3);
graphics.drawLine(p1,p4);
graphics.drawLine(p6,p5);
graphics.drawLine(p8,p7);
graphics.drawLine(p4,p3);
*/
// Move the label to the centre of the diamond
WrappingLabel label = (WrappingLabel) getChildren().get(0);
LayoutUtil.moveToCenter(label, this, graphics);
label.paint(graphics);

}

}
hi

This Java class implements a figure that I can contain other inside.

I have this problem:
when I create classes within it, does not show the corresponding figure.

I think they are covered by the initial figure.

how can I do to fix this?
make the picture transparent?
I have something wrong in the writing of Java class?

I need help urgently

Thanks to all
marco

[Updated on: Thu, 29 October 2009 19:12]

Report message to a moderator

Re: PROBLEMA WITH CUSTOMIZE FIGURE [message #494508 is a reply to message #493787] Fri, 30 October 2009 22:36 Go to previous message
marco  is currently offline marco Friend
Messages: 82
Registered: September 2009
Member
thanks...i resolve my problem

Previous Topic:Manage a GMF notation model
Next Topic:Validation with EMF - Problems view
Goto Forum:
  


Current Time: Thu Sep 19 21:29:12 GMT 2024

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

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

Back to the top