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 #170322] Thu, 03 March 2005 16:29 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.
Re: Frame on editor problem [message #170920 is a reply to message #170322] Tue, 08 March 2005 04:48 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Are the child's constraints being set on the parent? Maybe a screenshot
will help better understand the problem.

The SchemaFigure is your content figure, right? What are you doing in
paintFigure()? Set a border with insets of 20, 20, 20, 20 if you want a
thick border and it will resize correctly.

"Binti Sepaha" <binti@ksu.edu> wrote in message
news:d07f6p$k68$1@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.
>
>
Re: Frame on editor problem [message #171263 is a reply to message #170920] Thu, 10 March 2005 22:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: binti.ksu.edu

Yes, The schema figure is the content figure which extends freeformlayout. I
am including the snapshot. But the problem the bounds of the figure increase
only when I drag an element to the extremes but then my frame becomes a
problem, because the frame is just a rectangle on the schema figure. The
user should not be able to select it or delete it. It should be there. It
extends accordingly but the problem is the overlap of figure as shown in the
picture.

Please help me as what to do...

Binti.

"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:d0jaqf$elb$1@www.eclipse.org...
> Are the child's constraints being set on the parent? Maybe a screenshot
> will help better understand the problem.
>
> The SchemaFigure is your content figure, right? What are you doing in
> paintFigure()? Set a border with insets of 20, 20, 20, 20 if you want a
> thick border and it will resize correctly.
>
> "Binti Sepaha" <binti@ksu.edu> wrote in message
> news:d07f6p$k68$1@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.
>>
>>
>
>


  • Attachment: frame.JPG
    (Size: 149.59KB, Downloaded 100 times)
Re: Frame on editor problem [message #171535 is a reply to message #171263] Mon, 14 March 2005 01:29 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Create the frame as a border, instead of a rectangle figure, and you'll be
fine.

"Binti Sepaha" <binti@ksu.edu> wrote in message
news:d0qhgj$45u$1@www.eclipse.org...
> Yes, The schema figure is the content figure which extends freeformlayout.
I
> am including the snapshot. But the problem the bounds of the figure
increase
> only when I drag an element to the extremes but then my frame becomes a
> problem, because the frame is just a rectangle on the schema figure. The
> user should not be able to select it or delete it. It should be there. It
> extends accordingly but the problem is the overlap of figure as shown in
the
> picture.
>
> Please help me as what to do...
>
> Binti.
>
> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> news:d0jaqf$elb$1@www.eclipse.org...
> > Are the child's constraints being set on the parent? Maybe a screenshot
> > will help better understand the problem.
> >
> > The SchemaFigure is your content figure, right? What are you doing in
> > paintFigure()? Set a border with insets of 20, 20, 20, 20 if you want a
> > thick border and it will resize correctly.
> >
> > "Binti Sepaha" <binti@ksu.edu> wrote in message
> > news:d07f6p$k68$1@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.
> >>
> >>
> >
> >
>
>
>
Re: Frame on editor problem [message #174777 is a reply to message #171535] Fri, 01 April 2005 01:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: binti.ksu.edu

Thanks Pratik,

It worked for me. I used a margin border.

Binti.

"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:d12pdg$moc$1@www.eclipse.org...
> Create the frame as a border, instead of a rectangle figure, and you'll be
> fine.
>
> "Binti Sepaha" <binti@ksu.edu> wrote in message
> news:d0qhgj$45u$1@www.eclipse.org...
>> Yes, The schema figure is the content figure which extends
>> freeformlayout.
> I
>> am including the snapshot. But the problem the bounds of the figure
> increase
>> only when I drag an element to the extremes but then my frame becomes a
>> problem, because the frame is just a rectangle on the schema figure. The
>> user should not be able to select it or delete it. It should be there. It
>> extends accordingly but the problem is the overlap of figure as shown in
> the
>> picture.
>>
>> Please help me as what to do...
>>
>> Binti.
>>
>> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
>> news:d0jaqf$elb$1@www.eclipse.org...
>> > Are the child's constraints being set on the parent? Maybe a
>> > screenshot
>> > will help better understand the problem.
>> >
>> > The SchemaFigure is your content figure, right? What are you doing in
>> > paintFigure()? Set a border with insets of 20, 20, 20, 20 if you want
>> > a
>> > thick border and it will resize correctly.
>> >
>> > "Binti Sepaha" <binti@ksu.edu> wrote in message
>> > news:d07f6p$k68$1@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.
>> >>
>> >>
>> >
>> >
>>
>>
>>
>
>
Re: Frame on editor problem [message #175480 is a reply to message #174777] Mon, 04 April 2005 22:33 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
A MarginBorder just leaves some empty space so I don't know how you did
this. Did you subclass it? You should use a LineBorder.

"Binti Sepaha" <binti@ksu.edu> wrote in message
news:d2i7mv$ehm$1@news.eclipse.org...
> Thanks Pratik,
>
> It worked for me. I used a margin border.
>
> Binti.
>
> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> news:d12pdg$moc$1@www.eclipse.org...
> > Create the frame as a border, instead of a rectangle figure, and you'll
be
> > fine.
> >
> > "Binti Sepaha" <binti@ksu.edu> wrote in message
> > news:d0qhgj$45u$1@www.eclipse.org...
> >> Yes, The schema figure is the content figure which extends
> >> freeformlayout.
> > I
> >> am including the snapshot. But the problem the bounds of the figure
> > increase
> >> only when I drag an element to the extremes but then my frame becomes a
> >> problem, because the frame is just a rectangle on the schema figure.
The
> >> user should not be able to select it or delete it. It should be there.
It
> >> extends accordingly but the problem is the overlap of figure as shown
in
> > the
> >> picture.
> >>
> >> Please help me as what to do...
> >>
> >> Binti.
> >>
> >> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> >> news:d0jaqf$elb$1@www.eclipse.org...
> >> > Are the child's constraints being set on the parent? Maybe a
> >> > screenshot
> >> > will help better understand the problem.
> >> >
> >> > The SchemaFigure is your content figure, right? What are you doing
in
> >> > paintFigure()? Set a border with insets of 20, 20, 20, 20 if you
want
> >> > a
> >> > thick border and it will resize correctly.
> >> >
> >> > "Binti Sepaha" <binti@ksu.edu> wrote in message
> >> > news:d07f6p$k68$1@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.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >>
> >
> >
>
>
Previous Topic:Creating a container editpart
Next Topic:GEF TreeViewer
Goto Forum:
  


Current Time: Sat Apr 27 03:05:33 GMT 2024

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

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

Back to the top