Skip to main content



      Home
Home » Eclipse Projects » GEF » Mixing 2d drawing and UI widgets
Mixing 2d drawing and UI widgets [message #20447] Wed, 25 September 2002 09:34 Go to next message
Eclipse UserFriend
Originally posted by: ed.burnette.no.spam.sas.com

Would GEF be appropriate for creating an editor or view that mixes standard
UI objects with freehand drawings? Something like this:
http://msdn.microsoft.com/vstudio/art/img_adoplusfig4.gif

In this case you don't want to try to emulate the standard widgets (lists,
grids, etc.), you just want to use the real native widgets and windows but
add some annotation around them (for example showing the relationship
between tables and nodes, that sort of thing).

Advice on how to use GEF for something like this or on a better way to go
would be appreciated. I'm just learning about Eclipse and building plugins
so pardon me if this is a misguided question. I searched the archives and
faq first but didn't see a relevant answer. TIA.

-- Ed
(remove no.spam. from email)
Re: Mixing 2d drawing and UI widgets [message #20638 is a reply to message #20447] Wed, 25 September 2002 11:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hudsonr.us.eye-bee-em.com

You could do something that looks like that by writing your own "table"
Figure. This would be a really cool thing to add to draw2d. Others have
done this already. Some people have placed SWT Tables directly on the
Graphical Viewer, but this has limitations, because you can't paint on top
of that table very easily, and you'd have to customize the viewer a lot.

"Ed Burnette" <ed.burnette@no.spam.sas.com> wrote in message
news:amscsv$cnh$1@rogue.oti.com...
> Would GEF be appropriate for creating an editor or view that mixes
standard
> UI objects with freehand drawings? Something like this:
> http://msdn.microsoft.com/vstudio/art/img_adoplusfig4.gif
>
> In this case you don't want to try to emulate the standard widgets (lists,
> grids, etc.), you just want to use the real native widgets and windows but
> add some annotation around them (for example showing the relationship
> between tables and nodes, that sort of thing).

Actually, there are reasons to emulate tables, but maybe none of them
applies to what you are trying to do. Reasons might include changing the
appearance of a TableItem, better "cell" support, and support for really
large data sets.

>
> Advice on how to use GEF for something like this or on a better way to go
> would be appreciated. I'm just learning about Eclipse and building plugins
> so pardon me if this is a misguided question. I searched the archives and
> faq first but didn't see a relevant answer. TIA.
>
> -- Ed
> (remove no.spam. from email)
>
>
Re: Mixing 2d drawing and UI widgets [message #21216 is a reply to message #20638] Thu, 26 September 2002 17:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mec.enteract.com

We're grappling with a similar problem here - we want to basically throw an
entire custom panel of widgets (buttons, list boxes, tables, whatever)
inside of a figure in a GEF editor as a connectible figure. Here's what
we've been futzing around with and can't get to work:

1) Derive our object (InteractionFigure) from Figure
2) Add a myComposite member that is a new SWT Composite
3) Then, we overload the paint function in InteractionFigure to resize
myComposite to be in the exact place and size as the InteractionFigure.
Then we tell myComposite to redraw.

Obviously this isn't working, so I'm worried that as a newbie I just don't
understand something fundamental. Will this ever work? Can I have a
floating Composite that sits on top of my figure that gets repainted at the
right times and contains a set of SWT widgets?

Thanks,
Michael



"Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
news:amsi4q$gib$1@rogue.oti.com...
> You could do something that looks like that by writing your own "table"
> Figure. This would be a really cool thing to add to draw2d. Others have
> done this already. Some people have placed SWT Tables directly on the
> Graphical Viewer, but this has limitations, because you can't paint on top
> of that table very easily, and you'd have to customize the viewer a lot.
>
> "Ed Burnette" <ed.burnette@no.spam.sas.com> wrote in message
> news:amscsv$cnh$1@rogue.oti.com...
> > Would GEF be appropriate for creating an editor or view that mixes
> standard
> > UI objects with freehand drawings? Something like this:
> > http://msdn.microsoft.com/vstudio/art/img_adoplusfig4.gif
> >
> > In this case you don't want to try to emulate the standard widgets
(lists,
> > grids, etc.), you just want to use the real native widgets and windows
but
> > add some annotation around them (for example showing the relationship
> > between tables and nodes, that sort of thing).
>
> Actually, there are reasons to emulate tables, but maybe none of them
> applies to what you are trying to do. Reasons might include changing the
> appearance of a TableItem, better "cell" support, and support for really
> large data sets.
>
> >
> > Advice on how to use GEF for something like this or on a better way to
go
> > would be appreciated. I'm just learning about Eclipse and building
plugins
> > so pardon me if this is a misguided question. I searched the archives
and
> > faq first but didn't see a relevant answer. TIA.
> >
> > -- Ed
> > (remove no.spam. from email)
> >
> >
>
>
Re: Mixing 2d drawing and UI widgets [message #21483 is a reply to message #21216] Thu, 26 September 2002 21:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hudsonr.us.eye-bee-em.com

"Michael Cloran" <mec@enteract.com> wrote in message
news:amvrrm$duj$1@rogue.oti.com...
>
> We're grappling with a similar problem here - we want to basically throw
an
> entire custom panel of widgets (buttons, list boxes, tables, whatever)
> inside of a figure in a GEF editor as a connectible figure. Here's what
> we've been futzing around with and can't get to work:
>
> 1) Derive our object (InteractionFigure) from Figure
> 2) Add a myComposite member that is a new SWT Composite
> 3) Then, we overload the paint function in InteractionFigure to resize
> myComposite to be in the exact place and size as the InteractionFigure.

