Skip to main content



      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 11:15 Go to next message
Eclipse UserFriend
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 11:59 Go to previous messageGo to next message
Eclipse UserFriend
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 05:21 Go to previous messageGo to next message
Eclipse UserFriend
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 11:02 Go to previous messageGo to next message
Eclipse UserFriend
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 10:26 Go to previous message
Eclipse UserFriend
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: Thu Jul 10 02:55:57 EDT 2025

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

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

Back to the top