DisplaySystem and Multiple Canvases in JME2.0

Hello everyone

I am working on a multicanvas Swing-JME applications, and i am switching the rendering from JME1.0 to JME2.0.

So far I have used a context management system based on the one coming with Radakan, that uses a custom ContextDisplaySystem.

In the constructor of my ContextDisplaySystem I init the SystemProvider for the application this way:

system = new ContextSystemProvider(this);


where my ContextSystemProvider has this minimal implementation:


public class ContextSystemProvider implements SystemProvider {

   protected ContextDisplaySystem display;

   public ContextSystemProvider(ContextDisplaySystem display) {
      this.display = display;
   }

   public String getProviderIdentifier() {
      return "CONTEXT";
   }

   public DisplaySystem getDisplaySystem() {
      if (display == null) {
         display = new ContextDisplaySystem();
      }
      return display;
   }

   public void disposeDisplaySystem() {
      JmeContext.get().dispose();
   }

   public Timer getTimer() {
      return JmeContext.get().getTimer();
   }

   public void installLibs() {
   }

}



The fact is that I can no more init my ContextDisplaySystem in my code because, from 1.0 to 2.0, the visibility of the system variable (the DisplaySystem's variable keeping the SystemProvider) has changed from protected to private. What is the reason of this visibility change? Wouldn't be good to leave it protected so the user can plug its rendering system provider?
Notice that this could be solved by using the method DisplaySystem.setSystemProvider() instead of directly assigning the variable, but this doesn't work because if i do this i get a

java.lang.IllegalStateException: SystemProvider already set



Maybe this last thing is a bug? Or what is the reason to prevent the user from setting the SystemProvider if already set?

Actually it seems like i did quite a newbie error… the things work perfectly initing the ContextDisplaySystem resetting the default system provider before setting the new one.



   public ContextDisplaySystem() {
      resetSystemProvider();
      setSystemProvider(new ContextSystemProvider(this));
      created = true;
   }



I hope this will learn you to read the code of the classes (or at least the JavaDocs).. I for sure have learned to do it now!