Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Draw figure differently depending on state
Draw figure differently depending on state [message #172178] Wed, 16 March 2005 21:47 Go to next message
Beth Tibbitts is currently offline Beth TibbittsFriend
Messages: 231
Registered: July 2009
Senior Member
I know this is going to be obvious once I write it down, but..
I want to draw a figure differently, depending on its state.
Item C can contain one or more of item E.
Specifically, if an item E is "collapsed" inside item C, it will be rawn
as a small figure inside the figure for C. If not collapsed, it will be
a larger figure, with
connections back to the parent figure. Or probably a connection back
to the "collapsed" small figure inside the C. So I guess both the
inside/collapsed and outside/expanded/elaborated figure are shown in
this case.

How does the figure class know its state, to know what to draw?
only the editpart can access this info. The figure can't see its model.
Actually, I may not even want to store this info in the model, it's
purely to know how to visually represent the model, has nothing to
do with the model objects themselves. If I store it in the editpart or
the model,
how does the figure know it in order to know how to paint itself?

I know how to return editpart.getModelChildren() and return children or
not, based on whether or not to draw them, but how do I give info to the
figure on *how* to draw themselves based on state?

Maybe what I draw "inside" the C is not the E figures, but a different
view of the C itself ("mini-E's"). But again, how to I reference the
content in an intelligent manner?

Thanks, I feel like this is obvious, but haven't found the answer yet.
....Beth
Re: Draw figure differently depending on state [message #172186 is a reply to message #172178] Wed, 16 March 2005 22:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Beth Tibbitts wrote:
> I know this is going to be obvious once I write it down, but..
> I want to draw a figure differently, depending on its state.
> Item C can contain one or more of item E.
> Specifically, if an item E is "collapsed" inside item C, it will be rawn
> as a small figure inside the figure for C. If not collapsed, it will be
> a larger figure, with
> connections back to the parent figure. Or probably a connection back
> to the "collapsed" small figure inside the C. So I guess both the
> inside/collapsed and outside/expanded/elaborated figure are shown in
> this case.
>
> How does the figure class know its state, to know what to draw?
> only the editpart can access this info. The figure can't see its model.
> Actually, I may not even want to store this info in the model, it's
> purely to know how to visually represent the model, has nothing to
> do with the model objects themselves. If I store it in the editpart or
> the model,
> how does the figure know it in order to know how to paint itself?
>

tell the edit part to return a different figure.one that meets the needs
of the current state of the model/view.

Then ask the edit part to be redrawn.



> I know how to return editpart.getModelChildren() and return children or
> not, based on whether or not to draw them, but how do I give info to the
> figure on *how* to draw themselves based on state?

As stated, the editPart controls the way it is displayed based on the
figure it returns. If you want a different look, return a different figure.

>
> Maybe what I draw "inside" the C is not the E figures, but a different
> view of the C itself ("mini-E's"). But again, how to I reference the
> content in an intelligent manner?
>
> Thanks, I feel like this is obvious, but haven't found the answer yet.
> ...Beth
Re: Draw figure differently depending on state [message #172235 is a reply to message #172186] Thu, 17 March 2005 02:41 Go to previous message
Beth Tibbitts is currently offline Beth TibbittsFriend
Messages: 231
Registered: July 2009
Senior Member
CL [dnoyeb] Gilbert wrote:
> tell the edit part to return a different figure.one that meets the needs
> of the current state of the model/view.

I knew it should have been obvious! Thanks.
Previous Topic:model change notification from commands
Next Topic:GEF & Draw2D on Linux/GTK
Goto Forum:
  


Current Time: Thu Apr 25 06:18:34 GMT 2024

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

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

Back to the top