Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Frame on editor problem
Frame on editor problem [message #170330] Thu, 03 March 2005 16:48 Go to next message
Eclipse UserFriend
Originally posted by: binti.ksu.edu

Hi all,

I am trying to make changes to the schema diagram editor example to get a
better understanding of gef. I need to add af frame to the editor on which
my figures would appear. I am able to do this by adding a recatngular figure
to the schemafigure. Schemafigure extends FreeformLayer. So the frame
appears on it.

The class schemafigure is as follows:

public class SchemaFigure extends FreeformLayer
{
public SchemaFigure()
{
setOpaque(true);
setBorder(new LineBorder(ColorConstants.white, 1));
}

protected void paintFigure(Graphics g)
{
Rectangle r = getBounds().getCopy();
r.translate(20, 20);
g.setLineWidth(2);
g.drawRectangle(r.x, r.y, r.width - 40, r.height - 40);
g.drawRectangle(r);
}
}

My problem is, when I add figures at the edges, the frame and the editor
expands, which is desired, but my figure intersects the frame. How can I
validate and expand the frame at this point so that the figure lies withing
the frame and not over it.

Thanks in advance,
Binti
Re: Frame on editor problem [message #170392 is a reply to message #170330] Fri, 04 March 2005 05:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: huangjun.cs.umb.edu

If I understand you correctly...
when you do sth to your models to impl adding a child figure onto your
frame, do you recalculate the size of the frame?

Best,
Jun

"Binti Sepaha" <binti@ksu.edu> wrote in message
news:d07f6p$k68$2@www.eclipse.org...
> Hi all,
>
> I am trying to make changes to the schema diagram editor example to get a
> better understanding of gef. I need to add af frame to the editor on which
> my figures would appear. I am able to do this by adding a recatngular
figure
> to the schemafigure. Schemafigure extends FreeformLayer. So the frame
> appears on it.
>
> The class schemafigure is as follows:
>
> public class SchemaFigure extends FreeformLayer
> {
> public SchemaFigure()
> {
> setOpaque(true);
> setBorder(new LineBorder(ColorConstants.white, 1));
> }
>
> protected void paintFigure(Graphics g)
> {
> Rectangle r = getBounds().getCopy();
> r.translate(20, 20);
> g.setLineWidth(2);
> g.drawRectangle(r.x, r.y, r.width - 40, r.height - 40);
> g.drawRectangle(r);
> }
> }
>
> My problem is, when I add figures at the edges, the frame and the editor
> expands, which is desired, but my figure intersects the frame. How can I
> validate and expand the frame at this point so that the figure lies
withing
> the frame and not over it.
>
> Thanks in advance,
> Binti
>
>
Re: Frame on editor problem [message #170399 is a reply to message #170392] Fri, 04 March 2005 05:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: huangjun.cs.umb.edu

Sorry. Just have a look at logic example...
Do you set a FreeformLayout instance as the LayoutManager of the frame?

"hunj" <huangjun@cs.umb.edu> wrote in message
news:d08rj5$2ji$1@www.eclipse.org...
> If I understand you correctly...
> when you do sth to your models to impl adding a child figure onto your
> frame, do you recalculate the size of the frame?
>
> Best,
> Jun
>
> "Binti Sepaha" <binti@ksu.edu> wrote in message
> news:d07f6p$k68$2@www.eclipse.org...
> > Hi all,
> >
> > I am trying to make changes to the schema diagram editor example to get
a
> > better understanding of gef. I need to add af frame to the editor on
which
> > my figures would appear. I am able to do this by adding a recatngular
> figure
> > to the schemafigure. Schemafigure extends FreeformLayer. So the frame
> > appears on it.
> >
> > The class schemafigure is as follows:
> >
> > public class SchemaFigure extends FreeformLayer
> > {
> > public SchemaFigure()
> > {
> > setOpaque(true);
> > setBorder(new LineBorder(ColorConstants.white, 1));
> > }
> >
> > protected void paintFigure(Graphics g)
> > {
> > Rectangle r = getBounds().getCopy();
> > r.translate(20, 20);
> > g.setLineWidth(2);
> > g.drawRectangle(r.x, r.y, r.width - 40, r.height - 40);
> > g.drawRectangle(r);
> > }
> > }
> >
> > My problem is, when I add figures at the edges, the frame and the editor
> > expands, which is desired, but my figure intersects the frame. How can I
> > validate and expand the frame at this point so that the figure lies
> withing
> > the frame and not over it.
> >
> > Thanks in advance,
> > Binti
> >
> >
>
>
Re: Frame on editor problem [message #170454 is a reply to message #170399] Fri, 04 March 2005 14:13 Go to previous message
Eclipse UserFriend
Originally posted by: binti.ksu.edu

As I mentioned the schemafigure extends a freeform layer and it extends when
the model becomes largea and the frame on it expands as well. I am trying to
recalculate the size of the frame and resetting its bounds, but it is not
doing so....i try to get the freeformextent and set it again. even if I use
setsize or setpreferred size for schema figure it does not show....it is
only following the default behaviour of expansion vertically and
horizontally upon adding childs. How can I control this behaviour?


Thanks in advance,
Binti

"hunj" <huangjun@cs.umb.edu> wrote in message
news:d08s8h$58i$1@www.eclipse.org...
> Sorry. Just have a look at logic example...
> Do you set a FreeformLayout instance as the LayoutManager of the frame?
>
> "hunj" <huangjun@cs.umb.edu> wrote in message
> news:d08rj5$2ji$1@www.eclipse.org...
>> If I understand you correctly...
>> when you do sth to your models to impl adding a child figure onto your
>> frame, do you recalculate the size of the frame?
>>
>> Best,
>> Jun
>>
>> "Binti Sepaha" <binti@ksu.edu> wrote in message
>> news:d07f6p$k68$2@www.eclipse.org...
>> > Hi all,
>> >
>> > I am trying to make changes to the schema diagram editor example to get
> a
>> > better understanding of gef. I need to add af frame to the editor on
> which
>> > my figures would appear. I am able to do this by adding a recatngular
>> figure
>> > to the schemafigure. Schemafigure extends FreeformLayer. So the frame
>> > appears on it.
>> >
>> > The class schemafigure is as follows:
>> >
>> > public class SchemaFigure extends FreeformLayer
>> > {
>> > public SchemaFigure()
>> > {
>> > setOpaque(true);
>> > setBorder(new LineBorder(ColorConstants.white, 1));
>> > }
>> >
>> > protected void paintFigure(Graphics g)
>> > {
>> > Rectangle r = getBounds().getCopy();
>> > r.translate(20, 20);
>> > g.setLineWidth(2);
>> > g.drawRectangle(r.x, r.y, r.width - 40, r.height - 40);
>> > g.drawRectangle(r);
>> > }
>> > }
>> >
>> > My problem is, when I add figures at the edges, the frame and the
>> > editor
>> > expands, which is desired, but my figure intersects the frame. How can
>> > I
>> > validate and expand the frame at this point so that the figure lies
>> withing
>> > the frame and not over it.
>> >
>> > Thanks in advance,
>> > Binti
>> >
>> >
>>
>>
>
>
Previous Topic:How to delete an editpart from the diagram
Next Topic:Visual folding editor - how?
Goto Forum:
  


Current Time: Fri Apr 26 02:33:45 GMT 2024

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

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

Back to the top