Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » need help on GMF graphic definition, how to add a vertical line in a rectangle?
need help on GMF graphic definition, how to add a vertical line in a rectangle? [message #234587] Wed, 24 June 2009 15:15 Go to next message
Bo Liu is currently offline Bo LiuFriend
Messages: 9
Registered: July 2009
Junior Member
Hi Everyone,

I am new to GMF, and I managed to implement a simple editor following the
tutorials.

But when I moved to define my own figures, I get confused in the several
layout choices and their attributes ...
What I want is simply like this:
Re: add a vertical lSorry about the diagrams, they looks like this [message #234602 is a reply to message #234587] Wed, 24 June 2009 15:59 Go to previous messageGo to next message
Bo Liu is currently offline Bo LiuFriend
Messages: 9
Registered: July 2009
Junior Member
Sorry about the code I use, the diagrams are like this:
____________________
| | | |
| | | |
| | | |
|__|__|_____________|

and

____________________
| | | |
| | | |
| | | ____|
| | | | |
|__|__|________|____|


Thanks a lot
Re: need help on GMF graphic definition, how to add a vertical line in a rectangle? [message #234622 is a reply to message #234587] Thu, 25 June 2009 09:21 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Bo,

> I am not quite clear about the several layout styles(xy,grid,flow...),
> is there any documents about this?
All these layouts are just a reflection of corresponding data from GEF, so
you can read GEF documentation to understand how to use them.

-----------------
Alex Shatalin
Re: need help on GMF graphic definition, how to add a vertical line in a rectangle? [message #234700 is a reply to message #234622] Thu, 25 June 2009 15:02 Go to previous messageGo to next message
bluetlck Mising name is currently offline bluetlck Mising nameFriend
Messages: 4
Registered: July 2009
Junior Member
on GMF graphic definition,you can define PolyLine ,but the line's location
and length is fixed.

so need use custom layout to set label's position and use custom border to
draw line and rectangle just like below:

public class CustomBorder extends LineBorder {

public void paint(IFigure figure, Graphics g, Insets insets) {

tempRect.setBounds(getPaintRectangle(figure, insets));
if (getWidth() % 2 == 1) {
tempRect.width--;
tempRect.height--;
}
tempRect.shrink(getWidth() / 2, getWidth() / 2);
g.setLineWidth(getWidth());
if (getColor() != null)
g.setForegroundColor(getColor());
g.drawRectangle(tempRect);
g.drawLine(tempRect.x +30, tempRect.y
tempRect.x + 30, tempRect.y + tempRect.height);

}
}
Re: need help on GMF graphic definition, how to add a vertical line in a rectangle? [message #234845 is a reply to message #234700] Mon, 29 June 2009 14:26 Go to previous message
Bo Liu is currently offline Bo LiuFriend
Messages: 9
Registered: July 2009
Junior Member
Thanks a lot bluetlck.

I can't purely rely on the GMF and code generation stuff, do I?
As I have seen from the previous post about graphic definition, GEF is
needed a lot.

Long way to go for my project. 8-]

> on GMF graphic definition,you can define PolyLine ,but the line's location
> and length is fixed.

> so need use custom layout to set label's position and use custom border to
> draw line and rectangle just like below:

> public class CustomBorder extends LineBorder {

> public void paint(IFigure figure, Graphics g, Insets insets) {

> tempRect.setBounds(getPaintRectangle(figure, insets));
> if (getWidth() % 2 == 1) {
> tempRect.width--;
> tempRect.height--;
> }
> tempRect.shrink(getWidth() / 2, getWidth() / 2);
> g.setLineWidth(getWidth());
> if (getColor() != null)
> g.setForegroundColor(getColor());
> g.drawRectangle(tempRect);
> g.drawLine(tempRect.x +30, tempRect.y
> tempRect.x + 30, tempRect.y + tempRect.height);

> }
> }
Previous Topic:Use of ConnectionHandle to add new node with connection
Next Topic:can't open GMF Editor after adding Audit Rules to mapping model since using Galileo
Goto Forum:
  


Current Time: Sat Jun 06 02:05:53 GMT 2020

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

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

Back to the top