[Nifty] Interaction between two Nifty Instances --Solved

Hello,



I’m still on my toolbar.

I now get another problem :



One of the functionnality I want to implement is ‘Changing view’

That means :

  • Changing the 3D scene behind my GUIs
  • Resetting my toolbar



    I’ve managed to change my 3D scene but i get an error when trying to reset my toolbar

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:663)


It seems it need to queue my actions but I don't really know how to do it.

Here is a Sum Up of the cycle

- [application] start
- [application] create the Controller [A]
- [application] create the toobar GUI and link it to [A]
- [application] read the view it needs to load
- [application] create the other GUI(s) needed for this view.
- for each GUI :
# [gui] load its components
# [gui] register itself to [A] ( via a singleton )
# [A] add an icon for this gui in the toolbar.
# [A] store the controller
- waiting for human action
- ...
- [human] click on a button of a [gui] that change the view
- [gui] launch the view switch ( via singleton )
- [application] reset the toobar
# [A] remove icon and reference to each [gui]
# [A] close gui
## [gui] nifty.exit() (1)
- [application] change the 3D scene
- create the other GUI(s) needed for this view.
- for each GUI :
# [gui] load its components
# [gui] register itself to [A] ( via a singleton )
# [A] add an icon for this gui in the toolbar. (2)
# [A] store the controller
- waiting for human action


I've got problems on steps (1) and (2).:

In the beginning in my [gui] part, I did :
[java]
public void loadGame()
{
ViewManager.goToPlace( "battleTest", "battleTest" );
}
[/java]
( ViewManager is my singleton )
But there were a probleme with step (1) : [A] was trying to destroy [gui] while [gui] was the caller.
So I changed it to that :
[java]
public void loadGame()
{
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
ViewManager.goToPlace( "battleTest", "battleTest" );
}
});
}
[/java]

Now step (1) works but ... not step (2) :(

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:663)



I tried to be succinct, but I don't know if you will have enough data to understand the problem.
I can give the sources if needed.

If someone can help...

You need to do every modification of “live” things from the OpenGL thread:

[snippet id=“10”]

Wonderfull !!

It works!



In the beginning I had some issue because my binding task was called after another - but now I works great !



Thanks a lot!