You should use an AncestorListener. This is what the selection handles in
GEF use to follow a figure. When the ancestor listener is notified, you
need to take the InteractionFigure's Bounds, and then call
interactionFigure.translateToAbsolute(copiedBoundsRectangle) , then place the
native composite in that location.

> Then we tell myComposite to redraw.
>
> Obviously this isn't working, so I'm worried that as a newbie I just don't
> understand something fundamental. Will this ever work? Can I have a
> floating Composite that sits on top of my figure that gets repainted at
the
> right times and contains a set of SWT widgets?

You never have to ask native controls to repaint. This is automatic. It
should work, but with the limitations mentioned before.
>
> Thanks,
> Michael
>
>
>
> "Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
> news:amsi4q$gib$1@rogue.oti.com...
> > You could do something that looks like that by writing your own "table"
> > Figure. This would be a really cool thing to add to draw2d. Others
have
> > done this already. Some people have placed SWT Tables directly on the
> > Graphical Viewer, but this has limitations, because you can't paint on
top
> > of that table very easily, and you'd have to customize the viewer a lot.
> >
> > "Ed Burnette" <ed.burnette@no.spam.sas.com> wrote in message
> > news:amscsv$cnh$1@rogue.oti.com...
> > > Would GEF be appropriate for creating an editor or view that mixes
> > standard
> > > UI objects with freehand drawings? Something like this:
> > > http://msdn.microsoft.com/vstudio/art/img_adoplusfig4.gif
> > >
> > > In this case you don't want to try to emulate the standard widgets
> (lists,
> > > grids, etc.), you just want to use the real native widgets and windows
> but
> > > add some annotation around them (for example showing the relationship
> > > between tables and nodes, that sort of thing).
> >
> > Actually, there are reasons to emulate tables, but maybe none of them
> > applies to what you are trying to do. Reasons might include changing
the
> > appearance of a TableItem, better "cell" support, and support for really
> > large data sets.
> >
> > >
> > > Advice on how to use GEF for something like this or on a better way to
> go
> > > would be appreciated. I'm just learning about Eclipse and building
> plugins
> > > so pardon me if this is a misguided question. I searched the archives
> and
> > > faq first but didn't see a relevant answer. TIA.
> > >
> > > -- Ed
> > > (remove no.spam. from email)
> > >
> > >
> >
> >
>
>
Re: Mixing 2d drawing and UI widgets [message #21849 is a reply to message #20638] Fri, 27 September 2002 09:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ed.burnette.no.spam.sas.com

Do you have any examples I could look at?

"Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
news:amsi4q$gib$1@rogue.oti.com...
> You could do something that looks like that by writing your own "table"
> Figure. This would be a really cool thing to add to draw2d. Others have
> done this already. Some people have placed SWT Tables directly on the
> Graphical Viewer, but this has limitations, because you can't paint on top
> of that table very easily, and you'd have to customize the viewer a lot.
>
Re: Mixing 2d drawing and UI widgets [message #25903 is a reply to message #21483] Wed, 09 October 2002 06:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mec.enteract.com

The below was great advice. Thanks Randy.

The AncestorListener works great. Everytime I move a figure the moved
function gets called and all I do is this:
public void ancestorMoved(IFigure ancestor) {

Rectangle rect = getFigure().getBounds();

getFigure().translateToAbsolute(rect);

wrapperPanel.setBounds(rect.x+1, rect.y+1, rect.width-2, rect.height-2);

}

I thought I was done a week ago...then tonight (this morning since it is now
6am?) I finally used the scrollbars and *shock* the figure borders move when
the scrollbars move but my panels that were floating on top of them stay
still. I can't believe I didn't notice this until now.

Anyway - I'm probably just being lazy - but is there the equivalent of
'AncestorListener' for when the main panel is scrolled? I've looked through
ScrollingGraphicalViewer and FreeformGraphicalRootEditPart and can't find
any obvious place to pick up this event.

Sorry if this is an obvious question - been at work for 21 hours now...
Michael

> "Michael Cloran" <mec@enteract.com> wrote in message
> news:amvrrm$duj$1@rogue.oti.com...
> >
> > We're grappling with a similar problem here - we want to basically throw
> an
> > entire custom panel of widgets (buttons, list boxes, tables, whatever)
> > inside of a figure in a GEF editor as a connectible figure. Here's what
> > we've been futzing around with and can't get to work:
> >
> > 1) Derive our object (InteractionFigure) from Figure
> > 2) Add a myComposite member that is a new SWT Composite
> > 3) Then, we overload the paint function in InteractionFigure to resize
> > myComposite to be in the exact place and size as the InteractionFigure.
>
> You should use an AncestorListener. This is what the selection handles in
> GEF use to follow a figure. When the ancestor listener is notified, you
> need to take the InteractionFigure's Bounds, and then call
> interactionFigure.translateToAbsolute(copiedBoundsRectangle) , then place
the
> native composite in that location.
>
> > Then we tell myComposite to redraw.
> >
> > Obviously this isn't working, so I'm worried that as a newbie I just
don't
> > understand something fundamental. Will this ever work? Can I have a
> > floating Composite that sits on top of my figure that gets repainted at
> the
> > right times and contains a set of SWT widgets?
>
> You never have to ask native controls to repaint. This is automatic. It
> should work, but with the limitations mentioned before.
> >
> > Thanks,
> > Michael
> >
> >
> >
> > "Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
> > news:amsi4q$gib$1@rogue.oti.com...
> > > You could do something that looks like that by writing your own
"table"
> > > Figure. This would be a really cool thing to add to draw2d. Others
> have
> > > done this already. Some people have placed SWT Tables directly on the
> > > Graphical Viewer, but this has limitations, because you can't paint on
> top
> > > of that table very easily, and you'd have to customize the viewer a
lot.
> > >
> > > "Ed Burnette" <ed.burnette@no.spam.sas.com> wrote in message
> > > news:amscsv$cnh$1@rogue.oti.com...
> > > > Would GEF be appropriate for creating an editor or view that mixes
> > > standard
> > > > UI objects with freehand drawings? Something like this:
> > > > http://msdn.microsoft.com/vstudio/art/img_adoplusfig4.gif
> > > >
> > > > In this case you don't want to try to emulate the standard widgets
> > (lists,
> > > > grids, etc.), you just want to use the real native widgets and
windows
> > but
> > > > add some annotation around them (for example showing the
relationship
> > > > between tables and nodes, that sort of thing).
> > >
> > > Actually, there are reasons to emulate tables, but maybe none of them
> > > applies to what you are trying to do. Reasons might include changing
> the
> > > appearance of a TableItem, better "cell" support, and support for
really
> > > large data sets.
> > >
> > > >
> > > > Advice on how to use GEF for something like this or on a better way
to
> > go
> > > > would be appreciated. I'm just learning about Eclipse and building
> > plugins
> > > > so pardon me if this is a misguided question. I searched the
archives
> > and
> > > > faq first but didn't see a relevant answer. TIA.
> > > >
> > > > -- Ed
> > > > (remove no.spam. from email)
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Mixing 2d drawing and UI widgets [message #26307 is a reply to message #25903] Wed, 09 October 2002 10:42 Go to previous message
Eclipse UserFriend
Originally posted by: hudsonr.us.eye-bee-em.com

"Michael Cloran" <mec@enteract.com> wrote in message
news:ao0vvv$hri$1@rogue.oti.com...
> The below was great advice. Thanks Randy.
>
> The AncestorListener works great. Everytime I move a figure the moved
> function gets called and all I do is this:
> public void ancestorMoved(IFigure ancestor) {
>
> Rectangle rect = getFigure().getBounds();
>
> getFigure().translateToAbsolute(rect);
>
> wrapperPanel.setBounds(rect.x+1, rect.y+1, rect.width-2, rect.height-2);
>
> }
>
> I thought I was done a week ago...then tonight (this morning since it is
now
> 6am?) I finally used the scrollbars and *shock* the figure borders move
when
> the scrollbars move but my panels that were floating on top of them stay
> still. I can't believe I didn't notice this until now.
>
> Anyway - I'm probably just being lazy - but is there the equivalent of
> 'AncestorListener' for when the main panel is scrolled? I've looked
through
> ScrollingGraphicalViewer and FreeformGraphicalRootEditPart and can't find
> any obvious place to pick up this event.
>
> Sorry if this is an obvious question - been at work for 21 hours now...
> Michael

This has been fixed (yea!) so that scrolling the ScrollingGraphicalViewer
(which uses FigureCanvas), will also scroll any SWT Controls that are
*children* of the FigureCanvas. Notification is *purposely* disabled for
that scrolling to prevent the entire diagram from laying out when nothing is
moving. (Actually, just the connection and selection handles would think
that they need to layout, but its still wasteful).

This fix is in CVS for now. Eclipse.org has almost ironed out build issues
with us so that we can provide nightly builds via an automated build page.
If you want to try the fix locally, hack FigureCanvas.scrollToY(int) so that
the call to scroll(int, int, int, .... boolean); has *true* at the end (the
last parameter).
Previous Topic:How modelize & control & draw n-m / multivalued relationships with GEF?
Next Topic:How to find out the width/height of a Label in draw2d
Goto Forum:
  


Current Time: Fri Apr 25 01:53:56 EDT 2025

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

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

Back to the top