Login | Register
My pages Projects Community openCollabNet

Discussions > users > Re: [gef-users] PGML to GIF

gef
Discussion topic

Back to topic list

Re: [gef-users] PGML to GIF

Reply

Author raphael
Full name Raphael Langerhorst
Date 2003-06-01 01:35:35 PDT
Message Hello Loic!

Sorry for the delay...

You create the Editor with Editor(diagram). Have a look at this constructor of
Editor. It calls another constructor (which again calls another constructor)
in which a null reference is passed for _awt_component.

Now have a look at createImage(). It checks whether an _awt_component is set
and only creates an image if one is set. And with the constructor you use
_awt_component gets set to null. To avoid this you need to use another
constructor: Editor(GraphModel gm, Component awt_comp, Layer lay).

in your case something like:
editor = new Editor(diagram.getGraphModel(),
  [your_awt_component_​the_editor_works_in]​,
  diagram.getLayer());

the only thing you have to find out is which component you pass the editor - I
would suggest the component where the diagram is displayed in.

greetings,
Raphael

On Sunday 18 May 2003 11:05, lqn wrote:
> Hi,
>
> I am trying to convert a PGML diagram into a GIF image with the following
> code :
>
> Diagram diagram = PGMLParser.SINGLETON​.readDiagram(url);
> editor = new Editor(diagram);
> Rectangle clip = new Rectangle(0, 0, 100, 100);
> Image image = editor.createImage(clip.width, clip.height);
> Graphics graphics = image.getGraphics();
> ...
>
>
> Image image = editor.createImage(clip.width, clip.height); returns a null
> image. Why ? I suppose I have to instantiate the editor differently, but
> how can this easily be done if I do not want to build a fully fledged
> application, but only a standalone converter ?
>
> Thanks in advance for any help.
>
> Loïc QUERAN
>
>
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: users-unsubscribe@ge​f.tigris.org
> For additional commands, e-mail: users-help at gef dot tigris dot org


--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@ge​f.tigris.org
For additional commands, e-mail: users-help at gef dot tigris dot org

« Previous message in topic | 2 of 3 | Next message in topic »

Messages

Show all messages in topic

[gef-users] PGML to GIF lqn <loic dot queran at free dot fr> lqn <loic dot queran at free dot fr> 2003-05-18 02:05:27 PDT
     Re: [gef-users] PGML to GIF raphael Raphael Langerhorst 2003-06-01 01:35:35 PDT
     Re: [gef-users] PGML to GIF raphael Raphael Langerhorst 2003-06-01 01:38:21 PDT
Messages per page: