> My application includes a ArtifactManager POJO that has different contexts > which would be instances of objects implementing the Dictionary interface. > The ArtifactManager would be created with a BXML file that would need to load > in the JSON artifact resource files that represent the last state of each > context. The last context states would be stored in/loaded from a JSON > configuration file associated with the ArtifactManager.
JSON is used in several contexts in a Pivot application: - For style declarations - For resource bundle definition - As a serialization format It sounds like you are describing the last case. If so, you'll probably want to take a look at JSONSerializer, which you can use to load and store arbitrary JSON data. > Each JSON KV in a artifact resource file would need to be a entry in a given > context. Does each entry need to be a bean object (like the StockQuote bean) > or can it just be a string? In code, you can use either typed (bean) values or untyped (dictionary) values. However, when read/written, your data will be mapped to the data types supported by JSON (String, Number, Boolean, Object, Array, and null). JSONSerializer will handle this for you. > Once the ArtifactManager is created is it possible to reload each context > with a different artifact resource file at anytime? Yes, though you'll probably need to provide a method in ArtifactManager to reload the data (for example, from a URL). > Do the context maps also need to implement the Bindable interface? No. BXML binding is used to map objects declared in BXML to member variables and provide notification that a root object has been initialized. It is generally a one-time operation that happens at application startup. It is different from data binding, which is used to automatically populate or extract data from a collection of UI elements. > If the above is possible then is it possible to bind the entries in any given > context to alternate UI components. Yes. > What is the best way to bind the entries in a given context model to > interchangeable UI widgets? Simply call load()/store() on the root container of each component hierarchy you want to bind to. G
