Subject: | |
From: | |
Reply To: | |
Date: | Tue, 22 Jan 2019 13:59:40 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
There's some overuse of the term volatility, and that's my fault no doubt. :-)
INSPECTORS can be volatile. This means that they're updated every time step [the default]. The alternative is that they're only updated when you press a "refresh" button.
The underlying PROPERTIES of an object which a SimpleInspector is inspecting can be "volatile". This means that every time the SimpleInspector is called to update itself, it has to rebuild itself from scratch because the underlying object could have changed in significant ways. That's what you want to do.
What I suggest you do is make a subclass of SimpleInspector along these lines:
public class MySimpleInspector
{
public MySimpleInspector(Properties properties, GUIState state, String name, int maxProperties)
{ super(properties, state, name, maxProperties; }
public boolean needToRebuild(Object myObject)
{
// determine if the object has changed and so I need to rebuild
return true; // <--- change this
}
// this is largely stolen from SimpleInspector, look there to see
public void updateInspector()
{
if (needToRebuild(properties.getObject()))
{
remove(propertyList);
generateProperties(start);
doEnsuredRepaint(this);
}
else super.updateInspector();
}
}
The idea is that you don't want to force a rebuild from scratch every timestep, just when your agent changes his agentNames list or whatever it was.
Sean
|
|
|