I think I have figured out why my pluggable rendering system didn't
throw a NullPointerExcpetion when loading a new Layer, but why it does
when OpenJUMP starts with a new or empty project, or when the Layer
View is panned or zoomed.

I believe the LayerViewPanel.paintComponent() method calls the
RenderingManager.copyTo() method. The RenderingManager.copyTo() method
calls the copyTo() method of each Renderer associated with the
RenderingManager. In this path of execution no call is ever made to
the RenderingManager.repaint() method.

I believe that the LayerViewPanel.repaint() method should first
determine if there are any valid ConentIDs to paint before execution
proceeds. If there is not any valid ContentIDs this method should make
a call to super.repaint() so only the painting of the JPanel
underlying the LayerViewPanel takes place. If there is valid
ContentIDs this method needs to call the RenderingManager.renderAll()
method instead.

Jon was checking for valid ContentIDs by seeing if the
RenderingManager associated with the LayerViewPanel had been
initialized. I think that I changes I made to the rendering code will
not allow this to work, although I can't identify what changes of mine
caused this.

Here is what I am going to try:

I'm going to make the RenderingManager.contentIDs() method public. I
will then call this method from the body of the repaint() method. If
this method returns false, which indicates that there are no valid
ContentIDs to render, I'll just call super.repaint. If the method
returns true, there are valid ContentIDs to paint and I'll call
RenderingManager.renderAll() instead.

This means that the repaint() method of the JPanel class will be
called when there are no Layers, scale bars, or other things to paint.
(For example, when OpenJUMP fires up with an empty or new project.)
When the user has added Layers to the LayerManager the
RenderingManager.renderAll() method will be called instead.

I hope this will fix my problem. If you have seen something that I
have overlooked please let me know.

SS

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to