Determining global state

Subscribe to Determining global state 3 post(s), 2 voice(s)

Avatar Laurence Pas... 59 post(s)

What’s the preferred mechanism for determining the global state? I can’t see anything immediately obvious in the code that tries to track miscellaneous state and querying it. I’m not overly familiar with Java so I may be missing something obvious like simply declaring a public variable in the right class. Thanks.

Avatar Morgan Schweers Administrator 1,204 post(s)


I’m not quite sure what you’re looking for…

Generally, the way I track settings and such is through my JConfig.queryConfiguration and JConfig.setConfiguration methods.

That way settings are globally available, and can be seen and changed in the advanced configuration panel.

Does that help, or were you looking for something else?

— Morgan Schweers, Cyber*FOX*!

Avatar Laurence Pas... 59 post(s)

That’s what I was using to get round the problem but it doesn’t feel right to me.

I’m trying to implement an “only show selected rows” mechanism. It’s basically just a check box in addition to the “select” search string text box. If you do a select and the tick box is unchecked you get current behaviour of just highlighting matching rows. If the tick box is checked then all the unselected rows disappear (well that’s if I get it working).

Anyway, I’m not 100% convinced that the state of the tick box is really a cross-session attribute because if it’s active when you start JBW then, because no select has been attempted, all the auction rows would be unselected and so be suppressed – not great behaviour. If you move the selection behaviour to the configuration manager as a user preference instead then that works but you still have the same startup issues and you now need to track another per-session state as to whether a select has just been attempted (or reset by the user manually creating a new selection).

I can use the JConfig mechanism and simply ignore the stored value at startup easily enough but it just seems wrong that a run-time parameter needs to be read/written to/from a file on disk rather than just residing in memory.