Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Draw2D Figures
Draw2D Figures [message #217450] Tue, 06 June 2006 12:43 Go to next message
Manuel Selva is currently offline Manuel SelvaFriend
Messages: 189
Registered: July 2009
Location: Grenoble, France
Senior Member
Hi every body,

I have got one question, still about my very large number of draw2D
figures. is it possible, using Draw2D, to reuse an already drawn figure in
an other location into the same parent figure. In other words, is it
possible with only one figure instance into the JVM to draw this figure 2
or more times into my panel??

for example:

myPanel.add(myFigure, new Rectangle(10,10,10,10);
myPanel.add(myFigure, new Rectangle(50,50,10,10);

Thanks

Manu


Re: Draw2D Figures [message #217464 is a reply to message #217450] Tue, 06 June 2006 16:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: guedes.bruno.gmail.com

Hi,

Perhaps, you could use the flyweight design pattern ....

Hasta luego

Bruno
Re: Draw2D Figures [message #217471 is a reply to message #217464] Tue, 06 June 2006 20:08 Go to previous messageGo to next message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
and you'd have to implement the IFigure interface yourself...unless you can
figure out a way to subclass Figure and have it ignore it's state for
position and size.

-Steve

"bguedes" <guedes.bruno@gmail.com> wrote in message
news:b1352560cd83670e93541f0a80e8733f$1@www.eclipse.org...
> Hi,
>
> Perhaps, you could use the flyweight design pattern ....
>
> Hasta luego
>
> Bruno
>
Re: Draw2D Figures [message #217542 is a reply to message #217450] Wed, 07 June 2006 18:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Yes, you can simply ask a figure to paint on a Graphics. You may have to
translate the graphics to get the desired placement, and most figures
require a parent, which can simply be set to some figure in the diagram.

If you need to alter the figure before it paints, slightly more is involved.
You may have to validate() it.

"Manu" <manuel.selva@st.com> wrote in message
news:15231f7ed6c0334b6701c48cd7f2150c$1@www.eclipse.org...
> Hi every body,
>
> I have got one question, still about my very large number of draw2D
> figures. is it possible, using Draw2D, to reuse an already drawn figure in
> an other location into the same parent figure. In other words, is it
> possible with only one figure instance into the JVM to draw this figure 2
> or more times into my panel??
>
> for example:
>
> myPanel.add(myFigure, new Rectangle(10,10,10,10);
> myPanel.add(myFigure, new Rectangle(50,50,10,10);
>
> Thanks
>
> Manu
>
Re: Draw2D Figures [message #217554 is a reply to message #217450] Thu, 08 June 2006 06:30 Go to previous message
Manuel Selva is currently offline Manuel SelvaFriend
Messages: 189
Registered: July 2009
Location: Grenoble, France
Senior Member
Thanks every body,

I was just thinking about using the flying pattern to reduce the number of
draw2d figures in my chart. But i think it is impossible to do it using
the classic Draw2D figures wich implements the Figure class. Isn't it ??
Shoul i have to implement my own figures by implementing the IFigure like
Steven said interface or is there an other easier way to do this ??

Thanks.

PS : If someone has already used the flyweight pattern with Draw2D please
can you send me a piece of code wich explain how in more details.

Manu


Previous Topic:Re:ANN: article "Java 2D imaging for the Standard Widget Toolkit"
Next Topic:Need help in designing Figure with Anchors
Goto Forum:
  


Current Time: Wed Jan 22 09:08:22 GMT 2025

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

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

Back to the top