How to render the PApplet in my own application

Please use a mailing-list, see http://gephi.org/developers/
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
lwbiuchsjk
Posts:3
Joined:03 Jul 2013 08:49
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
How to render the PApplet in my own application

Post by lwbiuchsjk » 03 Jul 2013 09:03

hi there,

I am creating my application with gephi, but when I render the PApplet in my own code with PreviewController.render(), it will return the NullPointerException.

here is the part of my code:

ProcessingTarget target = (ProcessingTarget) previewController.getRenderTarget(RenderTarget.PROCESSING_TARGET, show.workspace);
previewController.render(target, show.workspace);
PApplet applet = target.getApplet();

here is the excepetion:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.gephi.preview.plugin.renderers.EdgeRenderer.renderStraightEdge(EdgeRenderer.java:348)
at org.gephi.preview.plugin.renderers.EdgeRenderer.render(EdgeRenderer.java:188)
at org.gephi.preview.PreviewControllerImpl.render(PreviewControllerImpl.java:299)
at org.gephi.preview.PreviewControllerImpl.render(PreviewControllerImpl.java:256)

And the exception is always the same!

How can I deal with that!

Thanks a lot!

lwbiuchsjk
Posts:3
Joined:03 Jul 2013 08:49
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: How to render the PApplet in my own application

Post by lwbiuchsjk » 06 Jul 2013 04:06

Now I know the reason is that I do not initial the applet.
But I still do not know how to start the render in my own application. In fact, I want to make a function when I type a node's name in the textField, the render will start automatically. How can I deal with that?

Thanks !

bsunders
Posts:5
Joined:24 Jul 2013 06:15
Location:Sydney, Australia
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: How to render the PApplet in my own application

Post by bsunders » 24 Jul 2013 06:35

Hi I get the same error but with more in the trace:

Exception in thread "AWT-EventQueue-0" sun.dc.pr.PRError: setPenT4: invalid pen transformation (singular)
at sun.dc.pr.PathStroker.setPenT4(Native Method)
at sun.dc.pr.Rasterizer.setPenT4(Rasterizer.java:232)
at sun.dc.DuctusRenderingEngine.getAATileGenerator(DuctusRenderingEngine.java:409)
at sun.java2d.pipe.AAShapePipe.renderPath(AAShapePipe.java:151)
at sun.java2d.pipe.AAShapePipe.draw(AAShapePipe.java:64)
at sun.java2d.pipe.PixelToParallelogramConverter.draw(PixelToParallelogramConverter.java:148)
at sun.java2d.pipe.ValidatePipe.draw(ValidatePipe.java:154)
at sun.java2d.SunGraphics2D.draw(SunGraphics2D.java:2398)
at processing.core.PGraphicsJava2D.drawShape(Unknown Source)
at processing.core.PGraphicsJava2D.endShape(Unknown Source)
at processing.core.PGraphics.endShape(Unknown Source)
at processing.core.PGraphics.bezier(Unknown Source)
at org.gephi.preview.plugin.renderers.EdgeRenderer.renderCurvedEdge(EdgeRenderer.java:279)
at org.gephi.preview.plugin.renderers.EdgeRenderer.render(EdgeRenderer.java:186)
at org.gephi.preview.PreviewControllerImpl.render(PreviewControllerImpl.java:299)

My code is based on the wiki:

Code: Select all

ProcessingTarget target = (ProcessingTarget) previewController.getRenderTarget(RenderTarget.PROCESSING_TARGET);
		
		PApplet applet = target.getApplet();
		applet.init();

		previewController.render(target);
		target.refresh();
		target.resetZoom();

		return applet;
		//next two lines need to be refactor

and then:

Code: Select all

	PApplet applet;
		applet = tsb.buildGraph();  // returns applet per above code
		contentPane2.add( applet, BorderLayout.CENTER);
		applet.mousePressed();
		this.pack();



As you can see I call the init() function but still get the NPE. It seems to be intermittentent .
I tried upgrading JDK on my Mac but same level of NPE.
Are you on Mac - did you resolve altogether ?



Image

https://www.evernote.com/shard/s78/sh/7 ... 22bf8337f0

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable