> The Component object has style and also a user data dictionaries. This is a 
> nice way to couple extra data and properties with an object and each object 
> within a component graph can act as a scope, with its own 
> cascading/overriding properties. 
> 
> Are these dictionaries available for any arbitrary data?

Yes. As I mentioned in my previous email, you can also use the Sequence and 
Dictionary interface in your application classes. This promotes polymorphism 
throughout your code and also facilitates construction via BXML.

> I'm still working through the Pivot source but it does seem to be possible to 
> load and save the contents of these dictionaries from JSON files in a dynamic 
> fashion.

That's right - I had forgotten to mention that. If you use these interfaces in 
your model classes, you can also load and store your data using JSONSerializer.

> If these dictionaries were used for any configuration data desired is there 
> then also a way to have an override mechanism where if there is not what I 
> call a tweak value a default value would be used instead?

That would be up to your model. Generally, anything that you plan to 
deserialize (whether via BXML or JSON) should have a default value, which can 
be overridden via a call to a setter method (or a put() method, if you are 
implementing Dictionary). E.g.:

public class Foo {
    private int bar = 100;

    public int getBar() {
        return bar;
    }

    public void setBar(int bar) {
        this.bar = bar;
    }
}

In BXML, the following would create a Foo with the default "bar" value of 100:

<Foo/>

This would create a Foo with a "bar" value of 200:

<Foo bar="200"/>

> I'm very impressed with BXML. I'm a little reminded of Apache Digester but 
> BXML is much more powerful. I can see that there is potential to use BXML for 
> constructing object graphs other than the UI. Are there any examples along 
> these lines? For constructing a UI the Component Explorer provides a good 
> sample for me to look at.

Pretty much every demo and tutorial example uses BXML. But basically, any Java 
Bean object can be instantiated and populated via BXML. If you want to support 
creation of nested objects, you'll need to implement Sequence somewhere, and if 
you want to support dynamic keyed attributes, you'll implement Dictionary, but 
otherwise that's pretty much it.
 
> P.S. There should most definitely be a Pivot 2.0 book published and widely 
> promoted. I have a feeling many developers do not know about Pivot or have 
> not had the opportunity to take a closer look.

I tend to agree. In the meantime, please feel free to spread the word.  :-)


Reply via email to