pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Superstring Media <superstring.me...@gmail.com>
Subject Re: Dictionaries and BXML
Date Wed, 29 Sep 2010 07:46:04 GMT
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.

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?
Artifacts are things like scale ratio strings, rhythm duration strings or dynamic level strings.
The individual artifacts in an artifact file are like resources, similar to localization languages
like english or french except that they instead relate to the languages and vocabularies of

Once the ArtifactManager is created is it possible to reload each context with a different
artifact resource file at anytime? Do the context maps also need to implement the Bindable

If the above is possible then is it possible to bind the entries in any given context to alternate
UI components. These UI components would be browsers, editors, tables, etc. and it would not
be known which UI component will be used until it is enabled and made visible by a click on
a specific icon. What is the best way to bind the entries in a given context model to interchangeable
UI widgets?


On 2010-09-28, at 7:02 AM, Greg Brown wrote:

>> 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.  :-)

View raw message